Skip to content

Commit

Permalink
Implementation of cross sliding rail
Browse files Browse the repository at this point in the history
  • Loading branch information
YocyCraft committed Dec 17, 2024
1 parent 8e49bea commit 578730b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"y": 90
},
"axis=y": {
"model": "anvilcraft:block/sliding_rail"
"model": "anvilcraft:block/sliding_rail_cross"
},
"axis=z": {
"model": "anvilcraft:block/sliding_rail"
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/dev/dubhe/anvilcraft/block/SlidingRailBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ public class SlidingRailBlock extends Block implements IHammerChangeable, IHamme
Block.box(0, 12, 0, 5, 16, 16),
Block.box(11, 6, 0, 14, 12, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
public static final VoxelShape AABB_Y =
Stream.of(
Block.box(0, 0, 0, 16, 6, 16),
Block.box(11, 6, 11, 16, 16, 16),
Block.box(0, 6, 11, 5, 16, 16),
Block.box(0, 6, 0, 5, 16, 5),
Block.box(11, 6, 0, 16, 16, 5)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public static final HashMap<BlockPos, PistonPushInfo> MOVING_PISTON_MAP = new HashMap<>();

Expand Down Expand Up @@ -99,8 +107,9 @@ public VoxelShape getShape(
case X:
yield AABB_X;
case Z:
default:
yield AABB_Z;
case Y:
yield AABB_Y;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public static void init(RegistrateRecipeProvider provider) {
.input(Blocks.DIRT)
.result(Blocks.MYCELIUM)
.save(provider);
BlockCompressRecipe.builder()
.input(ModBlocks.VOID_MATTER_BLOCK.get())
.input(ModBlocks.SUPERCRITICAL_NESTING_SHULKER_BOX.get())
.result(ModBlocks.SPACE_OVERCOMPRESSOR.get())
.save(provider);
}

private static void blockCompress(RegistrateRecipeProvider provider, Block block1, Block block2, Block result) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/dev/dubhe/anvilcraft/init/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,9 @@ public class ModBlocks {
.modelFile(DangerUtil.genModModelFile("block/sliding_rail").get())
.rotationY(90)
.buildLast()};
case Z, Y -> DangerUtil.genConfiguredModel("block/sliding_rail")
case Z -> DangerUtil.genConfiguredModel("block/sliding_rail")
.get();
case Y -> DangerUtil.genConfiguredModel("block/sliding_rail_cross")
.get();
});
})
Expand Down

0 comments on commit 578730b

Please sign in to comment.