From b96725fe98b7d6edb059fb5525befd6ebd7aabd8 Mon Sep 17 00:00:00 2001 From: Arcaratus Date: Mon, 28 Dec 2015 19:09:51 -0500 Subject: [PATCH] More sigils Deleted weird file --- .../java/WayofTime/bloodmagic/BloodMagic.java | 2 + .../bloodmagic/api/altar/IBloodAltar.java | 2 +- .../api/compress/CompressionHandler.java | 14 + .../api/compress/CompressionRegistry.java | 57 ++++ .../bloodmagic/block/BlockPhantom.java | 9 +- .../compress/AdvancedCompressionHandler.java | 141 ++++++++++ .../compress/BaseCompressionHandler.java | 93 +++++++ .../compress/StorageBlockCraftingManager.java | 140 ++++++++++ ...StorageBlockCraftingRecipeAssimilator.java | 253 ++++++++++++++++++ .../item/ItemDaggerOfSacrifice.java | 89 ++++++ .../item/sigil/ItemSigilCompression.java | 25 +- .../item/sigil/ItemSigilEnderSeverance.java | 26 +- .../item/sigil/ItemSigilHurricane.java | 4 - .../item/sigil/ItemSigilWhirlwind.java | 19 ++ .../potion/PotionEventHandlers.java | 77 +++++- .../bloodmagic/registry/ModItems.java | 40 ++- .../bloodmagic/registry/ModPotions.java | 6 +- .../bloodmagic/registry/ModRecipes.java | 13 + .../bloodmagic/blockstates/BlockPhantom.json | 7 +- .../assets/bloodmagic/lang/en_US.lang | 9 +- .../bloodmagic/models/block/BlockPhantom.json | 8 +- .../models/item/ItemDaggerOfSacrifice.json | 6 + ...ivated.json => ItemSigilCompression0.json} | 0 ...ivated.json => ItemSigilCompression1.json} | 0 .../models/item/ItemSigilEnderSeverance0.json | 6 + .../models/item/ItemSigilEnderSeverance1.json | 6 + .../models/item/ItemSigilWhirlwind0.json | 6 + .../models/item/ItemSigilWhirlwind1.json | 6 + .../textures/blocks/PhantomBlock.png | Bin 792 -> 767 bytes .../items/SigilOfSupression_activated.png | Bin 637 -> 0 bytes .../items/SigilOfSupression_deactivated.png | Bin 645 -> 0 bytes 31 files changed, 1011 insertions(+), 53 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/api/compress/CompressionHandler.java create mode 100644 src/main/java/WayofTime/bloodmagic/api/compress/CompressionRegistry.java create mode 100644 src/main/java/WayofTime/bloodmagic/compress/AdvancedCompressionHandler.java create mode 100644 src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java create mode 100644 src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java create mode 100644 src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingRecipeAssimilator.java create mode 100644 src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java delete mode 100644 src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHurricane.java create mode 100644 src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilWhirlwind.java create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemDaggerOfSacrifice.json rename src/main/resources/assets/bloodmagic/models/item/{ItemSigilCompression_deactivated.json => ItemSigilCompression0.json} (100%) rename src/main/resources/assets/bloodmagic/models/item/{ItemSigilCompression_activated.json => ItemSigilCompression1.json} (100%) create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance0.json create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance1.json create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind0.json create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind1.json delete mode 100644 src/main/resources/assets/bloodmagic/textures/items/SigilOfSupression_activated.png delete mode 100644 src/main/resources/assets/bloodmagic/textures/items/SigilOfSupression_deactivated.png diff --git a/src/main/java/WayofTime/bloodmagic/BloodMagic.java b/src/main/java/WayofTime/bloodmagic/BloodMagic.java index 4e378205..7cf5d469 100644 --- a/src/main/java/WayofTime/bloodmagic/BloodMagic.java +++ b/src/main/java/WayofTime/bloodmagic/BloodMagic.java @@ -69,6 +69,8 @@ public class BloodMagic { @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { + ModRecipes.addCompressionHandlers(); + proxy.postInit(); } } diff --git a/src/main/java/WayofTime/bloodmagic/api/altar/IBloodAltar.java b/src/main/java/WayofTime/bloodmagic/api/altar/IBloodAltar.java index 8d10a5a8..93026308 100644 --- a/src/main/java/WayofTime/bloodmagic/api/altar/IBloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/api/altar/IBloodAltar.java @@ -26,7 +26,7 @@ public interface IBloodAltar { int getBufferCapacity(); - void sacrificialDaggerCall(int amount, boolean b); + void sacrificialDaggerCall(int amount, boolean isSacrifice); void startCycle(); diff --git a/src/main/java/WayofTime/bloodmagic/api/compress/CompressionHandler.java b/src/main/java/WayofTime/bloodmagic/api/compress/CompressionHandler.java new file mode 100644 index 00000000..ddb123e4 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/api/compress/CompressionHandler.java @@ -0,0 +1,14 @@ +package WayofTime.bloodmagic.api.compress; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public abstract class CompressionHandler { + + /** + * Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not. + * @param inv The inventory iterated through + * @return The result of the compression + */ + public abstract ItemStack compressInventory(ItemStack[] inv, World world); +} diff --git a/src/main/java/WayofTime/bloodmagic/api/compress/CompressionRegistry.java b/src/main/java/WayofTime/bloodmagic/api/compress/CompressionRegistry.java new file mode 100644 index 00000000..70c72084 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/api/compress/CompressionRegistry.java @@ -0,0 +1,57 @@ +package WayofTime.bloodmagic.api.compress; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A registry aimed to help compress items in an inventory into its compressible form. + */ +public class CompressionRegistry { + + public static List compressionRegistry = new ArrayList(); + public static Map thresholdMap = new HashMap(); + + public static void registerHandler(CompressionHandler handler) { + compressionRegistry.add(handler); + } + + /** + * Registers an item so that it only compresses while above this threshold + * + * @param stack item/block to be compressed + * @param threshold amount that is to be compressed + */ + public static void registerItemThreshold(ItemStack stack, int threshold) { + thresholdMap.put(stack, threshold); + } + + public static ItemStack compressInventory(ItemStack[] inv, World world) { + for (CompressionHandler handler : compressionRegistry) { + ItemStack stack = handler.compressInventory(inv, world); + if (stack != null) { + return stack; + } + } + + return null; + } + + public static int getItemThreshold(ItemStack stack) { + for (Map.Entry entry : thresholdMap.entrySet()) { + if (areItemStacksEqual(entry.getKey(), stack)) { + return entry.getValue(); + } + } + + return 0; + } + + public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) { + return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound())); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java b/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java index 0569ef95..ea72825b 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockPhantom.java @@ -35,10 +35,17 @@ public class BlockPhantom extends BlockContainer { return false; } + @Override + @SideOnly(Side.CLIENT) + public boolean isTranslucent() + { + return true; + } + @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { - return EnumWorldBlockLayer.CUTOUT; + return EnumWorldBlockLayer.TRANSLUCENT; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/compress/AdvancedCompressionHandler.java b/src/main/java/WayofTime/bloodmagic/compress/AdvancedCompressionHandler.java new file mode 100644 index 00000000..59883ec3 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compress/AdvancedCompressionHandler.java @@ -0,0 +1,141 @@ +package WayofTime.bloodmagic.compress; + +import WayofTime.bloodmagic.api.compress.CompressionHandler; +import WayofTime.bloodmagic.api.compress.CompressionRegistry; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class AdvancedCompressionHandler extends CompressionHandler { + + @Override + public ItemStack compressInventory(ItemStack[] inv, World world) { + return test(inv, true, world); + } + + public ItemStack test(ItemStack[] inv, boolean doDrain, World world) { + for (ItemStack invStack : inv) { + if (invStack == null) { + continue; + } + + for (int i = 2; i <= 3; i++) { + ItemStack stacky = getRecipe(invStack, world, i); + if (stacky != null) { + int threshold = CompressionRegistry.getItemThreshold(invStack); + + int needed = i * i; + int neededLeft = iterateThroughInventory(invStack, threshold + invStack.getMaxStackSize() - needed, inv, needed, false); + if (neededLeft <= 0) { + iterateThroughInventory(invStack, 0, inv, needed, true); + return stacky; + } + } + } + } + + return null; + } + + public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain) { + int i = -1; + + for (ItemStack invStack : inv) { + i++; + + if (invStack == null) { + continue; + } + + if (invStack.isItemEqual(required) && (invStack.getTagCompound() == null ? required.getTagCompound() == null : invStack.getTagCompound().equals(required.getTagCompound()))) { + int stackSize = invStack.stackSize; + int used = 0; + if (kept > 0) { + int remainingFromStack = Math.max(stackSize - kept, 0); + used += stackSize - remainingFromStack; + } + + kept -= used; + + if (kept <= 0 && needed > 0) { + int remainingFromStack = Math.max(stackSize - used - needed, 0); + if (doDrain) { + invStack.stackSize = remainingFromStack + used; + if (invStack.stackSize <= 0) { + inv[i] = null; + } + } + + needed -= (stackSize - used - remainingFromStack); + } + + if (needed <= 0) { + return 0; + } + } + } + + return needed; + } + + public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world) { + if (stack == null) { + return false; + } + InventoryCrafting inventory = new InventoryCrafting(new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, 2, 2); + + inventory.setInventorySlotContents(0, stack); + + ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); + if (returnStack == null) { + return false; + } + + ItemStack compressedStack = null; + switch (gridSize) { + case 2: + compressedStack = get22Recipe(returnStack, world); + break; + case 3: + compressedStack = get33Recipe(returnStack, world); + break; + } + + return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack); + } + + public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { + InventoryCrafting inventory = new InventoryCrafting(new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, gridSize, gridSize); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + inventory.setInventorySlotContents(i, stack); + } + + return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); + } + + public static boolean has22Recipe(ItemStack stack, World world) { + return get22Recipe(stack, world) != null; + } + + public static ItemStack get22Recipe(ItemStack stack, World world) { + return getRecipe(stack, world, 2); + } + + public static boolean has33Recipe(ItemStack stack, World world) { + return get33Recipe(stack, world) != null; + } + + public static ItemStack get33Recipe(ItemStack stack, World world) { + return getRecipe(stack, world, 3); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java b/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java new file mode 100644 index 00000000..0039c09f --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compress/BaseCompressionHandler.java @@ -0,0 +1,93 @@ +package WayofTime.bloodmagic.compress; + +import WayofTime.bloodmagic.api.compress.CompressionHandler; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class BaseCompressionHandler extends CompressionHandler { + + private final ItemStack required; + private final ItemStack result; + private final int leftover; + + public BaseCompressionHandler(ItemStack requested, ItemStack result, int leftover) { + super(); + this.required = requested; + this.result = result; + this.leftover = leftover; + } + + public ItemStack getResultStack() { + return this.result.copy(); + } + + public ItemStack getRequiredStack() { + return this.required.copy(); + } + + @Override + public ItemStack compressInventory(ItemStack[] inv, World world) { + int remaining = this.getRemainingNeeded(inv); + if (remaining <= 0) { + this.drainInventory(inv); + return this.getResultStack(); + } + + return null; + } + + public int getRemainingNeeded(ItemStack[] inv) { + return iterateThroughInventory(inv, false); + } + + public int drainInventory(ItemStack[] inv) { + return iterateThroughInventory(inv, true); + } + + public int iterateThroughInventory(ItemStack[] inv, boolean doDrain) { + int needed = this.required.stackSize; + int kept = this.getLeftover(); + int i = -1; + + for (ItemStack invStack : inv) { + i++; + + if (invStack == null) { + continue; + } + + if (invStack.isItemEqual(this.required) && (invStack.getTagCompound() == null ? this.required.getTagCompound() == null : invStack.getTagCompound().equals(this.required.getTagCompound()))) { + int stackSize = invStack.stackSize; + int used = 0; + if (kept > 0) { + int remainingFromStack = Math.max(stackSize - kept, 0); + used += stackSize - remainingFromStack; + } + + kept -= used; + + if (kept <= 0 && needed > 0) { + int remainingFromStack = Math.max(stackSize - used - needed, 0); + if (doDrain) { + invStack.stackSize = remainingFromStack + used; + if (invStack.stackSize <= 0) { + inv[i] = null; + } + } + + needed -= (stackSize - used - remainingFromStack); + } + + if (needed <= 0) { + return 0; + } + } + } + + return needed; + } + + public int getLeftover() { + return this.leftover; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java new file mode 100644 index 00000000..ba047c16 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java @@ -0,0 +1,140 @@ +package WayofTime.bloodmagic.compress; + +import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.api.compress.CompressionRegistry; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; + +import java.util.LinkedList; +import java.util.List; + +public class StorageBlockCraftingManager { + + private static final StorageBlockCraftingManager instance = new StorageBlockCraftingManager(); + private List recipes = new LinkedList(); + + public static StorageBlockCraftingManager getInstance() { + return instance; + } + + public void addStorageBlockRecipes() { + this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes(); + + BloodMagic.instance.getLogger().info("Total number of compression recipes: " + this.recipes.size()); + } + + private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list) { + if (stack == null) { + return false; + } + InventoryCrafting inventory = new InventoryCrafting(new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, 2, 2); + + inventory.setInventorySlotContents(0, stack); + + ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); + if (returnStack == null || returnStack.getItem() == null) { + return false; + } + + ItemStack compressedStack = null; + switch (gridSize) { + case 2: + compressedStack = get22Recipe(returnStack, world, list); + break; + case 3: + compressedStack = get33Recipe(returnStack, world, list); + break; + } + + return compressedStack != null && CompressionRegistry.areItemStacksEqual(stack, compressedStack); + } + + private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list) { + InventoryCrafting inventory = new InventoryCrafting(new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, gridSize, gridSize); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + inventory.setInventorySlotContents(i, stack); + } + + return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); + } + + private static boolean has22Recipe(ItemStack stack, World world, List list) { + return get22Recipe(stack, world, list) != null; + } + + private static ItemStack get22Recipe(ItemStack stack, World world, List list) { + return getRecipe(stack, world, 2, list); + } + + private static boolean has33Recipe(ItemStack stack, World world, List list) { + return get33Recipe(stack, world, list) != null; + } + + private static ItemStack get33Recipe(ItemStack stack, World world, List list) { + return getRecipe(stack, world, 3, list); + } + + public ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world) { + return this.findMatchingRecipe(craftingInventory, world, this.recipes); + } + + private ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world, List list) { + int i = 0; + ItemStack itemstack = null; + ItemStack itemstack1 = null; + int j; + + for (j = 0; j < craftingInventory.getSizeInventory(); ++j) { + ItemStack itemstack2 = craftingInventory.getStackInSlot(j); + + if (itemstack2 != null) { + if (i == 0) { + itemstack = itemstack2; + } + + if (i == 1) { + itemstack1 = itemstack2; + } + + ++i; + } + } + + if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) { + Item item = itemstack.getItem(); + int j1 = item.getMaxDamage() - itemstack.getItemDamage(); + int k = item.getMaxDamage() - itemstack1.getItemDamage(); + int l = j1 + k + item.getMaxDamage() * 5 / 100; + int i1 = item.getMaxDamage() - l; + + if (i1 < 0) { + i1 = 0; + } + + return new ItemStack(itemstack.getItem(), 1, i1); + } else { + for (j = 0; j < list.size(); ++j) { + IRecipe irecipe = (IRecipe) list.get(j); + + if (irecipe.matches(craftingInventory, world)) { + return irecipe.getCraftingResult(craftingInventory); + } + } + + return null; + } + } +} diff --git a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingRecipeAssimilator.java b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingRecipeAssimilator.java new file mode 100644 index 00000000..693547e0 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingRecipeAssimilator.java @@ -0,0 +1,253 @@ +package WayofTime.bloodmagic.compress; + +import WayofTime.bloodmagic.BloodMagic; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +import java.util.*; + +public class StorageBlockCraftingRecipeAssimilator { + + public List getPackingRecipes() { + // grab all recipes potentially suitable for packing or unpacking + + List packingRecipes = new LinkedList(); + List unpackingRecipes = new ArrayList(); + + for (IRecipe recipe : getCraftingRecipes()) { + ItemStack output = recipe.getRecipeOutput(); + if (output == null || output.getItem() == null) continue; + + if (output.stackSize == 1) { + PackingRecipe packingRecipe = getPackingRecipe(recipe); + + if (packingRecipe != null) { + packingRecipes.add(packingRecipe); + } + } else if ((output.stackSize == 4 || output.stackSize == 9) && recipe.getRecipeSize() == 1) { + unpackingRecipes.add(recipe); + } + } + + // grab all packing recipes which accept the output of any of the unpacking recipes + + Container container = makeDummyContainer(); + InventoryCrafting inventoryUnpack = new InventoryCrafting(container, 2, 2); + InventoryCrafting inventory2x2 = new InventoryCrafting(container, 2, 2); + InventoryCrafting inventory3x3 = new InventoryCrafting(container, 3, 3); + World world = null; // TODO: use a proper dummy world? + + List ret = new ArrayList(); + + for (IRecipe recipeUnpack : unpackingRecipes) { + ItemStack unpacked = recipeUnpack.getRecipeOutput(); + InventoryCrafting inventory = null; + + for (Iterator it = packingRecipes.iterator(); it.hasNext(); ) { + PackingRecipe recipePack = it.next(); + + // check if the packing recipe accepts the unpacking recipe's output + + boolean matched = false; + + if (recipePack.possibleInputs != null) { // the recipe could be parsed, use its inputs directly since that's faster + // verify recipe size + + if (recipePack.inputCount != unpacked.stackSize) continue; + + // check if any of the input options matches the unpacked item stack + + for (ItemStack stack : recipePack.possibleInputs) { + if (areInputsIdentical(unpacked, stack)) { + matched = true; + break; + } + } + } else { // unknown IRecipe, check through the recipe conventionally + // verify recipe size for 3x3 to skip anything smaller quickly + + if (unpacked.stackSize == 9 && recipePack.recipe.getRecipeSize() < 9) continue; + + // initialize inventory late, but only once per unpack recipe + + if (inventory == null) { + if (unpacked.stackSize == 4) { + inventory = inventory2x2; + } else { + inventory = inventory3x3; + } + + for (int i = 0; i < unpacked.stackSize; i++) { + inventory.setInventorySlotContents(i, unpacked.copy()); + } + } + + // check if the packing recipe accepts the unpacked item stack + + matched = recipePack.recipe.matches(inventory, world); + } + + if (matched) { + // check if the unpacking recipe accepts the packing recipe's output + + ItemStack packOutput = recipePack.recipe.getRecipeOutput(); + inventoryUnpack.setInventorySlotContents(0, packOutput.copy()); + + if (recipeUnpack.matches(inventoryUnpack, world)) { + ret.add(recipePack.recipe); + BloodMagic.instance.getLogger().info("Adding the following recipe to the Compression Handler: " + packOutput); + it.remove(); + } + } + } + } + + return ret; + } + + @SuppressWarnings("unchecked") + private List getCraftingRecipes() { + return CraftingManager.getInstance().getRecipeList(); + } + + private Container makeDummyContainer() { + return new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return true; + } + }; + } + + private PackingRecipe getPackingRecipe(IRecipe recipe) { + if (recipe.getRecipeSize() < 4) return null; + + List inputs; + + if (recipe instanceof ShapedRecipes) { + inputs = Arrays.asList(((ShapedRecipes) recipe).recipeItems); + } else if (recipe instanceof ShapelessRecipes) { + inputs = ((ShapelessRecipes) recipe).recipeItems; + } else if (recipe instanceof ShapedOreRecipe) { + inputs = Arrays.asList(((ShapedOreRecipe) recipe).getInput()); + } else if (recipe instanceof ShapelessOreRecipe) { + inputs = ((ShapelessOreRecipe) recipe).getInput(); + } else { + return new PackingRecipe(recipe, null, -1); + } + + // check if the recipe inputs are size 4 or 9 + + int count = 0; + + for (Object o : inputs) { + if (o != null) count++; + } + + if (count != 4 && count != 9) return null; + + // grab identical inputs + + List identicalInputs = getIdenticalInputs(inputs); + if (identicalInputs == null) return null; + + return new PackingRecipe(recipe, identicalInputs, count); + } + + /** + * Determine the item stacks from the provided inputs which are suitable for every input element. + * + * @param inputs List of all inputs, null elements are being ignored. + * @return List List of all options. + */ + @SuppressWarnings("unchecked") + private List getIdenticalInputs(List inputs) { + List options = null; + + for (Object input : inputs) { + if (input == null) continue; + + List offers; + + if (input instanceof ItemStack) { + offers = Collections.singletonList((ItemStack) input); + } else if (input instanceof List) { + offers = (List) input; + + if (offers.isEmpty()) return null; + } else { + throw new RuntimeException("invalid input: "+input.getClass()); + } + + if (options == null) { + options = new ArrayList(offers); + continue; + } + + for (Iterator it = options.iterator(); it.hasNext(); ) { + ItemStack stackReq = it.next(); + boolean found = false; + + for (ItemStack stackCmp : offers) { + if (areInputsIdentical(stackReq, stackCmp)) { + found = true; + break; + } + } + + if (!found) { + it.remove(); + + if (options.isEmpty()) return null; + } + } + } + + return options; + } + + private boolean areInputsIdentical(ItemStack a, ItemStack b) { + + try { + if (a.getItem() != b.getItem()) + return false; + + int dmgA = a.getItemDamage(); + int dmgB = b.getItemDamage(); + + return dmgA == dmgB || dmgA == OreDictionary.WILDCARD_VALUE || dmgB == OreDictionary.WILDCARD_VALUE; + } catch (NullPointerException e) { + + BloodMagic.instance.getLogger().error("A mod in this instance has registered an item with a null input. Known problem mods are:"); + +// String err = ""; +// for (String problem : problemMods) +// err += (err.length() > 0 ? ", " : "") + problem; +// BloodMagic.instance.getLogger().error(err); + + return false; + } + } + + private static class PackingRecipe { + PackingRecipe(IRecipe recipe, List possibleInputs, int inputCount) { + this.recipe = recipe; + this.possibleInputs = possibleInputs; + this.inputCount = inputCount; + } + + final IRecipe recipe; + final List possibleInputs; + final int inputCount; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java new file mode 100644 index 00000000..fc29a769 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/item/ItemDaggerOfSacrifice.java @@ -0,0 +1,89 @@ +package WayofTime.bloodmagic.item; + +import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.DamageSourceBloodMagic; +import WayofTime.bloodmagic.api.altar.IBloodAltar; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ItemDaggerOfSacrifice extends Item { + + public ItemDaggerOfSacrifice() { + super(); + setUnlocalizedName(Constants.Mod.MODID + ".daggerOfSacrifice"); + setCreativeTab(BloodMagic.tabBloodMagic); + setMaxStackSize(1); + setFull3D(); + } + + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { + if (target == null || attacker == null || attacker.worldObj.isRemote || (attacker instanceof EntityPlayer && !(attacker instanceof EntityPlayerMP))) + return false; + + if (target.isChild() || target instanceof EntityPlayer || target instanceof IBossDisplayData) + return false; + + if (target.isDead || target.getHealth() < 0.5F) + return false; + + //TODO Make these configurable + int lifeEssence = 500; + if (target instanceof EntityVillager) lifeEssence = 2000; + else if (target instanceof EntitySlime) lifeEssence = 150; + else if (target instanceof EntityEnderman) lifeEssence = 200; + else if (target instanceof EntityAnimal) lifeEssence = 250; + + if (findAndFillAltar(attacker.worldObj, target, lifeEssence)) { + double posX = target.posX; + double posY = target.posY; + double posZ = target.posZ; + target.worldObj.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F); + target.setHealth(-1); + target.onDeath(new DamageSourceBloodMagic()); + } + + return false; + } + + public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount) { + IBloodAltar bloodAltar = findBloodAltar(world, sacrifice.getPosition()); + + if (bloodAltar != null) { + bloodAltar.sacrificialDaggerCall(amount, true); + bloodAltar.startCycle(); + return true; + } + + return false; + } + + public IBloodAltar findBloodAltar(World world, BlockPos blockPos) { + TileEntity tileEntity; + + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { + for (int k = -2; k <= 1; k++) { + tileEntity = world.getTileEntity(blockPos.add(i, k, j)); + + if ((tileEntity instanceof IBloodAltar)) + return (IBloodAltar) tileEntity; + } + } + } + + return null; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilCompression.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilCompression.java index 4d58bed9..24c960b7 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilCompression.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilCompression.java @@ -1,4 +1,27 @@ package WayofTime.bloodmagic.item.sigil; -public class ItemSigilCompression { +import WayofTime.bloodmagic.api.compress.CompressionRegistry; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItemSigilCompression extends ItemSigilToggleable { + + public ItemSigilCompression() { + super("compression", 200); + } + + //TODO REWRITE all compression stuff if someone has time + //TODO for now, there is a semi-working system in place + + @Override + public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) { + ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world); + + if (compressedStack != null) { + EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, compressedStack); + world.spawnEntityInWorld(entityItem); + } + } } diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilEnderSeverance.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilEnderSeverance.java index db58306e..f2c8efbe 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilEnderSeverance.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilEnderSeverance.java @@ -1,4 +1,28 @@ package WayofTime.bloodmagic.item.sigil; -public class ItemSigilEnderSeverance { +import WayofTime.bloodmagic.registry.ModPotions; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; + +import java.util.List; + +public class ItemSigilEnderSeverance extends ItemSigilToggleable { + + public ItemSigilEnderSeverance() { + super("enderSeverance", 200); + } + + @Override + public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) { + List entityList = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(player.posX - 4.5, player.posY - 4.5, player.posZ - 4.5, player.posX + 4.5, player.posY + 4.5, player.posZ + 4.5)); + for (Entity entity : entityList) { + if (entity instanceof EntityEnderman) + ((EntityEnderman) entity).addPotionEffect(new PotionEffect(ModPotions.planarBinding.id, 40, 0)); + } + } } diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHurricane.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHurricane.java deleted file mode 100644 index 571f0073..00000000 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilHurricane.java +++ /dev/null @@ -1,4 +0,0 @@ -package WayofTime.bloodmagic.item.sigil; - -public class ItemSigilHurricane { -} diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilWhirlwind.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilWhirlwind.java new file mode 100644 index 00000000..90f92310 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilWhirlwind.java @@ -0,0 +1,19 @@ +package WayofTime.bloodmagic.item.sigil; + +import WayofTime.bloodmagic.registry.ModPotions; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class ItemSigilWhirlwind extends ItemSigilToggleable { + + public ItemSigilWhirlwind() { + super("whirlwind", 250); + } + + @Override + public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) { + player.addPotionEffect(new PotionEffect(ModPotions.whirlwind.id, 2, 0, true, false)); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java b/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java index ed38826a..3d759db6 100644 --- a/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java +++ b/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java @@ -1,14 +1,19 @@ package WayofTime.bloodmagic.potion; import WayofTime.bloodmagic.registry.ModPotions; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.Entity; +import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.EnderTeleportEvent; +import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.ArrayList; import java.util.List; public class PotionEventHandlers { @@ -31,11 +36,6 @@ public class PotionEventHandlers { @SubscribeEvent public void onEntityUpdate(LivingEvent.LivingUpdateEvent event) { -// EntityLivingBase entityLiving = event.entityLiving; -// double x = entityLiving.posX; -// double y = entityLiving.posY; -// double z = entityLiving.posZ; - if (event.entityLiving.isPotionActive(ModPotions.boost)) { int i = event.entityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier(); @@ -51,5 +51,66 @@ public class PotionEventHandlers { } } } + + if (event.entityLiving.isPotionActive(ModPotions.whirlwind)) { + int d0 = 3; + AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(event.entityLiving.posX - 0.5, event.entityLiving.posY - 0.5, event.entityLiving.posZ - 0.5, event.entityLiving.posX + 0.5, event.entityLiving.posY + 0.5, event.entityLiving.posZ + 0.5).expand(d0, d0, d0); + List entityList = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisAlignedBB); + + for (Object thing : entityList) { + Entity projectile = (Entity) thing; + + if (projectile == null) continue; + if (!(projectile instanceof IProjectile)) continue; + + Entity throwingEntity = null; + + if (projectile instanceof EntityArrow) throwingEntity = ((EntityArrow) projectile).shootingEntity; + else if (projectile instanceof EntityThrowable) + throwingEntity = ((EntityThrowable) projectile).getThrower(); + + if (throwingEntity != null && throwingEntity.equals(event.entityLiving)) continue; + + double delX = projectile.posX - event.entityLiving.posX; + double delY = projectile.posY - event.entityLiving.posY; + double delZ = projectile.posZ - event.entityLiving.posZ; + + double angle = (delX * projectile.motionX + delY * projectile.motionY + delZ * projectile.motionZ) / + (Math.sqrt(delX * delX + delY * delY + delZ * delZ) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ)); + + angle = Math.acos(angle); + + if (angle < 3 * (Math.PI / 4)) continue; //angle is < 135 degrees + + if (throwingEntity != null) { + delX = -projectile.posX + throwingEntity.posX; + delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight()); + delZ = -projectile.posZ + throwingEntity.posZ; + } + + double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ); + + delX /= curVel; + delY /= curVel; + delZ /= curVel; + double newVel = Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ); + projectile.motionX = newVel * delX; + projectile.motionY = newVel * delY; + projectile.motionZ = newVel * delZ; + } + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onPlayerDamageEvent(LivingAttackEvent event) { + if (event.entityLiving.isPotionActive(ModPotions.whirlwind) && event.isCancelable() && event.source.isProjectile()) + event.setCanceled(true); + } + + @SubscribeEvent + public void onEndermanTeleportEvent(EnderTeleportEvent event) { + if (event.entityLiving.isPotionActive(ModPotions.planarBinding) && event.isCancelable()) { + event.setCanceled(true); + } } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModItems.java b/src/main/java/WayofTime/bloodmagic/registry/ModItems.java index 46e1df62..a8d6e45b 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModItems.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModItems.java @@ -7,31 +7,11 @@ import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.orb.BloodOrb; import WayofTime.bloodmagic.api.registry.OrbRegistry; -import WayofTime.bloodmagic.item.ItemActivationCrystal; -import WayofTime.bloodmagic.item.ItemAltarMaker; -import WayofTime.bloodmagic.item.ItemBloodOrb; -import WayofTime.bloodmagic.item.ItemBucketEssence; -import WayofTime.bloodmagic.item.ItemComponent; -import WayofTime.bloodmagic.item.ItemInscriptionTool; -import WayofTime.bloodmagic.item.ItemSacrificialDagger; -import WayofTime.bloodmagic.item.ItemSlate; +import WayofTime.bloodmagic.item.*; import WayofTime.bloodmagic.item.armour.ItemLivingArmour; import WayofTime.bloodmagic.item.gear.ItemPackSacrifice; import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice; -import WayofTime.bloodmagic.item.sigil.ItemSigilAir; -import WayofTime.bloodmagic.item.sigil.ItemSigilBloodLight; -import WayofTime.bloodmagic.item.sigil.ItemSigilDivination; -import WayofTime.bloodmagic.item.sigil.ItemSigilElementalAffinity; -import WayofTime.bloodmagic.item.sigil.ItemSigilFastMiner; -import WayofTime.bloodmagic.item.sigil.ItemSigilGreenGrove; -import WayofTime.bloodmagic.item.sigil.ItemSigilHaste; -import WayofTime.bloodmagic.item.sigil.ItemSigilLava; -import WayofTime.bloodmagic.item.sigil.ItemSigilMagnetism; -import WayofTime.bloodmagic.item.sigil.ItemSigilPhantomBridge; -import WayofTime.bloodmagic.item.sigil.ItemSigilSeer; -import WayofTime.bloodmagic.item.sigil.ItemSigilSuppression; -import WayofTime.bloodmagic.item.sigil.ItemSigilVoid; -import WayofTime.bloodmagic.item.sigil.ItemSigilWater; +import WayofTime.bloodmagic.item.sigil.*; import WayofTime.bloodmagic.util.helper.InventoryRenderHelper; public class ModItems { @@ -53,6 +33,7 @@ public class ModItems { public static Item sacrificialDagger; public static Item packSelfSacrifice; public static Item packSacrifice; + public static Item daggerOfSacrifice; public static Item sigilDivination; public static Item sigilAir; @@ -68,7 +49,7 @@ public class ModItems { public static Item sigilFastMiner; public static Item sigilSeer; public static Item sigilEnderSeverance; - public static Item sigilHurricane; + public static Item sigilWhirlwind; public static Item sigilPhantomBridge; public static Item sigilCompression; @@ -105,6 +86,7 @@ public class ModItems { sacrificialDagger = registerItem(new ItemSacrificialDagger()); packSacrifice = registerItem(new ItemPackSacrifice()); packSelfSacrifice = registerItem(new ItemPackSelfSacrifice()); + daggerOfSacrifice = registerItem(new ItemDaggerOfSacrifice()); sigilDivination = registerItem(new ItemSigilDivination()); sigilAir = registerItem(new ItemSigilAir()); @@ -120,6 +102,9 @@ public class ModItems { sigilFastMiner = registerItem(new ItemSigilFastMiner()); sigilSeer = registerItem(new ItemSigilSeer()); sigilPhantomBridge = registerItem(new ItemSigilPhantomBridge()); + sigilWhirlwind = registerItem(new ItemSigilWhirlwind()); + sigilCompression = registerItem(new ItemSigilCompression()); + sigilEnderSeverance = registerItem(new ItemSigilEnderSeverance()); itemComponent = registerItem(new ItemComponent()); @@ -165,6 +150,7 @@ public class ModItems { renderHelper.itemRender(sacrificialDagger, 1); renderHelper.itemRender(packSacrifice); renderHelper.itemRender(packSelfSacrifice); + renderHelper.itemRender(daggerOfSacrifice); renderHelper.itemRender(sigilDivination); renderHelper.itemRender(sigilAir); @@ -187,7 +173,13 @@ public class ModItems { renderHelper.itemRender(sigilSeer); renderHelper.itemRender(sigilPhantomBridge, 0); renderHelper.itemRender(sigilPhantomBridge, 1); - + renderHelper.itemRender(sigilWhirlwind, 0); + renderHelper.itemRender(sigilWhirlwind, 1); + renderHelper.itemRender(sigilCompression, 0); + renderHelper.itemRender(sigilCompression, 1); + renderHelper.itemRender(sigilEnderSeverance, 0); + renderHelper.itemRender(sigilEnderSeverance, 1); + for(int i = 0 ; i < ItemComponent.getNames().size() ; i++) renderHelper.itemRender(itemComponent, i); diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java index 6ec4b821..fed56c9d 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java @@ -14,6 +14,8 @@ public class ModPotions { public static Potion drowning; public static Potion boost; public static Potion heavyHeart; + public static Potion whirlwind; + public static Potion planarBinding; public static void init() { if (Potion.potionTypes.length < 256) extendPortionArray(); @@ -25,9 +27,11 @@ public class ModPotions { // final String resourceLocation = Constants.Mod.MODID + ":textures/potions/"; // drowning = new PotionBloodMagic("Drowning", new ResourceLocation(resourceLocation + drowning.getName().toLowerCase()), true, 0, 0, 0); - boost = new PotionBloodMagic("Boost", new ResourceLocation("Minecraft:textures/gui/container/inventory.png") + boost = new PotionBloodMagic("Boost", new ResourceLocation("boost") // new ResourceLocation(resourceLocation + boost.getName().toLowerCase()) , false, 0, 0, 0); + whirlwind = new PotionBloodMagic("Whirlwind", new ResourceLocation("whirlwind"), false, 0, 0, 0); + planarBinding = new PotionBloodMagic("Planar Binding", new ResourceLocation("planarBinding"), false, 0, 0, 0); // heavyHeart = new PotionBloodMagic("Heavy Heart", new ResourceLocation(resourceLocation + heavyHeart.getName().toLowerCase()), true, 0, 0, 0); } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 4bcf0def..d2b70413 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -1,6 +1,10 @@ package WayofTime.bloodmagic.registry; import WayofTime.bloodmagic.item.ItemComponent; +import WayofTime.bloodmagic.api.compress.CompressionRegistry; +import WayofTime.bloodmagic.compress.AdvancedCompressionHandler; +import WayofTime.bloodmagic.compress.BaseCompressionHandler; +import WayofTime.bloodmagic.compress.StorageBlockCraftingManager; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -61,4 +65,13 @@ public class ModRecipes { AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.sigilElementalAffinity), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ElementalAffinitySigil.png")); AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SIGHT), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilSeer), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png")); } + + public static void addCompressionHandlers() { + StorageBlockCraftingManager.getInstance().addStorageBlockRecipes(); + CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.glowstone_dust, 4, 0), new ItemStack(Blocks.glowstone), 64)); + CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.snowball, 4, 0), new ItemStack(Blocks.snow), 8)); + CompressionRegistry.registerHandler(new AdvancedCompressionHandler()); + + CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.cobblestone), 64); + } } diff --git a/src/main/resources/assets/bloodmagic/blockstates/BlockPhantom.json b/src/main/resources/assets/bloodmagic/blockstates/BlockPhantom.json index 4db1b41a..7f83de76 100644 --- a/src/main/resources/assets/bloodmagic/blockstates/BlockPhantom.json +++ b/src/main/resources/assets/bloodmagic/blockstates/BlockPhantom.json @@ -1,10 +1,5 @@ { "variants": { - "normal": { - "model": "bloodmagic:BlockPhantom", - "textures": { - "all": "bloodmagic:blocks/PhantomBlock" - } - } + "normal": { "model": "bloodmagic:BlockPhantom" } } } diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index 0808fa42..b41581e4 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -10,6 +10,7 @@ item.BloodMagic.sacrificialDagger.normal.name=Sacrificial Dagger item.BloodMagic.sacrificialDagger.creative.name=Creative Sacrificial Dagger item.BloodMagic.pack.selfSacrifice.name=Blood Letter's Pack item.BloodMagic.pack.sacrifice.name=Coat of Arms +item.BloodMagic.daggerOfSacrifice.name=Dagger of Sacrifice item.BloodMagic.bucket.lifeEssence.name=Bucket of Life @@ -83,6 +84,8 @@ item.BloodMagic.sigil.magnetism.name=Sigil of Magnetism item.BloodMagic.sigil.fastMiner.name=Sigil of the Fast Miner item.BloodMagic.sigil.seer.name=Seer's Sigil item.BloodMagic.sigil.phantomBridge.name=Sigil of the Phantom Bridge +item.BloodMagic.sigil.whirlwind.name=Sigil of the Whirlwind +item.BloodMagic.sigil.enderSeverance.name=Sigil of Ender Severance item.BloodMagic.altarMaker.name=Altar Maker @@ -129,7 +132,7 @@ tooltip.BloodMagic.deactivated=Deactivated tooltip.BloodMagic.sigil.air.desc=&oI feel lighter already... tooltip.BloodMagic.sigil.bloodLight.desc=&oI see a light! -tooltip.BloodMagic.sigil.compression.desc=&oHands of Diamonds +tooltip.BloodMagic.sigil.compression.desc=&oHands of diamonds tooltip.BloodMagic.sigil.divination.desc=&oPeer into the soul tooltip.BloodMagic.sigil.divination.currentAltarTier=Current Tier: %d tooltip.BloodMagic.sigil.divination.currentEssence=Current Essence: %d LP @@ -149,7 +152,9 @@ tooltip.BloodMagic.sigil.seer.currentAltarConsumptionRate=Consumption Rate: %d L tooltip.BloodMagic.sigil.seer.currentAltarTier=Current Tier: %d tooltip.BloodMagic.sigil.seer.currentEssence=Current Essence: %d LP tooltip.BloodMagic.sigil.seer.currentAltarCapacity=Current Capacity: %d LP -tooltip.BloodMagic.sigil.phantomBridge.desc=Walking in thin air... +tooltip.BloodMagic.sigil.phantomBridge.desc=&oWalking on thin air... +tooltip.BloodMagic.sigil.whirlwind.desc=&oBest not to wear a skirt +tooltip.BloodMagic.sigil.enderSeverance.desc=&oPutting Endermen in Dire situations! tooltip.BloodMagic.sacrificialDagger.desc=Just a prick of the finger will suffice... tooltip.BloodMagic.slate.desc=Infused stone inside of a Blood Altar diff --git a/src/main/resources/assets/bloodmagic/models/block/BlockPhantom.json b/src/main/resources/assets/bloodmagic/models/block/BlockPhantom.json index 448aef05..1a2e871a 100644 --- a/src/main/resources/assets/bloodmagic/models/block/BlockPhantom.json +++ b/src/main/resources/assets/bloodmagic/models/block/BlockPhantom.json @@ -1,6 +1,6 @@ { - "parent": "block/cube_all", - "textures": { - "all": "bloodmagic:blocks/PhantomBlock" - } + "parent": "block/cube_all", + "textures": { + "all": "bloodmagic:blocks/PhantomBlock" + } } diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemDaggerOfSacrifice.json b/src/main/resources/assets/bloodmagic/models/item/ItemDaggerOfSacrifice.json new file mode 100644 index 00000000..64b3723a --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemDaggerOfSacrifice.json @@ -0,0 +1,6 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/DaggerOfSacrifice" + } +} diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression_deactivated.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression0.json similarity index 100% rename from src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression_deactivated.json rename to src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression0.json diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression_activated.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression1.json similarity index 100% rename from src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression_activated.json rename to src/main/resources/assets/bloodmagic/models/item/ItemSigilCompression1.json diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance0.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance0.json new file mode 100644 index 00000000..544f221e --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance0.json @@ -0,0 +1,6 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/SigilOfSeverance_deactivated" + } +} diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance1.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance1.json new file mode 100644 index 00000000..b24c7d40 --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemSigilEnderSeverance1.json @@ -0,0 +1,6 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/SigilOfSeverance_activated" + } +} diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind0.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind0.json new file mode 100644 index 00000000..d592a7b8 --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind0.json @@ -0,0 +1,6 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/WindSigil_deactivated" + } +} diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind1.json b/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind1.json new file mode 100644 index 00000000..c723292c --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemSigilWhirlwind1.json @@ -0,0 +1,6 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/WindSigil_activated" + } +} diff --git a/src/main/resources/assets/bloodmagic/textures/blocks/PhantomBlock.png b/src/main/resources/assets/bloodmagic/textures/blocks/PhantomBlock.png index 9e3a7e605722750a16137554af4d7ad508b1362f..fa7709b09539d862e06dc3aa280634d86f420600 100644 GIT binary patch delta 36 scmbQi_Mdfv3NK5#qpu?a!^VE@KZ&dp6^%G#1cY_=PwKDT*fNC)0M5w^$^ZZW delta 63 zcmey*I)iP3%0v@=Ln%>ljsM2N;S3B6vY8S|xv6<2KrRD=b5UwyNotBhd1gt5 Rg1e`0K#E=}`^M}kOaMk>5|97@ diff --git a/src/main/resources/assets/bloodmagic/textures/items/SigilOfSupression_activated.png b/src/main/resources/assets/bloodmagic/textures/items/SigilOfSupression_activated.png deleted file mode 100644 index eb2d7deea5a78dd9513e12eab565d90200bdc420..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 637 zcmV-@0)qXCP)%jMYsR}010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UI~{3nzPT<^ccz03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00H4iL_t(I%bkv$uP9#=k-o(KHrXhzeFA5>G6wwH8akaNKd>PJ*RaYina9F=`q?uu1*_Nw5|K zL6nf}ubFuk%dJ@s1@o$Tyy5eG?>ldlhyd{U*#Q7&?|1m0P*cE#x$EMbrzmm&f-pdb zhSC-|@7OK3)jt8}TUW%G2r0p6gDAmDK~WY69t6C2I!Om(T5SJ#rvQQ}$$5u}FzCMF zQM|@->oo!x6A_u1$=nCxR-1mbNkG8OQ}<3Z0b&VV#3b(lFwU0H7?dbN39EKdtYnK= zZ(0BHd>=qh0ef~w%}3Y7hyg&CF@?$)bT{jH2XS>CrVFzk0G!qrW%cC8Iv=M!5Ko{C z%gHOA%3Vs8^8MF0_Uum6gDMG`WYq{y@;hiW{q{y(f1qCAyluRKKALzO-cCDG6p}Me zm*^)IWO%SZZqr(QrUL*+rSP!zlE4S_lMP0PivWx|?`QU)0f?gnr%C`;^V{^h>rB!f zNF}(E-r%T5GbYX_S7p@RVw6>i2n>_Ab^UREi~Z~;yY|mk)&LRVTzpx?LlB1OP~)t{ zdW%sJVW9CiGJDwYpf>T0xg%jMYsR}010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UI~{3pyBSir4@E03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00HSqL_t(I%bk-=Yg0iK zhM&22<|b)So0On`Komc^5wSI<7A(3@X|3Q!aN*jY5QG6b zG$c00dB=9LrTz&xpIZ`RA|wH$4Wa}qF>w+jco6X7DHe(tlVhv6e3MW6O%gTW`|dY(Y-iGgGzn?<(h)xN-=NV{=hm|N*_q2YZzokt$rAy-wf*s^v8rKR41{DXmQH!2}>56>us6pwoXz zwX#aPTL(!6KkmNephr_C&KIuA^4vWdy;Ko_rSjdZ{=WZ$y