package com.bioxx.tfc2.blocks.terrain; 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 com.bioxx.tfc2.Core; import com.bioxx.tfc2.api.types.StoneType; import com.bioxx.tfc2.blocks.BlockGravity; import com.bioxx.tfc2.core.TFC_Sounds; import com.bioxx.tfc2.entity.EntityFallingBlockTFC; public class BlockSand extends BlockGravity { public static PropertyEnum META_PROPERTY = PropertyEnum.create("stone", StoneType.class); public BlockSand() { super(Material.GROUND, META_PROPERTY); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); setSoundType(SoundType.SAND); } /******************************************************************************* * 1. Content *******************************************************************************/ @Override public void onStartFalling(EntityFallingBlockTFC fallingEntity) { Core.playSoundAtEntity(fallingEntity, TFC_Sounds.FALLININGDIRTSHORT, 0.2f, 1.0f); } @Override public int getSlideHeight() { return 1; } @Override public float getSlideChance() { return 1.0f; } /******************************************************************************* * 2. Rendering *******************************************************************************/ /******************************************************************************* * 3. Blockstate *******************************************************************************/ @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[]{META_PROPERTY}); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(META_PROPERTY, StoneType.getStoneTypeFromMeta(meta)); } @Override public int getMetaFromState(IBlockState state) { return ((StoneType)state.getValue(META_PROPERTY)).getMeta(); } }