Make mobs drop all their stuff on death

Started by fenixgalax on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make mobs drop all their stuff on death

Good day!

Im very new to this and im trying to make a mod that would make mobs like skeletons zombies and such drop all their equipped gear on death....

 

Is the a simple way to do it or do i need to make a loot table for each individual mob?

 

thanks for any help.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is a simple way to do…
Mon, 10/09/2023 - 16:09

There is a simple way to do this. The chance of a mob dropping its armor and held items is determined by an NBT tag. This means you can make a procedure that triggers when an entity spawns, checks if the entity is a monster, and, if it is, overrides that NBT tag to be 1. (Guaranteed 100% chance- by default, it's more like 0.02, or 2%.) You can do this by either using a data merge command, or by using NBT modifier functions in MCcreator, and it'll work for any monster entity that can have stuff equipped. (If you look at the items tab of this command generator, it should give you the tags you need.)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
would i need to do this for…
Thu, 10/12/2023 - 20:28

would i need to do this for each individual mob or will it work for all at once?

 

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so i made a tag that puts…
Thu, 10/12/2023 - 21:17

so i made a tag that puts all the mobs i want to drop gear in one group....

now im trying to make a procedure that would make all the mobs with that tag change their nbt for gear drop to 100% chance but im not sure what to use and in which order....

 

Please help!!!

Thank you in advance.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You just need a procedure…
Thu, 10/12/2023 - 21:36

You just need a procedure with the 'when entity spawns' global trigger. 

Then you need an 'if' bracket that checks if your entity has your custom tag.

If it does, inside the if bracket, you want to run a command that changes the Hand-drop-chance NBT tag to 1.0, using a command that targets the nearest entity. (You would use /data, which allows you to override NBT tags.) The specific command I use for this is:

/data merge entity @e[type=wither_skeleton, sort=nearest, limit=1] {HandDropChances:[0.2f],ArmorDropChances:[0.2f,0.1f,0.1f,0.2f]}

...Where you replace type with the registry name of the entity you want. 0.2f gives a 20% chance of tropping, and 0.1f gives a 10% chance. You would want to replace all of these with 1.0f. 

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i actually managed to do it…
Fri, 10/13/2023 - 11:21

i actually managed to do it without checking for the entity.

just placed run command with your code and i adjusted it to 100% drop in the spawn event of the mob.