Java Code Examples for net.minecraft.client.renderer.OpenGlHelper#setLightmapTextureCoords()

The following examples show how to use net.minecraft.client.renderer.OpenGlHelper#setLightmapTextureCoords() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTRenderDisplayScreen.java    From GT-Classic with GNU Lesser General Public License v3.0 9 votes vote down vote up
@Override
public void render(GTTileDisplayScreen screen, double x, double y, double z, float partialTicks, int destroyStage,
		float alpha) {
	if (screen != null && screen.shouldDraw) {
		FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
		GlStateManager.pushMatrix();
		screen.applyRotation((float) x, (float) y, (float) z);
		screen.applySize(2.5F, 4D, 4D, -0.001D);
		int bright = 0xF0;
		int brightX = bright % 65536;
		int brightY = bright / 65536;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY);
		int i = 0;
		for (String text : screen.information.getWrapperList()) {
			i++;
			if (i > 8) {
				break;
			}
			renderer.drawString(text, (int) x + 10, (int) (y - 2) + (10 * i), Color.CYAN.getRGB());
		}
		GlStateManager.popMatrix();
	}
}
 
Example 2
Source File: PlayerSpecials.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderExtras(EntityPlayer player, boolean post) {
	if (!post) {
		GL11.glPushMatrix();
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
		if (player.isSneaking()) {
			GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
		}
		boolean armor = player.getCurrentArmor(1) != null;
		GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
		GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
		GL11.glTranslatef(-0.25F, -0.85F, armor ? 0.2F : 0.28F);
		GL11.glScalef(0.5F, 0.5F, 0.5F);
		GL11.glColor3f(1.0F, 1.0F, 1.0F);
		int light = 0xF000F0;
		int lightmapX = light % 0x10000;
		int lightmapY = light / 0x10000;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);

		IIcon icon = toRender.getIconIndex();
		ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1.0F / 16.0F);
		GL11.glPopMatrix();
	}
}
 
Example 3
Source File: Widget.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
protected static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable String altTxt) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.0F, 0.0F, 32.0F);
    GlStateManager.color(1F, 1F, 1F, 1F);
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableLighting();
    RenderHelper.enableGUIStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
    Minecraft mc = Minecraft.getMinecraft();
    RenderItem itemRender = mc.getRenderItem();
    itemRender.renderItemAndEffectIntoGUI(itemStack, x, y);
    itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, altTxt);
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableLighting();
    GlStateManager.color(1F, 1F, 1F, 1F);
    GlStateManager.popMatrix();
    GlStateManager.enableBlend();
    GlStateManager.disableDepth();
}
 
Example 4
Source File: RenderWitherCat.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public void doRenderLayer(EntityWitherCat cat, float p_177201_2_, float p_177201_3_, float p_177201_4_, float p_177201_5_, float p_177201_6_,
    float p_177201_7_, float p_177201_8_) {

  float blendFactor = 1.0F;
  float scale = cat.getScale();
  blendFactor = 1 - (cat.getAngryScale() - scale);

  if (blendFactor > 0) {
    bindTexture(angryTexture);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_ALPHA);

    GL14.glBlendColor(1.0f, 1.0f, 1.0f, blendFactor);

    GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
    GL11.glPolygonOffset(-1, -1);

    char c0 = 61680;
    int j = c0 % 65536;
    int k = c0 / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
    GL11.glEnable(GL11.GL_LIGHTING);

    getMainModel().render(cat, p_177201_2_, p_177201_3_, p_177201_5_, p_177201_6_, p_177201_7_, p_177201_8_);
    setLightmap(cat);
  }

}
 
Example 5
Source File: OutlineUtils.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public static void renderFour(final Color color) {
    setColor(color);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_POLYGON_OFFSET_LINE);
    glPolygonOffset(1.0F, -2000000F);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
 
Example 6
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void drawSlotContents(Slot slot) {
    GlStateManager.enableDepth();
    RenderHelper.enableGUIStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    drawSlot(slot);
    GlStateManager.enableDepth();
    GlStateManager.enableBlend();
    GlStateManager.disableLighting();
}
 
Example 7
Source File: FxLaserHeat.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn,
		float partialTicks, float rotationX, float rotationZ,
		float rotationYZ, float rotationXY, float rotationXZ) {
	//worldRendererIn.finishDrawing();
	
	float x = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
	float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
	float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
	
	int i = this.getBrightnessForRender(0);
	int j = i >> 16 & 65535;
	int k = i & 65535;
	
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0);
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
	
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL);
	GlStateManager.color(0.8f, 0.2f, 0.2f, particleAlpha);
	

	double size = this.size*particleAlpha;
	RenderHelper.renderCube(buffer, x - size, y - size, z - size, x + size, y + size, z + size);
	
	
	Tessellator.getInstance().draw();
	
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_LIGHTING);
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0);
	GlStateManager.color(1, 1, 1, 1);
	GL11.glLineWidth(1);
}
 
Example 8
Source File: LayerGlowEye.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public void doRenderLayer(T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    this.render.bindTexture(EYE_TEXTURE);
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);

    if (entitylivingbaseIn.isInvisible()) {
        GlStateManager.depthMask(false);
    } else {
        GlStateManager.depthMask(true);
    }

    int i = 50680;
    int j = i % 65536;
    int k = i / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().entityRenderer.setupFogColor(true);
    this.render.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    Minecraft.getMinecraft().entityRenderer.setupFogColor(false);
    i = entitylivingbaseIn.getBrightnessForRender();
    j = i % 65536;
    k = i / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k);
    this.render.setLightmap(entitylivingbaseIn);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
}
 
Example 9
Source File: LitematicaRenderer.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void renderSchematicOverlay()
{
    boolean invert = Hotkeys.INVERT_OVERLAY_RENDER_STATE.getKeybind().isKeybindHeld();

    if (Configs.Visuals.ENABLE_SCHEMATIC_OVERLAY.getBooleanValue() != invert)
    {
        boolean renderThrough = Configs.Visuals.SCHEMATIC_OVERLAY_RENDER_THROUGH.getBooleanValue() || Hotkeys.RENDER_OVERLAY_THROUGH_BLOCKS.getKeybind().isKeybindHeld();
        float lineWidth = (float) (renderThrough ? Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH_THROUGH.getDoubleValue() : Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH.getDoubleValue());

        GlStateManager.pushMatrix();
        GlStateManager.disableTexture2D();
        GlStateManager.disableCull();
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.001F);
        GlStateManager.enablePolygonOffset();
        GlStateManager.doPolygonOffset(-0.4f, -0.8f);
        fi.dy.masa.malilib.render.RenderUtils.setupBlend();
        GlStateManager.glLineWidth(lineWidth);
        fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);

        if (renderThrough)
        {
            GlStateManager.disableDepth();
        }

        this.getWorldRenderer().renderBlockOverlays();

        GlStateManager.enableDepth();
        GlStateManager.doPolygonOffset(0f, 0f);
        GlStateManager.disablePolygonOffset();
        GlStateManager.enableTexture2D();
        GlStateManager.popMatrix();
    }
}
 
Example 10
Source File: RenderCyberZombie.java    From Cyberware with MIT License 5 votes vote down vote up
public void doRenderLayer(T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
	if (entitylivingbaseIn.isBrute())
	{
		this.czRenderer.bindTexture(HIGHLIGHT_BRUTE);
	}
	else
	{
		this.czRenderer.bindTexture(HIGHLIGHT);
	}
	GlStateManager.enableBlend();
	//GlStateManager.disableAlpha();
	GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);

	if (entitylivingbaseIn.isInvisible())
	{
		GlStateManager.depthMask(false);
	}
	else
	{
		GlStateManager.depthMask(true);
	}

	int i = 61680;
	int j = i % 65536;
	int k = i / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	this.czRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
	i = entitylivingbaseIn.getBrightnessForRender(partialTicks);
	j = i % 65536;
	k = i / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
	this.czRenderer.setLightmap(entitylivingbaseIn, partialTicks);
	GlStateManager.disableBlend();
	GlStateManager.enableAlpha();
}
 
Example 11
Source File: EssentialsMissingHandlerClient.java    From Cyberware with MIT License 5 votes vote down vote up
private void setLightmap()
{
	AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
	int i = this.mc.theWorld.getCombinedLight(new BlockPos(abstractclientplayer.posX, abstractclientplayer.posY + (double)abstractclientplayer.getEyeHeight(), abstractclientplayer.posZ), 0);
	float f = (float)(i & 65535);
	float f1 = (float)(i >> 16);
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
}
 
