public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { int i; if (tileentity.getWorldObj() == null) { i = 0; } else { Block block = tileentity.getBlockType(); i = tileentity.getBlockMetadata(); if ((block != null) && (i == 0)) { i = tileentity.getBlockMetadata(); } } GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glPushMatrix(); GL11.glRotatef(180.0F, 180.0F, 0.0F, 0.0F); int j = 0; if (i == 3) { j = 0; } if (i == 2) { j = 180; } if (i == 4) { j = 90; } if (i == 5) { j = 270; } GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); }
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { int rotation = 180; switch (te.getBlockMetadata() % 4) { case 0: rotation = 0; break; case 3: rotation = 90; break; case 2: rotation = 180; break; case 1: rotation = 270; break; } GL11.glPushMatrix(); int i = te.getBlockMetadata(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); Minecraft.getMinecraft() .renderEngine .bindTexture(new ResourceLocation("Ported_Blocks:textures/texturemaps/Sail_HD.png")); GL11.glScalef(1.0F, -1F, -1F); model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
@Override @SideOnly(Side.CLIENT) public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { AbstractPowerExpander expander = (AbstractPowerExpander) te; ResourceLocation textures = (new ResourceLocation(ModInfo.ID + ":textures/blocks/expanderPowerTierFour.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); int rotation = 0; if (te.getWorldObj() != null) { rotation = te.getBlockMetadata(); } GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); model.expander.rotateAngleX = expander.baseFitRotationX; model.expander.rotateAngleY = expander.baseFitRotationZ; model.renderAll(); GL11.glPopMatrix(); }
@Override public void updateEntity() { ItemStack jar = getStackInSlot(0); if (!worldObj.isRemote && jar != null && jar.getItem() instanceof ItemJarFilled) { ItemJarFilled item = (ItemJarFilled) jar.getItem(); AspectList aspectList = item.getAspects(jar); if (aspectList != null && aspectList.size() == 1) { Aspect aspect = aspectList.getAspects()[0]; TileEntity tile = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord); if (tile != null && tile instanceof TileEntityHopper) { TileEntity tile1 = getHopperFacing(tile.xCoord, tile.yCoord, tile.zCoord, tile.getBlockMetadata()); if (tile1 instanceof TileJarFillable) { TileJarFillable jar1 = (TileJarFillable) tile1; AspectList aspectList1 = jar1.getAspects(); if (aspectList1 != null && aspectList1.size() == 0 || aspectList1.getAspects()[0] == aspect && aspectList1.getAmount(aspectList1.getAspects()[0]) < 64) { jar1.addToContainer(aspect, 1); item.setAspects(jar, aspectList.remove(aspect, 1)); } } } } } }
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); switch (tileentity.getBlockMetadata()) { case 5: GL11.glRotatef(90, 0F, 1F, 0F); break; case 3: GL11.glRotatef(180, 0F, 1F, 0F); break; case 4: GL11.glRotatef(270, 0F, 1F, 0F); break; case 2: GL11.glRotatef(0, 0F, 1F, 0F); break; } this.bindTexture(texture); GL11.glPushMatrix(); this.model.renderModel(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); }
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float s) { GL11.glPushMatrix(); this.bindTexture(mainTexture); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180, 0.0F, 0.0F, 1.0F); model.render(null, tile.getBlockMetadata() % 2, 0, 0, 0, 0, 0.0625F); GL11.glPopMatrix(); }
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float delta) { int metadata = 0; if (tileEntity.hasWorldObj()) { metadata = tileEntity.getBlockMetadata(); } GL11.glPushMatrix(); boolean oldRescaleNormal = GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL); if (oldRescaleNormal) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); } GL11.glColor4f(1f, 1f, 1f, 1f); GL11.glTranslatef((float) x, (float) y + 1f, (float) z); GL11.glTranslatef(0.5f, 0.5f, 0.5f); float angle; switch (ForgeDirection.getOrientation(metadata)) { case NORTH: angle = 0; break; case EAST: angle = -90; break; case SOUTH: angle = 180; break; case WEST: angle = 90; break; default: angle = -90; } GL11.glRotatef(angle, 0f, 1f, 0f); GL11.glRotatef(180f, 0f, 0f, 1f); bindTexture(texture); model.renderAll(); if (!oldRescaleNormal) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); } GL11.glPopMatrix(); GL11.glColor4f(1f, 1f, 1f, 1f); TileEntityCookingTable tileEntityTable = (TileEntityCookingTable) tileEntity; if (tileEntityTable.hasNoFilterBook()) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5f, (float) y + 0.9f, (float) z + 0.5f); GL11.glRotatef(angle, 0f, 1f, 0f); GL11.glTranslatef(0f, 0f, -0.2f); GL11.glRotatef(90f, 1f, 0f, 0f); RenderManager.instance.renderEntityWithPosYaw( tileEntityTable.getRenderItem(), 0, 0, 0, 0f, 0f); GL11.glPopMatrix(); } }
public void renderTileEntityAt( TileEntity var1, double var2, double var4, double var6, float var8) { TileColorable tile = (TileColorable) var1; GL11.glDisable('\u803a'); GL11.glPushMatrix(); GL11.glTranslatef((float) var2 + 0.5F, (float) var4 + 1.5F, (float) var6 + 0.5F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef((float) (90 * tile.rotation), 0.0F, 1.0F, 0.0F); GL11.glColor3f(1.0F, 1.0F, 1.0F); this.setWoodTexture(var1.getBlockMetadata()); this.model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
public static void check(TileEntity te) { for (SegmentTileEntity segment : segmentsTile.get(te.getClass())) { if (!segment.shouldExist(te)) { ItemStack itemStack = new ItemStack(te.getBlockType(), 1, te.getBlockMetadata()); NBTTagCompound nbt = new NBTTagCompound(); te.writeToNBT(nbt); itemStack.setTagCompound(nbt); WorldUtils.dropAsEntity(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, itemStack); te.getWorldObj().setBlock(te.xCoord, te.yCoord, te.zCoord, Blocks.air); te.invalidate(); MyTown.instance.LOG.info("TileEntity {} was ATOMICALLY DISINTEGRATED!", te.toString()); return; } } }
@Override public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8) { IModelCustom model = APClientProps.MDL_MAGNET_MODULE; int meta = var1.getBlockMetadata(); GL11.glPushMatrix(); { RenderUtils.loadTexture(APClientProps.TEX_MDL_MAGNET_MODULE); GL11.glTranslated(x, y, z); float scale = 0.0036F; GL11.glTranslatef(0.5F, 0.0F, 0.5F); GL11.glRotatef(rotations[meta], 0F, -1F, 0F); GL11.glScalef(scale, scale, scale); model.renderAll(); } GL11.glPopMatrix(); }
public void renderTileEntityAt( TileEntity var1, double var2, double var4, double var6, float var8) { TileTallLamp tile = (TileTallLamp) var1; GL11.glDisable('\u803a'); GL11.glPushMatrix(); GL11.glTranslatef((float) var2 + 0.5F, (float) var4 + 1.5F, (float) var6 + 0.5F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef((float) (90 * tile.rotation), 0.0F, 1.0F, 0.0F); GL11.glColor3f(1.0F, 1.0F, 1.0F); setMaterialTexture(var1.getBlockMetadata()); this.model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); this.bindTexture(resourceTop); float[] color = BlockRendererInterface.colorTable[tile.color]; GL11.glColor3f(color[0], color[1], color[2]); this.top.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
@Override public void renderDynamic(TileEntity tile, double x, double y, double z, float f) { super.renderDynamic(tile, x, y, z, f); if (tile instanceof TileRedstoneWireConnector) { GL11.glPushMatrix(); int hex = ItemDye.field_150922_c[15 - ((TileRedstoneWireConnector) tile).redstoneChannel]; int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = (hex & 0xFF); GL11.glColor3f(r / 255f, g / 255f, b / 255f); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); if (tile.hasWorldObj()) { switch (tile.getBlockMetadata()) { case 0: break; case 1: GL11.glRotatef(180, 0, 0, 1); break; case 2: GL11.glRotatef(90, 1, 0, 0); break; case 3: GL11.glRotatef(-90, 1, 0, 0); break; case 4: GL11.glRotatef(-90, 0, 0, 1); break; case 5: GL11.glRotatef(90, 0, 0, 1); break; } } Minecraft.getMinecraft().renderEngine.bindTexture(channelTexture); modelChannel.renderAll(); GL11.glPopMatrix(); } }
@Override public void renderTileEntityAt( TileEntity tile, double par2, double par4, double par6, float par8) { if (this.doRenderModel((RotaryCraftTileEntity) tile)) this.renderTileEntityDisplayAt((TileEntityDisplay) tile, par2, par4, par6, par8); if (((RotaryCraftTileEntity) tile).isInWorld() && MinecraftForgeClient.getRenderPass() == 1) { if (((TileEntityDisplay) tile).canDisplay() && ((TileEntityDisplay) tile).hasSpace()) { ((TileEntityDisplay) tile).loadColorData(); int dir = 0; int dx = 0; int dz = 0; switch (tile.getBlockMetadata()) { case 0: dir = 270; dx = 1; break; case 1: dir = 90; dz = 1; break; case 2: dir = 180; dz = 1; dx = 1; break; case 3: dir = 0; break; } GL11.glPushMatrix(); GL11.glTranslated(par2, par4, par6); GL11.glTranslated(dx, 0, dz); GL11.glRotatef(dir, 0, 1, 0); this.renderScreen((TileEntityDisplay) tile, par2, par4, par6); this.renderText((TileEntityDisplay) tile, par2, par4, par6); GL11.glRotatef(-dir, 0, 1, 0); GL11.glTranslated(-dx, 0, -dz); GL11.glPopMatrix(); } } }
public void renderTileEntityAt( TileEntity var1, double var2, double var4, double var6, float var8) { TileCouchWood tile = (TileCouchWood) var1; GL11.glDisable('\u803a'); GL11.glPushMatrix(); GL11.glTranslatef((float) var2 + 0.5F, (float) var4 + 1.5F, (float) var6 + 0.5F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef((float) (90 * tile.rotation), 0.0F, 1.0F, 0.0F); GL11.glColor3f(1.0F, 1.0F, 1.0F); this.setWoodTexture(var1.getBlockMetadata()); if (tile.hasLeft && tile.hasRight) { this.model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); } else if (tile.hasLeft) { this.modelLeft.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); } else if (tile.hasRight) { this.modelRight.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); } else { this.modelCorner.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); } GL11.glPopMatrix(); }
@Override public void renderStatic( TileEntity tile, Tessellator tes, Matrix4 translationMatrix, Matrix4 rotationMatrix) { translationMatrix.translate(.5, .5, .5); if (tile.hasWorldObj()) { switch (tile.getBlockMetadata()) { case 0: break; case 1: rotationMatrix.rotate(Math.toRadians(180), 0, 0, 1); break; case 2: rotationMatrix.rotate(Math.toRadians(90), 1, 0, 0); break; case 3: rotationMatrix.rotate(Math.toRadians(-90), 1, 0, 0); break; case 4: rotationMatrix.rotate(Math.toRadians(-90), 0, 0, 1); break; case 5: rotationMatrix.rotate(Math.toRadians(90), 0, 0, 1); break; } } if (tile.hasWorldObj()) { if (tile instanceof TileRedstoneWireConnector && ((TileRedstoneWireConnector) tile).isInput()) { modelInput.render(tile, tes, translationMatrix, rotationMatrix, 0, false, "connectorMV"); } else { modelOutput.render(tile, tes, translationMatrix, rotationMatrix, 0, false, "connectorMV"); } } else { modelOutput.render(tile, tes, translationMatrix, rotationMatrix, 0, false); } }
public boolean getMutliBlock() { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { TileEntity tileEntity = worldObj.getTileEntity( xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); if (tileEntity instanceof TileMachineCasing) { if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { int heat; heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata()); Location location = new Location(xCoord, yCoord, zCoord, direction); location.modifyPositionFromSide(direction, 1); if (worldObj .getBlock(location.getX(), location.getY(), location.getZ()) .getUnlocalizedName() .equals("tile.lava")) { heat += 500; } return true; } } } return false; }
protected void renderCompletionLevel( TileEntity tile, String par2Str, double par3, double par5, double par7, int par9, boolean par10, int par11) { int j = 0; int i = tile.getBlockMetadata(); if (i == 0) { j = 0; } if (i == 1) { j = 90; } if (i == 2) { j = 180; } if (i == 3) { j = 270; } FontRenderer var12 = this.getFontRenderer(); float var13 = 1.6F; float var14 = 0.0116666668F * var13; GL11.glPushMatrix(); if (i == 0) GL11.glTranslatef((float) par3 + 0.60F, (float) par5 + 1.1F, (float) par7 + 1.41F); if (i == 1) GL11.glTranslatef((float) par3 + 1.51F, (float) par5 + 1.1F, (float) par7 + 0.50F); if (i == 2) GL11.glTranslatef((float) par3 + 0.60F, (float) par5 + 1.1F, (float) par7 - 0.41F); if (i == 3) GL11.glTranslatef((float) par3 - 0.31F, (float) par5 + 1.1F, (float) par7 + 0.51F); GL11.glRotatef(j + 180, 0.0F, 1.0F, 0.0F); GL11.glNormal3f(0.0F, 1.0F, 0.0F); if (!par10) { GL11.glScalef(-var14, -var14, var14); } else { GL11.glScalef(-var14 + 0.012f, -var14 + 0.012f, var14 + 0.012f); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator var15 = Tessellator.instance; byte var16 = 0; GL11.glDisable(GL11.GL_TEXTURE_2D); int var17 = var12.getStringWidth(par2Str) / 2; GL11.glEnable(GL11.GL_TEXTURE_2D); var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, par11); var15.startDrawingQuads(); var15.addVertex((double) (-var17 - 1), (double) (-1 + var16), 0.0D); var15.addVertex((double) (-var17 - 1), (double) (8 + var16), 0.0D); var15.addVertex((double) (var17 + 1), (double) (8 + var16), 0.0D); var15.addVertex((double) (var17 + 1), (double) (-1 + var16), 0.0D); var15.draw(); var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, par11); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
private void renderItem(TileEntity tile, double par2, double par4, double par6) { TileEntityFillingStation fs = (TileEntityFillingStation) tile; if (!fs.isInWorld()) return; ItemStack is = fs.getItemForRender(); if (is == null) return; double in = 0.125; double xoff = 0; double zoff = 0; float var11 = 0; switch (tile.getBlockMetadata()) { case 0: var11 = 180; break; case 1: var11 = 0; xoff = 1; zoff = -1; break; case 2: var11 = 270; in = -in; break; case 3: var11 = 90; xoff = 1; zoff = 1; in = -in; break; } GL11.glTranslated(par2, par4, par6); GL11.glRotatef(var11 - 90, 0.0F, 1.0F, 0.0F); GL11.glTranslated(xoff, 0, zoff); Tessellator v5 = Tessellator.instance; v5.startDrawingQuads(); Item item = is.getItem(); IItemRenderer iir = MinecraftForgeClient.getItemRenderer(is, ItemRenderType.INVENTORY); if (item instanceof IndexedItemSprites && !(item instanceof ItemBlockPlacer)) { IndexedItemSprites iis = (IndexedItemSprites) item; ReikaTextureHelper.bindTexture(iis.getTextureReferenceClass(), iis.getTexture(is)); int index = iis.getItemSpriteIndex(is); int row = index / 16; int col = index % 16; float u = col / 16F; float v = row / 16F; float du = u + 0.0625F; float dv = v + 0.0625F; v5.addVertexWithUV(0, 0, in, u, dv); v5.addVertexWithUV(-1, 0, in, du, dv); v5.addVertexWithUV(-1, 1, in, du, v); v5.addVertexWithUV(0, 1, in, u, v); } else if (iir != null) {; // iir.renderItem(ItemRenderType.INVENTORY, is, new RenderBlocks()); } else { if (ReikaItemHelper.isBlock(is)) ReikaTextureHelper.bindTerrainTexture(); else ReikaTextureHelper.bindItemTexture(); IIcon ico = item.getIcon(is, MinecraftForgeClient.getRenderPass()); float u = ico.getMinU(); float v = ico.getMinV(); float du = ico.getMaxU(); float dv = ico.getMaxV(); v5.addVertexWithUV(0, 0, in, u, dv); v5.addVertexWithUV(-1, 0, in, du, dv); v5.addVertexWithUV(-1, 1, in, du, v); v5.addVertexWithUV(0, 1, in, u, v); } v5.draw(); GL11.glTranslated(-xoff, 0, -zoff); GL11.glRotatef(-var11 + 90, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-par2, -par4, -par6); }
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) { int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata(); int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90; TileRepairer repairer = (TileRepairer) tileentity; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bindTexture(modelTex); GL11.glTranslatef(0F, 2F, 1F); GL11.glScalef(1F, -1F, -1F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(rotation, 0F, 1F, 0F); model.render(); GL11.glDisable(GL11.GL_BLEND); GL11.glScalef(1F, -1F, -1F); ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0); if (item != null) { GL11.glPushMatrix(); final float scale = 0.5F; GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, (float) (-2.5F + Math.sin(repairer.ticksExisted / 10F) * 0.1F), 0F); float deg = repairer.ticksExisted * 0.75F % 360F; GL11.glTranslatef(1F / 2F, 1F / 2F, 1F / 32F); GL11.glRotatef(deg, 0F, 1F, 0F); GL11.glTranslatef(-1F / 2F, -1F / 2F, -1F / 32F); bindTexture(TextureMap.locationItemsTexture); int renderPass = 0; do { IIcon icon = item.getItem().getIcon(item, renderPass); if (icon != null) { Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D( Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage())); GL11.glPopMatrix(); } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bindTexture(modelTex); GL11.glScalef(1F, -1F, -1F); GL11.glRotatef(rotation, 0F, 1F, 0F); model.renderGlass(); GL11.glDisable(GL11.GL_BLEND); GL11.glScalef(1F, -1F, -1F); renderOverlay( (TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff, 1.25F); GL11.glPopMatrix(); GL11.glColor4f(1F, 1F, 1F, 1F); }