Eragonn14900

Untitled

Nov 24th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. package com.reactioncraft.desert.common;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import com.reactioncraft.reactioncraft;
  7. import com.reactioncraft.core.common.blocks.BlockBase;
  8. import net.minecraft.block.material.MapColor;
  9. import net.minecraft.block.material.Material;
  10. import net.minecraft.block.properties.IProperty;
  11. import net.minecraft.block.properties.PropertyEnum;
  12. import net.minecraft.block.state.BlockStateContainer;
  13. import net.minecraft.block.state.IBlockState;
  14. import net.minecraft.creativetab.CreativeTabs;
  15. import net.minecraft.item.EnumDyeColor;
  16. import net.minecraft.item.Item;
  17. import net.minecraft.item.ItemBlock;
  18. import net.minecraft.item.ItemStack;
  19. import net.minecraft.util.BlockRenderLayer;
  20. import net.minecraft.util.math.BlockPos;
  21. import net.minecraft.world.World;
  22. import net.minecraftforge.fml.relauncher.Side;
  23. import net.minecraftforge.fml.relauncher.SideOnly;
  24.  
  25. public class BlockHireoMulti extends BlockBase
  26. {
  27. public static final PropertyEnum<EnumHireoGlyphs> TYPE = PropertyEnum.<EnumHireoGlyphs>create("type", EnumHireoGlyphs.class);
  28.  
  29. public BlockHireoMulti(Material materialIn, String name)
  30. {
  31. super(materialIn, name);
  32. this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumHireoGlyphs.one1));
  33. this.setCreativeTab(reactioncraft.Reactioncraft);
  34. }
  35.  
  36. /**
  37. * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
  38. * returns the metadata of the dropped item based on the old metadata of the block.
  39. */
  40. public int damageDropped(IBlockState state)
  41. {
  42. return ((EnumHireoGlyphs)state.getValue(TYPE)).getMetadata();
  43. }
  44.  
  45. /**
  46. * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
  47. */
  48. @SideOnly(Side.CLIENT)
  49. @Override
  50. public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
  51. {
  52. for (EnumHireoGlyphs types : EnumHireoGlyphs.values())
  53. {
  54. list.add(new ItemStack(itemIn, 1, types.getMetadata()));
  55. }
  56. }
  57.  
  58. /**
  59. * Convert the given metadata into a BlockState for this Block
  60. */
  61. @Override
  62. public IBlockState getStateFromMeta(int meta)
  63. {
  64. return this.getDefaultState().withProperty(TYPE, EnumHireoGlyphs.byMetadata(meta));
  65. }
  66.  
  67. /**
  68. * Convert the BlockState into the correct metadata value
  69. */
  70. @Override
  71. public int getMetaFromState(IBlockState state)
  72. {
  73. return ((EnumHireoGlyphs)state.getValue(TYPE)).getMetadata();
  74. }
  75.  
  76. @Override
  77. protected BlockStateContainer createBlockState()
  78. {
  79. return new BlockStateContainer(this, new IProperty[] {TYPE});
  80. }
  81. }
Add Comment
Please, Sign In to add comment