List of usage examples for net.minecraftforge.client.model.animation Animation getWorldTime
public static float getWorldTime(World world, float tickProgress)
From source file:vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube.java
License:Open Source License
private void renderAnimatedModel(TileCorporeaCrystalCube te, double x, double y, double z, float partialTick) { // From FastTESR.renderTileEntityAt Tessellator tessellator = Tessellator.getInstance(); VertexBuffer worldRenderer = tessellator.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend();/* ww w.ja v a 2s . c om*/ GlStateManager.disableCull(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); // Inlined AnimationTESR.renderTileEntityFast if (!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) { return; } if (blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockPos pos = te.getPos(); IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); IBlockState state = world.getBlockState(pos); if (state.getPropertyNames().contains(Properties.StaticProperty)) { state = state.withProperty(Properties.StaticProperty, false); } if (state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState) state; if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) { float time = Animation.getWorldTime(getWorld(), partialTick); Pair<IModelState, Iterable<Event>> pair = te .getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time); // handleEvents(te, time, pair.getRight()); IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft()); worldRenderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, worldRenderer, false); } } // End inline AnimationTESR.renderTileEntityFast worldRenderer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }