Java Code Examples for codechicken.core.ClientUtils#getRenderTime()
The following examples show how to use
codechicken.core.ClientUtils#getRenderTime() .
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: EnderChestRenderer.java From EnderStorage with MIT License | 5 votes |
public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, float lidAngle) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e); GL11.glColor4f(1, 1, 1, 1); CCRenderState.changeTexture("enderstorage:textures/enderchest.png"); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1, 1, 1, 1); GL11.glTranslated(x, y + 1.0, z + 1.0F); GL11.glScalef(1.0F, -1F, -1F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); model.chestLid.rotateAngleX = lidAngle; model.render(owned); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); renderButtons(freq, rotation, lidAngle); GL11.glPopMatrix(); double time = ClientUtils.getRenderTime() + offset; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + EnderStorageClientProxy.getPearlBob(time), z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example 2
Source File: RenderTracker.java From WirelessRedstone with MIT License | 5 votes |
@Override public void doRender(Entity entity, double x, double y, double z, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslated(x, y+0.2, z); EntityWirelessTracker tracker = (EntityWirelessTracker) entity; if(tracker.isAttachedToEntity()) { Vector3 relVec = tracker.getRotatedAttachment(); Vector3 yAxis = new Vector3(0, 1, 0); Vector3 axis = relVec.copy().crossProduct(yAxis); double angle = -(relVec.angle(yAxis)*todeg); GL11.glTranslated(-x, -y-0.2, -z);//undo translation Vector3 pos = new Vector3(tracker.attachedEntity.lastTickPosX + (tracker.attachedEntity.posX - tracker.attachedEntity.lastTickPosX)*f1, tracker.attachedEntity.lastTickPosY + (tracker.attachedEntity.posY - tracker.attachedEntity.lastTickPosY)*f1 + tracker.attachedEntity.height/2 - tracker.attachedEntity.yOffset - tracker.height, tracker.attachedEntity.lastTickPosZ + (tracker.attachedEntity.posZ - tracker.attachedEntity.lastTickPosZ)*f1); pos.add(relVec).add(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ); GL11.glTranslated(pos.x, pos.y, pos.z); GL11.glRotatef((float)angle, (float)axis.x, (float)axis.y, (float)axis.z); } else if(tracker.item) { double bob = sin(ClientUtils.getRenderTime() / 10) * 0.1; double rotate = ClientUtils.getRenderTime() / 20 * todeg; GL11.glRotatef((float) rotate, 0, 1, 0); GL11.glTranslated(0, bob + 0.2, 0); } GL11.glTranslated(0, -0.2, 0); renderTracker(tracker.freq); GL11.glPopMatrix(); }
Example 3
Source File: EnderTankRenderer.java From EnderStorage with MIT License | 4 votes |
public static void renderTank(int rotation, float valve, int freq, boolean owned, double x, double y, double z, int offset) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e); GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslated(x+0.5, y, z+0.5); GL11.glRotatef(-90*(rotation+2), 0, 1, 0); CCRenderState.changeTexture("enderstorage:textures/endertank.png"); CCRenderState.startDrawing(4); tankModel.render(); CCRenderState.draw(); CCRenderState.changeTexture("enderstorage:textures/buttons.png"); CCRenderState.startDrawing(7); for(int i = 0; i < 3; i++) { int colour = EnderStorageManager.getColourFromFreq(freq, i); buttons[i].render(new UVTranslation(0.25 * (colour % 4), 0.25 * (colour / 4))); } CCRenderState.draw(); new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)).glApply(); CCRenderState.changeTexture("enderstorage:textures/endertank.png"); CCRenderState.startDrawing(4); valveModel.render(new UVTranslation(0, owned ? 13/64D : 0)); CCRenderState.draw(); GL11.glPopMatrix(); double time = ClientUtils.getRenderTime()+offset; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(x+0.5, y+0.45+EnderStorageClientProxy.getPearlBob(time)*2, z+0.5), new Rotation(time/3, new Vector3(0, 1, 0)), 0.04); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example 4
Source File: TileChunkLoaderRenderer.java From ChickenChunks with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { CCRenderState.reset(); CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); double rot = ClientUtils.getRenderTime()*2; double height; double size; double updown = (ClientUtils.getRenderTime()%50) / 25F; updown = (float) Math.sin(updown*3.141593); updown *= 0.2; TileChunkLoaderBase chunkLoader = (TileChunkLoaderBase)tile; if(chunkLoader instanceof TileChunkLoader) { TileChunkLoader ctile = (TileChunkLoader)chunkLoader; rot /= Math.pow(ctile.radius, 0.2); height = 0.9; size = 0.08; } else if(chunkLoader instanceof TileSpotLoader) { height = 0.5; size = 0.05; } else return; RenderInfo renderInfo = chunkLoader.renderInfo; double active = (renderInfo.activationCounter)/20D; if(chunkLoader.active && renderInfo.activationCounter < 20) active += f/20D; else if(!chunkLoader.active && renderInfo.activationCounter > 0) active -= f/20D; if(renderInfo.showLasers) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); drawRays(d, d1, d2, rot, updown, tile.xCoord, tile.yCoord, tile.zCoord, chunkLoader.getChunks()); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_FOG); } rot = ClientUtils.getRenderTime()*active / 3F; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(d+0.5, d1+height+(updown + 0.3)*active, d2+0.5), new Rotation(rot, new Vector3(0, 1, 0)), size); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("chickenchunks:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }