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

Started by Finemanederby on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
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"

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

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

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

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
....What
Sat, 05/12/2018 - 22:46

....What

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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));

}

}

}

 

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
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?

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

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

It is simply just EntityWitherSkeleton

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
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. 

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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)

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
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.. 

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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.

Active 9 months ago
Joined Aug 2013
Points:
1160

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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.

Active 2 years ago
Joined Jul 2017
Points:
809

User statistics:

  • Modifications: 2
  • Forum topics: 10
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 105
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)

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

  • Modifications: 3
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 106
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?

Active 2 years ago
Joined Apr 2015
Points:
975

User statistics:

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

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