Jump to content

[1.12] Custom book, mouse cursor not visible upon opening


Recommended Posts

Posted

Alright, so I want to make a custom book item to serve as a manual for my mod. So I looked up a tutorial and got a simple book functioning simply by copying most of the code. Despite being for an older version of Minecraft, I only had to make a few small changes to get the code to work for 1.12. However, there is one minor problem that is bugging me quite a bit. When I open the book, the mouse cursor can be moved around but isn't visible. This can be fixed by moving the cursor outside the window and then back in, but it's still quite annoying. 

For reference, the tutorial I copied can be found here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-block-with-simple-gui.html

The only changes I really made were the paths to the textures, and a few variable names were changed to work with 1.12. I also cross-referenced the vanilla GuiScreenBook class and my book seems to be consistent with it.  Also, the tutorial is for drawing the book Gui when right clicking on a block, but I just changed that to the onRightClick method of my book item.

Posted

Sure thing, here's the book GUI, mostly copied:

  Reveal hidden contents

The book item:

  Reveal hidden contents

And finally the method in the client proxy to draw the GUI:

public void drawMonsterBook() {
		Minecraft.getMinecraft().displayGuiScreen(new GuiMonsterBook());
	}

 

Posted (edited)

After a bit of trial and error, it looks like I have fixed the problem.  Although all the tutorial code included it, I removed the !world.isRemote check from my book item since I figured the proxies already were handling the side checks. Upon removing it, I now can see my mouse when opening the book!

Edited by Lyeoj
  • Like 1

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.