seat polish

This commit is contained in:
Darto KLoning
2026-10-03 13:40:39 +07:00
parent 57ee17b56c
commit d6b3c68c1f
3 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true
org.gradle.caching=true
mod_version=4.0.12
mod_version=4.0.13
maven_group=earth.terrarium.handcrafted
archives_base_name=handcrafted
@@ -72,6 +72,21 @@ public class BenchBlock extends ModularSeatBlock {
return SEAT;
}
@Override
public double getSeatHeight(BlockState state) {
// As with chairs, only compensate for the optional cushion.
return super.getSeatHeight(state)
+ (state.getValue(COLOR) == OptionalColorProperty.NONE ? 0.0D : 0.10D);
}
@Override
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
// A backless bench has no canonical facing for the rider. Passing null
// makes Seat free-rotating, just like the standalone cushion/dining bench.
this.sitOn(level, pos, player, null);
return InteractionResult.SUCCESS;
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
@@ -88,6 +88,15 @@ public class ChairBlock extends HorizontalDirectionalBlock implements SittableBl
return SEAT;
}
@Override
public double getSeatHeight(BlockState state) {
// Keep the original chair height untouched unless an optional cushion
// is actually installed. The cushion adds visible thickness, so lift
// the rider just enough to sit on top of it instead of inside it.
return SittableBlock.super.getSeatHeight(state)
+ (state.getValue(COLOR) == OptionalColorProperty.NONE ? 0.0D : 0.10D);
}
@Override
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
InteractionResult result = InteractionUtils.interactOptionalCushion(state, level, pos, player, stack, COLOR);