Skip to content

Commit

Permalink
[~] Create x Frame compat
Browse files Browse the repository at this point in the history
  • Loading branch information
crispytwig committed May 21, 2024
1 parent 9838a0a commit 3fd0b01
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 46 deletions.
9 changes: 8 additions & 1 deletion src/main/java/com/starfish_studios/bbb/block/FrameBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public void attack(BlockState blockState, Level level, BlockPos blockPos, Player
}
}

@Override
public VoxelShape getShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) {
return switch (blockState.getValue(FACING)) {
case EAST -> EAST;
Expand All @@ -106,6 +107,7 @@ public VoxelShape getShape(BlockState blockState, BlockGetter blockGetter, Block
};
}

@Override
public VoxelShape getCollisionShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) {
return switch (blockState.getValue(FACING)) {
case NORTH -> Shapes.or(blockState.getValue(TOP) ? TOP_NORTH_AABB : Shapes.empty(), blockState.getValue(BOTTOM) ? BOTTOM_NORTH_AABB : Shapes.empty());
Expand Down Expand Up @@ -209,7 +211,12 @@ public BlockState getConnections(BlockState state, LevelAccessor level, BlockPos
}

public boolean validConnection(BlockState state) {
if (state.isSolid()) {
if (state.isFaceSturdy(null, null, Direction.UP) ||
state.isFaceSturdy(null, null, Direction.DOWN) ||
state.isFaceSturdy(null, null, Direction.NORTH) ||
state.isFaceSturdy(null, null, Direction.EAST) ||
state.isFaceSturdy(null, null, Direction.SOUTH) ||
state.isFaceSturdy(null, null, Direction.WEST)) {
return true;
}
return state.is(BBBTags.BBBBlockTags.FRAMES);
Expand Down
Loading

0 comments on commit 3fd0b01

Please sign in to comment.