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)) {
cycleAllRenderDistance(player);
}else {
removePlayer(player);
addPlayer(player);
// these 2 are called within recreatePlayerEntity
// 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);
for(int i = 0, l = curList.size(); i < l; ++i) {
EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i);
removePlayer(playerReload);
addPlayer(playerReload);
// these 2 are called within recreatePlayerEntity
// 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
*/
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().untrackEntity(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
@ -312,13 +315,21 @@ public class ServerConfigurationManager {
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), var4, var5);
if (var9 != null) {
if (teleport) {
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);
} else {
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);
@ -332,7 +343,9 @@ public class ServerConfigurationManager {
var9 = var8.getSpawnPoint();
var7.playerNetServerHandler.setPlayerLocation(var7.posX, var7.posY, var7.posZ, var7.rotationYaw,
var7.rotationPitch);
if (teleport) {
var7.playerNetServerHandler.sendPacket(new Packet6SpawnPosition(var9.posX, var9.posY, var9.posZ));
}
var7.playerNetServerHandler
.sendPacket(new Packet43Experience(var7.experience, var7.experienceTotal, var7.experienceLevel));
this.updateTimeAndWeatherForPlayer(var7, var8);