Search in sources :

Example 11 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project BuildCraft by BuildCraft.

the class RoboticsProxyClient method preInit.

@Override
public void preInit() {
    ModelLoader.setCustomModelResourceLocation(BuildCraftRobotics.robotItem, 0, new ModelResourceLocation("buildcraftrobotics:robot", "inventory"));
    RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new IRenderFactory<EntityRobot>() {

        @Override
        public Render<? super EntityRobot> createRenderFor(RenderManager manager) {
            return new RenderRobot(manager);
        }
    });
}
Also used : Render(net.minecraft.client.renderer.entity.Render) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 12 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project Armourers-Workshop by RiskyKen.

the class SkinRenderHelper method renderGuideFace.

private static void renderGuideFace(ForgeDirection dir, double x, double y, double z, double sizeX, double sizeY, float scale) {
    RenderManager renderManager = RenderManager.instance;
    Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);
    ModRenderHelper.enableAlphaBlend();
    float scale1 = 0.999F;
    // GL11.glScalef(scale1, scale1, scale1);
    GL11.glTranslated(x * scale, y * scale, z * scale);
    switch(dir) {
        case EAST:
            GL11.glRotated(-90, 0, 1, 0);
            break;
        case WEST:
            GL11.glRotated(-90, 0, 1, 0);
            break;
        case UP:
            GL11.glRotated(90, 1, 0, 0);
            break;
        case DOWN:
            GL11.glRotated(90, 1, 0, 0);
            break;
        default:
            break;
    }
    tessellator.setBrightness(15728880);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0, 0, 0, 0, 0);
    tessellator.addVertexWithUV(0, sizeY * scale, 0, sizeY, 0);
    tessellator.addVertexWithUV(sizeX * scale, sizeY * scale, 0, sizeY, sizeX);
    tessellator.addVertexWithUV(sizeX * scale, 0, 0, 0, sizeX);
    tessellator.draw();
    ModRenderHelper.disableAlphaBlend();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Example 13 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project watson by totemo.

the class Annotation method drawBillboard.

// --------------------------------------------------------------------------
/**
 * Draw a camera-facing text billboard in three dimensions.
 *
 * @param x the x world coordinate.
 * @param y the y world coordinate.
 * @param z the z world coordinate.
 * @param bgARGB the background colour of the billboard, with alpha in the top
 *          8 bits, then red, green, blue in less significant octets (blue in
 *          the least significant 8 bits).
 * @param fgARGB the foreground (text) colour of the billboard, with alpha in
 *          the top 8 bits, then red, green, blue in less significant octets
 *          (blue in the least significant 8 bits).
 * @param scaleFactor a scale factor to adjust the size of the billboard. Try
 *          0.02.
 * @param text the text on the billboard.
 */
