Skip to content

Commit

Permalink
Reindex Recipe Book when recipes are validated after their dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfyScript committed Jan 10, 2024
1 parent 5077064 commit 54d5ad4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ public void setSaveDestination(SaveDestination saveDestination) {

@EventHandler
private void integrationEnable(PluginIntegrationEnableEvent event) {
int validatedTotal = 0;
for (ResourceLoader loader : loaders) {
loader.validatePending();
validatedTotal += loader.validatePending();
}
if (validatedTotal > 0) {
configHandler.getRecipeBookConfig().index(customCrafting);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void load() {
}

@Override
public void validatePending() {

public int validatePending() {
return 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void run() {
}

@Override
public void validatePending() {
public int validatePending() {
int pendingSize = pendingRecipes.size();
int validatedRecipeCount = 0;

Expand All @@ -190,6 +190,7 @@ public void validatePending() {

printPendingRecipes();
printInvalidRecipes();
return validatedRecipeCount;
}

private void printPendingRecipes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void load(boolean upgrade) {
}
}

public abstract void validatePending();
public abstract int validatePending();

/**
* Sets the new value for the "replace data" option.<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public void load() {
}

@Override
public void validatePending() {

public int validatePending() {
return 0;
}

/**
Expand Down

0 comments on commit 54d5ad4

Please sign in to comment.