Move API to it's own source set

This commit is contained in:
Nicholas Ignoffo 2018-02-14 23:37:23 -08:00
parent c03af41c88
commit 2afc235af7
11 changed files with 32 additions and 27 deletions

View file

@ -314,7 +314,7 @@ public class BloodAltar implements IFluidHandler {
if (progress >= liquidRequired * stackSize) {
ItemStack result = recipe.getOutput().copy();
BloodMagicCraftedEvent.Altar event = new BloodMagicCraftedEvent.Altar(recipe, result);
BloodMagicCraftedEvent.Altar event = new BloodMagicCraftedEvent.Altar(recipe.getInput(), result);
MinecraftForge.EVENT_BUS.post(event);
tileAltar.setInventorySlotContents(0, event.getOutput());
progress = 0;

View file

@ -1,16 +0,0 @@
package WayofTime.bloodmagic.api;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation lets Blood Magic detect mod plugins.
* All {@link IBloodMagicPlugin} must have this annotation and a constructor with no arguments.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface BloodMagicPlugin {
}

View file

@ -1,53 +0,0 @@
package WayofTime.bloodmagic.api;
import net.minecraft.block.state.IBlockState;
import javax.annotation.Nonnull;
/**
* The main interface between a plugin and Blood Magic's internals.
*/
public interface IBloodMagicAPI {
/**
* Retrieves the instance of the blacklist.
*
* @return the active {@link IBloodMagicBlacklist} instance
*/
@Nonnull
IBloodMagicBlacklist getBlacklist();
/**
* Retrieves the instance of the recipe registrar.
*
* @return the active {@link IBloodMagicRecipeRegistrar} instance
*/
@Nonnull
IBloodMagicRecipeRegistrar getRecipeRegistrar();
/**
* Retrieves the instance of the value manager.
*
* @return the active {@link IBloodMagicValueManager} instance
*/
@Nonnull
IBloodMagicValueManager getValueManager();
/**
* Registers an {@link IBlockState} as a given component for the Blood Altar.
*
* Valid component types:
* <ul>
* <li>GLOWSTONE</li>
* <li>BLOODSTONE</li>
* <li>BEACON</li>
* <li>BLOODRUNE</li>
* <li>CRYSTAL</li>
* <li>NOTAIR</li>
* </ul>
*
* @param state The state to register
* @param componentType The type of Blood Altar component to register as.
*/
void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType);
}

View file

@ -1,47 +0,0 @@
package WayofTime.bloodmagic.api;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
/**
* Allows blacklisting of various objects from different Blood Magic systems.
*/
public interface IBloodMagicBlacklist {
/**
* Blacklists a given {@link IBlockState} from being teleposed.
*
* @param state The {@link IBlockState} to blacklist.
*/
void addTeleposer(@Nonnull IBlockState state);
/**
* Blacklists a {@link net.minecraft.entity.Entity} from being teleposed based on the given registry name.
*
* @param entityId The registry name to blacklist.
*/
void addTeleposer(@Nonnull ResourceLocation entityId);
/**
* Blacklists a given {@link IBlockState} from being transposed.
*
* @param state The {@link IBlockState} to blacklist.
*/
void addTransposition(@Nonnull IBlockState state);
/**
* Blacklists a given {@link IBlockState} from being accelerated by the growth enhancement ritual and sigil.
*
* @param state The {@link IBlockState} to blacklist.
*/
void addGreenGrove(@Nonnull IBlockState state);
/**
* Blacklists a {@link net.minecraft.entity.Entity} from being sacrificed via the Well of Suffering ritual.
*
* @param entityId The registry name to blacklist.
*/
void addWellOfSuffering(@Nonnull ResourceLocation entityId);
}

View file

@ -1,15 +0,0 @@
package WayofTime.bloodmagic.api;
/**
* The main class to implement to create a Blood Magic plugin. Everything communicated between a mod and Blood Magic is through this class.
* IBloodMagicPlugins must have the {@link BloodMagicPlugin} annotation to get loaded by Blood Magic.
*/
public interface IBloodMagicPlugin {
/**
* Register mod content with the API
*
* @param api The active instance of the {@link IBloodMagicAPI}
*/
void register(IBloodMagicAPI api);
}

View file

@ -1,95 +0,0 @@
package WayofTime.bloodmagic.api;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Allows recipe addition and removal.
*/
public interface IBloodMagicRecipeRegistrar {
/**
* Adds a new recipe to the Blood Altar.
*
* @param input An input {@link Ingredient}.
* @param output An output {@link ItemStack}.
* @param minimumTier The minimum Blood Altar tier required for this recipe.
* @param syphon The amount of Life Essence to syphon from the Blood Altar over the course of the craft.
* @param consumeRate How quickly the Life Essence is syphoned.
* @param drainRate How quickly progress is lost if the Blood Altar runs out of Life Essence during the craft.
*/
void addBloodAltar(@Nonnull Ingredient input, @Nonnull ItemStack output, @Nonnegative int minimumTier, @Nonnegative int syphon, @Nonnegative int consumeRate, @Nonnegative int drainRate);
/**
* Removes a Blood Altar recipe based on an input {@link ItemStack}.
*
* @param input The input item to remove the recipe of.
*
* @return Whether or not a recipe was removed.
*/
boolean removeBloodAltar(@Nonnull ItemStack input);
/**
* Adds a new recipe to the Alchemy Table.
*
* @param output An output {@link ItemStack}.
* @param syphon The amount of Life Essence to syphon from the Blood Orb's bound network over the course of the craft.
* @param ticks The amount of ticks it takes to complete the craft.
* @param minimumTier The minimum Blood Orb tier required for this recipe.
* @param input An array of {@link Ingredient}s to accept as inputs.
*/
void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Ingredient... input);
/**
* Removes an Alchemy Table recipe based on an input {@link ItemStack} array.
*
* @param input The input items to remove the recipe of.
*
* @return Whether or not a recipe was removed.
*/
boolean removeAlchemyTable(@Nonnull ItemStack... input);
/**
* Adds a new recipe to the Soul/Tartaric Forge.
*
* @param output An output {@link ItemStack}.
* @param minimumSouls The minimum number of souls that must be contained in the Soul Gem.
* @param soulDrain The number of souls to drain from the Soul Gem.
* @param input An array of {@link Ingredient}s to accept as inputs.
*/
void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Ingredient... input);
/**
* Removes a Soul/Tartaric Forge recipe based on an input {@link ItemStack} array.
*
* @param input The input items to remove the recipe of.
*
* @return Whether or not a recipe was removed.
*/
boolean removeTartaricForge(@Nonnull ItemStack... input);
/**
* Adds a new recipe to the Alchemy Array.
*
* @param input An input {@link Ingredient}. First item put into the Alchemy Array.
* @param catalyst A catalyst {@link Ingredient}. Second item put into the Alchemy Array.
* @param output An output {@link ItemStack}.
* @param circleTexture The texture to render for the Alchemy Array circle.
*/
void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture);
/**
* Removes an Alchemy Array recipe based on an input {@link ItemStack} and it's catalyst {@link ItemStack}.
*
* @param input The input item to remove the recipe of.
* @param catalyst The catalyst item to remove the recipe of.
*
* @return Whether or not a recipe was removed.
*/
boolean removeAlchemyArray(@Nonnull ItemStack input, @Nonnull ItemStack catalyst);
}

