Allow making component changes conditional on predicates (fixes empty shulker box stacking)#20
Conversation
|
@0x4e49434f4c45 how does one download this fork as a mod, and what is the correct syntax for specifying custom components? since the mod author is currently silent i doubt they will merge the pr and release the update anytime soon |
|
You can download/clone the forked repo and then just run I'm not sure what you mean by your second question, but the |
|
That is precisely what I meant, I must have missed the edits made to the shulker boxes datapack in this PR. Thank you and have a good one |
Fixes #13
This change allows datapacks to specify a predicate in addition to an item or tag, which is evaluated before applying the changes.
The motivating use case is to allow only empty shulker boxes to stack. The existing implementation supports stacking shulker boxes, but also allows stacking full shulker boxes if their contents match. With this change, a predicate can be used to modify the shulker box max stack size only if the box is empty. But because predicates are used, any condition can be applied which can be expressed as a predicate.
The approach in this PR is to apply conditional changes (those that contain predicates) at the ItemStack level instead of the Item level. Unconditional changes (those without predicates) are still applied at the Item level to avoid taking any performance penalty. That being said, this change set has been used to implement stackable empty shulker boxes on the tech server I run for the last year without any measurable performance impact.
UPDATE: This PR now also updates the pack.mcmeta files for compatibility with Minecraft 1.21.9+.