Guest User

mangoleaf.java

a guest
Apr 8th, 2016
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. package com.tristanvo.mod;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import net.minecraft.block.BlockLeavesBase;
  6. import net.minecraft.block.material.Material;
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.client.renderer.texture.IIconRegister;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.util.IIcon;
  11. import net.minecraft.world.IBlockAccess;
  12. import net.minecraftforge.common.IShearable;
  13.  
  14. public class mangoLeaf extends BlockLeavesBase implements IShearable {
  15.  
  16. protected IIcon icon1;
  17. protected IIcon icon2;
  18.  
  19. protected mangoLeaf(Material material) {
  20. super(material, false);
  21. this.setStepSound(this.soundTypeGrass);
  22. this.setHardness(0.2F);
  23. }
  24.  
  25. @Override
  26. public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
  27. return true;
  28. }
  29.  
  30. @Override
  31. public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
  32. ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
  33. drops.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
  34. return drops;
  35. }
  36. public void registerBlockIcons(IIconRegister icon)
  37. {
  38. if(Minecraft.isFancyGraphicsEnabled())
  39. {
  40. icon1 = icon.registerIcon("moem:mangoleaf_sidefancy");
  41. }
  42. else
  43. {
  44. icon2 = icon.registerIcon("moem:mangoleaf_sidefast");
  45. }
  46. }
  47. public IIcon getIcon(int side, int meta)
  48. {
  49. if(Minecraft.isFancyGraphicsEnabled())
  50. {
  51. return icon1;
  52. }
  53. else
  54. {
  55. return icon2;
  56. }
  57. }
  58. public boolean isOpaqueCube()
  59. {
  60. if(Minecraft.isFancyGraphicsEnabled())
  61. {
  62. return true;
  63. }
  64. else
  65. {
  66. return false;
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment