Started by
AgentCPU0
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a mod that adds a new loot table to all mobs, but I'm having trouble getting it to work. It's my first time using the app. What do I need to do?
Are you making 1 item drop or multiple? Multiple requires multiple loot pools, and a selection of multiple items to drop that only drops one requires multiple pool entries. Sorry if this is confusing, I'm not really good at explaining things.
This wiki page could help:
https://mcreator.net/wiki/how-make-loot-table
I only want it to drop 1 item, on top of vanilla loot
Use a "Entity dies" trigger and then use a World Management procedure block to "Spawn Item at X Y Z".
I don't see the "entity dies" trigger
https://imgur.com/a/3JHCxeT
Okay, I got it working, but it overwrote the vanilla mob loot. Can that be fixed?
Nevermind, I'm really confused. I have no clue what I'm doing at all. It's my first mod. What do I even do, from start to finish, to drop a single modded item?
Not sure what you have going wrong. I just made a quick test procedure, just the trigger and the item spawn block. Works perfectly. Spawned some zombies. Upon death they always dropped my bonus item and also their normal drops (some dropped nothing, some dropped rotten flesh).
Make a new Procedure, call it whatever you like.
Set the trigger and add the spawn command block, selecting whatever item you want to drop in the red square thing.
https://imgur.com/a/ez9ueSw
Save and run a test game. Any time any mob dies, it should always drop the above item as well as its normal drops. You can then get more advanced and add checks for mob type, or additional drop choices, etc...
That's great, but I need spectific entities to drop specific items, not all entities
When modding, particularly when just starting out, it's important to take things one step at a time. If you try to tackle every nuance of your idea all at once you're destined to fail. You'll have so many possible things that can be going wrong you won't be able to recognize what parts are even working.
Start with the most basic step. Verify that it is working as you intend, then add the next bit of complexity. If something goes wrong, you'll know what it was that caused the problem and can work on a solution.
In your case, you want to give certain mobs certain extra drops, right? Well, first you need to make sure you can can an item to drop at all. Don't try to run before you can walk.
Anyway, once you get your procedure working so that items are dropping, you can work on adding a check for certain mob types. For this you will use a basic If/Do statement, found under Flow Control. Attach to the "If" connection an "Is [Event/target entity] (sub)type of <your mob>" block, found under Logic. Put the Spawn item block in the "Do" section. Bam, now your item only drops from the selected mob type.
Thank you, I got it working. Just one last thing. How do I get Looting to affect my new drop?
Since this doesn't use the base loot system you'll need to simulate the Looting effect manually. There are ways to add drops to vanilla system, but it isn't particularly easy and straightforward.
So, to simulate Looting you'll need to do a few things. First you need to detect if Looting is in effect. You can do a check for the enchantment level of Looting of the item in the player's main hand.
It can be hard to find the right command blocks, even if you know exactly what you're looking for. Make use of the [search procedure blocks] function at the top of the procedure window to hunt for keywords. For example, type "enchant" and it will pop a list of any relevant blocks.
Once you can detect Looting, you'll need to do something with it, what exactly is up to you. You can add a flat bonus to the number of drops or random chance for bonus drops all based on the Looting level you detected. Look up a tutorial on how to use random.