this doesn't compile yet, but have something to peek at

This commit is contained in:
Nicholas Ignoffo 2017-08-14 20:53:42 -07:00
parent 973f1019a5
commit 5fcdd978d7
329 changed files with 3247 additions and 2953 deletions

View file

@ -1,15 +1,11 @@
package WayofTime.bloodmagic.api;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@Getter
@EqualsAndHashCode(exclude = { "state" })
public class BlockStack
{
private final Block block;
@ -39,6 +35,36 @@ public class BlockStack
return new ItemStack(block, 1, meta);
}
public Block getBlock() {
return block;
}
public int getMeta() {
return meta;
}
public IBlockState getState() {
return state;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BlockStack)) return false;
BlockStack that = (BlockStack) o;
if (meta != that.meta) return false;
return block != null ? block.equals(that.block) : that.block == null;
}
@Override
public int hashCode() {
int result = block != null ? block.hashCode() : 0;
result = 31 * result + meta;
return result;
}
@Override
public String toString()
{

View file

@ -1,9 +1,8 @@
package WayofTime.bloodmagic.api;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.api.util.helper.LogHelper;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -35,38 +34,27 @@ import java.util.Map;
*/
public class BloodMagicAPI
{
@Getter
private static final List<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
@Getter
private static final List<BlockStack> transpositionBlacklist = new ArrayList<BlockStack>();
@Getter
private static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
@Getter
private static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
@Getter
private static final Map<IBlockState, EnumAltarComponent> altarComponents = new HashMap<IBlockState, EnumAltarComponent>();
public static final List<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
public static final List<BlockStack> transpositionBlacklist = new ArrayList<BlockStack>();
public static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
public static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
public static final Map<IBlockState, EnumAltarComponent> altarComponents = new HashMap<IBlockState, EnumAltarComponent>();
@Getter
@Setter
private static boolean loggingEnabled;
public static boolean loggingEnabled;
@Getter
private static LogHelper logger = new LogHelper("BloodMagic|API");
public static LogHelper logger = new LogHelper("BloodMagic|API");
@Getter
private static DamageSource damageSource = new DamageSourceBloodMagic();
public static DamageSource damageSource = new DamageSourceBloodMagic();
@Getter
@Setter
private static Fluid lifeEssence;
private static ItemStack lifeEssenceBucket;
public static Fluid lifeEssence;
public static ItemStack lifeEssenceBucket;
public static ItemStack getLifeEssenceBucket()
{
if (lifeEssenceBucket != null)
return lifeEssenceBucket;
lifeEssenceBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, getLifeEssence());
lifeEssenceBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, lifeEssence);
return lifeEssenceBucket;
}
@ -82,7 +70,7 @@ public class BloodMagicAPI
*/
public static Item getItem(String name)
{
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(Constants.Mod.MODID, name));
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(BloodMagic.MODID, name));
}
/**
@ -110,7 +98,7 @@ public class BloodMagicAPI
*/
public static Block getBlock(String name)
{
return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(Constants.Mod.MODID, name));
return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BloodMagic.MODID, name));
}
/**

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.api;
import java.util.Locale;
import lombok.Getter;
import WayofTime.bloodmagic.BloodMagic;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
@ -132,11 +132,7 @@ public class Constants
public static class Mod
{
public static final String MODID = "bloodmagic";
public static final String DOMAIN = MODID.toLowerCase(Locale.ENGLISH) + ":";
public static final String NAME = "Blood Magic: Alchemical Wizardry";
public static final String VERSION = "@VERSION@";
public static final String DEPEND = "required-after:guideapi;";
public static final String DOMAIN = BloodMagic.MODID.toLowerCase(Locale.ENGLISH) + ":";
}
public static final class Gui
@ -151,19 +147,19 @@ public class Constants
public static class Compat
{
public static final String JEI_CATEGORY_ALTAR = Mod.MODID + ":altar";
public static final String JEI_CATEGORY_BINDING = Mod.MODID + ":binding";
public static final String JEI_CATEGORY_ALCHEMYARRAY = Mod.MODID + ":alchemyArray";
public static final String JEI_CATEGORY_SOULFORGE = Mod.MODID + ":soulForge";
public static final String JEI_CATEGORY_ALCHEMYTABLE = Mod.MODID + ":salchemyTable";
public static final String JEI_CATEGORY_ARMOURDOWNGRADE = Mod.MODID + ":armourDowngrade";
public static final String JEI_CATEGORY_ALTAR = BloodMagic.MODID + ":altar";
public static final String JEI_CATEGORY_BINDING = BloodMagic.MODID + ":binding";
public static final String JEI_CATEGORY_ALCHEMYARRAY = BloodMagic.MODID + ":alchemyArray";
public static final String JEI_CATEGORY_SOULFORGE = BloodMagic.MODID + ":soulForge";
public static final String JEI_CATEGORY_ALCHEMYTABLE = BloodMagic.MODID + ":salchemyTable";
public static final String JEI_CATEGORY_ARMOURDOWNGRADE = BloodMagic.MODID + ":armourDowngrade";
public static final String WAILA_CONFIG_BYPASS_SNEAK = Mod.MODID + ".bypassSneak";
public static final String WAILA_CONFIG_ALTAR = Mod.MODID + ".bloodAltar";
public static final String WAILA_CONFIG_TELEPOSER = Mod.MODID + ".teleposer";
public static final String WAILA_CONFIG_RITUAL = Mod.MODID + ".ritualController";
public static final String WAILA_CONFIG_ARRAY = Mod.MODID + ".array";
public static final String WAILA_CONFIG_BLOOD_TANK = Mod.MODID + ".bloodTank";
public static final String WAILA_CONFIG_BYPASS_SNEAK = BloodMagic.MODID + ".bypassSneak";
public static final String WAILA_CONFIG_ALTAR = BloodMagic.MODID + ".bloodAltar";
public static final String WAILA_CONFIG_TELEPOSER = BloodMagic.MODID + ".teleposer";
public static final String WAILA_CONFIG_RITUAL = BloodMagic.MODID + ".ritualController";
public static final String WAILA_CONFIG_ARRAY = BloodMagic.MODID + ".array";
public static final String WAILA_CONFIG_BLOOD_TANK = BloodMagic.MODID + ".bloodTank";
public static final Item THAUMCRAFT_GOGGLES = ForgeRegistries.ITEMS.getValue(new ResourceLocation("Thaumcraft", "goggles"));
}
@ -187,12 +183,6 @@ public class Constants
BOUND_PICKAXE("ItemBoundPickaxe"),
BOUND_SHOVEL("ItemBoundShovel"),
BOUND_SWORD("ItemBoundSword"),
/**
* @deprecated - Use
* {@code UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, BloodMagicAPI.getLifeEssence())}
**/
@Deprecated
BUCKET_ESSENCE("ItemBucketEssence"),
COMPONENT("ItemComponent"),
CUTTING_FLUID("ItemCuttingFluid"),
DEMON_CRYSTAL("ItemDemonCrystal"),
@ -257,7 +247,6 @@ public class Constants
SIGIL_BOUNCE("ItemSigilBounce"),
SIGIL_FROST("ItemSigilFrost");
@Getter
private final String regName;
BloodMagicItem(String regName)
@ -267,7 +256,12 @@ public class Constants
public Item getItem()
{
return BloodMagicAPI.getItem(getRegName());
return BloodMagicAPI.getItem(regName);
}
public String getRegName()
{
return regName;
}
}
@ -319,7 +313,6 @@ public class Constants
INVERSION_PILLAR("BlockInversionPillar"),
INVERSION_PILLAR_END("BlockInversionPillarEnd");
@Getter
private final String regName;
BloodMagicBlock(String regName)
@ -329,7 +322,12 @@ public class Constants
public Block getBlock()
{
return BloodMagicAPI.getBlock(getRegName());
return BloodMagicAPI.getBlock(regName);
}
public String getRegName()
{
return regName;
}
}
}

