@Override public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) { if (side != null) return ImmutableList.of(); if (quads == null) { quads = buildQuads(this.state); } if (blockState instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState) blockState; if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) { IModelState newState = exState.getValue(Properties.AnimationProperty); if (newState != null) { newState = new ModelStateComposition(this.state, newState); return buildQuads(newState); } } } return quads; }
@Override public void renderTileEntityFast(TileEntityFan te, double x, double y, double z, float partialTicks, int destroyStage, float alpha, BufferBuilder renderer) { 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); IExtendedBlockState exState = ((IExtendedBlockState)state).withProperty(EvalModelState.PROPERTY, te.getTesrRenderState(partialTicks)); final IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false); renderer.setTranslation(0, 0, 0); } }
public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer) { 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()); // TODO: caching? 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); } } }
@Override public IBlockState getExtendedState(final IBlockState state, final IBlockAccess world, final BlockPos pos) { if (this.checkWorldTile(world, pos)) { final TileSolarMirror tile = this.getWorldTile(world, pos); return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, tile.state); } return state; }
@Override public IBlockState getExtendedState(final IBlockState state, final IBlockAccess world, final BlockPos pos) { if (this.checkWorldTile(world, pos)) { final TileLiquidBoiler tile = this.getWorldTile(world, pos); return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, tile.state); } return state; }
@Override public IBlockState getExtendedState(final IBlockState state, final IBlockAccess world, final BlockPos pos) { if (this.checkWorldTile(world, pos)) { final TileTank tile = this.getWorldTile(world, pos); if (tile.getTier() != 0) return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, tile.state); } return state; }
@Override public IBlockState getExtendedState(final IBlockState state, final IBlockAccess world, final BlockPos pos) { if (this.checkWorldTile(world, pos)) return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, this.getWorldTile(world, pos).state); return state; }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{BlockMultiblockBase.MULTIBLOCK_GAG, BlockMultiblockBase.FACING}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileEntitySpellWovenTable) { TileEntitySpellWovenTable te = (TileEntitySpellWovenTable) world.getTileEntity(pos); if (te.transform != TRSRTransformation.identity()) return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, te.transform); } return state; }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if(world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileRoutedPipe) { TileRoutedPipe te = (TileRoutedPipe)world.getTileEntity(pos); te.checkConnections(world, pos); ArrayList<String> check = te.checkConnections(world, pos); if(!hidden.equals(check)) { hidden.clear(); hidden.addAll(check); } return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, this.state); } return state; }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if(world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileChassisMkI) { TileChassisMkI te = (TileChassisMkI)world.getTileEntity(pos); ArrayList<String> check = te.checkConnections(world, pos); if(!hidden.equals(check)) { hidden.clear(); hidden.addAll(check); } return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, this.state); } return state; }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if(world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileBlockingPipe) { TileBlockingPipe te = (TileBlockingPipe)world.getTileEntity(pos); ArrayList<String> check = te.checkConnections(world, pos); if(!hidden.equals(check)) { hidden.clear(); hidden.addAll(check); } return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, this.state); } return state; }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { if(world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileBasicPipe) { TileBasicPipe te = (TileBasicPipe)world.getTileEntity(pos); ArrayList<String> check = te.checkConnections(world, pos); if(!hidden.equals(check)) { hidden.clear(); hidden.addAll(check); } return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, this.state); } return state; }
@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); } } } }
@Override protected BlockStateContainer createBlockState() { // 1.8.9 Hack, crashes otherwise return new ExtendedBlockState(this, new IProperty[] { getPropertyOrientation(), BlockLiquid.LEVEL, Properties.StaticProperty }, new IUnlistedProperty[] { EvalModelState.PROPERTY }); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{State.ACTIVE}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{BlockExtractor.FACING, BlockExtractor.FILTER}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
public IBlockState getGhostState(final IBlockState state, final VisibilityModelState visibilityState) { return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, visibilityState); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { Properties.AnimationProperty }); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {Properties.AnimationProperty}); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
@Override public void renderTileEntityFast(TileEntitySprinkler te, double x, double y, double z, float partialTick, int breakStage, float alpha, BufferBuilder renderer) { 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) { IExtendedBlockState exState = (IExtendedBlockState)state; if (exState.getUnlistedNames().contains(EvalModelState.PROPERTY)) { 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); exState = exState.withProperty(EvalModelState.PROPERTY, te.getRenderState()); vb.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); final IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, vb, false); vb.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); } } }
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(); } } }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { getPropertyOrientation(), ACTIVE }, new IUnlistedProperty[] { Properties.AnimationProperty }); }
public BlockSprinkler() { super(Material.WATER); setDefaultState(getDefaultState().withProperty(BlockLiquid.LEVEL, 1).withProperty(Properties.StaticProperty, true)); }
public BlockPaintMixer() { super(Material.ROCK); setDefaultState(getDefaultState().withProperty(Properties.StaticProperty, true)); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { getPropertyOrientation(), Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty, CAN_COLOR }); }
public BlockFan() { super(Material.CIRCUITS); setDefaultState(getDefaultState().withProperty(Properties.StaticProperty, true)); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { getPropertyOrientation(), Properties.StaticProperty }, new IUnlistedProperty[] { EvalModelState.PROPERTY }); }