Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
     }

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.

  • Author
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

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.