Jump to content

[1.12] Mod drop loot, am I doing this right?


TheGoldenProof

Recommended Posts

I'm trying to make wither bosses drop this item (ModItems.ELUCIDATOR) and its not working. What am I doing wrong?

 

@SubscribeEvent
public void loadLootTables(LootTableLoadEvent event) {
	if (event.getName().toString().equals("minecraft:entities/wither")) {
		LootFunction[] funcs = {};
		LootCondition[] conds = {};
		LootEntry[] loots = {
				new LootEntryItem(ModItems.ELUCIDATOR, 99999, 7, funcs, conds, "elucidator") //just using 99999 as a test weight to make sure its actually working and I'm not really unlucky
			};
		LootPool pool = new LootPool(loots, conds, new RandomValueRange(1, 1), new RandomValueRange(0), "saomodpool");
		event.getTable().addPool(pool);
	}
}

 

Link to comment
Share on other sites

24 minutes ago, TheGoldenProof said:

//just using 99999 as a test weight to make sure its actually working and I'm not really unlucky

If your entry is the only one then the weight does not matter.

 

If you want to add new drops to the pool use json, there is no need to do it from code. Read the official docs on the matter.

Link to comment
Share on other sites

4 minutes ago, TheGoldenProof said:

I have 0 understanding of json so I'm trying to avoid it as much as possible.

You need to rethink your approach. If you don't understand something you need to learn it, not avoid it like a plague. Minecraft is getting more and more data driven and utilizes json for more and more of it's things. If you wish to continue modding you need to learn to use json. It's not very difficult. You've learned to use java after all, that's way more difficult than some json.

Link to comment
Share on other sites

JSON stands for JavaScript Object Notation, it’s just a serialised representation of an object. As voidwalker said, learnig java is a lot harder and you’ve already done it.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

try this:

        @SubscribeEvent
		public void mobDrop(LootTableLoadEvent event) {
	    
	    if (event.getName().equals(LootTableList.ENTITIES_WITHER)) {
		   	 
	        final LootPool main = event.getTable().getPool("main");
	 
	        if (main != null) {
	 
	        	main.addEntry(entry);
	            
	        }
	    }
	    
	  }

 

Edited by nov4e
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.