Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help - Dynamic Loot Drops?


Recommended Posts

So I have a block class, that I intend to use as a base class for several other blocks. The block class is called a CoinPile. I have several blocks that will be different instances of that CoinPile. I have it set up so that a coin is used as a block item to get it started. I want to be able to right click with a coin stack in hand and add one coin to the pile per right click. And if I right click with an empty hand, it pops off one coin. If I punch the pile, it drops all of the coins in the pile as items. I do not know how to go about this. I had hoped there would be some way to make a dynamic loot table so that just based on a block state integer it would multiply the drop count by that integer, but I so far haven't figured out how to do that aside from having just 64 different loot drop conditions.

Link to comment
Share on other sites

Register a custom LootNumberProviderType. You register it using DeferredRegister. In there you return the number of coins based on the LootContext (get the BlockState that is being dropped using LootContextParams.BLOCK_STATE). Then you can use the "set_count" loot function with your new number provider type to set the count of the stack.

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.

 Share



×
×
  • Create New...

Important Information

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