RenderRing.java 文件源码

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

项目:MagicalRings 作者:
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    Tessellator tess = Tessellator.instance;
    for (int i = 0; i < 3; i++) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        IIcon icon = item.getItem().getIcon(item, i);
        int rgb = item.getItem().getColorFromItemStack(item, i);
        float r = (rgb >> 16 & 255) / 255.0F;
        float g = (rgb >> 8 & 255) / 255.0F;
        float b = (rgb & 255) / 255.0F;

        if (icon == null)
            continue;

        float uv1 = icon.getMinU();
        float uv2 = icon.getMaxU();
        float uv3 = icon.getMinV();
        float uv4 = icon.getMaxV();

        GL11.glColor4f(r, g, b, 1f);

        ItemRenderer.renderItemIn2D(tess, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

        GL11.glColor4f(1f, 1f, 1f, 1f);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号