View file

@ -1,7 +1,5 @@
package WayofTime.bloodmagic.api.alchemyCrafting;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
@ -10,12 +8,14 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.iface.IAlchemyArray;
@RequiredArgsConstructor
public abstract class AlchemyArrayEffect
{
@Getter
public final String key;
public AlchemyArrayEffect(String key) {
this.key = key;
}
public abstract boolean update(TileEntity tile, int ticksActive);
public abstract void writeToNBT(NBTTagCompound tag);
@ -28,4 +28,8 @@ public abstract class AlchemyArrayEffect
{
}
public String getKey() {
return key;
}
}

View file

@ -1,12 +1,10 @@
package WayofTime.bloodmagic.api.altar;
import lombok.Getter;
import net.minecraft.util.math.BlockPos;
/**
* Used for building the altar structure.
*/
@Getter
public class AltarComponent
{
private BlockPos offset;
@ -50,4 +48,16 @@ public class AltarComponent
this.upgradeSlot = true;
return this;
}
public BlockPos getOffset() {
return offset;
}
public boolean isUpgradeSlot() {
return upgradeSlot;
}
public EnumAltarComponent getComponent() {
return component;
}
}

View file

@ -1,12 +1,5 @@
package WayofTime.bloodmagic.api.altar;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class AltarUpgrade
{
private int speedCount;
@ -20,6 +13,22 @@ public class AltarUpgrade
private int accelerationCount;
private int chargingCount;
public AltarUpgrade(int speedCount, int efficiencyCount, int sacrificeCount, int selfSacrificeCount, int displacementCount, int capacityCount, int orbCapacityCount, int betterCapacityCount, int accelerationCount, int chargingCount) {
this.speedCount = speedCount;
this.efficiencyCount = efficiencyCount;
this.sacrificeCount = sacrificeCount;
this.selfSacrificeCount = selfSacrificeCount;
this.displacementCount = displacementCount;
this.capacityCount = capacityCount;
this.orbCapacityCount = orbCapacityCount;
this.betterCapacityCount = betterCapacityCount;
this.accelerationCount = accelerationCount;
this.chargingCount = chargingCount;
}
public AltarUpgrade() {
}
// Adders
public AltarUpgrade addSpeed()
@ -81,4 +90,44 @@ public class AltarUpgrade
chargingCount++;
return this;
}
public int getSpeedCount() {
return speedCount;
}
public int getEfficiencyCount() {
return efficiencyCount;
}
public int getSacrificeCount() {
return sacrificeCount;
}
public int getSelfSacrificeCount() {
return selfSacrificeCount;
}
public int getDisplacementCount() {
return displacementCount;
}
public int getCapacityCount() {
return capacityCount;
}
public int getOrbCapacityCount() {
return orbCapacityCount;
}
public int getBetterCapacityCount() {
return betterCapacityCount;
}
public int getAccelerationCount() {
return accelerationCount;
}
public int getChargingCount() {
return chargingCount;
}
}

View file

@ -2,12 +2,9 @@ package WayofTime.bloodmagic.api.altar;
import java.util.Locale;
import lombok.Getter;
/**
* List of different components used to construct different tiers of altars.
*/
@Getter
public enum EnumAltarComponent
{
GLOWSTONE,
@ -24,4 +21,8 @@ public enum EnumAltarComponent
{
this.key = BASE + name().toLowerCase(Locale.ENGLISH);
}
public String getKey() {
return key;
}
}

View file

@ -1,12 +1,10 @@
package WayofTime.bloodmagic.api.altar;
import lombok.Getter;
import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
//@formatter:off
@Getter
public enum EnumAltarTier
{
ONE(), TWO()
@ -152,4 +150,8 @@ public enum EnumAltarTier
{
return ordinal() + 1;
}
public ArrayList<AltarComponent> getAltarComponents() {
return altarComponents;
}
}

View file

@ -1,7 +1,6 @@
package WayofTime.bloodmagic.api.event;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import lombok.Getter;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.Event;
@ -10,7 +9,6 @@ import net.minecraftforge.fml.common.eventhandler.Event;
*
* It is not cancelable, however you can modify the output stack.
*/
@Getter
public class AltarCraftedEvent extends Event
{
@ -28,4 +26,12 @@ public class AltarCraftedEvent extends Event
this.altarRecipe = altarRecipe;
this.output = output;
}
public AltarRecipeRegistry.AltarRecipe getAltarRecipe() {
return altarRecipe;
}
public ItemStack getOutput() {
return output;
}
}

View file

@ -4,5 +4,5 @@ import net.minecraft.util.EnumFacing;
public interface IAlchemyArray
{
public abstract EnumFacing getRotation();
EnumFacing getRotation();
}

View file

@ -3,7 +3,6 @@ package WayofTime.bloodmagic.api.impl;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.ISigil;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import lombok.Getter;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -13,7 +12,6 @@ import net.minecraft.world.World;
*/
public class ItemSigil extends ItemBindable implements ISigil
{
@Getter
private int lpUsed;
public ItemSigil(int lpUsed)
@ -49,4 +47,8 @@ public class ItemSigil extends ItemBindable implements ISigil
{
return false;
}
public int getLpUsed() {
return lpUsed;
}
}

View file

@ -1,22 +1,23 @@
package WayofTime.bloodmagic.api.orb;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.registries.IForgeRegistryEntry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Base object for all Blood Orbs. Makes Orb creation quite a bit easier.
*
* Just create a new BloodOrb instance then register it with
* {@link OrbRegistry#registerOrb(BloodOrb)} This will allow the use of just one
* item ID for all orbs. If an addon dev needs more control over the intricacies
* of their orb (custom right clicking, renderers, etc), they can just create
* their own item as normal.
* Just create a new BloodOrb instance then register it in {@link net.minecraftforge.event.RegistryEvent.Register<BloodOrb>}
*/
public class BloodOrb
public class BloodOrb extends IForgeRegistryEntry.Impl<BloodOrb>
{
private String name;
private int tier;
private int capacity;
private String owner = "BloodMagic";
private final String name;
private final int tier;
private final int capacity;
@Nullable
private ModelResourceLocation modelLocation;
/**
* A base object for BloodOrbs. A bit cleaner than the old way through
@ -51,26 +52,19 @@ public class BloodOrb
return capacity;
}
public String getOwner()
{
return owner;
@Nullable
public ModelResourceLocation getModelLocation() {
return modelLocation;
}
/**
* For setting the MODID of the mod that creates the Orb. Not required, but
* preferred.
*
* @return - The BloodOrb object for further use.
*/
public BloodOrb setOwner(String owner)
{
this.owner = owner;
public BloodOrb withModel(@Nonnull ModelResourceLocation modelLocation) {
this.modelLocation = modelLocation;
return this;
}
@Override
public String toString()
{
return "BloodOrb{" + "name='" + name + '\'' + ", tier=" + tier + ", capacity=" + capacity + ", owner=" + owner + '}';
return "BloodOrb{" + "name='" + name + '\'' + ", tier=" + tier + ", capacity=" + capacity + ", owner=" + getRegistryName() + '}';
}
}

View file

@ -1,10 +1,11 @@
package WayofTime.bloodmagic.api.orb;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
public interface IBloodOrb
{
BloodOrb getOrb(int meta);
int getMaxEssence(int meta);
int getOrbLevel(int meta);
@Nullable
BloodOrb getOrb(ItemStack stack);
}

View file

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

View file

@ -5,27 +5,20 @@ import java.util.Iterator;
import java.util.List;
import com.google.common.collect.ImmutableList;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.builder.ToStringBuilder;
@EqualsAndHashCode
@ToString
public class AlchemyTableRecipe
{
protected ItemStack output = ItemStack.EMPTY;
protected ArrayList<Object> input = new ArrayList<Object>();
@Getter
protected int lpDrained;
@Getter
protected int ticksRequired;
@Getter
protected int tierRequired;
public AlchemyTableRecipe(Block result, int lpDrained, int ticksRequired, int tierRequired, Object... recipe)
@ -186,4 +179,52 @@ public class AlchemyTableRecipe
return copyStack;
}
public int getLpDrained() {
return lpDrained;
}
public int getTicksRequired() {
return ticksRequired;
}
public int getTierRequired() {
return tierRequired;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("output", output)
.append("input", input)
.append("lpDrained", lpDrained)
.append("ticksRequired", ticksRequired)
.append("tierRequired", tierRequired)
.append("recipeSize", getRecipeSize())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AlchemyTableRecipe)) return false;
AlchemyTableRecipe that = (AlchemyTableRecipe) o;
if (lpDrained != that.lpDrained) return false;
if (ticksRequired != that.ticksRequired) return false;
if (tierRequired != that.tierRequired) return false;
if (output != null ? !output.equals(that.output) : that.output != null) return false;
return input != null ? input.equals(that.input) : that.input == null;
}
@Override
public int hashCode() {
int result = output != null ? output.hashCode() : 0;
result = 31 * result + (input != null ? input.hashCode() : 0);
result = 31 * result + lpDrained;
result = 31 * result + ticksRequired;
result = 31 * result + tierRequired;
return result;
}
}

View file

@ -1,28 +1,22 @@
package WayofTime.bloodmagic.api.recipe;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@EqualsAndHashCode
@ToString
public class TartaricForgeRecipe
{
protected ItemStack output = null;
protected List<Object> input = new ArrayList<Object>();
@Getter
protected double minimumSouls;
@Getter
protected double soulsDrained;
public TartaricForgeRecipe(Block result, double minSouls, double drain, Object... recipe)
@ -145,4 +139,50 @@ public class TartaricForgeRecipe
{
return this.input;
}
public double getMinimumSouls() {
return minimumSouls;
}
public double getSoulsDrained() {
return soulsDrained;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("output", output)
.append("input", input)
.append("minimumSouls", minimumSouls)
.append("soulsDrained", soulsDrained)
.append("recipeSize", getRecipeSize())
.append("recipeOutput", getRecipeOutput())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TartaricForgeRecipe)) return false;
TartaricForgeRecipe that = (TartaricForgeRecipe) o;
if (Double.compare(that.minimumSouls, minimumSouls) != 0) return false;
if (Double.compare(that.soulsDrained, soulsDrained) != 0) return false;
if (output != null ? !output.equals(that.output) : that.output != null) return false;
return input != null ? input.equals(that.input) : that.input == null;
}
@Override
public int hashCode() {
int result;
long temp;
result = output != null ? output.hashCode() : 0;
result = 31 * result + (input != null ? input.hashCode() : 0);
temp = Double.doubleToLongBits(minimumSouls);
result = 31 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(soulsDrained);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}

View file

@ -5,11 +5,9 @@ import WayofTime.bloodmagic.api.ItemStackWrapper;
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.Collections;
import java.util.List;
@ -34,7 +32,7 @@ public class AltarRecipeRegistry
if (!recipes.containsValue(altarRecipe) && altarRecipe.getInput().size() > 0)
recipes.put(altarRecipe.getInput(), altarRecipe);
else
BloodMagicAPI.getLogger().error("Error adding altar recipe for input [{}].", altarRecipe.toString());
BloodMagicAPI.logger.error("Error adding altar recipe for input [{}].", altarRecipe.toString());
}
public static void registerFillRecipe(ItemStack orbStack, EnumAltarTier tier, int maxForOrb, int consumeRate, int drainRate)
@ -87,9 +85,6 @@ public class AltarRecipeRegistry
return HashBiMap.create(recipes);
}
@Getter
@ToString
@EqualsAndHashCode
public static class AltarRecipe
{
private final List<ItemStackWrapper> input;
@ -174,5 +169,74 @@ public class AltarRecipeRegistry
return false;
}
public List<ItemStackWrapper> getInput() {
return input;
}
public ItemStack getOutput() {
return output;
}
public EnumAltarTier getMinTier() {
return minTier;
}
public int getSyphon() {
return syphon;
}
public int getConsumeRate() {
return consumeRate;
}
public int getDrainRate() {
return drainRate;
}
public boolean isFillable() {
return fillable;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AltarRecipe)) return false;
AltarRecipe that = (AltarRecipe) o;
if (syphon != that.syphon) return false;
if (consumeRate != that.consumeRate) return false;
if (drainRate != that.drainRate) return false;
if (fillable != that.fillable) return false;
if (input != null ? !input.equals(that.input) : that.input != null) return false;
if (output != null ? !output.equals(that.output) : that.output != null) return false;
return minTier == that.minTier;
}
@Override
public int hashCode() {
int result = input != null ? input.hashCode() : 0;
result = 31 * result + (output != null ? output.hashCode() : 0);
result = 31 * result + (minTier != null ? minTier.hashCode() : 0);
result = 31 * result + syphon;
result = 31 * result + consumeRate;
result = 31 * result + drainRate;
result = 31 * result + (fillable ? 1 : 0);
return result;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("input", input)
.append("output", output)
.append("minTier", minTier)
.append("syphon", syphon)
.append("consumeRate", consumeRate)
.append("drainRate", drainRate)
.append("fillable", fillable)
.toString();
}
}
}

