From 19768ce8704a26ce670487b6a62c41fe7b666160 Mon Sep 17 00:00:00 2001 From: Swedz Date: Mon, 23 Sep 2024 21:39:57 -0400 Subject: [PATCH] Allow vertical orientations with component --- .../machines/components/OrientationComponent.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/aztech/modern_industrialization/machines/components/OrientationComponent.java b/src/main/java/aztech/modern_industrialization/machines/components/OrientationComponent.java index a91b0241f..2e5229be6 100644 --- a/src/main/java/aztech/modern_industrialization/machines/components/OrientationComponent.java +++ b/src/main/java/aztech/modern_industrialization/machines/components/OrientationComponent.java @@ -89,7 +89,7 @@ public boolean useWrench(Player player, InteractionHand hand, Direction face) { return true; } } else { - if (face.getAxis().isHorizontal()) { + if (params.canBeVertical || face.getAxis().isHorizontal()) { facingDirection = face; } // We consume the event to prevent the GUI from opening. @@ -100,7 +100,7 @@ public boolean useWrench(Player player, InteractionHand hand, Direction face) { public void onPlaced(@Nullable LivingEntity placer, ItemStack itemStack) { // The placer can be null using some mods' automatic placement: pick NORTH arbitrarily. - Direction dir = placer != null ? placer.getDirection() : Direction.NORTH; + Direction dir = placer != null ? (params.canBeVertical ? placer.getNearestViewDirection() : placer.getDirection()) : Direction.NORTH; facingDirection = dir.getOpposite(); if (params.hasOutput) { outputDirection = dir; @@ -111,11 +111,17 @@ public static class Params { public final boolean hasOutput; public final boolean hasExtractItems; public final boolean hasExtractFluids; + public final boolean canBeVertical; - public Params(boolean hasOutput, boolean hasExtractItems, boolean hasExtractFluids) { + public Params(boolean hasOutput, boolean hasExtractItems, boolean hasExtractFluids, boolean canBeVertical) { this.hasOutput = hasOutput; this.hasExtractItems = hasExtractItems; this.hasExtractFluids = hasExtractFluids; + this.canBeVertical = canBeVertical; + } + + public Params(boolean hasOutput, boolean hasExtractItems, boolean hasExtractFluids) { + this(hasOutput, hasExtractItems, hasExtractFluids, false); } }