How to change mob drops?

Started by FireBlast on Sun, 11/22/2015 - 16:29
Last seen on 01:19, 22. Jul 2016
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How to change mob drops?
Sun, 11/22/2015 - 16:29

I want that a zombie drop rotten flesh and bones, and the chicken just drops raw chicken.

Is there some way to change the mobs drops?

P.S: Sorry for my bad English, i'm not from US or UK.

Last seen on 08:18, 12. Jan 2018
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
ok if you mean normal
Sun, 11/22/2015 - 20:07

ok if you mean normal minecraft zombies and chickens then you can do that but if you had made your own zombie and chicken you can put those drop

Last seen on 01:19, 22. Jul 2016
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:ok if you mean normal
Sun, 11/22/2015 - 22:17

@#1 OK, but if i create a new zombie and a new chicken, the original ones will drop they original drop. How can i delete them, or something else?

Last seen on 14:11, 15. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
You DON'T must make new mobs.
Sun, 11/22/2015 - 23:04

You DON'T must make new mobs. You can easily edit the vanilla mobs.

Make new overlay. There don´t edit anything and click "finish" or "next".

View source of this "Overlay". Remove some things. You need your "overlay" class looks like this: 

[spoiler]import ..........

public class mcreator_overlayTest{

public static class GUIRenderEventClass
{}

public mcreator_overlayTest(){}

public Object instance;
public void load(FMLInitializationEvent event){
    MinecraftForge.EVENT_BUS.register(new GUIRenderEventClass());
    
     
}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public int addFuel(ItemStack fuel){return 0;}
public void serverLoad(FMLServerStartingEvent event){}
public void preInit(FMLPreInitializationEvent event){}
public void registerRenderers(){}
}[/spoiler]

to the public static class GUIRenderEventClass
add:

  public void playerKilledZombie(LivingDropsEvent event)
   {
      if(event.entityLiving instanceof EntityZombie)
      {

        

        event.entityLiving.dropItem(Items.rotten_flesh, 1);

         event.entityLiving.dropItem(Items.bone, 1);
        
      }
    
}


Now the zombie will drop rotten flesh and bone.

 

For the chicken under previous text add:

@SubscribeEvent
public void playerKilledChicken(LivingDropsEvent event)
   {
      if(event.entityLiving instanceof EntityChicken)
      {

         event.drops.clear();
         ItemStack itemStackToDrop = new ItemStack(Items.chicken, 1);
         event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, 
              event.entity.posY, event.entity.posZ, itemStackToDrop));

       
        
      }
    
}

And that's all! And yes i tested it and this method works on 100%.

Last seen on 01:19, 22. Jul 2016
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:You DON'T must make new mobs.
Sun, 11/22/2015 - 23:05

@#2 Thanks

Last seen on 17:02, 6. Jul 2016
Joined Jun 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:You DON'T must make new mobs.
Sun, 06/19/2016 - 07:52

@#2 Can you help me on how to change the drops of a cow? I made a custom item (Cowhide) and I want to replace cows dropping leather to dropping my custom item. I tried copying the code you put up and changing certain things but it just failed. 

Last seen on 14:11, 15. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
RE:RE:You DON'T must make new mobs.
Sun, 06/19/2016 - 22:27

@#2.2 1st - was the class "Event Handler" (or simplier - empty GUI Overlay) ?
2nd - what exactly do you mean by "it just failed"?

3rd - can I see your code + crash log (if there is any)?

Last seen on 02:36, 4. Dec 2016
Joined Nov 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:RE:RE:You DON'T must make new mobs.
Sun, 11/20/2016 - 23:48

@#2.2.1 I'm doing something similar right now, trying to add a custom item to squid drops.

So far I've changed the code in the overlay as per your instructions and now am here:

public static class GUIRenderEventClass
{ public void playerKilledSquid(LivingDropsEvent event)
   {
      if(event.entityLiving instanceof EntitySquid)
      {

        

        event.entityLiving.dropItem(Items.ink_sac, 1);

         event.entityLiving.dropItem(Items.Xylan, 1);
        
      }
    
}
}

Can you tell me what information I need to properly refer to my custom item, and if there's anything apparently wrong with this code?

Last seen on 14:11, 15. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
You can easily get your
Mon, 11/21/2016 - 06:17

You can easily get your custom item using "mcreator_itemName.block", Also you miss @SubscribeEvent before the void

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Question why does the chicken
Mon, 11/21/2016 - 17:17

Question why does the chicken have to be clearned and why is it a different code then the rest I am confused why the mobs code wouldn't follow a patten.

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
This does not work in 1.7.1
Mon, 11/21/2016 - 17:53

This does not work in 1.7.1