End Stone Smelter
This commit is contained in:
parent
257307d93d
commit
a542aac45b
18 changed files with 551 additions and 77 deletions
|
@ -1,12 +1,16 @@
|
|||
package ru.betterend.recipe;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class EndRecipeManager {
|
||||
private static final Map<RecipeType<?>, Map<Identifier, Recipe<?>>> RECIPES = Maps.newHashMap();
|
||||
|
@ -33,13 +37,30 @@ public class EndRecipeManager {
|
|||
Map<Identifier, Recipe<?>> list = RECIPES.get(type);
|
||||
if (list != null) {
|
||||
Map<Identifier, Recipe<?>> typeList = result.get(type);
|
||||
list.forEach((id, recipe) -> {
|
||||
if (typeList == null) {
|
||||
typeList = Maps.newHashMap();
|
||||
result.put(type, typeList);
|
||||
}
|
||||
for (Entry<Identifier, Recipe<?>> entry : list.entrySet()) {
|
||||
Identifier id = entry.getKey();
|
||||
if (!typeList.containsKey(id))
|
||||
typeList.put(id, recipe);
|
||||
});
|
||||
typeList.put(id, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static <S extends RecipeSerializer<T>, T extends Recipe<?>> S registerSerializer(String id, S serializer) {
|
||||
return Registry.register(Registry.RECIPE_SERIALIZER, BetterEnd.getResId(id), serializer);
|
||||
}
|
||||
|
||||
static <T extends Recipe<?>> RecipeType<T> registerType(String name) {
|
||||
return Registry.register(Registry.RECIPE_TYPE, BetterEnd.getResId(name), new RecipeType<T>() {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue