net.minecraft.client.renderer.RenderHelper Java Examples

The following examples show how to use net.minecraft.client.renderer.RenderHelper. 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: ScreenEntityEntry.java    From WearableBackpacks with MIT License 6 votes vote down vote up
@Override
public void draw(int mouseX, int mouseY, float partialTicks) {
	int w = getWidth();
	int h = getHeight();
	
	enableBlendAlphaStuffs();
	setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2);
	setRenderColorARGB(_colorBorder);     drawOutline(0, 0, w, h);
	disableBlendAlphaStuffs();
	
	ItemStack stack = getStack();
	if (stack.isEmpty()) return;
	
	GlStateManager.enableDepth();
	GlStateManager.enableRescaleNormal();
	RenderHelper.enableGUIStandardItemLighting();
	getMC().getRenderItem().renderItemIntoGUI(stack, w / 2 - 8, h / 2 - 8);
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	GlStateManager.disableDepth();
}
 
Example #2
Source File: GuiFabricatorButton.java    From EmergingTechnology with MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {

    if (!visible)
        return;
    
    RenderHelper.enableGUIStandardItemLighting();
    RenderItem itemRender = mc.getRenderItem();

    GlStateManager.translate(0.0F, 0.0F, 32.0F);
    this.zLevel = 200.0F;
    itemRender.zLevel = 200.0F;
    itemRender.renderItemAndEffectIntoGUI(itemStackToRender, x, y);
    this.zLevel = 0.0F;
    itemRender.zLevel = 0.0F;

    RenderHelper.disableStandardItemLighting();
}
 
Example #3
Source File: OptionUtilities.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void drawIcons()
{
    int x = buttonX();
    LayoutManager.drawIcon(x+4, 4, new Image(120, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(120, 12, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(168, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(144, 12, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(180, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(132, 12, 12, 12)); x+=24;
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    ItemStack sword = new ItemStack(Items.diamond_sword);
    sword.addEnchantment(Enchantment.sharpness, 1);
    GuiContainerManager.drawItem(x+2, 2, sword); x+=24;
    GuiContainerManager.drawItem(x+2, 2, new ItemStack(Items.potionitem)); x+=24;
    GuiContainerManager.drawItem(x+2, 2, new ItemStack(Blocks.stone)); x+=24;
}
 
Example #4
Source File: ArmorComponent.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
   // RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
    final Minecraft mc = Minecraft.getMinecraft();

    int space = 0;

    for (int i = 0; i <= 3; i++) {
        final ItemStack stack = mc.player.inventoryContainer.getSlot(8 - i).getStack();
        if (stack != ItemStack.EMPTY) {
            GlStateManager.pushMatrix();
            RenderHelper.enableGUIStandardItemLighting();
            mc.getRenderItem().renderItemAndEffectIntoGUI(stack, (int)this.getX() + space, (int)this.getY());
            mc.getRenderItem().renderItemOverlays(mc.fontRenderer, stack, (int)this.getX() + space, (int)this.getY());
            RenderHelper.disableStandardItemLighting();
            GlStateManager.popMatrix();
            space += 18;
        }
    }

    this.setW(space);
    this.setH(16);
}
 
Example #5
Source File: GuiItemIconDumper.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private void drawItems() {
    Dimension d = GuiDraw.displayRes();

    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0, d.width*16D/iconSize, d.height*16D/iconSize, 0, 1000, 3000);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.clearColor(0, 0, 0, 0);
    GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    int rows = d.height / boxSize;
    int cols = d.width / boxSize;
    int fit = rows*cols;

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.color(1, 1, 1, 1);

    for(int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
        int x = i%cols * 18;
        int y = i/cols * 18;
        GuiContainerManager.drawItem(x+1, y+1, ItemPanel.items.get(drawIndex));
    }

    GL11.glFlush();
}
 
Example #6
Source File: GuiSelectionScreen.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
@Override // @mcp: func_230432_a_  = render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    BlockData blockData = this.block;

    FontRenderer font = Minecraft.getInstance().fontRenderer;
    // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF);
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB());

    RenderHelper.enableStandardItemLighting();
    Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7);
    RenderHelper.disableStandardItemLighting();
    if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) {
        this.parent.parent.func_238654_b_(
                stack,
                Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")),
                left + 15,
                (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries
        );  // @mcp: func_230457_a_ = renderTooltip
    }

    RenderSystem.enableAlphaTest();
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor());
    RenderSystem.disableAlphaTest();
    RenderSystem.disableBlend();
}
 
Example #7
Source File: FramebufferShader.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
public void stopDraw(final Color color, final float radius, final float quality) {
    mc.gameSettings.entityShadows = entityShadows;
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    mc.getFramebuffer().bindFramebuffer(true);

    red = color.getRed() / 255F;
    green = color.getGreen() / 255F;
    blue = color.getBlue() / 255F;
    alpha = color.getAlpha() / 255F;
    this.radius = radius;
    this.quality = quality;

    mc.entityRenderer.disableLightmap();
    RenderHelper.disableStandardItemLighting();

    startShader();
    mc.entityRenderer.setupOverlayRendering();
    drawFramebuffer(framebuffer);
    stopShader();

    mc.entityRenderer.disableLightmap();

    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
}
 
Example #8
Source File: GuiItemIconDumper.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private void drawItems() {
    Dimension d = GuiDraw.getDisplayRes();

    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0, d.width * 16D / iconSize, d.height * 16D / iconSize, 0, 1000, 3000);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.clearColor(0, 0, 0, 0);
    GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    int rows = d.height / boxSize;
    int cols = d.width / boxSize;
    int fit = rows * cols;

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.color(1, 1, 1, 1);

    for (int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
        int x = i % cols * 18;
        int y = i / cols * 18;
        GuiHelper.drawItem(x + 1, y + 1, ItemPanel.items.get(drawIndex));
    }

    GL11.glFlush();
}
 
Example #9
Source File: OptionUtilities.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void drawIcons() {
    int x = buttonX();
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(120, 24, 12, 12));
    x += 24;
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(120, 12, 12, 12));
    x += 24;
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(168, 24, 12, 12));
    x += 24;
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(144, 12, 12, 12));
    x += 24;
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(180, 24, 12, 12));
    x += 24;
    LayoutManager.drawIcon(x + 4, 4, new Rectangle4i(132, 12, 12, 12));
    x += 24;
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    ItemStack sword = new ItemStack(Items.DIAMOND_SWORD);
    sword.addEnchantment(Enchantment.getEnchantmentByLocation("sharpness"), 1);
    GuiHelper.drawItem(x + 2, 2, sword);
    x += 24;
    GuiHelper.drawItem(x + 2, 2, new ItemStack(Items.POTIONITEM));
    x += 24;
    GuiHelper.drawItem(x + 2, 2, new ItemStack(Blocks.STONE));
    x += 24;
}
 
Example #10
Source File: GuiButtonSpecial.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks){
    if(thisVisible) super.drawButton(mc, mouseX, mouseY, partialTicks);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = this.x + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + width && mouseY < this.y + height) {
            Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor);
        }
    }
}
 
Example #11
Source File: MetaTileEntityTESR.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderTileEntityFastPart(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    }
    else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

    renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partialTicks, buffer);
    buffer.setTranslation(0, 0, 0);
    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
}
 
Example #12
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 #13
Source File: ItemChiselRenderer.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
	RenderHelper.enableGUIStandardItemLighting();

	renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);

	if (stack.stackTagCompound == null)
		return;

	ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
	if (chiselTarget == null)
		return;

	GL11.glPushMatrix();
	GL11.glScalef(0.65f, 0.65f, 0.65f);
	GL11.glTranslatef(-8f, -8f, 0.0f);

	renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);

	GL11.glPopMatrix();
}
 
Example #14
Source File: BlockAndItemWikiTab.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderForeground(GuiWiki gui, int mouseX, int mouseY){
    if(!drawingStack.isEmpty()) {
        GlStateManager.enableLighting();
        RenderHelper.enableGUIStandardItemLighting();
        if(drawingStack.getItem() instanceof ItemBlock) {
            gui.renderRotatingBlockIntoGUI(gui, drawingStack, 55, 58, 2.8F);
        } else {
            GL11.glPushMatrix();
            GL11.glTranslated(49, 20, 0);
            GL11.glScaled(2.2, 2.2, 2.2);
            Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(drawingStack, 0, 0);
            GL11.glPopMatrix();
        }
    }
}
 
