private static void refreshCamera() { Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); if(entity == null) return; float partialTicks = Animation.getPartialTickTime(); ICamera newCam = new Frustum(); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks; newCam.setPosition(d0, d1, d2); cameraX = d0; cameraY = d1; cameraZ = d2; camera = newCam; }
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment) { RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO, bossInfo, x, y, increment); MinecraftForge.EVENT_BUS.post(evt); return evt; }
@Override public void renderTileEntityFast(TileEntityPaintMixer te, double x, double y, double z, float partialTick, int breakStage, float alpha, BufferBuilder renderer) { if (te.hasPaint()) { if (!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) { return; } if (blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); final BlockPos pos = te.getPos(); final IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); IBlockState state = world.getBlockState(pos); if (state.getPropertyKeys().contains(Properties.StaticProperty)) { state = state.withProperty(Properties.StaticProperty, false); } if (state instanceof IExtendedBlockState) { state = state.getBlock().getExtendedState(state, world, pos); // difference between this and AnimationTESR 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); IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft()); renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false); } } } }
public void onRenderTickStart(float timer) { Animation.setClientPartialTickTime(timer); bus().post(new TickEvent.RenderTickEvent(Phase.START, timer)); }
public static void bossBarRenderPost(ScaledResolution res) { MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO)); }
private void renderProjector(TileEntityProjector projector, float partialTickTime, double x, double y, double z) { if (bakedSpinnerModel == null) return; if (!projector.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) return; if (blockModelRenderer == null) { blockModelRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer(); } final BlockPos pos = projector.getPos(); final IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(projector.getWorld(), pos); final IBlockState state = world.getBlockState(pos); if (state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState)state; if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vb = tessellator.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.disableCull(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); float time = Animation.getWorldTime(getWorld(), partialTickTime); final Pair<IModelState, Iterable<Event>> pair = projector.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time); exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft()); vb.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); blockModelRenderer.renderModel(world, bakedSpinnerModel, exState, pos, vb, false); vb.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); } } }
private void updateLastChangeTime() { lastChange.setValue(Animation.getWorldTime(getWorld(), Animation.getPartialTickTime())); }