PlayerManager, PlayerProfileCache, ServerConfigurationManager, NetHandlerHandshakeTCP rejects fixed; ItemInWorldManager patch error fixed.
This commit is contained in:
parent
c976ec494e
commit
a8a69775a1
9 changed files with 124 additions and 184 deletions
|
@ -167,7 +167,7 @@
|
|||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = null;
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack);
|
||||
}
|
||||
|
||||
if (!player.isUsingItem())
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
p_72683_1_.managedPosX = p_72683_1_.posX;
|
||||
p_72683_1_.managedPosZ = p_72683_1_.posZ;
|
||||
+ // Load nearby chunks first
|
||||
+ List<ChunkCoordIntPair> chunkList = new ArrayList<ChunkCoordIntPair>();
|
||||
+ List<ChunkCoordIntPair> chunkList = Lists.newArrayList();
|
||||
|
||||
for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
|||
int i1 = this.playerViewRadius;
|
||||
int j1 = i - k;
|
||||
int k1 = j - l;
|
||||
+ List<ChunkCoordIntPair> chunksToLoad = new ArrayList<ChunkCoordIntPair>();
|
||||
+ List<ChunkCoordIntPair> chunksToLoad = Lists.newArrayList();
|
||||
|
||||
if (j1 != 0 || k1 != 0)
|
||||
{
|
||||
|
@ -176,7 +176,7 @@
|
|||
public void onUpdate()
|
||||
{
|
||||
if (this.numBlocksToUpdate != 0)
|
||||
@@ -441,7 +515,7 @@
|
||||
@@ -441,18 +515,19 @@
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos));
|
||||
|
||||
|
@ -185,3 +185,37 @@
|
|||
{
|
||||
this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos));
|
||||
}
|
||||
}
|
||||
- else if (this.numBlocksToUpdate == 64)
|
||||
+ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold)
|
||||
{
|
||||
int i1 = this.chunkCoords.chunkXPos * 16;
|
||||
int k1 = this.chunkCoords.chunkZPos * 16;
|
||||
this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate));
|
||||
|
||||
- for (int i2 = 0; i2 < 16; ++i2)
|
||||
+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones
|
||||
+ for (int i2 = 0; false && i2 < 16; ++i2)
|
||||
{
|
||||
if ((this.flagsYAreasToUpdate & 1 << i2) != 0)
|
||||
{
|
||||
@@ -469,7 +544,9 @@
|
||||
else
|
||||
{
|
||||
this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos)));
|
||||
-
|
||||
+ }
|
||||
+ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
|
||||
+ WorldServer world = PlayerManager.this.theWorldServer;
|
||||
for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1)
|
||||
{
|
||||
int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16;
|
||||
@@ -477,7 +554,7 @@
|
||||
int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16;
|
||||
BlockPos blockpos1 = new BlockPos(l1, j2, l2);
|
||||
|
||||
- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity())
|
||||
+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1)))
|
||||
{
|
||||
this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1));
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/management/PlayerProfileCache.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/management/PlayerProfileCache.java
|
||||
@@ -229,6 +229,20 @@
|
||||
{
|
||||
IOUtils.closeQuietly((Reader)bufferedreader);
|
||||
}
|
||||
+ }
|
||||
+ catch (FileNotFoundException filenotfoundexception)
|
||||
+ {
|
||||
+ ;
|
||||
+ }
|
||||
+ catch (com.google.gson.JsonParseException parsefail)
|
||||
+ {
|
||||
+ // No op - the cache can quietly rebuild if it's junk
|
||||
+ }
|
||||
+ finally
|
||||
+ {
|
||||
+ IOUtils.closeQuietly(bufferedreader);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_152658_c()
|
|
@ -92,11 +92,81 @@
|
|||
playerIn.triggerAchievement(StatList.leaveGameStat);
|
||||
this.writePlayerData(playerIn);
|
||||
WorldServer worldserver = playerIn.getServerForPlayer();
|
||||
@@ -495,17 +525,27 @@
|
||||
@@ -328,6 +358,7 @@
|
||||
this.uuidToPlayerMap.remove(uuid);
|
||||
this.playerStatFiles.remove(uuid);
|
||||
}
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount());
|
||||
|
||||
this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
|
||||
}
|
||||
@@ -411,13 +442,23 @@
|
||||
|
||||
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd)
|
||||
{
|
||||
+ World world = mcServer.worldServerForDimension(dimension);
|
||||
+ if (world == null)
|
||||
+ {
|
||||
+ dimension = 0;
|
||||
+ }
|
||||
+ else if (!world.provider.canRespawnHere())
|
||||
+ {
|
||||
+ dimension = world.provider.getRespawnDimension(playerIn);
|
||||
+ }
|
||||
+
|
||||
playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn);
|
||||
playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn);
|
||||
playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn);
|
||||
this.playerEntityList.remove(playerIn);
|
||||
this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn);
|
||||
- BlockPos blockpos = playerIn.getBedLocation();
|
||||
- boolean flag = playerIn.isSpawnForced();
|
||||
+ BlockPos blockpos = playerIn.getBedLocation(dimension);
|
||||
+ boolean flag = playerIn.isSpawnForced(dimension);
|
||||
playerIn.dimension = dimension;
|
||||
ItemInWorldManager iteminworldmanager;
|
||||
|
||||
@@ -433,6 +474,7 @@
|
||||
EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager);
|
||||
entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler;
|
||||
entityplayermp.clonePlayer(playerIn, conqueredEnd);
|
||||
+ entityplayermp.dimension = dimension;
|
||||
entityplayermp.setEntityId(playerIn.getEntityId());
|
||||
entityplayermp.func_174817_o(playerIn);
|
||||
WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
@@ -472,19 +514,25 @@
|
||||
this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp);
|
||||
entityplayermp.addSelfToInternalCraftingInventory();
|
||||
entityplayermp.setHealth(entityplayermp.getHealth());
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp);
|
||||
return entityplayermp;
|
||||
}
|
||||
|
||||
public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension)
|
||||
{
|
||||
+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter());
|
||||
+ }
|
||||
+
|
||||
+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter)
|
||||
+ {
|
||||
int i = playerIn.dimension;
|
||||
WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
playerIn.dimension = dimension;
|
||||
WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType()));
|
||||
+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType()));
|
||||
worldserver.removePlayerEntityDangerously(playerIn);
|
||||
playerIn.isDead = false;
|
||||
- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1);
|
||||
+ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter);
|
||||
this.func_72375_a(playerIn, worldserver);
|
||||
playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
|
||||
playerIn.theItemInWorldManager.setWorld(worldserver1);
|
||||
@@ -495,17 +543,27 @@
|
||||
{
|
||||
playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect));
|
||||
}
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension);
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension);
|
||||
}
|
||||
|
||||
public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
|
||||
|
@ -123,7 +193,7 @@
|
|||
{
|
||||
d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
|
||||
d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
|
||||
@@ -516,7 +556,7 @@
|
||||
@@ -516,7 +574,7 @@
|
||||
p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +202,7 @@
|
|||
{
|
||||
d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D);
|
||||
d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D);
|
||||
@@ -527,7 +567,8 @@
|
||||
@@ -527,7 +585,8 @@
|
||||
p_82448_3_.updateEntityWithOptionalForce(entityIn, false);
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +212,7 @@
|
|||
{
|
||||
BlockPos blockpos;
|
||||
|
||||
@@ -562,7 +603,7 @@
|
||||
@@ -562,7 +621,7 @@
|
||||
if (entityIn.isEntityAlive())
|
||||
{
|
||||
entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
public void processHandshake(C00Handshake packetIn)
|
||||
{
|
||||
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
|
||||
+
|
||||
switch (packetIn.getRequestedState())
|
||||
{
|
||||
case LOGIN:
|
|
@ -1,40 +0,0 @@
|
|||
++++ REJECTED PATCH 13
|
||||
{
|
||||
int i1;
|
||||
|
||||
- if (this.numBlocksToUpdate == 64)
|
||||
+ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold)
|
||||
{
|
||||
i = this.chunkCoords.chunkXPos * 16;
|
||||
j = this.chunkCoords.chunkZPos * 16;
|
||||
this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate));
|
||||
|
||||
- for (k = 0; k < 16; ++k)
|
||||
+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones
|
||||
+ for (k = 0; false && k < 16; ++k)
|
||||
{
|
||||
if ((this.flagsYAreasToUpdate & 1 << k) != 0)
|
||||
{
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 14
|
||||
else
|
||||
{
|
||||
this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos)));
|
||||
+ }
|
||||
|
||||
+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
|
||||
+ WorldServer world = PlayerManager.this.theWorldServer;
|
||||
for (i = 0; i < this.numBlocksToUpdate; ++i)
|
||||
{
|
||||
j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16;
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 15
|
||||
i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16;
|
||||
BlockPos blockpos1 = new BlockPos(j, k, i1);
|
||||
|
||||
- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity())
|
||||
+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1)))
|
||||
{
|
||||
this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1));
|
||||
}
|
||||
++++ END PATCH
|
|
@ -1,28 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
{
|
||||
List list = null;
|
||||
BufferedReader bufferedreader = null;
|
||||
- label64:
|
||||
{
|
||||
try
|
||||
{
|
||||
bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8);
|
||||
list = (List)this.gson.fromJson(bufferedreader, field_152666_h);
|
||||
- break label64;
|
||||
- }
|
||||
- catch (FileNotFoundException filenotfoundexception)
|
||||
- {
|
||||
- ;
|
||||
- }
|
||||
- finally
|
||||
- {
|
||||
- IOUtils.closeQuietly(bufferedreader);
|
||||
- }
|
||||
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
if (list != null)
|
||||
{
|
||||
this.field_152661_c.clear();
|
||||
++++ END PATCH
|
|
@ -1,74 +0,0 @@
|
|||
++++ REJECTED PATCH 9
|
||||
this.playerEntityList.remove(playerIn);
|
||||
this.uuidToPlayerMap.remove(playerIn.getUniqueID());
|
||||
this.playerStatFiles.remove(playerIn.getUniqueID());
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount());
|
||||
this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
|
||||
}
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 10
|
||||
|
||||
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd)
|
||||
{
|
||||
+ World world = mcServer.worldServerForDimension(dimension);
|
||||
+ if (world == null)
|
||||
+ {
|
||||
+ dimension = 0;
|
||||
+ }
|
||||
+ else if (!world.provider.canRespawnHere())
|
||||
+ {
|
||||
+ dimension = world.provider.getRespawnDimension(playerIn);
|
||||
+ }
|
||||
+
|
||||
playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn);
|
||||
playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn);
|
||||
playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn);
|
||||
this.playerEntityList.remove(playerIn);
|
||||
this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn);
|
||||
- BlockPos blockpos = playerIn.getBedLocation();
|
||||
- boolean flag1 = playerIn.isSpawnForced();
|
||||
+ BlockPos blockpos = playerIn.getBedLocation(dimension);
|
||||
+ boolean flag1 = playerIn.isSpawnForced(dimension);
|
||||
playerIn.dimension = dimension;
|
||||
Object object;
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 11
|
||||
EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object);
|
||||
entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler;
|
||||
entityplayermp1.clonePlayer(playerIn, conqueredEnd);
|
||||
+ entityplayermp1.dimension = dimension;
|
||||
entityplayermp1.setEntityId(playerIn.getEntityId());
|
||||
entityplayermp1.func_174817_o(playerIn);
|
||||
WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 12
|
||||
this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1);
|
||||
entityplayermp1.addSelfToInternalCraftingInventory();
|
||||
entityplayermp1.setHealth(entityplayermp1.getHealth());
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1);
|
||||
return entityplayermp1;
|
||||
}
|
||||
|
||||
public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension)
|
||||
{
|
||||
+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter());
|
||||
+ }
|
||||
+
|
||||
+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter)
|
||||
+ {
|
||||
int j = playerIn.dimension;
|
||||
WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
playerIn.dimension = dimension;
|
||||
WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension);
|
||||
- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType()));
|
||||
+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information
|
||||
worldserver.removePlayerEntityDangerously(playerIn);
|
||||
playerIn.isDead = false;
|
||||
- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1);
|
||||
+ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter);
|
||||
this.func_72375_a(playerIn, worldserver);
|
||||
playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
|
||||
playerIn.theItemInWorldManager.setWorld(worldserver1);
|
||||
++++ END PATCH
|
|
@ -1,10 +0,0 @@
|
|||
++++ REJECTED PATCH 1
|
||||
|
||||
public void processHandshake(C00Handshake packetIn)
|
||||
{
|
||||
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
|
||||
+
|
||||
switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()])
|
||||
{
|
||||
case 1:
|
||||
++++ END PATCH
|
Loading…
Reference in a new issue