Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.chaos.rfchaos.common.blocks;
- import net.chaos.rfchaos.RefinedChaosMod;
- import net.chaos.rfchaos.common.CommonProxy;
- import net.chaos.rfchaos.common.ModFinals;
- import net.chaos.rfchaos.util.EnumSize;
- import net.chaos.rfchaos.util.EnumWeight;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockGrass;
- import net.minecraft.block.SoundType;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.properties.IProperty;
- import net.minecraft.block.properties.PropertyBool;
- import net.minecraft.block.state.BlockStateContainer;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.client.renderer.block.model.ModelResourceLocation;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.util.BlockRenderLayer;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.IBlockAccess;
- import net.minecraftforge.client.model.ModelLoader;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class BlockTerraGrass extends BlockGrass {
- public static final PropertyBool SNOWY = PropertyBool.create("snowy");
- public BlockTerraGrass(String registryReplacement, String name) {
- super();
- this.setUnlocalizedName(ModFinals.MODID + "." + name);
- this.setRegistryName(registryReplacement);
- this.setCreativeTab(RefinedChaosMod.TAB);
- this.setSoundType(SoundType.PLANT);
- }
- @SideOnly(Side.CLIENT)
- public void registerModel() {
- ModelLoader.setCustomStateMapper(this, RefinedChaosMod.proxy.mapper);
- ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(ModFinals.MODID + ":rf_grass", "inventory"));
- }
- /**
- * Get the actual Block state of this Block at the given position. This applies properties not visible in the
- * metadata, such as fence connections.
- */
- @Override
- public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
- {
- Block block = worldIn.getBlockState(pos.up()).getBlock();
- return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.SNOW || block == Blocks.SNOW_LAYER));
- }
- /**
- * Convert the BlockState into the correct metadata value
- * */
- @Override
- public int getMetaFromState(IBlockState state)
- {
- return 0;
- }
- @Override
- protected BlockStateContainer createBlockState()
- {
- return new BlockStateContainer(this, new IProperty[] {SNOWY});
- }
- @Override
- @SideOnly(Side.CLIENT)
- public BlockRenderLayer getBlockLayer()
- {
- return BlockRenderLayer.CUTOUT_MIPPED;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment