81 lines
3.3 KiB
Diff
81 lines
3.3 KiB
Diff
--- ../src_base/minecraft/net/minecraft/server/management/PlayerInstance.java
|
|
+++ ../src_work/minecraft/net/minecraft/server/management/PlayerInstance.java
|
|
@@ -1,6 +1,7 @@
|
|
package net.minecraft.server.management;
|
|
|
|
import java.util.ArrayList;
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
|
import net.minecraft.network.packet.Packet;
|
|
@@ -9,6 +10,9 @@
|
|
import net.minecraft.network.packet.Packet53BlockChange;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.world.ChunkCoordIntPair;
|
|
+import net.minecraftforge.common.ForgeDummyContainer;
|
|
+import net.minecraftforge.common.MinecraftForge;
|
|
+import net.minecraftforge.event.world.ChunkWatchEvent;
|
|
|
|
public class PlayerInstance
|
|
{
|
|
@@ -64,6 +68,8 @@
|
|
this.players.remove(par1EntityPlayerMP);
|
|
par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation);
|
|
|
|
+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));
|
|
+
|
|
if (this.players.isEmpty())
|
|
{
|
|
long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32;
|
|
@@ -91,7 +97,7 @@
|
|
|
|
this.field_73260_f |= 1 << (par2 >> 4);
|
|
|
|
- if (this.numBlocksToUpdate < 64)
|
|
+ //if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run
|
|
{
|
|
short short1 = (short)(par1 << 12 | par3 << 8 | par2);
|
|
|
|
@@ -103,6 +109,10 @@
|
|
}
|
|
}
|
|
|
|
+ if (numBlocksToUpdate == blocksToUpdate.length)
|
|
+ {
|
|
+ blocksToUpdate = Arrays.copyOf(blocksToUpdate, blocksToUpdate.length << 1);
|
|
+ }
|
|
this.blocksToUpdate[this.numBlocksToUpdate++] = short1;
|
|
}
|
|
}
|
|
@@ -147,12 +157,13 @@
|
|
{
|
|
int l;
|
|
|
|
- if (this.numBlocksToUpdate == 64)
|
|
+ if (this.numBlocksToUpdate >= ForgeDummyContainer.clumpingThreshold)
|
|
{
|
|
i = this.chunkLocation.chunkXPos * 16;
|
|
j = this.chunkLocation.chunkZPos * 16;
|
|
this.sendPacketToPlayersInInstance(new Packet51MapChunk(PlayerManager.getWorldServer(this.myManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.field_73260_f));
|
|
|
|
+ /* Forge: Grabings ALL tile entities is costly on a modded server, only send needed ones
|
|
for (k = 0; k < 16; ++k)
|
|
{
|
|
if ((this.field_73260_f & 1 << k) != 0)
|
|
@@ -166,11 +177,15 @@
|
|
}
|
|
}
|
|
}
|
|
+ */
|
|
}
|
|
else
|
|
{
|
|
this.sendPacketToPlayersInInstance(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.blocksToUpdate, this.numBlocksToUpdate, PlayerManager.getWorldServer(this.myManager)));
|
|
|
|
+ }
|
|
+
|
|
+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
|
|
for (i = 0; i < this.numBlocksToUpdate; ++i)
|
|
{
|
|
j = this.chunkLocation.chunkXPos * 16 + (this.blocksToUpdate[i] >> 12 & 15);
|