Creation of 1.16.3 branch
Initial publishing of the 1.16.3 branch of the mod. A lot of systems are missing (such as Rituals and Living Armour), but enough is present for a decent Alpha release.
This commit is contained in:
parent
0e02b983f1
commit
d617911d7a
1662 changed files with 18791 additions and 85075 deletions
|
@ -1,83 +1,101 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
package wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import WayofTime.bloodmagic.api.IBloodMagicAPI;
|
||||
import WayofTime.bloodmagic.altar.ComponentType;
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class BloodMagicAPI implements IBloodMagicAPI {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
private final BloodMagicBlacklist blacklist;
|
||||
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
||||
private final BloodMagicValueManager valueManager;
|
||||
private final Multimap<ComponentType, BlockState> altarComponents;
|
||||
import net.minecraft.block.BlockState;
|
||||
import wayoftime.bloodmagic.altar.ComponentType;
|
||||
import wayoftime.bloodmagic.api.IBloodMagicAPI;
|
||||
import wayoftime.bloodmagic.util.BMLog;
|
||||
|
||||
public BloodMagicAPI() {
|
||||
this.blacklist = new BloodMagicBlacklist();
|
||||
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
||||
this.valueManager = new BloodMagicValueManager();
|
||||
this.altarComponents = ArrayListMultimap.create();
|
||||
}
|
||||
public class BloodMagicAPI implements IBloodMagicAPI
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicBlacklist getBlacklist() {
|
||||
return blacklist;
|
||||
}
|
||||
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicRecipeRegistrar getRecipeRegistrar() {
|
||||
return recipeRegistrar;
|
||||
}
|
||||
// private final BloodMagicBlacklist blacklist;
|
||||
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
||||
// private final BloodMagicValueManager valueManager;
|
||||
private final Multimap<ComponentType, BlockState> altarComponents;
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicValueManager getValueManager() {
|
||||
return valueManager;
|
||||
}
|
||||
public BloodMagicAPI()
|
||||
{
|
||||
// this.blacklist = new BloodMagicBlacklist();
|
||||
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
||||
// this.valueManager = new BloodMagicValueManager();
|
||||
this.altarComponents = ArrayListMultimap.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAltarComponent(@Nonnull BlockState state, @Nonnull String componentType) {
|
||||
ComponentType component = null;
|
||||
for (ComponentType type : ComponentType.VALUES) {
|
||||
if (type.name().equalsIgnoreCase(componentType)) {
|
||||
component = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// @Nonnull
|
||||
// @Override
|
||||
// public BloodMagicBlacklist getBlacklist()
|
||||
// {
|
||||
// return blacklist;
|
||||
// }
|
||||
//
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicRecipeRegistrar getRecipeRegistrar()
|
||||
{
|
||||
return recipeRegistrar;
|
||||
}
|
||||
//
|
||||
// @Nonnull
|
||||
// @Override
|
||||
// public BloodMagicValueManager getValueManager()
|
||||
// {
|
||||
// return valueManager;
|
||||
// }
|
||||
|
||||
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);
|
||||
}
|
||||
@Override
|
||||
public void registerAltarComponent(@Nonnull BlockState state, @Nonnull String componentType)
|
||||
{
|
||||
ComponentType component = null;
|
||||
for (ComponentType type : ComponentType.VALUES)
|
||||
{
|
||||
if (type.name().equalsIgnoreCase(componentType))
|
||||
{
|
||||
component = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterAltarComponent(@Nonnull BlockState 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);
|
||||
}
|
||||
|
||||
if (component != null) {
|
||||
BMLog.API_VERBOSE.info("Unregistered {} from being a {} altar component.", state, componentType);
|
||||
altarComponents.remove(component, state);
|
||||
} else BMLog.API.warn("Invalid Altar component type: {}.", componentType);
|
||||
}
|
||||
@Override
|
||||
public void unregisterAltarComponent(@Nonnull BlockState state, @Nonnull String componentType)
|
||||
{
|
||||
ComponentType component = null;
|
||||
for (ComponentType type : ComponentType.VALUES)
|
||||
{
|
||||
if (type.name().equalsIgnoreCase(componentType))
|
||||
{
|
||||
component = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<BlockState> getComponentStates(ComponentType component) {
|
||||
return (List<BlockState>) altarComponents.get(component);
|
||||
}
|
||||
}
|
||||
if (component != null)
|
||||
{
|
||||
BMLog.API_VERBOSE.info("Unregistered {} from being a {} altar component.", state, componentType);
|
||||
altarComponents.remove(component, state);
|
||||
} else
|
||||
BMLog.API.warn("Invalid Altar component type: {}.", componentType);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<BlockState> getComponentStates(ComponentType component)
|
||||
{
|
||||
return (List<BlockState>) altarComponents.get(component);
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
|
||||
import WayofTime.bloodmagic.api.IBloodMagicBlacklist;
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
|
||||
public class BloodMagicBlacklist implements IBloodMagicBlacklist {
|
||||
|
||||
private final Set<BlockState> teleposer;
|
||||
private final Set<ResourceLocation> teleposerEntities;
|
||||
private final Set<BlockState> transposition;
|
||||
private final Set<BlockState> 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 BlockState 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 (BlockState 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 BlockState 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 (BlockState state : block.getBlockState().getValidStates())
|
||||
addTransposition(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGreenGrove(@Nonnull BlockState 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 (BlockState 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<BlockState> getTeleposer() {
|
||||
return ImmutableSet.copyOf(teleposer);
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getTeleposerEntities() {
|
||||
return ImmutableSet.copyOf(teleposerEntities);
|
||||
}
|
||||
|
||||
public Set<BlockState> getTransposition() {
|
||||
return ImmutableSet.copyOf(transposition);
|
||||
}
|
||||
|
||||
public Set<BlockState> getGreenGrove() {
|
||||
return ImmutableSet.copyOf(greenGrove);
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getSacrifice() {
|
||||
return ImmutableSet.copyOf(sacrifice);
|
||||
}
|
||||
}
|
|
@ -1,144 +1,29 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
package wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.altar.ComponentType;
|
||||
import WayofTime.bloodmagic.api.BloodMagicPlugin;
|
||||
import WayofTime.bloodmagic.api.IBloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.IBloodMagicPlugin;
|
||||
import WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import WayofTime.bloodmagic.block.BlockBloodRune;
|
||||
import WayofTime.bloodmagic.block.BlockDecorative;
|
||||
import WayofTime.bloodmagic.block.enums.BloodRuneType;
|
||||
import WayofTime.bloodmagic.block.enums.EnumDecorative;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicRecipes;
|
||||
import WayofTime.bloodmagic.incense.EnumTranquilityType;
|
||||
import WayofTime.bloodmagic.incense.TranquilityStack;
|
||||
import WayofTime.bloodmagic.util.StateUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import wayoftime.bloodmagic.altar.ComponentType;
|
||||
import wayoftime.bloodmagic.api.IBloodMagicAPI;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
|
||||
@BloodMagicPlugin
|
||||
public class BloodMagicCorePlugin implements IBloodMagicPlugin {
|
||||
public class BloodMagicCorePlugin
|
||||
{
|
||||
public static final BloodMagicCorePlugin INSTANCE = new BloodMagicCorePlugin();
|
||||
|
||||
@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"));
|
||||
public void register(IBloodMagicAPI apiInterface)
|
||||
{
|
||||
apiInterface.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
apiInterface.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
apiInterface.registerAltarComponent(Blocks.BEACON.getDefaultState(), ComponentType.BEACON.name());
|
||||
|
||||
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());
|
||||
|
||||
BlockDecorative decorative = (BlockDecorative) RegistrarBloodMagicBlocks.DECORATIVE_BRICK;
|
||||
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_BRICK), ComponentType.BLOODSTONE.name());
|
||||
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), ComponentType.BLOODSTONE.name());
|
||||
if (ConfigHandler.general.enableTierSixEvenThoughThereIsNoContent) {
|
||||
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());
|
||||
}
|
||||
|
||||
BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE;
|
||||
for (BloodRuneType runeType : BloodRuneType.values())
|
||||
api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), ComponentType.BLOODRUNE.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(StateUtil.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(StateUtil.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.BLANK_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.SPEED_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.SACRIFICE_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.SELF_SACRIFICE_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.DISPLACEMENT_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.CAPACITY_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.AUGMENTED_CAPACITY_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.ORB_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.ACCELERATION_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.CHARGING_RUNE.get().getDefaultState(), ComponentType.BLOODRUNE.name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,357 +1,448 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
package wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
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 WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeSacrificeCraft;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import WayofTime.bloodmagic.core.recipe.IngredientBloodOrb;
|
||||
import WayofTime.bloodmagic.orb.IBloodOrb;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.api.IBloodMagicRecipeRegistrar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import wayoftime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
|
||||
|
||||
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.");
|
||||
//
|
||||
// // TODO: Got to adda ResourceLocation argument.
|
||||
// altarRecipes.add(new IRecipeBloodAltar(null, input, output, minimumTier, 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(World world, @Nonnull ItemStack input)
|
||||
{
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
List<RecipeBloodAltar> altarRecipes = world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALTAR);
|
||||
|
||||
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(World world, @Nonnull List<ItemStack> input)
|
||||
{
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
List<RecipeTartaricForge> tartaricForgeRecipes = world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.TARTARICFORGE);
|
||||
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.test(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;
|
||||
// }
|
||||
//
|
||||
/**
|
||||
*
|
||||
* @param world
|
||||
* @param input
|
||||
* @param catalyst
|
||||
* @return If false and the recipe is nonnull, it is a partial match. If true,
|
||||
* the returned recipe is a full match.
|
||||
*/
|
||||
@Nullable
|
||||
public Pair<Boolean, RecipeAlchemyArray> getAlchemyArray(World world, @Nonnull ItemStack input, @Nonnull ItemStack catalyst)
|
||||
{
|
||||
Preconditions.checkNotNull(input, "input cannot be null.");
|
||||
if (input.isEmpty())
|
||||
return null;
|
||||
|
||||
List<RecipeAlchemyArray> altarRecipes = world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARRAY);
|
||||
|
||||
RecipeAlchemyArray partialMatch = null;
|
||||
for (RecipeAlchemyArray recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.getBaseInput().test(input))
|
||||
{
|
||||
if (recipe.getAddedInput().test(catalyst))
|
||||
{
|
||||
return Pair.of(true, recipe);
|
||||
} else if (partialMatch == null)
|
||||
{
|
||||
partialMatch = recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Pair.of(false, partialMatch);
|
||||
}
|
||||
|
||||
public Set<RecipeBloodAltar> getAltarRecipes(World world)
|
||||
{
|
||||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ALTAR));
|
||||
}
|
||||
|
||||
public Set<RecipeTartaricForge> getTartaricForgeRecipes(World world)
|
||||
{
|
||||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.TARTARICFORGE));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyArray> getAlchemyArrayRecipes(World world)
|
||||
{
|
||||
return ImmutableSet.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARRAY));
|
||||
}
|
||||
|
||||
public Set<RecipeAlchemyArray> getCraftingAlchemyArrayRecipes(World world)
|
||||
{
|
||||
Set<RecipeAlchemyArray> recipes = Set.copyOf(world.getRecipeManager().getRecipesForType(BloodMagicRecipeType.ARRAY));
|
||||
Set<RecipeAlchemyArray> copyRecipes = Set.of();
|
||||
for (RecipeAlchemyArray recipe : recipes)
|
||||
{
|
||||
if (!recipe.getOutput().isEmpty())
|
||||
{
|
||||
copyRecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
return copyRecipes;
|
||||
}
|
||||
|
||||
// public Set<RecipeAlchemyTable> getAlchemyRecipes()
|
||||
// {
|
||||
// return ImmutableSet.copyOf(alchemyRecipes);
|
||||
// }
|
||||
//
|
||||
// public Set<RecipeTartaricForge> getTartaricForgeRecipes()
|
||||
// {
|
||||
// return ImmutableSet.copyOf(tartaricForgeRecipes);
|
||||
// }
|
||||
//
|
||||
// public Set<RecipeAlchemyArray> getAlchemyArrayRecipes()
|
||||
// {
|
||||
// return ImmutableSet.copyOf(alchemyArrayRecipes);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
|
||||
import WayofTime.bloodmagic.api.IBloodMagicValueManager;
|
||||
import WayofTime.bloodmagic.incense.EnumTranquilityType;
|
||||
import WayofTime.bloodmagic.incense.TranquilityStack;
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
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<BlockState, TranquilityStack> tranquility;
|
||||
|
||||
public BloodMagicValueManager() {
|
||||
this.sacrificial = Maps.newHashMap();
|
||||
this.tranquility = Maps.newHashMap();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTranquility(@Nonnull BlockState 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);
|
||||
}
|
||||
|
||||
public void setTranquility(Block block, TranquilityStack tranquilityStack) {
|
||||
for (BlockState 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);
|
||||
}
|
||||
|
||||
public Map<BlockState, TranquilityStack> getTranquility() {
|
||||
return ImmutableMap.copyOf(tranquility);
|
||||
}
|
||||
}
|
|
@ -1,53 +1,87 @@
|
|||
package WayofTime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RecipeAlchemyArray {
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@Nonnull
|
||||
private final Ingredient input;
|
||||
@Nonnull
|
||||
private final Ingredient catalyst;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnull
|
||||
private final ResourceLocation circleTexture;
|
||||
public abstract class RecipeAlchemyArray extends BloodMagicRecipe
|
||||
{
|
||||
private final ResourceLocation id;
|
||||
private final ResourceLocation texture;
|
||||
@Nonnull
|
||||
private final Ingredient baseInput;
|
||||
@Nonnull
|
||||
private final Ingredient addedInput;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
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.");
|
||||
protected RecipeAlchemyArray(ResourceLocation id, ResourceLocation texture, @Nonnull Ingredient baseIngredient, @Nonnull Ingredient addedIngredient, @Nonnull ItemStack result)
|
||||
{
|
||||
super(id);
|
||||
this.id = id;
|
||||
this.texture = texture;
|
||||
this.baseInput = baseIngredient;
|
||||
this.addedInput = addedIngredient;
|
||||
this.output = result;
|
||||
}
|
||||
|
||||
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 final ResourceLocation getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getInput() {
|
||||
return input;
|
||||
}
|
||||
@Nonnull
|
||||
public final ResourceLocation getTexture()
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Ingredient getCatalyst() {
|
||||
return catalyst;
|
||||
}
|
||||
@Nonnull
|
||||
public final Ingredient getBaseInput()
|
||||
{
|
||||
return baseInput;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
@Nonnull
|
||||
public final Ingredient getAddedInput()
|
||||
{
|
||||
return addedInput;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ResourceLocation getCircleTexture() {
|
||||
return circleTexture;
|
||||
}
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getBaseInput());
|
||||
list.add(getAddedInput());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
if (texture != null)
|
||||
{
|
||||
buffer.writeBoolean(true);
|
||||
buffer.writeResourceLocation(texture);
|
||||
} else
|
||||
{
|
||||
buffer.writeBoolean(false);
|
||||
}
|
||||
|
||||
baseInput.write(buffer);
|
||||
addedInput.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
package 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;
|
||||
}
|
||||
}
|
|
@ -1,72 +1,104 @@
|
|||
package WayofTime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import WayofTime.bloodmagic.altar.AltarTier;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeBloodAltar {
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@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;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.altar.AltarTier;
|
||||
|
||||
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.MAXTIERS, "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.");
|
||||
public abstract class RecipeBloodAltar extends BloodMagicRecipe
|
||||
{
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumTier = AltarTier.values()[minimumTier];
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
}
|
||||
@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;
|
||||
|
||||
@Nonnull
|
||||
public final Ingredient getInput() {
|
||||
return input;
|
||||
}
|
||||
public RecipeBloodAltar(ResourceLocation id, @Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate)
|
||||
{
|
||||
super(id);
|
||||
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.MAXTIERS, "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.");
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumTier = AltarTier.values()[minimumTier];
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AltarTier getMinimumTier() {
|
||||
return minimumTier;
|
||||
}
|
||||
@Nonnull
|
||||
public final Ingredient getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getSyphon() {
|
||||
return syphon;
|
||||
}
|
||||
@Override
|
||||
public final NonNullList<Ingredient> getIngredients()
|
||||
{
|
||||
NonNullList<Ingredient> list = NonNullList.create();
|
||||
list.add(getInput());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getConsumeRate() {
|
||||
return consumeRate;
|
||||
}
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final int getDrainRate() {
|
||||
return drainRate;
|
||||
}
|
||||
}
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
input.write(buffer);
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeInt(minimumTier.ordinal());
|
||||
buffer.writeInt(syphon);
|
||||
buffer.writeInt(consumeRate);
|
||||
buffer.writeInt(drainRate);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package 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;
|
||||
}
|
||||
}
|
|
@ -1,53 +1,77 @@
|
|||
package WayofTime.bloodmagic.api.impl.recipe;
|
||||
package 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 java.util.List;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeTartaricForge {
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@Nonnull
|
||||
private final NonNullList<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final double minimumSouls;
|
||||
@Nonnegative
|
||||
private final double soulDrain;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
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.");
|
||||
public abstract class RecipeTartaricForge extends BloodMagicRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final List<Ingredient> input;
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
@Nonnegative
|
||||
private final double minimumSouls;
|
||||
@Nonnegative
|
||||
private final double soulDrain;
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumSouls = minimumSouls;
|
||||
this.soulDrain = soulDrain;
|
||||
}
|
||||
public RecipeTartaricForge(ResourceLocation id, @Nonnull List<Ingredient> input, @Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain)
|
||||
{
|
||||
super(id);
|
||||
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.");
|
||||
|
||||
@Nonnull
|
||||
public final NonNullList<Ingredient> getInput() {
|
||||
return input;
|
||||
}
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minimumSouls = minimumSouls;
|
||||
this.soulDrain = soulDrain;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
@Nonnull
|
||||
public final List<Ingredient> getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getMinimumSouls() {
|
||||
return minimumSouls;
|
||||
}
|
||||
@Nonnull
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getSoulDrain() {
|
||||
return soulDrain;
|
||||
}
|
||||
}
|
||||
@Nonnegative
|
||||
public final double getMinimumSouls()
|
||||
{
|
||||
return minimumSouls;
|
||||
}
|
||||
|
||||
@Nonnegative
|
||||
public final double getSoulDrain()
|
||||
{
|
||||
return soulDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer)
|
||||
{
|
||||
buffer.writeInt(input.size());
|
||||
for (int i = 0; i < input.size(); i++)
|
||||
{
|
||||
input.get(i).write(buffer);
|
||||
}
|
||||
buffer.writeItemStack(output);
|
||||
buffer.writeDouble(minimumSouls);
|
||||
buffer.writeDouble(soulDrain);
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue