List of usage examples for net.minecraftforge.common.model.animation CapabilityAnimation ANIMATION_CAPABILITY
Capability ANIMATION_CAPABILITY
To view the source code for net.minecraftforge.common.model.animation CapabilityAnimation ANIMATION_CAPABILITY.
Click Source Link
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();/*from w w w . ja v a2 s . c o m*/ 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(); }
From source file:vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube.java
License:Open Source License
@Override public boolean hasCapability(@Nonnull Capability<?> cap, @Nonnull EnumFacing side) { return cap == CapabilityAnimation.ANIMATION_CAPABILITY || super.hasCapability(cap, side); }
From source file:vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube.java
License:Open Source License
@Nonnull @Override/* www . j av a 2 s . co m*/ public <T> T getCapability(@Nonnull Capability<T> cap, @Nonnull EnumFacing side) { if (cap == CapabilityAnimation.ANIMATION_CAPABILITY) { return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm); } else return super.getCapability(cap, side); }