package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalContainer; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class BlockAnimalContainer extends BlockContainerImpl implements IVisualizable { public BlockAnimalContainer() { super("animal_container", TileEntityAnimalContainer::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2)); } @Override @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityAnimalContainer) { int radius = ((TileEntityAnimalContainer) tile).getRadius(); if (radius > 0) return new AxisAlignedBB(pos).grow(radius); } return null; } @Override @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x42ddf5; } }