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
80
src/main/java/wayoftime/bloodmagic/api/IBloodMagicAPI.java
Normal file
80
src/main/java/wayoftime/bloodmagic/api/IBloodMagicAPI.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
/**
|
||||
* The main interface between a plugin and Blood Magic's internals.
|
||||
*
|
||||
* This API is intended for <i>compatibility</i> between other mods and Blood
|
||||
* Magic. More advanced integration is out of the scope of this API and are
|
||||
* considered "addons".
|
||||
*
|
||||
* To get an instance of this without actually creating an
|
||||
* {@link IBloodMagicPlugin}, use {@link BloodMagicPlugin.Inject}.
|
||||
*/
|
||||
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.
|
||||
* <p>
|
||||
* 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 BlockState state, @Nonnull String componentType);
|
||||
|
||||
/**
|
||||
* Removes an {@link IBlockState} from the component mappings
|
||||
* <p>
|
||||
* 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 unregister
|
||||
* @param componentType The type of Blood Altar component to unregister from.
|
||||
*/
|
||||
void unregisterAltarComponent(@Nonnull BlockState state, @Nonnull String componentType);
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
//
|
||||
// void addSacrificeCraft(@Nonnull ItemStack output, @Nonnegative double healthRequired, @Nonnull Ingredient... input);
|
||||
//
|
||||
// boolean removeSacrificeCraft(@Nonnull ItemStack... input);
|
||||
}
|
60
src/main/java/wayoftime/bloodmagic/api/SerializerHelper.java
Normal file
60
src/main/java/wayoftime/bloodmagic/api/SerializerHelper.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
/**
|
||||
* Copied liberally from Mekanism. Thanks, pupnewfster!
|
||||
*
|
||||
*/
|
||||
public class SerializerHelper
|
||||
{
|
||||
private SerializerHelper()
|
||||
{
|
||||
}
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
|
||||
private static void validateKey(@Nonnull JsonObject json, @Nonnull String key)
|
||||
{
|
||||
if (!json.has(key))
|
||||
{
|
||||
throw new JsonSyntaxException("Missing '" + key + "', expected to find an object");
|
||||
}
|
||||
if (!json.get(key).isJsonObject())
|
||||
{
|
||||
throw new JsonSyntaxException("Expected '" + key + "' to be an object");
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(@Nonnull JsonObject json, @Nonnull String key)
|
||||
{
|
||||
validateKey(json, key);
|
||||
return ShapedRecipe.deserializeItem(JSONUtils.getJsonObject(json, key));
|
||||
}
|
||||
|
||||
public static JsonElement serializeItemStack(@Nonnull ItemStack stack)
|
||||
{
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty(Constants.JSON.ITEM, stack.getItem().getRegistryName().toString());
|
||||
if (stack.getCount() > 1)
|
||||
{
|
||||
json.addProperty(Constants.JSON.COUNT, stack.getCount());
|
||||
}
|
||||
if (stack.hasTag())
|
||||
{
|
||||
json.addProperty(Constants.JSON.NBT, stack.getTag().toString());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package wayoftime.bloodmagic.api.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class BloodMagicCraftedEvent extends Event
|
||||
{
|
||||
|
||||
private final boolean modifiable;
|
||||
private final ItemStack[] inputs;
|
||||
private ItemStack output;
|
||||
|
||||
public BloodMagicCraftedEvent(ItemStack output, ItemStack[] inputs, boolean modifiable)
|
||||
{
|
||||
this.modifiable = modifiable;
|
||||
this.inputs = inputs;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public boolean isModifiable()
|
||||
{
|
||||
return modifiable;
|
||||
}
|
||||
|
||||
public ItemStack[] getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public ItemStack getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
public void setOutput(ItemStack output)
|
||||
{
|
||||
if (isModifiable())
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in a Blood Altar.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class Altar extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public Altar(ItemStack output, ItemStack input)
|
||||
{
|
||||
super(output, new ItemStack[]
|
||||
{ input }, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in a Soul Forge.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class SoulForge extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public SoulForge(ItemStack output, ItemStack[] inputs)
|
||||
{
|
||||
super(output, inputs, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in an Alchemy Table.
|
||||
*
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public static class AlchemyTable extends BloodMagicCraftedEvent
|
||||
{
|
||||
|
||||
public AlchemyTable(ItemStack output, ItemStack[] inputs)
|
||||
{
|
||||
super(output, inputs, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package wayoftime.bloodmagic.api.impl.recipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.api.inventory.IgnoredIInventory;
|
||||
|
||||
public abstract class BloodMagicRecipe implements IRecipe<IgnoredIInventory>
|
||||
{
|
||||
private final ResourceLocation id;
|
||||
|
||||
protected BloodMagicRecipe(ResourceLocation id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes this recipe to a PacketBuffer.
|
||||
*
|
||||
* @param buffer The buffer to write to.
|
||||
*/
|
||||
public abstract void write(PacketBuffer buffer);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull IgnoredIInventory inv, @Nonnull World world)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic()
|
||||
{
|
||||
// Note: If we make this non dynamic, we can make it show in vanilla's crafting
|
||||
// book and also then obey the recipe locking.
|
||||
// For now none of that works/makes sense in our concept so don't lock it
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult(@Nonnull IgnoredIInventory inv)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package wayoftime.bloodmagic.api.inventory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public final class IgnoredIInventory implements IInventory
|
||||
{
|
||||
public static final IgnoredIInventory INSTANCE = new IgnoredIInventory();
|
||||
|
||||
private IgnoredIInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int index)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, @Nonnull ItemStack stack)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsableByPlayer(@Nonnull PlayerEntity player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package wayoftime.bloodmagic.api.providers;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.api.text.IHasTextComponent;
|
||||
import wayoftime.bloodmagic.api.text.IHasTranslationKey;
|
||||
|
||||
public interface IBaseProvider extends IHasTextComponent, IHasTranslationKey
|
||||
{
|
||||
ResourceLocation getRegistryName();
|
||||
|
||||
default String getName()
|
||||
{
|
||||
return getRegistryName().getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITextComponent getTextComponent()
|
||||
{
|
||||
return new TranslationTextComponent(getTranslationKey());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package wayoftime.bloodmagic.api.providers;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public interface IEntityTypeProvider extends IBaseProvider
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
EntityType<?> getEntityType();
|
||||
|
||||
@Override
|
||||
default ResourceLocation getRegistryName()
|
||||
{
|
||||
return getEntityType().getRegistryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
default ITextComponent getTextComponent()
|
||||
{
|
||||
return getEntityType().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
default String getTranslationKey()
|
||||
{
|
||||
return getEntityType().getTranslationKey();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package wayoftime.bloodmagic.api.text;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public interface IHasTextComponent
|
||||
{
|
||||
ITextComponent getTextComponent();
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package wayoftime.bloodmagic.api.text;
|
||||
|
||||
public interface IHasTranslationKey
|
||||
{
|
||||
String getTranslationKey();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue