mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-27 12:51:42 +02:00
45 lines
1.7 KiB
Java
45 lines
1.7 KiB
Java
package de.ellpeck.naturesaura.blocks;
|
|
|
|
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntitySnowCreator;
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|
import net.minecraft.block.Blocks;
|
|
import net.minecraft.tileentity.BlockEntity;
|
|
import net.minecraft.util.math.AABB;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.level.Level;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
|
|
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
|
public BlockSnowCreator() {
|
|
super("snow_creator", BlockEntitySnowCreator::new, Properties.from(Blocks.STONE_BRICKS));
|
|
}
|
|
|
|
@Override
|
|
@OnlyIn(Dist.CLIENT)
|
|
public AABB getVisualizationBounds(Level level, BlockPos pos) {
|
|
BlockEntity tile = level.getBlockEntity(pos);
|
|
if (tile instanceof BlockEntitySnowCreator) {
|
|
int radius = ((BlockEntitySnowCreator) tile).getRange();
|
|
if (radius > 0)
|
|
return new AABB(pos).grow(radius);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public int getVisualizationColor(Level level, BlockPos pos) {
|
|
return 0xdbe9ff;
|
|
}
|
|
|
|
@Override
|
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
|
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
|
generator.modLoc("block/" + this.getBaseName()),
|
|
generator.modLoc("block/" + this.getBaseName() + "_top"),
|
|
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
|
}
|
|
}
|