Merge branch 'master' into 1.15

# Conflicts:
#	src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java
#	src/main/java/carpet/script/CarpetExpression.java
#	src/main/resources/carpet.mixins.json
This commit is contained in:
gnembon committed 2019-12-27 11:26:49 -04:00
commit e9e36f64a3
14 files changed
+321 -16

No files matched your search

@@ -29,6 +29,7 @@ import net.minecraft.entity.mob.MobEntityWithAi;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
@@ -93,6 +94,25 @@ public class EntityValue extends Value
return entity;
}
public static ServerPlayerEntity getPlayerByValue(MinecraftServer server, Value value)
{
ServerPlayerEntity player = null;
if (value instanceof EntityValue)
{
Entity e = ((EntityValue) value).getEntity();
if (e instanceof ServerPlayerEntity)
{
player = (ServerPlayerEntity) e;
}
}
else
{
String playerName = value.getString();
player = server.getPlayerManager().getPlayer(playerName);
}
return player;
}
@Override
public String getString()
{