From 0dec38445398d23d1f57355ebd81562d40d4ff8a Mon Sep 17 00:00:00 2001 From: Caltinor <62700786+Caltinor@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:01:29 -0500 Subject: [PATCH] AutoValue Enabled Configs actually work Fixes #598 --- .../java/harmonised/pmmo/features/autovalues/AutoBlock.java | 6 +++--- .../harmonised/pmmo/features/autovalues/AutoEntity.java | 2 +- .../java/harmonised/pmmo/features/autovalues/AutoItem.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/harmonised/pmmo/features/autovalues/AutoBlock.java b/src/main/java/harmonised/pmmo/features/autovalues/AutoBlock.java index dfaab437..013c3d4b 100644 --- a/src/main/java/harmonised/pmmo/features/autovalues/AutoBlock.java +++ b/src/main/java/harmonised/pmmo/features/autovalues/AutoBlock.java @@ -24,7 +24,7 @@ public class AutoBlock { public static Map processReqs(ReqType type, ResourceLocation blockID) { //exit early if the type is not valid for a block - if (!type.blockApplicable || isWorldSensitive(blockID)) + if (!type.blockApplicable || isWorldSensitive(blockID) || !AutoValueConfig.isReqEnabled(type)) return new HashMap<>(); Block block = ForgeRegistries.BLOCKS.getValue(blockID); @@ -47,13 +47,13 @@ public static Map processReqs(ReqType type, ResourceLocation bl public static Map processXpGains(EventType type, ResourceLocation blockID) { //exit early if the type is not valid for a block - if (!type.blockApplicable || isWorldSensitive(blockID)) + if (!type.blockApplicable || isWorldSensitive(blockID) || !AutoValueConfig.isXpGainEnabled(type)) return new HashMap<>(); Block block = ForgeRegistries.BLOCKS.getValue(blockID); Map outMap = new HashMap<>(); switch (type) { - case BLOCK_BREAK: case BLOCK_PLACE: { + case BLOCK_BREAK: case BLOCK_PLACE: { if (ForgeRegistries.BLOCKS.tags().getTag(Reference.CROPS).contains(block)) outMap.putAll(AutoValueConfig.getBlockXpAward(EventType.GROW)); else if (ForgeRegistries.BLOCKS.tags().getTag(Reference.MINABLE_AXE).contains(block)) diff --git a/src/main/java/harmonised/pmmo/features/autovalues/AutoEntity.java b/src/main/java/harmonised/pmmo/features/autovalues/AutoEntity.java index 498a6cf1..f98d7db1 100644 --- a/src/main/java/harmonised/pmmo/features/autovalues/AutoEntity.java +++ b/src/main/java/harmonised/pmmo/features/autovalues/AutoEntity.java @@ -27,7 +27,7 @@ public static Map processReqs(ReqType type, ResourceLocation en public static Map processXpGains(EventType type, ResourceLocation entityID) { //exit early if not an applicable type - if (!type.entityApplicable) + if (!type.entityApplicable || !AutoValueConfig.isXpGainEnabled(type)) return new HashMap<>(); Map outMap = new HashMap<>(); diff --git a/src/main/java/harmonised/pmmo/features/autovalues/AutoItem.java b/src/main/java/harmonised/pmmo/features/autovalues/AutoItem.java index c189f108..8706a9cd 100644 --- a/src/main/java/harmonised/pmmo/features/autovalues/AutoItem.java +++ b/src/main/java/harmonised/pmmo/features/autovalues/AutoItem.java @@ -48,7 +48,7 @@ public class AutoItem { public static Map processReqs(ReqType type, ResourceLocation stackID) { //exit early if the event type is not valid for an item - if (!type.itemApplicable) + if (!type.itemApplicable || !AutoValueConfig.isReqEnabled(type)) return new HashMap<>(); final Map outMap = new HashMap<>(); @@ -126,7 +126,7 @@ else if (stack.getItem() instanceof HoeItem) public static Map processXpGains(EventType type, ResourceLocation stackID) { //exit early if the event type is not valid for an item - if (!type.itemApplicable) + if (!type.itemApplicable || !AutoValueConfig.isXpGainEnabled(type)) return new HashMap<>(); Map outMap = new HashMap<>();