How do I make vanilla mobs drop custom/modded drops?

Started by Finemanederby on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make vanilla mobs drop custom/modded drops?

I have been trying to figure this out for weeks.. Someone please help!

Ex: Wither Skeleton drops "Wither Bone"

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can subscribe to…
Sat, 05/12/2018 - 21:19

You can subscribe to LivingDropsEvent event and add the drops here.

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a class, that has a…
Sun, 05/13/2018 - 00:31

Make a class, that has a static method, that takes as a parameter LivingDropsEvent event. Then you can get the entity from the event, check if the entity is that you desire and add to a list, that you can get from the event as well, the drops. Then add before the method @SubscribeEvent annotation, so the game can find it.

Fast example:
 

public class Eventhandler{

public static void onEntityDrop(LivingDropsEvent event){

if(event.getLiving() instanceof EntityPig){

event.getDrops().add(new ItemStack(Items.bone));

}

}

}

 

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do you by any chance know…
Sun, 05/13/2018 - 01:09

Do you by any chance know the entity name for the wither skeleton?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is simply just…
Sun, 05/13/2018 - 15:18

It is simply just EntityWitherSkeleton

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a class and…
Sun, 05/13/2018 - 16:20

How do I make a class and then add the @SubscribeEvent annotation? Sorry I am really new to coding. 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can simply create your…
Sun, 05/13/2018 - 17:16

You can simply create your own class using the button in the code editor or you can use already existing class from some other MCreator generated element (if you have chosen the later, I recommend you to use some dummy GUI Overlay element)

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I made a new class and…
Sun, 05/13/2018 - 19:15

So I made a new class and copy and pasted the code you sent and the recompilation failed... I'm so confused.. 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It was a fast example -…
Sun, 05/13/2018 - 20:30

It was a fast example - pseudocode - you have to use the exact method names from the event. It was meant for giving you some clue what you need to do.  Also 2 more things.
First, every time when you have some error and you want help with it, post everything you can  - code, console log/ crash log (if any). It is also quite recommended to use pastebin with correct Syntax Highlighting selected.

Second thing is that I have already answered this question here on a forum like 1- 2 years ago, so if you want, you can look there.

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
By the way, I have just make…
Sun, 05/13/2018 - 22:54

By the way, I have just make a fast look to the actual code for you and it seems that only difference between the pseudocode and the real one is that instead of "getLiving()" you have to use "getEntityLiving()". If you change this, it should work. If it does not, you can try to fix imports.

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hey, you can create a…
Sun, 05/20/2018 - 22:45

hey, you can create a procedure to that

if its a custom mob, do event: when entity is killed

spawn gem at x y z (item)

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So... How do I get a wither…
Mon, 05/21/2018 - 00:45

So... How do I get a wither skeleton to drop a custom item?

Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
May I have a picture…
Mon, 05/21/2018 - 00:47

May I have a picture tutorial? That would be greatly appreciated.