Fix: Updated Clipboard Interaction for Latest Create (DataComponents & API Migration)#31
Conversation
🦋 Changeset detectedLatest commit: 822537f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
MotionlessTrain
left a comment
There was a problem hiding this comment.
If you could look at the comment (either explain why, or change it back), I think it is good to go!
| final BlockState blockStateClicked = world.getBlockState(blockPosClicked); | ||
| final ItemStack heldItem = evt.getItemStack(); | ||
|
|
||
| if (blockHutBuilder != null && blockStateClicked.is(blockHutBuilder) && clipboard != null && heldItem.is(clipboard)) { |
There was a problem hiding this comment.
Why did you change the isBound checks here to null checks? It should never be null, but it is only bound to an actual block / item if the mod is loaded (which does not need to be the case for Minecolonies, as it is an optional dependency)
There was a problem hiding this comment.
Ah, I actually carried that null check over from the original InteractionHook.java logic—I didn't intentionally change it from an isBound check.
You're right though; since it's an optional dependency, the RegistryObject itself wouldn't be null, just empty. I can update that check to .isPresent() (or .isBound()) to be safe. Let me know which method you prefer for this codebase!
There was a problem hiding this comment.
I prefer isBound checks myself
There was a problem hiding this comment.
i've modified that, is should be available now.
|
no problem glad I could help, been having a blast with creating the schematics, thank you for the mod |
|
Glad to hear that! |
This PR fixes the Builder's Hut clipboard interaction, which was broken due to the latest Create Item Stack changes.
Changes:
Migrated to DataComponents: Replaced the old manual NBT writing (getOrCreateTag) with the latest DataComponents system to prevent issues with item data handling.
Refactored Clipboard Logic: Switched to using Create's ClipboardContent API instead of manually constructing NBT lists, making the code cleaner and more robust.
Cleaned Imports: Removed unused imports and deprecated event result handling.
Tested and confirmed working on the Builder's Hut (correctly subtracts available/delivering items from the total count).