View file

@ -5,13 +5,16 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import WayofTime.bloodmagic.api.orb.BloodOrb;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import com.google.common.collect.ArrayListMultimap;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -23,57 +26,14 @@ import java.util.List;
* This is only for those who wish to add a basic {@link BloodOrb}. If you need
* custom handling, you will need your own item class.
*/
@Deprecated
public class OrbRegistry
{
private static List<BloodOrb> orbs = new ArrayList<BloodOrb>();
private static ArrayListMultimap<Integer, ItemStack> tierMap = ArrayListMultimap.create();
public static ArrayListMultimap<Integer, ItemStack> tierMap = ArrayListMultimap.create();
private static Item orbItem = Constants.BloodMagicItem.BLOOD_ORB.getItem();
public static void registerOrb(BloodOrb orb)
{
if (!orbs.contains(orb))
{
orbs.add(orb);
registerOrbForTier(orb.getTier(), getOrbStack(orb));
} else
BloodMagicAPI.getLogger().error("Error adding orb %s. Orb already exists!", orb.toString());
}
public static void registerOrbForTier(int tier, ItemStack stack)
{
if (stack.getItem() instanceof IBloodOrb)
tierMap.put(tier, stack);
}
@SideOnly(Side.CLIENT)
public static void registerOrbTexture(BloodOrb orb, ResourceLocation resourceLocation)
{
int meta = getIndexOf(orb);
ModelBakery.registerItemVariants(orbItem, resourceLocation);
ModelLoader.setCustomModelResourceLocation(orbItem, meta, new ModelResourceLocation(resourceLocation, "inventory"));
}
public static BloodOrb getOrb(int index)
{
return orbs.get(index);
}
public static int getIndexOf(BloodOrb orb)
{
return orbs.indexOf(orb);
}
public static boolean isEmpty()
{
return orbs.isEmpty();
}
public static int getSize()
{
return orbs.size();
}
@GameRegistry.ObjectHolder("bloodmagic:blood_orb")
private static final Item ORB_ITEM = null;
public static List<ItemStack> getOrbsForTier(int tier)
{
@ -105,12 +65,11 @@ public class OrbRegistry
public static ItemStack getOrbStack(BloodOrb orb)
{
return new ItemStack(orbItem, 1, getIndexOf(orb));
}
public static List<BloodOrb> getOrbs()
{
return new ArrayList<BloodOrb>(orbs);
ItemStack ret = new ItemStack(ORB_ITEM);
NBTTagCompound tag = new NBTTagCompound();
tag.setString("orb", orb.getRegistryName().toString());
ret.setTagCompound(tag);
return ret;
}
public static ArrayListMultimap<Integer, ItemStack> getTierMap()

View file

@ -6,10 +6,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -21,15 +17,12 @@ import net.minecraft.world.World;
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* Abstract class for creating new rituals. Rituals need be registered with
* {@link WayofTime.bloodmagic.api.registry.RitualRegistry#registerRitual(Ritual, String)}
*/
@Getter
@RequiredArgsConstructor
@EqualsAndHashCode(exclude = { "modableRangeMap", "ritualComponents", "renderer", "volumeRangeMap", "horizontalRangeMap", "verticalRangeMap" })
@ToString
public abstract class Ritual
{
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
@ -44,6 +37,14 @@ public abstract class Ritual
protected final Map<String, Integer> horizontalRangeMap = new HashMap<String, Integer>();
protected final Map<String, Integer> verticalRangeMap = new HashMap<String, Integer>();
public Ritual(String name, int crystalLevel, int activationCost, RitualRenderer renderer, String unlocalizedName) {
this.name = name;
this.crystalLevel = crystalLevel;
this.activationCost = activationCost;
this.renderer = renderer;
this.unlocalizedName = unlocalizedName;
}
/**
* @param name
* - The name of the ritual
@ -365,4 +366,84 @@ public abstract class Ritual
}
public abstract Ritual getNewCopy();
public ArrayList<RitualComponent> getRitualComponents() {
return ritualComponents;
}
public String getName() {
return name;
}
public int getCrystalLevel() {
return crystalLevel;
}
public int getActivationCost() {
return activationCost;
}
public RitualRenderer getRenderer() {
return renderer;
}
public String getUnlocalizedName() {
return unlocalizedName;
}
public Map<String, AreaDescriptor> getModableRangeMap() {
return modableRangeMap;
}
public Map<String, Integer> getVolumeRangeMap() {
return volumeRangeMap;
}
public Map<String, Integer> getHorizontalRangeMap() {
return horizontalRangeMap;
}
public Map<String, Integer> getVerticalRangeMap() {
return verticalRangeMap;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("ritualComponents", ritualComponents)
.append("name", name)
.append("crystalLevel", crystalLevel)
.append("activationCost", activationCost)
.append("renderer", renderer)
.append("unlocalizedName", unlocalizedName)
.append("modableRangeMap", modableRangeMap)
.append("volumeRangeMap", volumeRangeMap)
.append("horizontalRangeMap", horizontalRangeMap)
.append("verticalRangeMap", verticalRangeMap)
.append("refreshTime", getRefreshTime())
.append("listOfRanges", getListOfRanges())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Ritual)) return false;
Ritual ritual = (Ritual) o;
if (crystalLevel != ritual.crystalLevel) return false;
if (activationCost != ritual.activationCost) return false;
if (name != null ? !name.equals(ritual.name) : ritual.name != null) return false;
return unlocalizedName != null ? unlocalizedName.equals(ritual.unlocalizedName) : ritual.unlocalizedName == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + crystalLevel;
result = 31 * result + activationCost;
result = 31 * result + (unlocalizedName != null ? unlocalizedName.hashCode() : 0);
return result;
}
}

View file

@ -1,7 +1,5 @@
package WayofTime.bloodmagic.api.ritual;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@ -9,13 +7,16 @@ import net.minecraft.util.math.BlockPos;
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos} for usage
* in Ritual creation.
*/
@Getter
@RequiredArgsConstructor
public class RitualComponent
{
private final BlockPos offset;
private final EnumRuneType runeType;
public RitualComponent(BlockPos offset, EnumRuneType runeType) {
this.offset = offset;
this.runeType = runeType;
}
public int getX(EnumFacing direction)
{
switch (direction)
@ -55,4 +56,12 @@ public class RitualComponent
{
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
}
public BlockPos getOffset() {
return offset;
}
public EnumRuneType getRuneType() {
return runeType;
}
}

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.api.ritual.imperfect;
import WayofTime.bloodmagic.api.BlockStack;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -12,9 +9,6 @@ import net.minecraft.world.World;
* registered with
* {@link WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry#registerRitual(ImperfectRitual)}
*/
@RequiredArgsConstructor
@Getter
@EqualsAndHashCode
public abstract class ImperfectRitual
{
@ -24,6 +18,14 @@ public abstract class ImperfectRitual
private final boolean lightshow;
private final String unlocalizedName;
public ImperfectRitual(String name, BlockStack requiredBlock, int activationCost, boolean lightshow, String unlocalizedName) {
this.name = name;
this.requiredBlock = requiredBlock;
this.activationCost = activationCost;
this.lightshow = lightshow;
this.unlocalizedName = unlocalizedName;
}
/**
* @param name
* - The name of the ritual
@ -49,9 +51,54 @@ public abstract class ImperfectRitual
*/
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
public String getName() {
return name;
}
public BlockStack getRequiredBlock() {
return requiredBlock;
}
public int getActivationCost() {
return activationCost;
}
public boolean isLightshow() {
return lightshow;
}
public String getUnlocalizedName() {
return unlocalizedName;
}
@Override
public String toString()
{
return getName() + ":" + getRequiredBlock().toString() + "@" + getActivationCost();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ImperfectRitual)) return false;
ImperfectRitual that = (ImperfectRitual) o;
if (activationCost != that.activationCost) return false;
if (lightshow != that.lightshow) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (requiredBlock != null ? !requiredBlock.equals(that.requiredBlock) : that.requiredBlock != null)
return false;
return unlocalizedName != null ? unlocalizedName.equals(that.unlocalizedName) : that.unlocalizedName == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (requiredBlock != null ? requiredBlock.hashCode() : 0);
result = 31 * result + activationCost;
result = 31 * result + (lightshow ? 1 : 0);
result = 31 * result + (unlocalizedName != null ? unlocalizedName.hashCode() : 0);
return result;
}
}

View file

@ -4,7 +4,7 @@ import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.WorldSavedData;
import net.minecraft.world.storage.WorldSavedData;
import java.util.*;

View file

@ -5,7 +5,6 @@ import WayofTime.bloodmagic.api.event.AddToNetworkEvent;
import WayofTime.bloodmagic.api.event.SoulNetworkEvent;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
import lombok.Getter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.nbt.NBTTagCompound;
@ -18,7 +17,6 @@ import net.minecraftforge.fml.common.eventhandler.Event;
import javax.annotation.Nullable;
import java.util.UUID;
@Getter
public class SoulNetwork implements INBTSerializable<NBTTagCompound>
{
private BMWorldSavedData parent;
@ -129,7 +127,7 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
if (!user.capabilities.isCreativeMode)
{
user.hurtResistantTime = 0;
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
user.attackEntityFrom(BloodMagicAPI.damageSource, 1.0F);
}
} else if (syphon >= 100)
@ -139,7 +137,7 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
for (int i = 0; i < ((syphon + 99) / 100); i++)
{
user.hurtResistantTime = 0;
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
user.attackEntityFrom(BloodMagicAPI.damageSource, 1.0F);
}
}
}
@ -151,7 +149,7 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
if (getParent() != null)
getParent().markDirty();
else
BloodMagicAPI.getLogger().error("A SoulNetwork was created, but a parent was not set to allow saving.");
BloodMagicAPI.logger.error("A SoulNetwork was created, but a parent was not set to allow saving.");
}
@Nullable
@ -184,6 +182,26 @@ public class SoulNetwork implements INBTSerializable<NBTTagCompound>
return this;
}
public BMWorldSavedData getParent() {
return parent;
}
public EntityPlayer getCachedPlayer() {
return cachedPlayer;
}
public UUID getPlayerId() {
return playerId;
}
public int getCurrentEssence() {
return currentEssence;
}
public int getOrbTier() {
return orbTier;
}
// INBTSerializable
@Override

View file

@ -15,19 +15,19 @@ public class LogHelper
public void info(String info, Object... format)
{
if (BloodMagicAPI.isLoggingEnabled())
if (BloodMagicAPI.loggingEnabled)
logger.info(info, format);
}
public void error(String error, Object... format)
{
if (BloodMagicAPI.isLoggingEnabled())
if (BloodMagicAPI.loggingEnabled)
logger.error(error, format);
}
public void debug(String debug, Object... format)
{
if (BloodMagicAPI.isLoggingEnabled())
if (BloodMagicAPI.loggingEnabled)
logger.debug(debug, format);
}