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:
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()
|
||||
{
|
||||
|
||||
@@ -37,6 +37,11 @@ public class ThreadValue extends Value
|
||||
return taskFuture.getNow(Value.NULL).getString();
|
||||
}
|
||||
|
||||
public Value getValue()
|
||||
{
|
||||
return taskFuture.getNow(Value.NULL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user