View file

@ -1,42 +0,0 @@
package WayofTime.bloodmagic.api;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
/**
* Allows value modification for various features of Blood Magic such as Sacrificial values.
*/
public interface IBloodMagicValueManager {
/**
* Sets the amount of LP received per health point from sacrificing the given entity. By default, this is 25. Setting
* the value to 0 effectively disables sacrificing.
*
* @param entityId The registry name of the entity.
* @param value The amount of LP per health point to receive upon sacrifice.
*/
void setSacrificialValue(@Nonnull ResourceLocation entityId, @Nonnegative int value);
/**
* Sets the Tranquility value of a given {@link IBlockState}.
*
* Valid tranquility types:
* <ul>
* <li>PLANT</li>
* <li>CROP</li>
* <li>TREE</li>
* <li>EARTHEN</li>
* <li>WATER</li>
* <li>FIRE</li>
* <li>LAVA</li>
* </ul>
*
* @param state The {@link IBlockState} to set the value of.
* @param tranquilityType The type of Tranquility this block should provide.
* @param value The amount of tranquility this block should provide.
*/
void setTranquility(@Nonnull IBlockState state, @Nonnull String tranquilityType, double value);
}

View file

@ -1,49 +0,0 @@
package WayofTime.bloodmagic.api.event;
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.Event;
public class BloodMagicCraftedEvent extends Event {
private final boolean modifiable;
private ItemStack output;
public BloodMagicCraftedEvent(ItemStack output, boolean modifiable) {
this.modifiable = modifiable;
this.output = output;
}
public boolean isModifiable() {
return modifiable;
}
public ItemStack getOutput() {
return output;
}
public void setOutput(ItemStack output) {
if (isModifiable())
this.output = output;
}
/**
* Fired whenever a craft is completed in a BloodAltar.
* <p>
* It is not cancelable, however you can modify the output stack.
*/
public static class Altar extends BloodMagicCraftedEvent {
private final RecipeBloodAltar recipe;
public Altar(RecipeBloodAltar recipe, ItemStack output) {
super(output, true);
this.recipe = recipe;
}
public RecipeBloodAltar getRecipe() {
return recipe;
}
}
}

View file

@ -1,5 +0,0 @@
@API(owner = BloodMagic.MODID, provides = BloodMagic.MODID + "|api", apiVersion = "2.0.0")
package WayofTime.bloodmagic.api;
import WayofTime.bloodmagic.BloodMagic;
import net.minecraftforge.fml.common.API;