The Meaning of Life, the Universe, and Everything.
Join Date:
4/7/2016
Posts:
50
Member Details
Hello everyone! I recently found a problem while trying to make a GUI, on This thread, the problem is, my gui is hiding the cursor! the weird thing is, the cursor can still move, and if you move the cursor out of the minecraft window, the mouse appears and stays visible when hovering back over the minecraft window, i can even click in the mc window, and the cursor stays visible! So to recap, incase that was confusing, when the gui is opened, the cursor is hidden, but stays visible when it leaves the MC window.
/**
* Created by PMiner on 4/12/2016.
*/
public class GuiHelpGuide extends GuiScreen
{
private final int bookImageHeight = 192;
private final int bookImageWidth = 192;
private int currPage = 0;
private static final int bookTotalPages = 7;
private static ResourceLocation[] bookPageTextures = new ResourceLocation[bookTotalPages];
private static String[] stringPageText = new String[bookTotalPages];
private GuiButton buttonDone;
private NextPageButton buttonNextPage;
private NextPageButton buttonPreviousPage;
public GuiHelpGuide()
{
bookPageTextures[0] = new ResourceLocation("minecraft"+":textures/gui/book.png");
bookPageTextures[1] = new ResourceLocation("minecraft"+":textures/gui/book.png");
bookPageTextures[2] = new ResourceLocation("minecraft"+":textures/gui/book.png");
stringPageText[0] = "Note: If your cursor disapears, just move your mouse cursor out of the MC window, and then move it back in. Sorry for the issue!\n\n P.S. I will try to have this fixed soon!";
stringPageText[1] = "Welcome to urbanization! I see you have found the help guide! This guide will help you understand all of the features of urbanization! First, you should get some seeds! These can be found by breaking grass!";
stringPageText[2] = "Onece you have a good food supply, we can get into the machines! The first machine is the Singularity Transponder! For this, you will need a singularity! These can be found in the nether, or by making singularity containers";
stringPageText[3]="Singularity containers, when broken drop singularities. if you click the ground with a singularity, the singularity will remeber where you clicked it, and you will warp to that location when you click the transponder with the";
stringPageText[4]="singularity. You can have multiple singularities! if you click an entire stack on the ground, the entire stack will remember the location as well! Next we can talk about decorations! Many decorations require special items to craft!";
stringPageText[5]="Such as the chandelier wich requires some lightbulbs to craft! The stop signs, require iron posts, and stop sign tops. same for go signs. the ceiling fan, requires copper! copper is found between Y 30-70. Smelt them into ingots,";
stringPageText[6]="then make a copper coil wich will be made in a metal press soon, but for now in a crafting grid. then you make a motor. If you have any questions, go to [email protected]. Thanks for checking out my mod!";
}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui()
{
buttonList.clear();
Keyboard.enableRepeatEvents(true);
buttonDone = new GuiButton(0, width/2-100, 4 + bookImageHeight, 200, 20, I18n.format("gui.done", new Object[0]));
buttonList.add(buttonDone);
int offsetFromScreenLeft = (width - bookImageWidth) / 2;
buttonList.add(buttonNextPage = new NextPageButton(1, offsetFromScreenLeft + 120, 156, true));
buttonList.add(buttonPreviousPage = new NextPageButton(2, offsetFromScreenLeft + 38, 156, false));
}
/**
* Called from the main game loop to update the screen.
*/
@Override
public void updateScreen()
{
buttonDone.visible = (currPage == bookTotalPages - 1);
buttonNextPage.visible = (currPage < bookTotalPages - 1);
buttonPreviousPage.visible = currPage > 0;
}
/**
* Draws the screen and all the components in it.
*/
@Override
public void drawScreen(int parWidth, int parHeight, float p_73863_3_)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (currPage == 0)
{
mc.getTextureManager().bindTexture(bookPageTextures[0]);
}
else
{
mc.getTextureManager().bindTexture(bookPageTextures[1]);
}
int offsetFromScreenLeft = (width - bookImageWidth ) / 2;
drawTexturedModalRect(offsetFromScreenLeft, 2, 0, 0, bookImageWidth, bookImageHeight);
int widthOfString;
String stringPageIndicator = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(currPage + 1), bookTotalPages});
widthOfString = fontRendererObj.getStringWidth(stringPageIndicator);
fontRendererObj.drawString(stringPageIndicator, offsetFromScreenLeft - widthOfString + bookImageWidth - 44, 18, 0);
fontRendererObj.drawSplitString(stringPageText[currPage], offsetFromScreenLeft + 36, 34, 116, 0);
super.drawScreen(parWidth, parHeight, p_73863_3_);
The Meaning of Life, the Universe, and Everything.
Join Date:
4/7/2016
Posts:
50
Member Details
you know, at this point, i'm questioning whether or not it would be possible to copy the default mc book code, and just put specific text into it. is that possible? instead of reading the text from nbt?
Hello everyone! I recently found a problem while trying to make a GUI, on This thread, the problem is, my gui is hiding the cursor! the weird thing is, the cursor can still move, and if you move the cursor out of the minecraft window, the mouse appears and stays visible when hovering back over the minecraft window, i can even click in the mc window, and the cursor stays visible! So to recap, incase that was confusing, when the gui is opened, the cursor is hidden, but stays visible when it leaves the MC window.
Here is the code for my GUI:
If you need any other section of code, just ask.
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
Here is an image demonstrating the problem:
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
What happens if you comment out the Keyboard.enableRepeatEvents(true); line in your #initGui method?
nothing. at least not that i can see.
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
also, would you prefer i put the code in github so that it is highlighted?
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
you know, at this point, i'm questioning whether or not it would be possible to copy the default mc book code, and just put specific text into it. is that possible? instead of reading the text from nbt?
EDIT: also, is that legal?
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
I honestly have no idea what to do! Does anyone have any idea?
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
I am having this issue as well, I still can't find a fix. Let me know if you do.
- Author of Pearcel Mod, Dimensional Ores, and Misc Configs -
If you need to contact me, do so here.