Jump to content

Recommended Posts

Posted

Like the title says, when I use player.displayGUIWorkbench, I do get the crafting menu but I CANNOT move items in my inventory!

 

code:

world.setBlock(0, 0, 0, Blocks.crafting_table, 0, 2);
player.displayGUIWorkbench(0, 0, 0);

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Posted

You can't open up the gui for the workbench that way. In the container class there's a method called canInteractWith that check's if there's a workbench at the location, which you managed to do with a dirty hack, and if the distance between the workbench and the player is less then 4 blocks away, which it isn't in your case, so it returns false so you can't interact with it.

 

A workaround is making your own gui and container extending the vanilla classes, and modify them a bit to your likings, and open that one, istead of the vanilla one.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

You can't open up the gui for the workbench that way. In the container class there's a method called canInteractWith that check's if there's a workbench at the location, which you managed to do with a dirty hack, and if the distance between the workbench and the player is less then 4 blocks away, which it isn't in your case, so it returns false so you can't interact with it.

 

A workaround is making your own gui and container extending the vanilla classes, and modify them a bit to your likings, and open that one, istead of the vanilla one.

 

READ MY POST

 

My problem is that i cannot move items when the inventory is open, NOT that the inventory is not opening. (aka it is opening)

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Posted

You can't open up the gui for the workbench that way. In the container class there's a method called canInteractWith that check's if there's a workbench at the location, which you managed to do with a dirty hack, and if the distance between the workbench and the player is less then 4 blocks away, which it isn't in your case, so it returns false so you can't interact with it.

 

A workaround is making your own gui and container extending the vanilla classes, and modify them a bit to your likings, and open that one, istead of the vanilla one.

 

READ MY POST

 

My problem is that i cannot move items when the inventory is open, NOT that the inventory is not opening. (aka it is opening)

 

He did read your post. He's telling you exactly why it opened but you're not able to interact with it. Maybe YOU should read HIS post, instead of being an ass when someone is helping you.

Posted

You can't open up the gui for the workbench that way. In the container class there's a method called canInteractWith that check's if there's a workbench at the location, which you managed to do with a dirty hack, and if the distance between the workbench and the player is less then 4 blocks away, which it isn't in your case, so it returns false so you can't interact with it.

 

A workaround is making your own gui and container extending the vanilla classes, and modify them a bit to your likings, and open that one, istead of the vanilla one.

 

READ MY POST

 

My problem is that i cannot move items when the inventory is open, NOT that the inventory is not opening. (aka it is opening)

 

He did read your post. He's telling you exactly why it opened but you're not able to interact with it. Maybe YOU should read HIS post, instead of being an ass when someone is helping you.

 

But I solved the problem with the workbench checking right? i placed a workbench in the world on coords 0, 0, 0 and opened that workbench. That should work, right?

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Posted

Yeah, but your coords are probably way more then 4 blocks away. If you go to 0 0 0 you can move the items. Thats why you made it a dirty work-around, instead of making your own classes, which is the best solution.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Simply copy the workbench gui classes and change the method from false to true. Don't forget the gui handler.

Copying such a class will simply open the original crafting table. displayGuiWorkbench() is hardcoded that way.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.