From f219f84c0917a119510c43562bf33e3eb2ee2da9 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Sat, 23 May 2015 15:08:25 +0100 Subject: [PATCH] Fix BOP stone drops --- .../common/block/BlockBOPStone.java | 15 +++++++++++--- .../blockstates/half_wood_slab_0.json | 20 ------------------- .../blockstates/half_wood_slab_1.json | 20 ------------------- 3 files changed, 12 insertions(+), 43 deletions(-) delete mode 100644 src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_0.json delete mode 100644 src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_1.json diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPStone.java b/src/main/java/biomesoplenty/common/block/BlockBOPStone.java index ab029076d..1979bc3b3 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPStone.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPStone.java @@ -77,16 +77,19 @@ public class BlockBOPStone extends Block implements IBOPBlock } + // TODO: can we get rid of these and just use a single hardness / resistance value? + // These don't work completely as expected - sometimes the block at pos is not this (when destroyed it becomes air for example) @Override public float getBlockHardness(World world, BlockPos pos) { - return (Boolean)world.getBlockState(pos).getValue(POLISHED) ? 1.5F : 3.0F; + IBlockState state = world.getBlockState(pos); + return (state.getBlock() == this && (Boolean)state.getValue(POLISHED)) ? 1.5F : 3.0F; } - @Override public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) { - return (Boolean)world.getBlockState(pos).getValue(POLISHED) ? 7.0F : 5.0F; + IBlockState state = world.getBlockState(pos); + return (state.getBlock() == this && (Boolean)state.getValue(POLISHED)) ? 7.0F : 5.0F; } // map from state to meta and vice verca - use highest bit for polished boolean, use low 2 bits for variant @@ -104,5 +107,11 @@ public class BlockBOPStone extends Block implements IBOPBlock boolean polished = (Boolean) state.getValue(POLISHED); return type + (polished ? 8 : 0); } + + @Override + public int damageDropped(IBlockState state) + { + return this.getMetaFromState(state); + } } \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_0.json b/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_0.json deleted file mode 100644 index 5b7133fab..000000000 --- a/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_0.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "variants": { - "half=bottom,variant=a": { "model": "biomesoplenty:half_slab_sacred_oak" }, - "half=top,variant=a": { "model": "biomesoplenty:upper_slab_sacred_oak" }, - "half=bottom,variant=b": { "model": "biomesoplenty:half_slab_cherry" }, - "half=top,variant=b": { "model": "biomesoplenty:upper_slab_cherry" }, - "half=bottom,variant=c": { "model": "biomesoplenty:half_slab_dark" }, - "half=top,variant=c": { "model": "biomesoplenty:upper_slab_dark" }, - "half=bottom,variant=d": { "model": "biomesoplenty:half_slab_fir" }, - "half=top,variant=d": { "model": "biomesoplenty:upper_slab_fir" }, - "half=bottom,variant=e": { "model": "biomesoplenty:half_slab_ethereal" }, - "half=top,variant=e": { "model": "biomesoplenty:upper_slab_ethereal" }, - "half=bottom,variant=f": { "model": "biomesoplenty:half_slab_magic" }, - "half=top,variant=f": { "model": "biomesoplenty:upper_slab_magic" }, - "half=bottom,variant=g": { "model": "biomesoplenty:half_slab_mangrove" }, - "half=top,variant=g": { "model": "biomesoplenty:upper_slab_mangrove" }, - "half=bottom,variant=h": { "model": "biomesoplenty:half_slab_palm" }, - "half=top,variant=h": { "model": "biomesoplenty:upper_slab_palm" } - } -} diff --git a/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_1.json b/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_1.json deleted file mode 100644 index f8f988d5c..000000000 --- a/src/main/resources/assets/biomesoplenty/blockstates/half_wood_slab_1.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "variants": { - "half=bottom,variant=a": { "model": "biomesoplenty:half_slab_redwood" }, - "half=top,variant=a": { "model": "biomesoplenty:upper_slab_redwood" }, - "half=bottom,variant=b": { "model": "biomesoplenty:half_slab_willow" }, - "half=top,variant=b": { "model": "biomesoplenty:upper_slab_willow" }, - "half=bottom,variant=c": { "model": "biomesoplenty:half_slab_pine" }, - "half=top,variant=c": { "model": "biomesoplenty:upper_slab_pine" }, - "half=bottom,variant=d": { "model": "biomesoplenty:half_slab_hell_bark" }, - "half=top,variant=d": { "model": "biomesoplenty:upper_slab_hell_bark" }, - "half=bottom,variant=e": { "model": "biomesoplenty:half_slab_jacaranda" }, - "half=top,variant=e": { "model": "biomesoplenty:upper_slab_jacaranda" }, - "half=bottom,variant=f": { "model": "biomesoplenty:half_slab_mahogany" }, - "half=top,variant=f": { "model": "biomesoplenty:upper_slab_mahogany" }, - "half=bottom,variant=g": { "model": "biomesoplenty:half_slab_giant_flower" }, - "half=top,variant=g": { "model": "biomesoplenty:upper_slab_giant_flower" }, - "half=bottom,variant=h": { "model": "biomesoplenty:half_slab_dead" }, - "half=top,variant=h": { "model": "biomesoplenty:upper_slab_dead" } - } -}