Posted April 1, 20214 yr How do I draw text on the screen? Basically, what does the function arguments of the function Minecraft.getInstance().fontRenderer.drawString() mean? Here is the code I used (UtilitiesMod is a static reference to my main mod class): // Code to draw the text fontRenderer.drawString(UtilitiesMod.netherPosStack, "Position (nether): "+UtilitiesMod.mcInstance.player.getPosX()/8+" "+UtilitiesMod.mcInstance.player.getPosY()/8+" "+UtilitiesMod.mcInstance.player.getPosZ()/8,1,0-(UtilitiesMod.mcInstance.currentScreen.height/2),14); // Main class (code for the MatrixStack variables) public static MatrixStack overworldPosStack=new MatrixStack(); public static MatrixStack netherPosStack=new MatrixStack(); Edited April 1, 20214 yr by andrussy44 Change "a portion of it" to exactly what portion it was.
April 1, 20214 yr 46 minutes ago, andrussy44 said: Basically, what does the function arguments of the function Minecraft.getInstance().fontRenderer.drawString() mean? the first param is a matrixStack the second is the String you want to draw the third is the starting x position of the string, and the fourth is the starting y position and the fifth is the color, it is better to write it in hexadecimal than decimal, you use 0x to say you're writing a hex number. if you still don't get it, you can search on hexadecimal color and also: don't create your own matrixStacks, use the ones that are passed to you, you should always have a matrixStack in the context you'd want to call drawString
April 1, 20214 yr Author Thanks, but what does this code do? // UtilitiesMod.overworldPosStack is the matrix stack I am using for this UtilitiesMod.overworldPosStack.scale(0,0,0);
April 1, 20214 yr 1 minute ago, andrussy44 said: Thanks, but what does this code do? // UtilitiesMod.overworldPosStack is the matrix stack I am using for this UtilitiesMod.overworldPosStack.scale(0,0,0); it scales what is going to be rendered with that matrix stack to 0 on x axis, 0 on the y axis, and 0 on the z axis, therefore making it infinetelly small
April 2, 20214 yr Author Thanks for all of this. However, I don't know how to make sure that the text will not overlap. Is it possible to specify a specific font size? Edited April 2, 20214 yr by andrussy44 Expand on this post
April 2, 20214 yr 16 hours ago, andrussy44 said: Thanks for all of this. However, I don't know how to make sure that the text will not overlap. Is it possible to specify a specific font size? you can use MatrixStack#scale, as said before, to make the text smaller
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.