From d945860185b888709300e28ae1c9db88799856c0 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 6 May 2023 08:13:45 -0700 Subject: Exploring some various ForgeDirection fixes (#1950) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix mFacing NPEs * Default facing fixes (#1945) * QuickFixes incomplete facing fixes * fix Neither UP nor DOWN conditions as offsetY == 0 is not valid test * fix neither up nor down again * Still not fixed: use ForgeDirection.flag for clarty killed more ordinal siding. * get ride of offset testing --------- Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com> Co-authored-by: Jason Mitchell * bit logic fix * Fix single block machine facings * Predict the machine facing direction clientside before the server packet arrives * Fix isFacingValid logic --------- Co-authored-by: Léa Gris Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com> Co-authored-by: Martin Robertz Co-authored-by: Raven Szewczyk --- src/main/java/gregtech/api/util/GT_HatchElementBuilder.java | 7 +++++-- src/main/java/gregtech/api/util/GT_ModHandler.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java index 8565dc21f5..194a29f8a2 100644 --- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java +++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java @@ -481,7 +481,10 @@ public class GT_HatchElementBuilder { // explicitly rejected, probably obstructed by another slice if (mDisallowedDirection.contains(direction)) continue; ForgeDirection rotated = env.getFacing() - .getWorldDirection(direction.offsetY != 0 ? direction.getOpposite() : direction); + .getWorldDirection( + (direction.flag & (ForgeDirection.UP.flag | ForgeDirection.DOWN.flag)) != 0 + ? direction.getOpposite() + : direction); allowed.add(rotated); } } @@ -492,7 +495,7 @@ public class GT_HatchElementBuilder { // find the first facing available, but prefer a facing that isn't up/down for (ForgeDirection facing : allowed) { result = facing; - if (facing.offsetY == 0) break; + if ((facing.flag & (ForgeDirection.UP.flag | ForgeDirection.DOWN.flag)) == 0) break; // Horizontal } assert result != null; ((IGregTechTileEntity) tileEntity).setFrontFacing(result); diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 8097f82dea..b87fda289a 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -1566,12 +1566,12 @@ public class GT_ModHandler { boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { if (aOutput == null) return false; boolean rReturn = false; - ArrayList tList = (ArrayList) CraftingManager.getInstance() + final ArrayList tList = (ArrayList) CraftingManager.getInstance() .getRecipeList(); aOutput = GT_OreDictUnificator.get(aOutput); int tList_sS = tList.size(); for (int i = 0; i < tList_sS; i++) { - IRecipe tRecipe = tList.get(i); + final IRecipe tRecipe = tList.get(i); if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; if (aOnlyRemoveNativeHandlers) { -- cgit