diff --git a/patches/common/net/minecraft/src/Chunk.java.patch b/patches/common/net/minecraft/src/Chunk.java.patch index 87f15f3bc1..fc8ec7066e 100644 --- a/patches/common/net/minecraft/src/Chunk.java.patch +++ b/patches/common/net/minecraft/src/Chunk.java.patch @@ -164,16 +164,24 @@ ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4]; boolean var11 = false; -@@ -607,7 +705,7 @@ +@@ -607,9 +705,13 @@ { Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9); } - else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4) +- { +- this.worldObj.removeBlockTileEntity(var12, par2, var13); + else if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(var9)) - { - this.worldObj.removeBlockTileEntity(var12, par2, var13); ++ { ++ TileEntity te = worldObj.getBlockTileEntity(var12, par2, var13); ++ if (te != null && te.shouldRefresh(var8, par4, var9, par5, worldObj, var12, par2, var13)) ++ { ++ this.worldObj.removeBlockTileEntity(var12, par2, var13); ++ } } -@@ -627,7 +725,7 @@ + } + +@@ -627,7 +729,7 @@ } else { @@ -182,7 +190,7 @@ { if (par2 >= var7) { -@@ -651,29 +749,21 @@ +@@ -651,29 +753,21 @@ Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13); } @@ -215,7 +223,7 @@ } } -@@ -688,7 +778,7 @@ +@@ -688,7 +782,7 @@ */ public boolean setBlockMetadata(int par1, int par2, int par3, int par4) { @@ -224,7 +232,7 @@ if (var5 == null) { -@@ -708,7 +798,7 @@ +@@ -708,7 +802,7 @@ var5.setExtBlockMetadata(par1, par2 & 15, par3, par4); int var7 = var5.getExtBlockID(par1, par2 & 15, par3); @@ -233,7 +241,7 @@ { TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3); -@@ -729,7 +819,7 @@ +@@ -729,7 +823,7 @@ */ public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) { @@ -242,7 +250,7 @@ return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue)); } -@@ -739,6 +829,11 @@ +@@ -739,6 +833,11 @@ */ public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) { @@ -254,7 +262,7 @@ ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4]; if (var6 == null) -@@ -767,7 +862,7 @@ +@@ -767,7 +866,7 @@ */ public int getBlockLightValue(int par1, int par2, int par3, int par4) { @@ -263,7 +271,7 @@ if (var5 == null) { -@@ -820,7 +915,7 @@ +@@ -820,7 +919,7 @@ { var4 = this.entityLists.length - 1; } @@ -272,7 +280,7 @@ par1Entity.addedToChunk = true; par1Entity.chunkCoordX = this.xPosition; par1Entity.chunkCoordY = var4; -@@ -870,33 +965,33 @@ +@@ -870,33 +969,33 @@ ChunkPosition var4 = new ChunkPosition(par1, par2, par3); TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); @@ -317,7 +325,7 @@ } /** -@@ -911,7 +1006,7 @@ +@@ -911,7 +1010,7 @@ if (this.isChunkLoaded) { @@ -326,7 +334,7 @@ } } -@@ -926,8 +1021,14 @@ +@@ -926,8 +1025,14 @@ par4TileEntity.yCoord = par2; par4TileEntity.zCoord = this.zPosition * 16 + par3; @@ -343,7 +351,7 @@ par4TileEntity.validate(); this.chunkTileEntityMap.put(var5, par4TileEntity); } -@@ -963,6 +1064,7 @@ +@@ -963,6 +1068,7 @@ { this.worldObj.addLoadedEntities(this.entityLists[var1]); } @@ -351,7 +359,7 @@ } /** -@@ -983,6 +1085,7 @@ +@@ -983,6 +1089,7 @@ { this.worldObj.unloadEntities(this.entityLists[var3]); } @@ -359,7 +367,7 @@ } /** -@@ -999,8 +1102,8 @@ +@@ -999,8 +1106,8 @@ */ public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List) { @@ -370,7 +378,7 @@ if (var4 < 0) { -@@ -1047,8 +1150,8 @@ +@@ -1047,8 +1154,8 @@ */ public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) { @@ -381,7 +389,7 @@ if (var5 < 0) { -@@ -1231,6 +1334,15 @@ +@@ -1231,6 +1338,15 @@ */ public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) { @@ -397,7 +405,7 @@ int var5 = 0; int var6; -@@ -1327,12 +1439,26 @@ +@@ -1327,12 +1443,26 @@ } this.generateHeightMap(); @@ -430,7 +438,7 @@ } } -@@ -1441,4 +1567,18 @@ +@@ -1441,4 +1571,18 @@ } } } diff --git a/patches/common/net/minecraft/src/TileEntity.java.patch b/patches/common/net/minecraft/src/TileEntity.java.patch index 8777160c23..f41c4bfe07 100644 --- a/patches/common/net/minecraft/src/TileEntity.java.patch +++ b/patches/common/net/minecraft/src/TileEntity.java.patch @@ -1,6 +1,6 @@ --- ../src_base/common/net/minecraft/src/TileEntity.java +++ ../src_work/common/net/minecraft/src/TileEntity.java -@@ -287,4 +287,33 @@ +@@ -287,4 +287,52 @@ addMapping(TileEntityBeacon.class, "Beacon"); addMapping(TileEntitySkull.class, "Skull"); } @@ -32,5 +32,24 @@ + */ + public void onChunkUnload() + { ++ } ++ ++ /** ++ * Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes. ++ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. ++ * ++ * @param oldID The old ID of the block ++ * @param newID The new ID of the block (May be the same) ++ * @param oldMeta The old metadata of the block ++ * @param newMeta The new metadata of the block (May be the same) ++ * @param world Current world ++ * @param x X Postion ++ * @param y Y Position ++ * @param z Z Position ++ * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to} ++ */ ++ public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) ++ { ++ return true; + } }