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

59 lines
2.3 KiB
Java
Raw Normal View History

2018-10-14 14:27:18 +02:00
package de.ellpeck.naturesaura.blocks;
2018-10-18 13:34:37 +02:00
import de.ellpeck.naturesaura.Helper;
2021-12-04 15:40:09 +01:00
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
2021-12-19 15:32:45 +01:00
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
2020-01-29 00:40:28 +01:00
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
2021-12-15 16:24:53 +01:00
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
2021-12-04 15:40:09 +01:00
import net.minecraft.core.BlockPos;
2021-12-15 16:24:53 +01:00
import net.minecraft.world.InteractionHand;
2021-12-04 15:40:09 +01:00
import net.minecraft.world.InteractionResult;
2021-12-15 16:24:53 +01:00
import net.minecraft.world.entity.player.Player;
2021-12-04 15:40:09 +01:00
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
2021-12-15 16:24:53 +01:00
import net.minecraft.world.level.block.Block;
2021-12-04 15:40:09 +01:00
import net.minecraft.world.level.block.state.BlockState;
2021-12-15 16:24:53 +01:00
import net.minecraft.world.phys.BlockHitResult;
2021-12-04 15:40:09 +01:00
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
2018-10-14 14:27:18 +02:00
2021-12-04 15:40:09 +01:00
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider<BlockEntityNatureAltar>, ICustomBlockState {
2018-10-14 14:27:18 +02:00
2021-12-04 15:40:09 +01:00
private static final VoxelShape SHAPE = Shapes.create(0, 0, 0, 1, 12 / 16F, 1);
2020-01-23 16:05:52 +01:00
2018-10-14 14:27:18 +02:00
public BlockNatureAltar() {
2023-07-08 12:32:27 +02:00
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of().strength(4F));
2018-10-14 14:27:18 +02:00
}
@Override
protected boolean hasWaterlogging() {
return true;
}
2018-10-18 13:34:37 +02:00
@Override
2023-02-15 23:45:50 +01:00
@SuppressWarnings("deprecation")
2021-12-04 15:40:09 +01:00
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
2022-06-27 15:24:04 +02:00
return BlockNatureAltar.SHAPE;
2018-10-14 14:27:18 +02:00
}
2018-10-16 11:49:30 +02:00
@Override
2023-02-15 23:45:50 +01:00
@SuppressWarnings("deprecation")
2021-12-15 16:24:53 +01:00
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
2020-01-23 16:05:52 +01:00
return Helper.putStackOnTile(player, handIn, pos, 0, true);
}
2020-01-29 00:40:28 +01:00
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
2021-12-15 16:24:53 +01:00
}
@Override
public void registerTESR() {
2021-12-19 15:32:45 +01:00
BlockEntityRenderers.register(ModBlockEntities.NATURE_ALTAR, RenderNatureAltar::new);
2020-01-29 00:40:28 +01:00
}
2018-10-14 14:27:18 +02:00
}