Additional railing grid work

This commit is contained in:
tgame14 2014-03-18 14:05:17 +02:00
parent c2ed03c4cd
commit 6690ebe8f4
3 changed files with 46 additions and 6 deletions

View file

@ -0,0 +1,15 @@
package resonantinduction.electrical.itemrailing;
import calclavia.lib.grid.Grid;
/**
* @since 18/03/14
* @author tgame14
*/
public class GridRailing extends Grid<PartRailing>
{
public GridRailing (Class type)
{
super(type);
}
}

View file

@ -1,5 +1,6 @@
package resonantinduction.electrical.itemrailing; package resonantinduction.electrical.itemrailing;
import calclavia.lib.grid.INode;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
import codechicken.microblock.IHollowConnect; import codechicken.microblock.IHollowConnect;
import codechicken.multipart.JNormalOcclusion; import codechicken.multipart.JNormalOcclusion;
@ -19,8 +20,14 @@ import universalelectricity.api.energy.IEnergyNetwork;
* @since 16/03/14 * @since 16/03/14
* @author tgame14 * @author tgame14
*/ */
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, INode
{ {
public enum EnumRailing
{
DEFAULT;
}
// default is NULL // default is NULL
private EnumColor color; private EnumColor color;
@ -35,13 +42,12 @@ public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, I
@Override @Override
public boolean canItemEnter (IItemRailingTransfer item) public boolean canItemEnter (IItemRailingTransfer item)
{ {
return this.color == item.getColor(); return this.color != null ? this.color == item.getColor() : false;
} }
@Override @Override
public boolean canConnectToRailing (IItemRailing railing, ForgeDirection from) public boolean canConnectToRailing (IItemRailing railing, ForgeDirection from)
{ {
return this.color != null ? this.color == railing.getRailingColor() : true; return this.color != null ? this.color == railing.getRailingColor() : true;
} }
@ -64,9 +70,28 @@ public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, I
return super.getWorld(); return super.getWorld();
} }
public enum EnumRailing @Override
public void reconstruct ()
{ {
DEFAULT;
}
@Override
public void deconstruct ()
{
}
@Override
public void recache ()
{
}
@Override
public void update (float deltaTime)
{
} }
@Override @Override

View file

@ -14,7 +14,7 @@ public interface IItemRailing
{ {
public boolean canItemEnter (IItemRailingTransfer item); public boolean canItemEnter (IItemRailingTransfer item);
public boolean canConnectToRailing (IItemRailing railing, ForgeDirection from); public boolean canConnectToRailing (IItemRailing railing, ForgeDirection to);
public EnumColor getRailingColor (); public EnumColor getRailingColor ();