Merge branch 'master' into 1.17
# Conflicts: # src/main/java/carpet/patches/EntityPlayerMPFake.java
This commit is contained in:
commit
60d4887302
2 files changed
+6
-2
No files matched your search
@@ -265,10 +265,12 @@ public class PlayerCommand
|
|||||||
() -> source.getWorld().getRegistryKey() // dimension.getType()
|
() -> source.getWorld().getRegistryKey() // dimension.getType()
|
||||||
);
|
);
|
||||||
GameMode mode = GameMode.CREATIVE;
|
GameMode mode = GameMode.CREATIVE;
|
||||||
|
boolean flying = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ServerPlayerEntity player = context.getSource().getPlayer();
|
ServerPlayerEntity player = context.getSource().getPlayer();
|
||||||
mode = player.interactionManager.getGameMode();
|
mode = player.interactionManager.getGameMode();
|
||||||
|
flying = player.abilities.flying;
|
||||||
}
|
}
|
||||||
catch (CommandSyntaxException ignored) {}
|
catch (CommandSyntaxException ignored) {}
|
||||||
String playerName = StringArgumentType.getString(context, "player");
|
String playerName = StringArgumentType.getString(context, "player");
|
||||||
@@ -284,7 +286,7 @@ public class PlayerCommand
|
|||||||
Messenger.m(context.getSource(), "rb Player "+playerName+" cannot be placed outside of the world");
|
Messenger.m(context.getSource(), "rb Player "+playerName+" cannot be placed outside of the world");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
PlayerEntity player = EntityPlayerMPFake.createFake(playerName, server, pos.x, pos.y, pos.z, facing.y, facing.x, dimType, mode);
|
PlayerEntity player = EntityPlayerMPFake.createFake(playerName, server, pos.x, pos.y, pos.z, facing.y, facing.x, dimType, mode, flying);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
Messenger.m(context.getSource(), "rb Player " + StringArgumentType.getString(context, "player") + " doesn't exist " +
|
Messenger.m(context.getSource(), "rb Player " + StringArgumentType.getString(context, "player") + " doesn't exist " +
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
|
|||||||
public Runnable fixStartingPosition = () -> {};
|
public Runnable fixStartingPosition = () -> {};
|
||||||
public boolean isAShadow;
|
public boolean isAShadow;
|
||||||
|
|
||||||
public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, RegistryKey<World> dimensionId, GameMode gamemode)
|
public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, RegistryKey<World> dimensionId, GameMode gamemode, boolean flying)
|
||||||
{
|
{
|
||||||
//prolly half of that crap is not necessary, but it works
|
//prolly half of that crap is not necessary, but it works
|
||||||
ServerWorld worldIn = server.getWorld(dimensionId);
|
ServerWorld worldIn = server.getWorld(dimensionId);
|
||||||
@@ -72,6 +72,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
|
|||||||
server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), dimensionId);//instance.dimension);
|
server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), dimensionId);//instance.dimension);
|
||||||
instance.getServerWorld().getChunkManager().updatePosition(instance);
|
instance.getServerWorld().getChunkManager().updatePosition(instance);
|
||||||
instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes)
|
instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes)
|
||||||
|
instance.abilities.flying = flying;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
|
|||||||
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.world.getRegistryKey());
|
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.world.getRegistryKey());
|
||||||
server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, playerShadow));
|
server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, playerShadow));
|
||||||
player.getServerWorld().getChunkManager().updatePosition(playerShadow);
|
player.getServerWorld().getChunkManager().updatePosition(playerShadow);
|
||||||
|
playerShadow.abilities.flying = player.abilities.flying;
|
||||||
return playerShadow;
|
return playerShadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user