Posted June 18, 201411 yr Whenever I right click a custom block I created, no matter what the action (Sysout, addChatMessage, etc.) it will run twice. I am trying to create a simple block that will open a custom crafting GUI upon right click, but it opens and closes when clicked on. All I have in the method is 'p.displayerGUIWorkbench(0,0,0);' Thanks in advance for your help.
June 18, 201411 yr It is firing once on the client, and once on the server. You will need to add some world.isRemote checks and only run the action on the proper side. Also, I believe that the container workbench has some code in it to auto-close if the player is out of range of the workbench, which is set via the (0,0,0) you are passing in...so unless the player is standing at 0,0,0 or near to it, it will close shortly after opening. vanilla workbench code that causes the closing in ContainerWorkbench: public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != Blocks.crafting_table ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; }
June 19, 201411 yr You can's use the displayGUIWorkbench, because some code in the ContainerWorkbench checks for a workbench at the location you specify, and if there isn't, you can't open the gui. 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/
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.