Begin adding working screen to TVs

This commit is contained in:
Andrew-71 2023-08-07 23:03:27 +03:00
parent 8033255f7d
commit 497ae9149b
5 changed files with 86 additions and 12 deletions

View file

@ -1,7 +1,7 @@
package su.a71.new_soviet.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
@ -12,10 +12,11 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import su.a71.new_soviet.entity.TVBlockEntity;
public class TVBlock extends HorizontalFacingBlock {
public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvider {
public TVBlock(AbstractBlock.Settings settings) {
super(settings.sounds(BlockSoundGroup.METAL).pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f));
super(settings.sounds(BlockSoundGroup.METAL).pistonBehavior(PistonBehavior.BLOCK).strength(1f, 2f));
setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH));
}
@ -38,4 +39,9 @@ public class TVBlock extends HorizontalFacingBlock {
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite());
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new TVBlockEntity(pos, state);
}
}