API, etc. improvements
This commit is contained in:
parent
971f3614c9
commit
0b329169ae
38 changed files with 138 additions and 86 deletions
|
@ -193,4 +193,9 @@ public class Position implements ISerializable {
|
||||||
stream.writeDouble(z);
|
stream.writeDouble(z);
|
||||||
stream.writeByte(orientation.ordinal());
|
stream.writeByte(orientation.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return (51 * (int) x) + (13 * (int) y) + (int) z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.api.gates;
|
package buildcraft.api.gates;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import buildcraft.api.statements.IStatement;
|
||||||
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||||
import buildcraft.api.transport.IPipe;
|
import buildcraft.api.transport.IPipe;
|
||||||
|
|
||||||
|
@ -16,4 +20,12 @@ public interface IGate extends ISidedStatementContainer {
|
||||||
void setPulsing(boolean pulse);
|
void setPulsing(boolean pulse);
|
||||||
|
|
||||||
IPipe getPipe();
|
IPipe getPipe();
|
||||||
|
|
||||||
|
List<IStatement> getTriggers();
|
||||||
|
List<IStatement> getActions();
|
||||||
|
|
||||||
|
List<StatementSlot> getActiveActions();
|
||||||
|
|
||||||
|
List<IStatementParameter> getTriggerParameters(int index);
|
||||||
|
List<IStatementParameter> getActionParameters(int index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.api.statements;
|
package buildcraft.api.statements;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport.gates;
|
package buildcraft.api.statements;
|
||||||
|
|
||||||
import buildcraft.api.statements.IStatement;
|
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
|
||||||
|
|
||||||
public class StatementSlot {
|
public class StatementSlot {
|
||||||
public IStatement statement;
|
public IStatement statement;
|
|
@ -53,6 +53,7 @@ public interface IPipeTile extends IInjectable {
|
||||||
boolean hasBlockingPluggable(ForgeDirection direction);
|
boolean hasBlockingPluggable(ForgeDirection direction);
|
||||||
|
|
||||||
void scheduleNeighborChange();
|
void scheduleNeighborChange();
|
||||||
|
void scheduleRenderUpdate();
|
||||||
|
|
||||||
// For compatibility with BC 6.2.x and below
|
// For compatibility with BC 6.2.x and below
|
||||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
|
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
import buildcraft.BuildCraftBuilders;
|
import buildcraft.BuildCraftBuilders;
|
||||||
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.core.StackAtPosition;
|
import buildcraft.core.StackAtPosition;
|
||||||
import buildcraft.core.builders.BuildingItem;
|
import buildcraft.core.builders.BuildingItem;
|
||||||
import buildcraft.core.builders.IBuildingItemsProvider;
|
import buildcraft.core.builders.IBuildingItemsProvider;
|
||||||
|
@ -74,7 +75,7 @@ public class RenderBuildingItems {
|
||||||
|
|
||||||
private void doRenderItem(BuildingItem i, float light) {
|
private void doRenderItem(BuildingItem i, float light) {
|
||||||
if (buildToolItem == null) {
|
if (buildToolItem == null) {
|
||||||
buildToolItem = Item.getItemFromBlock(BuildCraftBuilders.buildToolBlock);
|
buildToolItem = Item.getItemFromBlock(BuildCraftCore.buildToolBlock);
|
||||||
buildToolGlList = GL11.glGenLists(1);
|
buildToolGlList = GL11.glGenLists(1);
|
||||||
renderToList(new ItemStack(buildToolItem), buildToolGlList);
|
renderToList(new ItemStack(buildToolItem), buildToolGlList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LocalInventoryCrafting extends InventoryCrafting {
|
public class LocalInventoryCrafting extends InventoryCrafting {
|
||||||
|
|
||||||
public LocalInventoryCrafting() {
|
public LocalInventoryCrafting() {
|
||||||
super(new Container() {
|
super(new Container() {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package buildcraft.robotics;
|
package buildcraft.robotics;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
@ -17,6 +18,7 @@ import buildcraft.api.core.BlockIndex;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.api.robots.IDockingStation;
|
import buildcraft.api.robots.IDockingStation;
|
||||||
import buildcraft.api.robots.RobotManager;
|
import buildcraft.api.robots.RobotManager;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
|
|
||||||
public class DockingStation implements IDockingStation {
|
public class DockingStation implements IDockingStation {
|
||||||
|
@ -29,7 +31,7 @@ public class DockingStation implements IDockingStation {
|
||||||
private boolean linkIsMain = false;
|
private boolean linkIsMain = false;
|
||||||
|
|
||||||
private BlockIndex index;
|
private BlockIndex index;
|
||||||
private TileGenericPipe pipe;
|
private IPipeTile pipe;
|
||||||
|
|
||||||
public DockingStation(BlockIndex iIndex, ForgeDirection iSide) {
|
public DockingStation(BlockIndex iIndex, ForgeDirection iSide) {
|
||||||
index = iIndex;
|
index = iIndex;
|
||||||
|
@ -50,12 +52,12 @@ public class DockingStation implements IDockingStation {
|
||||||
return linkIsMain;
|
return linkIsMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileGenericPipe getPipe() {
|
public IPipeTile getPipe() {
|
||||||
if (pipe == null) {
|
if (pipe == null) {
|
||||||
pipe = (TileGenericPipe) world.getTileEntity(index.x, index.y, index.z);
|
pipe = (IPipeTile) world.getTileEntity(index.x, index.y, index.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipe == null || pipe.isInvalid()) {
|
if (pipe == null || ((TileEntity) pipe).isInvalid()) {
|
||||||
// Inconsistency - remove this pipe from the registry.
|
// Inconsistency - remove this pipe from the registry.
|
||||||
RobotManager.registryProvider.getRegistry(world).removeStation(this);
|
RobotManager.registryProvider.getRegistry(world).removeStation(this);
|
||||||
pipe = null;
|
pipe = null;
|
||||||
|
|
|
@ -51,12 +51,12 @@ import buildcraft.api.boards.RedstoneBoardRobot;
|
||||||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||||
import buildcraft.api.core.BlockIndex;
|
import buildcraft.api.core.BlockIndex;
|
||||||
import buildcraft.api.core.IZone;
|
import buildcraft.api.core.IZone;
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.api.robots.IDockingStation;
|
import buildcraft.api.robots.IDockingStation;
|
||||||
import buildcraft.api.robots.RobotManager;
|
import buildcraft.api.robots.RobotManager;
|
||||||
import buildcraft.api.tiles.IDebuggable;
|
import buildcraft.api.tiles.IDebuggable;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.LaserData;
|
import buildcraft.core.LaserData;
|
||||||
import buildcraft.core.lib.RFBattery;
|
import buildcraft.core.lib.RFBattery;
|
||||||
|
@ -68,9 +68,10 @@ import buildcraft.core.lib.utils.NetworkUtils;
|
||||||
import buildcraft.robotics.ai.AIRobotMain;
|
import buildcraft.robotics.ai.AIRobotMain;
|
||||||
import buildcraft.robotics.ai.AIRobotSleep;
|
import buildcraft.robotics.ai.AIRobotSleep;
|
||||||
import buildcraft.robotics.statements.ActionRobotWorkInArea;
|
import buildcraft.robotics.statements.ActionRobotWorkInArea;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeTransportPower;
|
import buildcraft.transport.PipeTransportPower;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class EntityRobot extends EntityRobotBase implements
|
public class EntityRobot extends EntityRobotBase implements
|
||||||
IEntityAdditionalSpawnData, IInventory, IFluidHandler, ICommandReceiver, IDebuggable {
|
IEntityAdditionalSpawnData, IInventory, IFluidHandler, ICommandReceiver, IDebuggable {
|
||||||
|
@ -345,7 +346,7 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
if (currentDockingStation == null) {
|
if (currentDockingStation == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(currentDockingStation.getPipe().pipe.transport instanceof PipeTransportPower)) {
|
if (currentDockingStation.getPipe().getPipeType() != IPipeTile.PipeType.POWER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -913,7 +914,7 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
@Override
|
@Override
|
||||||
public IZone getZoneToWork() {
|
public IZone getZoneToWork() {
|
||||||
if (linkedDockingStation instanceof DockingStation) {
|
if (linkedDockingStation instanceof DockingStation) {
|
||||||
for (StatementSlot s : new ActionIterator(((DockingStation) linkedDockingStation).getPipe().pipe)) {
|
for (StatementSlot s : new ActionIterator(((DockingStation) linkedDockingStation).getPipe().getPipe())) {
|
||||||
if (s.statement instanceof ActionRobotWorkInArea) {
|
if (s.statement instanceof ActionRobotWorkInArea) {
|
||||||
IZone zone = ActionRobotWorkInArea.getArea(s);
|
IZone zone = ActionRobotWorkInArea.getArea(s);
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@ import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.api.robots.IRequestProvider;
|
import buildcraft.api.robots.IRequestProvider;
|
||||||
import buildcraft.api.robots.StackRequest;
|
import buildcraft.api.robots.StackRequest;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.core.lib.inventory.InvUtils;
|
import buildcraft.core.lib.inventory.InvUtils;
|
||||||
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
|
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.IStationFilter;
|
import buildcraft.robotics.IStationFilter;
|
||||||
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
|
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class AIRobotDeliverRequested extends AIRobot {
|
public class AIRobotDeliverRequested extends AIRobot {
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class AIRobotDeliverRequested extends AIRobot {
|
||||||
public boolean matches(DockingStation station) {
|
public boolean matches(DockingStation station) {
|
||||||
boolean actionFound = false;
|
boolean actionFound = false;
|
||||||
|
|
||||||
Pipe pipe = station.getPipe().pipe;
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
|
|
||||||
if (!station.index().nextTo(new BlockIndex(requested.requester))) {
|
if (!station.index().nextTo(new BlockIndex(requested.requester))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -14,14 +14,14 @@ import buildcraft.api.core.IInvSlot;
|
||||||
import buildcraft.api.core.IZone;
|
import buildcraft.api.core.IZone;
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.core.lib.inventory.InventoryIterator;
|
import buildcraft.core.lib.inventory.InventoryIterator;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.EntityRobot;
|
import buildcraft.robotics.EntityRobot;
|
||||||
import buildcraft.robotics.IStationFilter;
|
import buildcraft.robotics.IStationFilter;
|
||||||
import buildcraft.robotics.statements.ActionStationInputItems;
|
import buildcraft.robotics.statements.ActionStationInputItems;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class AIRobotGotoStationToUnload extends AIRobot {
|
public class AIRobotGotoStationToUnload extends AIRobot {
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class AIRobotGotoStationToUnload extends AIRobot {
|
||||||
private class StationInventory implements IStationFilter {
|
private class StationInventory implements IStationFilter {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(DockingStation station) {
|
public boolean matches(DockingStation station) {
|
||||||
Pipe pipe = station.getPipe().pipe;
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
|
|
||||||
for (IInvSlot robotSlot : InventoryIterator.getIterable(robot, ForgeDirection.UNKNOWN)) {
|
for (IInvSlot robotSlot : InventoryIterator.getIterable(robot, ForgeDirection.UNKNOWN)) {
|
||||||
if (robotSlot.getStackInSlot() == null) {
|
if (robotSlot.getStackInSlot() == null) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.IStationFilter;
|
import buildcraft.robotics.IStationFilter;
|
||||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||||
import buildcraft.robotics.statements.ActionStationAcceptFluids;
|
import buildcraft.robotics.statements.ActionStationAcceptFluids;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeTransportFluids;
|
import buildcraft.transport.PipeTransportFluids;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
|
|
||||||
|
@ -69,8 +70,8 @@ public class AIRobotGotoStationToUnloadFluids extends AIRobot {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (station.getPipe().pipe.transport instanceof PipeTransportFluids) {
|
if (((Pipe) station.getPipe().getPipe()).transport instanceof PipeTransportFluids) {
|
||||||
PipeTransportFluids transport = ((PipeTransportFluids) station.getPipe().pipe.transport);
|
PipeTransportFluids transport = ((PipeTransportFluids) ((Pipe) station.getPipe().getPipe()).transport);
|
||||||
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, 1, false);
|
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, 1, false);
|
||||||
|
|
||||||
int filledAmount = transport.fill(station.side, drainable, false);
|
int filledAmount = transport.fill(station.side, drainable, false);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class AIRobotRecharge extends AIRobot {
|
||||||
public void delegateAIEnded(AIRobot ai) {
|
public void delegateAIEnded(AIRobot ai) {
|
||||||
if (ai instanceof AIRobotSearchAndGotoStation) {
|
if (ai instanceof AIRobotSearchAndGotoStation) {
|
||||||
if (robot.getDockingStation() == null
|
if (robot.getDockingStation() == null
|
||||||
|| !(((DockingStation) robot.getDockingStation()).getPipe().pipe.transport instanceof PipeTransportPower)) {
|
|| ((DockingStation) robot.getDockingStation()).getPipe().getPipeType() != IPipeTile.PipeType.POWER) {
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.api.robots.IRequestProvider;
|
||||||
import buildcraft.api.robots.StackRequest;
|
import buildcraft.api.robots.StackRequest;
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.StatementParameterItemStack;
|
import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.core.lib.inventory.StackHelper;
|
import buildcraft.core.lib.inventory.StackHelper;
|
||||||
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
|
@ -28,9 +29,8 @@ import buildcraft.robotics.IStationFilter;
|
||||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||||
import buildcraft.robotics.statements.ActionStationRequestItems;
|
import buildcraft.robotics.statements.ActionStationRequestItems;
|
||||||
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
|
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class AIRobotSearchStackRequest extends AIRobot {
|
public class AIRobotSearchStackRequest extends AIRobot {
|
||||||
|
|
||||||
|
@ -126,8 +126,7 @@ public class AIRobotSearchStackRequest extends AIRobot {
|
||||||
|
|
||||||
private StackRequest getOrderFromRequestingAction(DockingStation station) {
|
private StackRequest getOrderFromRequestingAction(DockingStation station) {
|
||||||
boolean actionFound = false;
|
boolean actionFound = false;
|
||||||
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
Pipe pipe = station.getPipe().pipe;
|
|
||||||
|
|
||||||
for (StatementSlot s : new ActionIterator(pipe)) {
|
for (StatementSlot s : new ActionIterator(pipe)) {
|
||||||
if (s.statement instanceof ActionStationRequestItems) {
|
if (s.statement instanceof ActionStationRequestItems) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.statements.ActionRobotWakeUp;
|
import buildcraft.robotics.statements.ActionRobotWakeUp;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class AIRobotSleep extends AIRobot {
|
public class AIRobotSleep extends AIRobot {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class AIRobotSleep extends AIRobot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preempt(AIRobot ai) {
|
public void preempt(AIRobot ai) {
|
||||||
for (StatementSlot s : new ActionIterator(((DockingStation) robot.getLinkedStation()).getPipe().pipe)) {
|
for (StatementSlot s : new ActionIterator(((DockingStation) robot.getLinkedStation()).getPipe().getPipe())) {
|
||||||
if (s.statement instanceof ActionRobotWakeUp) {
|
if (s.statement instanceof ActionRobotWakeUp) {
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.api.core.IInvSlot;
|
import buildcraft.api.core.IInvSlot;
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.core.lib.inventory.InventoryIterator;
|
import buildcraft.core.lib.inventory.InventoryIterator;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.EntityRobot;
|
import buildcraft.robotics.EntityRobot;
|
||||||
import buildcraft.robotics.statements.ActionStationInputItems;
|
import buildcraft.robotics.statements.ActionStationInputItems;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class AIRobotUnload extends AIRobot {
|
public class AIRobotUnload extends AIRobot {
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class AIRobotUnload extends AIRobot {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipe pipe = station.getPipe().pipe;
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
|
|
||||||
for (IInvSlot robotSlot : InventoryIterator.getIterable(robot, ForgeDirection.UNKNOWN)) {
|
for (IInvSlot robotSlot : InventoryIterator.getIterable(robot, ForgeDirection.UNKNOWN)) {
|
||||||
if (robotSlot.getStackInSlot() == null) {
|
if (robotSlot.getStackInSlot() == null) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import buildcraft.core.lib.inventory.filters.SimpleFluidFilter;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||||
import buildcraft.robotics.statements.ActionStationAcceptFluids;
|
import buildcraft.robotics.statements.ActionStationAcceptFluids;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeTransportFluids;
|
import buildcraft.transport.PipeTransportFluids;
|
||||||
|
|
||||||
public class AIRobotUnloadFluids extends AIRobot {
|
public class AIRobotUnloadFluids extends AIRobot {
|
||||||
|
@ -48,8 +49,8 @@ public class AIRobotUnloadFluids extends AIRobot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (station.getPipe().pipe.transport instanceof PipeTransportFluids) {
|
if (((Pipe) station.getPipe().getPipe()).transport instanceof PipeTransportFluids) {
|
||||||
PipeTransportFluids transport = ((PipeTransportFluids) station.getPipe().pipe.transport);
|
PipeTransportFluids transport = ((PipeTransportFluids) ((Pipe) station.getPipe().getPipe()).transport);
|
||||||
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.BUCKET_VOLUME,
|
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.BUCKET_VOLUME,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||||
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
||||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
||||||
|
|
||||||
DockingStation station = (DockingStation) robot.getLinkedStation();
|
DockingStation station = (DockingStation) robot.getLinkedStation();
|
||||||
|
|
||||||
for (StatementSlot slot : new ActionIterator(station.getPipe().pipe)) {
|
for (StatementSlot slot : new ActionIterator(station.getPipe().getPipe())) {
|
||||||
if (slot.statement instanceof ActionRobotFilter) {
|
if (slot.statement instanceof ActionRobotFilter) {
|
||||||
for (IStatementParameter p : slot.parameters) {
|
for (IStatementParameter p : slot.parameters) {
|
||||||
if (p != null && p instanceof StatementParameterItemStack) {
|
if (p != null && p instanceof StatementParameterItemStack) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import buildcraft.robotics.ai.AIRobotPumpBlock;
|
||||||
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
||||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class BoardRobotPump extends RedstoneBoardRobot {
|
public class BoardRobotPump extends RedstoneBoardRobot {
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class BoardRobotPump extends RedstoneBoardRobot {
|
||||||
|
|
||||||
DockingStation station = (DockingStation) robot.getLinkedStation();
|
DockingStation station = (DockingStation) robot.getLinkedStation();
|
||||||
|
|
||||||
for (StatementSlot slot : new ActionIterator(station.getPipe().pipe)) {
|
for (StatementSlot slot : new ActionIterator(station.getPipe().getPipe())) {
|
||||||
if (slot.statement instanceof ActionRobotFilter) {
|
if (slot.statement instanceof ActionRobotFilter) {
|
||||||
for (IStatementParameter p : slot.parameters) {
|
for (IStatementParameter p : slot.parameters) {
|
||||||
if (p != null && p instanceof StatementParameterItemStack) {
|
if (p != null && p instanceof StatementParameterItemStack) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.statements.IStatementContainer;
|
import buildcraft.api.statements.IStatementContainer;
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.StatementParameterItemStack;
|
import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.core.lib.inventory.filters.ArrayFluidFilter;
|
import buildcraft.core.lib.inventory.filters.ArrayFluidFilter;
|
||||||
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
|
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
|
||||||
import buildcraft.core.lib.inventory.filters.IFluidFilter;
|
import buildcraft.core.lib.inventory.filters.IFluidFilter;
|
||||||
|
@ -32,9 +33,8 @@ import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter;
|
||||||
import buildcraft.core.statements.BCStatement;
|
import buildcraft.core.statements.BCStatement;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionRobotFilter extends BCStatement implements IActionInternal {
|
public class ActionRobotFilter extends BCStatement implements IActionInternal {
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
|
||||||
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
|
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
|
||||||
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().pipe)) {
|
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().getPipe())) {
|
||||||
if (slot.statement instanceof ActionRobotFilter) {
|
if (slot.statement instanceof ActionRobotFilter) {
|
||||||
for (IStatementParameter p : slot.parameters) {
|
for (IStatementParameter p : slot.parameters) {
|
||||||
if (p != null && p instanceof StatementParameterItemStack) {
|
if (p != null && p instanceof StatementParameterItemStack) {
|
||||||
|
@ -111,7 +111,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
|
||||||
public static boolean canInteractWithItem(DockingStation station, IStackFilter filter, Class<?> actionClass) {
|
public static boolean canInteractWithItem(DockingStation station, IStackFilter filter, Class<?> actionClass) {
|
||||||
boolean actionFound = false;
|
boolean actionFound = false;
|
||||||
|
|
||||||
Pipe pipe = station.getPipe().pipe;
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
|
|
||||||
for (StatementSlot s : new ActionIterator(pipe)) {
|
for (StatementSlot s : new ActionIterator(pipe)) {
|
||||||
if (actionClass.isAssignableFrom(s.statement.getClass())) {
|
if (actionClass.isAssignableFrom(s.statement.getClass())) {
|
||||||
|
@ -129,7 +129,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
|
||||||
|
|
||||||
public static boolean canInteractWithFluid(DockingStation station, IFluidFilter filter, Class<?> actionClass) {
|
public static boolean canInteractWithFluid(DockingStation station, IFluidFilter filter, Class<?> actionClass) {
|
||||||
boolean actionFound = false;
|
boolean actionFound = false;
|
||||||
Pipe pipe = station.getPipe().pipe;
|
IPipe pipe = station.getPipe().getPipe();
|
||||||
|
|
||||||
for (StatementSlot s : new ActionIterator(pipe)) {
|
for (StatementSlot s : new ActionIterator(pipe)) {
|
||||||
if (actionClass.isAssignableFrom(s.statement.getClass())) {
|
if (actionClass.isAssignableFrom(s.statement.getClass())) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import buildcraft.core.statements.BCStatement;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionRobotFilterTool extends BCStatement implements IActionInternal {
|
public class ActionRobotFilterTool extends BCStatement implements IActionInternal {
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class ActionRobotFilterTool extends BCStatement implements IActionInterna
|
||||||
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
|
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
|
||||||
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().pipe)) {
|
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().getPipe())) {
|
||||||
if (slot.statement instanceof ActionRobotFilterTool) {
|
if (slot.statement instanceof ActionRobotFilterTool) {
|
||||||
for (IStatementParameter p : slot.parameters) {
|
for (IStatementParameter p : slot.parameters) {
|
||||||
if (p != null && p instanceof StatementParameterItemStack) {
|
if (p != null && p instanceof StatementParameterItemStack) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.StatementParameterItemStack;
|
import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
import buildcraft.core.statements.BCStatement;
|
import buildcraft.core.statements.BCStatement;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionRobotWorkInArea extends BCStatement implements IActionInternal {
|
public class ActionRobotWorkInArea extends BCStatement implements IActionInternal {
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,10 @@ import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.EntityRobot;
|
import buildcraft.robotics.EntityRobot;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionStationAcceptItems extends ActionStationInputItems {
|
public class ActionStationAcceptItems extends ActionStationInputItems {
|
||||||
|
|
||||||
|
@ -59,14 +60,14 @@ public class ActionStationAcceptItems extends ActionStationInputItems {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (station.getPipe().pipe.transport instanceof PipeTransportItems) {
|
if (((Pipe) station.getPipe().getPipe()).transport instanceof PipeTransportItems) {
|
||||||
float cx = station.x() + 0.5F + 0.2F * station.side().offsetX;
|
float cx = station.x() + 0.5F + 0.2F * station.side().offsetX;
|
||||||
float cy = station.y() + 0.5F + 0.2F * station.side().offsetY;
|
float cy = station.y() + 0.5F + 0.2F * station.side().offsetY;
|
||||||
float cz = station.z() + 0.5F + 0.2F * station.side().offsetZ;
|
float cz = station.z() + 0.5F + 0.2F * station.side().offsetZ;
|
||||||
|
|
||||||
TravelingItem item = TravelingItem.make(cx, cy, cz, invSlot.getStackInSlot());
|
TravelingItem item = TravelingItem.make(cx, cy, cz, invSlot.getStackInSlot());
|
||||||
|
|
||||||
((PipeTransportItems) station.getPipe().pipe.transport).injectItem(item, station.side().getOpposite());
|
((PipeTransportItems) ((Pipe) station.getPipe().getPipe()).transport).injectItem(item, station.side().getOpposite());
|
||||||
|
|
||||||
invSlot.setStackInSlot(null);
|
invSlot.setStackInSlot(null);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.ItemRobot;
|
import buildcraft.robotics.ItemRobot;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionStationForbidRobot extends BCStatement implements IActionInternal {
|
public class ActionStationForbidRobot extends BCStatement implements IActionInternal {
|
||||||
private final boolean invert;
|
private final boolean invert;
|
||||||
|
@ -57,7 +57,7 @@ public class ActionStationForbidRobot extends BCStatement implements IActionInte
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isForbidden(DockingStation station, EntityRobotBase robot) {
|
public static boolean isForbidden(DockingStation station, EntityRobotBase robot) {
|
||||||
for (StatementSlot s : new ActionIterator(station.getPipe().pipe)) {
|
for (StatementSlot s : new ActionIterator(station.getPipe().getPipe())) {
|
||||||
if (s.statement instanceof ActionStationForbidRobot) {
|
if (s.statement instanceof ActionStationForbidRobot) {
|
||||||
if (((ActionStationForbidRobot) s.statement).invert ^ ActionStationForbidRobot.isForbidden(s, robot)) {
|
if (((ActionStationForbidRobot) s.statement).invert ^ ActionStationForbidRobot.isForbidden(s, robot)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter;
|
||||||
import buildcraft.core.statements.BCStatement;
|
import buildcraft.core.statements.BCStatement;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.EntityRobot;
|
import buildcraft.robotics.EntityRobot;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public abstract class ActionStationInputItems extends BCStatement implements IActionInternal {
|
public abstract class ActionStationInputItems extends BCStatement implements IActionInternal {
|
||||||
|
|
||||||
|
|
|
@ -9,23 +9,17 @@
|
||||||
package buildcraft.robotics.statements;
|
package buildcraft.robotics.statements;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.core.IInvSlot;
|
import buildcraft.api.core.IInvSlot;
|
||||||
import buildcraft.api.statements.IStatementParameter;
|
import buildcraft.api.statements.IStatementParameter;
|
||||||
import buildcraft.api.statements.StatementParameterItemStack;
|
import buildcraft.api.statements.StatementParameterItemStack;
|
||||||
import buildcraft.core.lib.inventory.ITransactor;
|
|
||||||
import buildcraft.core.lib.inventory.Transactor;
|
|
||||||
import buildcraft.core.lib.utils.StringUtils;
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.robotics.DockingStation;
|
import buildcraft.robotics.DockingStation;
|
||||||
import buildcraft.robotics.EntityRobot;
|
import buildcraft.robotics.EntityRobot;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
|
||||||
public class ActionStationRequestItems extends ActionStationInputItems {
|
public class ActionStationRequestItems extends ActionStationInputItems {
|
||||||
|
|
||||||
|
@ -65,14 +59,14 @@ public class ActionStationRequestItems extends ActionStationInputItems {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (station.getPipe().pipe.transport instanceof PipeTransportItems) {
|
if (((Pipe) station.getPipe().getPipe()).transport instanceof PipeTransportItems) {
|
||||||
float cx = station.x() + 0.5F + 0.2F * station.side().offsetX;
|
float cx = station.x() + 0.5F + 0.2F * station.side().offsetX;
|
||||||
float cy = station.y() + 0.5F + 0.2F * station.side().offsetY;
|
float cy = station.y() + 0.5F + 0.2F * station.side().offsetY;
|
||||||
float cz = station.z() + 0.5F + 0.2F * station.side().offsetZ;
|
float cz = station.z() + 0.5F + 0.2F * station.side().offsetZ;
|
||||||
|
|
||||||
TravelingItem item = TravelingItem.make(cx, cy, cz, invSlot.getStackInSlot());
|
TravelingItem item = TravelingItem.make(cx, cy, cz, invSlot.getStackInSlot());
|
||||||
|
|
||||||
((PipeTransportItems) station.getPipe().pipe.transport).injectItem(item, station.side().getOpposite());
|
((PipeTransportItems) ((Pipe) station.getPipe().getPipe()).transport).injectItem(item, station.side().getOpposite());
|
||||||
|
|
||||||
invSlot.setStackInSlot(null);
|
invSlot.setStackInSlot(null);
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,11 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
|
@ -46,7 +49,7 @@ import buildcraft.core.GuiIds;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||||
import buildcraft.transport.gates.ItemGate;
|
import buildcraft.transport.gates.ItemGate;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.statements.ActionValve;
|
import buildcraft.transport.statements.ActionValve;
|
||||||
|
|
||||||
|
@ -663,6 +666,37 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta
|
||||||
return pipe.container;
|
return pipe.container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IStatement> getTriggers() {
|
||||||
|
return Arrays.asList(triggers).subList(0, material.numSlots);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IStatement> getActions() {
|
||||||
|
return Arrays.asList(actions).subList(0, material.numSlots);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatementSlot> getActiveActions() {
|
||||||
|
return activeActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IStatementParameter> getTriggerParameters(int index) {
|
||||||
|
if (index < 0 || index >= material.numSlots) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Arrays.asList(triggerParameters[index]).subList(0, material.numTriggerParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IStatementParameter> getActionParameters(int index) {
|
||||||
|
if (index < 0 || index >= material.numSlots) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Arrays.asList(actionParameters[index]).subList(0, material.numActionParameters);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRedstoneInput(ForgeDirection side) {
|
public int getRedstoneInput(ForgeDirection side) {
|
||||||
return side == ForgeDirection.UNKNOWN ? pipe.container.redstoneInput : pipe.container.redstoneInputSide[side.ordinal()];
|
return side == ForgeDirection.UNKNOWN ? pipe.container.redstoneInput : pipe.container.redstoneInputSide[side.ordinal()];
|
||||||
|
|
|
@ -40,7 +40,7 @@ import buildcraft.core.IDropControlInventory;
|
||||||
import buildcraft.core.lib.inventory.InvUtils;
|
import buildcraft.core.lib.inventory.InvUtils;
|
||||||
import buildcraft.core.lib.utils.Utils;
|
import buildcraft.core.lib.utils.Utils;
|
||||||
import buildcraft.transport.gates.GateFactory;
|
import buildcraft.transport.gates.GateFactory;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionValve.ValveState;
|
import buildcraft.transport.statements.ActionValve.ValveState;
|
||||||
|
|
||||||
public abstract class Pipe<T extends PipeTransport> implements IDropControlInventory, IPipe {
|
public abstract class Pipe<T extends PipeTransport> implements IDropControlInventory, IPipe {
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
||||||
LinkedList<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
|
LinkedList<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
|
||||||
Pipe<?> pipe = null;
|
Pipe<?> pipe = null;
|
||||||
TileEntity tile = container.getTile();
|
TileEntity tile = container.getTile();
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof TileGenericPipe) {
|
||||||
pipe = ((TileGenericPipe) tile).pipe;
|
pipe = ((TileGenericPipe) tile).pipe;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,15 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import buildcraft.api.statements.StatementSlot;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.transport.Gate;
|
import buildcraft.transport.Gate;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
|
|
||||||
public class ActionIterator implements Iterable<StatementSlot> {
|
public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
|
private IPipe pipe;
|
||||||
|
|
||||||
private Pipe pipe;
|
public ActionIterator(IPipe iPipe) {
|
||||||
|
|
||||||
public ActionIterator(Pipe iPipe) {
|
|
||||||
pipe = iPipe;
|
pipe = iPipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
while (!isValid()) {
|
while (!isValid()) {
|
||||||
if (curDir == ForgeDirection.UNKNOWN) {
|
if (curDir == ForgeDirection.UNKNOWN) {
|
||||||
break;
|
break;
|
||||||
} else if (pipe.gates[curDir.ordinal()] == null
|
} else if (pipe.getGate(curDir) == null
|
||||||
|| index >= pipe.gates[curDir.ordinal()].activeActions.size() - 1) {
|
|| index >= pipe.getGate(curDir).getActiveActions().size() - 1) {
|
||||||
index = 0;
|
index = 0;
|
||||||
curDir = ForgeDirection.values()[curDir.ordinal() + 1];
|
curDir = ForgeDirection.values()[curDir.ordinal() + 1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,7 +49,7 @@ public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
next = pipe.gates[curDir.ordinal()].activeActions.get(index);
|
next = pipe.getGate(curDir).getActiveActions().get(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
next = pipe.gates[curDir.ordinal()].activeActions.get(index);
|
next = pipe.getGate(curDir).getActiveActions().get(index);
|
||||||
} else {
|
} else {
|
||||||
next = null;
|
next = null;
|
||||||
}
|
}
|
||||||
|
@ -92,8 +93,8 @@ public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
|
|
||||||
private boolean isValid() {
|
private boolean isValid() {
|
||||||
return curDir != ForgeDirection.UNKNOWN
|
return curDir != ForgeDirection.UNKNOWN
|
||||||
&& pipe.gates[curDir.ordinal()] != null
|
&& pipe.getGate(curDir) != null
|
||||||
&& index < pipe.gates[curDir.ordinal()].activeActions.size();
|
&& index < pipe.getGate(curDir).getActiveActions().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportFluids;
|
import buildcraft.transport.PipeTransportFluids;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionPipeDirection;
|
import buildcraft.transport.statements.ActionPipeDirection;
|
||||||
|
|
||||||
public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
|
public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.pipes.events.PipeEventItem;
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.statements.ActionPipeColor;
|
import buildcraft.transport.statements.ActionPipeColor;
|
||||||
import buildcraft.transport.statements.ActionPipeDirection;
|
import buildcraft.transport.statements.ActionPipeDirection;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import buildcraft.core.lib.network.IGuiReturnHandler;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionExtractionPreset;
|
import buildcraft.transport.statements.ActionExtractionPreset;
|
||||||
|
|
||||||
public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler {
|
public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionPipeDirection;
|
import buildcraft.transport.statements.ActionPipeDirection;
|
||||||
|
|
||||||
public class PipeItemsIron extends Pipe<PipeTransportItems> {
|
public class PipeItemsIron extends Pipe<PipeTransportItems> {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.pipes.events.PipeEventItem;
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.statements.ActionPipeColor;
|
import buildcraft.transport.statements.ActionPipeColor;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.pipes.events.PipeEventItem;
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.statements.ActionPipeDirection;
|
import buildcraft.transport.statements.ActionPipeDirection;
|
||||||
import buildcraft.transport.utils.TransportUtils;
|
import buildcraft.transport.utils.TransportUtils;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import buildcraft.core.lib.utils.StringUtils;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportPower;
|
import buildcraft.transport.PipeTransportPower;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.api.statements.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionPowerLimiter;
|
import buildcraft.transport.statements.ActionPowerLimiter;
|
||||||
|
|
||||||
public class PipePowerIron extends Pipe<PipeTransportPower> {
|
public class PipePowerIron extends Pipe<PipeTransportPower> {
|
||||||
|
|
|
@ -6,11 +6,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.api.transport.pluggable.IFacadePluggable;
|
import buildcraft.api.transport.pluggable.IFacadePluggable;
|
||||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||||
import buildcraft.core.CompatHooks;
|
import buildcraft.core.CompatHooks;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
|
||||||
|
|
||||||
public class FacadeBlockAccess implements IBlockAccess {
|
public class FacadeBlockAccess implements IBlockAccess {
|
||||||
private final IBlockAccess world;
|
private final IBlockAccess world;
|
||||||
|
@ -29,8 +29,8 @@ public class FacadeBlockAccess implements IBlockAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
PipePluggable p = ((TileGenericPipe) tile).getPipePluggable(side);
|
PipePluggable p = ((IPipeTile) tile).getPipePluggable(side);
|
||||||
if (p instanceof IFacadePluggable) {
|
if (p instanceof IFacadePluggable) {
|
||||||
return ((IFacadePluggable) p).getCurrentBlock();
|
return ((IFacadePluggable) p).getCurrentBlock();
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ public class FacadeBlockAccess implements IBlockAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
PipePluggable p = ((TileGenericPipe) tile).getPipePluggable(side);
|
PipePluggable p = ((IPipeTile) tile).getPipePluggable(side);
|
||||||
if (p instanceof IFacadePluggable) {
|
if (p instanceof IFacadePluggable) {
|
||||||
//System.out.println("Found facade " + ((FacadePluggable) p).getRenderingMeta());
|
//System.out.println("Found facade " + ((FacadePluggable) p).getRenderingMeta());
|
||||||
return ((IFacadePluggable) p).getCurrentMetadata();
|
return ((IFacadePluggable) p).getCurrentMetadata();
|
||||||
|
@ -73,7 +73,7 @@ public class FacadeBlockAccess implements IBlockAccess {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAirBlock(int x, int y, int z) {
|
public boolean isAirBlock(int x, int y, int z) {
|
||||||
return !(world.getBlock(x, y, z) instanceof BlockGenericPipe);
|
return !(world.getTileEntity(x, y, z) instanceof IPipeTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue