Skip to content

Commit

Permalink
fix: Fix fridge size to allow placing blocks on top #487
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed May 26, 2024
1 parent 5572433 commit 708d1f5
Show file tree
Hide file tree
Showing 39 changed files with 242 additions and 903 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

import java.util.List;
Expand All @@ -62,6 +64,9 @@ public String getSerializedName() {
public static final BooleanProperty PRESERVATION_CHAMBER = BooleanProperty.create("preservation_chamber");
public static final BooleanProperty ICE_UNIT = BooleanProperty.create("ice_unit");

private static final VoxelShape BOUNDING_BOX_X = Block.box(1, 0, 1, 15, 16, 15);
private static final VoxelShape BOUNDING_BOX_Z = Block.box(1, 0, 1, 15, 16, 15);

private final DyeColor color;

public FridgeBlock(DyeColor color, Properties properties) {
Expand All @@ -74,6 +79,15 @@ public DyeColor getColor() {
return color;
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
if (state.getValue(FACING).getAxis() == Direction.Axis.X) {
return BOUNDING_BOX_X;
} else {
return BOUNDING_BOX_Z;
}
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING, MODEL_TYPE, FLIPPED, PRESERVATION_CHAMBER, ICE_UNIT);
Expand Down
Loading

0 comments on commit 708d1f5

Please sign in to comment.