Advertisement
Marikc0

Untitled

Dec 9th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.79 KB | None | 0 0
  1. package marikc0.optionals.food;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import cpw.mods.fml.relauncher.Side;
  7. import cpw.mods.fml.relauncher.SideOnly;
  8. import marikc0.optionals.Food;
  9. import marikc0.optionals.Items;
  10. import marikc0.optionals.ModInfo;
  11. import net.minecraft.block.Block;
  12. import net.minecraft.client.renderer.texture.IconRegister;
  13. import net.minecraft.creativetab.CreativeTabs;
  14. import net.minecraft.entity.player.EntityPlayer;
  15. import net.minecraft.item.*;
  16. import net.minecraft.potion.Potion;
  17. import net.minecraft.world.World;
  18.  
  19. public class FoodBertiesBean extends ItemFood {
  20.    
  21.     public final int itemUseDuration;
  22.     private int healAmount;
  23.     private float saturationModifier;
  24.     private final boolean isWolfsFavoriteMeat;
  25.     private boolean alwaysEdible;
  26.     private int potionId;
  27.     private int potionDuration;
  28.     private int potionAmplifier;    
  29.     private float potionEffectProbability;
  30.    
  31.     private float saturationMod;
  32.     private int hungerMod;
  33.     private int potionUse;
  34.     private int isHealed;
  35.     private static int healthAmount;
  36.     private int healthRecovered;
  37.    
  38.     public FoodBertiesBean(int id, int hunger, float saturation, boolean wolfFavorite) {
  39.         super(id, hunger, saturation, wolfFavorite);
  40.         this.setMaxStackSize(Food.STACK_BEAN);
  41.         this.setCreativeTab(CreativeTabs.tabFood);
  42.         this.setUnlocalizedName("foodNuclearMishMash");
  43.         this.itemUseDuration = 16;
  44.         this.isWolfsFavoriteMeat = wolfFavorite;
  45.         this.saturationModifier = saturation;
  46.         this.healAmount = hunger;      
  47.        
  48.     }    
  49.    
  50.     protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
  51.        
  52.         Random randomChance = new Random();
  53.         saturationMod = randomChance.nextInt(3) + 1;
  54.         hungerMod = randomChance.nextInt(14) + 1;
  55.         potionUse = randomChance.nextInt(18) + 1;
  56.         isHealed = randomChance.nextInt(100) + 1;
  57.         healthAmount = randomChance.nextInt(5) + 1;
  58.                
  59.         this.saturationModifier = saturationMod;
  60.         this.healAmount = hungerMod;
  61.        
  62.         if(isHealed <= 20) {
  63.             this.setPotionEffect(Potion.heal.id, healthAmount, 0, 1.0f);
  64.         }
  65.        
  66.     }
  67.    
  68.     public ItemFood setAlwaysEdible()
  69.     {
  70.         this.alwaysEdible = true;
  71.         return this;
  72.     }
  73.    
  74.     @Override
  75.     @SideOnly(Side.CLIENT)
  76.     public void registerIcons(IconRegister reg)
  77.     {
  78.         this.itemIcon = reg.registerIcon(Items.TEXTURE_LOCATION + ":" + "FoodBertiesBean");
  79.     }
  80.    
  81.     @Override
  82.     @SideOnly(Side.CLIENT)
  83.     public void addInformation(ItemStack itemstack, EntityPlayer player, List info, boolean useExtraInformation){
  84.         info.add(Food.INFO_BEAN);
  85.     }
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement