mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-28 13:19:09 +02:00
59 lines
2.3 KiB
Java
59 lines
2.3 KiB
Java
package de.ellpeck.naturesaura.blocks;
|
|
|
|
import de.ellpeck.naturesaura.Helper;
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
|
|
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
|
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.entity.player.Player;
|
|
import net.minecraft.world.level.BlockGetter;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraft.world.phys.BlockHitResult;
|
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
|
import net.minecraft.world.phys.shapes.Shapes;
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider<BlockEntityNatureAltar>, ICustomBlockState {
|
|
|
|
private static final VoxelShape SHAPE = Shapes.create(0, 0, 0, 1, 12 / 16F, 1);
|
|
|
|
public BlockNatureAltar() {
|
|
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of().strength(4F));
|
|
}
|
|
|
|
@Override
|
|
protected boolean hasWaterlogging() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
@SuppressWarnings("deprecation")
|
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
|
return BlockNatureAltar.SHAPE;
|
|
}
|
|
|
|
@Override
|
|
@SuppressWarnings("deprecation")
|
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
|
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
|
}
|
|
|
|
@Override
|
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
|
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
|
|
}
|
|
|
|
@Override
|
|
public void registerTESR() {
|
|
BlockEntityRenderers.register(ModBlockEntities.NATURE_ALTAR, RenderNatureAltar::new);
|
|
}
|
|
}
|