Added Item Routing ritual.
Added performance improvements to magnetism ritual!
This commit is contained in:
parent
2f0a1c9909
commit
1b4879ad64
25 changed files with 429 additions and 149 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue