From f434688f3aec77181762a44fb0cb094db4890730 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sun, 14 Aug 2022 22:13:33 -0600 Subject: [PATCH] Allow max size of controller to be configurable (#126) * modifiable max length of a controller in all 3 axis * added a 1-255 range on the sizes * fixed values to [1, 63] --- src/main/java/appeng/core/AEConfig.java | 15 +++++++++++++++ .../me/pathfinding/ControllerValidator.java | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/appeng/core/AEConfig.java b/src/main/java/appeng/core/AEConfig.java index efa8af128..44cd93a3b 100644 --- a/src/main/java/appeng/core/AEConfig.java +++ b/src/main/java/appeng/core/AEConfig.java @@ -117,6 +117,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject private double wirelessBoosterExp = 1.5; // Autocrafting private boolean enableCraftingSubstitutes = false; + // Controller sizes + private int maxControllerSizeX = 7; + private int maxControllerSizeY = 7; + private int maxControllerSizeZ = 7; private AEConfig( final File configFile ) { @@ -181,6 +185,11 @@ public final class AEConfig extends Configuration implements IConfigurableObject this.addCustomCategoryComment( "autocrafting", "Enable patterns with substitutions on to have their substitutes to be auto craftable.\nThis changes the crafting tree, and can show missing ingredients for the substitute, instead of the patterned item" ); this.enableCraftingSubstitutes = this.get( "autocrafting", "EnableAutocraftinSubstitutes", this.enableCraftingSubstitutes ).getBoolean( this.enableCraftingSubstitutes ); + this.addCustomCategoryComment( "ControllerSize", "Set the max size of a controller in any of the 3 axis.\nEach is between [1, 64)" ); + this.maxControllerSizeX = Math.min(Math.max(this.get( "ControllerSize", "maxControllerSizeX", this.maxControllerSizeX ).getInt(this.maxControllerSizeX), 1), 63); + this.maxControllerSizeY = Math.min(Math.max(this.get( "ControllerSize", "maxControllerSizeY", this.maxControllerSizeY ).getInt(this.maxControllerSizeY), 1), 63); + this.maxControllerSizeZ = Math.min(Math.max(this.get( "ControllerSize", "maxControllerSizeZ", this.maxControllerSizeZ ).getInt(this.maxControllerSizeZ), 1), 63); + this.clientSync(); this.addCustomCategoryComment( "features", "Warning: Disabling a feature may disable other features depending on it." ); @@ -763,4 +772,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject { return this.enableCraftingSubstitutes; } + + public int getMaxControllerSizeX() { return this.maxControllerSizeX; } + + public int getMaxControllerSizeY() { return this.maxControllerSizeY; } + + public int getMaxControllerSizeZ() { return this.maxControllerSizeZ; } } diff --git a/src/main/java/appeng/me/pathfinding/ControllerValidator.java b/src/main/java/appeng/me/pathfinding/ControllerValidator.java index fb9e7af2d..8b791ce2e 100644 --- a/src/main/java/appeng/me/pathfinding/ControllerValidator.java +++ b/src/main/java/appeng/me/pathfinding/ControllerValidator.java @@ -19,6 +19,7 @@ package appeng.me.pathfinding; +import appeng.core.AEConfig; import net.minecraft.util.math.BlockPos; import appeng.api.networking.IGridHost; @@ -66,7 +67,7 @@ public class ControllerValidator implements IGridVisitor this.minZ = Math.min( pos.getZ(), this.minZ ); this.maxZ = Math.max( pos.getZ(), this.maxZ ); - if( this.maxX - this.minX < 7 && this.maxY - this.minY < 7 && this.maxZ - this.minZ < 7 ) + if( this.maxX - this.minX < AEConfig.instance().getMaxControllerSizeX() && this.maxY - this.minY < AEConfig.instance().getMaxControllerSizeY() && this.maxZ - this.minZ < AEConfig.instance().getMaxControllerSizeZ() ) { this.setFound( this.getFound() + 1 ); return true;