Fix place blocks in entities bug

This commit is contained in:
ayunami2000 2022-08-22 12:07:32 -04:00
parent a74abf3d4b
commit bee66cacae
4 changed files with 11831 additions and 11813 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -90,8 +90,10 @@ public class PlayerManager {
if(player.mcServer.getServerOwner().equals(player.username)) { if(player.mcServer.getServerOwner().equals(player.username)) {
cycleAllRenderDistance(player); cycleAllRenderDistance(player);
}else { }else {
removePlayer(player); // these 2 are called within recreatePlayerEntity
addPlayer(player); // removePlayer(player);
player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, 0, true, false);
// addPlayer(player.playerNetServerHandler.playerEntity);
} }
} }
@ -101,8 +103,10 @@ public class PlayerManager {
curList.addAll(players); curList.addAll(players);
for(int i = 0, l = curList.size(); i < l; ++i) { for(int i = 0, l = curList.size(); i < l; ++i) {
EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i); EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i);
removePlayer(playerReload); // these 2 are called within recreatePlayerEntity
addPlayer(playerReload); // removePlayer(playerReload);
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, 0, true, false);
// addPlayer(playerReload.playerNetServerHandler.playerEntity);
} }
} }

View File

@ -286,6 +286,9 @@ public class ServerConfigurationManager {
* Called on respawn * Called on respawn
*/ */
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) {
return recreatePlayerEntity(par1EntityPlayerMP, par2, par3, false);
}
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3, boolean teleport) {
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
@ -312,14 +315,22 @@ public class ServerConfigurationManager {
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), var4, var5); this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), var4, var5);
if (var9 != null) { if (var9 != null) {
var7.setLocationAndAngles((double) ((float) var9.posX + 0.5F), (double) ((float) var9.posY + 0.1F), if (teleport) {
(double) ((float) var9.posZ + 0.5F), 0.0F, 0.0F); var7.setLocationAndAngles((double) ((float) var9.posX + 0.5F), (double) ((float) var9.posY + 0.1F),
(double) ((float) var9.posZ + 0.5F), 0.0F, 0.0F);
}
var7.setSpawnChunk(var4, var5); var7.setSpawnChunk(var4, var5);
} else { } else {
var7.playerNetServerHandler.sendPacket(new Packet70GameEvent(0, 0)); if (teleport) {
var7.playerNetServerHandler.sendPacket(new Packet70GameEvent(0, 0));
}
} }
} }
if (!teleport) {
var7.setLocationAndAngles(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
}
var8.theChunkProviderServer.loadChunk((int) var7.posX >> 4, (int) var7.posZ >> 4); var8.theChunkProviderServer.loadChunk((int) var7.posX >> 4, (int) var7.posZ >> 4);
while (!var8.getCollidingBoundingBoxes(var7, var7.boundingBox).isEmpty()) { while (!var8.getCollidingBoundingBoxes(var7, var7.boundingBox).isEmpty()) {
@ -332,7 +343,9 @@ public class ServerConfigurationManager {
var9 = var8.getSpawnPoint(); var9 = var8.getSpawnPoint();
var7.playerNetServerHandler.setPlayerLocation(var7.posX, var7.posY, var7.posZ, var7.rotationYaw, var7.playerNetServerHandler.setPlayerLocation(var7.posX, var7.posY, var7.posZ, var7.rotationYaw,
var7.rotationPitch); var7.rotationPitch);
var7.playerNetServerHandler.sendPacket(new Packet6SpawnPosition(var9.posX, var9.posY, var9.posZ)); if (teleport) {
var7.playerNetServerHandler.sendPacket(new Packet6SpawnPosition(var9.posX, var9.posY, var9.posZ));
}
var7.playerNetServerHandler var7.playerNetServerHandler
.sendPacket(new Packet43Experience(var7.experience, var7.experienceTotal, var7.experienceLevel)); .sendPacket(new Packet43Experience(var7.experience, var7.experienceTotal, var7.experienceLevel));
this.updateTimeAndWeatherForPlayer(var7, var8); this.updateTimeAndWeatherForPlayer(var7, var8);