FIXED FIXED FIIIIIXED RENDER DISTANCE BS
This commit is contained in:
parent
04bd7edcc6
commit
d1daef0c41
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -188,7 +188,7 @@ public class NetServerHandler extends NetHandler {
|
||||||
this.playerEntity.ridingEntity.updateRiderPosition();
|
this.playerEntity.ridingEntity.updateRiderPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playerEntity = this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||||
this.lastPosX = this.playerEntity.posX;
|
this.lastPosX = this.playerEntity.posX;
|
||||||
this.lastPosY = this.playerEntity.posY;
|
this.lastPosY = this.playerEntity.posY;
|
||||||
this.lastPosZ = this.playerEntity.posZ;
|
this.lastPosZ = this.playerEntity.posZ;
|
||||||
|
@ -329,7 +329,7 @@ public class NetServerHandler extends NetHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
||||||
this.playerEntity = this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||||
this.playerEntity.handleFalling(this.playerEntity.posY - var3, par1Packet10Flying.onGround);
|
this.playerEntity.handleFalling(this.playerEntity.posY - var3, par1Packet10Flying.onGround);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,16 +86,14 @@ public class PlayerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayerMP cycleRenderDistance(EntityPlayerMP player) {
|
public void cycleRenderDistance(EntityPlayerMP player) {
|
||||||
if(player.lastRenderDistance != player.renderDistance) {
|
if(player.lastRenderDistance != player.renderDistance) {
|
||||||
player.lastRenderDistance = player.renderDistance;
|
player.lastRenderDistance = player.renderDistance;
|
||||||
player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, player.dimension, true, false);
|
player.mcServer.getConfigurationManager().updateOnRenderDistanceChange(player);
|
||||||
player = player.playerNetServerHandler.playerEntity;
|
|
||||||
}
|
}
|
||||||
if(player.mcServer.getServerOwner().equals(player.username)) {
|
if(player.mcServer.getServerOwner().equals(player.username)) {
|
||||||
cycleAllRenderDistance(player);
|
cycleAllRenderDistance(player);
|
||||||
}
|
}
|
||||||
return player;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cycleAllRenderDistance(EntityPlayerMP player) {
|
public void cycleAllRenderDistance(EntityPlayerMP player) {
|
||||||
|
@ -110,8 +108,7 @@ public class PlayerManager {
|
||||||
int targetRenderDist = player.renderDistance > limited ? limited : player.renderDistance;
|
int targetRenderDist = player.renderDistance > limited ? limited : player.renderDistance;
|
||||||
if (playerReload.renderDistance != targetRenderDist) {
|
if (playerReload.renderDistance != targetRenderDist) {
|
||||||
playerReload.lastRenderDistance = playerReload.renderDistance = targetRenderDist;
|
playerReload.lastRenderDistance = playerReload.renderDistance = targetRenderDist;
|
||||||
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, playerReload.dimension, true, false);
|
playerReload.mcServer.getConfigurationManager().updateOnRenderDistanceChange(playerReload);
|
||||||
// playerReload = playerReload.playerNetServerHandler.playerEntity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,16 +135,16 @@ public class PlayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.players.add(par1EntityPlayerMP);
|
this.players.add(par1EntityPlayerMP);
|
||||||
this.filterChunkLoadQueue(par1EntityPlayerMP); // above, it sets lastRenderDistance to renderDistance, meaning this never recreates the player.
|
this.filterChunkLoadQueue(par1EntityPlayerMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all chunks from the given player's chunk load queue that are not in
|
* Removes all chunks from the given player's chunk load queue that are not in
|
||||||
* viewing range of the player.
|
* viewing range of the player.
|
||||||
*/
|
*/
|
||||||
public EntityPlayerMP filterChunkLoadQueue(EntityPlayerMP par1EntityPlayerMP) {
|
public void filterChunkLoadQueue(EntityPlayerMP par1EntityPlayerMP) {
|
||||||
if(par1EntityPlayerMP.lastRenderDistance != par1EntityPlayerMP.renderDistance) {
|
if(par1EntityPlayerMP.lastRenderDistance != par1EntityPlayerMP.renderDistance) {
|
||||||
par1EntityPlayerMP = cycleRenderDistance(par1EntityPlayerMP);
|
cycleRenderDistance(par1EntityPlayerMP);
|
||||||
}
|
}
|
||||||
ArrayList var2 = new ArrayList(par1EntityPlayerMP.loadedChunks);
|
ArrayList var2 = new ArrayList(par1EntityPlayerMP.loadedChunks);
|
||||||
int var3 = 0;
|
int var3 = 0;
|
||||||
|
@ -192,7 +189,6 @@ public class PlayerManager {
|
||||||
par1EntityPlayerMP.loadedChunks.add(var9);
|
par1EntityPlayerMP.loadedChunks.add(var9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return par1EntityPlayerMP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,9 +224,9 @@ public class PlayerManager {
|
||||||
/**
|
/**
|
||||||
* update chunks around a player being moved by server logic (e.g. cart, boat)
|
* update chunks around a player being moved by server logic (e.g. cart, boat)
|
||||||
*/
|
*/
|
||||||
public EntityPlayerMP updateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
public void updateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
||||||
if(par1EntityPlayerMP.renderDistance != par1EntityPlayerMP.lastRenderDistance) {
|
if(par1EntityPlayerMP.renderDistance != par1EntityPlayerMP.lastRenderDistance) {
|
||||||
par1EntityPlayerMP = cycleRenderDistance(par1EntityPlayerMP);
|
cycleRenderDistance(par1EntityPlayerMP);
|
||||||
}
|
}
|
||||||
int var2 = (int) par1EntityPlayerMP.posX >> 4;
|
int var2 = (int) par1EntityPlayerMP.posX >> 4;
|
||||||
int var3 = (int) par1EntityPlayerMP.posZ >> 4;
|
int var3 = (int) par1EntityPlayerMP.posZ >> 4;
|
||||||
|
@ -262,12 +258,11 @@ public class PlayerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
par1EntityPlayerMP = this.filterChunkLoadQueue(par1EntityPlayerMP);
|
this.filterChunkLoadQueue(par1EntityPlayerMP);
|
||||||
par1EntityPlayerMP.managedPosX = par1EntityPlayerMP.posX;
|
par1EntityPlayerMP.managedPosX = par1EntityPlayerMP.posX;
|
||||||
par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ;
|
par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return par1EntityPlayerMP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerWatchingChunk(EntityPlayerMP par1EntityPlayerMP, int par2, int par3) {
|
public boolean isPlayerWatchingChunk(EntityPlayerMP par1EntityPlayerMP, int par2, int par3) {
|
||||||
|
|
|
@ -213,8 +213,8 @@ public class ServerConfigurationManager {
|
||||||
* using player's dimension, update their movement when in a vehicle (e.g. cart,
|
* using player's dimension, update their movement when in a vehicle (e.g. cart,
|
||||||
* boat)
|
* boat)
|
||||||
*/
|
*/
|
||||||
public EntityPlayerMP serverUpdateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
public void serverUpdateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
||||||
return par1EntityPlayerMP.getServerForPlayer().getPlayerManager().updateMountedMovingPlayer(par1EntityPlayerMP);
|
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().updateMountedMovingPlayer(par1EntityPlayerMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -289,23 +289,46 @@ public class ServerConfigurationManager {
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP, true);
|
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP, true);
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, true);
|
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, true);
|
||||||
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
|
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
|
||||||
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().addPlayer(par1EntityPlayerMP);
|
this.playerEntityList.remove(par1EntityPlayerMP);
|
||||||
for (Object loadedChunk : par1EntityPlayerMP.loadedChunks) {
|
|
||||||
Chunk chunk = (Chunk) loadedChunk;
|
WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().func_85172_a(par1EntityPlayerMP, chunk);
|
|
||||||
|
par1EntityPlayerMP.setLocationAndAngles(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
|
||||||
|
|
||||||
|
var8.theChunkProviderServer.loadChunk((int) par1EntityPlayerMP.posX >> 4, (int) par1EntityPlayerMP.posZ >> 4);
|
||||||
|
|
||||||
|
// see https://wiki.vg/index.php?title=Protocol&oldid=1092
|
||||||
|
// footnotes of packet Respawn (0x09)
|
||||||
|
par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(((par1EntityPlayerMP.dimension + 2) % 3) - 1,
|
||||||
|
(byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(),
|
||||||
|
par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
|
||||||
|
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw,
|
||||||
|
par1EntityPlayerMP.rotationPitch);
|
||||||
|
par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(par1EntityPlayerMP.dimension,
|
||||||
|
(byte) par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(),
|
||||||
|
par1EntityPlayerMP.worldObj.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
|
||||||
|
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw,
|
||||||
|
par1EntityPlayerMP.rotationPitch);
|
||||||
|
this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, var8);
|
||||||
|
this.syncPlayerInventory(par1EntityPlayerMP);
|
||||||
|
Iterator var6 = par1EntityPlayerMP.getActivePotionEffects().iterator();
|
||||||
|
|
||||||
|
while (var6.hasNext()) {
|
||||||
|
PotionEffect var7 = (PotionEffect) var6.next();
|
||||||
|
par1EntityPlayerMP.playerNetServerHandler
|
||||||
|
.sendPacket(new Packet41EntityEffect(par1EntityPlayerMP.entityId, var7));
|
||||||
}
|
}
|
||||||
|
var8.getPlayerManager().addPlayer(par1EntityPlayerMP);
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().trackEntity(par1EntityPlayerMP);
|
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().trackEntity(par1EntityPlayerMP);
|
||||||
|
this.playerEntityList.add(par1EntityPlayerMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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, true);
|
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP);
|
||||||
}
|
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP);
|
||||||
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3, boolean teleport) {
|
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP, !teleport);
|
|
||||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, !teleport);
|
|
||||||
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
|
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
|
||||||
this.playerEntityList.remove(par1EntityPlayerMP);
|
this.playerEntityList.remove(par1EntityPlayerMP);
|
||||||
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension)
|
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension)
|
||||||
|
@ -322,9 +345,6 @@ public class ServerConfigurationManager {
|
||||||
var7.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler;
|
var7.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler;
|
||||||
var7.clonePlayer(par1EntityPlayerMP, par3);
|
var7.clonePlayer(par1EntityPlayerMP, par3);
|
||||||
var7.entityId = par1EntityPlayerMP.entityId;
|
var7.entityId = par1EntityPlayerMP.entityId;
|
||||||
if (!teleport) {
|
|
||||||
var7.capabilities = par1EntityPlayerMP.capabilities;
|
|
||||||
}
|
|
||||||
WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
|
WorldServer var8 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
|
||||||
this.func_72381_a(var7, par1EntityPlayerMP, var8);
|
this.func_72381_a(var7, par1EntityPlayerMP, var8);
|
||||||
ChunkCoordinates var9;
|
ChunkCoordinates var9;
|
||||||
|
@ -334,48 +354,27 @@ public class ServerConfigurationManager {
|
||||||
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), var4, var5);
|
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), var4, var5);
|
||||||
|
|
||||||
if (var9 != null) {
|
if (var9 != null) {
|
||||||
if (teleport) {
|
var7.setLocationAndAngles((double) ((float) var9.posX + 0.5F), (double) ((float) var9.posY + 0.1F),
|
||||||
var7.setLocationAndAngles((double) ((float) var9.posX + 0.5F), (double) ((float) var9.posY + 0.1F),
|
(double) ((float) var9.posZ + 0.5F), 0.0F, 0.0F);
|
||||||
(double) ((float) var9.posZ + 0.5F), 0.0F, 0.0F);
|
|
||||||
}
|
|
||||||
var7.setSpawnChunk(var4, var5);
|
var7.setSpawnChunk(var4, var5);
|
||||||
} else {
|
} else {
|
||||||
if (teleport) {
|
var7.playerNetServerHandler.sendPacket(new Packet70GameEvent(0, 0));
|
||||||
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);
|
||||||
|
|
||||||
if (teleport) {
|
while (!var8.getCollidingBoundingBoxes(var7, var7.boundingBox).isEmpty()) {
|
||||||
while (!var8.getCollidingBoundingBoxes(var7, var7.boundingBox).isEmpty()) {
|
var7.setPosition(var7.posX, var7.posY + 1.0D, var7.posZ);
|
||||||
var7.setPosition(var7.posX, var7.posY + 1.0D, var7.posZ);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startDim != par2) {
|
|
||||||
// see https://wiki.vg/index.php?title=Protocol&oldid=1092
|
|
||||||
// footnotes of packet Respawn (0x09)
|
|
||||||
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(((var7.dimension + 2) % 3) - 1,
|
|
||||||
(byte) var7.worldObj.difficultySetting, var7.worldObj.getWorldInfo().getTerrainType(),
|
|
||||||
var7.worldObj.getHeight(), var7.theItemInWorldManager.getGameType()));
|
|
||||||
var7.playerNetServerHandler.setPlayerLocation(var7.posX, var7.posY, var7.posZ, var7.rotationYaw,
|
|
||||||
var7.rotationPitch);
|
|
||||||
}
|
|
||||||
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(var7.dimension,
|
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(var7.dimension,
|
||||||
(byte) var7.worldObj.difficultySetting, var7.worldObj.getWorldInfo().getTerrainType(),
|
(byte) var7.worldObj.difficultySetting, var7.worldObj.getWorldInfo().getTerrainType(),
|
||||||
var7.worldObj.getHeight(), var7.theItemInWorldManager.getGameType()));
|
var7.worldObj.getHeight(), var7.theItemInWorldManager.getGameType()));
|
||||||
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);
|
||||||
if (teleport) {
|
var7.playerNetServerHandler.sendPacket(new Packet6SpawnPosition(var9.posX, var9.posY, var9.posZ));
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user