mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 12:56:28 +00:00
Improve Recipe system
This commit is contained in:
@@ -25,6 +25,10 @@ public class CustomShapedRecipe<T> extends CraftingTableRecipe<T> {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public ParsedPattern<T> parsedPattern() {
|
||||
return parsedPattern;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean matches(RecipeInput input) {
|
||||
@@ -72,6 +76,10 @@ public class CustomShapedRecipe<T> extends CraftingTableRecipe<T> {
|
||||
this.ingredients = ingredients;
|
||||
}
|
||||
|
||||
public List<Optional<Ingredient<T>>> ingredients() {
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
public int width() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,11 @@ public class OptimizedIDItem<T> {
|
||||
public boolean isEmpty() {
|
||||
return idHolder == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OptimizedIDItem{" +
|
||||
"idHolder=" + idHolder +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.momirealms.craftengine.core.util.Key;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface RecipeManager<T> extends Reloadable, ConfigSectionParser {
|
||||
String CONFIG_SECTION_NAME = "recipes";
|
||||
@@ -25,7 +26,7 @@ public interface RecipeManager<T> extends Reloadable, ConfigSectionParser {
|
||||
@Nullable
|
||||
Recipe<T> getRecipe(Key type, RecipeInput input);
|
||||
|
||||
void delayedLoad();
|
||||
CompletableFuture<Void> delayedLoad();
|
||||
|
||||
default int loadingSequence() {
|
||||
return LoadingSequence.RECIPE;
|
||||
|
||||
@@ -80,11 +80,9 @@ public abstract class CraftEngine implements Plugin {
|
||||
this.worldManager.reload();
|
||||
this.packManager.reload();
|
||||
this.blockManager.delayedLoad();
|
||||
this.recipeManager.delayedLoad();
|
||||
|
||||
this.scheduler.async().execute(() -> {
|
||||
this.recipeManager.delayedLoad().thenRunAsync(() -> {
|
||||
this.packManager.generateResourcePack();
|
||||
});
|
||||
}, this.scheduler.async());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user