mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 21:20:12 +00:00
Add missing air checks to WorldGenTrees and ChunkCache Closes #593
This commit is contained in:
1 parent
b12872eed1
commit
be14c33ed1
2 files changed
+49
-7
No files matched your search
@@ -49,6 +49,17 @@
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,8 +338,8 @@
|
||||
*/
|
||||
public boolean isAirBlock(int par1, int par2, int par3)
|
||||
{
|
||||
- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)];
|
||||
- return block == null;
|
||||
+ int id = getBlockId(par1, par2, par3);
|
||||
+ return id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(this.worldObj, par1, par2, par3);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -449,4 +462,22 @@
|
||||
int i1 = this.getBlockId(par1, par2, par3);
|
||||
return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingStrongPower(this, par1, par2, par3, par4);
|
||||
|
||||
@@ -11,14 +11,15 @@
|
||||
|
||||
public class WorldGenTrees extends WorldGenerator
|
||||
{
|
||||
@@ -67,7 +69,13 @@
|
||||
@@ -67,7 +69,14 @@
|
||||
{
|
||||
k1 = par1World.getBlockId(l1, i1, j1);
|
||||
|
||||
- if (k1 != 0 && k1 != Block.leaves.blockID && k1 != Block.grass.blockID && k1 != Block.dirt.blockID && k1 != Block.wood.blockID)
|
||||
+ Block block = Block.blocksList[k1];
|
||||
+ boolean isAir = par1World.isAirBlock(l1, i1, j1);
|
||||
+
|
||||
+ if (k1 != 0 &&
|
||||
+ if (!isAir &&
|
||||
+ !block.isLeaves(par1World, l1, i1, j1) &&
|
||||
+ k1 != Block.grass.blockID &&
|
||||
+ k1 != Block.dirt.blockID &&
|
||||
@@ -26,7 +27,7 @@
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
@@ -87,10 +95,12 @@
|
||||
@@ -87,10 +96,12 @@
|
||||
else
|
||||
{
|
||||
i1 = par1World.getBlockId(par3, par4 - 1, par5);
|
||||
@@ -43,7 +44,7 @@
|
||||
b0 = 3;
|
||||
byte b1 = 0;
|
||||
int i2;
|
||||
@@ -113,8 +123,9 @@
|
||||
@@ -113,8 +124,9 @@
|
||||
if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || par2Random.nextInt(2) != 0 && k1 != 0)
|
||||
{
|
||||
int j3 = par1World.getBlockId(j2, j1, l2);
|
||||
@@ -55,7 +56,7 @@
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, j2, j1, l2, Block.leaves.blockID, this.metaLeaves);
|
||||
}
|
||||
@@ -127,7 +138,9 @@
|
||||
@@ -127,7 +139,9 @@
|
||||
{
|
||||
k1 = par1World.getBlockId(par3, par4 + j1, par5);
|
||||
|
||||
@@ -66,7 +67,7 @@
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.metaWood);
|
||||
|
||||
@@ -167,7 +180,8 @@
|
||||
@@ -167,24 +181,25 @@
|
||||
{
|
||||
for (k2 = par5 - i2; k2 <= par5 + i2; ++k2)
|
||||
{
|
||||
@@ -74,5 +75,35 @@
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(j2, j1, k2)];
|
||||
+ if (block != null && block.isLeaves(par1World, j2, j1, k2))
|
||||
{
|
||||
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0)
|
||||
- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0)
|
||||
+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 - 1, j1, k2))
|
||||
{
|
||||
this.growVines(par1World, j2 - 1, j1, k2, 8);
|
||||
}
|
||||
|
||||
- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 + 1, j1, k2) == 0)
|
||||
+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 + 1, j1, k2))
|
||||
{
|
||||
this.growVines(par1World, j2 + 1, j1, k2, 2);
|
||||
}
|
||||
|
||||
- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 - 1) == 0)
|
||||
+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 - 1))
|
||||
{
|
||||
this.growVines(par1World, j2, j1, k2 - 1, 1);
|
||||
}
|
||||
|
||||
- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 + 1) == 0)
|
||||
+ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 + 1))
|
||||
{
|
||||
this.growVines(par1World, j2, j1, k2 + 1, 4);
|
||||
}
|
||||
@@ -235,7 +250,7 @@
|
||||
{
|
||||
--par3;
|
||||
|
||||
- if (par1World.getBlockId(par2, par3, par4) != 0 || i1 <= 0)
|
||||
+ if (!par1World.isAirBlock(par2, par3, par4) || i1 <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user