Guest User

tiktok

a guest
Jan 7th, 2017
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. @Override
  2.     protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
  3.     {
  4.         if(!worldIn.isRemote)
  5.         {
  6.             switch(type)
  7.             {
  8.                 case RAW: mysteryMeat(worldIn, player);
  9.                     break;
  10.                 case FROZEN: carpaccio(stack, worldIn, player);
  11.                     break;
  12.                 default: //Nothing yet ;)
  13.                     break;
  14.             }
  15.         }
  16.     }
  17.     //currently crashes
  18.     private void mysteryMeat(World worldIn, EntityPlayer player)
  19.     {
  20.         int effect = rng.nextInt(5);
  21.        
  22.         switch(effect)
  23.         {
  24.             case 0: player.setFire(8);
  25.                 break;
  26.             case 1: player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 100, 1));
  27.                 break;
  28.             case 2: player.addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 1));
  29.                 break;
  30.             case 3: player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 100, 10));
  31.                 break;
  32.             case 4: //nothing
  33.                 break;
  34.         }
  35.     }
  36.     //currently crashes
  37.     private void carpaccio(ItemStack stack, World worldIn, EntityPlayer player)
  38.     {
  39.         int effect = rng.nextInt(5);
  40.        
  41.         switch(effect)
  42.         {
  43.             case 0: player.curePotionEffects(stack);
  44.                 break;
  45.             case 1: player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 150, 1));
  46.                 break;
  47.             case 2: player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 50, 5));
  48.                 break;
  49.             case 3: player.addPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, 100, 10));
  50.                 break;
  51.             case 4: //nothing
  52.                 break;
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment