Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. package wwrp.Blocks.Slab;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import wwrp.Common.Modwwrp;
  7. import net.minecraft.block.Block;
  8. import net.minecraft.block.BlockSlab;
  9. import net.minecraft.block.material.Material;
  10. import net.minecraft.creativetab.CreativeTabs;
  11. import net.minecraft.init.Blocks;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.util.IIcon;
  15. import net.minecraft.world.World;
  16. import cpw.mods.fml.relauncher.Side;
  17. import cpw.mods.fml.relauncher.SideOnly;
  18.  
  19. public class BlocklightOldPlanksSlab extends BlockSlab
  20. {
  21. public static final String[] StepTypes = new String[] {"lightOldPlanks", "lightOldPlankstwo", "darkOldPlanks", "darkOldPlankstwo"};
  22.  
  23. public BlocklightOldPlanksSlab(boolean isdouble, Material material)
  24. {
  25. super(isdouble, material);
  26. this.setCreativeTab(Modwwrp.wwrpTab);
  27. if(!this.field_150004_a)
  28. {
  29. this.setLightOpacity(0);
  30. }
  31. }
  32.  
  33. @SideOnly(Side.CLIENT)
  34. public IIcon getIcon(int side, int metadata)
  35. {
  36. int k = metadata & 7;
  37. return k == 0 ? Modwwrp.lightOldPlanks.getBlockTextureFromSide(side) : k == 1 ? Modwwrp.lightOldPlankstwo.getBlockTextureFromSide(side) : k == 2 ? Modwwrp.darkOldPlanks.getBlockTextureFromSide(side) : k == 3 ? Modwwrp.darkOldPlankstwo.getBlockTextureFromSide(side) : Blocks.iron_block.getBlockTextureFromSide(side);
  38. }
  39.  
  40. @SideOnly(Side.CLIENT)
  41. private static boolean func_150003_a(Block block)
  42. {
  43. return block == Modwwrp.singleSlaboldPlanks;
  44. }
  45.  
  46. @SideOnly(Side.CLIENT)
  47. public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
  48. {
  49. return func_150003_a(this) ? Item.getItemFromBlock(Modwwrp.singleSlaboldPlanks) : Item.getItemFromBlock(Modwwrp.doubleSlaboldPlanks);
  50. }
  51.  
  52. public Item getItemDropped(int metadata, Random rand, int fortune)
  53. {
  54. return Item.getItemFromBlock(Blocks.stone_slab);
  55. }
  56.  
  57. protected ItemStack createStackedBlock(int metadata)
  58. {
  59. return new ItemStack(Modwwrp.singleSlaboldPlanks, 2, metadata & 7);
  60. }
  61.  
  62. @SideOnly(Side.CLIENT)
  63. public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
  64. {
  65. if(item != Item.getItemFromBlock(Modwwrp.doubleSlaboldPlanks))
  66. {
  67. for(int i = 0; i < StepTypes.length; i++)
  68. {
  69. list.add(new ItemStack(item, 1, i));
  70. }
  71. }
  72. }
  73.  
  74. @Override
  75. public String func_150002_b(int metadata)
  76. {
  77. if(metadata < 0 || metadata >= StepTypes.length)
  78. {
  79. metadata = 0;
  80. }
  81. return super.getUnlocalizedName() + "." + StepTypes[metadata];
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement