示例#1
0
 public void setUseAction(String useAction) {
   if (Util.isInEnum(useAction.toLowerCase(), EnumAction.class)) {
     this.useAction = EnumAction.valueOf(useAction.toLowerCase());
   } else {
     this.useAction = EnumAction.eat;
   }
 }
示例#2
0
 @Override
 protected void onFoodEaten(ItemStack p_77849_1_, World p_77849_2_, EntityPlayer p_77849_3_) {
   if (!p_77849_2_.isRemote) {
     if (effectsArray != null) {
       for (int i = 0; i < effectsArray.length; i++) {
         Cfg_PotionEffect effect = effectsArray[i];
         if (p_77849_2_.rand.nextFloat() < effect.potionEffectProbability) {
           p_77849_3_.addPotionEffect(
               new PotionEffect(
                   Util.potionEffectId(effect.effect),
                   effect.potionDuration * 20,
                   effect.potionAmplifier));
         }
       }
     }
   }
 }