Skip to content

Commit c996a00

Browse files
authored
Fix combustion intakes on Y axis (#179)
Fix issue that combustion intakes always being obstructed when main body faced Y axis.
1 parent fe78afe commit c996a00

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/ghostipedia/cosmiccore/common/machine/multiblock/multi/logic/ExoticCombustionEngineMachine.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ public ExoticCombustionEngineMachine(IMachineBlockEntity holder, int tier) {
8787

8888
private boolean isIntakesObstructed() {
8989
var dir = this.getFrontFacing();
90-
boolean mutableXZ = dir.getAxis() == Direction.Axis.Z;
90+
var axis = dir.getAxis();
9191
var centerPos = this.getPos().relative(dir);
9292
for (int x = -1; x < 2; x++) {
9393
for (int y = -1; y < 2; y++) {
9494
if (x == 0 && y == 0)
9595
continue;
96-
var blockPos = centerPos.offset(mutableXZ ? x : 0, y, mutableXZ ? 0 : x);
96+
var blockPos = switch (axis) {
97+
case X -> centerPos.offset(0, x, y);
98+
case Y -> centerPos.offset(x, 0, y);
99+
case Z -> centerPos.offset(x, y, 0);
100+
};
97101
var blockState = this.getLevel().getBlockState(blockPos);
98102
if (!blockState.isAir())
99103
return true;

0 commit comments

Comments
 (0)