Fixed double slab drops. Closes #615

This commit is contained in:
Adubbz 2016-01-20 20:51:20 +11:00
parent 97d283950c
commit 54a4b92531
2 changed files with 35 additions and 3 deletions

View file

@ -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<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
List<ItemStack> ret = new ArrayList<ItemStack>();
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;

View file

@ -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<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
// always drop a bottom slab
return this.getMetaFromState(state.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
List<ItemStack> ret = new ArrayList<ItemStack>();
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