Advertisement
Guest User

PapCrop

a guest
Dec 23rd, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. package com.morefood.mod.crops;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. import com.morefood.mod.Debugger;
  7. import com.morefood.mod.Morefood;
  8.  
  9. import cpw.mods.fml.relauncher.Side;
  10. import cpw.mods.fml.relauncher.SideOnly;
  11. import net.minecraft.block.BlockCrops;
  12. import net.minecraft.client.renderer.texture.IIconRegister;
  13. import net.minecraft.init.Items;
  14. import net.minecraft.item.Item;
  15. import net.minecraft.item.ItemStack;
  16. import net.minecraft.util.IIcon;
  17. import net.minecraft.world.IBlockAccess;
  18. import net.minecraft.world.World;
  19. import net.minecraftforge.common.EnumPlantType;
  20.  
  21. public class PapCrop extends BlockCrops
  22. {
  23. @SideOnly(Side.CLIENT)
  24. private IIcon[] iconArray;
  25. private Random r = new Random();
  26. private int bufferstage;
  27.  
  28.  
  29. @Override
  30. public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
  31. {
  32. return EnumPlantType.Crop;
  33. }
  34.  
  35. @Override
  36. public Item getItemDropped(int stage, Random random, int j)
  37. {
  38. return customGetDropFunction(stage);
  39. }
  40.  
  41. @Override
  42. public int quantityDropped(Random random) {
  43. Debugger.log(bufferstage);
  44. if (bufferstage == 4) {
  45. return 3;
  46. }else if (bufferstage == 5) {
  47. return 3;
  48. }else if (bufferstage == 6) {
  49. return 3;
  50. }else{
  51. return 1;
  52. }
  53. }
  54.  
  55. public Item customGetDropFunction(int stage) {
  56. Debugger.log(bufferstage);
  57. bufferstage = stage;
  58. if (stage == 4) {
  59. return Morefood.cropGreenPaprika;
  60. }else if (stage == 5){
  61. return Morefood.cropYellowPaprika;
  62. }else if (stage == 6){
  63. return Morefood.cropRedPaprika;
  64. }else{
  65. return (Morefood.cropPaprikaSeeds);
  66. }
  67. }
  68.  
  69. protected Item func_149866_i()
  70. {
  71. return null;
  72. }
  73.  
  74. protected Item func_149865_P()
  75. {
  76. return null;
  77. }
  78.  
  79. /**
  80. * Gets the block's texture. Args: side, meta
  81. */
  82. @SideOnly(Side.CLIENT)
  83. public IIcon getIcon(int side, int metadata)
  84. {
  85. if (metadata < 7)
  86. {
  87. return this.iconArray[metadata];
  88. }
  89. else
  90. {
  91. return this.iconArray[6];
  92. }
  93. }
  94.  
  95. @SideOnly(Side.CLIENT)
  96. public Item getItem(World world, int i, int j, int k)
  97. {
  98. return Morefood.cropPaprikaSeeds;
  99. }
  100.  
  101. @SideOnly(Side.CLIENT)
  102. public void registerBlockIcons(IIconRegister iconRegister)
  103. {
  104. this.iconArray = new IIcon[7];
  105.  
  106. for (int i = 0; i < this.iconArray.length; ++i)
  107. {
  108. this.iconArray[i] = iconRegister.registerIcon(Morefood.modid + ":" + this.getUnlocalizedName().substring(5) + (i + 1));
  109. }
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement