implement custom recipes
This commit is contained in:
parent
70b149fcd6
commit
ae36541d9c
|
@ -1,31 +0,0 @@
|
|||
package net.anvilcraft.ntx4core;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
|
||||
public class RecipesEvent extends Event implements IModBusEvent {
|
||||
public Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
|
||||
public Map<Identifier, Recipe<?>> recipesById;
|
||||
|
||||
public RecipesEvent(
|
||||
Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes,
|
||||
Map<Identifier, Recipe<?>> recipesById
|
||||
) {
|
||||
this.recipes = recipes;
|
||||
this.recipesById = recipesById;
|
||||
}
|
||||
|
||||
public void registerRecipe(Recipe<?> recipe) {
|
||||
if (!this.recipes.containsKey(recipe.getType()))
|
||||
this.recipes.put(recipe.getType(), new HashMap<>());
|
||||
|
||||
this.recipes.get(recipe.getType()).put(recipe.getId(), recipe);
|
||||
this.recipesById.put(recipe.getId(), recipe);
|
||||
}
|
||||
}
|
29
src/main/java/net/anvilcraft/ntx4core/Util.java
Normal file
29
src/main/java/net/anvilcraft/ntx4core/Util.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package net.anvilcraft.ntx4core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class Util {
|
||||
public static ItemStack stackFromRegistry(Identifier id) {
|
||||
if (ForgeRegistries.ITEMS.containsKey(id)) {
|
||||
return new ItemStack(ForgeRegistries.ITEMS.getValue(id));
|
||||
} else if (ForgeRegistries.BLOCKS.containsKey(id)) {
|
||||
return new ItemStack(ForgeRegistries.BLOCKS.getValue(id));
|
||||
} else {
|
||||
throw new IllegalArgumentException("No block or item with ID " + id + "!");
|
||||
}
|
||||
}
|
||||
|
||||
public static Ingredient ingredientFromString(String s) {
|
||||
if (s.charAt(0) == '#')
|
||||
return Ingredient.fromTag(
|
||||
TagKey.of(Registry.ITEM_KEY, new Identifier(s.substring(1)))
|
||||
);
|
||||
|
||||
return Ingredient.ofStacks(stackFromRegistry(new Identifier(s)));
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ import net.minecraftforge.internal.BrandingControl;
|
|||
public class TitleScreenMixin extends Screen {
|
||||
@Shadow
|
||||
@Final
|
||||
public static Text COPYRIGHT
|
||||
public static final Text COPYRIGHT
|
||||
// Mojang, FUCK YOU!
|
||||
= new LiteralText("Copyleft Anvilcraft. Licensed under AGPL-3.0+ALEC");
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import com.google.gson.JsonElement;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.RecipesEvent;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipesEvent;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeManager;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
|
@ -20,6 +20,7 @@ import net.minecraft.resource.ResourceManager;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
|
||||
@Mixin(RecipeManager.class)
|
||||
public class RecipeManagerMixin {
|
||||
|
@ -36,6 +37,11 @@ public class RecipeManagerMixin {
|
|||
Profiler alec3,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
if (!FMLEnvironment.production) {
|
||||
Ntx4Core.LOGGER.warn("Running in dev env, skipping Recipe Event!");
|
||||
return;
|
||||
}
|
||||
|
||||
Ntx4Core.LOGGER.info("Firing Recipe Event");
|
||||
Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes = new HashMap<>();
|
||||
this.recipes.forEach((k, v) -> recipes.put(k, new HashMap<>(v)));
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.anvilcraft.ntx4core.Util;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public abstract class AbstractIngredientCondition implements Predicate<Ingredient> {
|
||||
public static AbstractIngredientCondition of(String s) {
|
||||
return s.charAt(0) == '#'
|
||||
? new TagIngredientCondition(new Identifier(s.substring(1)))
|
||||
: new StackIngredientCondition(Util.stackFromRegistry(new Identifier(s)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Ingredient i) {
|
||||
return Arrays.stream(i.entries).anyMatch(this::entryMatches);
|
||||
}
|
||||
|
||||
public abstract boolean entryMatches(Ingredient.Entry e);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
||||
/**
|
||||
* IRecipeMapper describes a class that knows how to conditionally replace recipes.
|
||||
*/
|
||||
public interface IRecipeMapper extends Function<Recipe<?>, Recipe<?>> {
|
||||
public boolean shouldMap(Recipe<?> recipe);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
||||
public class IngredientsContainPredicate implements Predicate<Recipe<?>> {
|
||||
public Predicate<Ingredient> pred;
|
||||
|
||||
public IngredientsContainPredicate(Predicate<Ingredient> pred) {
|
||||
this.pred = pred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Recipe<?> r) {
|
||||
return r.getIngredients().stream().anyMatch(this.pred);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.anvilcraft.ntx4core.Util;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
||||
public class InputReplaceRecipeMapper implements IRecipeMapper {
|
||||
public Map<Predicate<Ingredient>, Ingredient> replacements = new HashMap<>();
|
||||
|
||||
public InputReplaceRecipeMapper replace(Predicate<Ingredient> p, Ingredient i) {
|
||||
this.replacements.put(p, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public InputReplaceRecipeMapper replace(String p, Ingredient i) {
|
||||
return this.replace(AbstractIngredientCondition.of(p), i);
|
||||
}
|
||||
|
||||
public InputReplaceRecipeMapper replace(String p, String i) {
|
||||
return this.replace(p, Util.ingredientFromString(i));
|
||||
}
|
||||
|
||||
public InputReplaceRecipeMapper replace(Predicate<Ingredient> p, String i) {
|
||||
return this.replace(p, Util.ingredientFromString(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMap(Recipe<?> recipe) {
|
||||
var ingredients = recipe.getIngredients();
|
||||
if (ingredients == null)
|
||||
return false;
|
||||
|
||||
for (var k : this.replacements.keySet())
|
||||
if (ingredients.stream().anyMatch(k))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Recipe<?> apply(Recipe<?> recipe) {
|
||||
var ingredients = recipe.getIngredients();
|
||||
for (int i = 0; i < ingredients.size(); i++) {
|
||||
var ing = ingredients.get(i);
|
||||
for (var entry : this.replacements.entrySet())
|
||||
if (entry.getKey().test(ing))
|
||||
ingredients.set(i, entry.getValue());
|
||||
}
|
||||
return recipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
||||
public class RecipeContainsPredicate implements Predicate<Recipe<?>> {
|
||||
public ItemStack item;
|
||||
|
||||
public RecipeContainsPredicate(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Recipe<?> r) {
|
||||
return r.getIngredients() == null
|
||||
? false
|
||||
: r.getIngredients().stream().anyMatch(new StackIngredientCondition(this.item))
|
||||
|| r.getOutput().isItemEqual(this.item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
|
||||
public class RecipesEvent extends Event implements IModBusEvent {
|
||||
public Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
|
||||
public Map<Identifier, Recipe<?>> recipesById;
|
||||
|
||||
public RecipesEvent(
|
||||
Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes,
|
||||
Map<Identifier, Recipe<?>> recipesById
|
||||
) {
|
||||
this.recipes = recipes;
|
||||
this.recipesById = recipesById;
|
||||
}
|
||||
|
||||
public void registerRecipe(Recipe<?> recipe) {
|
||||
if (!this.recipes.containsKey(recipe.getType()))
|
||||
this.recipes.put(recipe.getType(), new HashMap<>());
|
||||
|
||||
this.recipes.get(recipe.getType()).put(recipe.getId(), recipe);
|
||||
this.recipesById.put(recipe.getId(), recipe);
|
||||
}
|
||||
|
||||
public Optional<Recipe<?>> removeRecipeID(Identifier id) {
|
||||
if (this.recipesById.containsKey(id)) {
|
||||
return Optional.of(
|
||||
this.recipes.get(this.recipesById.remove(id).getType()).remove(id)
|
||||
);
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public void removeRecipesMatching(Predicate<Recipe<?>> p) {
|
||||
var iter = this.recipesById.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
var entry = iter.next();
|
||||
if (p.test(entry.getValue())) {
|
||||
iter.remove();
|
||||
this.recipes.get(entry.getValue().getType()).remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mapRecipes(IRecipeMapper mapper) {
|
||||
var iter = this.recipesById.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
var entry = iter.next();
|
||||
if (mapper.shouldMap(entry.getValue())) {
|
||||
var mapped = mapper.apply(entry.getValue());
|
||||
if (mapped != entry.getValue()) {
|
||||
iter.remove();
|
||||
this.recipes.get(entry.getValue().getType()).remove(entry.getKey());
|
||||
this.registerRecipe(mapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mapRecipeID(Identifier id, Function<Recipe<?>, Recipe<?>> func) {
|
||||
var recipe = this.recipesById.get(id);
|
||||
if (recipe != null) {
|
||||
var mapped = func.apply(recipe);
|
||||
if (recipe != mapped) {
|
||||
this.removeRecipeID(id);
|
||||
this.registerRecipe(mapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.ShapedRecipe;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ShapedRecipeBuilder {
|
||||
public Identifier ident;
|
||||
public String[] pattern;
|
||||
public Map<Character, Ingredient> ingredients = new HashMap<>();
|
||||
public ItemStack output;
|
||||
|
||||
public ShapedRecipeBuilder(Identifier ident, ItemStack output) {
|
||||
this.ident = ident;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder(String ident, ItemStack output) {
|
||||
this(Ntx4Core.id(ident), output);
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder pattern(String... pat) {
|
||||
this.pattern = pat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder ingredient(char c, Ingredient i) {
|
||||
this.ingredients.put(c, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder ingredient(char c, ItemStack... is) {
|
||||
return this.ingredient(c, Ingredient.ofStacks(is));
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder ingredient(char c, Item i) {
|
||||
return this.ingredient(c, new ItemStack(i));
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder ingredient(char c, Block b) {
|
||||
return this.ingredient(c, new ItemStack(b));
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder ingredient(char c, String s) {
|
||||
if (s.charAt(0) == '#') {
|
||||
return this.tagIngredient(c, new Identifier(s.substring(1)));
|
||||
}
|
||||
|
||||
var ident = new Identifier(s);
|
||||
var maybeItem = ForgeRegistries.ITEMS.getValue(ident);
|
||||
if (maybeItem == null) {
|
||||
var maybeBlock = ForgeRegistries.BLOCKS.getValue(ident);
|
||||
if (maybeBlock == null)
|
||||
throw new IllegalArgumentException(
|
||||
"ID " + s + " not found in item or block registry!"
|
||||
);
|
||||
|
||||
return this.ingredient(c, maybeBlock);
|
||||
}
|
||||
|
||||
return this.ingredient(c, maybeItem);
|
||||
}
|
||||
|
||||
public ShapedRecipeBuilder tagIngredient(char c, Identifier t) {
|
||||
return this.ingredient(c, Ingredient.fromTag(TagKey.of(Registry.ITEM_KEY, t)));
|
||||
}
|
||||
|
||||
public ShapedRecipe build() {
|
||||
int width = -1;
|
||||
for (String line : this.pattern) {
|
||||
if (width != -1 && width != line.length())
|
||||
throw new IllegalArgumentException(
|
||||
"Lines in crafting pattern must be same width!"
|
||||
);
|
||||
width = line.length();
|
||||
}
|
||||
|
||||
DefaultedList<Ingredient> ingredients = DefaultedList.of();
|
||||
Arrays.stream(this.pattern)
|
||||
.flatMap(s -> s.chars().mapToObj(c -> (char) c))
|
||||
.map(this.ingredients::get)
|
||||
.forEach(ingredients::add);
|
||||
|
||||
return new ShapedRecipe(
|
||||
this.ident, "", width, this.pattern.length, ingredients, this.output
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Ingredient.Entry;
|
||||
import net.minecraft.recipe.Ingredient.StackEntry;
|
||||
|
||||
public class StackIngredientCondition extends AbstractIngredientCondition {
|
||||
public ItemStack stack;
|
||||
|
||||
public StackIngredientCondition(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entryMatches(Entry e) {
|
||||
return e instanceof StackEntry se && se.stack.isItemEqual(this.stack);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.anvilcraft.ntx4core.recipe;
|
||||
|
||||
import net.minecraft.recipe.Ingredient.Entry;
|
||||
import net.minecraft.recipe.Ingredient.TagEntry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class TagIngredientCondition extends AbstractIngredientCondition {
|
||||
public Identifier id;
|
||||
|
||||
public TagIngredientCondition(Identifier id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entryMatches(Entry e) {
|
||||
return e instanceof TagEntry te && te.tag.id().equals(this.id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package net.anvilcraft.ntx4core.recipes;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.Util;
|
||||
import net.anvilcraft.ntx4core.recipe.InputReplaceRecipeMapper;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipesEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
|
||||
public class InputReplacements {
|
||||
@SubscribeEvent
|
||||
public static void onRecipeRegister(RecipesEvent ev) {
|
||||
var darkMatter = Util.ingredientFromString("projecte:dark_matter");
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("draconicevolution", "components/draconium_core"),
|
||||
new InputReplaceRecipeMapper().replace("#forge:ingots/draconium", darkMatter)
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("draconicevolution", "components/wyvern_core"),
|
||||
new InputReplaceRecipeMapper().replace("#forge:ingots/draconium", darkMatter)
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("projecte", "relay_mk1"),
|
||||
new InputReplaceRecipeMapper().replace(
|
||||
"#forge:storage_blocks/diamond",
|
||||
"mekanism:pellet_antimatter"
|
||||
)
|
||||
);
|
||||
|
||||
var philosopherStoneMapper = new InputReplaceRecipeMapper().replace(
|
||||
"#forge:gems/diamond",
|
||||
"#forge:darkmatter"
|
||||
);
|
||||
ev.mapRecipeID(
|
||||
new Identifier("projecte", "philosophers_stone"), philosopherStoneMapper
|
||||
);
|
||||
ev.mapRecipeID(
|
||||
new Identifier("projecte", "philosophers_stone_alt"), philosopherStoneMapper
|
||||
);
|
||||
|
||||
// Unify DeepResonance machine frames
|
||||
ev.mapRecipes(new InputReplaceRecipeMapper().replace(
|
||||
"deepresonance:machine_frame", "rftoolsbase:machine_frame"
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.anvilcraft.ntx4core.recipes;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.Util;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipeContainsPredicate;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipesEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
|
||||
public class RecipeRemovals {
|
||||
@SubscribeEvent
|
||||
public static void onRecipeRegister(RecipesEvent ev) {
|
||||
ev.removeRecipesMatching(new RecipeContainsPredicate(
|
||||
Util.stackFromRegistry(new Identifier("projecte", "condenser_mk1"))
|
||||
));
|
||||
ev.removeRecipesMatching(new RecipeContainsPredicate(
|
||||
Util.stackFromRegistry(new Identifier("projecte", "transmutation_table"))
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package net.anvilcraft.ntx4core.recipes;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipesEvent;
|
||||
import net.anvilcraft.ntx4core.recipe.ShapedRecipeBuilder;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
|
||||
public class RecipeReplacements {
|
||||
@SubscribeEvent
|
||||
public static void onRecipeRegister(RecipesEvent ev) {
|
||||
ev.mapRecipeID(
|
||||
new Identifier("shrink", "shrinking_device"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("shrinking_device", r.getOutput())
|
||||
.pattern("IDI", "TFE", "IDI")
|
||||
.ingredient('I', "#forge:ingots/osmium")
|
||||
.ingredient('D', "projecte:dark_matter")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('F', "ae2:fluix_pearl")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("compactmachines", "personal_shrinking_device"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("shrinking_device", r.getOutput())
|
||||
.pattern("IDI", "TFE", "IDI")
|
||||
.ingredient('I', "#forge:ingots/iron")
|
||||
.ingredient('D', "projecte:dark_matter")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('F', "ae2:fluix_pearl")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("tempad", "tempad"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("tempad", r.getOutput())
|
||||
.pattern("MGM", "TCE", "MGM")
|
||||
.ingredient('M', "#forge:ingots/copper")
|
||||
.ingredient('G', "#forge:ingots/refined_glowstone")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('C', "mekanism:teleportation_core")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("dmlreforged", "deep_learner"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("deep_learner", r.getOutput())
|
||||
.pattern("MGM", "TCE", "MGM")
|
||||
.ingredient('M', "#forge:ingots/manyullyn")
|
||||
.ingredient('G', "mekanism:elite_control_circuit")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('C', "industrialforegoing:mob_imprisonment_tool")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("scannable", "scanner"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("scanner", r.getOutput())
|
||||
.pattern("MGM", "TCE", "MGM")
|
||||
.ingredient('M', "#forge:ingots/iron")
|
||||
.ingredient('G', "mekanism:advanced_control_circuit")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('C', "projecte:divining_rod_3")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("enderrift", "rift"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("enderrift", r.getOutput())
|
||||
.pattern("PDP", "DCD", "PDP")
|
||||
.ingredient('P', "ae2:fluix_pearl")
|
||||
.ingredient('C', "mekanism:qio_drive_array")
|
||||
.ingredient('D', "projecte:dark_matter")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("enderrift", "rift_orb"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("rift_orb", r.getOutput())
|
||||
.pattern("DPD", "PCP", "DPD")
|
||||
.ingredient('D', "projecte:dark_matter")
|
||||
.ingredient('P', "minecraft:ender_eye")
|
||||
.ingredient('C', "ae2:singularity")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("projecte", "dark_matter"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("dark_matter", r.getOutput())
|
||||
.pattern("DFD", "FSF", "DFD")
|
||||
.ingredient('F', "projecte:aeternalis_fuel")
|
||||
.ingredient('S', "ae2:singularity")
|
||||
.ingredient('D', "#forge:ingots/draconium")
|
||||
.build()
|
||||
);
|
||||
|
||||
ev.mapRecipeID(
|
||||
new Identifier("quantumquarryplus", "qqprcp"),
|
||||
r
|
||||
-> new ShapedRecipeBuilder("quantum_quarry", r.getOutput())
|
||||
.pattern("ECE", "BFD", "ECE")
|
||||
.ingredient('E', "#forge:ingots/enderium")
|
||||
.ingredient('C', "quantumquarryplus:endercell")
|
||||
.ingredient('B', "rftoolsbuilder:builder")
|
||||
.ingredient('F', "quantumquarryplus:quarry_framw") // framw.
|
||||
.ingredient('D', "rftoolsdim:dimension_builder")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package net.anvilcraft.ntx4core.recipes;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.recipe.RecipesEvent;
|
||||
import net.anvilcraft.ntx4core.recipe.ShapedRecipeBuilder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
|
||||
public class ShapedRecipes {
|
||||
@SubscribeEvent
|
||||
public static void onRecipeRegister(RecipesEvent ev) {
|
||||
ev.registerRecipe(new ShapedRecipeBuilder(
|
||||
"he_who_remains_tempad",
|
||||
new ItemStack(ForgeRegistries.ITEMS.getValue(
|
||||
new Identifier("tempad", "he_who_remains_tempad")
|
||||
))
|
||||
)
|
||||
.pattern("MGM", "TCE", "MGM")
|
||||
.ingredient('M', "projecte:dark_matter")
|
||||
.ingredient('G', "#forge:ingots/refined_glowstone")
|
||||
.ingredient('T', "rftoolsbase:tablet")
|
||||
.ingredient('C', "mekanism:teleportation_core")
|
||||
.ingredient('E', "mekanism:energy_tablet")
|
||||
.build());
|
||||
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package net.anvilcraft.ntx4core.recipes;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.RecipesEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
||||
@EventBusSubscriber(modid = Ntx4Core.MODID, bus = Bus.MOD)
|
||||
public class ShapelessRecipes {
|
||||
@SubscribeEvent
|
||||
public static void onRecipeRegister(RecipesEvent ev) {
|
||||
// TODO
|
||||
}
|
||||
}
|
|
@ -1,2 +1,5 @@
|
|||
# Make stuff for custom title screen public
|
||||
public-f net.minecraft.client.gui.screens.LoadingOverlay f_96161_ # SplashOverlay.BRAND_ARGB
|
||||
public net.minecraft.world.item.crafting.Ingredient f_43902_ # Ingredient.entries
|
||||
public net.minecraft.world.item.crafting.Ingredient$TagValue f_43959_ # Ingredient$TagEntry.tag
|
||||
public net.minecraft.world.item.crafting.Ingredient$ItemValue f_43951_ # Ingredient$StackEntry.stack
|
||||
|
|
Loading…
Reference in a new issue