From 69ad344aa0d090eacdeab8d011047c2e587ec631 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 24 Nov 2020 21:19:25 -0500 Subject: [PATCH] Fixed Hellfire Forge Aura Consumption Fixed the Hellfire Forge so that it actually consumes Will from the Aura. --- .../bloodmagic/tile/TileSoulForge.java | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileSoulForge.java b/src/main/java/wayoftime/bloodmagic/tile/TileSoulForge.java index b812ad48..f67389e2 100644 --- a/src/main/java/wayoftime/bloodmagic/tile/TileSoulForge.java +++ b/src/main/java/wayoftime/bloodmagic/tile/TileSoulForge.java @@ -17,18 +17,18 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.registries.ObjectHolder; -import wayoftime.bloodmagic.api.event.BloodMagicCraftedEvent; -import wayoftime.bloodmagic.impl.BloodMagicAPI; -import wayoftime.bloodmagic.recipe.RecipeTartaricForge; -import wayoftime.bloodmagic.tile.container.ContainerSoulForge; -import wayoftime.bloodmagic.util.Constants; import wayoftime.bloodmagic.api.compat.EnumDemonWillType; import wayoftime.bloodmagic.api.compat.IDemonWill; import wayoftime.bloodmagic.api.compat.IDemonWillConduit; import wayoftime.bloodmagic.api.compat.IDemonWillGem; +import wayoftime.bloodmagic.api.event.BloodMagicCraftedEvent; +import wayoftime.bloodmagic.demonaura.WorldDemonWillHandler; +import wayoftime.bloodmagic.impl.BloodMagicAPI; +import wayoftime.bloodmagic.recipe.RecipeTartaricForge; +import wayoftime.bloodmagic.tile.container.ContainerSoulForge; +import wayoftime.bloodmagic.util.Constants; -public class TileSoulForge extends TileInventory - implements ITickableTileEntity, INamedContainerProvider, IDemonWillConduit +public class TileSoulForge extends TileInventory implements ITickableTileEntity, INamedContainerProvider, IDemonWillConduit { @ObjectHolder("bloodmagic:soulforge") public static TileEntityType TYPE; @@ -110,6 +110,27 @@ public class TileSoulForge extends TileInventory return; } + if (!getWorld().isRemote) + { + for (EnumDemonWillType type : EnumDemonWillType.values()) + { + double willInWorld = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type); + double filled = Math.min(willInWorld, worldWillTransferRate); + + if (filled > 0) + { + filled = this.fillDemonWill(type, filled, false); + filled = WorldDemonWillHandler.drainWill(getWorld(), pos, type, filled, false); + + if (filled > 0) + { + this.fillDemonWill(type, filled, true); + WorldDemonWillHandler.drainWill(getWorld(), pos, type, filled, true); + } + } + } + } + double soulsInGem = getWill(EnumDemonWillType.DEFAULT); List inputList = new ArrayList<>(); @@ -237,8 +258,7 @@ public class TileSoulForge extends TileInventory if (soulStack != null) { - if (soulStack.getItem() instanceof IDemonWill - && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type) + if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type) { IDemonWill soul = (IDemonWill) soulStack.getItem(); return soul.getWill(type, soulStack); @@ -260,8 +280,7 @@ public class TileSoulForge extends TileInventory if (soulStack != null) { - if (soulStack.getItem() instanceof IDemonWill - && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type) + if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type) { IDemonWill soul = (IDemonWill) soulStack.getItem(); double souls = soul.drainWill(type, soulStack, requested);