From a155097deee4171df1c7bd4d0c3bf5ce85583a84 Mon Sep 17 00:00:00 2001 From: Amnet Date: Tue, 22 Oct 2013 22:33:21 +0200 Subject: [PATCH] Fix for issue #100. --- .../biomesoplenty/blocks/BlockBOPLeaves.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/common/biomesoplenty/blocks/BlockBOPLeaves.java b/common/biomesoplenty/blocks/BlockBOPLeaves.java index 68e4c14a1..557f35642 100644 --- a/common/biomesoplenty/blocks/BlockBOPLeaves.java +++ b/common/biomesoplenty/blocks/BlockBOPLeaves.java @@ -70,24 +70,27 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable 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) { - 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) { - return fallingLeavesChance[getTypeFromMeta(metadata) + (category.ordinal() * 8)]; + int type = getTypeFromMeta(metadata) + (category.ordinal() * 8); + return fallingLeavesChance[type >= leaves.length ? 0 : type]; } - @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 @@ -349,9 +352,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable 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)