It compiles. Somehow.
This commit is contained in:
parent
554c9852e6
commit
348fee1e2a
150 changed files with 1029 additions and 2186 deletions
|
@ -3,7 +3,6 @@ package WayofTime.bloodmagic.api;
|
|||
import java.util.Locale;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
@ -171,163 +170,4 @@ public class Constants
|
|||
public static final int NIGHT_VISION_CONSTANT_BEGIN = 30002;
|
||||
public static final int NIGHT_VISION_CONSTANT_END = 30000;
|
||||
}
|
||||
|
||||
public enum BloodMagicItem
|
||||
{
|
||||
ACTIVATION_CRYSTAL("ItemActivationCrystal"),
|
||||
ALTAR_MAKER("ItemAltarMaker"),
|
||||
ARCANE_ASHES("ItemArcaneAshes"),
|
||||
BLOOD_ORB("ItemBloodOrb"),
|
||||
BOUND_AXE("ItemBoundAxe"),
|
||||
BLOOD_SHARD("ItemBloodShard"),
|
||||
BOUND_PICKAXE("ItemBoundPickaxe"),
|
||||
BOUND_SHOVEL("ItemBoundShovel"),
|
||||
BOUND_SWORD("ItemBoundSword"),
|
||||
COMPONENT("ItemComponent"),
|
||||
CUTTING_FLUID("ItemCuttingFluid"),
|
||||
DEMON_CRYSTAL("ItemDemonCrystal"),
|
||||
DAGGER_OF_SACRIFICE("ItemDaggerOfSacrifice"),
|
||||
INSCRIPTION_TOOL("ItemInscriptionTool"),
|
||||
LAVA_CRYSTAL("ItemLavaCrystal"),
|
||||
LIVING_ARMOR_HELMET("ItemLivingArmourHelmet"),
|
||||
LIVING_ARMOR_CHEST("ItemLivingArmourChest"),
|
||||
LIVING_ARMOR_LEGS("ItemLivingArmourLegs"),
|
||||
LIVING_ARMOR_BOOTS("ItemLivingArmourBoots"),
|
||||
MONSTER_SOUL("ItemMonsterSoul"),
|
||||
NODE_ROUTER("ItemNodeRouter"),
|
||||
RITUAL_DIVINER("ItemRitualDiviner"),
|
||||
ROUTER_FILTER("ItemRouterFilter"),
|
||||
FLUID_ROUTER_FILTER("ItemFluidRouterFilter"),
|
||||
SACRIFICIAL_DAGGER("ItemSacrificialDagger"),
|
||||
SACRIFICE_PACK("ItemPackSacrifice"),
|
||||
SELF_SACRIFICE_PACK("ItemPackSelfSacrifice"),
|
||||
SENTIENT_ARMOR_HELMET("ItemSentientArmourHelmet"),
|
||||
SENTIENT_ARMOR_CHEST("ItemSentientArmourChest"),
|
||||
SENTIENT_ARMOR_LEGS("ItemSentientArmourLegs"),
|
||||
SENTIENT_ARMOR_BOOTS("ItemSentientArmourBoots"),
|
||||
SENTIENT_ARMOR_GEM("ItemSentientArmourGem"),
|
||||
SENTIENT_AXE("ItemSentientAxe"),
|
||||
SENTIENT_BOW("ItemSentientBow"),
|
||||
SENTIENT_PICKAXE("ItemSentientPickaxe"),
|
||||
SENTIENT_SHOVEL("ItemSentientShovel"),
|
||||
SENTIENT_SWORD("ItemSentientSword"),
|
||||
SOUL_GEM("ItemSoulGem"),
|
||||
SOUL_SNARE("ItemSoulSnare"),
|
||||
SIGIL_AIR("ItemSigilAir"),
|
||||
SIGIL_BLOOD_LIGHT("ItemSigilBloodLight"),
|
||||
SIGIL_COMPRESSION("ItemSigilCompression"),
|
||||
SIGIL_DIVINATION("ItemSigilDivination"),
|
||||
SIGIL_ELEMENTAL_AFFINITY("ItemSigilElementalAffinity"),
|
||||
SIGIL_ENDER_SEVERANCE("ItemSigilEnderSeverance"),
|
||||
SIGIL_FAST_MINER("ItemSigilFastMiner"),
|
||||
SIGIL_GREEN_GROVE("ItemSigilGreenGrove"),
|
||||
SIGIL_HASTE("ItemSigilHaste"),
|
||||
SIGIL_LAVA("ItemSigilLava"),
|
||||
SIGIL_MAGNETISM("ItemSigilMagnetism"),
|
||||
SIGIL_PHANTOM_BRIDGE("ItemSigilPhantomBridge"),
|
||||
SIGIL_SEER("ItemSigilSeer"),
|
||||
SIGIL_SUPPRESION("ItemSigilSuppression"),
|
||||
SIGIL_VOID("ItemSigilVoid"),
|
||||
SIGIL_WATER("ItemSigilWater"),
|
||||
SIGIL_WHIRLWIND("ItemSigilWhirlwind"),
|
||||
SLATE("ItemSlate"),
|
||||
TELEPOSITION_FOCUS("ItemTelepositionFocus"),
|
||||
UPGRADE_TOME("ItemUpgradeTome"),
|
||||
UPGRADE_TRAINER("ItemUpgradeTrainer"),
|
||||
SIGIL_TELEPOSITION("ItemSigilTeleposition"),
|
||||
EXPERIENCE_TOME("ItemExperienceBook"),
|
||||
SIGIL_TRANSPOSITION("ItemSigilTransposition"),
|
||||
RITUAL_READER("ItemRitualReader"),
|
||||
SANGUINE_BOOK("ItemSanguineBook"),
|
||||
SIGIL_HOLDING("ItemSigilHolding"),
|
||||
ARMOUR_POINTS_UPGRADE("ItemLivingArmourPointsUpgrade"),
|
||||
DEMON_WILL_GAUGE("ItemDemonWillGauge"),
|
||||
POTION_FLASK("ItemPotionFlask"),
|
||||
SIGIL_CLAW("ItemSigilClaw"),
|
||||
SIGIL_BOUNCE("ItemSigilBounce"),
|
||||
SIGIL_FROST("ItemSigilFrost");
|
||||
|
||||
private final String regName;
|
||||
|
||||
BloodMagicItem(String regName)
|
||||
{
|
||||
this.regName = regName;
|
||||
}
|
||||
|
||||
public Item getItem()
|
||||
{
|
||||
return BloodMagicAPI.getItem(regName);
|
||||
}
|
||||
|
||||
public String getRegName()
|
||||
{
|
||||
return regName;
|
||||
}
|
||||
}
|
||||
|
||||
public enum BloodMagicBlock
|
||||
{
|
||||
ALCHEMY_ARRAY("BlockAlchemyArray"),
|
||||
ALTAR("BlockAltar"),
|
||||
BLOOD_LIGHT("BlockBloodLight"),
|
||||
BLOOD_RUNE("BlockBloodRune"),
|
||||
BLOOD_STONE("BlockBloodStoneBrick"),
|
||||
CRYSTAL("BlockCrystal"),
|
||||
INPUT_ROUTING_NODE("BlockInputRoutingNode"),
|
||||
ITEM_ROUTING_NODE("BlockItemRoutingNode"),
|
||||
LIFE_ESSENCE("BlockLifeEssence"),
|
||||
MASTER_ROUTING_NODE("BlockMasterRoutingNode"),
|
||||
OUTPUT_ROUTING_NODE("BlockOutputRoutingNode"),
|
||||
@Deprecated
|
||||
PEDESTAL("BlockPedestal"),
|
||||
/** No longer included in the mod. */
|
||||
PHANTOM("BlockPhantom"),
|
||||
RITUAL_CONTROLLER("BlockRitualController"),
|
||||
RITUAL_STONE("BlockRitualStone"),
|
||||
SOUL_FORGE("BlockSoulForge"),
|
||||
SPECTRAL("BlockSpectral"),
|
||||
TELEPOSER("BlockTeleposer"),
|
||||
INCENSE_ALTAR("BlockIncenseAltar"),
|
||||
PATH("BlockPath"),
|
||||
DEMON_CRUCIBLE("BlockDemonCrucible"),
|
||||
DEMON_PYLON("BlockDemonPylon"),
|
||||
DEMON_CRYSTALLIZER("BlockDemonCrystallizer"),
|
||||
DEMON_CRYSTAL("BlockDemonCrystal"),
|
||||
DIMENSIONAL_PORTAL("BlockDimensionalPortal"),
|
||||
BLOOD_TANK("BlockBloodTank"),
|
||||
MIMIC("BlockMimic"),
|
||||
ALCHEMY_TABLE("BlockAlchemyTable"),
|
||||
DEMON_BRICK_1("BlockDemonBricks1"),
|
||||
DEMON_BRICK_2("BlockDemonBricks2"),
|
||||
DEMON_BLOCK_EXTRA("BlockDemonExtra"),
|
||||
DEMON_PILLAR_1("BlockPillar1"),
|
||||
DEMON_PILLAR_2("BlockPillar2"),
|
||||
DEMON_PILLAR_CAP_1("BlockPillarCap1"),
|
||||
DEMON_PILLAR_CAP_2("BlockPillarCap2"),
|
||||
DEMON_PILLAR_CAP_3("BlockPillarCap3"),
|
||||
DEMON_WALL_1("BlockWall1"),
|
||||
DEMON_STAIRS_1("BlockStairs1"),
|
||||
DEMON_STAIRS_2("BlockStairs2"),
|
||||
DEMON_STAIRS_3("BlockStairs3"),
|
||||
DEMON_LIGHT("BlockDemonLight"),
|
||||
INVERSION_PILLAR("BlockInversionPillar"),
|
||||
INVERSION_PILLAR_END("BlockInversionPillarEnd");
|
||||
|
||||
private final String regName;
|
||||
|
||||
BloodMagicBlock(String regName)
|
||||
{
|
||||
this.regName = regName;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return BloodMagicAPI.getBlock(regName);
|
||||
}
|
||||
|
||||
public String getRegName()
|
||||
{
|
||||
return regName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package WayofTime.bloodmagic.api;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -12,16 +9,19 @@ import javax.annotation.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class ItemStackWrapper
|
||||
{
|
||||
public final Item item;
|
||||
public final int stackSize;
|
||||
public final int meta;
|
||||
@Setter
|
||||
public NBTTagCompound nbtTag;
|
||||
|
||||
public ItemStackWrapper(Item item, int stackSize, int meta) {
|
||||
this.item = item;
|
||||
this.stackSize = stackSize;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public ItemStackWrapper(Item item, int stackSize)
|
||||
{
|
||||
this(item, stackSize, 0);
|
||||
|
@ -103,4 +103,24 @@ public class ItemStackWrapper
|
|||
|
||||
return stackList;
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public int getStackSize() {
|
||||
return stackSize;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public NBTTagCompound getNbtTag() {
|
||||
return nbtTag;
|
||||
}
|
||||
|
||||
public void setNbtTag(NBTTagCompound nbtTag) {
|
||||
this.nbtTag = nbtTag;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.api.alchemyCrafting;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -9,7 +8,6 @@ import net.minecraft.util.math.BlockPos;
|
|||
|
||||
public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect
|
||||
{
|
||||
@Getter
|
||||
public final ItemStack outputStack;
|
||||
public int tickLimit;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.bloodmagic.api.alchemyCrafting;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -81,7 +81,7 @@ public class AlchemyCircleRenderer
|
|||
TileAlchemyArray tileArray = (TileAlchemyArray) tile;
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer wr = tessellator.getBuffer();
|
||||
BufferBuilder wr = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
// float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
|
||||
|
|
|
@ -30,12 +30,12 @@ public class ItemBindable extends Item implements IBindable
|
|||
@Override
|
||||
public String getOwnerName(ItemStack stack)
|
||||
{
|
||||
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
||||
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerUUID(ItemStack stack)
|
||||
{
|
||||
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
||||
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class LivingArmourHandler
|
|||
Constructor<? extends LivingArmourUpgrade> ctor = clazz.getConstructor(int.class);
|
||||
if (ctor == null)
|
||||
{
|
||||
BloodMagicAPI.getLogger().error("Error adding living armour upgrade {} as it doesn't have a valid constructor.", upgrade.getUniqueIdentifier());
|
||||
BloodMagicAPI.logger.error("Error adding living armour upgrade {} as it doesn't have a valid constructor.", upgrade.getUniqueIdentifier());
|
||||
} else
|
||||
{
|
||||
upgradeConstructorMap.put(upgrade.getUniqueIdentifier(), ctor);
|
||||
|
|
|
@ -1,305 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.recipe;
|
||||
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Shaped Blood Orb Recipe Handler by joshie *
|
||||
*/
|
||||
public class ShapedBloodOrbRecipe implements IRecipe
|
||||
{
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||
|
||||
private ItemStack output = null;
|
||||
private Object[] input = null;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private int tier;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ShapedBloodOrbRecipe(Block result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe(Item result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
|
||||
String shape = "";
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean) recipe[idx];
|
||||
if (recipe[idx + 1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[]) recipe[idx + 1];
|
||||
} else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[]) recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
} else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String) recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
|
||||
{
|
||||
// If the item is an instanceof IBloodOrb then save the level of
|
||||
// the orb.
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
ItemStack inStack = (ItemStack) in;
|
||||
tier = ((IBloodOrb) inStack.getItem()).getOrbLevel(inStack.getItemDamage());
|
||||
itemMap.put(chr, tier);
|
||||
} else
|
||||
{
|
||||
tier = ((IBloodOrb) in).getOrbLevel(0);
|
||||
itemMap.put(chr, tier);
|
||||
}
|
||||
} else if (in instanceof ItemStack)
|
||||
{
|
||||
itemMap.put(chr, ((ItemStack) in).copy());
|
||||
} else if (in instanceof Item)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Item) in));
|
||||
} else if (in instanceof Block)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} else if (in instanceof String)
|
||||
{
|
||||
itemMap.put(chr, OreDictionary.getOres((String) in));
|
||||
} else
|
||||
{
|
||||
String ret = "Invalid shaped orb recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
|
||||
{
|
||||
output = recipe.getRecipeOutput();
|
||||
width = recipe.recipeWidth;
|
||||
height = recipe.recipeHeight;
|
||||
|
||||
input = new Object[recipe.recipeItems.length];
|
||||
|
||||
for (int i = 0; i < input.length; i++)
|
||||
{
|
||||
ItemStack ingred = recipe.recipeItems[i];
|
||||
|
||||
if (ingred == null)
|
||||
continue;
|
||||
|
||||
input[i] = recipe.recipeItems[i];
|
||||
|
||||
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||
{
|
||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, true))
|
||||
{
|
||||
input[i] = OreDictionary.getOres(replace.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||
{
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return input.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world)
|
||||
{
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||
{
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||
{
|
||||
if (checkMatch(inv, x, y, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mirrored && checkMatch(inv, x, y, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
|
||||
{
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||
{
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||
{
|
||||
int subX = x - startX;
|
||||
int subY = y - startY;
|
||||
Object target = null;
|
||||
|
||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
||||
{
|
||||
if (mirror)
|
||||
{
|
||||
target = input[width - subX - 1 + subY * width];
|
||||
} else
|
||||
{
|
||||
target = input[subX + subY * width];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack slot = inv.getStackInRowAndColumn(x, y);
|
||||
// If target is integer, then we should be check the blood orb
|
||||
// value of the item instead
|
||||
if (target instanceof Integer)
|
||||
{
|
||||
if (!slot.isEmpty() && slot.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
} else if (target instanceof ItemStack)
|
||||
{
|
||||
if (!OreDictionary.itemMatches((ItemStack) target, slot, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else if (target instanceof List)
|
||||
{
|
||||
boolean matched = false;
|
||||
|
||||
Iterator<ItemStack> itr = ((List<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched)
|
||||
{
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else if (target == null && !slot.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object[] getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
public int getTier()
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.recipe;
|
||||
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Shapeless Blood Orb Recipe Handler by joshie *
|
||||
*/
|
||||
public class ShapelessBloodOrbRecipe implements IRecipe
|
||||
{
|
||||
private ItemStack output = null;
|
||||
private ArrayList<Object> input = new ArrayList<Object>();
|
||||
private int tier;
|
||||
|
||||
public ShapelessBloodOrbRecipe(Block result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapelessBloodOrbRecipe(Item result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
for (Object in : recipe)
|
||||
{
|
||||
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
|
||||
{
|
||||
// If the item is an instanceof IBloodOrb then save the level of
|
||||
// the orb.
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
ItemStack inStack = (ItemStack) in;
|
||||
tier = ((IBloodOrb) inStack.getItem()).getOrbLevel(inStack.getItemDamage());
|
||||
input.add(tier);
|
||||
} else
|
||||
{
|
||||
tier = ((IBloodOrb) in).getOrbLevel(0);
|
||||
input.add(tier);
|
||||
}
|
||||
} else if (in instanceof ItemStack)
|
||||
{
|
||||
input.add(((ItemStack) in).copy());
|
||||
} else if (in instanceof Item)
|
||||
{
|
||||
input.add(new ItemStack((Item) in));
|
||||
} else if (in instanceof Block)
|
||||
{
|
||||
input.add(new ItemStack((Block) in));
|
||||
} else if (in instanceof String)
|
||||
{
|
||||
input.add(OreDictionary.getOres((String) in));
|
||||
} else
|
||||
{
|
||||
String ret = "Invalid shapeless ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
|
||||
{
|
||||
output = recipe.getRecipeOutput();
|
||||
|
||||
for (ItemStack ingred : recipe.recipeItems)
|
||||
{
|
||||
Object finalObj = ingred;
|
||||
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||
{
|
||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, false))
|
||||
{
|
||||
finalObj = OreDictionary.getOres(replace.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
input.add(finalObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return input.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||
{
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World world)
|
||||
{
|
||||
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||
|
||||
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
|
||||
if (!slot.isEmpty())
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
|
||||
// If target is integer, then we should be check the blood
|
||||
// orb value of the item instead
|
||||
if (next instanceof Integer)
|
||||
{
|
||||
if (slot.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) next)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
match = true;
|
||||
} else if (next instanceof ItemStack)
|
||||
{
|
||||
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
|
||||
} else if (next instanceof List)
|
||||
{
|
||||
Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator();
|
||||
while (itr.hasNext() && !match)
|
||||
{
|
||||
match = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
{
|
||||
inRecipe = true;
|
||||
required.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inRecipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return required.isEmpty();
|
||||
}
|
||||
|
||||
public ArrayList<Object> getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
|
||||
public int getTier()
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,6 @@ import java.util.Map.Entry;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
@ -128,8 +125,8 @@ public class AlchemyArrayRecipeRegistry
|
|||
if (effectEntry.getValue() instanceof AlchemyArrayEffectCrafting)
|
||||
{
|
||||
AlchemyArrayEffectCrafting craftingEffect = (AlchemyArrayEffectCrafting) effectEntry.getValue();
|
||||
ItemStack resultStack = craftingEffect.getOutputStack();
|
||||
if (resultStack != null && resultStack.getItem() != null)
|
||||
ItemStack resultStack = craftingEffect.outputStack;
|
||||
if (!resultStack.isEmpty())
|
||||
{
|
||||
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage())
|
||||
{
|
||||
|
@ -291,9 +288,6 @@ public class AlchemyArrayRecipeRegistry
|
|||
return getAlchemyCircleRenderer(Collections.singletonList(itemStack), catalystStack);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public static class AlchemyArrayRecipe
|
||||
{
|
||||
public AlchemyCircleRenderer defaultCircleRenderer;
|
||||
|
@ -384,6 +378,45 @@ public class AlchemyArrayRecipeRegistry
|
|||
|
||||
return defaultCircleRenderer;
|
||||
}
|
||||
|
||||
public AlchemyCircleRenderer getDefaultCircleRenderer() {
|
||||
return defaultCircleRenderer;
|
||||
}
|
||||
|
||||
public List<ItemStack> getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public BiMap<ItemStackWrapper, AlchemyArrayEffect> getCatalystMap() {
|
||||
return catalystMap;
|
||||
}
|
||||
|
||||
public BiMap<ItemStackWrapper, AlchemyCircleRenderer> getCircleMap() {
|
||||
return circleMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof AlchemyArrayRecipe)) return false;
|
||||
|
||||
AlchemyArrayRecipe that = (AlchemyArrayRecipe) o;
|
||||
|
||||
if (defaultCircleRenderer != null ? !defaultCircleRenderer.equals(that.defaultCircleRenderer) : that.defaultCircleRenderer != null)
|
||||
return false;
|
||||
if (input != null ? !input.equals(that.input) : that.input != null) return false;
|
||||
if (catalystMap != null ? !catalystMap.equals(that.catalystMap) : that.catalystMap != null) return false;
|
||||
return circleMap != null ? circleMap.equals(that.circleMap) : that.circleMap == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = defaultCircleRenderer != null ? defaultCircleRenderer.hashCode() : 0;
|
||||
result = 31 * result + (input != null ? input.hashCode() : 0);
|
||||
result = 31 * result + (catalystMap != null ? catalystMap.hashCode() : 0);
|
||||
result = 31 * result + (circleMap != null ? circleMap.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static BiMap<List<ItemStack>, AlchemyArrayRecipe> getRecipes()
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ImperfectRitualRegistry
|
|||
if (imperfectRitual != null)
|
||||
{
|
||||
if (registry.containsKey(id))
|
||||
BloodMagicAPI.getLogger().error("Duplicate imperfect ritual id: %s", id);
|
||||
BloodMagicAPI.logger.error("Duplicate imperfect ritual id: %s", id);
|
||||
else
|
||||
{
|
||||
registry.put(id, imperfectRitual);
|
||||
|
@ -88,7 +88,7 @@ public class ImperfectRitualRegistry
|
|||
return enabledRituals.get(imperfectRitual);
|
||||
} catch (NullPointerException e)
|
||||
{
|
||||
BloodMagicAPI.getLogger().error("Invalid Imperfect Ritual was called");
|
||||
BloodMagicAPI.logger.error("Invalid Imperfect Ritual was called");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,15 @@ public class RitualRegistry
|
|||
{
|
||||
if (locked)
|
||||
{
|
||||
BloodMagicAPI.getLogger().error("This registry has been locked. Please register your ritual earlier.");
|
||||
BloodMagicAPI.getLogger().error("If you reflect this, I will hunt you down. - TehNut");
|
||||
BloodMagicAPI.logger.error("This registry has been locked. Please register your ritual earlier.");
|
||||
BloodMagicAPI.logger.error("If you reflect this, I will hunt you down. - TehNut");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ritual != null)
|
||||
{
|
||||
if (registry.containsKey(id))
|
||||
BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id);
|
||||
BloodMagicAPI.logger.error("Duplicate ritual id: %s", id);
|
||||
else
|
||||
{
|
||||
registry.put(id, ritual);
|
||||
|
@ -95,7 +95,7 @@ public class RitualRegistry
|
|||
return enabledRituals.get(ritual);
|
||||
} catch (NullPointerException e)
|
||||
{
|
||||
BloodMagicAPI.getLogger().error("Invalid Ritual was called");
|
||||
BloodMagicAPI.logger.error("Invalid Ritual was called");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -17,6 +19,9 @@ public enum EnumRuneType implements IStringSerializable
|
|||
DUSK(TextFormatting.DARK_GRAY),
|
||||
DAWN(TextFormatting.GOLD);
|
||||
|
||||
@GameRegistry.ObjectHolder("bloodmagic:inscription_tool")
|
||||
public static final Item INSCRIPTION_TOOL = Items.AIR;
|
||||
|
||||
public final TextFormatting colorCode;
|
||||
|
||||
EnumRuneType(TextFormatting colorCode)
|
||||
|
@ -34,7 +39,7 @@ public enum EnumRuneType implements IStringSerializable
|
|||
|
||||
public ItemStack getScribeStack()
|
||||
{
|
||||
return new ItemStack(Constants.BloodMagicItem.INSCRIPTION_TOOL.getItem(), 1, ordinal());
|
||||
return new ItemStack(INSCRIPTION_TOOL, 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.teleport;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Getter
|
||||
public class ChunkPairSerializable implements Serializable
|
||||
{
|
||||
private int chunkXPos;
|
||||
private int chunkZPos;
|
||||
|
||||
public ChunkPairSerializable(int chunkXPos, int chunkZPos)
|
||||
{
|
||||
this.chunkXPos = chunkXPos;
|
||||
this.chunkZPos = chunkZPos;
|
||||
}
|
||||
|
||||
public ChunkPairSerializable(BlockPos blockPos)
|
||||
{
|
||||
this(blockPos.getX() >> 4, blockPos.getZ() >> 4);
|
||||
}
|
||||
|
||||
public BlockPos getChunkCenter(int y)
|
||||
{
|
||||
return new BlockPos((chunkXPos << 4) + 8, y, (chunkZPos << 4) + 8);
|
||||
}
|
||||
|
||||
public BlockPos getChunkCenter()
|
||||
{
|
||||
return getChunkCenter(64);
|
||||
}
|
||||
}
|
|
@ -1,23 +1,16 @@
|
|||
package WayofTime.bloodmagic.api.teleport;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ToString
|
||||
public class PortalLocation implements Serializable
|
||||
{
|
||||
@Getter
|
||||
private int x;
|
||||
@Getter
|
||||
private int y;
|
||||
@Getter
|
||||
private int z;
|
||||
@Getter
|
||||
private int dimension;
|
||||
|
||||
public PortalLocation(int x, int y, int z, int dimension)
|
||||
|
@ -87,4 +80,20 @@ public class PortalLocation implements Serializable
|
|||
result = 31 * result + z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public int getDimension() {
|
||||
return dimension;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
package WayofTime.bloodmagic.api.teleport;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public abstract class Teleport implements ITeleport
|
||||
{
|
||||
@Getter
|
||||
protected int x;
|
||||
@Getter
|
||||
protected int y;
|
||||
@Getter
|
||||
protected int z;
|
||||
@Getter
|
||||
protected Entity entity;
|
||||
@Getter
|
||||
protected String networkToDrain;
|
||||
|
||||
public Teleport(int x, int y, int z, Entity entity, String networkToDrain)
|
||||
|
@ -34,4 +24,48 @@ public abstract class Teleport implements ITeleport
|
|||
{
|
||||
this(blockPos.getX(), blockPos.getY(), blockPos.getZ(), entity, networkToDrain);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public String getNetworkToDrain() {
|
||||
return networkToDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Teleport)) return false;
|
||||
|
||||
Teleport teleport = (Teleport) o;
|
||||
|
||||
if (x != teleport.x) return false;
|
||||
if (y != teleport.y) return false;
|
||||
if (z != teleport.z) return false;
|
||||
if (entity != null ? !entity.equals(teleport.entity) : teleport.entity != null) return false;
|
||||
return networkToDrain != null ? networkToDrain.equals(teleport.networkToDrain) : teleport.networkToDrain == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = x;
|
||||
result = 31 * result + y;
|
||||
result = 31 * result + z;
|
||||
result = 31 * result + (entity != null ? entity.hashCode() : 0);
|
||||
result = 31 * result + (networkToDrain != null ? networkToDrain.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package WayofTime.bloodmagic.api.util.helper;
|
|||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.event.SoulNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.api.saving.BMWorldSavedData;
|
||||
|
@ -87,9 +88,11 @@ public class NetworkHelper
|
|||
if (tier > OrbRegistry.getTierMap().size() || tier < 0)
|
||||
return ret;
|
||||
|
||||
for (ItemStack orbStack : OrbRegistry.getOrbsForTier(tier))
|
||||
if (((IBloodOrb) orbStack.getItem()).getMaxEssence(orbStack.getItemDamage()) > ret)
|
||||
ret = ((IBloodOrb) orbStack.getItem()).getMaxEssence(orbStack.getItemDamage());
|
||||
for (ItemStack orbStack : OrbRegistry.getOrbsForTier(tier)) {
|
||||
BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
|
||||
if (orb.getCapacity() > ret)
|
||||
ret = orb.getCapacity();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.bloodmagic.api.util.helper;
|
|||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
@ -82,7 +82,7 @@ public class PlayerSacrificeHelper
|
|||
{
|
||||
player.setHealth(maxHealth / 10.0f);
|
||||
setPlayerIncense(player, 0);
|
||||
player.addPotionEffect(new PotionEffect(ModPotions.soulFray, soulFrayDuration));
|
||||
player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, soulFrayDuration));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue