Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. package com.dannydobbi.realmsofcaltrice.food;
  2.  
  3. **IMPORTS HERE YADAYADAYADA**
  4.  
  5. public class BlockBerryBush extends BlockFlower
  6. {
  7. public int growth;
  8.  
  9. public BlockBerryBush(int par1, Material plants)
  10. {
  11. super(par1);
  12. this.setCreativeTab(ModTab.tabCaltrice);
  13. this.setStepSound(Block.soundTypeGrass);
  14. this.setHardness(0.3F);
  15. float f = 0.375F;
  16. float f1 = f / 2.0F;
  17. this.setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, f, 0.5F + f1);
  18. }
  19.  
  20. public BlockBerryBush(int par1)
  21. {
  22. this(par1, Material.plants);
  23. }
  24.  
  25. @Override
  26. public boolean canSilkHarvest()
  27. {
  28. return true;
  29. }
  30.  
  31. @Override
  32. public Item getItemDropped(int par1, Random par2Random, int par3)
  33. {
  34. if(this == CaltriceBlocks.BlueBerryBush)
  35. {
  36. return CaltriceItems.BlueBerry;
  37. }
  38. if(this == CaltriceBlocks.RaspBerryBush)
  39. {
  40. return CaltriceItems.RaspBerry;
  41. }
  42. if(this == CaltriceBlocks.StrawBerryBush)
  43. {
  44. return CaltriceItems.StrawBerry;
  45. }
  46. return Item.getItemFromBlock(null);
  47.  
  48. }
  49. public void registerIcons(IIconRegister i)
  50. {
  51. if(blockIcon == CaltriceBlocks.BerryBush)
  52. {
  53. this.blockIcon = i.registerIcon(ModInfo.MODID + ":" + "BerryBush");
  54. }
  55. if(blockIcon == CaltriceBlocks.RaspBerryBush)
  56. {
  57. this.blockIcon = i.registerIcon(ModInfo.MODID + ":" + "RaspberryBush");
  58. }
  59. if(blockIcon == CaltriceBlocks.BlueBerryBush)
  60. {
  61. this.blockIcon = i.registerIcon(ModInfo.MODID + ":" + "BlueberryBush");
  62. }
  63. if(blockIcon == CaltriceBlocks.StrawBerryBush)
  64. {
  65. this.blockIcon = i.registerIcon(ModInfo.MODID + ":" + "StrawberryBush");
  66. }
  67. }
  68. @Override
  69. public boolean isOpaqueCube()
  70. {
  71. return false;
  72. }
  73.  
  74. @Override
  75. public boolean renderAsNormalBlock()
  76. {
  77. return false;
  78. }
  79.  
  80. @Override
  81. public int getRenderType()
  82. {
  83. return 0;
  84. }
  85.  
  86. @Override
  87. public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
  88. {
  89. if(blockIcon == CaltriceBlocks.BerryBush)
  90. {
  91. world.setBlockToAir(x, y, z);
  92. }
  93. if(blockIcon == CaltriceBlocks.BlueBerryBush)
  94. {
  95. world.setBlock(x, y, z, CaltriceBlocks.BerryBush, meta, meta);
  96. }
  97. if(blockIcon == CaltriceBlocks.RaspBerryBush)
  98. {
  99. world.setBlock(x, y, z, CaltriceBlocks.BerryBush, meta, meta);
  100. }
  101. if(blockIcon == CaltriceBlocks.StrawBerryBush)
  102. {
  103. world.setBlock(x, y, z, CaltriceBlocks.BerryBush, meta, meta);
  104. }
  105. }
  106.  
  107. @Override
  108. public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
  109. {
  110. return null;
  111. }
  112.  
  113. protected boolean canPlaceBlockOn(Block block)
  114. {
  115. if(this == CaltriceBlocks.BlueBerryBush || this == CaltriceBlocks.RaspBerryBush || this == CaltriceBlocks.StrawBerryBush)
  116. {
  117. return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland;
  118. }
  119. else
  120. {
  121. return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland;
  122. }
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement