From 54a4b92531d52debeef581b623b76df44b796947 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 20 Jan 2016 20:51:20 +1100 Subject: [PATCH] Fixed double slab drops. Closes #615 --- .../common/block/BlockBOPDoubleOtherSlab.java | 21 +++++++++++++++++++ .../common/block/BlockBOPDoubleWoodSlab.java | 17 ++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleOtherSlab.java b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleOtherSlab.java index 98a4bfb87..9fc1952f2 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleOtherSlab.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleOtherSlab.java @@ -8,8 +8,16 @@ package biomesoplenty.common.block; +import java.util.ArrayList; +import java.util.List; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.common.enums.BOPWoods; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; public class BlockBOPDoubleOtherSlab extends BlockBOPHalfOtherSlab { @@ -27,6 +35,19 @@ public class BlockBOPDoubleOtherSlab extends BlockBOPHalfOtherSlab super(); } + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + List ret = new ArrayList(); + SlabType type = state.getValue(BlockBOPHalfOtherSlab.VARIANT); + IBlockState halfState = BOPBlocks.other_slab.getDefaultState().withProperty(BlockBOPHalfOtherSlab.VARIANT, type); + + //Drop two of the corresponding half slab for this block + ret.add(new ItemStack(halfState.getBlock(), 2, halfState.getBlock().getMetaFromState(halfState))); + + return ret; + } + @Override public boolean isDouble() { return true; diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java index d15c33460..92da88aff 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java @@ -8,7 +8,9 @@ package biomesoplenty.common.block; +import java.util.ArrayList; import java.util.List; +import java.util.Random; import com.google.common.collect.ImmutableSet; @@ -25,6 +27,9 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -123,10 +128,16 @@ public class BlockBOPDoubleWoodSlab extends BlockSlab implements IBOPBlock } @Override - public int damageDropped(IBlockState state) + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - // always drop a bottom slab - return this.getMetaFromState(state.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM)); + List ret = new ArrayList(); + BOPWoods wood = (BOPWoods) state.getValue(this.variantProperty); + IBlockState halfState = BlockBOPHalfWoodSlab.paging.getVariantState(wood); + + //Drop two of the corresponding half slab for this block + ret.add(new ItemStack(halfState.getBlock(), 2, halfState.getBlock().getMetaFromState(halfState))); + + return ret; } @Override