Fix bounds checking on chunkcache. Should fix a bunch of rp2 and maybe other extended tile entity code
This commit is contained in:
parent
8e92472409
commit
2c8517f4d7
1 changed files with 33 additions and 0 deletions
33
patches/common/net/minecraft/src/ChunkCache.java.patch
Normal file
33
patches/common/net/minecraft/src/ChunkCache.java.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- ../src_base/common/net/minecraft/src/ChunkCache.java
|
||||
+++ ../src_work/common/net/minecraft/src/ChunkCache.java
|
||||
@@ -91,7 +91,15 @@
|
||||
{
|
||||
int var4 = (par1 >> 4) - this.chunkX;
|
||||
int var5 = (par3 >> 4) - this.chunkZ;
|
||||
- return this.chunkArray[var4][var5].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
|
||||
+ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length)
|
||||
+ {
|
||||
+ Chunk var6 = this.chunkArray[var4][var5];
|
||||
+ return var6 == null ? null : var6.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -239,7 +247,12 @@
|
||||
{
|
||||
int var4 = (par1 >> 4) - this.chunkX;
|
||||
int var5 = (par3 >> 4) - this.chunkZ;
|
||||
- return this.chunkArray[var4][var5].getBlockMetadata(par1 & 15, par2, par3 & 15);
|
||||
+ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length)
|
||||
+ {
|
||||
+ Chunk var6 = this.chunkArray[var4][var5];
|
||||
+ return var6 == null ? 0 : var6.getBlockMetadata(par1 & 15, par2, par3 & 15);
|
||||
+ }
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue