package me.km.blocks; import me.km.KajetansMod; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockHay extends BlockRotatedPillar implements IBlockBase { protected String name; private SoundType type; public BlockHay(String name, String local) { super(Material.GRASS); this.name = name; this.setRegistryName(name); super.setUnlocalizedName(local); super.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); super.setHardness(0.5F); this.type = SoundType.PLANT; this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y)); } @Override public void onFallenUpon(World w, BlockPos pos, Entity ent, float fallDistance) { ent.fall(fallDistance, 0.2F); } @Override public void registerItemModel(Item itemBlock) { KajetansMod.proxy.registerItemRenderer(itemBlock, 0, name); } @Override public BlockHay setSoundType(SoundType sound) { this.type = sound; return this; } @Override public SoundType getSoundType(IBlockState state, World world, BlockPos pos, Entity entity) { return type; } }