Advertisement
Eragonn14900

Untitled

Dec 3rd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. package com.reactioncraft.desert.common;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import javax.annotation.Nullable;
  7.  
  8. import com.reactioncraft.reactioncraft;
  9. import com.reactioncraft.core.common.blocks.BlockBase;
  10. import com.reactioncraft.integration.instances.IntegratedBlocks;
  11. import com.reactioncraft.integration.instances.IntegratedItems;
  12.  
  13. import net.minecraft.block.BlockDirt;
  14. import net.minecraft.block.material.MapColor;
  15. import net.minecraft.block.material.Material;
  16. import net.minecraft.block.properties.IProperty;
  17. import net.minecraft.block.properties.PropertyEnum;
  18. import net.minecraft.block.state.BlockStateContainer;
  19. import net.minecraft.block.state.IBlockState;
  20. import net.minecraft.creativetab.CreativeTabs;
  21. import net.minecraft.init.Blocks;
  22. import net.minecraft.init.Items;
  23. import net.minecraft.item.EnumDyeColor;
  24. import net.minecraft.item.Item;
  25. import net.minecraft.item.ItemBlock;
  26. import net.minecraft.item.ItemStack;
  27. import net.minecraft.util.BlockRenderLayer;
  28. import net.minecraft.util.math.BlockPos;
  29. import net.minecraft.world.IBlockAccess;
  30. import net.minecraft.world.World;
  31. import net.minecraftforge.fml.relauncher.Side;
  32. import net.minecraftforge.fml.relauncher.SideOnly;
  33.  
  34. public class BlockDesertMulti extends BlockBase
  35. {
  36. public static final PropertyEnum<EnumDesertBlocks> TYPE = PropertyEnum.<EnumDesertBlocks>create("type", EnumDesertBlocks.class);
  37.  
  38. public BlockDesertMulti(String name, Material materialIn)
  39. {
  40. super(materialIn, name);
  41. this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumDesertBlocks.one1));
  42. this.setCreativeTab(reactioncraft.Reactioncraft);
  43. //this.getItemDropped(getDefaultState(), RANDOM, lightOpacity);
  44. }
  45.  
  46. @Nullable
  47. public Item getItemDropped(IBlockState state, Random rand, int fortune)
  48. {
  49. if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one1)
  50. {
  51. System.out.println("here?");
  52. return IntegratedBlocks.DesertBlocks.getItemDropped(IntegratedBlocks.DesertBlocks.getDefaultState().withProperty(BlockDesertMulti.TYPE, EnumDesertBlocks.one2), rand, fortune);
  53. //return Blocks.DIRT.getItemDropped(Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune);
  54. }
  55. if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one2)
  56. {
  57. System.out.println("here!");
  58. return IntegratedItems.UncutLBGem;
  59. }
  60. if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one3)
  61. {
  62. System.out.println("here@");
  63. return IntegratedItems.UncutDBGem;
  64. }
  65. else
  66. {
  67. System.out.println("why here?");
  68. return (Item) state;
  69. }
  70. }
  71.  
  72. /**
  73. * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
  74. */
  75. @SideOnly(Side.CLIENT)
  76. public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
  77. {
  78. for (EnumDesertBlocks types : EnumDesertBlocks.values())
  79. {
  80. list.add(new ItemStack(itemIn, 1, types.getMetadata()));
  81. }
  82. }
  83.  
  84. /**
  85. * Convert the given metadata into a BlockState for this Block
  86. */
  87. public IBlockState getStateFromMeta(int meta)
  88. {
  89. return this.getDefaultState().withProperty(TYPE, EnumDesertBlocks.byMetadata(meta));
  90. }
  91.  
  92. /**
  93. * Convert the BlockState into the correct metadata value
  94. */
  95. public int getMetaFromState(IBlockState state)
  96. {
  97. return ((EnumDesertBlocks)state.getValue(TYPE)).getMetadata();
  98. }
  99.  
  100.  
  101. protected BlockStateContainer createBlockState()
  102. {
  103. return new BlockStateContainer(this, new IProperty[] {TYPE});
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement