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

Started by Finemanederby on Thu, 05/10/2018 - 20:35
Last seen on 04:35, 21. Jun 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How do I make vanilla mobs drop custom/modded drops?
Thu, 05/10/2018 - 20:35

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

Ex: Wither Skeleton drops "Wither Bone"

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

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

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

Last seen on 04:35, 21. Jun 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
....What
Sat, 05/12/2018 - 22:46

....What

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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));

}

}

}

 

Last seen on 04:35, 21. Jun 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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?

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

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

It is simply just EntityWitherSkeleton

Last seen on 04:35, 21. Jun 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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. 

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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)

Last seen on 04:35, 21. Jun 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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.. 

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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.

Last seen on 19:19, 21. Jun 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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.