fixed constant unnecessary render distance reloads

This commit is contained in:
LAX1DUDE 2022-08-22 23:14:41 -07:00
parent 0e11249c8e
commit 58c4a73ac2
5 changed files with 3764 additions and 3753 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -713,6 +713,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
*/ */
public void clonePlayer(EntityPlayer par1EntityPlayer, boolean par2) { public void clonePlayer(EntityPlayer par1EntityPlayer, boolean par2) {
super.clonePlayer(par1EntityPlayer, par2); super.clonePlayer(par1EntityPlayer, par2);
this.renderDistance = ((EntityPlayerMP)par1EntityPlayer).renderDistance;
this.lastExperience = -1; this.lastExperience = -1;
this.lastHealth = -1; this.lastHealth = -1;
this.lastFoodLevel = -1; this.lastFoodLevel = -1;

View File

@ -469,7 +469,7 @@ public class EntityTrackerEntry {
public void removeTrackedPlayerSymmetric(EntityPlayerMP par1EntityPlayerMP) { public void removeTrackedPlayerSymmetric(EntityPlayerMP par1EntityPlayerMP) {
if (this.trackingPlayers.contains(par1EntityPlayerMP)) { if (this.trackingPlayers.contains(par1EntityPlayerMP)) {
this.trackingPlayers.remove(par1EntityPlayerMP); this.trackingPlayers.remove(par1EntityPlayerMP);
System.out.println(this.trackedEntity.getEntityName() + ": removeTrackedPlayerSymmetric"); //System.out.println(this.trackedEntity.getEntityName() + ": removeTrackedPlayerSymmetric");
par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.trackedEntity.entityId)); par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.trackedEntity.entityId));
} }
} }

View File

@ -90,23 +90,32 @@ public class PlayerManager {
if(player.mcServer.getServerOwner().equals(player.username)) { if(player.mcServer.getServerOwner().equals(player.username)) {
cycleAllRenderDistance(player); cycleAllRenderDistance(player);
}else { }else {
// these 2 are called within recreatePlayerEntity if(player.lastRenderDistance != player.renderDistance) {
// removePlayer(player); // these 2 are called within recreatePlayerEntity
player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, 0, true, false); // removePlayer(player);
// addPlayer(player.playerNetServerHandler.playerEntity); player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, 0, true, false);
player = player.playerNetServerHandler.playerEntity;
player.lastRenderDistance = player.renderDistance;
// addPlayer(player.playerNetServerHandler.playerEntity);
}
} }
} }
public void cycleAllRenderDistance(EntityPlayerMP player) { public void cycleAllRenderDistance(EntityPlayerMP player) {
player.mcServer.getConfigurationManager().viewDistance = player.renderDistance; if(player.lastRenderDistance != player.renderDistance) {
List curList = new ArrayList(); player.mcServer.getConfigurationManager().viewDistance = player.renderDistance;
curList.addAll(players); player.lastRenderDistance = player.renderDistance;
for(int i = 0, l = curList.size(); i < l; ++i) { List curList = new ArrayList();
EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i); curList.addAll(players);
// these 2 are called within recreatePlayerEntity for(int i = 0, l = curList.size(); i < l; ++i) {
// removePlayer(playerReload); EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i);
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, 0, true, false); // these 2 are called within recreatePlayerEntity
// addPlayer(playerReload.playerNetServerHandler.playerEntity); // removePlayer(playerReload);
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, 0, true, false);
playerReload = playerReload.playerNetServerHandler.playerEntity;
playerReload.lastRenderDistance = playerReload.renderDistance;
// addPlayer(playerReload.playerNetServerHandler.playerEntity);
}
} }
} }