public static void drawBillboard(double x, double y, double z, int bgARGB, int fgARGB, double scaleFactor, String text) {
    RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
    FontRenderer fontRenderer = renderManager.getFontRenderer();
    if (fontRenderer == null) {
        // Not ready yet.
        return;
    }
    Minecraft mc = Minecraft.getMinecraft();
    // (512 >> mc.gameSettings.renderDistance) * 0.8;
    double far = mc.gameSettings.renderDistanceChunks * 16;
    double dx = x - PrivateFieldsWatson.renderPosX.get(renderManager) + 0.5d;
    double dy = y - PrivateFieldsWatson.renderPosY.get(renderManager) + 0.5d;
    double dz = z - PrivateFieldsWatson.renderPosZ.get(renderManager) + 0.5d;
    double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
    double dl = distance;
    if (dl > far) {
        double d = far / dl;
        dx *= d;
        dy *= d;
        dz *= d;
        dl = far;
    }
    GlStateManager.pushMatrix();
    double scale = (0.05 * dl + 1.0) * scaleFactor;
    GlStateManager.translate(dx, dy, dz);
    GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
    GlStateManager.rotate(mc.gameSettings.thirdPersonView != 2 ? renderManager.playerViewX : -renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
    GlStateManager.scale(-scale, -scale, scale);
    GlStateManager.disableLighting();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer wr = tessellator.getWorldRenderer();
    int textWidth = fontRenderer.getStringWidth(text) >> 1;
    if (textWidth != 0) {
        GlStateManager.disableTexture2D();
        GlStateManager.disableDepth();
        GlStateManager.depthMask(false);
        // Draw background plate.
        wr.startDrawingQuads();
        wr.setColorRGBA_I(bgARGB & 0x00FFFFFF, (bgARGB >>> 24) & 0xFF);
        wr.addVertex(-textWidth - 1, -6, 0.0);
        wr.addVertex(-textWidth - 1, 4, 0.0);
        wr.addVertex(textWidth + 1, 4, 0.0);
        wr.addVertex(textWidth + 1, -6, 0.0);
        tessellator.draw();
        // Draw text.
        GlStateManager.enableTexture2D();
        GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
        fontRenderer.drawString(text, -textWidth, -5, fgARGB);
        GlStateManager.enableDepth();
        GlStateManager.depthMask(true);
    }
    GlStateManager.disableBlend();
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) FontRenderer(net.minecraft.client.gui.FontRenderer) RenderManager(net.minecraft.client.renderer.entity.RenderManager) Minecraft(net.minecraft.client.Minecraft) WorldRenderer(net.minecraft.client.renderer.WorldRenderer)

Example 14 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project pnc-repressurized by TeamPneumatic.

the class RenderAssemblyPlatform method renderModel.

@Override
void renderModel(TileEntityAssemblyPlatform te, float partialTicks) {
    if (te != null) {
        EntityItem ghostEntityItem = null;
        if (!te.getHeldStack().isEmpty()) {
            ghostEntityItem = new EntityItem(te.getWorld());
            ghostEntityItem.hoverStart = 0.0F;
            ghostEntityItem.setItem(te.getHeldStack());
        }
        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
        boolean fancySetting = renderManager.options.fancyGraphics;
        renderManager.options.fancyGraphics = true;
        model.renderModel(0.0625f, te.oldClawProgress + (te.clawProgress - te.oldClawProgress) * partialTicks, ghostEntityItem);
        renderManager.options.fancyGraphics = fancySetting;
    } else {
        model.renderModel(0.0625f, 0, null);
    }
}
Also used : RenderManager(net.minecraft.client.renderer.entity.RenderManager) EntityItem(net.minecraft.entity.item.EntityItem)

Example 15 with RenderManager

use of net.minecraft.client.renderer.entity.RenderManager in project malmo by Microsoft.

the class TextureHelper method hookIntoRenderPipeline.

public static void hookIntoRenderPipeline() {
    // Subvert the render manager. This MUST be called at the right time (FMLInitializationEvent).
    // 1: Replace the MC entity renderer with our own:
    Minecraft.getMinecraft().entityRenderer = new MalmoEntityRenderer(Minecraft.getMinecraft(), Minecraft.getMinecraft().getResourceManager());
    // 2: Create a new RenderManager:
    RenderManager newRenderManager = new TextureHelper.MalmoRenderManager(Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem());
    // 3: Use reflection to:
    // a) replace Minecraft's RenderManager with our new RenderManager
    // b) point Minecraft's RenderGlobal object to the new RenderManager
    // Are we in the dev environment or deployed?
    boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
    // We need to know, because the names will either be obfuscated or not.
    String mcRenderManagerName = devEnv ? "renderManager" : "field_175616_W";
    String globalRenderManagerName = devEnv ? "renderManager" : "field_175010_j";
    // NOTE: obfuscated name may need updating if Forge changes - search in
    // ~\.gradle\caches\minecraft\de\oceanlabs\mcp\mcp_snapshot\20161220\1.11.2\srgs\mcp-srg.srg
    Field renderMan;
    Field globalRenderMan;
    try {
        renderMan = Minecraft.class.getDeclaredField(mcRenderManagerName);
        renderMan.setAccessible(true);
        renderMan.set(Minecraft.getMinecraft(), newRenderManager);
        globalRenderMan = RenderGlobal.class.getDeclaredField(globalRenderManagerName);
        globalRenderMan.setAccessible(true);
        globalRenderMan.set(Minecraft.getMinecraft().renderGlobal, newRenderManager);
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
}
Also used : Minecraft(net.minecraft.client.Minecraft) RenderGlobal(net.minecraft.client.renderer.RenderGlobal) Field(java.lang.reflect.Field) RenderManager(net.minecraft.client.renderer.entity.RenderManager)

Aggregations

RenderManager (net.minecraft.client.renderer.entity.RenderManager)45 Tessellator (net.minecraft.client.renderer.Tessellator)8 FontRenderer (net.minecraft.client.gui.FontRenderer)7 InvokeEvent (cc.hyperium.event.InvokeEvent)4 Minecraft (net.minecraft.client.Minecraft)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)3 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)3 Render (net.minecraft.client.renderer.entity.Render)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityItem (net.minecraft.entity.item.EntityItem)3 Field (java.lang.reflect.Field)2 EntityJuicer (micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)2 TextureManager (net.minecraft.client.renderer.texture.TextureManager)2 Entity (net.minecraft.entity.Entity)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ItemStack (net.minecraft.item.ItemStack)2 LayerBloodElytra (WayofTime.bloodmagic.client.render.LayerBloodElytra)1 IMixinThreadDownloadImageData (cc.hyperium.mixins.client.renderer.IMixinThreadDownloadImageData)1