Posted June 23, 201411 yr I got suggested that I should use a PacketHandler to open my GUI. Now I have no idea on how to open the gui in the PacketHandler, so I would require some help. I searched for some tutorials and explanations, but I can't realize what should I do. The GUI has 1 button and 1 text input field. When you input a number in the field and click on the button, it will take the number and set the strength of the explosion. Here's the action method for the button: protected void actionPerformed(GuiButton button) { World world = null; WorldServer[] list = MinecraftServer.getServer().worldServers; /*switch (button.id) { case 1: i += 1; break; case 2: i -= 1; } */ // Packet code here // PaintEventDispatcher.sendPacketToServer(packet); //send packet for (WorldServer ins : list) { if (ins.provider.dimensionId == entity.worldObj.provider.dimensionId) world = ins; } if (world == null) world = list[0]; if (button.id == 0) { if (true) { if (power.getText().isEmpty()) power.setText(""); else if (power.getText().matches("[a-zA-Z]+")) power.setText(""); else if (power.getText().matches("[0-9]+")) { this.mc.displayGuiScreen((GuiScreen) null); world.createExplosion((Entity) null, i, j - 10, k, Integer.parseInt(power.getText().trim()), true); } else power.setText(""); } } } _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
June 23, 201411 yr First, you would create a packet handler etc. and register it. Then, you would create a packet that takes an integer (ID of the gui you want to open) as its data. When the packet is received, open up the GUI via the gui ID you sent. We all stuff up sometimes... But I seem to be at the bottom of that pot.
June 23, 201411 yr Are you trying to open the gui on an entity, an item or a tileentity? you would only have to use a packet for the strength of the explosion you've declared client sided in the gui's text input.
June 23, 201411 yr Author I'm opening GUI on the block. Can any of you guys lead me to some source or examples? _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
June 23, 201411 yr http://bit.ly/1nwGrJq 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/
June 23, 201411 yr Author With the PacketHandler _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
June 24, 201411 yr Why do you need a PacketHandler if you can just use the onBlockActivated(args) method in the block class so if you click on the block in te world (not in the inventory) it opens the gui. If you wan't it to be in your inventory and right click it, you need a custom ItemBlock and use the onItemUse(args) method and open the gui in that method. If this doesn't match your needs, can you please specify where the block is, so we now what you wan't to do with the block. 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/
June 25, 201411 yr Author This is actually my problem http://www.minecraftforge.net/forum/index.php/topic,20398.msg102954.html#msg102954 ... I still can't fix it or know what the problem is _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
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.