• Hey! Register here to create your account, engage with the community, and talk about what is new!

How do I disable the 2x2 crafting?

TheExtremeBurger

Notorious member
Joined
Sep 8, 2020
Messages
103
Reaction score
25
So I've seen some games where if you try to use the vanilla 2x2 crafting in your inventory, it closes your inventory so you can't vanilla craft to make vanilla items. I've heard it is hard to explain, but if anyone knows how to, can you tell me? It could be easier to type it out. Thank you
 

EmeralDev

Forum adept
Joined
Sep 7, 2020
Messages
193
Reaction score
30
what you want to do is this:

Code:
On Player Click Own Inv()
{
    If Variable(gameValue.getClickedIndex>=37)
    {
        CancelEvent();
    }
}

that should work, if it doesn't then tell me :)
 

TheExtremeBurger

Notorious member
Joined
Sep 8, 2020
Messages
103
Reaction score
25
Hey, thanks for the help, but for whatever reason it doesn't work. It disables most of the armor and offhand slots, but not the crafting menu. Also, when i send myself the Clicked Slot Index in the chat, and I click the crafting menu, nothing appears. Is there another trick to it?
 

RDM

Member
Overlord
Joined
Sep 6, 2020
Messages
36
Reaction score
22
@TheExtremeBurger

Also, when i send myself the Clicked Slot Index in the chat, and I click the crafting menu, nothing appears.

If that's the case, then you most likely can't check if the crafting inventory has been clicked through direct means, unless there's some uber simple "If Player Clicks Crafting Table Menu" action that I don't know of.

It appears that Click Own Inv doesn't run with crafting menus, so my recommendation would be to find something that does run when you click on the crafting menu slots. Test everything that could potentially work thoroughly. You can also still figure out if the crafting menu is clicked by checking if you aren't clicking on your inventory slots, but in order to do that we've got to sort out the crafting menu not being detected first.

I'll most likely have time today or tomorrow to find something concrete if you're still having trouble by then.
 

EmeralDev

Forum adept
Joined
Sep 7, 2020
Messages
193
Reaction score
30
Hey, thanks for the help, but for whatever reason it doesn't work. It disables most of the armor and offhand slots, but not the crafting menu. Also, when i send myself the Clicked Slot Index in the chat, and I click the crafting menu, nothing appears. Is there another trick to it?
it might not be 37. try toying around with numbers maybe with a sendmessage(eventClickedSlotIndex);
also, instead of cancel event, do close inventory as that might work better
 

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
you can try doing on click, get the inventory menu items (this will default to the 2x2 crafting if you are opening your own inv iirc) and see whether the list is equal to [air, air, air, air, air]. if its NOT equal, cancel event.

edit: or just a loop
 
Last edited:

RolandMC123

Forum adept
Joined
Sep 9, 2020
Messages
186
Reaction score
50
As RDM said, Player Event: ClickOwnInv doesn't activate when you click the crafting menu at all, so it won't output anything no matter what code you put in to detect that.
 

Vulcano

Forum adept
Overlord
Joined
Sep 11, 2020
Messages
251
Reaction score
65
I've seen games that force your inventory to close whenever you put something in the crafting grid. I'm not sure how they do it, though.
They probably check if they lost an item when they clicked, so they made sure it didnt just go in the inventory
 

TheExtremeBurger

Notorious member
Joined
Sep 8, 2020
Messages
103
Reaction score
25
I've experimented a bit, and for whatever reason, you can find the items in the game value Inventory Menu Items, without an actual Inventory Menu open. Additionally, the Inventory Menu Name game value will say "Crafting" when you don't have an actual inventory menu open. So, I believe you have to check if your "menu" name is "crafting", and if there is anything in there, your inventory is closed. Only thing is, I don't know what the name really is. I've tried just "Crafting" with the natural italics, and that didn't seem to work.
 

RolandMC123

Forum adept
Joined
Sep 9, 2020
Messages
186
Reaction score
50
can no one read my message when I say the player event doesn't even run when clicking the crafting menu
 

TheExtremeBurger

Notorious member
Joined
Sep 8, 2020
Messages
103
Reaction score
25
I've found how to disable it!

What you do, is, on a loop:

If Var: (GameValue: OpenInvTitle) Contains txt(Crafting)

Then, Set Variable: Join Text var(%default inventory items) to gameValue: InventoryMenuItems

Now, an If Var: var(%default inventory items) =! airairairairair

Then PlayerAction: CloseInventory

sorry if the explanation is bad, i can't write instructions well, especially in a semi code format lol
also, "airairairairair" is the 5 inventory slots of the Crafting menu. Using jointext doesn't put in spaces

also, thx stinkey, I didn't see the message until now, and I figured it out lol
 

The Cube

Moderator
Moderator
Joined
Sep 16, 2020
Messages
7
Reaction score
2
There is a method to do this that I am aware of (I thought of it a while back and my brain is peanut-sized so there's probably a much better solution) and I'll go over that.

To start, you need to first create a variable on join, that being an item variable that is equal to air. For those unaware of how to do this, you use a Set Item Type setvar. In there, place one should be the variable, place two should have any unmodified item (stone, dirt, grass, etc) and place three a text item "air". This will create an air item stores as a variable. After this, you need to create a list consisting of exactly 5 of that variable.

Once you have this set up, you likely want to place the code to prevent 2x2 crafting on a one-tick loop. First have an ifvar checking if the Open Inventory Title game value is equal to a text item "Crafting". Within that, place another ifvar, checking if your air list variable is not equal to the Inventory Menu Items game value. The reason this second ifvar checks if you have placed anything within the crafting grid, and the first ensures the code does not run if your inventory is not open - otherwise you get a nice little softlock.
 

The Cube

Moderator
Moderator
Joined
Sep 16, 2020
Messages
7
Reaction score
2
I've found how to disable it!

What you do, is, on a loop:

If Var: (GameValue: OpenInvTitle) Contains txt(Crafting)

Then, Set Variable: Join Text var(%default inventory items) to gameValue: InventoryMenuItems

Now, an If Var: var(%default inventory items) =! airairairairair

Then PlayerAction: CloseInventory

sorry if the explanation is bad, i can't write instructions well, especially in a semi code format lol
also, "airairairairair" is the 5 inventory slots of the Crafting menu. Using jointext doesn't put in spaces

also, thx stinkey, I didn't see the message until now, and I figured it out lol
wow mean you posted it before me
 
Top Bottom