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

Hotswap Hotbars #850

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Hotswap Hotbars #850

wants to merge 25 commits into from

Conversation

BPR02
Copy link
Member

@BPR02 BPR02 commented Feb 19, 2023

Hotswap Hotbars allows players to craft a new item: the hotswapper!
Screen_Shot_2023-02-18_at_8 29 33_PM
Any shulker box can be used in the recipe and by default the hotswapper is a brown shulker box, but it can be renamed and recolored with no issues. When placed down, players can configure the three additional hotbar rows which will be saved back onto the item when broken.

To use the hotswapper, players must equip it in their offhand. When this happens it will turn into a firework star to prevent players from accidentally placing down the hotswapper as a shulker box.

When equipped in the offhand, swapping hands will instead swap hotbars, cycling between the 3 rows stored in the hotswapper (plus the active hotbar, making 4 rows total). This will store any changes made to the hotbars, so shulker boxes can be stored inside the hotswapper (the only way to put a shulker box in a saved hotbar).

To place down and modify the hotswapper as a shulker box players must go into their inventory and move the hotswapper to a different slot (that's not the mainhand) and it'll convert back to a shulker box. All data is saved between the two states of the hotswapper, so no name, lore, enchantments, shamirs, etc. are lost.

Hotswappers can have the Animi Shamir equipped to it.

New module (name subject to change)
description todo
- hotswappers will retain their custom name when placed and broken
- fixes some bugs related to copy-paste typos
- still has a bug when placing shulker box with offhand, but that will be irrelevant after next push which changes it to a firework star when in the offhand
@BPR02 BPR02 marked this pull request as draft February 19, 2023 22:56
- When in the offhand, the hotswapper will turn into a (colored) firework star so the player cannot accidentally place it down
- CMD changed to 5 as to not conflict with other firework stars
- allows animi to be added to the hotswapper
@BPR02 BPR02 marked this pull request as ready for review February 21, 2023 05:45
- make firework star state nonstackable
- prevent crafting a hotswapper with a hotswapper
- Firework star states no longer wait until there's no hotswapper in offhand before converting back into a shulker box
@misode misode added module A concept-approved module to be added to the repository needs-testing Requires in-game testing labels Mar 9, 2023
@EpyonProjects
Copy link
Member

Downloaded the artifact, tested in 1.19.4. Works great, feels seamless, can't seem to find any issues 👍

Copy link
Member

@TheThanathor TheThanathor left a comment

Choose a reason for hiding this comment

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

Left a few minor points. Code looks good, and the module feels great to use in-game.
It could be be updated with the new 1.19.4 features before release, but that's not at all necessary.

What could be added is a custom texture for the Hotswapper (especially the firework form), kyrkis is looking for something to work on, so you can ask him to make something.

@@ -0,0 +1 @@
execute if score gm4_hotswap_hotbars load.status matches 1 if score $crafted gm4_crafting matches 0 store success score $crafted gm4_crafting if score $slot_count gm4_crafting matches 9 if score $stack_size gm4_crafting matches 1 if data storage gm4_custom_crafters:temp/crafter {Items:[{Slot:0b,id:"minecraft:leather"},{Slot:1b,id:"minecraft:leather"},{Slot:2b,id:"minecraft:leather"},{Slot:3b,id:"minecraft:copper_ingot"},{Slot:4b,item_tags:{gm4_hotswap_hotbars:{shulker_boxes:1b}}},{Slot:5b,id:"minecraft:copper_ingot"},{Slot:6b,id:"minecraft:leather"},{Slot:7b,id:"minecraft:leather"},{Slot:8b,id:"minecraft:leather"}]} unless data storage gm4_custom_crafters:temp/crafter {Items:[{Slot:4b,tag:{gm4_hotswap_hotbars:{item:"hotswapper"}}}]} run function gm4_hotswap_hotbars:craft
Copy link
Member

Choose a reason for hiding this comment

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

File missing a header

@TheThanathor
Copy link
Member

tested in 1.20, works as expected and was unable to break anything

@TheThanathor
Copy link
Member

Notes after some playtesting:

  • conserve colour during crafting
  • don't allow storing of shulker boxes or hotswappers in firework star form inside hotswappers (really easy to chunk ban an area), instead drop the item at the players feet with 0 PickupDelay
  • don't HideFlags the contents of the shulkerbox
  • crafting recipe might need tweaking

@BPR02
Copy link
Member Author

BPR02 commented Jul 25, 2023

I've made the changes outlined in Thanathor's latest post. The recipe tweak hasn't been made since that's waiting for further discussion on discord. I didn't (and currently can't) test the changes, so if someone could see if the following works that'd be great:

  • When crafting, the color of the shulker box doesn't change (test with all colors)
  • When there are items in the hotswapper, the advanced tooltips say what the items are (just like a normal shulker box)
  • Trying to swap a shulker box and/or hotswapper firework star into a new hotbar results in those items being dropped at the player's feet (I forgot how to obtain the firework star item, but there is a minor, non-destructive exploit to get it in the inventory)

@Bloo-dev
Copy link
Member

Update on this for future us:
This is still being worked on but has dropped on the priority list (to make space for more important projects such as the Guidebook).

At some point this will need to be tested & potentially updated to be compatible with newer minecraft versions.

@Bloo-dev Bloo-dev removed the needs-testing Requires in-game testing label Nov 28, 2023
new recipe as decided in a meeting, now involving 7 copper ingots, 1 shulker box, and 1 piston
- dupe bug introduced when preventing hotswappers and shulker boxes from being saved (issue was the hotswapper item would be dropped since it's invalid, but the function still restores the item into the offhand)
- Change name to "Mechanical Shulker Box"
- Hide Firework Star color info
@BPR02
Copy link
Member Author

BPR02 commented Dec 17, 2023

This has had a few updates, notably the crafting recipe has been changed (see below) and the name of the item was changed to "Mechanical Shulker Box." Additionally, a dupe bug that was introduced in the commit to prevent hotswappers and shulker boxes to be stored was squished. Also, now it properly hides the color data of the firework star when it's in the offhand.

I've tested it for 1.20.2 and I didn't see anything that'd break in 1.20.3-1.20.4, though if someone would like to test it, that'd be awesome.

@BPR02
Copy link
Member Author

BPR02 commented Dec 17, 2023

New recipe
recipe

- only one shulker box at a time would be restored, all others would be lost
- light blue shulker boxes were missed and always deleted

- all shulker boxes would be returned, not just the ones in the hotbar leading to duped shulker boxes if in the normal inventory
- piston with CMD 3420008
  - works in all 6 rotations, matching how a piston is rotated
Copy link
Member

@Bloo-dev Bloo-dev left a comment

Choose a reason for hiding this comment

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

I tested this in-game and found a couple of issues.

Loss of custom data (breaking):

  1. Be in survival mode and have a hotswapper in your hotbar
  2. Place the hotswapper
  3. Break it by hand
  4. ❌ The hotswapper loses all its custom data; It is now called 'Customize Hotbars' and no longer becomes a firework star when placed in the offhand.

Wooden swords visuals:

  1. Have a hotswapper in your offhand, with some items inside
  2. Press the offhand key (F by default) whilst looking down
  3. ❌ You can see wooden swords spawning in for a split second, additionally, if you do this on a hopper the hopper will steal your items (but those items wont be wooden swords)

@Bloo-dev
Copy link
Member

This PR is outdated, as it does not support 1.21.

@Bloo-dev Bloo-dev added the invalid The structure of this is missing files or contains unwanted files label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid The structure of this is missing files or contains unwanted files module A concept-approved module to be added to the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants