PigeonDamigion Posted September 29, 2018 Share Posted September 29, 2018 So I'm making a UI for my mod, that shows stats that are returned from the NBTTag data of the player, right? Well, the problem is it doesn't seem to work at all, cause all it returns is null. Also, I'm basically brand new to modding, so please tell me if some of my code is redundant/useless @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { Minecraft.getMinecraft().renderEngine.bindTexture(texture); int centerX = width/2 - guiWidth/2; int centerY = height/2 - guiHeight/2; GlStateManager.pushMatrix(); { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.color(1, 1, 1, 0.7F); drawTexturedModalRect(centerX, centerY, 0, 0, guiWidth, guiHeight); } GlStateManager.popMatrix(); drawString(fontRendererObj, "Stand:", centerX+5, centerY+10, 0xFFFFFF); drawString(fontRendererObj, "STR:", centerX+5, centerY+50, 0xFFFFFF); drawString(fontRendererObj, "END:", centerX+5, centerY+65, 0xFFFFFF); drawString(fontRendererObj, "SPE:", centerX+5, centerY+80, 0xFFFFFF); EntityPlayer player = Minecraft.getMinecraft().thePlayer; NBTTagCompound persistTag = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG); NBTTagCompound jojoTag = persistTag.getCompoundTag("Jojo"); switch (jojoTag.getInteger("Stand")) { case 1: String strength, endurance, special; String Stand = "Killer Queen"; strength=String.valueOf(jojoTag.getInteger("Stand_str")); endurance=String.valueOf(jojoTag.getInteger("Stand_end")); special=String.valueOf(jojoTag.getInteger("Stand_spe")); drawString(fontRendererObj, Stand, centerX+40, centerY+10, 0xFFFFFF); drawString(fontRendererObj, strength, centerX+30, centerY+50, 0xFFFFFF); drawString(fontRendererObj, endurance, centerX+30, centerY+65, 0xFFFFFF); drawString(fontRendererObj, special, centerX+30, centerY+80, 0xFFFFFF); break; case 2: break; case 3: break; default: System.out.println("ERROR: you fucked up with the Gui data"); System.out.println(Minecraft.getMinecraft().thePlayer.getEntityData().getInteger("Stand")); String none = "None"; drawString(fontRendererObj, none, centerX+40, centerY+10, 0xFFFFFF); drawString(fontRendererObj, "0", centerX+30, centerY+50, 0xFFFFFF); drawString(fontRendererObj, "0", centerX+30, centerY+65, 0xFFFFFF); drawString(fontRendererObj, "0", centerX+30, centerY+80, 0xFFFFFF); break; } super.drawScreen(mouseX, mouseY, partialTicks); } Quote Link to comment Share on other sites More sharing options...
V0idWa1k3r Posted September 29, 2018 Share Posted September 29, 2018 2 hours ago, PigeonDamigion said: NBTTagCompound persistTag = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG); I am pretty sure these don't get synced to the client. You shouldn't be using this anyway, use capabilities. 2 hours ago, PigeonDamigion said: GlStateManager.pushMatrix(); { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.color(1, 1, 1, 0.7F); drawTexturedModalRect(centerX, centerY, 0, 0, guiWidth, guiHeight); } GlStateManager.popMatrix(); There are no reasons whatsoever to push/pop matrix here. You are not changing the matrix in any way. If you change the GL state to something change it back when you are done. If you are enabling blend then specify the blend profile too. Why are you modding for 1.10.2 anyway? It's outdated, use 1.12.2. 1 Quote Link to comment Share on other sites More sharing options...
PigeonDamigion Posted September 29, 2018 Author Share Posted September 29, 2018 52 minutes ago, V0idWa1k3r said: Why are you modding for 1.10.2 anyway? It's outdated, use 1.12.2. Cause when I started this mod I was following a 1.10.2 modding tutorial, I'll move it to a newer version when the core stuff is done Quote Link to comment Share on other sites More sharing options...
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.