Hotbar & experience bar

Версия Minecraft
1.7.10
28
0
I created a hotbar, but there's a problem. The first problem is, when you select an item, the item selection image is displayed in white. The second problem is that the block items in the slot have different brightness. Third, I want to know how to get the value of the experience value bar.

s.PNG

renderHotbar:
GL11.glPushMatrix(); {
                GL11.glTranslatef((float)(event.resolution.getScaledWidth() / 2 - 80), (float)(event.resolution.getScaledHeight() - 30),0.0F);
                final Tessellator t = Tessellator.instance;
                for (int i = 0; i < 9; ++i) {
                    mc.renderEngine.bindTexture(new ResourceLocation(MOD_ID + ":invslot.png"));
                    GL11.glEnable(3042);
                    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
                    RenderHelper.disableStandardItemLighting();
                    t.startDrawingQuads();
                    t.addVertexWithUV((double)(0 + i * 18), 0.0, 0.0, 0.0, 0.0);
                    t.addVertexWithUV((double)(0 + i * 18), 16.0, 0.0, 0.0, 1.0);
                    t.addVertexWithUV((double)(16 + i * 18), 16.0, 0.0, 1.0, 1.0);
                    t.addVertexWithUV((double)(16 + i * 18), 0.0, 0.0, 1.0, 0.0);
                    t.draw();
                    this.renderInventorySlot(i, i * 18, 0, 0.0f);
                }
                RenderHelper.disableStandardItemLighting();
                GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
                if(mc.thePlayer.inventory.currentItem >= 0 && mc.thePlayer.inventory.currentItem <= 9) {
                    mc.renderEngine.bindTexture(new ResourceLocation(MOD_ID + ":slotsel.png"));
                    t.startDrawingQuads();
                    t.addVertexWithUV(1 + this.mc.thePlayer.inventory.currentItem * 18, 1.0, 0.0, 0.0, 0.0);
                    t.addVertexWithUV(1 + this.mc.thePlayer.inventory.currentItem * 18, 15.0, 0.0, 0.0, 1.0);
                    t.addVertexWithUV(15 + this.mc.thePlayer.inventory.currentItem * 18, 15.0, 0.0, 1.0, 1.0);
                    t.addVertexWithUV(15 + this.mc.thePlayer.inventory.currentItem * 18, 1.0, 0.0, 1.0, 0.0);
                    t.draw();
                }
            }
            GL11.glPopMatrix();

renderInventorySlot:
protected void renderInventorySlot(final int p_73832_1_, final int p_73832_2_, final int p_73832_3_, final float p_73832_4_) {
        final ItemStack itemstack = ((EntityPlayer)this.mc.thePlayer).inventory.mainInventory[p_73832_1_];
        if (itemstack != null) {
            final float f1 = itemstack.animationsToGo - p_73832_4_;
            if (f1 > 0.0f) {
                GL11.glPushMatrix();
                final float f2 = 1.0f + f1 / 5.0f;
                GL11.glTranslatef((float)(p_73832_2_ + 8), (float)(p_73832_3_ + 12), 0.0f);
                GL11.glScalef(1.0f / f2, (f2 + 1.0f) / 2.0f, 1.0f);
                GL11.glTranslatef((float)(-(p_73832_2_ + 8)), (float)(-(p_73832_3_ + 12)), 0.0f);
            }
            itemRenderer.renderItemIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, p_73832_2_, p_73832_3_);
            if (f1 > 0.0f) {
                GL11.glPopMatrix();
            }
            itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, p_73832_2_, p_73832_3_);
        }
    }
    static {
        itemRenderer = new RenderItem();
    }
 
Сверху