Initial commit for 3.0
The altar mostly works. Sigils exist. Orbs exist. Living Armor framework exists. Probably some other things.
This commit is contained in:
parent
ecebe75f33
commit
26af9d5c6d
1764 changed files with 7049 additions and 90817 deletions
|
@ -0,0 +1,67 @@
|
|||
package com.wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicAPI;
|
||||
import com.wayoftime.bloodmagic.core.type.ComponentType;
|
||||
import com.wayoftime.bloodmagic.core.util.BMLog;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class BloodMagicAPI implements IBloodMagicAPI {
|
||||
|
||||
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
|
||||
|
||||
private final BloodMagicBlacklist blacklist;
|
||||
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
||||
private final BloodMagicValueManager valueManager;
|
||||
private final Multimap<ComponentType, IBlockState> altarComponents;
|
||||
|
||||
public BloodMagicAPI() {
|
||||
this.blacklist = new BloodMagicBlacklist();
|
||||
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
||||
this.valueManager = new BloodMagicValueManager();
|
||||
this.altarComponents = ArrayListMultimap.create();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicBlacklist getBlacklist() {
|
||||
return blacklist;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicRecipeRegistrar getRecipeRegistrar() {
|
||||
return recipeRegistrar;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicValueManager getValueManager() {
|
||||
return valueManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) {
|
||||
ComponentType component = null;
|
||||
for (ComponentType type : ComponentType.VALUES) {
|
||||
if (type.name().equalsIgnoreCase(componentType)) {
|
||||
component = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (component != null) {
|
||||
BMLog.API_VERBOSE.info("Registered {} as a {} altar component.", state, componentType);
|
||||
altarComponents.put(component, state);
|
||||
} else BMLog.API.warn("Invalid Altar component type: {}.", componentType);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<IBlockState> getComponentStates(ComponentType component) {
|
||||
return (List<IBlockState>) altarComponents.get(component);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicBlacklist;
|
||||
import com.wayoftime.bloodmagic.core.util.BMLog;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
|
||||
public class BloodMagicBlacklist implements IBloodMagicBlacklist {
|
||||
|
||||
private final Set<IBlockState> teleposer;
|
||||
private final Set<ResourceLocation> teleposerEntities;
|
||||
private final Set<IBlockState> transposition;
|
||||
private final Set<IBlockState> greenGrove;
|
||||
private final Set<ResourceLocation> sacrifice;
|
||||
|
||||
public BloodMagicBlacklist() {
|
||||
this.teleposer = Sets.newHashSet();
|
||||
this.teleposerEntities = Sets.newHashSet();
|
||||
this.transposition = Sets.newHashSet();
|
||||
this.greenGrove = Sets.newHashSet();
|
||||
this.sacrifice = Sets.newHashSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeleposer(@Nonnull IBlockState state) {
|
||||
if (!teleposer.contains(state)) {
|
||||
BMLog.API_VERBOSE.info("Blacklist: Added {} to the Teleposer blacklist.", state);
|
||||
teleposer.add(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void addTeleposer(@Nonnull Block block) {
|
||||
for (IBlockState state : block.getBlockState().getValidStates())
|
||||
addTeleposer(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeleposer(@Nonnull ResourceLocation entityId) {
|
||||
if (!teleposerEntities.contains(entityId)) {
|
||||
BMLog.API_VERBOSE.info("Blacklist: Added {} to the Teleposer blacklist.", entityId);
|
||||
teleposerEntities.add(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTransposition(@Nonnull IBlockState state) {
|
||||
if (!transposition.contains(state)) {
|
||||
BMLog.API_VERBOSE.info("Blacklist: Added {} to the Transposition blacklist.", state);
|
||||
transposition.add(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void addTransposition(@Nonnull Block block) {
|
||||
for (IBlockState state : block.getBlockState().getValidStates())
|
||||
addTransposition(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGreenGrove(@Nonnull IBlockState state) {
|
||||
if (!greenGrove.contains(state)) {
|
||||
BMLog.API_VERBOSE.info("Blacklist: Added {} to the Green Grove blacklist.", state);
|
||||
greenGrove.add(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void addGreenGrove(@Nonnull Block block) {
|
||||
for (IBlockState state : block.getBlockState().getValidStates())
|
||||
addGreenGrove(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWellOfSuffering(@Nonnull ResourceLocation entityId) {
|
||||
if (!sacrifice.contains(entityId)) {
|
||||
BMLog.API_VERBOSE.info("Blacklist: Added {} to the Well of Suffering blacklist.", entityId);
|
||||
sacrifice.add(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
// Internal use getters
|
||||
|
||||
public Set<IBlockState> getTeleposer() {
|
||||
return ImmutableSet.copyOf(teleposer);
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getTeleposerEntities() {
|
||||
return ImmutableSet.copyOf(teleposerEntities);
|
||||
}
|
||||
|
||||
public Set<IBlockState> getTransposition() {
|
||||
return ImmutableSet.copyOf(transposition);
|
||||
}
|
||||
|
||||
public Set<IBlockState> getGreenGrove() {
|
||||
return ImmutableSet.copyOf(greenGrove);
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getSacrifice() {
|
||||
return ImmutableSet.copyOf(sacrifice);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
package com.wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import com.wayoftime.bloodmagic.BloodMagic;
|
||||
import com.wayoftime.bloodmagic.api.BloodMagicPlugin;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicAPI;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicPlugin;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import com.wayoftime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import com.wayoftime.bloodmagic.core.RegistrarBloodMagicRecipes;
|
||||
import com.wayoftime.bloodmagic.core.type.ComponentType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
@BloodMagicPlugin
|
||||
public class BloodMagicCorePlugin implements IBloodMagicPlugin {
|
||||
|
||||
@Override
|
||||
public void register(IBloodMagicAPI apiInterface) {
|
||||
BloodMagicAPI api = (BloodMagicAPI) apiInterface;
|
||||
// Add forced blacklistings
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
|
||||
// api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
|
||||
// api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
|
||||
api.getBlacklist().addWellOfSuffering(new ResourceLocation("armor_stand"));
|
||||
api.getBlacklist().addWellOfSuffering(new ResourceLocation(BloodMagic.MODID, "sentient_specter"));
|
||||
|
||||
api.getValueManager().setSacrificialValue(new ResourceLocation("armor_stand"), 0);
|
||||
api.getValueManager().setSacrificialValue(new ResourceLocation(BloodMagic.MODID, "sentient_specter"), 0);
|
||||
|
||||
// api.getValueManager().setTranquility(Blocks.LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
|
||||
// api.getValueManager().setTranquility(Blocks.FLOWING_LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
|
||||
// api.getValueManager().setTranquility(Blocks.WATER, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.FLOWING_WATER, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
|
||||
// api.getValueManager().setTranquility(RegistrarBloodMagicBlocks.LIFE_ESSENCE, new TranquilityStack(EnumTranquilityType.WATER, 1.5D));
|
||||
// api.getValueManager().setTranquility(Blocks.NETHERRACK, new TranquilityStack(EnumTranquilityType.FIRE, 0.5D));
|
||||
// api.getValueManager().setTranquility(Blocks.DIRT, new TranquilityStack(EnumTranquilityType.EARTHEN, 0.25D));
|
||||
// api.getValueManager().setTranquility(Blocks.FARMLAND, new TranquilityStack(EnumTranquilityType.EARTHEN, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.POTATOES, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.CARROTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.WHEAT, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.NETHER_WART, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.BEETROOTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
|
||||
handleConfigValues(api);
|
||||
|
||||
// Add standard blocks for altar components
|
||||
api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
api.registerAltarComponent(Blocks.BEACON.getDefaultState(), ComponentType.BEACON.name());
|
||||
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOODSTONE_BRICK.getDefaultState(), ComponentType.BLOODSTONE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOODSTONE_TILE.getDefaultState(), ComponentType.BLOODSTONE.name());
|
||||
// api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), ComponentType.CRYSTAL.name());
|
||||
// api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), ComponentType.CRYSTAL.name());
|
||||
|
||||
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_BLANK.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_ACCELERATION.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_CAPACITY.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_AUGMENTED_CAPACITY.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_CHARGING.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_DISPLACEMENT.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_EFFICIENCY.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_ORB.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_SACRIFICE.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_SELF_SACRIFICE.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
api.registerAltarComponent(RegistrarBloodMagicBlocks.BLOOD_RUNE_SPEED.getDefaultState(), ComponentType.BLOOD_RUNE.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRecipes(IBloodMagicRecipeRegistrar recipeRegistrar) {
|
||||
RegistrarBloodMagicRecipes.registerAltarRecipes((BloodMagicRecipeRegistrar) recipeRegistrar);
|
||||
// RegistrarBloodMagicRecipes.registerAlchemyTableRecipes((BloodMagicRecipeRegistrar) recipeRegistrar);
|
||||
// RegistrarBloodMagicRecipes.registerTartaricForgeRecipes((BloodMagicRecipeRegistrar) recipeRegistrar);
|
||||
// RegistrarBloodMagicRecipes.registerAlchemyArrayRecipes((BloodMagicRecipeRegistrar) recipeRegistrar);
|
||||
// RegistrarBloodMagicRecipes.registerSacrificeCraftRecipes((BloodMagicRecipeRegistrar) recipeRegistrar);
|
||||
}
|
||||
|
||||
private static void handleConfigValues(BloodMagicAPI api) {
|
||||
// for (String value : ConfigHandler.values.sacrificialValues)
|
||||
// {
|
||||
// String[] split = value.split(";");
|
||||
// if (split.length != 2) // Not valid format
|
||||
// continue;
|
||||
//
|
||||
// api.getValueManager().setSacrificialValue(new ResourceLocation(split[0]), Integer.parseInt(split[1]));
|
||||
// }
|
||||
//
|
||||
// for (String value : ConfigHandler.blacklist.teleposer)
|
||||
// {
|
||||
// EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value));
|
||||
// if (entityEntry == null)
|
||||
// { // It's not an entity (or at least not a valid one), so let's try a block.
|
||||
// String[] blockData = value.split("\\[");
|
||||
// Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0]));
|
||||
// if (block == Blocks.AIR || block == null) // Not a valid block either
|
||||
// continue;
|
||||
//
|
||||
// if (blockData.length > 1)
|
||||
// { // We have properties listed, so let's build a state.
|
||||
// api.getBlacklist().addTeleposer(parseState(value));
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// api.getBlacklist().addTeleposer(block);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// api.getBlacklist().addTeleposer(entityEntry.getRegistryName());
|
||||
// }
|
||||
//
|
||||
// for (String value : ConfigHandler.blacklist.transposer)
|
||||
// {
|
||||
// String[] blockData = value.split("\\[");
|
||||
// Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockData[0]));
|
||||
// if (block == Blocks.AIR || block == null) // Not a valid block
|
||||
// continue;
|
||||
//
|
||||
// if (blockData.length > 1)
|
||||
// { // We have properties listed, so let's build a state.
|
||||
// api.getBlacklist().addTeleposer(parseState(value));
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// api.getBlacklist().addTeleposer(block);
|
||||
// }
|
||||
//
|
||||
// for (String value : ConfigHandler.blacklist.wellOfSuffering)
|
||||
// {
|
||||
// EntityEntry entityEntry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(value));
|
||||
// if (entityEntry == null) // Not a valid entity
|
||||
// continue;
|
||||
//
|
||||
// api.getBlacklist().addWellOfSuffering(entityEntry.getRegistryName());
|
||||
// }
|
||||
}
|
||||
|
||||
private static IBlockState parseState(String blockInfo) {
|
||||
String[] split = blockInfo.split("\\[");
|
||||
split[1] = split[1].substring(0, split[1].lastIndexOf("]")); // Make sure brackets are removed from state
|
||||
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(split[0])); // Find the block
|
||||
if (block == Blocks.AIR)
|
||||
return Blocks.AIR.getDefaultState(); // The block is air, so we're looking at invalid data
|
||||
|
||||
BlockStateContainer blockState = block.getBlockState();
|
||||
IBlockState returnState = blockState.getBaseState();
|
||||
|
||||
// Force our values into the state
|
||||
String[] stateValues = split[1].split(","); // Splits up each value
|
||||
for (String value : stateValues) {
|
||||
String[] valueSplit = value.split("="); // Separates property and value
|
||||
IProperty property = blockState.getProperty(valueSplit[0]);
|
||||
if (property != null)
|
||||
returnState = returnState.withProperty(property, (Comparable) property.parseValue(valueSplit[1]).get()); // Force the property into the state
|
||||
}
|
||||
|
||||
return returnState;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,357 @@
|
|||
package com.wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import com.wayoftime.bloodmagic.api.impl.recipe.*;
|
||||
import com.wayoftime.bloodmagic.core.altar.AltarTier;
|
||||
import com.wayoftime.bloodmagic.core.network.IBloodOrb;
|
||||
import com.wayoftime.bloodmagic.core.recipe.IngredientBloodOrb;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class BloodMagicRecipeRegistrar implements IBloodMagicRecipeRegistrar {
|
||||
|
||||
private final Set<RecipeBloodAltar> altarRecipes;
|
||||
private final Set<RecipeAlchemyTable> alchemyRecipes;
|
||||
private final Set<RecipeTartaricForge> tartaricForgeRecipes;
|
||||
private final Set<RecipeAlchemyArray> alchemyArrayRecipes;
|
||||
private final Set<RecipeSacrificeCraft> sacrificeCraftRecipes;
|
||||
|
||||
public BloodMagicRecipeRegistrar() {
|
||||
this.altarRecipes = Sets.newHashSet();
|
||||
this.alchemyRecipes = Sets.newHashSet();
|
||||
this.tartaricForgeRecipes = Sets.newHashSet();
|
||||
this.alchemyArrayRecipes = Sets.newHashSet();
|
||||
this.sacrificeCraftRecipes = Sets.newHashSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative.");
|
||||
Preconditions.checkArgument(drainRate >= 0, "drainRate cannot be negative.");
|
||||
|
||||
altarRecipes.add(new RecipeBloodAltar(input, output, minimumTier, syphon, consumeRate, drainRate));
|
||||
}
|
||||
|
||||
public void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnull AltarTier tier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate) {
|
||||
addBloodAltar(input, output, tier.ordinal(), syphon, consumeRate, drainRate);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean removeBloodAltar(@Nonnull ItemStack input) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
return altarRecipes.remove(getBloodAltar(input));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
|
||||
alchemyRecipes.add(new RecipeAlchemyTable(inputs, output, syphon, ticks, minimumTier));
|
||||
}
|
||||
|
||||
public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Object... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
List<Ingredient> ingredients = Lists.newArrayList();
|
||||
for (Object object : input) {
|
||||
if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) {
|
||||
ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object)));
|
||||
continue;
|
||||
}
|
||||
|
||||
ingredients.add(CraftingHelper.getIngredient(object));
|
||||
}
|
||||
|
||||
addAlchemyTable(output, syphon, ticks, minimumTier, ingredients.toArray(new Ingredient[0]));
|
||||
}
|
||||
|
||||
public void addAlchemyTable(RecipeAlchemyTable recipe) {
|
||||
alchemyRecipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAlchemyTable(@Nonnull ItemStack... input) {
|
||||
Preconditions.checkNotNull(input, "inputs cannot be null.");
|
||||
|
||||
for (ItemStack stack : input)
|
||||
Preconditions.checkNotNull(stack, "input cannot be null.");
|
||||
|
||||
return alchemyRecipes.remove(getAlchemyTable(Lists.newArrayList(input)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
|
||||
Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
|
||||
tartaricForgeRecipes.add(new RecipeTartaricForge(inputs, output, minimumSouls, soulDrain));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeTartaricForge(@Nonnull ItemStack... input) {
|
||||
Preconditions.checkNotNull(input, "inputs cannot be null.");
|
||||
|
||||
for (ItemStack stack : input)
|
||||
Preconditions.checkNotNull(stack, "input cannot be null.");
|
||||
|
||||
return tartaricForgeRecipes.remove(getTartaricForge(Lists.newArrayList(input)));
|
||||
}
|
||||
|
||||
public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Object... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
|
||||
Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
List<Ingredient> ingredients = Lists.newArrayList();
|
||||
for (Object object : input) {
|
||||
if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) {
|
||||
ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object)));
|
||||
continue;
|
||||
}
|
||||
|
||||
ingredients.add(CraftingHelper.getIngredient(object));
|
||||
}
|
||||
|
||||
addTartaricForge(output, minimumSouls, soulDrain, ingredients.toArray(new Ingredient[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(catalyst, "catalyst cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
|
||||
alchemyArrayRecipes.add(new RecipeAlchemyArray(input, catalyst, output, circleTexture));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(catalyst, "catalyst cannot be null.");
|
||||
|
||||
return alchemyArrayRecipes.remove(getAlchemyArray(input, catalyst));
|
||||
}
|
||||
|
||||
public void addAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(catalyst, "catalyst cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
|
||||
addAlchemyArray(Ingredient.fromStacks(input), Ingredient.fromStacks(catalyst), output, circleTexture);
|
||||
}
|
||||
|
||||
public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Object... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
List<Ingredient> ingredients = Lists.newArrayList();
|
||||
for (Object object : input) {
|
||||
if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) {
|
||||
ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object)));
|
||||
continue;
|
||||
}
|
||||
|
||||
ingredients.add(CraftingHelper.getIngredient(object));
|
||||
}
|
||||
|
||||
addSacrificeCraft(output, healthRequired, ingredients.toArray(new Ingredient[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeSacrificeCraft(@Nonnull ItemStack... input) {
|
||||
Preconditions.checkNotNull(input, "inputs cannot be null.");
|
||||
|
||||
for (ItemStack stack : input)
|
||||
Preconditions.checkNotNull(stack, "input cannot be null.");
|
||||
|
||||
return sacrificeCraftRecipes.remove(getSacrificeCraft(Lists.newArrayList(input)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input) {
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative.");
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
|
||||
NonNullList<Ingredient> inputs = NonNullList.from(Ingredient.EMPTY, input);
|
||||
sacrificeCraftRecipes.add(new RecipeSacrificeCraft(inputs, output, healthRequired));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeBloodAltar getBloodAltar(@Nonnull ItemStack input) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
for (RecipeBloodAltar recipe : altarRecipes)
|
||||
if (recipe.getInput().test(input))
|
||||
return recipe;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeAlchemyTable getAlchemyTable(@Nonnull List<ItemStack> input) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
mainLoop:
|
||||
for (RecipeAlchemyTable recipe : alchemyRecipes) {
|
||||
if (recipe.getInput().size() != input.size())
|
||||
continue;
|
||||
|
||||
List<Ingredient> recipeInput = new ArrayList<>(recipe.getInput());
|
||||
|
||||
for (int i = 0; i < input.size(); i++) {
|
||||
boolean matched = false;
|
||||
for (int j = 0; j < recipeInput.size(); j++) {
|
||||
Ingredient ingredient = recipeInput.get(j);
|
||||
if (ingredient.apply(input.get(i))) {
|
||||
matched = true;
|
||||
recipeInput.remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeTartaricForge getTartaricForge(@Nonnull List<ItemStack> input) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
mainLoop:
|
||||
for (RecipeTartaricForge recipe : tartaricForgeRecipes) {
|
||||
if (recipe.getInput().size() != input.size())
|
||||
continue;
|
||||
|
||||
List<Ingredient> recipeInput = new ArrayList<>(recipe.getInput());
|
||||
|
||||
for (int i = 0; i < input.size(); i++) {
|
||||
boolean matched = false;
|
||||
for (int j = 0; j < recipeInput.size(); j++) {
|
||||
Ingredient ingredient = recipeInput.get(j);
|
||||
if (ingredient.apply(input.get(i))) {
|
||||
matched = true;
|
||||
recipeInput.remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeSacrificeCraft getSacrificeCraft(@Nonnull List<ItemStack> input) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
mainLoop:
|
||||
for (RecipeSacrificeCraft recipe : sacrificeCraftRecipes) {
|
||||
if (recipe.getInput().size() != input.size())
|
||||
continue;
|
||||
|
||||
List<Ingredient> recipeInput = new ArrayList<>(recipe.getInput());
|
||||
|
||||
for (int i = 0; i < input.size(); i++) {
|
||||
boolean matched = false;
|
||||
for (int j = 0; j < recipeInput.size(); j++) {
|
||||
Ingredient ingredient = recipeInput.get(j);
|
||||
if (ingredient.apply(input.get(i))) {
|
||||
matched = true;
|
||||
recipeInput.remove(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
continue mainLoop;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RecipeAlchemyArray getAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
for (RecipeAlchemyArray recipe : alchemyArrayRecipes)
|
||||
if (recipe.getInput().test(input) && recipe.getCatalyst().test(catalyst))
|
||||
return recipe;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<RecipeBloodAltar> getAltarRecipes() {
|
||||
return ImmutableSet.copyOf(altarRecipes);
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyTable> getAlchemyRecipes() {
|
||||
return ImmutableSet.copyOf(alchemyRecipes);
|
||||
}
|
||||
|
||||
public Set<RecipeTartaricForge> getTartaricForgeRecipes() {
|
||||
return ImmutableSet.copyOf(tartaricForgeRecipes);
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyArray> getAlchemyArrayRecipes() {
|
||||
return ImmutableSet.copyOf(alchemyArrayRecipes);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.wayoftime.bloodmagic.api.IBloodMagicValueManager;
|
||||
import com.wayoftime.bloodmagic.core.util.BMLog;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
public class BloodMagicValueManager implements IBloodMagicValueManager {
|
||||
|
||||
private final Map<ResourceLocation, Integer> sacrificial;
|
||||
// private final Map<IBlockState, TranquilityStack> tranquility; // TODO - Tranquility
|
||||
|
||||
public BloodMagicValueManager() {
|
||||
this.sacrificial = Maps.newHashMap();
|
||||
// this.tranquility = Maps.newHashMap(); // TODO - Tranquility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSacrificialValue(@Nonnull ResourceLocation entityId, int value) {
|
||||
BMLog.API_VERBOSE.info("Value Manager: Set sacrificial value of {} to {}.", entityId, value);
|
||||
sacrificial.put(entityId, value);
|
||||
}
|
||||
|
||||
// TODO - Tranquility
|
||||
@Override
|
||||
public void setTranquility(@Nonnull IBlockState state, @Nonnull String tranquilityType, double value) {
|
||||
// EnumTranquilityType tranquility = null;
|
||||
// for (EnumTranquilityType type : EnumTranquilityType.values()) {
|
||||
// if (type.name().equalsIgnoreCase(tranquilityType)) {
|
||||
// tranquility = type;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (tranquility != null) {
|
||||
// BMLog.API_VERBOSE.info("Value Manager: Set tranquility value of {} to {} @ {}", state, tranquilityType, value);
|
||||
// this.tranquility.put(state, new TranquilityStack(tranquility, value));
|
||||
// } else BMLog.API.warn("Invalid tranquility type: {}.", tranquilityType);
|
||||
}
|
||||
|
||||
// TODO - Tranquility
|
||||
// public void setTranquility(Block block, TranquilityStack tranquilityStack) {
|
||||
// for (IBlockState state : block.getBlockState().getValidStates()) {
|
||||
// BMLog.API_VERBOSE.info("Value Manager: Set tranquility value of {} to {} @ {}", state, tranquilityStack.type, tranquilityStack.value);
|
||||
// tranquility.put(state, tranquilityStack);
|
||||
// }
|
||||
// }
|
||||
|
||||
public Map<ResourceLocation, Integer> getSacrificial() {
|
||||
return ImmutableMap.copyOf(sacrificial);
|
||||
}
|
||||
|
||||
// TODO - Tranquility
|
||||
// public Map<IBlockState, TranquilityStack> getTranquility() {
|
||||
// return ImmutableMap.copyOf(tranquility);
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.wayoftime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RecipeAlchemyArray {
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final Ingredient catalyst;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnull
|
||||
private final ResourceLocation circleTexture;
|
||||
|
||||
public RecipeAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(catalyst, "catalyst cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
|
||||
this.input = input;
|
||||
this.catalyst = catalyst;
|
||||
this.output = output;
|
||||
this.circleTexture = circleTexture == null ? new ResourceLocation(BloodMagic.MODID, "textures/models/AlchemyArrays/WIPArray.png") : circleTexture;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getCatalyst() {
|
||||
return catalyst;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ResourceLocation getCircleTexture() {
|
||||
return circleTexture;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeAlchemyTable {
|
||||
|
||||
@Nonnull
|
||||
private final NonNullList<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final int syphon;
|
||||
@Nonnegative
|
||||
private final int ticks;
|
||||
@Nonnegative
|
||||
private final int minimumTier;
|
||||
|
||||
public RecipeAlchemyTable(@Nonnull NonNullList<Ingredient> input, @Nonnull ItemStack output, int syphon, int ticks, int minimumTier) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.syphon = syphon;
|
||||
this.ticks = ticks;
|
||||
this.minimumTier = minimumTier;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final NonNullList<Ingredient> getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public final int getSyphon() {
|
||||
return syphon;
|
||||
}
|
||||
|
||||
public final int getTicks() {
|
||||
return ticks;
|
||||
}
|
||||
|
||||
public final int getMinimumTier() {
|
||||
return minimumTier;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.wayoftime.bloodmagic.core.altar.AltarTier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeBloodAltar {
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnull
|
||||
private final AltarTier minimumTier;
|
||||
@Nonnegative
|
||||
private final int syphon;
|
||||
@Nonnegative
|
||||
private final int consumeRate;
|
||||
@Nonnegative
|
||||
private final int drainRate;
|
||||
|
||||
public RecipeBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
|
||||
Preconditions.checkArgument(minimumTier <= AltarTier.values().length, "minimumTier cannot be higher than max tier");
|
||||
Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
|
||||
Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative.");
|
||||
Preconditions.checkArgument(drainRate >= 0, "drain cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumTier = AltarTier.values()[minimumTier];
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AltarTier getMinimumTier() {
|
||||
return minimumTier;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getSyphon() {
|
||||
return syphon;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getConsumeRate() {
|
||||
return consumeRate;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getDrainRate() {
|
||||
return drainRate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeSacrificeCraft {
|
||||
@Nonnull
|
||||
private final NonNullList<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final double healthRequired;
|
||||
|
||||
public RecipeSacrificeCraft(@Nonnull NonNullList<Ingredient> input, @Nonnull ItemStack output, @Nonnegative double healthRequired) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(healthRequired >= 0, "healthRequired cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.healthRequired = healthRequired;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final NonNullList<Ingredient> getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getHealthRequired() {
|
||||
return healthRequired;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeTartaricForge {
|
||||
|
||||
@Nonnull
|
||||
private final NonNullList<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final double minimumSouls;
|
||||
@Nonnegative
|
||||
private final double soulDrain;
|
||||
|
||||
public RecipeTartaricForge(@Nonnull NonNullList<Ingredient> input, @Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain) {
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
Preconditions.checkNotNull(output, "output cannot be null.");
|
||||
Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
|
||||
Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumSouls = minimumSouls;
|
||||
this.soulDrain = soulDrain;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final NonNullList<Ingredient> getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getMinimumSouls() {
|
||||
return minimumSouls;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getSoulDrain() {
|
||||
return soulDrain;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue