Added Item Routing ritual.

Added performance improvements to magnetism ritual!
This commit is contained in:
WayofTime 2015-01-20 17:27:53 -05:00
parent 2f0a1c9909
commit 1b4879ad64
25 changed files with 429 additions and 149 deletions

View file

@ -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;
// }

View file

@ -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"));
}

View file

@ -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");
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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<RoutingFocusLogic> logicList = new LinkedList();
public List<RoutingFocusPosAndFacing> 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();
}
}

View file

@ -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;
}
}

View file

@ -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<ItemStack> 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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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)
{

View file

@ -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");
}
}

View file

@ -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();
}
}

View file

@ -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)

View file

@ -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;

View file

@ -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<outputFocusInventory.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<outputFocusInventory.getSizeInventory(); j++)
{
if(outputFocusInventory.getStackInSlot(j) != null)
{
transferEverything = false;
break;
}
}
OutputRoutingFocus outputFocus = (OutputRoutingFocus)stack.getItem();
RoutingFocusParadigm parad = new RoutingFocusParadigm();
parad.addRoutingFocusPosAndFacing(outputFocus.getPosAndFacing(stack));
parad.addLogic(outputFocus.getLogic(stack.getItemDamage()));
TileEntity outputChest = world.getTileEntity(outputFocus.xCoord(stack), outputFocus.yCoord(stack), outputFocus.zCoord(stack)); //Destination
ForgeDirection inputDirection = outputFocus.getSetDirection(stack);
if(transferEverything)
{
if(outputChest instanceof IInventory)
{
if(outputFocusInventory.getStackInSlot(j) != null)
IInventory outputChestInventory = (IInventory)outputChest;
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
{
transferEverything = false;
break;
ItemStack syphonedStack = bufferInventory.getStackInSlot(n);
if(syphonedStack == null)
{
continue;
}
int size = syphonedStack.stackSize;
ItemStack newStack = SpellHelper.insertStackIntoInventory(syphonedStack, outputChestInventory, inputDirection);
if(size == newStack.stackSize)
{
continue;
}
if(newStack != null && newStack.stackSize <= 0)
{
newStack = null;
}
bufferInventory.setInventorySlotContents(n, newStack);
// break;
}
}
OutputRoutingFocus outputFocus = (OutputRoutingFocus)stack.getItem();
TileEntity outputChest = world.getTileEntity(outputFocus.xCoord(stack), outputFocus.yCoord(stack), outputFocus.zCoord(stack)); //Destination
ForgeDirection inputDirection = outputFocus.getSetDirection(stack);
if(transferEverything)
{
if(outputChest instanceof IInventory)
{
IInventory outputChestInventory = (IInventory)outputChest;
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
{
ItemStack syphonedStack = bufferInventory.getStackInSlot(n);
if(syphonedStack == null)
{
continue;
}
ItemStack newStack = SpellHelper.insertStackIntoInventory(syphonedStack, outputChestInventory, inputDirection);
if(newStack != null && newStack.stackSize <= 0)
{
newStack = null;
}
bufferInventory.setInventorySlotContents(n, newStack);
break;
}
}
}else
{
if(!(outputChest instanceof IInventory))
{
continue;
}
for(int j=1; j<outputFocusInventory.getSizeInventory(); j++)
{
ItemStack keyStack = outputFocusInventory.getStackInSlot(j);
if(keyStack == null)
{
continue;
}
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
}else
{
if(!(outputChest instanceof IInventory))
{
continue;
}
IInventory outputChestInventory = (IInventory)outputChest;
boolean lastItemWasFocus = true;
for(int j=1; j<outputFocusInventory.getSizeInventory(); j++)
{
ItemStack keyStack = outputFocusInventory.getStackInSlot(j);
if(keyStack == null)
{
continue;
}
if(keyStack.getItem() instanceof OutputRoutingFocus)
{
if(!lastItemWasFocus)
{
parad.clear();
}
outputFocus = (OutputRoutingFocus)keyStack.getItem();
parad.addRoutingFocusPosAndFacing(outputFocus.getPosAndFacing(keyStack));
parad.addLogic(outputFocus.getLogic(keyStack.getItemDamage()));
lastItemWasFocus = true;
continue;
}else
{
lastItemWasFocus = false;
}
for(RoutingFocusPosAndFacing posAndFacing : parad.locationList)
{
if(posAndFacing == null)
{
continue;
}
inputDirection = posAndFacing.facing;
if(outputChest == null || !posAndFacing.location.equals(new Int3(outputChest.xCoord, outputChest.yCoord, outputChest.zCoord)))
{
outputChest = world.getTileEntity(posAndFacing.location.xCoord, posAndFacing.location.yCoord, posAndFacing.location.zCoord);
if(outputChest instanceof IInventory)
{
outputChestInventory = (IInventory)outputChest;
}else
{
continue;
}
}
for(int n=0; n<bufferInventory.getSizeInventory(); n++)
{
ItemStack checkStack = bufferInventory.getStackInSlot(n);
if(checkStack == null)
@ -185,21 +237,26 @@ public class RitualEffectItemRouting extends RitualEffect
continue;
}
if(outputFocus.doesItemMatch(keyStack, checkStack))
if(parad.doesItemMatch(keyStack, checkStack))
{
ItemStack newStack = SpellHelper.insertStackIntoInventory(checkStack, (IInventory)outputChest, inputDirection);
int size = checkStack.stackSize;
ItemStack newStack = SpellHelper.insertStackIntoInventory(checkStack, outputChestInventory, inputDirection);
if(size == newStack.stackSize)
{
continue;
}
if(newStack != null && newStack.stackSize <= 0)
{
newStack = null;
}
bufferInventory.setInventorySlotContents(n, newStack);
break;
// break;
}
}
}
}
}
}
}
}
}
}
}
}
}

View file

@ -1,18 +1,20 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectMagnetic extends RitualEffect
{
@ -72,11 +74,22 @@ public class RitualEffectMagnetic extends RitualEffect
if (replace)
{
for (int j = y - 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<RitualComponent> getRitualComponentList()

View file

@ -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();
}
}

View file

@ -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();

View file

@ -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)

View file

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B