Added recipes into named map
This commit is contained in:
parent
95284640e0
commit
8ebcf2352a
2 changed files with 5 additions and 2 deletions
|
@ -21,6 +21,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.dataexchange.DataExchangeAPI;
|
||||
import ru.bclib.recipes.BCLRecipeManager;
|
||||
|
||||
|
@ -59,7 +60,9 @@ public class MinecraftServerMixin {
|
|||
|
||||
private void bclib_injectRecipes() {
|
||||
RecipeManagerAccessor accessor = (RecipeManagerAccessor) resources.getRecipeManager();
|
||||
accessor.bclib_setRecipes(BCLRecipeManager.getMap(accessor.bclib_getRecipes()));
|
||||
if (!BCLib.isClient()) {
|
||||
accessor.bclib_setRecipesByName(BCLRecipeManager.getMapByName(accessor.bclib_getRecipesByName()));
|
||||
}
|
||||
accessor.bclib_setRecipes(BCLRecipeManager.getMap(accessor.bclib_getRecipes()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BCLRecipeManager {
|
|||
public static Map<ResourceLocation, Recipe<?>> getMapByName(Map<ResourceLocation, Recipe<?>> recipes) {
|
||||
Map<ResourceLocation, Recipe<?>> result = CollectionsUtil.getMutable(recipes);
|
||||
RECIPES.values().forEach(map -> map.forEach((location, recipe) -> {
|
||||
if (!recipes.containsKey(location)) {
|
||||
if (!result.containsKey(location)) {
|
||||
result.put(location, recipe);
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue