How to change mob drops?

12 posts / 0 new
Last post
Offline
Last seen: 6 months 2 days ago
Joined: 04/26/2015 - 23:22
Gems: 0
How to change mob drops?

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.



Brich036's picture
Offline
Last seen: 1 week 2 days ago
Joined: 05/11/2015 - 03:57
Gems: 2
ok if you mean normal

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

Offline
Last seen: 6 months 2 days ago
Joined: 04/26/2015 - 23:22
Gems: 0
RE:ok if you mean normal

@Brich036 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?

Nuparu00's picture
Offline
Last seen: 8 hours 26 min ago
Joined: 08/27/2013 - 18:03
Gems: 276
You DON'T must make new mobs.

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: Highlight to view
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(){}
}

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%.

Offline
Last seen: 6 months 2 days ago
Joined: 04/26/2015 - 23:22
Gems: 0
RE:You DON'T must make new mobs.

@Nuparu00 Thanks

Offline
Last seen: 6 months 2 weeks ago
Joined: 06/19/2016 - 08:01
Gems: 0
RE:You DON'T must make new mobs.

@Nuparu00 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. 

Nuparu00's picture
Offline
Last seen: 8 hours 26 min ago
Joined: 08/27/2013 - 18:03
Gems: 276
RE:RE:You DON'T must make new mobs.

@venomsoar 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)?

Offline
Last seen: 1 month 2 weeks ago
Joined: 11/17/2016 - 12:18
Gems: 2
RE:RE:RE:You DON'T must make new mobs.

@Nuparu00 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?

Nuparu00's picture
Offline
Last seen: 8 hours 26 min ago
Joined: 08/27/2013 - 18:03
Gems: 276
You can easily get your

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

LueLusten's picture
Offline
Last seen: 1 month 1 week ago
Joined: 11/16/2016 - 03:22
Gems: 133
Question why does the chicken

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.

LueLusten's picture
Offline
Last seen: 1 month 1 week ago
Joined: 11/16/2016 - 03:22
Gems: 133
This does not work in 1.7.1

This does not work in 1.7.1

Pages