NaturesAura/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java

44 lines
1.1 KiB
Java
Raw Normal View History

2018-10-18 13:34:37 +02:00
package de.ellpeck.naturesaura.recipes;
2018-10-31 01:17:58 +01:00
import net.minecraft.block.Block;
2018-10-18 13:34:37 +02:00
import net.minecraft.item.ItemStack;
2018-10-22 00:14:52 +02:00
import net.minecraft.util.ResourceLocation;
2018-10-18 13:34:37 +02:00
2018-10-22 00:14:52 +02:00
import java.util.HashMap;
import java.util.Map;
2018-10-18 13:34:37 +02:00
public class AltarRecipe {
2018-10-22 00:14:52 +02:00
public static final Map<ResourceLocation, AltarRecipe> RECIPES = new HashMap<>();
2018-10-18 13:34:37 +02:00
2018-10-22 00:14:52 +02:00
public final ResourceLocation name;
2018-10-18 13:34:37 +02:00
public final ItemStack input;
public final ItemStack output;
2018-10-31 01:17:58 +01:00
public final Block catalyst;
2018-10-18 13:34:37 +02:00
public final int aura;
public final int time;
2018-10-31 01:17:58 +01:00
public AltarRecipe(ResourceLocation name, ItemStack input, ItemStack output, Block catalyst, int aura, int time) {
2018-10-22 00:14:52 +02:00
this.name = name;
2018-10-18 13:34:37 +02:00
this.input = input;
this.output = output;
2018-10-31 01:17:58 +01:00
this.catalyst = catalyst;
2018-10-18 13:34:37 +02:00
this.aura = aura;
this.time = time;
}
public static AltarRecipe forInput(ItemStack input) {
2018-10-22 00:14:52 +02:00
for (AltarRecipe recipe : RECIPES.values()) {
2018-10-18 13:34:37 +02:00
if (recipe.input.isItemEqual(input)) {
return recipe;
}
}
return null;
}
public AltarRecipe add() {
2018-10-22 00:14:52 +02:00
RECIPES.put(this.name, this);
2018-10-18 13:34:37 +02:00
return this;
}
}