Async Operation Catching
Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. By: md_5 <git@md-5.net>
This commit is contained in:
@@ -29,14 +29,13 @@
|
||||
public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> implements RecipeAccess {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -109,9 +114,27 @@
|
||||
protected void apply(RecipeMap prepared, ResourceManager manager, ProfilerFiller profiler) {
|
||||
this.recipes = prepared;
|
||||
@@ -111,7 +116,26 @@
|
||||
RecipeManager.LOGGER.info("Loaded {} recipes", prepared.values().size());
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void addRecipe(RecipeHolder<?> irecipe) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("Recipe Add"); // Spigot
|
||||
+ this.recipes.addRecipe(irecipe);
|
||||
+ this.finalizeRecipeLoading();
|
||||
+ }
|
||||
@@ -49,15 +48,15 @@
|
||||
+
|
||||
+ MinecraftServer.getServer().getPlayerList().reloadRecipes();
|
||||
+ }
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
public void finalizeRecipeLoading(FeatureFlagSet features) {
|
||||
+ this.featureflagset = features;
|
||||
+ // CraftBukkit end
|
||||
List<SelectableRecipe.SingleInputEntry<StonecutterRecipe>> list = new ArrayList();
|
||||
List<RecipeManager.IngredientCollector> list1 = RecipeManager.RECIPE_PROPERTY_SETS.entrySet().stream().map((entry) -> {
|
||||
return new RecipeManager.IngredientCollector((ResourceKey) entry.getKey(), (RecipeManager.IngredientExtractor) entry.getValue());
|
||||
@@ -130,7 +153,7 @@
|
||||
@@ -130,7 +154,7 @@
|
||||
StonecutterRecipe recipestonecutting = (StonecutterRecipe) irecipe;
|
||||
|
||||
if (RecipeManager.isIngredientEnabled(features, recipestonecutting.input()) && recipestonecutting.resultDisplay().isEnabled(features)) {
|
||||
@@ -66,7 +65,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +195,10 @@
|
||||
@@ -172,7 +196,10 @@
|
||||
}
|
||||
|
||||
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level world) {
|
||||
@@ -78,7 +77,7 @@
|
||||
}
|
||||
|
||||
public Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> key) {
|
||||
@@ -183,7 +209,7 @@
|
||||
@@ -183,7 +210,7 @@
|
||||
private <T extends Recipe<?>> RecipeHolder<T> byKeyTyped(RecipeType<T> type, ResourceKey<Recipe<?>> key) {
|
||||
RecipeHolder<?> recipeholder = this.recipes.byKey(key);
|
||||
|
||||
@@ -87,7 +86,7 @@
|
||||
}
|
||||
|
||||
public Map<ResourceKey<RecipePropertySet>, RecipePropertySet> getSynchronizedItemProperties() {
|
||||
@@ -231,6 +257,22 @@
|
||||
@@ -231,6 +258,22 @@
|
||||
return new RecipeHolder<>(key, irecipe);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user