Jump to content

Adding loot drop to vanilla block


Koque

Recommended Posts

Hey,

Because i couldn't find entry for loot tables in the 1.15.x documentation, so I tried to edit the drop from a sand block with the help from the 1.13.x documentation. But I ran in two problem.

 

After reading the article about editing vanilla loot tables my code looks like the following:

@SubscribeEvent
public void lootLoad(LootTableLoadEvent event) {
    if (event.getName().toString().equals("minecraft:blocks/sand")) {
        
	LootEntry entry = new LootEntryTable(new ResourceLocation("mymod:inject/sand"), 100, 100, 0, "sand_entry");

	LootPool pool = new LootPool(new LootEntry[] {entry}, 0, 1, 0, "sand_pool");

	event.getTable().addPool(pool);

    }
}

 

The following errors appear:

 

1. The documentation says, I need to create a new LootEntry with new LootEntryTable(), but there is not a Class LootEntryTable, which can be imported.

2. When trying to create the pool, the IDE says: 

                 private LootPool(@NotNull net.minecraft.world.storage.loot.LootEntry[] p_i51268_1_,
                 @NotNull net.minecraft.world.storage.loot.conditions.ILootCondition[] p_i51268_2_,
                 @NotNull net.minecraft.world.storage.loot.functions.ILootFunction[] p_i51268_3_,
                 net.minecraft.world.storage.loot.IRandomRange p_i51268_4_,
                 net.minecraft.world.storage.loot.RandomValueRange p_i51268_5_,
                 String name)

No plan what the IDE wants me to say. :(

 

Due to I haven't used Java in a while and switched from NetBeans to Intellij, I a noob in this area.

 

I appreciate every kind of help. :)

Edited by Koque
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.