diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java index 6a2e112d..e30b2c81 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java @@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.book.ItemBMBook; import WayofTime.alchemicalWizardry.common.items.AWBaseItems; import WayofTime.alchemicalWizardry.common.items.ActivationCrystal; @@ -77,7 +79,6 @@ import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheFastMiner; import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfWind; import WayofTime.alchemicalWizardry.common.items.sigil.VoidSigil; import WayofTime.alchemicalWizardry.common.items.sigil.WaterSigil; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; import cpw.mods.fml.common.registry.GameRegistry; /** @@ -282,6 +283,9 @@ public class ModItems itemFluidSigil = new ItemFluidSigil().setUnlocalizedName("itemFluidSigil"); itemSeerSigil = new ItemSeerSigil().setUnlocalizedName("itemSeerSigil"); customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool"); + + SpellParadigmTool.customTool = customTool; + itemCombinationalCatalyst = new CombinationalCatalyst().setUnlocalizedName("itemCombinationalCatalyst"); itemAttunedCrystal = new ItemAttunedCrystal().setUnlocalizedName("itemAttunedCrystal"); itemTankSegmenter = new ItemTankSegmenter().setUnlocalizedName("itemTankSegmenter"); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java new file mode 100644 index 00000000..83c10c05 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java @@ -0,0 +1,23 @@ +package WayofTime.alchemicalWizardry.api.event; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import cpw.mods.fml.common.eventhandler.Cancelable; + +@Cancelable +public class RitualActivatedEvent extends RitualEvent +{ + public final EntityPlayer player; + public final ItemStack crystalStack; + public int crystalTier; + + public RitualActivatedEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, EntityPlayer player, ItemStack activationCrystal, int crystalTier) + { + super(mrs, ownerKey, ritualKey); + + this.player = player; + this.crystalStack = activationCrystal; + this.crystalTier = crystalTier; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java new file mode 100644 index 00000000..fbe1649c --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java @@ -0,0 +1,18 @@ +package WayofTime.alchemicalWizardry.api.event; + +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import cpw.mods.fml.common.eventhandler.Event; + +public class RitualEvent extends Event +{ + public final IMasterRitualStone mrs; + public String ownerKey; + public final String ritualKey; + + public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) + { + this.mrs = mrs; + this.ownerKey = ownerKey; + this.ritualKey = ritualKey; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java similarity index 95% rename from src/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java rename to src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java index ebf30859..72f0c83c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java @@ -1,9 +1,11 @@ -package WayofTime.alchemicalWizardry.common.items.spell; +package WayofTime.alchemicalWizardry.api.items; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; +import java.util.Set; -import WayofTime.alchemicalWizardry.api.spell.SpellEffect; -import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,8 +23,10 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; - -import java.util.*; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.api.spell.SpellEffect; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; public class ItemSpellMultiTool extends Item { @@ -107,7 +111,7 @@ public class ItemSpellMultiTool extends Item int hlvl = -1; float blockHardness = block.getBlockHardness(world, x, y, z); - MovingObjectPosition mop = SpellHelper.raytraceFromEntity(world, player, true, 5.0D); + MovingObjectPosition mop = APISpellHelper.raytraceFromEntity(world, player, true, 5.0D); Block localBlock = world.getBlock(x, y, z); int localMeta = world.getBlockMetadata(x, y, z); @@ -153,14 +157,14 @@ public class ItemSpellMultiTool extends Item if (blockHardness > 0f) onBlockDestroyed(stack, world, localBlock, x, y, z, player); - List items = SpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack)); + List items = APISpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack)); SpellParadigmTool parad = this.loadParadigmFromStack(stack); List newItems = parad.handleItemList(stack, items); if (!world.isRemote) { - SpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f); + APISpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f); } world.func_147479_m(x, y, z); @@ -173,7 +177,7 @@ public class ItemSpellMultiTool extends Item if (cost > 0) { - EnergyItems.syphonAndDamageWhileInContainer(stack, player, cost); + SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost); } } else { @@ -340,14 +344,14 @@ public class ItemSpellMultiTool extends Item int cost = parad.onUpdate(toolStack, world, par3Entity, par4, par5); if (par3Entity instanceof EntityPlayer && cost > 0) - EnergyItems.syphonAndDamageWhileInContainer(toolStack, (EntityPlayer) par3Entity, cost); + SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, cost); int duration = Math.max(this.getDuration(toolStack, world), 0); if (duration <= 0 && par3Entity instanceof EntityPlayer) { int banishCost = parad.onBanishTool(toolStack, world, par3Entity, par4, par5); - EnergyItems.syphonAndDamageWhileInContainer(toolStack, (EntityPlayer) par3Entity, banishCost); + SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, banishCost); ((EntityPlayer) par3Entity).inventory.mainInventory[par4] = this.getContainedCrystal(toolStack); } } @@ -377,7 +381,7 @@ public class ItemSpellMultiTool extends Item if (cost > 0) { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, cost); + SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost); } return par1ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java index 331f1915..ce900aa1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java @@ -121,6 +121,16 @@ public class SoulNetworkHandler return false; } + World world = player.worldObj; + if (world != null) + { + double posX = player.posX; + double posY = player.posY; + double posZ = player.posZ; + + world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + } + int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone); hurtPlayer(player, damageToBeDone - amount); @@ -355,4 +365,14 @@ public class SoulNetworkHandler entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); } + + public static String getOwnerName(ItemStack item) + { + if (item.stackTagCompound == null) + { + item.setTagCompound(new NBTTagCompound()); + } + + return item.stackTagCompound.getString("ownerName"); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java new file mode 100644 index 00000000..a0cc0a5a --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java @@ -0,0 +1,101 @@ +package WayofTime.alchemicalWizardry.api.spell; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class APISpellHelper +{ + public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) + { + float f = 1.0F; + float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; + float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; + double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f; + if (!world.isRemote && player instanceof EntityPlayer) + d1 += 1.62D; + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = range; + if (player instanceof EntityPlayerMP) + { + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + } + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + return world.func_147447_a(vec3, vec31, par3, !par3, par3); + } + + public static List getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) + { + boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta); + + if (canSilk && silkTouch) + { + ArrayList items = new ArrayList(); + ItemStack item = new ItemStack(block, 1, meta); + + items.add(item); + + return items; + } else + { + return block.getDrops(world, x, y, z, meta, fortune); + } + } + + public static void spawnItemListInWorld(List items, World world, float x, float y, float z) + { + for (ItemStack stack : items) + { + EntityItem itemEntity = new EntityItem(world, x, y, z, stack); + itemEntity.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(itemEntity); + } + } + + public static String getNumeralForInt(int num) + { + switch (num) + { + case 1: + return "I"; + case 2: + return "II"; + case 3: + return "III"; + case 4: + return "IV"; + case 5: + return "V"; + case 6: + return "VI"; + case 7: + return "VII"; + case 8: + return "VIII"; + case 9: + return "IX"; + case 10: + return "X"; + default: + return ""; + } + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IDigAreaEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java similarity index 72% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IDigAreaEffect.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java index 8e20e062..2355ed7d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IDigAreaEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java @@ -1,6 +1,6 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IItemManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java similarity index 70% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IItemManipulator.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java index bdfa0ee2..eb9b766b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IItemManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ILeftClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java similarity index 73% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ILeftClickEffect.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java index 7b368202..65f53f86 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ILeftClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBanishTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java similarity index 75% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBanishTool.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java index b8bfe314..4e12fdd4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBanishTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBreakBlock.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java similarity index 82% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBreakBlock.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java index 452a7164..12f844cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnBreakBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnSummonTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java similarity index 73% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnSummonTool.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java index 5752ab45..6a5ea4d3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IOnSummonTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IRightClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java similarity index 86% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IRightClickEffect.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java index 12152d1a..dd9f7d26 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IRightClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ISpecialDamageEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java similarity index 65% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ISpecialDamageEffect.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java index 9b40c724..323ccf3b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ISpecialDamageEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IToolUpdateEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java similarity index 75% rename from src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IToolUpdateEffect.java rename to src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java index 70f397af..c3bacfc2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/IToolUpdateEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java @@ -1,4 +1,4 @@ -package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java index e5b09ce3..629f7dba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java @@ -1,13 +1,13 @@ package WayofTime.alchemicalWizardry.api.spell; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; + public class SpellParadigmMelee extends SpellParadigm { private List entityEffectList; @@ -30,7 +30,7 @@ public class SpellParadigmMelee extends SpellParadigm { int cost = this.getTotalCost(); - if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost)) + if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { return; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java index 848f92dd..9034e2ee 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -43,7 +44,7 @@ public class SpellParadigmProjectile extends SpellParadigm { int cost = this.getTotalCost(); - if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost)) + if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { return; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java index 2241dbef..89cffe07 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java @@ -1,13 +1,13 @@ package WayofTime.alchemicalWizardry.api.spell; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; + public class SpellParadigmSelf extends SpellParadigm { public List selfSpellEffectList; @@ -30,7 +30,7 @@ public class SpellParadigmSelf extends SpellParadigm int cost = this.getTotalCost(); - if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost)) + if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { return; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java index fc729342..f6cc001b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java @@ -1,25 +1,23 @@ package WayofTime.alchemicalWizardry.api.spell; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.*; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; + public class SpellParadigmTool extends SpellParadigm { private List leftClickEffectList; @@ -45,6 +43,8 @@ public class SpellParadigmTool extends SpellParadigm private boolean silkTouch; private int duration; + + public static Item customTool; public SpellParadigmTool() { @@ -99,7 +99,7 @@ public class SpellParadigmTool extends SpellParadigm int cost = this.getTotalCost(); - if(!EnergyItems.syphonBatteries(crystal, entityPlayer, cost)) + if(!SoulNetworkHandler.syphonAndDamageFromNetwork(crystal, entityPlayer, cost)) { return; } @@ -117,9 +117,9 @@ public class SpellParadigmTool extends SpellParadigm */ public ItemStack prepareTool(ItemStack crystalStack, World world) { - ItemStack toolStack = new ItemStack(ModItems.customTool, 1); + ItemStack toolStack = new ItemStack(customTool, 1); - ItemSpellMultiTool itemTool = (ItemSpellMultiTool) ModItems.customTool; + ItemSpellMultiTool itemTool = (ItemSpellMultiTool) customTool; itemTool.setItemAttack(toolStack, this.composeMaxDamageFromHash()); @@ -148,12 +148,12 @@ public class SpellParadigmTool extends SpellParadigm if (this.getSilkTouch()) { - this.addToolString("SilkTouch", "Silk Touch" + " " + SpellHelper.getNumeralForInt(1)); + this.addToolString("SilkTouch", "Silk Touch" + " " + APISpellHelper.getNumeralForInt(1)); } if (this.getFortuneLevel() > 0) { - this.addToolString("Fortune", "Fortune" + " " + SpellHelper.getNumeralForInt(this.getFortuneLevel())); + this.addToolString("Fortune", "Fortune" + " " + APISpellHelper.getNumeralForInt(this.getFortuneLevel())); } itemTool.setCritChance(toolStack, this.getCritChance() / 100f); @@ -175,7 +175,7 @@ public class SpellParadigmTool extends SpellParadigm itemTool.setDuration(toolStack, world, this.duration); itemTool.loadParadigmIntoStack(toolStack, this.bufferedEffectList); - EnergyItems.checkAndSetItemOwner(toolStack, EnergyItems.getOwnerName(crystalStack)); + SoulNetworkHandler.checkAndSetItemOwner(toolStack, SoulNetworkHandler.getOwnerName(crystalStack)); itemTool.setContainedCrystal(toolStack, crystalStack); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java index 5529bb12..096dc60e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java @@ -81,8 +81,8 @@ public class BlockMasterStone extends BlockContainer } ActivationCrystal acItem = (ActivationCrystal) item; - tileEntity.setOwner(acItem.getOwnerName(playerItem)); - tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), player); +// tileEntity.setOwner(acItem.getOwnerName(playerItem)); + tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem)); world.markBlockForUpdate(x, y, z); return true; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java index e2ae593c..e994b7b8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; import WayofTime.alchemicalWizardry.common.NewPacketHandler; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.block.Block; @@ -364,56 +365,17 @@ public class SpellHelper public static List getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) { - boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta); - - if (canSilk && silkTouch) - { - ArrayList items = new ArrayList(); - ItemStack item = new ItemStack(block, 1, meta); - - items.add(item); - - return items; - } else - { - return block.getDrops(world, x, y, z, meta, fortune); - } + return APISpellHelper.getItemsFromBlock(world, block, x, y, z, meta, silkTouch, fortune); } public static void spawnItemListInWorld(List items, World world, float x, float y, float z) { - for (ItemStack stack : items) - { - EntityItem itemEntity = new EntityItem(world, x, y, z, stack); - itemEntity.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(itemEntity); - } + APISpellHelper.spawnItemListInWorld(items, world, x, y, z); } public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { - float f = 1.0F; - float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; - float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; - double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f; - if (!world.isRemote && player instanceof EntityPlayer) - d1 += 1.62D; - double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; - Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); - float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); - float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); - float f5 = -MathHelper.cos(-f1 * 0.017453292F); - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; - double d3 = range; - if (player instanceof EntityPlayerMP) - { - d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); - } - Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - return world.func_147447_a(vec3, vec31, par3, !par3, par3); + return APISpellHelper.raytraceFromEntity(world, player, par3, range); } public static String getNumeralForInt(int num) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java index 6f3f19ad..ab6986a0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java @@ -1,6 +1,6 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.DigAreaEffect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java index a23b3e86..b6b75ee4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java @@ -1,7 +1,8 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.spell.IDigAreaEffect; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java index e18317f4..fdd66528 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java @@ -1,7 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java index 7fe00aa3..4fe6295b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java @@ -4,6 +4,8 @@ import net.minecraft.item.ItemStack; import java.util.List; +import WayofTime.alchemicalWizardry.api.spell.IItemManipulator; + public abstract class ItemManipulator implements IItemManipulator { protected int powerUpgrades; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java index cb1a9b9c..3cbfd2fc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.spell.ILeftClickEffect; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java index 331a1064..a6af2688 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.spell.IOnBreakBlock; + public abstract class OnBreakBlockEffect implements IOnBreakBlock { protected int powerUpgrades; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java index f0153db7..5eb7b5ae 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.spell.IRightClickEffect; + public abstract class RightClickEffect implements IRightClickEffect { protected int powerUpgrades; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java index 86c396ab..8a14beb0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.spell.IOnSummonTool; + public abstract class SummonToolEffect implements IOnSummonTool { protected int powerUpgrades; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java index 94446c79..56b0e894 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java @@ -1,29 +1,35 @@ package WayofTime.alchemicalWizardry.common.tileEntity; -import WayofTime.alchemicalWizardry.api.alchemy.energy.*; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod; -import WayofTime.alchemicalWizardry.api.rituals.Rituals; -import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; +import WayofTime.alchemicalWizardry.api.event.RitualActivatedEvent; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod; +import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class TEMasterStone extends TileEntity implements IMasterRitualStone { @@ -177,7 +183,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone tag.setTag("customRitualTag", customRitualTag); } - public void activateRitual(World world, int crystalLevel, EntityPlayer player) + public void activateRitual(World world, int crystalLevel, ItemStack activationCrystal, EntityPlayer player, String crystalOwner) { if (world.isRemote) { @@ -192,7 +198,20 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone return; } - boolean testLevel = Rituals.canCrystalActivate(testRitual, crystalLevel); + //TODO + RitualActivatedEvent event = new RitualActivatedEvent(this, crystalOwner, testRitual, player, activationCrystal, crystalLevel); + if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) + { + player.addChatMessage(new ChatComponentText("Something stopped you in your tracks...")); + + return; + } + + int eventCrystalTier = event.crystalTier; + String eventRitualKey = event.ritualKey; + String eventOwnerKey = event.ownerKey; + + boolean testLevel = Rituals.canCrystalActivate(eventRitualKey, eventCrystalTier); if (!testLevel) { @@ -201,7 +220,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone return; } - int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); + int currentEssence = SoulNetworkHandler.getCurrentEssence(eventOwnerKey); if (currentEssence < Rituals.getCostForActivation(testRitual)) { @@ -219,7 +238,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone return; } else { - int drain = SoulNetworkHandler.syphonFromNetwork(owner, Rituals.getCostForActivation(testRitual)); + int drain = SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(testRitual)); if(drain > 0) { @@ -242,6 +261,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone { Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.ACTIVATE); } + this.setOwner(eventOwnerKey); cooldown = Rituals.getInitialCooldown(testRitual); var1 = 0; currentRitualString = testRitual;