PotionEffectRenderer.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:AlchemicalBling 作者:
@SubscribeEvent
public void onGuiDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
    Minecraft mc = Minecraft.getMinecraft();

    if (!(event.gui instanceof InventoryEffectRenderer)) {
        return;
    }

    int i = this.guiLeft - 124;
    int j = this.guiTop;

    Collection collection = mc.thePlayer.getActivePotionEffects();

    if (!collection.isEmpty()) {

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        int k = 33;

        if (collection.size() > 5) {
            k = 132 / (collection.size() - 1);
        }

        for (Iterator iterator = mc.thePlayer.getActivePotionEffects().iterator(); iterator.hasNext(); j += k) {
            PotionEffect potioneffect = (PotionEffect) iterator.next();

            if (potioneffect instanceof BaublePotionEffect) {
                mc.getTextureManager().bindTexture(INVENTORY);
                Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                event.gui.drawTexturedModalRect(i, j, 0, 166, 140, 32);

                if (potion.hasStatusIcon()) {
                    int l = potion.getStatusIconIndex();
                    event.gui.drawTexturedModalRect(i + 6, j + 7, l % 8 * 18, 198 + l / 8 * 18, 18, 18);
                }

                String s1 = I18n.format(potion.getName());

                if (potioneffect.getAmplifier() == 1) {
                    s1 = s1 + " II";
                } else if (potioneffect.getAmplifier() == 2) {
                    s1 = s1 + " III";
                } else if (potioneffect.getAmplifier() == 3) {
                    s1 = s1 + " IV";
                }

                mc.fontRenderer.drawStringWithShadow(s1, i + 10 + 18, j + 6, 16777215);
                mc.fontRenderer.drawStringWithShadow("Bauble", i + 10 + 18, j + 6 + 10, 8355711);
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号