@Override @SideOnly(Side.CLIENT) public void renderFormedStructure() { if (renderStack == null) renderStack = new ItemStack( IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.EXCAVATOR.getMeta()); if (renderStack2 == null) renderStack2 = new ItemStack( IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.BUCKET_WHEEL.getMeta()); GlStateManager.translate(2, 3.5, 2.875); GlStateManager.rotate(-225, 0, 1, 0); GlStateManager.rotate(-20, 1, 0, 0); double s = 5.25; GlStateManager.scale(s, s, s); GlStateManager.disableCull(); ClientUtils.mc() .getRenderItem() .renderItem(renderStack, ItemCameraTransforms.TransformType.GUI); GlStateManager.scale(1 / s, 1 / s, 1 / s); GlStateManager.rotate(20, 1, 0, 0); GlStateManager.rotate(225, 0, 1, 0); GlStateManager.translate(2.5, 0, -1.375); GlStateManager.rotate(-45, 0, 1, 0); GlStateManager.rotate(-20, 1, 0, 0); GlStateManager.scale(6.875, 6.875, 6.875); ClientUtils.mc() .getRenderItem() .renderItem(renderStack2, ItemCameraTransforms.TransformType.GUI); GlStateManager.enableCull(); }
@Override public void renderTileEntityAt( TileEntityChargingStation te, double x, double y, double z, float partialTicks, int destroyStage) { if (te.getWorld() != null && te.getWorld().isBlockLoaded(te.getPos(), false)) { GlStateManager.pushMatrix(); GlStateManager.translate(x + .5, y + .3125, z + .5); GlStateManager.scale(.75f, .75f, .75f); ClientUtils.bindAtlas(); switch (te.facing) { case NORTH: GlStateManager.rotate(180, 0, 1, 0); break; case SOUTH: break; case WEST: GlStateManager.rotate(-90, 0, 1, 0); break; case EAST: GlStateManager.rotate(90, 0, 1, 0); break; } if (te.inventory[0] != null) { GlStateManager.pushMatrix(); float scale = .625f; GlStateManager.scale(scale, scale, 1); ClientUtils.mc() .getRenderItem() .renderItem(te.inventory[0], ItemCameraTransforms.TransformType.FIXED); GlStateManager.popMatrix(); // if(!RenderManager.instance.options.fancyGraphics && // MinecraftForgeClient.getItemRenderer(te.inventory, ItemRenderType.ENTITY)==null) // { // float rot = te.facing==3?180: te.facing==4?-90: te.facing==5?90: 0; // GL11.glRotatef(rot - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); // } // EntityItem entityitem = new EntityItem(te.getWorld(), 0.0D, 0.0D, 0.0D, te.inventory); // entityitem.hoverStart = 0.0F; // RenderItem.renderInFrame = true; // RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, // 0.0F); // RenderItem.renderInFrame = false; } GlStateManager.popMatrix(); } }
public static void dispatch() { Profiler profiler = ClientUtils.mc().mcProfiler; profiler.startSection(ImmersiveEngineering.MODID + "-particles"); boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); for (String key : EntityFXIEBase.queuedRenders.keySet()) { profiler.endStartSection(key); int i = 0; ClientUtils.tes().startDrawingQuads(); for (EntityFXIEBase particle : EntityFXIEBase.queuedRenders.get(key)) { if ((i++) == 0) ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture()); particle.tessellateFromQueue(ClientUtils.tes()); } ClientUtils.tes().draw(); } EntityFXIEBase.queuedRenders.clear(); profiler.startSection("depthIgnoring"); GL11.glDisable(GL11.GL_DEPTH_TEST); for (String key : EntityFXIEBase.queuedDepthIgnoringRenders.keySet()) { profiler.endStartSection(key); int i = 0; ClientUtils.tes().startDrawingQuads(); for (EntityFXIEBase particle : EntityFXIEBase.queuedDepthIgnoringRenders.get(key)) { if ((i++) == 0) ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture()); particle.tessellateFromQueue(ClientUtils.tes()); } ClientUtils.tes().draw(); } EntityFXIEBase.queuedDepthIgnoringRenders.clear(); GL11.glEnable(GL11.GL_DEPTH_TEST); profiler.endSection(); if (!isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); profiler.endSection(); }
public ModelItemDynamicOverride( IBakedModel itemModel, @Nullable List<ResourceLocation> textures) { this.itemModel = itemModel; if (textures != null) { ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); Optional<TRSRTransformation> transform = Optional.of(TRSRTransformation.identity()); for (int i = 0; i < textures.size(); i++) builder.addAll( ItemLayerModel.getQuadsForSprite( i, ClientUtils.getSprite(textures.get(i)), DefaultVertexFormats.ITEM, transform)); quads = builder.build(); } }
@Override protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); ClientUtils.bindTexture("immersiveengineering:textures/gui/blastFurnace.png"); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if (tile.lastBurnTime > 0) { int h = (int) (12 * (tile.burnTime / (float) tile.lastBurnTime)); this.drawTexturedModalRect(guiLeft + 56, guiTop + 37 + 12 - h, 179, 1 + 12 - h, 9, h); } if (tile.processMax > 0) { int w = (int) (22 * ((tile.processMax - tile.process) / (float) tile.processMax)); this.drawTexturedModalRect(guiLeft + 76, guiTop + 35, 177, 14, w, 16); } }
@Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { GL11.glPushMatrix(); try { if (metadata == BlockMetalDecoration.META_fence) { GL11.glTranslatef(-.5f, -.5f, -.5f); renderer.setRenderBounds(0, 0, .375, .25, 1, .625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(.75, 0, .375, 1, 1, .625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(-.125, .8125, .4375, 1.125, .9375, .5625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(-.125, .3125, .4375, 1.125, .4375, .5625); ClientUtils.drawInventoryBlock(block, metadata, renderer); GL11.glTranslatef(.5f, .5f, .5f); } else if (metadata == BlockMetalDecoration.META_scaffolding) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); ClientUtils.drawInventoryBlock(block, metadata, renderer); } else if (metadata == BlockMetalDecoration.META_lantern) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityLantern()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDecoration.META_structuralArm) { Tessellator tes = ClientUtils.tes(); IIcon iSide = block.getIcon(2, 3); IIcon iTop = block.getIcon(0, 3); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tes.startDrawing(6); tes.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0, 0, 0, iTop); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 1.0F, 0.0F); tes.setBrightness(0xff); tes.addVertexWithUV(1, 1, 1, iTop.getMaxU(), iTop.getMaxV()); tes.addVertexWithUV(1, 1, 0, iTop.getMaxU(), iTop.getMinV()); tes.addVertexWithUV(0, 0, 0, iTop.getMinU(), iTop.getMinV()); tes.addVertexWithUV(0, 0, 1, iTop.getMinU(), iTop.getMaxV()); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 0.0F, -1.0F); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(1, 1, 0, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 0, 0, iSide.getMaxU(), iSide.getMinV()); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 0.0F, 1.0F); tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getMinV()); tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(-1.0F, 0.0F, 0.0F); tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(1.0F, 0.0F, 0.0F); tes.addVertexWithUV(1, 1, 0, iSide.getMinU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.addVertexWithUV(1, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.draw(); } else if (metadata == BlockMetalDecoration.META_connectorStructural) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityConnectorStructural()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDecoration.META_wallMount) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityWallmountMetal()); Tessellator.instance.draw(); } else { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); ClientUtils.drawInventoryBlock(block, metadata, renderer); } } catch (Exception e) { e.printStackTrace(); } GL11.glPopMatrix(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_fence) { renderer.setRenderBounds(.375, 0, .375, .625, 1, .625); renderer.renderStandardBlock(block, x, y, z); BlockMetalDecoration md = (BlockMetalDecoration) block; if (md.canConnectFenceTo(world, x + 1, y, z)) { renderer.setRenderBounds(.625, .375, .4375, 1, .5625, .5625); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.625, .75, .4375, 1, .9375, .5625); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x - 1, y, z)) { renderer.setRenderBounds(0, .375, .4375, .375, .5625, .5625); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0, .75, .4375, .375, .9375, .5625); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x, y, z + 1)) { renderer.setRenderBounds(.4375, .375, .625, .5625, .5625, 1); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.4375, .75, .625, .5625, .9375, 1); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x, y, z - 1)) { renderer.setRenderBounds(.4375, .375, 0, .5625, .5625, .375); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.4375, .75, 0, .5625, .9375, .375); renderer.renderStandardBlock(block, x, y, z); } return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_scaffolding) { renderer.setRenderBoundsFromBlock(block); float f = .015625f; float f1 = 0; renderer.renderFromInside = true; renderer.renderMinX += block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1; renderer.renderMinY += block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1; renderer.renderMinZ += block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1; renderer.renderMaxX -= block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1; renderer.renderMaxY -= block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1; renderer.renderMaxZ -= block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1; renderer.renderStandardBlock(block, x, y, z); renderer.renderMinX -= block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1; renderer.renderMinY -= block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1; renderer.renderMinZ -= block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1; renderer.renderMaxX += block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1; renderer.renderMaxY += block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1; renderer.renderMaxZ += block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1; renderer.renderFromInside = false; return renderer.renderStandardBlock(block, x, y, z); } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_lantern) // { // if(world.isAirBlock(x,y-1,z)&&!world.isAirBlock(x,y+1,z)) // { // renderer.uvRotateWest = 3; // renderer.uvRotateEast = 3; // renderer.uvRotateNorth = 3; // renderer.uvRotateSouth = 3; // renderer.setRenderBounds(.3125f,.875f,.3125f, .6875f,1,.6875f); // renderer.renderStandardBlock(block, x, y, z); // renderer.setRenderBounds(.25f,.1875f,.25f, .75f,.875f,.75f); // renderer.renderStandardBlock(block, x, y, z); // renderer.uvRotateWest = 0; // renderer.uvRotateEast = 0; // renderer.uvRotateNorth = 0; // renderer.uvRotateSouth = 0; // } // else // { // renderer.setRenderBounds(.3125f,0,.3125f, .6875f,.125f,.6875f); // renderer.renderStandardBlock(block, x, y, z); // renderer.setRenderBounds(.25f,.125f,.25f, .75f,.8125f,.75f); // renderer.renderStandardBlock(block, x, y, z); // } // return true; // } { TileEntityLantern tile = (TileEntityLantern) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_structuralArm) { Tessellator tes = ClientUtils.tes(); IIcon iSide = block.getIcon(2, 3); IIcon iTop = block.getIcon(0, 3); int f = (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm) ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).facing : 0; boolean inv = (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm) ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).inverted : false; ForgeDirection fd = ForgeDirection.getOrientation(f); int rowTop = 0; while (rowTop < 8) { if (world.getTileEntity(x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)) instanceof TileEntityStructuralArm && ((TileEntityStructuralArm) world.getTileEntity( x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))) .facing == f && ((TileEntityStructuralArm) world.getTileEntity( x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))) .inverted == inv) rowTop++; else break; } int rowBot = 0; while (rowBot < 8) { if (world.getTileEntity(x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)) instanceof TileEntityStructuralArm && ((TileEntityStructuralArm) world.getTileEntity( x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))) .facing == f && ((TileEntityStructuralArm) world.getTileEntity( x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))) .inverted == inv) rowBot++; else break; } double rowTotal = rowTop + rowBot + 1; double yTop = 1 - rowTop / rowTotal; double yBot = rowBot / rowTotal; double d3 = iTop.getInterpolatedU(0); double d4 = iTop.getInterpolatedU(16); double d5 = iTop.getInterpolatedV(0); double d6 = iTop.getInterpolatedV(16); double d7 = d4; double d8 = d3; double d9 = d5; double d10 = d6; double y11 = f == 5 || f == 3 ? yBot : yTop; double y10 = f == 5 || f == 2 ? yBot : yTop; double y00 = f == 4 || f == 2 ? yBot : yTop; double y01 = f == 4 || f == 3 ? yBot : yTop; // SIDE 0 ClientUtils.BlockLightingInfo info = ClientUtils.calculateBlockLighting(0, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0), z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0), z + 0, d3, d5); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0), z + 0, d7, d9); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0), z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0) + .0001, z + 0, d3, d5); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0) + .0001, z + 1, d8, d10); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0) + .0001, z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0) + .0001, z + 0, d7, d9); // SIDE 1 info = ClientUtils.calculateBlockLighting(1, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11), z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10), z + 0, d7, d9); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00), z + 0, d3, d5); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01), z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10) - .0001, z + 0, d7, d9); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11) - .0001, z + 1, d4, d6); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01) - .0001, z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00) - .0001, z + 0, d3, d5); // SIDE 2 info = ClientUtils.calculateBlockLighting(2, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMaxU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0 + .0001, iSide.getMaxU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0 + .0001, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 0, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMaxU(), iSide.getMinV()); // SIDE 3 info = ClientUtils.calculateBlockLighting(3, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMinU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1 - .0001, iSide.getMinU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1 - .0001, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMaxU(), iSide.getMinV()); // SIDE 4 info = ClientUtils.calculateBlockLighting(4, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); // SIDE 5 info = ClientUtils.calculateBlockLighting(5, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y10 * 16)); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_connectorStructural) { TileEntityConnectorStructural tile = (TileEntityConnectorStructural) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_wallMount) { TileEntityWallmountMetal tile = (TileEntityWallmountMetal) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else { renderer.setRenderBounds(0, 0, 0, 1, 1, 1); return renderer.renderStandardBlock(block, x, y, z); } }
@Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { GL11.glPushMatrix(); try { if (metadata == BlockMetalDevices2.META_breakerSwitch) { GL11.glTranslatef(-1f, -.75f, .25f); GL11.glScalef(1.25f, 1.25f, 1.25f); GL11.glRotatef(-90, 1, 0, 0); Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityBreakerSwitch()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_energyMeter) { GL11.glScalef(.75f, .75f, .75f); GL11.glTranslatef(0, .625f, 0); Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityEnergyMeter()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_electricLantern) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityElectricLantern()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_floodlight) { Tessellator.instance.startDrawingQuads(); TileEntityFloodlight tile = new TileEntityFloodlight(); TileEntitySpecialRenderer tesr = TileEntityRendererDispatcher.instance.getSpecialRenderer(tile); if (tesr instanceof TileRenderFloodlight) ((TileRenderFloodlight) tesr) .model.render( tile, Tessellator.instance, new Matrix4().translate(0, .125, 0), new Matrix4().rotate(Math.PI, 0, 1, 0), 0, false); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_fluidPipe) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityFluidPipe()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_fluidPump) { GL11.glPushMatrix(); GL11.glScalef(0.65f, 0.65f, 0.65f); GL11.glTranslatef(0, -0.5f, 0); IEContent.blockMetalDevice2.setBlockBounds(0, 0, 0, 1, 1, 1); renderer.setRenderBoundsFromBlock(IEContent.blockMetalDevice2); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos( IEContent.blockMetalDevice2, 0, 0, 0, IEContent.blockMetalDevice2.getIcon(0, BlockMetalDevices2.META_fluidPump)); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg( IEContent.blockMetalDevice2, 0, 0, 0, IEContent.blockMetalDevice2.getIcon(2, BlockMetalDevices2.META_fluidPump)); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos( IEContent.blockMetalDevice2, 0, 0, 0, IEContent.blockMetalDevice2.getIcon(1, BlockMetalDevices2.META_fluidPump)); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg( IEContent.blockMetalDevice2, 0, 0, 0, IEContent.blockMetalDevice2.getIcon(0, BlockMetalDevices2.META_fluidPump)); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(0.0F, -1.0f, 0.0F); renderer.renderFaceYNeg( IEContent.blockMetalDevice2, 0, 0, 0, IEContent.blockMetalDevice2.getIcon(3, BlockMetalDevices2.META_fluidPump)); Tessellator.instance.draw(); Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityFluidPump()); Tessellator.instance.draw(); GL11.glPopMatrix(); } else if (metadata == BlockMetalDevices2.META_barrel) { renderer.setRenderBounds(0, 0, 0, 1, 1, 1); ClientUtils.drawInventoryBlock(block, metadata, renderer); } else if (metadata == BlockMetalDevices2.META_capacitorCreative) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); ClientUtils.drawInventoryBlock(block, metadata, renderer); } else if (metadata == BlockMetalDevices2.META_redstoneBreaker) { GL11.glTranslatef(-.5f, -.5f, -.5f); Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityRedstoneBreaker()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDevices2.META_chargingStation) { Tessellator.instance.startDrawingQuads(); TileEntityChargingStation tile = new TileEntityChargingStation(); GL11.glRotatef(-180, 0, 1, 0); GL11.glTranslatef(-.5f, -.5f, -.5f); renderPass = 0; ClientUtils.handleStaticTileRenderer(tile); renderPass = 1; ClientUtils.handleStaticTileRenderer(tile); Tessellator.instance.draw(); } } catch (Exception e) { e.printStackTrace(); } GL11.glPopMatrix(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int metadata = world.getBlockMetadata(x, y, z); if (renderPass == 0 || metadata == BlockMetalDevices2.META_floodlight || metadata == BlockMetalDevices2.META_chargingStation) if (metadata == BlockMetalDevices2.META_breakerSwitch) { TileEntityBreakerSwitch tile = (TileEntityBreakerSwitch) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); ClientUtils.renderAttachedConnections(tile); return true; } else if (metadata == BlockMetalDevices2.META_skycrateDispenser) { renderer.setRenderBounds(0, 0, 0, 1, 1, 1); return renderer.renderStandardBlock(block, x, y, z); } else if (metadata == BlockMetalDevices2.META_energyMeter) { TileEntityEnergyMeter tile = (TileEntityEnergyMeter) world.getTileEntity(x, y, z); if (!tile.dummy) { ClientUtils.handleStaticTileRenderer(tile); ClientUtils.renderAttachedConnections(tile); return true; } } else if (metadata == BlockMetalDevices2.META_electricLantern) { TileEntityElectricLantern tile = (TileEntityElectricLantern) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); ClientUtils.renderAttachedConnections(tile); return true; } else if (metadata == BlockMetalDevices2.META_floodlight) { TileEntityFloodlight tile = (TileEntityFloodlight) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); ClientUtils.renderAttachedConnections(tile); return true; } else if (metadata == BlockMetalDevices2.META_fluidPipe) { TileEntityFluidPipe tile = (TileEntityFluidPipe) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); if (tile.scaffoldCovering != null) { Block cover = Block.getBlockFromItem(tile.scaffoldCovering.getItem()); float f = .015625f; AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(1 - f, 1 - f, 1 - f, f, f, f) .getOffsetBoundingBox(x, y, z); ClientUtils.drawWorldBlock(world, cover, x, y, z, tile.scaffoldCovering.getItemDamage()); ClientUtils.drawWorldBlock( world, cover, x, y, z, tile.scaffoldCovering.getItemDamage(), aabb); } return true; } else if (metadata == BlockMetalDevices2.META_fluidPump) { TileEntityFluidPump tile = (TileEntityFluidPump) world.getTileEntity(x, y, z); if (!tile.dummy) { ClientUtils.handleStaticTileRenderer(tile); renderer.renderFaceXPos( IEContent.blockMetalDevice2, x, y, z, IEContent.blockMetalDevice2.getIcon( tile.sideConfig[5], BlockMetalDevices2.META_fluidPump)); renderer.renderFaceXNeg( IEContent.blockMetalDevice2, x, y, z, IEContent.blockMetalDevice2.getIcon( tile.sideConfig[4], BlockMetalDevices2.META_fluidPump)); renderer.renderFaceZPos( IEContent.blockMetalDevice2, x, y, z, IEContent.blockMetalDevice2.getIcon( tile.sideConfig[3], BlockMetalDevices2.META_fluidPump)); renderer.renderFaceZNeg( IEContent.blockMetalDevice2, x, y, z, IEContent.blockMetalDevice2.getIcon( tile.sideConfig[2], BlockMetalDevices2.META_fluidPump)); renderer.renderFaceYNeg( IEContent.blockMetalDevice2, x, y, z, IEContent.blockMetalDevice2.getIcon( 3 + tile.sideConfig[0], BlockMetalDevices2.META_fluidPump)); } return true; } else if (metadata == BlockMetalDevices2.META_barrel) { renderer.setRenderBoundsFromBlock(block); return renderer.renderStandardBlock(block, x, y, z); } else if (metadata == BlockMetalDevices2.META_capacitorCreative) { renderer.setRenderBounds(0, 0, 0, 1, 1, 1); return renderer.renderStandardBlock(block, x, y, z); } else if (metadata == BlockMetalDevices2.META_redstoneBreaker) { TileEntityRedstoneBreaker tile = (TileEntityRedstoneBreaker) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); ClientUtils.renderAttachedConnections(tile); return true; } else if (metadata == BlockMetalDevices2.META_chargingStation) { TileEntityChargingStation tile = (TileEntityChargingStation) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } return false; }