Fixed redwood tree growth
This commit is contained in:
parent
bf50843441
commit
c572546353
2 changed files with 124 additions and 167 deletions
|
@ -39,7 +39,7 @@ public class ColorizedLeavesRenderer implements ISimpleBlockRenderingHandler
|
|||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (metadata % 4 == 3 && renderer.hasOverrideBlockTexture())
|
||||
if (block == BOPCBlocks.colorizedLeaves2 && metadata % 4 == 3 && renderer.hasOverrideBlockTexture())
|
||||
{
|
||||
renderer.setOverrideBlockTexture(renderer.overrideBlockTexture);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
@ -49,7 +49,7 @@ public class ColorizedLeavesRenderer implements ISimpleBlockRenderingHandler
|
|||
{
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
if (metadata % 4 == 3)
|
||||
if (block == BOPCBlocks.colorizedLeaves2 && metadata % 4 == 3)
|
||||
{
|
||||
renderer.setOverrideBlockTexture(leavesBlock.floweringIcon);
|
||||
renderer.renderStandardBlock(Blocks.stone, x, y, z);
|
||||
|
|
|
@ -39,56 +39,14 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z)
|
||||
{
|
||||
int l = random.nextInt(this.randomTreeHeight) + this.minTreeHeight;
|
||||
boolean flag = true;
|
||||
int treeHeight = random.nextInt(this.randomTreeHeight) + this.minTreeHeight;
|
||||
|
||||
if (y >= 1 && y + l + 1 <= 256)
|
||||
if (y >= 1 && y + treeHeight + 1 <= 256)
|
||||
{
|
||||
byte b0;
|
||||
byte width;
|
||||
int k1;
|
||||
Block block;
|
||||
|
||||
for (int i1 = y; i1 <= y + 1 + l; ++i1)
|
||||
{
|
||||
b0 = 5;
|
||||
|
||||
if (i1 == y)
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
if (i1 >= y + 1 + l - 2)
|
||||
{
|
||||
b0 = 6;
|
||||
}
|
||||
|
||||
for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1)
|
||||
{
|
||||
for (k1 = z - b0; k1 <= z + b0 && flag; ++k1)
|
||||
{
|
||||
if (i1 >= 0 && i1 < 256)
|
||||
{
|
||||
block = world.getBlock(j1, i1, k1);
|
||||
|
||||
if (!this.isReplaceable(world, j1, i1, k1))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean isSoil = true;
|
||||
boolean hasSpace = true;
|
||||
|
||||
|
@ -108,7 +66,7 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
|
||||
for (int ix = -2; ix <= 2; ix++)
|
||||
{
|
||||
for (int iy = 0; iy <= l; iy++)
|
||||
for (int iy = 0; iy <= treeHeight; iy++)
|
||||
{
|
||||
for (int iz = -2; iz <= 2; iz++)
|
||||
{
|
||||
|
@ -123,7 +81,7 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
}
|
||||
}
|
||||
|
||||
if (isSoil && hasSpace && y < 256 - l - 1)
|
||||
if (isSoil && hasSpace && y < 256 - treeHeight - 1)
|
||||
{
|
||||
for (int ix = -2; ix <= 2; ix++)
|
||||
{
|
||||
|
@ -138,16 +96,16 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
}
|
||||
}
|
||||
|
||||
b0 = 9;
|
||||
width = 9;
|
||||
byte b1 = 0;
|
||||
int l1;
|
||||
int i2;
|
||||
int j2;
|
||||
int i3;
|
||||
|
||||
for (k1 = y - b0 + l; k1 <= y + l; ++k1)
|
||||
for (k1 = y - width + treeHeight; k1 <= y + treeHeight; ++k1)
|
||||
{
|
||||
i3 = k1 - (y + l);
|
||||
i3 = k1 - (y + treeHeight);
|
||||
l1 = b1 + 1 - i3 / 6;
|
||||
|
||||
for (i2 = x - l1; i2 <= x + l1; ++i2)
|
||||
|
@ -174,19 +132,19 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
}
|
||||
}
|
||||
|
||||
for (k1 = 0; k1 < l; ++k1)
|
||||
for (k1 = 0; k1 < treeHeight; ++k1)
|
||||
{
|
||||
block = world.getBlock(x, y + k1, z);
|
||||
|
||||
if (block.isAir(world, x, y + k1, z) || block.isLeaves(world, x, y + k1, z))
|
||||
{
|
||||
//1
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l + 1), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l + 2), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l + 3), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l + 4), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (l + 5), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight + 1), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight + 2), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight + 3), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight + 4), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + (treeHeight + 5), z, this.wood, this.woodMeta);
|
||||
this.setBlockAndNotifyAdequately(world, x, y + k1, z, this.wood, this.woodMeta);
|
||||
|
||||
//2
|
||||
|
@ -224,7 +182,6 @@ public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue