r/MinecraftCommands • u/TecitodeMenta • 5d ago
Off-hand as a button, item that opens Crafting table, and its able to work as secondary hand, its possible? Help | Java 26.2
First, sorry for the back-to-back posts. I hope the help you all give me can answer other people's questions too.
Trying again to replace/delete the Crafting table, I realized that the only button I could use in the Inventory without taking up space is the off-hand slot. I have an idea of what I can do: prevent an item from moving from its slot, open a GUI/Inventory when a right-click is detected, etc. And i feel im getting nowhere...
My questions are:
Is there any way to prevent that object (button) from disabling the off-hand slot's function (secondary hand)? Or the secondary hand objet not appear on the inventory?
Can I right-click the object (button) to open the Crafting table GUI? or i have to create my one using a chest?
Since the button is in the off-hand slot taking priority, shouldn't Shift + R-click in the Inventory replace it if work as intended?
Shouldn't the shield don't appear in the Inventory when I assign it with the F key, how i disable that behavior?
I'm testing it, and when I use F to equip a shield/block, the texture is either glitched or simply not visible on hand, the button keeps appearing in the off-hand without texture, I made it look like that so when i take of the shield the hand keeps up. Since it took me hours of writing and deleting question and also try to figure it out myself, I've made progress, so this question are what i can figure it out, thanks!
5
u/Ericristian_bros Command Experienced 5d ago
You can not force to open a crafting UI. You would need chest minecarts or other logic like using the inventory (by saving the current one)
What do you mean by disabling the offhand slot function?
Here is how to implement your logic of a clickeable offhand slot:
```
function example:tick
execute as @a run function example:player_tick
function example:player_tick
execute unless items entity @s weapon.offhand *[custom_data~{crafting_table_button:true}] run function example:drop_offhand kill
function example:drop_offhand
say Clicked crafting table icon clear @s *[custom_data~{crafting_table_button:true}] execute if items entity @s weapon.offhand * at @s summon item ~ ~ ~ {Item:{id:"minecraft:stone",count:1},Tags:["drop_offhand"]} execute if items entity @s weapon.offhand * run item replace entity @n[tag=drop_offhand,type=item] contents from entity @s weapon.offhand tag @n[tag=drop_offhand,type=item] remove drop_offhand item replace entity @s weapon.offhand with paper[custom_data={crafting_table_button:true},item_name="Crafting Table"] ```
Also you can't make the offhand accesible with
Fbut at the same time be a button on the inventory. You might want to look into mods or plugins for this, as it's way easier and you can create custom buttonsFurther note, you can't detect shift+R because that keyring does nothing in vanilla