Skip to content

Fix: Updated Clipboard Interaction for Latest Create (DataComponents & API Migration)#31

Merged
MotionlessTrain merged 3 commits into
MotionlessTrain:1.21from
Enzo1990-ui:1.21
Feb 3, 2026
Merged

Fix: Updated Clipboard Interaction for Latest Create (DataComponents & API Migration)#31
MotionlessTrain merged 3 commits into
MotionlessTrain:1.21from
Enzo1990-ui:1.21

Conversation

@Enzo1990-ui
Copy link
Copy Markdown

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: 822537f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
CreateColonies Patch

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

Copy link
Copy Markdown
Owner

@MotionlessTrain MotionlessTrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer isBound checks myself

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've modified that, is should be available now.

Copy link
Copy Markdown
Owner

@MotionlessTrain MotionlessTrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@MotionlessTrain MotionlessTrain merged commit a58e10d into MotionlessTrain:1.21 Feb 3, 2026
@MotionlessTrain MotionlessTrain mentioned this pull request Feb 3, 2026
@Enzo1990-ui
Copy link
Copy Markdown
Author

no problem glad I could help, been having a blast with creating the schematics, thank you for the mod

@MotionlessTrain
Copy link
Copy Markdown
Owner

Glad to hear that!
You’re welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants