All pastes #2086113 Raw Edit

Someone

public text v1 · immutable
#2086113 ·published 2011-10-01 19:06 UTC
rendered paste body
diff -r 6daed187642a minecraft/net/minecraft/src/Chunk.java
--- a/minecraft/net/minecraft/src/Chunk.java	Sat Oct 01 20:56:53 2011 +0200
+++ b/minecraft/net/minecraft/src/Chunk.java	Sat Oct 01 21:00:11 2011 +0200
@@ -39,10 +39,25 @@
 

         Arrays.fill(field_35845_c, -999);

     }

-

+    

+    public void ReUseChunk(World world, int i, int j)

+    {

+    	isTerrainPopulated = false;

+        isModified = false;

+        hasEntities = false;

+        lastSaveTime = 0L;

+        worldObj = world;

+    	xPosition = i;

+        zPosition = j;

+    }

+    

     public Chunk(World world, byte abyte0[], int i, int j)

     {

         this(world, i, j);

+		if (abyte0 == null) 

+		{

+			abyte0 = new byte[32768];

+		}

         blocks = abyte0;

         world.getClass();

         data = new NibbleArray(abyte0.length, 7);

@@ -51,7 +66,28 @@
         world.getClass();

         blocklightMap = new NibbleArray(abyte0.length, 7);

     }

-

+    

+    public void ReUseChunk(World world, byte abyte0[], int i, int j)

+    {

+    	ReUseChunk(world, i, j);

+    	if (abyte0 == null)

+		{

+			abyte0 = new byte[32768];

+		}

+    	

+    	if (blocks==null)

+    	{

+	        blocks = abyte0;

+	        data = new NibbleArray(abyte0.length, 7);

+	        skylightMap = new NibbleArray(abyte0.length, 7);

+	        blocklightMap = new NibbleArray(abyte0.length, 7);

+    	}

+    	else

+    	{

+    		blocks = abyte0;

+    	}

+    }

+    

     public boolean isAtLocation(int i, int j)

     {

         return i == xPosition && j == zPosition;

@@ -686,6 +722,8 @@
         {

             worldObj.unloadEntities(entities[i]);

         }

+        

+        FreeChunkList.instance.Chunklist.push(this);

 

     }

 

@@ -916,8 +954,8 @@
     public NibbleArray blocklightMap;

     public byte heightMap[];

     public int lowestBlockHeight;

-    public final int xPosition;

-    public final int zPosition;

+    public int xPosition;

+    public int zPosition;

     public Map chunkTileEntityMap;

     public List entities[];

     public boolean isTerrainPopulated;

diff -r 6daed187642a minecraft/net/minecraft/src/ChunkProviderClient.java
--- a/minecraft/net/minecraft/src/ChunkProviderClient.java	Sat Oct 01 20:56:53 2011 +0200
+++ b/minecraft/net/minecraft/src/ChunkProviderClient.java	Sat Oct 01 21:00:11 2011 +0200
@@ -48,8 +48,7 @@
     public Chunk loadChunk(int i, int j)

     {

         worldObj.getClass();

-        byte abyte0[] = new byte[256 * 128];

-        Chunk chunk = new Chunk(worldObj, abyte0, i, j);

+        Chunk chunk = FreeChunkList.instance.GetFreeChunk(worldObj, null, i, j);

         Arrays.fill(chunk.skylightMap.data, (byte)-1);

         chunkMapping.func_35577_a(ChunkCoordIntPair.chunkXZ2Int(i, j), chunk);

         chunk.isChunkLoaded = true;

@@ -89,7 +88,7 @@
 

     public String makeString()

     {

-        return (new StringBuilder()).append("MultiplayerChunkCache: ").append(chunkMapping.func_35576_a()).toString();

+        return (new StringBuilder()).append("MultiplayerChunkCache: ").append(chunkMapping.func_35576_a()).append(" Drop: ").append(FreeChunkList.instance.Chunklist.size()).toString();

     }

 

     private Chunk blankChunk;