diff --git a/src/api/java/thaumcraft/api/visnet/VisNetHandler.java b/src/api/java/thaumcraft/api/visnet/VisNetHandler.java index baf46d8e..23e01ccf 100644 --- a/src/api/java/thaumcraft/api/visnet/VisNetHandler.java +++ b/src/api/java/thaumcraft/api/visnet/VisNetHandler.java @@ -247,9 +247,9 @@ public class VisNetHandler { // double yd = (source.yCoord-target.yCoord) / d; // double zd = (source.zCoord-target.zCoord) / d; // return source.getWorldObj().rayTraceBlocks( - // Vec3.createVectorHelper(source.xCoord-xd+.5+.5, source.yCoord-yd, + // SpellHelper.createVec3(source.xCoord-xd+.5+.5, source.yCoord-yd, // source.zCoord-zd), - // Vec3.createVectorHelper(target.xCoord+.5, target.yCoord+.5, + // SpellHelper.createVec3(target.xCoord+.5, target.yCoord+.5, // target.zCoord+.5)) == null; // } diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 532dac44..b11cad7b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -1283,7 +1283,7 @@ public class AlchemicalWizardry Rituals.registerRitual("AW032", 1, 100, new RitualEffectOmegaTest(), "Symmetry of the Omega"); Rituals.registerRitual("AW033", 2, 100, new RitualEffectOmegaStalling(), "Omega Stalling"); Rituals.registerRitual("AW034", 2, 100, new RitualEffectAlphaPact(), "Alpha Pact"); - Rituals.registerRitual("AW035", 1, 100, new RitualEffectItemRouting(), "Ritual of the Phantom Hands"); + Rituals.registerRitual("AW035", 1, 100, new RitualEffectItemRouting(), "Orchestra of the Phantom Hands"); //Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock")); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java index db4b71d1..754d41e7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java @@ -68,6 +68,7 @@ import WayofTime.alchemicalWizardry.common.items.potion.StandardFillingAgent; import WayofTime.alchemicalWizardry.common.items.potion.WeakBindingAgent; import WayofTime.alchemicalWizardry.common.items.potion.WeakFillingAgent; import WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus; +import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus; import WayofTime.alchemicalWizardry.common.items.sigil.AirSigil; import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil; import WayofTime.alchemicalWizardry.common.items.sigil.ItemBloodLightSigil; @@ -228,6 +229,7 @@ public class ModItems public static OmegaArmour boundBootsWind; public static Item inputRoutingFocus; + public static Item outputRoutingFocus; public static void init() { @@ -348,6 +350,7 @@ public class ModItems boundBootsWind = (OmegaArmour) new OmegaArmourWind(3).setUnlocalizedName("boundBootsWind"); inputRoutingFocus = new InputRoutingFocus().setUnlocalizedName("inputRoutingFocus"); + outputRoutingFocus = new OutputRoutingFocus().setUnlocalizedName("outputRoutingFocus"); } public static void registerItems() @@ -473,6 +476,7 @@ public class ModItems GameRegistry.registerItem(ModItems.boundBootsWind, "boundBootsWind"); GameRegistry.registerItem(ModItems.inputRoutingFocus, "inputRoutingFocus"); + GameRegistry.registerItem(ModItems.outputRoutingFocus, "outputRoutingFocus"); //GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java new file mode 100644 index 00000000..d98d70da --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java @@ -0,0 +1,11 @@ +package WayofTime.alchemicalWizardry.api; + +import net.minecraft.item.ItemStack; + +public class RoutingFocusLogic +{ + public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) + { + return previous || (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) : false); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java new file mode 100644 index 00000000..9f7f1518 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java @@ -0,0 +1,21 @@ +package WayofTime.alchemicalWizardry.api; + +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; + +public class RoutingFocusLogicModItems extends RoutingFocusLogic +{ + @Override + public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) + { + if(keyStack != null && checkedStack != null) + { + UniqueIdentifier keyId = GameRegistry.findUniqueIdentifierFor(keyStack.getItem()); + UniqueIdentifier checkedId = GameRegistry.findUniqueIdentifierFor(checkedStack.getItem()); + return previous && keyId.modId.equals(checkedId.modId); + } + + return previous; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java new file mode 100644 index 00000000..301d6398 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java @@ -0,0 +1,41 @@ +package WayofTime.alchemicalWizardry.api; + +import java.util.LinkedList; +import java.util.List; + +import net.minecraft.item.ItemStack; + +public class RoutingFocusParadigm +{ + public List logicList = new LinkedList(); + + public List locationList = new LinkedList(); + + public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing) + { + locationList.add(facing); + } + + public void addLogic(RoutingFocusLogic logic) + { + logicList.add(logic); + } + + public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) + { + boolean isGood = false; + for(RoutingFocusLogic logic : logicList) + { + isGood = logic.doesItemMatch(isGood, keyStack, checkedStack); + if(isGood){return true;} + } + + return isGood; + } + + public void clear() + { + logicList.clear(); + locationList.clear(); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java new file mode 100644 index 00000000..e7360874 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java @@ -0,0 +1,22 @@ +package WayofTime.alchemicalWizardry.api; + +import net.minecraftforge.common.util.ForgeDirection; +import WayofTime.alchemicalWizardry.common.Int3; + +public class RoutingFocusPosAndFacing +{ + public Int3 location; + public ForgeDirection facing; + + public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing) + { + this.location = location; + this.facing = facing; + } + + @Override + public boolean equals(Object obj) + { + return obj instanceof RoutingFocusPosAndFacing ? facing.equals(((RoutingFocusPosAndFacing)obj).facing) && location.equals(((RoutingFocusPosAndFacing)obj).location) : false; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java index e2e7898d..afdca1cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java @@ -16,6 +16,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class APISpellHelper { @@ -153,7 +154,7 @@ public class APISpellHelper 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); + Vec3 vec3 = SpellHelper.createVec3(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); @@ -169,6 +170,11 @@ public class APISpellHelper return world.func_147447_a(vec3, vec31, par3, !par3, par3); } + public static Vec3 createVec3(double x, double y, double z) + { + return Vec3.createVectorHelper(x, y, z); + } + 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); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java index becdb32b..bfa5f693 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java @@ -1,21 +1,26 @@ package WayofTime.alchemicalWizardry.api.spell; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class EntitySpellProjectile extends Entity implements IProjectile { @@ -185,7 +190,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) + if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } @@ -214,15 +219,15 @@ public class EntitySpellProjectile extends Entity implements IProjectile } } - Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ); - Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); + Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); - var17 = Vec3.createVectorHelper(posX, posY, posZ); - var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + var17 = SpellHelper.createVec3(posX, posY, posZ); + var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); if (var4 != null) { - var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java index 178fcb3d..3e5e9bfa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java @@ -1,8 +1,8 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; -import cpw.mods.fml.common.registry.IThrowableEntity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.Iterator; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -11,11 +11,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraft.world.World; - -import java.util.Iterator; -import java.util.List; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import cpw.mods.fml.common.registry.IThrowableEntity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; //Shamelessly ripped off from x3n0ph0b3 public class EnergyBlastProjectile extends Entity implements IProjectile, IThrowableEntity @@ -235,7 +240,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) + if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } @@ -261,15 +266,15 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow } } - Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ); - Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); + Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); - var17 = Vec3.createVectorHelper(posX, posY, posZ); - var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + var17 = SpellHelper.createVec3(posX, posY, posZ); + var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); if (var4 != null) { - var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java index abc38a70..617db735 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java @@ -1,18 +1,23 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.Iterator; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraft.world.World; - -import java.util.Iterator; -import java.util.List; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile implements IProjectile { @@ -182,7 +187,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) + if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } @@ -208,15 +213,15 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil } } - Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ); - Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); + Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); - var17 = Vec3.createVectorHelper(posX, posY, posZ); - var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); + var17 = SpellHelper.createVec3(posX, posY, posZ); + var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); if (var4 != null) { - var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java index b1a5daa9..b42c0ec6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java @@ -134,6 +134,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundBoots"); } + @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java index 634c184c..5e3250ff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java @@ -15,6 +15,6 @@ public class InputRoutingFocus extends RoutingFocus @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_deactivated"); + this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:InputRoutingFocus"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java index 45e94efd..32edb10f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java @@ -1,7 +1,9 @@ package WayofTime.alchemicalWizardry.common.items.routing; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; +import WayofTime.alchemicalWizardry.api.RoutingFocusLogicModItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,11 +18,29 @@ public class OutputRoutingFocus extends RoutingFocus @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_deactivated"); + this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocus"); } - public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int damage) + { + switch(damage) + { + case 0: + return this.itemIcon; + } + return this.itemIcon; + } + + public RoutingFocusLogic getLogic(int damage) { - return keyStack != null ? checkedStack != null && keyStack.areItemStacksEqual(keyStack, checkedStack) : false; + switch(damage) + { + case 0: + return new RoutingFocusLogic(); + case 1: + return new RoutingFocusLogicModItems(); + } + return new RoutingFocusLogic(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java index 2ba79fd4..7f8f2d84 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java @@ -11,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; +import WayofTime.alchemicalWizardry.common.Int3; public class RoutingFocus extends Item { @@ -21,6 +23,11 @@ public class RoutingFocus extends Item this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); } + public RoutingFocusPosAndFacing getPosAndFacing(ItemStack itemStack) + { + return new RoutingFocusPosAndFacing(new Int3(this.xCoord(itemStack), this.yCoord(itemStack), this.zCoord(itemStack)), this.getSetDirection(itemStack)); + } + @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { @@ -68,7 +75,7 @@ public class RoutingFocus extends Item @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("An Enderpearl imbued with blood"); + par3List.add(this.getFocusDescription()); if (!(par1ItemStack.getTagCompound() == null)) { @@ -78,6 +85,11 @@ public class RoutingFocus extends Item par3List.add("Direction: " + this.getSetDirection(par1ItemStack)); } } + + public String getFocusDescription() + { + return "An Enderpearl imbued with blood"; + } @Override public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java index c76a5eb1..36697fbd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java @@ -197,7 +197,7 @@ public class ItemSigilOfTheAssassin extends EnergyItems implements ArmourUpgrade double d0 = p_77621_2_.prevPosX + (p_77621_2_.posX - p_77621_2_.prevPosX) * (double)f; double d1 = p_77621_2_.prevPosY + (p_77621_2_.posY - p_77621_2_.prevPosY) * (double)f + (double)(p_77621_1_.isRemote ? p_77621_2_.getEyeHeight() - p_77621_2_.getDefaultEyeHeight() : p_77621_2_.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences double d2 = p_77621_2_.prevPosZ + (p_77621_2_.posZ - p_77621_2_.prevPosZ) * (double)f; - Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + Vec3 vec3 = SpellHelper.createVec3(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); @@ -215,15 +215,15 @@ public class ItemSigilOfTheAssassin extends EnergyItems implements ArmourUpgrade // public MovingObjectPosition movingObjectPositiongdsa(WOrld worldObj, int posX, int posY, int posZ) // { -// Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ); -// Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); +// Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); +// Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); // MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); -// var17 = Vec3.createVectorHelper(posX, posY, posZ); -// var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); +// var17 = SpellHelper.createVec3(posX, posY, posZ); +// var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); // // if (var4 != null) // { -// var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); +// var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); // } // // Entity var5 = null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java index 7e09eeec..5af3b0b3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java @@ -10,6 +10,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import WayofTime.alchemicalWizardry.api.RoutingFocusParadigm; +import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; @@ -75,7 +77,6 @@ public class RitualEffectItemRouting extends RitualEffect int[] validSlots = ((ISidedInventory) inputChest).getAccessibleSlotsFromSide(syphonDirection.ordinal()); for(int in : validSlots) { - System.out.println("" + in); canSyphonList[in] = true; } }else @@ -96,13 +97,18 @@ public class RitualEffectItemRouting extends RitualEffect continue; } + int size = syphonedStack.stackSize; ItemStack newStack = SpellHelper.insertStackIntoInventory(syphonedStack, bufferInventory, ForgeDirection.DOWN); + if(size == newStack.stackSize) + { + continue; + } if(newStack != null && newStack.stackSize <= 0) { newStack = null; } inputChestInventory.setInventorySlotContents(n, newStack); - break; +// break; } } } @@ -118,66 +124,112 @@ public class RitualEffectItemRouting extends RitualEffect if(outputFocusInv instanceof IInventory) { IInventory outputFocusInventory = (IInventory)outputFocusInv; -// for(int j=0; j<((IInventory) outputFocusInv).getSizeInventory(); j++) - { - ItemStack stack = ((IInventory) outputFocusInv).getStackInSlot(0); - if(stack != null && stack.getItem() instanceof OutputRoutingFocus) //TODO change to output routing focus - { - boolean transferEverything = true; - for(int j=1; j= 0; j--) + Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag()); + + int j = y - 1; + int i = 0; + int k = 0; + + if(lastPos != null) + { + + } + + while(j >= 0) { - for (int i = -radius; i <= radius; i++) + while(i <= radius) { - for (int k = -radius; k <= radius; k++) + while(k <= radius) { Block block = world.getBlock(x + i, j, z + k); int meta = world.getBlockMetadata(x + i, j, z + k); @@ -113,13 +126,26 @@ public class RitualEffectMagnetic extends RitualEffect { this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); } + + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); return; } } + k++; } + k = -radius; + i++; } + i = -radius; + j--; + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + return; } + + j = y - 1; + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + return; } } } @@ -129,6 +155,24 @@ public class RitualEffectMagnetic extends RitualEffect { return 50; } + + public Int3 getLastPosition(NBTTagCompound tag) + { + if(tag != null) + { + return Int3.readFromNBT(tag); + } + + return new Int3(0, 0, 0); + } + + public void setLastPosition(NBTTagCompound tag, Int3 pos) + { + if(tag != null) + { + pos.writeToNBT(tag); + } + } @Override public List getRitualComponentList() diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java new file mode 100644 index 00000000..ed692bbd --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java @@ -0,0 +1,19 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect; + +import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; +import WayofTime.alchemicalWizardry.api.RoutingFocusLogicModItems; +import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus; + +public class OutputRoutingFocusModItems extends OutputRoutingFocus +{ + @Override + public String getFocusDescription() + { + return "Only accepts items that are the same modID"; + } + + public RoutingFocusLogic getLogic() + { + return new RoutingFocusLogicModItems(); + } +} 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 70491a21..4c4e1101 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 @@ -53,9 +53,14 @@ public class SpellHelper public static boolean canEntityBeSeen(Entity entity, Entity entity2) { - return entity.worldObj.rayTraceBlocks(Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ), Vec3.createVectorHelper(entity2.posX, entity2.posY, entity2.posZ), false) == null; + return entity.worldObj.rayTraceBlocks(SpellHelper.createVec3(entity.posX, entity.posY, entity.posZ), SpellHelper.createVec3(entity2.posX, entity2.posY, entity2.posZ), false) == null; } + public static Vec3 createVec3(double x, double y, double z) + { + return APISpellHelper.createVec3(x, y, z); + } + public static void smeltBlockInWorld(World world, int posX, int posY, int posZ) { FurnaceRecipes recipes = FurnaceRecipes.smelting(); 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 fdd66528..ce304d09 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,17 +1,18 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; - -import java.util.LinkedList; -import java.util.List; -import java.util.Random; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class DigAreaTunnel extends DigAreaEffect { @@ -42,9 +43,9 @@ public class DigAreaTunnel extends DigAreaEffect double initialLength = this.getRandomVectorLength(); - Vec3 initialVector = Vec3.createVectorHelper(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); + Vec3 initialVector = SpellHelper.createVec3(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); - Vec3 lastVec = Vec3.createVectorHelper(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); + Vec3 lastVec = SpellHelper.createVec3(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); vectorLine.add(initialVector); double currentLength = lastVec.lengthVector(); @@ -151,10 +152,10 @@ public class DigAreaTunnel extends DigAreaEffect { double vecLength = vector.lengthVector(); AlchemicalWizardry.logger.info(vecLength); - Vec3 normVec = Vec3.createVectorHelper(vector.xCoord, vector.yCoord, vector.zCoord); + Vec3 normVec = SpellHelper.createVec3(vector.xCoord, vector.yCoord, vector.zCoord); normVec = normVec.normalize(); - Vec3 prevVec = Vec3.createVectorHelper(0, 0, 0); + Vec3 prevVec = SpellHelper.createVec3(0, 0, 0); double distanceTravelled = 0; while (distanceTravelled < vecLength) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java index 0ea6d6ef..6d53b912 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java @@ -1,15 +1,16 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; - -import java.util.LinkedList; -import java.util.List; -import java.util.Random; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class RightClickTunnel extends RightClickEffect { @@ -42,9 +43,9 @@ public class RightClickTunnel extends RightClickEffect double initialLength = this.getRandomVectorLength(); - Vec3 initialVector = Vec3.createVectorHelper(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); + Vec3 initialVector = SpellHelper.createVec3(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); - Vec3 lastVec = Vec3.createVectorHelper(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); + Vec3 lastVec = SpellHelper.createVec3(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); vectorLine.add(initialVector); double currentLength = lastVec.lengthVector(); @@ -157,10 +158,10 @@ public class RightClickTunnel extends RightClickEffect { double vecLength = vector.lengthVector(); - Vec3 normVec = Vec3.createVectorHelper(vector.xCoord, vector.yCoord, vector.zCoord); + Vec3 normVec = SpellHelper.createVec3(vector.xCoord, vector.yCoord, vector.zCoord); normVec = normVec.normalize(); - Vec3 prevVec = Vec3.createVectorHelper(0, 0, 0); + Vec3 prevVec = SpellHelper.createVec3(0, 0, 0); double distanceTravelled = 0; while (distanceTravelled < vecLength) diff --git a/src/main/resources/assets/alchemicalwizardry/textures/items/InputRoutingFocus.png b/src/main/resources/assets/alchemicalwizardry/textures/items/InputRoutingFocus.png new file mode 100644 index 00000000..de371ed4 Binary files /dev/null and b/src/main/resources/assets/alchemicalwizardry/textures/items/InputRoutingFocus.png differ diff --git a/src/main/resources/assets/alchemicalwizardry/textures/items/OutputRoutingFocusModItem.png b/src/main/resources/assets/alchemicalwizardry/textures/items/OutputRoutingFocusModItem.png new file mode 100644 index 00000000..dc7d0b26 Binary files /dev/null and b/src/main/resources/assets/alchemicalwizardry/textures/items/OutputRoutingFocusModItem.png differ diff --git a/src/main/resources/assets/alchemicalwizardry/textures/items/outputRoutingFocus.png b/src/main/resources/assets/alchemicalwizardry/textures/items/outputRoutingFocus.png new file mode 100644 index 00000000..90a36900 Binary files /dev/null and b/src/main/resources/assets/alchemicalwizardry/textures/items/outputRoutingFocus.png differ