TileEntityTrophyRenderer.java 文件源码

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

项目:OpenBlocks 作者:
private void renderTrophy(Trophy type, double x, double y, double z, float angle) {
    Entity entity = type.getEntity();
    if (entity != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(x, y + type.getVerticalOffset() + 0.2, z);
        GL11.glRotatef(angle, 0, 1, 0);

        final double ratio = type.getScale();
        GL11.glScaled(ratio, ratio, ratio);
        World renderWorld = RenderUtils.getRenderWorld();
        if (renderWorld != null) {
            Render<Entity> renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity);
            // yeah we don't care about fonts, but we do care that the
            // renderManager is available
            if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {

                final boolean blurLast;
                final boolean mipmapLast;
                final AbstractTexture blocksTexture = getBlockTexture();
                if (blocksTexture != null) {
                    blurLast = blocksTexture.blurLast;
                    mipmapLast = blocksTexture.mipmapLast;
                } else {
                    blurLast = false;
                    mipmapLast = false;
                }

                GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
                final boolean lightmapEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
                GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

                synchronized (entity) {
                    entity.world = renderWorld;
                    renderer.doRender(entity, 0, 0, 0, 0, 0);
                    entity.world = null;
                }

                GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
                if (lightmapEnabled) GlStateManager.enableTexture2D();
                else GlStateManager.disableTexture2D();
                GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

                if (blocksTexture != null) {
                    blocksTexture.mipmapLast = mipmapLast;
                    blocksTexture.blurLast = blurLast;
                }
            }
        }
        GL11.glPopMatrix();

    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号