Guest User

Strawberry

a guest
Dec 21st, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. package com.morefood.mod.crops;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.morefood.mod.Morefood;
  6.  
  7. import cpw.mods.fml.relauncher.Side;
  8. import cpw.mods.fml.relauncher.SideOnly;
  9. import net.minecraft.block.BlockCrops;
  10. import net.minecraft.client.renderer.texture.IIconRegister;
  11. import net.minecraft.init.Items;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.util.IIcon;
  14. import net.minecraft.world.IBlockAccess;
  15. import net.minecraft.world.World;
  16. import net.minecraftforge.common.EnumPlantType;
  17.  
  18. public class StrawCrop extends BlockCrops
  19. {
  20. @SideOnly(Side.CLIENT)
  21. private IIcon[] iconArray;
  22. public Random r = new Random();
  23.  
  24. @Override
  25. public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
  26. {
  27. return EnumPlantType.Crop;
  28. }
  29.  
  30. /**
  31. * Gets the block's texture. Args: side, meta
  32. */
  33. @SideOnly(Side.CLIENT)
  34. public IIcon getIcon(int side, int metadata)
  35. {
  36. if (metadata < 4)
  37. {
  38. return this.iconArray[metadata];
  39. }
  40. else
  41. {
  42. return this.iconArray[3];
  43. }
  44. }
  45.  
  46.  
  47. public int quantityDropped (Random random) {
  48. return 1+r.nextInt(3);
  49. }
  50.  
  51. protected Item func_149866_i()
  52. {
  53. return Morefood.cropStrawberrySeeds;
  54. }
  55.  
  56. protected Item func_149865_P()
  57. {
  58. return Morefood.cropStrawberry;
  59. }
  60.  
  61. @SideOnly(Side.CLIENT)
  62. public Item getItem(World world, int i, int j, int k)
  63. {
  64. return Morefood.cropStrawberrySeeds;
  65. }
  66.  
  67. @SideOnly(Side.CLIENT)
  68. public void registerBlockIcons(IIconRegister iconRegister)
  69. {
  70. this.iconArray = new IIcon[4];
  71.  
  72. for (int i = 0; i < this.iconArray.length; ++i)
  73. {
  74. this.iconArray[i] = iconRegister.registerIcon(Morefood.modid + ":" + this.getUnlocalizedName().substring(5) + (i + 1));
  75. }
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment