Jump to content

Get Vanilla Block drops [1.16.5]


Yurim64

Recommended Posts

12 minutes ago, Yurim64 said:

With BlockState.getDrops() i need a LootTable.Builder context, how can i get that context?

Have you looked at the LootTable.Builder class to see if it has any useful methods for creating one? That's where I would start! :)

Link to comment
Share on other sites

Yeah, i saw the code of LootTable and of the Builder, but there is nothing that can help me.
I also found the class LootTables that has some static ResourceLocation of the vanilla loot table files, but i don't know hot to apply them.

Link to comment
Share on other sites

One idea is to look for existing usage of the class and replicate it.

The problem is that you can't just "get a block's drops" because it might depend on who's harvesting the block (or for that matter, it might be random!)

What effect are you trying to achieve? (answer from what the player observes happening, not your attempt to code it).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

The idea is that, the player build a specific structure.
This structure can place and harvest a tree, and place the drops in a chest.

 

So i need the drops of log and leaves, as if the player breaks them.

Edited by Yurim64
Link to comment
Share on other sites

3 minutes ago, Yurim64 said:

The idea is that, the player build a specific structure.
This structure can place and harvest a tree, and place the drops in a chest.

 

So i need the drops of log and leaves, as if the player breaks them.

so why do you not use Block#getDrops?

Link to comment
Share on other sites

2 minutes ago, Yurim64 said:

Because it needs a LootContext.Builder as parameter;

And if i create one with the ServerWorld as paramenter, it gives me errors as malformed Builder.

use the static method Block#getDrops, which requires a BlockState, a world, a position and a TileEntity (nullable)

Edited by Luis_ST
Link to comment
Share on other sites

8 minutes ago, Luis_ST said:

use the static method Block#getDrops, which requires a BlockState, a world, a position and a TileEntity (nullable)

BlockState -> yes, ServerWorld -> yes, BlockPos -> No, TileEntity (Nullable) -> yes

check the parameters that you have specified

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
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.



×
×
  • Create New...

Important Information

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