diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index bd12b0ca..020698cc 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -23,6 +23,7 @@ import carpet.utils.Messenger; public class EntityPlayerMPFake extends ServerPlayerEntity { public Runnable fixStartingPosition = () -> {}; + public boolean isAShadow; public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, DimensionType dimension, GameMode gamemode) { @@ -38,7 +39,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity { gameprofile = SkullBlockEntity.loadProperties(gameprofile); } - EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn); + EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, false); instance.fixStartingPosition = () -> instance.refreshPositionAndAngles(d0, d1, d2, (float) yaw, (float) pitch); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), instance); if (instance.dimension != dimension) //player was logged in in a different dimension @@ -73,7 +74,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity ServerWorld worldIn = server.getWorld(player.dimension); ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn); GameProfile gameprofile = player.getGameProfile(); - EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn); + EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, true); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), playerShadow); playerShadow.setHealth(player.getHealth()); @@ -90,9 +91,10 @@ public class EntityPlayerMPFake extends ServerPlayerEntity return playerShadow; } - private EntityPlayerMPFake(MinecraftServer server, ServerWorld worldIn, GameProfile profile, ServerPlayerInteractionManager interactionManagerIn) + private EntityPlayerMPFake(MinecraftServer server, ServerWorld worldIn, GameProfile profile, ServerPlayerInteractionManager interactionManagerIn, boolean shadow) { super(server, worldIn, profile, interactionManagerIn); + isAShadow = shadow; } diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index a579512b..4990c1b4 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -155,6 +155,7 @@ public class CarpetExpression private final Expression expr; Expression getExpr() {return expr;} private static long tickStart = 0L; + // dummy entity for dummy requirements in the loot tables (see snowball) private static FallingBlockEntity DUMMY_ENTITY = new FallingBlockEntity(EntityType.FALLING_BLOCK, null); private static boolean stopAll = false; @@ -2157,6 +2158,17 @@ public class CarpetExpression *
String with gamemode, or null if not a player.
query(e,'gamemode_id')Good'ol gamemode id, or null if not a player.
+ *query(e,'player_type')Returns null if the argument is not a player, otherwise:
singleplayer: for singleplayer gamemultiplayer: for players on a dedicated serverlan_host: for singleplayer owner that opened the game to LANlan_player: for all other players that connected to a LAN hostfake: any carpet-spanwed fake playershadow: any carpet-shadowed real playerrealms: ?query(e,'permission_level')Player's permission level, or null if not applicable for this entity.