Cleanup and adding comparator for sorting most probably target for IItemTransfer

This commit is contained in:
tgame14 2014-04-16 16:11:39 +03:00
parent ced9a4dcbf
commit 5443704ab0
5 changed files with 34 additions and 59 deletions

View file

@ -1,6 +1,10 @@
package resonantinduction.electrical.itemrailing; package resonantinduction.electrical.itemrailing;
import calclavia.lib.grid.NodeGrid; import calclavia.lib.grid.NodeGrid;
import resonantinduction.electrical.itemrailing.interfaces.IItemRailing;
import resonantinduction.electrical.itemrailing.interfaces.IItemRailingTransfer;
import java.util.Comparator;
/** /**
* @since 18/03/14 * @since 18/03/14
@ -12,4 +16,19 @@ public class GridRailing extends NodeGrid<NodeRailing>
{ {
super(type); super(type);
} }
public IItemRailing findTargetForIItemTransfer(IItemRailingTransfer itemRailingTransfer)
{
}
public static class ComparatorRailing implements Comparator<IItemRailing>
{
@Override
public int compare(IItemRailing o1, IItemRailing o2)
{
return 0;
}
}
} }

View file

@ -7,7 +7,7 @@ import resonantinduction.electrical.itemrailing.interfaces.IItemRailingTransfer;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
/** /**
* An object that Transfers all * An object that is a wrapper for all items through railings
* *
* @since 16/03/14 * @since 16/03/14
* @author tgame14 * @author tgame14
@ -16,7 +16,7 @@ public class ItemRailingTransfer implements IItemRailingTransfer
{ {
private ItemStack stack; private ItemStack stack;
private EnumColor color; private EnumColor color;
private PartRailing railing; private IItemRailing railing;
public ItemRailingTransfer(ItemStack stack, PartRailing railing) public ItemRailingTransfer(ItemStack stack, PartRailing railing)
{ {
@ -49,13 +49,13 @@ public class ItemRailingTransfer implements IItemRailingTransfer
} }
@Override @Override
public PartRailing getRailing() public IItemRailing getRailing()
{ {
return this.railing; return this.railing;
} }
@Override @Override
public IItemRailingTransfer setRailing(PartRailing railing) public IItemRailingTransfer setRailing(IItemRailing railing)
{ {
this.railing = railing; this.railing = railing;
return this; return this;

View file

@ -17,6 +17,8 @@ import resonantinduction.electrical.itemrailing.interfaces.IItemRailing;
import resonantinduction.electrical.itemrailing.interfaces.IItemRailingTransfer; import resonantinduction.electrical.itemrailing.interfaces.IItemRailingTransfer;
import universalelectricity.api.energy.IConductor; import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyNetwork; import universalelectricity.api.energy.IEnergyNetwork;
import universalelectricity.api.vector.IVectorWorld;
import universalelectricity.api.vector.VectorWorld;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -28,7 +30,7 @@ import java.lang.reflect.InvocationTargetException;
public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, IConductor, IEnergyNetwork> implements IConductor, TSlottedPart, JNormalOcclusion, IHollowConnect, IItemRailing public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, IConductor, IEnergyNetwork> implements IConductor, TSlottedPart, JNormalOcclusion, IHollowConnect, IItemRailing
{ {
public enum EnumRailing public static enum EnumRailing
{ {
DEFAULT, EXTENTION; DEFAULT, EXTENTION;
} }
@ -94,13 +96,13 @@ public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, I
return this; return this;
} }
@Override @Override
public World getWorldObj () public IVectorWorld getWorldPos()
{ {
return super.getWorld(); return new VectorWorld(getWorld(), x(), y(), z());
} }
@Override @Override
public float getResistance () public float getResistance ()
{ {
return 0; return 0;

View file

@ -1,40 +0,0 @@
package resonantinduction.electrical.itemrailing;
import calclavia.lib.path.IPathCallBack;
import calclavia.lib.path.Pathfinder;
import calclavia.lib.path.PathfinderAStar;
import universalelectricity.api.vector.Vector3;
import java.util.Set;
/**
* @since 20/03/14
* @author tgame14
*/
public class PathfinderRailing extends PathfinderAStar
{
public PathfinderRailing (IPathCallBack callBack, Vector3 goal)
{
super(callBack, goal);
}
private static class PathCallBackRailing implements IPathCallBack
{
@Override
public Set<Vector3> getConnectedNodes (Pathfinder finder, Vector3 currentNode)
{
return null;
}
@Override
public boolean onSearch (Pathfinder finder, Vector3 start, Vector3 currentNode)
{
return false;
}
}
}

View file

@ -4,6 +4,7 @@ import calclavia.lib.grid.INodeProvider;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.IVectorWorld;
/** /**
* implement on Part Railings. * implement on Part Railings.
@ -21,14 +22,7 @@ public interface IItemRailing extends INodeProvider
public IItemRailing setRailingColor (EnumColor color); public IItemRailing setRailingColor (EnumColor color);
/** an easy implementation for tiles / parts that already have this method in them */ public IVectorWorld getWorldPos();
public World getWorldObj ();
public int x ();
public int y ();
public int z ();