Fixed fancy/fast graphic on leaves.
Added decay to them - apple leaves always decay, even when placed by players (intentional).
This commit is contained in:
parent
2051109dd9
commit
5a8adb1dc8
6 changed files with 503 additions and 18 deletions
|
@ -26,6 +26,7 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
|
|||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[][] textures;
|
||||
int[] adjacentTreeBlocks;
|
||||
|
||||
public BlockBOPAppleLeaves(int blockID)
|
||||
{
|
||||
|
@ -58,6 +59,12 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
|
|||
return textures[(!isOpaqueCube() ? 0 : 1)][meta & 7];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return Block.leaves.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
|
||||
|
@ -65,17 +72,156 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1)
|
||||
{
|
||||
double d0 = (double)((float)x + random.nextFloat());
|
||||
double d1 = (double)y - 0.05D;
|
||||
double d2 = (double)((float)z + random.nextFloat());
|
||||
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
|
||||
{
|
||||
byte radius = 1;
|
||||
int bounds = radius + 1;
|
||||
|
||||
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
|
||||
for (int i = -radius; i <= radius; ++i)
|
||||
for (int j = -radius; j <= radius; ++j)
|
||||
for (int k = -radius; k <= radius; ++k)
|
||||
{
|
||||
int blockID = world.getBlockId(x + i, y + j, z + k);
|
||||
|
||||
if (Block.blocksList[blockID] != null)
|
||||
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
// if (random1.nextInt(20) == 0 && world.getBlockLightValue(x, y, z) >= 8)
|
||||
// {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if ((meta & 3) < 3)
|
||||
world.setBlock(x, y, z, blockID, meta + 1, 3);
|
||||
// }
|
||||
if ((meta & 4) < 3)
|
||||
world.setBlock(x, y, z, blockID, ++meta, 3);
|
||||
|
||||
if ((meta & 8) != 0 && (meta & 4) == 0)
|
||||
{
|
||||
byte b0 = 4;
|
||||
int i1 = b0 + 1;
|
||||
byte b1 = 32;
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (this.adjacentTreeBlocks == null)
|
||||
{
|
||||
this.adjacentTreeBlocks = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
int l1;
|
||||
|
||||
if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1))
|
||||
{
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
|
||||
for (l1 = -b0; l1 <= b0; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
k2 = world.getBlockId(x + l1, y + i2, z + j2);
|
||||
|
||||
Block block = Block.blocksList[k2];
|
||||
|
||||
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
}
|
||||
else if (block != null && block.isLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l1 = 1; l1 <= 4; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
for (k2 = -b0; k2 <= b0; ++k2)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l1 = this.adjacentTreeBlocks[k1 * j1 + k1 * b1 + k1];
|
||||
|
||||
if (l1 >= 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeLeaves(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,12 +261,6 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
|
|||
return random.nextInt(20) == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int getDamageValue(World par1World, int par2, int par3, int par4)
|
||||
// {
|
||||
// return par1World.getBlockMetadata(par2, par3, par4) / 4;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
|
||||
{
|
||||
|
@ -146,6 +286,12 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(World world, int x, int y, int z)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
private static final String[] leaves = new String[] {"acacia", "mangrove", "palm", "redwood", "willow"};
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[][] textures;
|
||||
int[] adjacentTreeBlocks;
|
||||
|
||||
public BlockBOPColorizedLeaves(int blockID)
|
||||
{
|
||||
|
@ -63,8 +64,18 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int par1)
|
||||
{
|
||||
// TODO
|
||||
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic());
|
||||
switch (par1)
|
||||
{
|
||||
case 0:
|
||||
case 4:
|
||||
return ColorizerFoliage.getFoliageColorBirch();
|
||||
|
||||
case 3:
|
||||
return ColorizerFoliage.getFoliageColorPine();
|
||||
|
||||
default:
|
||||
return ColorizerFoliage.getFoliageColorBasic();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,6 +107,12 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
return textures[(!isOpaqueCube() ? 0 : 1)][getTypeFromMeta(meta)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return Block.leaves.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
|
||||
|
@ -103,6 +120,157 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
list.add(new ItemStack(blockID, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1)
|
||||
{
|
||||
double d0 = (double)((float)x + random.nextFloat());
|
||||
double d1 = (double)y - 0.05D;
|
||||
double d2 = (double)((float)z + random.nextFloat());
|
||||
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
|
||||
{
|
||||
byte radius = 1;
|
||||
int bounds = radius + 1;
|
||||
|
||||
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
|
||||
for (int i = -radius; i <= radius; ++i)
|
||||
for (int j = -radius; j <= radius; ++j)
|
||||
for (int k = -radius; k <= radius; ++k)
|
||||
{
|
||||
int blockID = world.getBlockId(x + i, y + j, z + k);
|
||||
|
||||
if (Block.blocksList[blockID] != null)
|
||||
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ((meta & 8) != 0 && (meta & 4) == 0)
|
||||
{
|
||||
byte b0 = 4;
|
||||
int i1 = b0 + 1;
|
||||
byte b1 = 32;
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (this.adjacentTreeBlocks == null)
|
||||
{
|
||||
this.adjacentTreeBlocks = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
int l1;
|
||||
|
||||
if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1))
|
||||
{
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
|
||||
for (l1 = -b0; l1 <= b0; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
k2 = world.getBlockId(x + l1, y + i2, z + j2);
|
||||
|
||||
Block block = Block.blocksList[k2];
|
||||
|
||||
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
}
|
||||
else if (block != null && block.isLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l1 = 1; l1 <= 4; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
for (k2 = -b0; k2 <= b0; ++k2)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l1 = this.adjacentTreeBlocks[k1 * j1 + k1 * b1 + k1];
|
||||
|
||||
if (l1 >= 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeLeaves(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
|
@ -156,6 +324,12 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(World world, int x, int y, int z)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
|||
@SideOnly(Side.CLIENT)
|
||||
private Icon[][] textures;
|
||||
private final LeafCategory category;
|
||||
int[] adjacentTreeBlocks;
|
||||
|
||||
public BlockBOPLeaves(int blockID, LeafCategory cat)
|
||||
{
|
||||
|
@ -63,6 +64,12 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
|||
return textures[(!isOpaqueCube() ? 0 : 1)][getTypeFromMeta(meta) + (this.category.ordinal() * 8)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return Block.leaves.isOpaqueCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
|
||||
|
@ -71,6 +78,157 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
|||
list.add(new ItemStack(blockID, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1)
|
||||
{
|
||||
double d0 = (double)((float)x + random.nextFloat());
|
||||
double d1 = (double)y - 0.05D;
|
||||
double d2 = (double)((float)z + random.nextFloat());
|
||||
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
|
||||
{
|
||||
byte radius = 1;
|
||||
int bounds = radius + 1;
|
||||
|
||||
if (world.checkChunksExist(x - bounds, y - bounds, z - bounds, x + bounds, y + bounds, z + bounds))
|
||||
for (int i = -radius; i <= radius; ++i)
|
||||
for (int j = -radius; j <= radius; ++j)
|
||||
for (int k = -radius; k <= radius; ++k)
|
||||
{
|
||||
int blockID = world.getBlockId(x + i, y + j, z + k);
|
||||
|
||||
if (Block.blocksList[blockID] != null)
|
||||
Block.blocksList[blockID].beginLeavesDecay(world, x + i, y + j, z + k);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ((meta & 8) != 0 && (meta & 4) == 0)
|
||||
{
|
||||
byte b0 = 4;
|
||||
int i1 = b0 + 1;
|
||||
byte b1 = 32;
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (this.adjacentTreeBlocks == null)
|
||||
{
|
||||
this.adjacentTreeBlocks = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
int l1;
|
||||
|
||||
if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1))
|
||||
{
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
|
||||
for (l1 = -b0; l1 <= b0; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
k2 = world.getBlockId(x + l1, y + i2, z + j2);
|
||||
|
||||
Block block = Block.blocksList[k2];
|
||||
|
||||
if (block != null && block.canSustainLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
}
|
||||
else if (block != null && block.isLeaves(world, x + l1, y + i2, z + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l1 = 1; l1 <= 4; ++l1)
|
||||
{
|
||||
for (i2 = -b0; i2 <= b0; ++i2)
|
||||
{
|
||||
for (j2 = -b0; j2 <= b0; ++j2)
|
||||
{
|
||||
for (k2 = -b0; k2 <= b0; ++k2)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1)
|
||||
{
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2)
|
||||
{
|
||||
this.adjacentTreeBlocks[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l1 = this.adjacentTreeBlocks[k1 * j1 + k1 * b1 + k1];
|
||||
|
||||
if (l1 >= 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeLeaves(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
|
@ -125,11 +283,18 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
|||
this.graphicsLevel = par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(World world, int x, int y, int z)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves(World world, int x, int y, int z)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,6 @@ public class ItemBOPAppleLeaves extends ItemBlock
|
|||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta | 8;
|
||||
return meta;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ public class ItemBOPColorizedLeaves extends ItemBlock
|
|||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta | 8;
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ public class ItemBOPLeaves extends ItemBlock
|
|||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta | 8;
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue