diff --git a/changelog.txt b/changelog.txt index 0378a529..71532696 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,6 +13,7 @@ Version 2.0.0-18 - Fixed Crusher ritual so it didn't break everything at once. - Removed the FOV effect from the Quick Feet speed upgrade. - Minor work on the Demon Crucible. +- Crucibles now fill the tartaric gems of close-by hellfire forges ------------------------------------------------------ Version 2.0.0-17 diff --git a/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java b/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java index 5f4ebd18..e64dbfb5 100644 --- a/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java +++ b/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java @@ -65,9 +65,12 @@ public abstract class Ritual * - The {@link IMasterRitualStone} that the ritual is bound to * @param player * - The activating player + * @param owner + * - Owner of the crystal activating this ritual, or the current + * owner of the ritual if being reactivated. * @return - Whether activation was successful */ - public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) + public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player, String owner) { return true; } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java index 1a048bb1..264c29ba 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemLavaCrystal.java @@ -51,7 +51,6 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler if (fuelItem instanceof ItemLavaCrystal) { - System.out.println("Test get burn time: Side = " + FMLCommonHandler.instance().getSide()); // // if (FMLCommonHandler.instance().getSide() == Side.CLIENT) // { diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualPortal.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualPortal.java index 777d07e0..51fd2ff2 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualPortal.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualPortal.java @@ -1,15 +1,7 @@ package WayofTime.bloodmagic.ritual; -import WayofTime.bloodmagic.api.Constants; -import WayofTime.bloodmagic.api.ritual.EnumRuneType; -import WayofTime.bloodmagic.api.ritual.IMasterRitualStone; -import WayofTime.bloodmagic.api.ritual.Ritual; -import WayofTime.bloodmagic.api.ritual.RitualComponent; -import WayofTime.bloodmagic.api.teleport.PortalLocation; -import WayofTime.bloodmagic.api.util.helper.PlayerHelper; -import WayofTime.bloodmagic.registry.ModBlocks; -import WayofTime.bloodmagic.ritual.portal.LocationsHandler; -import WayofTime.bloodmagic.tile.TileDimensionalPortal; +import java.util.ArrayList; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -17,8 +9,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; - -import java.util.ArrayList; +import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.ritual.EnumRuneType; +import WayofTime.bloodmagic.api.ritual.IMasterRitualStone; +import WayofTime.bloodmagic.api.ritual.Ritual; +import WayofTime.bloodmagic.api.ritual.RitualComponent; +import WayofTime.bloodmagic.api.teleport.PortalLocation; +import WayofTime.bloodmagic.registry.ModBlocks; +import WayofTime.bloodmagic.ritual.portal.LocationsHandler; +import WayofTime.bloodmagic.tile.TileDimensionalPortal; public class RitualPortal extends Ritual { @@ -35,9 +34,8 @@ public class RitualPortal extends Ritual } @Override - public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) + public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player, String owner) { - String owner = PlayerHelper.getUUIDFromPlayer(player).toString(); World world = masterRitualStone.getWorldObj(); int x = masterRitualStone.getBlockPos().getX(); int y = masterRitualStone.getBlockPos().getY(); @@ -127,6 +125,11 @@ public class RitualPortal extends Ritual public void performRitual(IMasterRitualStone masterRitualStone) { World world = masterRitualStone.getWorldObj(); + if (world.isRemote) + { + return; + } + int x = masterRitualStone.getBlockPos().getX(); int y = masterRitualStone.getBlockPos().getY(); int z = masterRitualStone.getBlockPos().getZ(); @@ -236,7 +239,7 @@ public class RitualPortal extends Ritual addRune(components, 1, 0, 0, EnumRuneType.AIR); addRune(components, 2, 0, 0, EnumRuneType.WATER); addRune(components, -1, 0, 0, EnumRuneType.FIRE); - addRune(components, -2, 0, 0 , EnumRuneType.EARTH); + addRune(components, -2, 0, 0, EnumRuneType.EARTH); addRune(components, 2, 1, 0, EnumRuneType.DUSK); addRune(components, 2, 2, 0, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/portal/Teleports.java b/src/main/java/WayofTime/bloodmagic/ritual/portal/Teleports.java index 97fe448b..e7cbbea5 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/portal/Teleports.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/portal/Teleports.java @@ -41,13 +41,6 @@ public class Teleports { if (entity instanceof EntityPlayer) { - EntityPlayerMP player = (EntityPlayerMP) entity; - - player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5); - player.worldObj.updateEntityWithOptionalForce(player, false); - player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel())); - player.timeUntilPortal = 150; - SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain); if (network.getCurrentEssence() < getTeleportCost()) { @@ -55,15 +48,16 @@ public class Teleports } network.syphon(getTeleportCost()); + EntityPlayerMP player = (EntityPlayerMP) entity; + + player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5); + player.worldObj.updateEntityWithOptionalForce(player, false); + player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel())); + player.timeUntilPortal = 150; + player.worldObj.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F); } else { - WorldServer world = (WorldServer) entity.worldObj; - - entity.setPosition(x + 0.5, y + 0.5, z + 0.5); - entity.timeUntilPortal = 150; - world.resetUpdateEntityTick(); - SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain); if (network.getCurrentEssence() < (getTeleportCost() / 10)) { @@ -71,6 +65,12 @@ public class Teleports } network.syphon(getTeleportCost() / 10); + WorldServer world = (WorldServer) entity.worldObj; + + entity.setPosition(x + 0.5, y + 0.5, z + 0.5); + entity.timeUntilPortal = 150; + world.resetUpdateEntityTick(); + entity.worldObj.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F); } } @@ -122,20 +122,28 @@ public class Teleports if (!player.worldObj.isRemote) { + SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain); + if (network.getCurrentEssence() < getTeleportCost()) + { + return; + } + network.syphon(getTeleportCost()); + server.getConfigurationManager().transferPlayerToDimension(player, newWorldID, new TeleporterBloodMagic(newWorldServer)); player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5); player.worldObj.updateEntityWithOptionalForce(player, false); player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel())); } + } else if (!entity.worldObj.isRemote) + { SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain); - if (network.getCurrentEssence() < getTeleportCost()) + if (network.getCurrentEssence() < (getTeleportCost() / 10)) { return; } - network.syphon(getTeleportCost()); - } else if (!entity.worldObj.isRemote) - { + network.syphon(getTeleportCost() / 10); + NBTTagCompound tag = new NBTTagCompound(); entity.writeToNBTOptional(tag); @@ -154,13 +162,6 @@ public class Teleports oldWorldServer.resetUpdateEntityTick(); newWorldServer.resetUpdateEntityTick(); - - SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain); - if (network.getCurrentEssence() < (getTeleportCost() / 10)) - { - return; - } - network.syphon(getTeleportCost() / 10); } entity.timeUntilPortal = 150; diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrucible.java b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrucible.java index 4670d47f..13976dc9 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrucible.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrucible.java @@ -27,7 +27,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo public HashMap willMap = new HashMap(); public final int maxWill = 100; public final double maxTransferPerTick = 1; - public final double thresholdFill = 0.0; + public final double thresholdFill = 0.01; public final double gemDrainRate = 10; public int internalCounter = 0; @@ -192,9 +192,13 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo transfer = conduit.fillDemonWill(type, transfer, false); if (transfer > 0) { + worldObj.markBlockForUpdate(((TileEntity) conduit).getPos()); conduit.fillDemonWill(type, transfer, true); currentAmount -= transfer; transfered += transfer; + } else + { + conduitIterator.remove(); } } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java index b1e0dd82..bc56b18d 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java @@ -63,7 +63,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt active = true; ItemStack crystalStack = NBTHelper.checkNBT(new ItemStack(ModItems.activationCrystal, 1, getCurrentRitual().getCrystalLevel())); crystalStack.getTagCompound().setString(Constants.NBT.OWNER_UUID, getOwner()); - activateRitual(crystalStack, PlayerHelper.getPlayerFromUUID(getOwner()), getCurrentRitual()); + activateRitual(crystalStack, null, getCurrentRitual()); redstoned = false; } @@ -150,7 +150,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt return false; } - if (ritual.activateRitual(this, activator)) + if (ritual.activateRitual(this, activator, crystalOwner)) { if (!isRedstoned() && !activator.capabilities.isCreativeMode) network.syphon(ritual.getActivationCost()); diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java b/src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java index dbd75750..bce7a95d 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileSoulForge.java @@ -9,10 +9,12 @@ import net.minecraft.util.ITickable; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe; import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry; +import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.IDemonWill; +import WayofTime.bloodmagic.api.soul.IDemonWillConduit; import WayofTime.bloodmagic.api.soul.IDemonWillGem; -public class TileSoulForge extends TileInventory implements ITickable +public class TileSoulForge extends TileInventory implements ITickable, IDemonWillConduit { public static final int ticksRequired = 100; @@ -228,4 +230,97 @@ public class TileSoulForge extends TileInventory implements ITickable } } } + + @Override + public int getWeight() + { + return 50; + } + + @Override + public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) + { + if (amount <= 0) + { + return 0; + } + + if (!canFill(type)) + { + return 0; + } + + ItemStack stack = this.getStackInSlot(soulSlot); + if (stack == null || !(stack.getItem() instanceof IDemonWillGem)) + { + return 0; + } + + IDemonWillGem willGem = (IDemonWillGem) stack.getItem(); + + double maxWill = willGem.getMaxWill(stack); + double current = willGem.getWill(stack); + + if (!doFill) + { + return Math.min(maxWill - current, amount); + } + + double filled = maxWill - current; + + if (amount < filled) + { + willGem.setWill(stack, current + amount); + filled = amount; + } else + { + willGem.setWill(stack, maxWill); + } + + return filled; + } + + @Override + public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) + { + ItemStack stack = this.getStackInSlot(soulSlot); + if (stack == null || !(stack.getItem() instanceof IDemonWillGem)) + { + return 0; + } + + IDemonWillGem willGem = (IDemonWillGem) stack.getItem(); + + double drained = amount; + double current = willGem.getWill(stack); + if (current < drained) + { + drained = current; + } + + if (doDrain) + { + drained = willGem.drainWill(stack, drained); + } + + return drained; + } + + @Override + public boolean canFill(EnumDemonWillType type) + { + return type.equals(EnumDemonWillType.DEFAULT); + } + + @Override + public boolean canDrain(EnumDemonWillType type) + { + return type.equals(EnumDemonWillType.DEFAULT); + } + + @Override + public double getCurrentWill(EnumDemonWillType type) + { + return 0; + } }