Skip to content

Commit

Permalink
AutoValue Enabled Configs actually work
Browse files Browse the repository at this point in the history
Fixes #598
  • Loading branch information
Caltinor committed Nov 28, 2024
1 parent f3483be commit 0dec384
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AutoBlock {
public static Map<String, Integer> 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);
Expand All @@ -47,13 +47,13 @@ public static Map<String, Integer> processReqs(ReqType type, ResourceLocation bl

public static Map<String, Long> 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<String, Long> 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static Map<String, Integer> processReqs(ReqType type, ResourceLocation en

public static Map<String, Long> 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<String, Long> outMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class AutoItem {

public static Map<String, Integer> 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<String, Integer> outMap = new HashMap<>();
Expand Down Expand Up @@ -126,7 +126,7 @@ else if (stack.getItem() instanceof HoeItem)

public static Map<String, Long> 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<String, Long> outMap = new HashMap<>();
Expand Down

0 comments on commit 0dec384

Please sign in to comment.