Fix for issue #100.

This commit is contained in:
Amnet 2013-10-22 22:33:21 +02:00
parent ed4a5000d7
commit a155097dee

View file

@ -70,24 +70,27 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
public Icon getIconBetterLeaves(int metadata, float randomIndex) public Icon getIconBetterLeaves(int metadata, float randomIndex)
{ {
return textures[2][getTypeFromMeta(metadata) + (category.ordinal() * 8)]; int type = getTypeFromMeta(metadata) + (category.ordinal() * 8);
return textures[2][type >= leaves.length ? 0 : type];
} }
public Icon getIconFallingLeaves(int metadata) public Icon getIconFallingLeaves(int metadata)
{ {
return textures[1][getTypeFromMeta(metadata) + (category.ordinal() * 8)]; int type = getTypeFromMeta(metadata) + (category.ordinal() * 8);
return textures[1][type >= leaves.length ? 0 : type];
} }
public float getSpawnChanceFallingLeaves(int metadata) public float getSpawnChanceFallingLeaves(int metadata)
{ {
return fallingLeavesChance[getTypeFromMeta(metadata) + (category.ordinal() * 8)]; int type = getTypeFromMeta(metadata) + (category.ordinal() * 8);
return fallingLeavesChance[type >= leaves.length ? 0 : type];
} }
@Override @Override
public Icon getIcon(int side, int meta) public Icon getIcon(int side, int metadata)
{ {
return textures[(!isOpaqueCube() ? 0 : 1)][getTypeFromMeta(meta) + (category.ordinal() * 8)]; int type = getTypeFromMeta(metadata) + (category.ordinal() * 8);
return textures[(!isOpaqueCube() ? 0 : 1)][type >= leaves.length ? 0 : type];
} }
@Override @Override
@ -349,9 +352,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
return ret; return ret;
} }
public String getLeafType(int meta) public String getLeafType(int metadata)
{ {
return leaves[getTypeFromMeta(meta) + category.ordinal() * 8]; int type = getTypeFromMeta(metadata) + (category.ordinal() * 8);
return leaves[type >= leaves.length ? 0 : type];
} }
private static int getTypeFromMeta(int meta) private static int getTypeFromMeta(int meta)