
SebasTheGreat
Members-
Posts
26 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
SebasTheGreat's Achievements

Tree Puncher (2/8)
0
Reputation
-
[1.7.10] [Solved] How Do I Open a GUI on Server?
SebasTheGreat replied to SebasTheGreat's topic in Modder Support
Nvm I got it working but thanks for your time. -
[1.7.10] [Solved] How Do I Open a GUI on Server?
SebasTheGreat replied to SebasTheGreat's topic in Modder Support
I'm using a key connected to the GUI so when I press a button the GUI opens. In my key handler I have the network.sendToSever(new packetWhatever). In this packet before it opens the GUI it tests to see if the player is wearing armor, which works, but after the tests run it it doesn't open the GUI for some reason. this is in my GUI handler, I'll simplify it a little: public onMessage { if( "Tests to see if armor is worn") { { ctx.getServerHandler().playerEntity.openGui... } } } -
Hey so I've made a GUI in my mod and got it working okay. It is a GUI that isn't attached to a tile entity, and I have a problem right now where I'm trying to open the GUI on the server side but its not working. I'm using packets and the getServerHandler().playerEntity.openGui() but when I go to open it nothing happens, no errors or crash. Is there something I need to use beside openGui(), do I need to do something special with my GUI or my mod class, or does this not work period?
-
[1.7.10] [SOLVED] GUI Option Button?
SebasTheGreat replied to SebasTheGreat's topic in Modder Support
Sometimes I just do and say the dumbest things. I got it working all thanks to you guys . -
[1.7.10] [SOLVED] GUI Option Button?
SebasTheGreat replied to SebasTheGreat's topic in Modder Support
Hey so I made this in my actionPerformed method: boolean on = guiButton.displayString == "On"; if(on) { guiButton.displayString = "Off"; } else if(!on) { guiButton.displayString = "On"; } It toggles just the way I want it to but now I have 1 problem. How do I save what the text is? If I set it to on and leave the GUI, when I come back its back to off. -
Yeah so I have this in my onKeyInput: "ModName".network.sendToServer(new "Packet"); and this in my onMessage method in my packet: if(ctx.getServerHandler().playerEntity.getCurrentArmor(0) != null && ctx.getServerHandler().playerEntity.getCurrentArmor(0).getItem().equals("armorBoots")) if(ctx.getServerHandler().playerEntity.getCurrentArmor(1) != null && ctx.getServerHandler().playerEntity.getCurrentArmor(1).getItem().equals("armorLeggings")) if(ctx.getServerHandler().playerEntity.getCurrentArmor(2) != null && ctx.getServerHandler().playerEntity.getCurrentArmor(2).getItem().equals("armorChestplate")) if(ctx.getServerHandler().playerEntity.getCurrentArmor(3) != null && ctx.getServerHandler().playerEntity.getCurrentArmor(3).getItem().equals("armorHelmet")) { ctx.getServerHandler().playerEntity.openGui... } return null; but when I press the key in game nothing happens.
-
Yeah and this: is what it says on that page. That's what I'm doing in that code in my previous post. I need to use the sendTo method to send the packet to the client telling him to open the GUI if the key is pressed and have the packet check to see if the correct armor is being worn. I'm sorry but linking me to a page I've seen a hundred times ins't going to help me here, I'm not asking for any copy and paste but I would like an explanation of what I'm supposed to do with this situation.
-
[1.7.10] [SOLVED] GUI Option Button?
SebasTheGreat replied to SebasTheGreat's topic in Modder Support
No I know how to make a button, but I need the button that once you press it, turns on. Then the button changes to the turn off button and you can press it again to turn it off. An example would be the clouds button in the option menu. It toggles clouds on and off, that's what I'm trying to make, only for something other than clouds . -
Ok so in order for it to work on a server, I need to use packets. I assume I need a packet where the server sends a message to the client telling it to open the GUI, because GUI's are client side only. I've made the packet but I have the issue of "ModName".network.sendTo(new "Packet", "EntityPlayerMP"); What do I put in for the "EntityPlayerMP"? This is in the onKeyInput method which doesn't simply have a parameter for EntityPlayerMP. Is there a method that gets which player is pressing the key? Sorry for my obvious stupidity on this subject, I'm kinda new to it.
-
Hey so I'm trying to make an Option Button for my GUI that toggles invisibility. I need to know how to set up the Option Button, as it seems very complicated from the vanilla code I've looked at. After looking at the vanilla code and getting nowhere, I decided to come ask. If you have a video or post that teaches how to do it just link it and I'll figure it out from there. If you know how to do it I would be very thankful for your help.
-
Ok so I did what SuperKael said and I got it working so thanks for the help and responses everyone.
-
1. Can I use FMLClientHandler.instance().getClientPlayerEntity() instead. 2. I can't grasp what you're talking about with the ItemStack.getItem(), everytime I try to use it I get the error: Cannot make a static reference to the non-static method getItem() from the type ItemStack
-
So I've changed my code to what you guys said: if(Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(1) != null) { if(ItemStack.areItemStacksEqual(Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(1), new ItemStack("Armor I want"))) { Minecraft.getMinecraft().thePlayer.openGui... } } but it still doesn't work The armor piece I am checking is only an Item and I need an ItemStack to compare them so I make a new ItemStack.
-
Hey so I'm trying to make it so when I press a key and the player is wearing a certain type of armor, it opens a GUI. I have the key set up and when you press the key the GUI opens but when I add the if statement: if(Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(1) == new ItemStack("Armor I want")) { Minecraft.getMinecraft().thePlayer.openGui... } into the if statement that tests to see if the key is pressed, when I press the key in the game the GUI never opens, even if I have the armor specified on. So to re-put that so people can understand it, I press key - GUI opens, I add statement to see if specific armor is on, and press key - GUI doesn't open at all. I think I'm understanding the getEquipmentInSlot Method wrong so any help would be appreciated.