Example #15
Source File: SurfaceHelper.java    From ForgeHax with MIT License 6 votes vote down vote up
public static void drawPotionEffect(PotionEffect potion, int x, int y) {
  int index = potion.getPotion().getStatusIconIndex();
  GlStateManager.pushMatrix();
  RenderHelper.enableGUIStandardItemLighting();
  GlStateManager.disableLighting();
  GlStateManager.enableRescaleNormal();
  GlStateManager.enableColorMaterial();
  GlStateManager.enableLighting();
  GlStateManager.enableTexture2D();
  GlStateManager.color(1.f, 1.f, 1.f, 1.f);
  MC.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND);
  drawTexturedRect(x, y, index % 8 * 18, 198 + index / 8 * 18, 18, 18, 100);
  potion.getPotion().renderHUDEffect(x, y, potion, MC, 255);
  GlStateManager.disableLighting();
  GlStateManager.enableDepth();
  GlStateManager.color(1.f, 1.f, 1.f, 1.f);
  GlStateManager.popMatrix();
}
 
Example #16
Source File: SurfaceHelper.java    From ForgeHax with MIT License 6 votes vote down vote up
public static void drawItemWithOverlay(ItemStack item, double x, double y, double scale) {
  GlStateManager.pushMatrix();
  RenderHelper.enableGUIStandardItemLighting();
  GlStateManager.disableLighting();
  GlStateManager.enableRescaleNormal();
  GlStateManager.enableColorMaterial();
  GlStateManager.enableLighting();
  MC.getRenderItem().zLevel = 100.f;
  renderItemAndEffectIntoGUI(getLocalPlayer(), item, x, y, 16.D);
  renderItemOverlayIntoGUI(MC.fontRenderer, item, x, y, null, scale);
  MC.getRenderItem().zLevel = 0.f;
  GlStateManager.popMatrix();
  GlStateManager.disableLighting();
  GlStateManager.enableDepth();
  GlStateManager.color(1.f, 1.f, 1.f, 1.f);
}
 
Example #17
Source File: ItemChiselRenderer.java    From Chisel with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data)
{
    RenderHelper.enableGUIStandardItemLighting();

    renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);

    if(stack.stackTagCompound == null) return;

    ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
    if(chiselTarget == null) return;

    GL11.glPushMatrix();
    GL11.glScalef(0.65f, 0.65f, 0.65f);
    GL11.glTranslatef(-8f, -8f, 0.0f);

    renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);

    GL11.glPopMatrix();
}
 
Example #18
Source File: GuiSurgery.java    From Cyberware with MIT License 6 votes vote down vote up
public void renderEntity(Entity entity, float x, float y, float scale, float rotation)
{
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, 50.0F);
	GlStateManager.scale(-scale, scale, scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F;
	Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
	GlStateManager.enableTexture2D();
}
 
Example #19
Source File: PuzzleTESR.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
private void renderSlot(TilePuzzle te) {
    ItemStack stack = te.getItem();
    if (stack.isEmpty()) {
        return;
    }

    RenderHelper.enableGUIStandardItemLighting();
    float factor = 4.0f;
    float f3 = 0.0075F;
    GlStateManager.translate(-0.5F, 0.5F, -0.15F);
    GlStateManager.scale(f3 * factor, -f3 * factor, 0.0001f);

    RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
    itemRender.renderItemAndEffectIntoGUI(stack, 8, 8);

    RenderHelper.enableStandardItemLighting();
}
 
Example #20
Source File: GuiSurgery.java    From Cyberware with MIT License 6 votes vote down vote up
public void renderModel(ModelBase model, float x, float y, float scale, float rotation)
{
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, 120F);
	GlStateManager.scale(-scale, scale, scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(10.0F, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	float f1 = 0.7F;
	GlStateManager.glLightModel(2899, RenderHelper.setColorBuffer(f1, f1, f1, 1.0F));
	model.render(null, 0, 0, 0, 0, 0, .0625f);
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
	GlStateManager.enableTexture2D();

}
 
Example #21
Source File: RenderShip.java    From archimedes-ships with MIT License 6 votes vote down vote up
public void renderVehicle(EntityShip entity, double x, double y, double z, float yaw, float rendertime)
{
	GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT);
	RenderHelper.disableStandardItemLighting();
	
	float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * rendertime;
	
	float rx = entity.frontDirection == 1 ? -1f : entity.frontDirection == 3 ? 1f : 0f;
	float rz = entity.frontDirection == 0 ? 1f : entity.frontDirection == 2 ? -1f : 0f;
	
	GL11.glPushMatrix();
	GL11.glTranslatef((float) x, (float) y, (float) z);
	GL11.glRotatef(yaw, 0F, 1F, 0F);
	GL11.glRotatef(pitch, rx, 0f, rz);
	
	float fx = entity.getShipChunk().getCenterX();
	float fz = entity.getShipChunk().getCenterZ();
	GL11.glTranslatef(-fx, -entity.getShipChunk().minY(), -fz); //minY is always 0
	
	//float f4 = 0.75F;
	bindEntityTexture(entity);
	((MobileChunkClient) entity.getShipChunk()).getRenderer().render(0F);
	GL11.glPopMatrix();
	
	GL11.glPopAttrib();
}
 
Example #22
Source File: GuiButtonSpecial.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int x, int y){
    if(thisVisible) super.drawButton(mc, x, y);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = xPosition + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, renderedStacks[i], startX + i * 18, yPosition + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            func_146110_a(xPosition + width / 2 - 8, yPosition + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + height) {
            Gui.drawRect(xPosition, yPosition, xPosition + width, yPosition + height, invisibleHoverColor);
        }
    }
}
 
Example #23
Source File: GuiAutoChisel.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);

	int x = (this.width - this.xSize) / 2;
	int y = (this.height - this.ySize) / 2;

	for (Slot slot : (List<Slot>) inventorySlots.inventorySlots) {
		if (!slot.getHasStack() && mouseInside(slot, mouseX - x, mouseY - y)) {
			if (slot.slotNumber < autochisel.getSizeInventory()) {
				String tt = autochisel.getSlotTooltipUnloc(slot.slotNumber);
				if (!Strings.isNullOrEmpty(tt)) {
					this.func_146283_a(Lists.newArrayList(StatCollector.translateToLocal(tt)), mouseX - x, mouseY - y);
				}
			}
		}
	}
	RenderHelper.enableGUIStandardItemLighting();
}
 
Example #24
Source File: BaseComponent.java    From OpenModsLib with MIT License 6 votes vote down vote up
protected void drawItemStack(@Nonnull ItemStack stack, int x, int y, String overlayText) {
	if (stack.isEmpty()) return;

	RenderHelper.enableGUIStandardItemLighting();
	final RenderItem itemRenderer = parent.getItemRenderer();
	GlStateManager.translate(0.0F, 0.0F, 32.0F);
	this.zLevel = 200.0F;
	itemRenderer.zLevel = 200.0F;

	FontRenderer font = null;
	font = stack.getItem().getFontRenderer(stack);
	if (font == null) font = parent.getFontRenderer();

	itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
	itemRenderer.renderItemOverlayIntoGUI(font, stack, x, y, overlayText);
	this.zLevel = 0.0F;
	itemRenderer.zLevel = 0.0F;
	RenderHelper.disableStandardItemLighting();
}
 
Example #25
Source File: GuiBlockList.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override // @mcp; render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    FontRenderer font = this.parent.field_230668_b_.fontRenderer; // @mcp: field_230668_b_ = minecraft

    ResourceLocation resource = this.block.getItemStack().getItem().getRegistryName();
    font.func_238407_a_(stack,this.block.getItemStack().getItem().getName(), left + 40, top + 7, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(resource != null ? resource.getNamespace() : ""), left + 40, top + 17, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString
    // @mcp: func_240652_a_ = unknown... Code recommendation

    RenderHelper.enableStandardItemLighting();
    this.parent.field_230668_b_.getItemRenderer().renderItemAndEffectIntoGUI(this.block.getItemStack(), left + 15, top + 7); // @mcp: field_230668_b_ = minecraft
    RenderHelper.disableStandardItemLighting();
}
 
Example #26
Source File: GuiEdit.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) {
    getFontRender().func_238405_a_(stack, this.block.getItemStack().getDisplayName().getString(), getWidth() / 2f - 138, getHeight() / 2f - 90, 0xffffff); // @mcp: func_238405_a_ = drawtextwithshadow

    oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render

    GuiAddBlock.renderPreview(getWidth() / 2 - 138, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue());

    RenderHelper.enableStandardItemLighting();
    this.field_230707_j_.renderItemAndEffectIntoGUI(this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRenderer
    RenderHelper.disableStandardItemLighting();
}
 
Example #27
Source File: TileManaMagnetRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void render(TileManaMagnet te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
	if (te.manaOrb != null) {
		GlStateManager.pushMatrix();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

		GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
		GlStateManager.translate(0, MathHelper.sin(ClientTickHandler.getTicks()) / 2.0, 0);
		GlStateManager.disableRescaleNormal();
		{
			GlStateManager.enableRescaleNormal();
			GlStateManager.disableCull();
			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
			GlStateManager.enableLighting();
			GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
			RenderHelper.disableStandardItemLighting();

			Minecraft.getMinecraft().getTextureManager().bindTexture(manaPearlCubeTexture);
			TileOrbHolderRenderer.renderCube(0.1, Color.WHITE);

			GlStateManager.disableRescaleNormal();
		}

		GlStateManager.disableBlend();
		GlStateManager.popMatrix();
	}
}
 
Example #28
Source File: EssentialsMissingHandlerClient.java    From Cyberware with MIT License 5 votes vote down vote up
private void rotateArroundXAndY(float angle, float angleY)
{
	GlStateManager.pushMatrix();
	GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(angleY, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	GlStateManager.popMatrix();
}
 
Example #29
Source File: GuiEnderFurnace.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float gameTicks, int mouseX, int mouseY)
{
    super.drawGuiContainerBackgroundLayer(gameTicks, mouseX, mouseY);
    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;

    // 1: Outputting to Ender Chest, draw the regular arrow instead of the crossed over arrow
    if (this.containerEF.outputToEnderChest)
    {
        this.drawTexturedModalRect(x + 114, y + 34, 176, 78, 24, 16);
    }

    // Draw the burn progress flame
    if (this.teef.isBurningLast)
    {
        int uOffset = (this.teef.fastMode ? 14 : 0);
        int h = this.containerEF.fuelProgress * 13 / 100;

        this.drawTexturedModalRect(x + 34, y + 36 + 12 - h, 176 + uOffset, 12 - h, 14, h + 1);
    }

    // Draw the smelting progress arrow
    if (this.containerEF.smeltingProgress > 0)
    {
        int vOffset = 0;
        int w = this.containerEF.smeltingProgress * 24 / 100;

        if (this.teef.isBurningLast)
        {
            vOffset = (this.teef.fastMode ? 32 : 16);
        }

        this.drawTexturedModalRect(x + 57, y + 34, 176, 14 + vOffset, w, 16);
    }

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(Item.getItemFromBlock(Blocks.ENDER_CHEST)), x + 145, y + 34);
}
 
Example #30
Source File: MixinRenderGlobal.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Inject(method = "renderBlockLayer(Lnet/minecraft/util/BlockRenderLayer;DILnet/minecraft/entity/Entity;)I", at = @At("HEAD"))
private void preRenderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, int pass,
    Entity entityIn, CallbackInfoReturnable callbackInfo) {
    RenderHelper.disableStandardItemLighting();

    // This probably won't work with strange mods, but I'm too lazy to do it better
    ICamera icamera = new Frustum();
    Entity entity = this.mc.getRenderViewEntity();
    double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
    double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
    double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
    icamera.setPosition(d0, d1, d2);

    for (PhysicsWrapperEntity wrapper : ValkyrienSkiesMod.VS_PHYSICS_MANAGER
        .getManagerForWorld(this.world)
        .getTickablePhysicsEntities()) {
        GL11.glPushMatrix();
        if (wrapper.getPhysicsObject().getShipRenderer() != null && wrapper.getPhysicsObject()
            .getShipRenderer().shouldRender(icamera)) {
            wrapper.getPhysicsObject().getShipRenderer()
                .renderBlockLayer(blockLayerIn, partialTicks, pass, icamera);
        }
        GL11.glPopMatrix();
    }

    GlStateManager.resetColor();
}