protected void drawInventory( float delta, int mX, int mY ){ RenderEngine engine = mc.renderEngine; Tessellator buff = Tessellator.instance; //Bind the texture engine.bindTexture("/slp-gui/term.png"); //Standard item model RenderHelper.disableStandardItemLighting(); //Draw the leaflet buff.setTranslation(guiLeft +8, guiTop +114, 0); buff.startDrawingQuads(); buff.addVertexWithUV(0, 0, 0, 1, 0); buff.addVertexWithUV(0, 90, 0, 422f/512f, 0); buff.addVertexWithUV(256, 90, 0, 422f/512f, 1); buff.addVertexWithUV(256, 0, 0, 1, 1); buff.draw(); buff.setTranslation(0, 0, 0); //Draw slots super.drawScreen(mX, mY, delta); }
private void renderSMG(float x, float y, float z, float angle, float rotX, float rotY, float rotZ) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/SMGModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size GL11.glRotatef(angle, rotX, rotY, rotZ); smgModel.render(0.1F); GL11.glPopMatrix(); // end }
private void renderSMGForInventory(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/SMGModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size smgInv.render(0.094F); GL11.glPopMatrix(); // end }
private void renderSniper(float x, float y, float z, float angle, float rotX, float rotY, float rotZ) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/SniperModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size GL11.glRotatef(angle, rotX, rotY, rotZ); sniperModel.render(0.15F); GL11.glPopMatrix(); // end }
private void renderSniperForInventory(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/SniperModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size sniperInv.render(.06F); GL11.glPopMatrix(); // end }
private void renderPistol(float x, float y, float z, float angle, float rotX, float rotY, float rotZ) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/PistolModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size GL11.glRotatef(angle, rotX, rotY, rotZ); pistolModel.render(0.1F); GL11.glPopMatrix(); // end }
private void renderPistolForInventory(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/PistolModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size pistolInv.render(0.1F); GL11.glPopMatrix(); // end }
private void renderAssault(float x, float y, float z, float angle, float rotX, float rotY, float rotZ) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/AssaultRifleModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size GL11.glRotatef(angle, rotX, rotY, rotZ); assaultRifleModel.render(0.1F); GL11.glPopMatrix(); // end }
private void renderAssaultForInventory(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/Guns/AssaultRifleModel.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size assaultRifleInv.render(0.07F); GL11.glPopMatrix(); // end }
public static void renderGrenade(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/TextureGrenade.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size grenadeModel.render(.1F); GL11.glPopMatrix(); // end }
private void renderGrenadeInv(float x, float y, float z) { Minecraft mc = Minecraft.getMinecraft(); RenderEngine render = mc.renderEngine; render.bindTexture("/mods/BL2/textures/TextureGrenade.png"); GL11.glPushMatrix(); // start GL11.glTranslatef(x, y, z); // size grenadeInv.render(.29F); GL11.glPopMatrix(); // end }
/** * Caches the current frame's active render info, including the current World, RenderEngine, GameSettings and * FontRenderer settings, as well as interpolated player position, pitch and yaw. */ public void cacheActiveRenderInfo(World par1World, RenderEngine par2RenderEngine, FontRenderer par3FontRenderer, EntityLiving par4EntityLiving, EntityLiving par5EntityLiving, GameSettings par6GameSettings, float par7) { this.worldObj = par1World; this.renderEngine = par2RenderEngine; this.options = par6GameSettings; this.livingPlayer = par4EntityLiving; this.field_96451_i = par5EntityLiving; this.fontRenderer = par3FontRenderer; if (par4EntityLiving.isPlayerSleeping()) { int x = MathHelper.floor_double(par4EntityLiving.posX); int y = MathHelper.floor_double(par4EntityLiving.posY); int z = MathHelper.floor_double(par4EntityLiving.posZ); Block block = Block.blocksList[par1World.getBlockId(x, y, z)]; if (block != null && block.isBed(par1World, x, y, z, par4EntityLiving)) { int k = block.getBedDirection(par1World, x, y, z);; this.playerViewY = (float)(k * 90 + 180); this.playerViewX = 0.0F; } } else { this.playerViewY = par4EntityLiving.prevRotationYaw + (par4EntityLiving.rotationYaw - par4EntityLiving.prevRotationYaw) * par7; this.playerViewX = par4EntityLiving.prevRotationPitch + (par4EntityLiving.rotationPitch - par4EntityLiving.prevRotationPitch) * par7; } if (par6GameSettings.thirdPersonView == 2) { this.playerViewY += 180.0F; } this.viewerPosX = par4EntityLiving.lastTickPosX + (par4EntityLiving.posX - par4EntityLiving.lastTickPosX) * (double)par7; this.viewerPosY = par4EntityLiving.lastTickPosY + (par4EntityLiving.posY - par4EntityLiving.lastTickPosY) * (double)par7; this.viewerPosZ = par4EntityLiving.lastTickPosZ + (par4EntityLiving.posZ - par4EntityLiving.lastTickPosZ) * (double)par7; }
/** * Render the item's icon or block into the GUI, including the glint effect. */ public void renderItemAndEffectIntoGUI (SmallFontRenderer par1SmallFontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { if (par3ItemStack != null) { if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5)) { this.renderItemIntoGUI(par1SmallFontRenderer, par2RenderEngine, par3ItemStack, par4, par5); } if (par3ItemStack.hasEffect()) { GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); par2RenderEngine.bindTexture("%blur%/misc/glint.png"); this.zLevel -= 50.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); this.zLevel += 50.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } }
public void renderItemOverlayIntoGUI (SmallFontRenderer par1SmallFontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5, String par6Str) { if (par3ItemStack != null) { if (par3ItemStack.stackSize > 1 || par6Str != null) { String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str; GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); par1SmallFontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1SmallFontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } if (par3ItemStack.isItemDamaged()) { int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage()); int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage()); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tessellator = Tessellator.instance; int i1 = 255 - l << 16 | l << 8; int j1 = (255 - l) / 4 << 16 | 16128; this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0); this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1); this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } }
public SmallFontRenderer(GameSettings par1GameSettings, String par2Str, RenderEngine par3RenderEngine, boolean par4) { this.fontTextureName = par2Str; this.renderEngine = par3RenderEngine; this.unicodeFlag = true; this.readFontData(); par3RenderEngine.bindTexture(par2Str); for (int i = 0; i < 32; ++i) { int j = (i >> 3 & 1) * 85; int k = (i >> 2 & 1) * 170 + j; int l = (i >> 1 & 1) * 170 + j; int i1 = (i >> 0 & 1) * 170 + j; if (i == 6) { k += 85; } if (par1GameSettings.anaglyph) { int j1 = (k * 30 + l * 59 + i1 * 11) / 100; int k1 = (k * 30 + l * 70) / 100; int l1 = (k * 30 + i1 * 70) / 100; k = j1; l = k1; i1 = l1; } if (i >= 16) { k /= 4; l /= 4; i1 /= 4; } this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255; } }
public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack stack, int x, int y, float zLevel, float scale) { RenderBlocks renderBlocks = new RenderBlocks(); Block block = Block.blocksList[stack.itemID]; renderEngine.bindTexture(Textures.VANILLA_BLOCK_TEXTURE_SHEET); GL11.glPushMatrix(); GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); GL11.glTranslatef(1.0F, 0.5F, 1.0F); GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F); GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(0F + 1 * rotationAngle, 0.0F, 1.0F, 0.0F); rotationAngle = (rotationAngle + 1) % 360; int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0); float var16 = (var10 >> 16 & 255) / 255.0F; float var12 = (var10 >> 8 & 255) / 255.0F; float var13 = (var10 & 255) / 255.0F; GL11.glColor4f(var16, var12, var13, 1.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); renderBlocks.useInventoryTint = true; renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); }
public static void renderItemIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack itemStack, int x, int y, float opacity, float scale) { Icon icon = itemStack.getIconIndex(); GL11.glDisable(GL11.GL_LIGHTING); renderEngine.bindTexture(Textures.VANILLA_ITEM_TEXTURE_SHEET); int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0); float red = (overlayColour >> 16 & 255) / 255.0F; float green = (overlayColour >> 8 & 255) / 255.0F; float blue = (overlayColour & 255) / 255.0F; GL11.glColor4f(red, green, blue, opacity); drawTexturedQuad(x, y, icon, 16 * scale, 16 * scale, -90); GL11.glEnable(GL11.GL_LIGHTING); }
@Override public void bindImage(RenderEngine renderengine) { Proxies.common.bindTexture(Defaults.TEXTURE_ITEMS); }
@Override public void bindImage(RenderEngine renderengine) { Proxies.common.bindTexture(texture); }
/** * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the * specified position. */ public void renderItemOverlayIntoGUI (SmallFontRenderer par1SmallFontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { this.renderItemOverlayIntoGUI(par1SmallFontRenderer, par2RenderEngine, par3ItemStack, par4, par5, (String) null); }
private void readFontTexture (String par1Str) { BufferedImage bufferedimage; try { bufferedimage = ImageIO.read(RenderEngine.class.getResourceAsStream(par1Str)); } catch (IOException ioexception) { throw new RuntimeException(ioexception); } int i = bufferedimage.getWidth(); int j = bufferedimage.getHeight(); int[] aint = new int[i * j]; bufferedimage.getRGB(0, 0, i, j, aint, 0, i); int k = 0; while (k < 256) { int l = k % 16; int i1 = k / 16; int j1 = 7; while (true) { if (j1 >= 0) { int k1 = l * 8 + j1; boolean flag = true; for (int l1 = 0; l1 < 8 && flag; ++l1) { int i2 = (i1 * 8 + l1) * i; int j2 = aint[k1 + i2] & 255; if (j2 > 0) { flag = false; } } if (flag) { --j1; continue; } } if (k == 32) { j1 = 2; } this.charWidth[k] = j1 + 2; ++k; break; } } }
public TerminalRenderer(RenderEngine engine, Tessellator buff) { this.render = engine; this.buff = buff; BufferedImage image; try { image = ImageIO.read(getClass().getResourceAsStream( "/font/default.png")); } catch (IOException e) { throw new RuntimeException(); } int w = image.getWidth(); int h = image.getHeight(); int[] rgbData = new int[w * h]; image.getRGB(0, 0, w, h, rgbData, 0, w); for (int chrIndex = 0; chrIndex < 256; chrIndex++) { int x = chrIndex % 16; int y = chrIndex / 16; int wide = 7; while (wide >= 0) { int baseIndex = x * 8 + wide; boolean isEmpty = true; for (int lY = 0; lY < 8; lY++) { int index = (y * 8 + lY) * w; if ((rgbData[baseIndex + index] & 0xFF) > 0) { isEmpty = false; break; } } if (!isEmpty) break; wide--; } if (chrIndex == 32) // Space is 2 wide wide = 2; charWidth[chrIndex] = (wide + 2); } // Fix control chars for (int index = 0xB0; index < 0xDF; index++) charWidth[index] = FONT_WIDTH; // Setup the texture charTexture = engine.allocateAndSetupTexture(image); }
public static RenderEngine getRenderEngine() { return Minecraft.getMinecraft().renderEngine; }