Advertisement
Guest User

Drops for Vanilla Mobs Code

a guest
May 22nd, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.25 KB | None | 0 0
  1. package net.net46.thesuperhb.MobDrops;
  2.  
  3. import net.minecraft.entity.passive.*;
  4. import net.minecraft.entity.monster.*;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.init.Items;
  7. import net.minecraft.item.Item;
  8. import net.minecraftforge.event.entity.living.LivingDeathEvent;
  9. import net.minecraftforge.event.entity.living.LivingDropsEvent;
  10. import net.minecraftforge.event.entity.living.LivingSpawnEvent;
  11.  
  12. public class LivingDropEvent
  13. {
  14.     public static double rand;
  15.  
  16.     public void onEntityDropCow(LivingDropsEvent event)
  17.     {
  18.         if (event.source.getDamageType().equals("player"))
  19.         {
  20.             rand = Math.random();
  21.  
  22.             if (event.entityLiving instanceof EntityCow)
  23.             {
  24.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  25.                 if (rand < 0.17d)
  26.                 {
  27.                     event.entityLiving.dropItem(Items.bone, 12);
  28.                     event.entityLiving.dropItem(MobDrops.cowHorn, 2);
  29.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     public void onEntityDropMooshroom(LivingDropsEvent event)
  35.     {
  36.         if (event.source.getDamageType().equals("player"))
  37.         {
  38.             rand = Math.random();
  39.  
  40.             if (event.entityLiving instanceof EntityMooshroom)
  41.             {
  42.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  43.                 if (rand < 0.17d)
  44.                 {
  45.                     event.entityLiving.dropItem(Items.bone, 12);
  46.                     event.entityLiving.dropItem(MobDrops.cowHorn, 2);
  47.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  48.                     event.entityLiving.dropItem(MobDrops.redLeather, 3);
  49.                 }
  50.             }
  51.         }
  52.     }
  53.     public void onEntityDropSquid(LivingDropsEvent event)
  54.     {
  55.         if (event.source.getDamageType().equals("player"))
  56.         {
  57.             rand = Math.random();
  58.  
  59.             if (event.entityLiving instanceof EntitySquid)
  60.             {
  61.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  62.                 if (rand < 0.17d)
  63.                 {
  64.                     event.entityLiving.dropItem(MobDrops.squid, 2);
  65.                     event.entityLiving.dropItem(MobDrops.squidEye, 2);
  66.                     event.entityLiving.dropItem(MobDrops.squidTentacle, 8);
  67.                 }
  68.             }
  69.         }
  70.     }
  71.     public void onEntityDropSheep(LivingDropsEvent event)
  72.     {
  73.         if (event.source.getDamageType().equals("player"))
  74.         {
  75.             rand = Math.random();
  76.  
  77.             if (event.entityLiving instanceof EntitySheep)
  78.             {
  79.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  80.                 if (rand < 0.17d)
  81.                 {
  82.                     event.entityLiving.dropItem(MobDrops.rawLambchop, 4);
  83.                     event.entityLiving.dropItem(Items.bone, 5);
  84.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  85.                 }
  86.             }
  87.         }
  88.     }
  89.     public void onEntityDropBat(LivingDropsEvent event)
  90.     {
  91.         if (event.source.getDamageType().equals("player"))
  92.         {
  93.             rand = Math.random();
  94.  
  95.             if (event.entityLiving instanceof EntityBat)
  96.             {
  97.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  98.                 if (rand < 0.17d)
  99.                 {
  100.                     event.entityLiving.dropItem(MobDrops.batEyes, 2);
  101.                     event.entityLiving.dropItem(MobDrops.batWings, 2);
  102.                     event.entityLiving.dropItem(MobDrops.batEars, 2);
  103.                     event.entityLiving.dropItem(Items.bone, 1);
  104.                 }
  105.             }
  106.         }
  107.     }
  108.     public void onEntityDropChicken(LivingDropsEvent event)
  109.     {
  110.         if (event.source.getDamageType().equals("player"))
  111.         {
  112.             rand = Math.random();
  113.  
  114.             if (event.entityLiving instanceof EntityChicken)
  115.             {
  116.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  117.                 if (rand < 0.17d)
  118.                 {
  119.                     event.entityLiving.dropItem(MobDrops.chickenLegs, 2);
  120.                     event.entityLiving.dropItem(Items.bone, 3);
  121.                 }
  122.             }
  123.         }
  124.     }
  125.     public void onEntityDropHorse(LivingDropsEvent event)
  126.     {
  127.         if (event.source.getDamageType().equals("player"))
  128.         {
  129.             rand = Math.random();
  130.  
  131.             if (event.entityLiving instanceof EntityHorse)
  132.             {
  133.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  134.                 if (rand < 0.17d)
  135.                 {
  136.                     //event.entityLiving.dropItem(MobDrops.headHorse, 1);
  137.                     event.entityLiving.dropItem(MobDrops.skinHorse, 2);
  138.                     event.entityLiving.dropItem(MobDrops.hoofHorse, 2);
  139.                     event.entityLiving.dropItem(Items.bone, 10);
  140.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  141.                 }
  142.             }
  143.         }
  144.     }
  145.     public void onEntityDropPig(LivingDropsEvent event)
  146.     {
  147.         if (event.source.getDamageType().equals("player"))
  148.         {
  149.             rand = Math.random();
  150.  
  151.             if (event.entityLiving instanceof EntityPig)
  152.             {
  153.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  154.                 if (rand < 0.17d)
  155.                 {
  156.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  157.                     event.entityLiving.dropItem(Items.bone, 5);
  158.                     event.entityLiving.dropItem(MobDrops.rawRibs, 6);
  159.                     event.entityLiving.dropItem(MobDrops.ham, 6);
  160.                 }
  161.             }
  162.         }
  163.     }
  164.     public void onEntityDropWolf(LivingDropsEvent event)
  165.     {
  166.         if (event.source.getDamageType().equals("player"))
  167.         {
  168.             rand = Math.random();
  169.  
  170.             if (event.entityLiving instanceof EntityWolf)
  171.             {
  172.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  173.                 if (rand < 0.17d)
  174.                 {
  175.                     event.entityLiving.dropItem(MobDrops.wolfSkin, 4);
  176.                     event.entityLiving.dropItem(Items.bone, 5);
  177.                     event.entityLiving.dropItem(MobDrops.ribCage, 1);
  178.                 }
  179.             }
  180.         }
  181.     }
  182.     public void onEntityDropSpider(LivingDropsEvent event)
  183.     {
  184.         if (event.source.getDamageType().equals("player"))
  185.         {
  186.             rand = Math.random();
  187.  
  188.             if (event.entityLiving instanceof EntitySpider)
  189.             {
  190.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  191.                 if (rand < 0.10d)
  192.                 {
  193.                     event.entityLiving.dropItem(MobDrops.spiderLeg, 6);
  194.                 }
  195.             }
  196.         }
  197.     }
  198.     public void onEntityDropCreeper(LivingDropsEvent event)
  199.     {
  200.         if (event.source.getDamageType().equals("player"))
  201.         {
  202.             rand = Math.random();
  203.  
  204.             if (event.entityLiving instanceof EntityCreeper)
  205.             {
  206.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  207.                 if (rand < 0.10d)
  208.                 {
  209.                     event.entityLiving.dropItem(MobDrops.creeperSkin, 4);
  210.                     event.entityLiving.dropItem(MobDrops.creeperEye, 2);
  211.                 }
  212.             }
  213.         }
  214.     }
  215.     public void onEntityDropEnderman(LivingDropsEvent event)
  216.     {
  217.         if (event.source.getDamageType().equals("player"))
  218.         {
  219.             rand = Math.random();
  220.  
  221.             if (event.entityLiving instanceof EntityEnderman)
  222.             {
  223.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  224.                 if (rand < 0.10d)
  225.                 {
  226.                     event.entityLiving.dropItem(MobDrops.enderTear, 2);
  227.                 }
  228.             }
  229.         }
  230.     }
  231.     public void onEntityDropGhast(LivingDropsEvent event)
  232.     {
  233.         if (event.source.getDamageType().equals("player"))
  234.         {
  235.             rand = Math.random();
  236.  
  237.             if (event.entityLiving instanceof EntityGhast)
  238.             {
  239.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  240.                 if (rand < 0.10d)
  241.                 {
  242.                     event.entityLiving.dropItem(Items.flint, 10);
  243.                 }
  244.             }
  245.         }
  246.     }
  247.     public void onEntityDropMagmaCube(LivingDropsEvent event)
  248.     {
  249.         if (event.source.getDamageType().equals("player"))
  250.         {
  251.             rand = Math.random();
  252.  
  253.             if (event.entityLiving instanceof EntityMagmaCube)
  254.             {
  255.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  256.                 if (rand < 0.10d)
  257.                 {
  258.                     event.entityLiving.dropItem(MobDrops.magmaGoo, 2);
  259.                 }
  260.             }
  261.         }
  262.     }
  263.     public void onEntityDropSlime(LivingDropsEvent event)
  264.     {
  265.         if (event.source.getDamageType().equals("player"))
  266.         {
  267.             rand = Math.random();
  268.  
  269.             if (event.entityLiving instanceof EntitySlime)
  270.             {
  271.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  272.                 if (rand < 0.10d)
  273.                 {
  274.                     event.entityLiving.dropItem(MobDrops.goo, 2);
  275.                 }
  276.             }
  277.         }
  278.     }
  279.     public void onEntityDropWitch(LivingDropsEvent event)
  280.     {
  281.         if (event.source.getDamageType().equals("player"))
  282.         {
  283.             rand = Math.random();
  284.  
  285.             if (event.entityLiving instanceof EntityWitch)
  286.             {
  287.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  288.                 if (rand < 0.10d)
  289.                 {
  290.                     event.entityLiving.dropItem(MobDrops.witchRobe, 1);
  291.                     event.entityLiving.dropItem(MobDrops.wort, 1);
  292.                 }
  293.             }
  294.         }
  295.     }
  296.     public void onEntityDropZombie(LivingDropsEvent event)
  297.     {
  298.         if (event.source.getDamageType().equals("player"))
  299.         {
  300.             rand = Math.random();
  301.  
  302.             if (event.entityLiving instanceof EntityZombie)
  303.             {
  304.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  305.                 if (rand < 0.10d)
  306.                 {
  307.                     event.entityLiving.dropItem(MobDrops.zombieArm, 2);
  308.                     event.entityLiving.dropItem(MobDrops.zombieBrain, 1);
  309.                 }
  310.             }
  311.         }
  312.     }
  313.     public void onEntityDropPigZombie(LivingDropsEvent event)
  314.     {
  315.         if (event.source.getDamageType().equals("player"))
  316.         {
  317.             rand = Math.random();
  318.  
  319.             if (event.entityLiving instanceof EntityPigZombie)
  320.             {
  321.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  322.                 if (rand < 0.10d)
  323.                 {
  324.                     event.entityLiving.dropItem(MobDrops.pigmanMeat, 2);
  325.                     event.entityLiving.dropItem(Items.golden_sword, 1);
  326.                 }
  327.             }
  328.         }
  329.     }
  330.     public void onEntityDropSkeleton(LivingDropsEvent event)
  331.     {
  332.         if (event.source.getDamageType().equals("player"))
  333.         {
  334.             rand = Math.random();
  335.  
  336.             if (event.entityLiving instanceof EntitySkeleton)
  337.             {
  338.                 //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
  339.                 if (rand < 0.10d)
  340.                 {
  341.                     event.entityLiving.dropItem(Items.skull, 1);
  342.                     event.entityLiving.dropItem(Items.bow, 1);
  343.                 }
  344.             }
  345.         }
  346.     }
  347. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement