Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shulkerboxes.sc 1.21 data components compability #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Senth
Copy link
Contributor

@Senth Senth commented Jul 29, 2024

Due to changes in data components, the shulker boxes script stopped working in 1.20.5/1.21. This PR makes shulkerboxes.sc compatible with 1.21 (and possibly 1.20.5, but I haven't tested it)

What changed

  • Data components migration
    • Count is now lowercase count
    • Shulker inventory has been moved. BlockEntityTag.Items is now components."minecraft:container"
    • Custom data should be stored in components."minecraft:custom_data"
  • Simplified some lines
  • Consistency: Renamed variables to be more consistent across functions
  • Formatting (remove trailing spaces, tabs were replaced with two spaces to be consistent with the rest of the file)

Testing (only tested in 1.21)

  • The following modes that were affected
    • vacuum
      • 1 item
      • full stack
      • full stack where shulker has would be filled up, remaining should be picked up by the player
    • restock same
    • restock keep
    • restock keep vacuum
    • swap next
    • swap same
  • Potions refills
  • Totem of undying

Note

I installed the vim plugin for scarpet, which reformatted the file, removing some trailing spaces. I can always split the PR into two if it needs to be more clear.

@Senth Senth changed the title Fix hulkerboxes 1.21 data components compability Fix shulkerboxes.sc 1.21 data components compability Jul 29, 2024
Copy link

@mal0andre mal0andre left a comment

Choose a reason for hiding this comment

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

works perfectly

[item, count, tag] = e~'item';
items_left = __add_item_to_vacuum_sboxes(player, item, count, tag, true);
count_to_remove = count - items_left;
if (count_to_remove, modify(e, 'nbt_merge', '{Item:{Count:'+(count-count_to_remove)+'b}}'));
if (count_to_remove, modify(e, 'nbt_merge', '{Item:{count:'+(count-count_to_remove)+'}}'));

Choose a reason for hiding this comment

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

Should Item be changed to item here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just remembered that I need to answer this one. Item should be uppercase. I tried with lowercase first but that did not work. My guess is that {Item: is part of scarpet and not Minecraft, but I'm not too familiar with either one.

@lil-fox
Copy link

lil-fox commented Oct 21, 2024

vacuum didn't work in pickup mode

@lil-fox
Copy link

lil-fox commented Oct 21, 2024

mb, it work, but only if you have full stack, insted of work even vith one item, like in original

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.

4 participants