Skip to content

Commit

Permalink
Fix maintenance hatch rotating (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursivePineapple authored Feb 18, 2025
1 parent 2d9f77a commit 0e02322
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import net.minecraftforge.common.util.ForgeDirection;

import com.gtnewhorizon.structurelib.alignment.enumerable.Flip;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.VoidingMode;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
Expand Down Expand Up @@ -301,11 +302,18 @@ public boolean apply(IBlockApplyContext ctx) {

if (mGTFacing != null && alignment != null) {

if (alignment.isNewExtendedFacingValid(mGTFacing)) {
gte.setFrontFacing(mGTFacing.getDirection());
alignment.toolSetExtendedFacing(mGTFacing);
ExtendedFacing facing = mGTFacing;

// maintenance hatches can be rotated but not flipped
if (!alignment.isNewExtendedFacingValid(facing)) {
facing = ExtendedFacing.of(mGTFacing.getDirection(), mGTFacing.getRotation(), Flip.NONE);
}

if (alignment.isNewExtendedFacingValid(facing)) {
gte.setFrontFacing(facing.getDirection());
alignment.toolSetExtendedFacing(facing);
} else {
ctx.error("Could not set direction to '" + mGTFacing.getLocalizedName() + "'");
ctx.error("Could not set direction to '" + facing.getLocalizedName() + "'");
}
}
} else {
Expand Down

0 comments on commit 0e02322

Please sign in to comment.