Add registry for Binding rituals and add JEI support
This commit is contained in:
parent
a3b12cb7e2
commit
13d9cb4b5a
15 changed files with 298 additions and 93 deletions
|
@ -1,12 +1,16 @@
|
|||
package WayofTime.bloodmagic.api.registry;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.altar.AltarRecipe;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AltarRecipeRegistry {
|
||||
|
||||
@Getter
|
||||
|
@ -16,10 +20,68 @@ public class AltarRecipeRegistry {
|
|||
if (!recipes.containsValue(recipe))
|
||||
recipes.put(recipe.input, recipe);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
||||
}
|
||||
|
||||
public static AltarRecipe getRecipeForInput(ItemStack input) {
|
||||
return recipes.get(input);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public static class AltarRecipe {
|
||||
|
||||
public final int syphon, consumeRate, drainRate;
|
||||
public final boolean useTag;
|
||||
public final ItemStack input, output;
|
||||
public final EnumAltarTier minTier;
|
||||
|
||||
/**
|
||||
* Allows creation of a recipe for the {@link WayofTime.bloodmagic.block.BlockAltar} / {@link WayofTime.bloodmagic.tile.TileAltar}.
|
||||
* The output ItemStack is allowed to be null as some recipes do not contain an output. (Blood Orbs)
|
||||
*
|
||||
* @param input - The input ItemStack
|
||||
* @param output - The ItemStack obtained from the recipe
|
||||
* @param minTier - The minimum tier of Altar required
|
||||
* @param syphon - The amount of LP to syphon from the Altar
|
||||
* @param consumeRate - The rate at which LP is consumed during crafting
|
||||
* @param drainRate - The rate at which LP is drained during crafting
|
||||
* @param useTag -
|
||||
*/
|
||||
// public AltarRecipe(ItemStackWrapper input, @Nullable ItemStackWrapper output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag) {
|
||||
// this.input = input;
|
||||
// this.output = output;
|
||||
// this.minTier = minTier;
|
||||
// this.syphon = syphon;
|
||||
// this.consumeRate = consumeRate;
|
||||
// this.drainRate = drainRate;
|
||||
// this.useTag = useTag;
|
||||
// }
|
||||
//
|
||||
// public AltarRecipe(ItemStackWrapper input, ItemStackWrapper output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) {
|
||||
// this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
||||
// }
|
||||
//
|
||||
// public AltarRecipe(ItemStackWrapper input, EnumAltarTier minTier, int consumeRate, int drainRate) {
|
||||
// this(input, null, minTier, 0, consumeRate, drainRate);
|
||||
// }
|
||||
public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minTier = minTier;
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
this.useTag = useTag;
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) {
|
||||
this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate) {
|
||||
this(input, null, minTier, 0, consumeRate, drainRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package WayofTime.bloodmagic.api.registry;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BindingRecipeRegistry {
|
||||
|
||||
@Getter
|
||||
private static BiMap<ItemStack, BindingRecipe> recipes = HashBiMap.create();
|
||||
|
||||
public static void registerRecipe(BindingRecipe recipe) {
|
||||
if (!recipes.containsValue(recipe))
|
||||
recipes.put(recipe.getInput(), recipe);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding binding recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
||||
}
|
||||
|
||||
public static BindingRecipe getRecipeForInput(ItemStack input) {
|
||||
return recipes.get(input);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@RequiredArgsConstructor
|
||||
public static class BindingRecipe {
|
||||
|
||||
private final ItemStack input;
|
||||
private final ItemStack output;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue