package com.bioxx.tfc2.blocks; import java.util.Arrays; import java.util.Random; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import com.bioxx.tfc2.TFCBlocks; import com.bioxx.tfc2.api.types.WoodType; public class BlockLogNatural2 extends BlockTerra { public static PropertyEnum META_PROPERTY = PropertyEnum.create("wood", WoodType.class, Arrays.copyOfRange(WoodType.values(), 16, 18)); public BlockLogNatural2() { super(Material.GROUND, META_PROPERTY); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); this.setShowInCreative(false); setSoundType(SoundType.WOOD); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[]{META_PROPERTY}); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(META_PROPERTY, WoodType.getTypeFromMeta(meta+16)); } @Override public int getMetaFromState(IBlockState state) { return ((WoodType)state.getValue(META_PROPERTY)).getMeta() & 15; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(TFCBlocks.LogVertical2); } @Override public int damageDropped(IBlockState state) { return ((WoodType)state.getValue(META_PROPERTY)).getMeta(); } }