NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/BlockSnowCreator.java

45 lines
1.7 KiB
Java
Raw Normal View History

2020-02-02 22:21:55 +01:00
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable;
2021-12-04 15:40:09 +01:00
import de.ellpeck.naturesaura.blocks.tiles.BlockEntitySnowCreator;
2020-02-02 23:27:40 +01:00
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
2020-02-02 22:21:55 +01:00
import net.minecraft.block.Blocks;
2021-12-04 15:40:09 +01:00
import net.minecraft.tileentity.BlockEntity;
2020-02-02 22:21:55 +01:00
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
2021-12-04 15:40:09 +01:00
import net.minecraft.level.Level;
2020-02-02 22:21:55 +01:00
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
2020-02-02 23:27:40 +01:00
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
2020-02-02 22:21:55 +01:00
public BlockSnowCreator() {
2021-12-04 15:40:09 +01:00
super("snow_creator", BlockEntitySnowCreator::new, Properties.from(Blocks.STONE_BRICKS));
2020-02-02 22:21:55 +01:00
}
@Override
@OnlyIn(Dist.CLIENT)
2021-12-04 15:40:09 +01:00
public AxisAlignedBB getVisualizationBounds(Level level, BlockPos pos) {
BlockEntity tile = level.getBlockEntity(pos);
if (tile instanceof BlockEntitySnowCreator) {
int radius = ((BlockEntitySnowCreator) tile).getRange();
2020-02-02 22:21:55 +01:00
if (radius > 0)
return new AxisAlignedBB(pos).grow(radius);
}
return null;
}
@Override
2021-12-04 15:40:09 +01:00
public int getVisualizationColor(Level level, BlockPos pos) {
2020-02-02 22:21:55 +01:00
return 0xdbe9ff;
}
2020-02-02 23:27:40 +01:00
@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")));
}
2020-02-02 22:21:55 +01:00
}