88import net .minecraft .item .ItemPlacementContext ;
99import net .minecraft .item .ItemStack ;
1010import net .minecraft .state .StateManager ;
11+ import net .minecraft .state .property .BooleanProperty ;
1112import net .minecraft .state .property .EnumProperty ;
13+ import net .minecraft .state .property .IntProperty ;
1214import net .minecraft .util .ActionResult ;
1315import net .minecraft .util .hit .BlockHitResult ;
1416import net .minecraft .util .math .BlockPos ;
1517import net .minecraft .util .math .Direction ;
18+ import net .minecraft .util .shape .VoxelShape ;
19+ import net .minecraft .world .BlockView ;
1620import net .minecraft .world .World ;
1721import org .jetbrains .annotations .Nullable ;
1822
1923public class CorpseBlock extends BlockWithEntity {
2024 public static final EnumProperty <Direction > FACING = HorizontalFacingBlock .FACING ;
21-
25+ public static final IntProperty AGE = IntProperty .of ("age" , 0 , 15 );
26+ public static final BooleanProperty SKIN_STOLEN = BooleanProperty .of ("skin_stolen" );
27+ public static final VoxelShape SHAPE = Block .createCuboidShape (0 , 0 , -8 , 16 , 4 , 24 );
2228 public static final MapCodec <CorpseBlock > CODEC = createCodec (CorpseBlock ::new );
2329
2430 public CorpseBlock (Settings settings ) {
2531 super (settings );
26- // Sets default facing state to NORTH.
27- setDefaultState (getDefaultState ().with (FACING , Direction .NORTH ));
32+ // Sets the default state for facing, age, and if skin is stolen.
33+ setDefaultState (
34+ getDefaultState ()
35+ .with (FACING , Direction .NORTH )
36+ .with (SKIN_STOLEN , false )
37+ .with (AGE , 0 )
38+ );
2839 }
2940
3041 @ Override
@@ -41,7 +52,7 @@ protected MapCodec<? extends BlockWithEntity> getCodec() {
4152 // Builds and appends the properties.
4253 @ Override
4354 protected void appendProperties (StateManager .Builder <Block , BlockState > builder ) {
44- builder .add (FACING );
55+ builder .add (FACING ). add ( AGE ). add ( SKIN_STOLEN ) ;
4556 }
4657
4758 @ Override
@@ -77,4 +88,9 @@ protected ActionResult onUse(BlockState state, World world, BlockPos pos, Player
7788 }
7889 return ActionResult .SUCCESS ;
7990 }
91+
92+ @ Override
93+ protected VoxelShape getOutlineShape (BlockState state , BlockView world , BlockPos pos , ShapeContext context ) {
94+ return SHAPE ;
95+ }
8096}
0 commit comments