Example 12
Source File: SelfRf.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onWorldRender(RenderWorldLastEvent event) {
    if (selectedEnt == null) {
        return;
    }
    if (distVec != null) {
        distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize();
        distVec.xCoord *= size;
        distVec.yCoord *= size;
        distVec.zCoord *= size;
    }
    NBTTagCompound tag = new NBTTagCompound();
    selectedEnt.writeToNBT(tag);

    if (!GLUtils.hasClearedDepth) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GLUtils.hasClearedDepth = true;
    }
    Entity ent = selectedEnt;

    double tXPos = ent.posX;
    double tYPos = ent.posY;
    double tZPos = ent.posZ;

    double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks;
    double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + 1) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks;
    double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks;

    ent.posX = ent.lastTickPosX = xPos;
    ent.posY = ent.lastTickPosY = yPos;
    ent.posZ = ent.lastTickPosZ = zPos;

    float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks;
    RenderHelper.enableStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
    if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) {
        GL11.glColor4f(0, 1.0F, 0, 1f);
    } else {
        GL11.glColor4f(1.0F, 0, 0, 1f);
    }
    RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false);

    ent.posX = ent.lastTickPosX = tXPos;
    ent.posY = ent.lastTickPosY = tYPos;
    ent.posZ = ent.lastTickPosZ = tZPos;

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
 
Example 13
Source File: GuiEnderUtilities.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Draw the template stacks from a "lockable inventory" for otherwise empty slots
 * @param inv
 */
protected void drawTemplateStacks(ItemStackHandlerLockable inv)
{
    // Draw a faint version of the template item for empty locked slots
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    GlStateManager.enableRescaleNormal();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
    this.zLevel = 100.0F;
    this.itemRender.zLevel = 100.0F;
    int invSize = inv.getSlots();

    for (int slotNum = 0; slotNum < invSize; slotNum++)
    {
        Slot slot = this.inventorySlots.getSlot(slotNum);

        if (inv.isSlotLocked(slotNum) && inv.getStackInSlot(slotNum).isEmpty())
        {
            ItemStack stack = inv.getTemplateStackInSlot(slotNum);

            if (stack.isEmpty() == false)
            {
                int x = this.guiLeft + slot.xPos;
                int y = this.guiTop + slot.yPos;
                GlStateManager.enableLighting();
                GlStateManager.enableDepth();
                GlStateManager.enableBlend();
                OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
                GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
                this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
            }
        }
    }

    this.itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    RenderHelper.enableStandardItemLighting();
}
 
Example 14
Source File: RenderUtility.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Disables lighting and turns glow on.
 */
public static void disableLighting() {
	RenderHelper.disableStandardItemLighting();
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
 
Example 15
Source File: RenderUtility.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Disables lighting and turns glow on.
 */
public static void disableLighting() {
	RenderHelper.disableStandardItemLighting();
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
 
Example 16
Source File: RenderUtility.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Disables lighting and turns glow on.
 */
public static void disableLighting() {
	RenderHelper.disableStandardItemLighting();
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
 
Example 17
Source File: SelfEnd.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onWorldRender(RenderWorldLastEvent event) {
    if (selectedEnt == null) {
        return;
    }
    if (distVec != null) {
        distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize();
        distVec.xCoord *= size;
        distVec.yCoord *= size;
        distVec.zCoord *= size;
    }
    NBTTagCompound tag = new NBTTagCompound();
    selectedEnt.writeToNBT(tag);

    if (!GLUtils.hasClearedDepth) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GLUtils.hasClearedDepth = true;
    }
    Entity ent = selectedEnt;

    double tXPos = ent.posX;
    double tYPos = ent.posY;
    double tZPos = ent.posZ;

    double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks;
    double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + 1) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks;
    double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks;

    ent.posX = ent.lastTickPosX = xPos;
    ent.posY = ent.lastTickPosY = yPos;
    ent.posZ = ent.lastTickPosZ = zPos;

    float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks;
    RenderHelper.enableStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
    if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) {
        GL11.glColor4f(0, 1.0F, 0, 1f);
    } else {
        GL11.glColor4f(1.0F, 0, 0, 1f);
    }
    RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false);

    ent.posX = ent.lastTickPosX = tXPos;
    ent.posY = ent.lastTickPosY = tYPos;
    ent.posZ = ent.lastTickPosZ = tZPos;

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
 
Example 18
Source File: TESRBBarrel.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(TileEntityBBarrel te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {

	if (te.getChestPart().isItemSet()) {
		GlStateManager.pushMatrix();
		GlStateManager.translate((float) x, (float) y, (float) z);
		GlStateManager.translate(0.5F, 0.5F, 0.5F);

		ItemStack stack = te.getChestPart().getDummy();

		EnumFacing side = EnumFacing.HORIZONTALS[te.getBlockMetadata()];

		float angle = side.getHorizontalAngle();
		switch (side) {
		case SOUTH:
			//south
			angle = 180;
			break;
		case WEST:
			//west
			angle = 90;
			break;
		case NORTH:
			//north
			angle = 0;
			break;
		case EAST:
			//east
			angle = -90;
			break;
		}
		GlStateManager.rotate(angle, 0, 1, 0);

		{
			GlStateManager.pushMatrix();

			GlStateManager.translate(0, 0.1, -0.5);
			GlStateManager.scale(0.8, 0.8, 0.8);

			int skyBrightness = te.getWorld().getCombinedLight(te.getPosition().offset(side), 0);
			int skyBrightness1 = skyBrightness % 65536;
			int skyBrightness2 = skyBrightness / 65536;
			OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyBrightness1,
					skyBrightness2);

			Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED);

			GlStateManager.popMatrix();
		}

		{
			GlStateManager.pushMatrix();

			GlStateManager.translate(0, -0.25, -0.51);
			GlStateManager.scale(0.015, 0.015, 0.015);
			GlStateManager.rotate(180, 0, 0, 1);

			String text = te.getChestPart().getAmountDescr();
			int textlen = Minecraft.getMinecraft().fontRenderer.getStringWidth(text);
			Minecraft.getMinecraft().fontRenderer.drawString(text, -textlen / 2, 0, 0xFFFFFFFF);

			GlStateManager.popMatrix();
		}

		GlStateManager.popMatrix();
	}

}
 
Example 19
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    this.hoveredSlot = null;
    drawDefaultBackground();

    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();

    drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.pushMatrix();
    GlStateManager.translate(guiLeft, guiTop, 0.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.enableRescaleNormal();

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i) {
        Slot slot = this.inventorySlots.inventorySlots.get(i);
        if (slot.isEnabled()) {
            this.drawSlotContents(slot);
        }
        if (isPointInRegion(slot.xPos, slot.yPos, 16, 16, mouseX, mouseY) && slot.isEnabled()) {
            renderSlotOverlay(slot);
            setHoveredSlot(slot);
        }
    }

    RenderHelper.disableStandardItemLighting();
    GlStateManager.popMatrix();

    drawGuiContainerForegroundLayer(mouseX, mouseY);

    GlStateManager.pushMatrix();
    GlStateManager.translate(guiLeft, guiTop, 0.0F);
    RenderHelper.enableGUIStandardItemLighting();

    MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.DrawForeground(this, mouseX, mouseY));

    GlStateManager.enableDepth();
    renderItemStackOnMouse(mouseX, mouseY);
    renderReturningItemStack();

    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
    RenderHelper.enableStandardItemLighting();

    renderHoveredToolTip(mouseX, mouseY);
}
 
Example 20
Source File: RendererObservatory.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f, int damage, float a) {
	TileObservatory multiBlockTile = (TileObservatory)tile;

	if(!multiBlockTile.canRender())
		return;

	//Initial setup
       int i = this.getWorld().getCombinedLight(tile.getPos().add(0, 1, 0), 0);
       int j = i % 65536;
       int k = i / 65536;
       OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
       GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	
	GL11.glPushMatrix();

	//Rotate and move the model into position
	EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); //tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));//tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));
	GL11.glTranslated(x + .5, y, z + .5);
	GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0);

	GL11.glTranslated(2, -1, 0);

	bindTexture(texture);

	float offset = multiBlockTile.getOpenProgress();

	if(offset != 0f) {
		model.renderOnly("Base");

		model.renderPart("Scope");
		model.renderPart("Axis");

		GL11.glPushMatrix();
		GL11.glTranslatef(0, 0, -offset);
		model.renderOnly("CasingXMinus");
		GL11.glPopMatrix();

		GL11.glPushMatrix();
		GL11.glTranslatef(0,0,offset);
		model.renderOnly("CasingXPlus");
		GL11.glPopMatrix();

	}
	else {
		model.renderOnly("Base");
		model.renderOnly("CasingXMinus");
		model.renderOnly("CasingXPlus");
	}
	GL11.glPopMatrix();
}