ricosw Posted February 26, 2017 Posted February 26, 2017 (edited) Hello I have an Problem with my GUI when I open them with Minecraft.getMinecraft().displayGuiScreen(guiBuilder); //OR player.openGui(...) The Mouse Cursor is not visible if I hover over my buttons it works clicking it works too but the Cursor is still invisible if I go out of Minecraft and go back the Cursor works fine. My Gui: import com.google.gson.Gson; import de.ricosw.data.GuiButtonClick; import de.ricosw.hhmod.HHMod; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.io.IOException; import java.util.HashMap; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; /** * * @author Rico */ public class GuiBuilder extends GuiScreen { private HHMod mod; private HashMap<GuiButton, Integer> guiButtons; private int guiId = -1; public GuiBuilder(HHMod mod, int guiId, HashMap<GuiButton, Integer> guiButtons) { this.mod = mod; this.guiId = guiId; this.guiButtons = guiButtons; } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); } @Override public void initGui() { for (GuiButton buttons : guiButtons.keySet()) { System.out.println(buttons); this.buttonList.add(buttons); } super.initGui(); } @Override protected void actionPerformed(GuiButton button) throws IOException { if (guiButtons.containsKey(button)) { //... } } @Override public void updateScreen() { super.updateScreen(); } } Edit: I opening the Gui in ClientCustomPacketEvent Edited October 2, 2017 by ricosw changed game version Quote
ricosw Posted February 26, 2017 Author Posted February 26, 2017 Update: I have changed the Cursor I mean the image and it shows me it. But If I set an windows cursor on mac and linux will it be the windows cursor any ideas? Quote
ricosw Posted October 2, 2017 Author Posted October 2, 2017 #push Version: 1.12.2 Mouse Cursor is invisible I'm opening the gui at the ClientCustomPacketEvent any ideas? public class ClientPacketHandler extends ServerPacketHandler { private TestMod testMod; public ClientPacketHandler(TestMod testMod) { this.testMod = testMod; } @SubscribeEvent public void onClientPacket(ClientCustomPacketEvent event) throws IOException { channelName = event.getPacket().channel(); System.out.println("Message on channel " + channelName); if(channelName.equals("TESTMOD")) { System.out.println("target: " + event.getPacket().getTarget().name()); // TARGET IS CLIENT System.out.println("Client recived packet from server"); ProcessPacketClientSide.processPacketOnClient(testMod, event.getPacket().payload(), event.getPacket().getTarget()); } } } public class ProcessPacketClientSide { public ProcessPacketClientSide() { } @SideOnly(Side.CLIENT) public static void processPacketOnClient(TestMod testMod, ByteBuf parBB, Side parSide) { try { if (parSide != Side.CLIENT) { System.out.println("ERROR! ProcessPacketClientSide"); return; } System.out.println("Received ProcessPacketClientSide on Client Side"); ByteBufInputStream bbis = new ByteBufInputStream(parBB); String data = bbis.readLine(); /* DOING HERE MY GUI STUFF */ Minecraft.getMinecraft().player.openGui(testMod, gui.getGuiId(), Minecraft.getMinecraft().player.world, 0, 0, 0); // ON GUI OPEN THE MOUSE CURSOR IS NOT VISIBLE BUT I CAN HOVER BUTTONS AND CLICK THEM /*Minecraft.getMinecraft().setIngameNotInFocus(); Minecraft.getMinecraft().inGameHasFocus = false; Minecraft.getMinecraft().displayGuiScreen(guiBuilder); Minecraft.getMinecraft().currentScreen.allowUserInput = true;*/ //Mouse.setGrabbed(false); //Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); //Mouse.setGrabbed(false); } catch (IOException ex) { Logger.getLogger(ProcessPacketClientSide.class.getName()).log(Level.SEVERE, null, ex); } } } Quote
sleeper Posted January 11, 2018 Posted January 11, 2018 Did you find a solution ? I have the same problem ... Quote
Fobi Posted March 16, 2018 Posted March 16, 2018 Ive encountered the same problem today. Not sure why this is not working. When i saved the ui to open and called .openGui() from a clientTickListener it worked. Quote
Recommended Posts
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.