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) {
super.clonePlayer(par1EntityPlayer, par2);
this.renderDistance = ((EntityPlayerMP)par1EntityPlayer).renderDistance;
this.lastExperience = -1;
this.lastHealth = -1;
this.lastFoodLevel = -1;

View File

@ -469,7 +469,7 @@ public class EntityTrackerEntry {
public void removeTrackedPlayerSymmetric(EntityPlayerMP par1EntityPlayerMP) {
if (this.trackingPlayers.contains(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));
}
}

View File

@ -90,15 +90,21 @@ public class PlayerManager {
if(player.mcServer.getServerOwner().equals(player.username)) {
cycleAllRenderDistance(player);
}else {
if(player.lastRenderDistance != player.renderDistance) {
// these 2 are called within recreatePlayerEntity
// removePlayer(player);
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) {
if(player.lastRenderDistance != player.renderDistance) {
player.mcServer.getConfigurationManager().viewDistance = player.renderDistance;
player.lastRenderDistance = player.renderDistance;
List curList = new ArrayList();
curList.addAll(players);
for(int i = 0, l = curList.size(); i < l; ++i) {
@ -106,9 +112,12 @@ public class PlayerManager {
// these 2 are called within recreatePlayerEntity
// 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);
}
}
}
/**
* Adds an EntityPlayerMP to the PlayerManager.