refactors to robot docking station code, allow TEs to provide a singular docking station (wip)

This commit is contained in:
asiekierka 2015-04-03 13:16:22 +02:00
parent 27bee0a886
commit a9c7c1a2e8
61 changed files with 160 additions and 405 deletions

View file

@ -66,7 +66,6 @@ import buildcraft.core.BCCreativeTab;
import buildcraft.core.BlockBuildTool;
import buildcraft.core.BlockEngine;
import buildcraft.core.BlockSpring;
import buildcraft.core.config.BuildCraftConfiguration;
import buildcraft.core.CommandBuildCraft;
import buildcraft.core.CompatHooks;
import buildcraft.core.CoreGuiHandler;
@ -86,6 +85,7 @@ import buildcraft.core.TickHandlerCore;
import buildcraft.core.TileEngineWood;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.config.BuildCraftConfiguration;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.engines.ItemEngine;
import buildcraft.core.lib.engines.TileEngineBase;

View file

@ -51,8 +51,8 @@ import buildcraft.core.BlockSpring;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.lib.block.BlockBuildCraftFluid;
import buildcraft.core.config.ConfigManager;
import buildcraft.core.lib.block.BlockBuildCraftFluid;
import buildcraft.core.lib.engines.TileEngineBase;
import buildcraft.core.lib.engines.TileEngineBase.EnergyStage;
import buildcraft.core.lib.network.ChannelHandler;

View file

@ -225,29 +225,37 @@ public class BuildCraftRobotics extends BuildCraftMod {
RedstoneBoardRegistry.instance = new ImplRedstoneBoardRegistry();
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPickerNBT.instance, 20);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCarrierNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLumberjackNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotHarvesterNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotMinerNBT.instance, 10);
// Cheapest, dumbest robot types
// Those generally do very simple tasks
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotPickerNBT.instance, 8000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotCarrierNBT.instance, 8000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotFluidCarrierNBT.instance, 8000);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFluidCarrierNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotButcherNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotShovelmanNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCrafterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotDeliveryNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPumpNBT.instance, 5);
// More expensive robot types
// Those generally handle block mining/harvesting/placement.
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotLumberjackNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotHarvesterNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotMinerNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotPlanterNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotFarmerNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotLeaveCutterNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotButcherNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotShovelmanNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotPumpNBT.instance, 32000);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1);
// Even more expensive
// These handle complex multi-step operations.
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotCrafterNBT.instance, 128000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotDeliveryNBT.instance, 128000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotKnightNBT.instance, 128000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotBomberNBT.instance, 128000);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotStripesNBT.instance, 128000);
// Most expensive
// Overpowered galore!
if (Loader.isModLoaded("BuildCraft|Builders")) {
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBuilderNBT.instance, 0.5F);
RedstoneBoardRegistry.instance.registerBoardType(BoardRobotBuilderNBT.instance, 512000);
}
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotStripesNBT.instance, 0.5F);
StatementManager.registerActionProvider(new RobotsActionProvider());
StatementManager.registerTriggerProvider(new RobotsTriggerProvider());

View file

@ -42,7 +42,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;

View file

@ -9,7 +9,6 @@
package buildcraft.core.blueprints;
import java.util.BitSet;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;

View file

@ -35,7 +35,6 @@ import buildcraft.api.blueprints.Schematic;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.core.StackKey;

View file

@ -14,7 +14,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.SchematicBlockBase;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.builders.BuildingSlot;

View file

@ -1,7 +1,6 @@
package buildcraft.core.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@ -10,7 +9,6 @@ import cpw.mods.fml.client.IModGuiFactory;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

View file

@ -13,7 +13,6 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import buildcraft.BuildCraftCore;
import buildcraft.api.recipes.IAssemblyRecipeManager;
import buildcraft.api.recipes.IFlexibleRecipe;

View file

@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.BCLog;
import buildcraft.api.recipes.IFlexibleRecipe;
import buildcraft.api.recipes.IRefineryRecipeManager;

View file

@ -1,210 +0,0 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.robotics;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.RobotManager;
import buildcraft.api.transport.IPipeTile;
import buildcraft.transport.TileGenericPipe;
public class DockingStation implements IDockingStation {
public ForgeDirection side;
public World world;
private long robotTakingId = EntityRobotBase.NULL_ROBOT_ID;
private EntityRobotBase robotTaking;
private boolean linkIsMain = false;
private BlockIndex index;
private IPipeTile pipe;
public DockingStation(BlockIndex iIndex, ForgeDirection iSide) {
index = iIndex;
side = iSide;
}
public DockingStation(TileGenericPipe iPipe, ForgeDirection iSide) {
index = new BlockIndex(iPipe);
pipe = iPipe;
side = iSide;
world = iPipe.getWorld();
}
public DockingStation() {
}
public boolean isMainStation() {
return linkIsMain;
}
public IPipeTile getPipe() {
if (pipe == null) {
pipe = (IPipeTile) world.getTileEntity(index.x, index.y, index.z);
}
if (pipe == null || ((TileEntity) pipe).isInvalid()) {
// Inconsistency - remove this pipe from the registry.
RobotManager.registryProvider.getRegistry(world).removeStation(this);
pipe = null;
}
return pipe;
}
@Override
public int x() {
return index.x;
}
@Override
public int y() {
return index.y;
}
@Override
public int z() {
return index.z;
}
@Override
public ForgeDirection side() {
return side;
}
@Override
public EntityRobotBase robotTaking() {
if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) {
return null;
} else if (robotTaking == null) {
robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId);
}
return robotTaking;
}
public void invalidateRobotTakingEntity() {
robotTaking = null;
}
@Override
public long linkedId() {
return robotTakingId;
}
public boolean takeAsMain(EntityRobotBase robot) {
if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) {
linkIsMain = true;
robotTaking = robot;
robotTakingId = robot.getRobotId();
getPipe().scheduleRenderUpdate();
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
((EntityRobot) robot).setMainStation(this);
RobotManager.registryProvider.getRegistry(world).take(this, robot.getRobotId());
return true;
} else {
return robotTakingId == robot.getRobotId();
}
}
@Override
public boolean take(EntityRobotBase robot) {
if (robotTaking == null) {
linkIsMain = false;
robotTaking = robot;
robotTakingId = robot.getRobotId();
getPipe().scheduleRenderUpdate();
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
RobotManager.registryProvider.getRegistry(world).take(this, robot.getRobotId());
return true;
} else {
return robot.getRobotId() == robotTakingId;
}
}
public void release(EntityRobotBase robot) {
if (robotTaking == robot && !linkIsMain) {
unsafeRelease(robot);
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
RobotManager.registryProvider.getRegistry(world).release(this, robot.getRobotId());
}
}
/**
* Same a release but doesn't clear the registry (presumably called from the
* registry).
*/
public void unsafeRelease(EntityRobotBase robot) {
if (robotTaking == robot) {
linkIsMain = false;
robotTaking = null;
robotTakingId = EntityRobotBase.NULL_ROBOT_ID;
getPipe().scheduleRenderUpdate();
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
NBTTagCompound indexNBT = new NBTTagCompound();
index.writeTo(indexNBT);
nbt.setTag("index", indexNBT);
nbt.setByte("side", (byte) side.ordinal());
nbt.setBoolean("isMain", linkIsMain);
nbt.setLong("robotId", robotTakingId);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
index = new BlockIndex (nbt.getCompoundTag("index"));
side = ForgeDirection.values()[nbt.getByte("side")];
linkIsMain = nbt.getBoolean("isMain");
robotTakingId = nbt.getLong("robotId");
}
@Override
public boolean isTaken() {
return robotTakingId != EntityRobotBase.NULL_ROBOT_ID;
}
@Override
public long robotIdTaking() {
return robotTakingId;
}
@Override
public BlockIndex index() {
return index;
}
@Override
public String toString () {
return "{" + index.x + ", " + index.y + ", " + index.z + ", " + side + " :" + robotTakingId + "}";
}
public boolean linkIsDocked() {
if (isTaken()) {
return robotTaking().getDockingStation() == this;
} else {
return false;
}
}
public boolean canRelease() {
return !isMainStation() && !linkIsDocked();
}
}

View file

@ -47,8 +47,8 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.RobotManager;
import buildcraft.api.statements.StatementSlot;
import buildcraft.api.tiles.IDebuggable;
@ -73,7 +73,7 @@ public class EntityRobot extends EntityRobotBase implements
DefaultProps.TEXTURE_PATH_ROBOTS + "/robot_base.png");
public LaserData laser = new LaserData();
public IDockingStation linkedDockingStation;
public DockingStation linkedDockingStation;
public BlockIndex linkedDockingStationIndex;
public ForgeDirection linkedDockingStationSide;
@ -578,7 +578,7 @@ public class EntityRobot extends EntityRobotBase implements
}
@Override
public void dock(IDockingStation station) {
public void dock(DockingStation station) {
currentDockingStation = (DockingStation) station;
setSteamDirection(
@ -608,11 +608,12 @@ public class EntityRobot extends EntityRobotBase implements
return currentDockingStation;
}
public void setMainStation(IDockingStation iStation) {
DockingStation station = (DockingStation) iStation;
@Override
public void setMainStation(DockingStation iStation) {
DockingStation station = iStation;
if (linkedDockingStation != null && linkedDockingStation != station) {
((DockingStation) linkedDockingStation).unsafeRelease(this);
linkedDockingStation.unsafeRelease(this);
}
linkedDockingStation = station;
@ -855,7 +856,7 @@ public class EntityRobot extends EntityRobotBase implements
}
@Override
public IDockingStation getLinkedStation() {
public DockingStation getLinkedStation() {
return linkedDockingStation;
}

View file

@ -8,6 +8,8 @@
*/
package buildcraft.robotics;
import buildcraft.api.robots.DockingStation;
public interface IStationFilter {
boolean matches(DockingStation station);

View file

@ -27,6 +27,7 @@ import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.events.RobotPlacementEvent;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.BCCreativeTab;
import buildcraft.core.lib.items.ItemBuildCraft;

View file

@ -22,15 +22,15 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.world.ChunkEvent;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.IRobotRegistry;
import buildcraft.api.robots.ResourceId;
public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
protected World world;
protected HashMap<StationIndex, IDockingStation> stations = new HashMap<StationIndex, IDockingStation>();
protected HashMap<StationIndex, DockingStation> stations = new HashMap<StationIndex, DockingStation>();
private long nextRobotID = Long.MIN_VALUE;
@ -222,7 +222,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
}
@Override
public synchronized IDockingStation getStation(int x, int y, int z, ForgeDirection side) {
public synchronized DockingStation getStation(int x, int y, int z, ForgeDirection side) {
StationIndex index = new StationIndex(side, x, y, z);
if (stations.containsKey(index)) {
@ -233,12 +233,12 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
}
@Override
public synchronized Collection<IDockingStation> getStations() {
public synchronized Collection<DockingStation> getStations() {
return stations.values();
}
@Override
public synchronized void registerStation(IDockingStation station) {
public synchronized void registerStation(DockingStation station) {
markDirty();
StationIndex index = new StationIndex(station);
@ -251,7 +251,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
}
@Override
public synchronized void removeStation(IDockingStation station) {
public synchronized void removeStation(DockingStation station) {
markDirty();
StationIndex index = new StationIndex(station);
@ -268,7 +268,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
}
@Override
public synchronized void take(IDockingStation station, long robotId) {
public synchronized void take(DockingStation station, long robotId) {
if (!stationsTakenByRobot.containsKey(robotId)) {
stationsTakenByRobot.put(robotId, new HashSet<StationIndex>());
}
@ -277,7 +277,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
}
@Override
public synchronized void release(IDockingStation station, long robotId) {
public synchronized void release(DockingStation station, long robotId) {
if (stationsTakenByRobot.containsKey(robotId)) {
stationsTakenByRobot.get(robotId).remove(new StationIndex(station));
}
@ -303,7 +303,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
NBTTagList stationList = new NBTTagList();
for (Map.Entry<StationIndex, IDockingStation> e : stations.entrySet()) {
for (Map.Entry<StationIndex, DockingStation> e : stations.entrySet()) {
NBTTagCompound cpt = new NBTTagCompound();
e.getValue().writeToNBT(cpt);
stationList.appendTag(cpt);

View file

@ -3,7 +3,7 @@ package buildcraft.robotics;
import java.util.HashMap;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.IRobotRegistryProvider;
public class RobotRegistryProvider implements IRobotRegistryProvider {
@ -23,7 +23,7 @@ public class RobotRegistryProvider implements IRobotRegistryProvider {
newRegistry.world = world;
for (IDockingStation d : newRegistry.stations.values()) {
for (DockingStation d : newRegistry.stations.values()) {
((DockingStation) d).world = world;
}

View file

@ -12,7 +12,8 @@ import cofh.api.energy.IEnergyReceiver;
import buildcraft.BuildCraftRobotics;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.render.ITextureStates;
import buildcraft.api.robots.IDockingStationPluggable;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.IDockingStationProvider;
import buildcraft.api.robots.RobotManager;
import buildcraft.api.tiles.IDebuggable;
import buildcraft.api.transport.IPipe;
@ -25,7 +26,7 @@ import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.TileGenericPipe;
public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver, IDebuggable,
IDockingStationPluggable {
IDockingStationProvider {
public class RobotStationPluggableRenderer implements IPipePluggableRenderer {
private float zFightOffset = 1 / 4096.0F;

View file

@ -1,21 +1,35 @@
package buildcraft.robotics;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.IDockingStationProvider;
import buildcraft.api.transport.IPipeTile;
/**
* Created by asie on 1/24/15.
*/
public final class RobotUtils {
private RobotUtils() {
}
public static DockingStation getStation(IPipeTile tile, ForgeDirection d) {
if (tile.getPipePluggable(d) instanceof RobotStationPluggable) {
RobotStationPluggable pluggable = (RobotStationPluggable) tile.getPipePluggable(d);
return pluggable.getStation();
public static List<DockingStation> getStations(Object tile) {
ArrayList<DockingStation> stations = new ArrayList<DockingStation>();
if (tile instanceof IDockingStationProvider) {
stations.add(((IDockingStationProvider) tile).getStation());
}
return null;
if (tile instanceof IPipeTile) {
IPipeTile pipeTile = (IPipeTile) tile;
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (pipeTile.getPipePluggable(d) instanceof IDockingStationProvider) {
IDockingStationProvider pluggable = (IDockingStationProvider) pipeTile.getPipePluggable(d);
stations.add(pluggable.getStation());
}
}
}
return stations;
}
}

View file

@ -11,7 +11,7 @@ package buildcraft.robotics;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.DockingStation;
public class StationIndex {
@ -26,7 +26,7 @@ public class StationIndex {
index = new BlockIndex(x, y, z);
}
public StationIndex(IDockingStation station) {
public StationIndex(DockingStation station) {
side = station.side();
index = station.index();
}

View file

@ -17,6 +17,7 @@ import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.recipes.CraftingResult;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.ResourceIdBlock;
import buildcraft.api.robots.RobotManager;
@ -28,7 +29,6 @@ import buildcraft.core.lib.inventory.StackHelper;
import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.ArrayStackFilter;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationAllowCraft;

View file

@ -16,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.ResourceIdBlock;
import buildcraft.core.lib.inventory.ITransactor;
@ -24,7 +25,6 @@ import buildcraft.core.lib.inventory.StackHelper;
import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.ArrayStackFilter;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationAllowCraft;

View file

@ -24,6 +24,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.ITransactor;
import buildcraft.core.lib.inventory.InventoryCopy;
@ -32,7 +33,6 @@ import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.ArrayStackFilter;
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationAllowCraft;

View file

@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IRequestProvider;
import buildcraft.api.robots.StackRequest;
@ -19,7 +20,6 @@ import buildcraft.api.statements.StatementSlot;
import buildcraft.api.transport.IPipe;
import buildcraft.core.lib.inventory.InvUtils;
import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
import buildcraft.transport.gates.ActionIterator;

View file

@ -13,12 +13,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.ITransactor;
import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.AggregateFilter;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.statements.ActionRobotFilterTool;
public class AIRobotFetchAndEquipItemStack extends AIRobot {

View file

@ -9,8 +9,8 @@
package buildcraft.robotics.ai;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.robotics.DockingStation;
public class AIRobotGoAndLinkToDock extends AIRobot {
@ -33,9 +33,9 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
} else {
if (station.takeAsMain(robot)) {
startDelegateAI(new AIRobotGotoBlock(robot,
station.x() + station.side.offsetX * 2,
station.y() + station.side.offsetY * 2,
station.z() + station.side.offsetZ * 2));
station.x() + station.side().offsetX * 2,
station.y() + station.side().offsetY * 2,
station.z() + station.side().offsetZ * 2));
} else {
terminate();
}
@ -46,9 +46,9 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoBlock) {
startDelegateAI(new AIRobotStraightMoveTo(robot,
station.x() + 0.5F + station.side.offsetX * 0.5F,
station.y() + 0.5F + station.side.offsetY * 0.5F,
station.z() + 0.5F + station.side.offsetZ * 0.5F));
station.x() + 0.5F + station.side().offsetX * 0.5F,
station.y() + 0.5F + station.side().offsetY * 0.5F,
station.z() + 0.5F + station.side().offsetZ * 0.5F));
} else {
robot.dock(station);
station = null;

View file

@ -12,9 +12,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.robotics.DockingStation;
public class AIRobotGotoStation extends AIRobot {
@ -26,7 +25,7 @@ public class AIRobotGotoStation extends AIRobot {
super(iRobot);
}
public AIRobotGotoStation(EntityRobotBase iRobot, IDockingStation station) {
public AIRobotGotoStation(EntityRobotBase iRobot, DockingStation station) {
super(iRobot);
stationIndex = station.index();

View file

@ -10,8 +10,8 @@ package buildcraft.robotics.ai;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.robotics.DockingStation;
public class AIRobotGotoStationAndUnload extends AIRobot {

View file

@ -13,11 +13,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.ITransactor;
import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationProvideItems;

View file

@ -14,9 +14,9 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.filters.IFluidFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationProvideFluids;

View file

@ -12,11 +12,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.statements.StatementSlot;
import buildcraft.api.transport.IPipe;
import buildcraft.core.lib.inventory.InventoryIterator;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionStationInputItems;

View file

@ -12,9 +12,9 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.filters.SimpleFluidFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationAcceptFluids;

View file

@ -14,12 +14,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.ITransactor;
import buildcraft.core.lib.inventory.InventoryIterator;
import buildcraft.core.lib.inventory.Transactor;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationProvideItems;

View file

@ -14,9 +14,9 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.filters.IFluidFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationProvideFluids;

View file

@ -9,9 +9,9 @@
package buildcraft.robotics.ai;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.transport.IPipeTile;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
public class AIRobotRecharge extends AIRobot {

View file

@ -10,8 +10,8 @@ package buildcraft.robotics.ai;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
public class AIRobotSearchAndGotoStation extends AIRobot {

View file

@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IRequestProvider;
import buildcraft.api.robots.StackRequest;
@ -22,7 +23,6 @@ import buildcraft.api.statements.StatementSlot;
import buildcraft.api.transport.IPipe;
import buildcraft.core.lib.inventory.StackHelper;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationRequestItems;

View file

@ -10,9 +10,8 @@ package buildcraft.robotics.ai;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.IStationFilter;
import buildcraft.robotics.statements.ActionStationForbidRobot;
@ -45,7 +44,7 @@ public class AIRobotSearchStation extends AIRobot {
double potentialStationDistance = Float.MAX_VALUE;
DockingStation potentialStation = null;
for (IDockingStation d : robot.getRegistry().getStations()) {
for (DockingStation d : robot.getRegistry().getStations()) {
DockingStation station = (DockingStation) d;
if (d.isTaken() && d.robotIdTaking() != robot.getRobotId()) {

View file

@ -9,9 +9,9 @@
package buildcraft.robotics.ai;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.statements.StatementSlot;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.statements.ActionRobotWakeUp;
import buildcraft.transport.gates.ActionIterator;

View file

@ -11,11 +11,11 @@ package buildcraft.robotics.ai;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.statements.StatementSlot;
import buildcraft.api.transport.IPipe;
import buildcraft.core.lib.inventory.InventoryIterator;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.robotics.statements.ActionStationInputItems;
import buildcraft.transport.gates.ActionIterator;

View file

@ -12,9 +12,9 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.inventory.filters.SimpleFluidFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.statements.ActionRobotFilter;
import buildcraft.robotics.statements.ActionStationAcceptFluids;
import buildcraft.transport.Pipe;

View file

@ -24,8 +24,8 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.recipes.CraftingResult;
import buildcraft.api.recipes.IFlexibleRecipe;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.StackRequest;
import buildcraft.core.lib.inventory.StackHelper;
import buildcraft.core.recipes.AssemblyRecipeManager;
@ -45,7 +45,7 @@ public class BoardRobotCrafter extends RedstoneBoardRobot {
private ItemStack order;
private ArrayList<ItemStack> craftingBlacklist = new ArrayList<ItemStack>();
private HashSet<IDockingStation> reservedStations = new HashSet<IDockingStation>();
private HashSet<DockingStation> reservedStations = new HashSet<DockingStation>();
private StackRequest currentRequest = null;
public BoardRobotCrafter(EntityRobotBase iRobot) {

View file

@ -17,6 +17,7 @@ import net.minecraft.world.World;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.ResourceIdBlock;
import buildcraft.api.statements.IStatementParameter;
@ -24,7 +25,6 @@ import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.core.lib.utils.IBlockFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.ai.AIRobotBreak;
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
import buildcraft.robotics.ai.AIRobotGotoBlock;

View file

@ -23,13 +23,13 @@ import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IWorldProperty;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.robots.ResourceIdBlock;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.utils.IBlockFilter;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.ai.AIRobotGotoBlock;
import buildcraft.robotics.ai.AIRobotGotoSleep;
import buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids;

View file

@ -1,10 +1,10 @@
package buildcraft.robotics.map;
import gnu.trove.map.hash.TIntObjectHashMap;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.core.INBTStoreable;
import gnu.trove.map.hash.TIntObjectHashMap;
public class MapRegion implements INBTStoreable {
private final TIntObjectHashMap<MapChunk> chunks = new TIntObjectHashMap<MapChunk>();
private final int x, z;

View file

@ -1,5 +1,7 @@
package buildcraft.robotics.map;
import gnu.trove.map.hash.TLongObjectHashMap;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -16,8 +18,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import buildcraft.core.lib.utils.NBTUtils;
import gnu.trove.map.hash.TLongObjectHashMap;
public class MapWorld {
private final World world;
private final TLongObjectHashMap<MapRegion> regionMap;

View file

@ -14,7 +14,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
@ -30,7 +30,6 @@ import buildcraft.core.lib.inventory.filters.PassThroughStackFilter;
import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.transport.gates.ActionIterator;
public class ActionRobotFilter extends BCStatement implements IActionInternal {
@ -64,7 +63,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
return new StatementParameterItemStack();
}
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
public static Collection<ItemStack> getGateFilterStacks(DockingStation station) {
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().getPipe())) {
@ -85,7 +84,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
return result;
}
public static IStackFilter getGateFilter(IDockingStation station) {
public static IStackFilter getGateFilter(DockingStation station) {
Collection<ItemStack> stacks = getGateFilterStacks(station);
if (stacks.size() == 0) {
@ -95,7 +94,7 @@ public class ActionRobotFilter extends BCStatement implements IActionInternal {
}
}
public static IFluidFilter getGateFluidFilter(IDockingStation station) {
public static IFluidFilter getGateFluidFilter(DockingStation station) {
Collection<ItemStack> stacks = getGateFilterStacks(station);
if (stacks.size() == 0) {

View file

@ -12,7 +12,7 @@ import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import buildcraft.api.robots.IDockingStation;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
@ -23,7 +23,6 @@ import buildcraft.core.lib.inventory.filters.IStackFilter;
import buildcraft.core.lib.inventory.filters.PassThroughStackFilter;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.transport.gates.ActionIterator;
public class ActionRobotFilterTool extends BCStatement implements IActionInternal {
@ -57,7 +56,7 @@ public class ActionRobotFilterTool extends BCStatement implements IActionInterna
return new StatementParameterItemStack();
}
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
public static Collection<ItemStack> getGateFilterStacks(DockingStation station) {
ArrayList<ItemStack> result = new ArrayList<ItemStack>();
for (StatementSlot slot : new ActionIterator(((DockingStation) station).getPipe().getPipe())) {
@ -78,7 +77,7 @@ public class ActionRobotFilterTool extends BCStatement implements IActionInterna
return result;
}
public static IStackFilter getGateFilter(IDockingStation station) {
public static IStackFilter getGateFilter(DockingStation station) {
Collection<ItemStack> stacks = getGateFilterStacks(station);
if (stacks.size() == 0) {

View file

@ -8,12 +8,16 @@
*/
package buildcraft.robotics.statements;
import javax.print.Doc;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.items.IMapLocation;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.RobotManager;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatementContainer;
@ -22,7 +26,6 @@ import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.transport.IPipeTile;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.robotics.RobotRegistry;
import buildcraft.robotics.RobotUtils;
@ -53,10 +56,10 @@ public class ActionRobotGotoStation extends BCStatement implements IActionIntern
IPipeTile tile = (IPipeTile) container.getTile();
RobotRegistry registry = (RobotRegistry) RobotManager.registryProvider.getRegistry(tile.getWorld());
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
DockingStation station = RobotUtils.getStation(tile, d);
List<DockingStation> stations = RobotUtils.getStations(tile);
if (station != null && station.robotTaking() != null) {
for (DockingStation station : stations) {
if (station.robotTaking() != null) {
EntityRobot robot = (EntityRobot) station.robotTaking();
AIRobot ai = robot.getOverridingAI();

View file

@ -10,12 +10,12 @@ package buildcraft.robotics.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementManager;
import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeTransportItems;

View file

@ -10,6 +10,7 @@ package buildcraft.robotics.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatementContainer;
@ -18,7 +19,6 @@ import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.ItemRobot;
import buildcraft.transport.gates.ActionIterator;

View file

@ -9,13 +9,13 @@
package buildcraft.robotics.statements;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
public abstract class ActionStationInputItems extends BCStatement implements IActionInternal {

View file

@ -10,11 +10,11 @@ package buildcraft.robotics.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementParameterItemStack;
import buildcraft.api.statements.StatementSlot;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeTransportItems;

View file

@ -1,52 +0,0 @@
package buildcraft.robotics.statements;
import java.util.Iterator;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.transport.IPipeTile;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.RobotUtils;
public class DockingStationIterator implements Iterator<DockingStation> {
private final IPipeTile tile;
private DockingStation next;
private int side = -1;
public DockingStationIterator(IStatementContainer container) {
tile = container.getTile() instanceof IPipeTile ? (IPipeTile) container.getTile() : null;
findNext();
}
private void findNext() {
while (side < 6) {
side++;
DockingStation station = RobotUtils.getStation(tile, ForgeDirection.getOrientation(side));
if (station != null) {
next = station;
return;
}
}
next = null;
}
@Override
public boolean hasNext() {
return tile != null && next != null;
}
@Override
public DockingStation next() {
if (hasNext()) {
DockingStation output = next;
findNext();
return output;
} else {
return null;
}
}
@Override
public void remove() {
}
}

View file

@ -11,6 +11,7 @@ package buildcraft.robotics.statements;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWorkbench;
import net.minecraft.inventory.IInventory;
@ -19,13 +20,13 @@ import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.BuildCraftRobotics;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.IRequestProvider;
import buildcraft.api.statements.IActionExternal;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IActionProvider;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.transport.IPipeTile;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.RobotUtils;
import buildcraft.silicon.TileAssemblyTable;
import buildcraft.transport.PipeTransportFluids;
@ -43,13 +44,7 @@ public class RobotsActionProvider implements IActionProvider {
return result;
}
ArrayList<DockingStation> stations = new ArrayList<DockingStation>();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (RobotUtils.getStation((IPipeTile) tile, dir) != null) {
stations.add(RobotUtils.getStation((IPipeTile) tile, dir));
}
}
List<DockingStation> stations = RobotUtils.getStations(tile);
if (stations.size() == 0) {
return result;

View file

@ -10,21 +10,24 @@ package buildcraft.robotics.statements;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftRobotics;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.ITriggerExternal;
import buildcraft.api.statements.ITriggerInternal;
import buildcraft.api.statements.ITriggerProvider;
import buildcraft.robotics.RobotUtils;
public class RobotsTriggerProvider implements ITriggerProvider {
@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
LinkedList<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
DockingStationIterator iterator = new DockingStationIterator(container);
List<DockingStation> stations = RobotUtils.getStations(container.getTile());
if (iterator.hasNext()) {
if (stations.size() > 0) {
result.add(BuildCraftRobotics.triggerRobotSleep);
result.add(BuildCraftRobotics.triggerRobotInStation);
result.add(BuildCraftRobotics.triggerRobotLinked);

View file

@ -8,14 +8,16 @@
*/
package buildcraft.robotics.statements;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.ITriggerInternal;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.robotics.RobotUtils;
public class TriggerRobotInStation extends BCStatement implements ITriggerInternal {
@ -35,10 +37,9 @@ public class TriggerRobotInStation extends BCStatement implements ITriggerIntern
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
DockingStationIterator iterator = new DockingStationIterator(container);
List<DockingStation> stations = RobotUtils.getStations(container.getTile());
while (iterator.hasNext()) {
DockingStation station = iterator.next();
for (DockingStation station : stations) {
if (station.robotTaking() != null) {
EntityRobot robot = (EntityRobot) station.robotTaking();

View file

@ -8,13 +8,15 @@
*/
package buildcraft.robotics.statements;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.ITriggerInternal;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.RobotUtils;
public class TriggerRobotLinked extends BCStatement implements ITriggerInternal {
private final boolean reserved;
@ -36,10 +38,9 @@ public class TriggerRobotLinked extends BCStatement implements ITriggerInternal
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
DockingStationIterator iterator = new DockingStationIterator(container);
List<DockingStation> stations = RobotUtils.getStations(container.getTile());
while (iterator.hasNext()) {
DockingStation station = iterator.next();
for (DockingStation station: stations) {
if (station.isTaken() && (reserved || station.isMainStation())) {
return true;
}

View file

@ -8,14 +8,16 @@
*/
package buildcraft.robotics.statements;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import buildcraft.api.robots.DockingStation;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.ITriggerInternal;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.core.statements.BCStatement;
import buildcraft.robotics.DockingStation;
import buildcraft.robotics.EntityRobot;
import buildcraft.robotics.RobotUtils;
public class TriggerRobotSleep extends BCStatement implements ITriggerInternal {
@ -35,10 +37,9 @@ public class TriggerRobotSleep extends BCStatement implements ITriggerInternal {
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
DockingStationIterator iterator = new DockingStationIterator(container);
List<DockingStation> stations = RobotUtils.getStations(container.getTile());
while (iterator.hasNext()) {
DockingStation station = iterator.next();
for (DockingStation station : stations) {
if (station.robotTaking() != null) {
EntityRobot robot = (EntityRobot) station.robotTaking();

View file

@ -8,19 +8,15 @@
*/
package buildcraft.transport.render;
import buildcraft.transport.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.render.ITextureStates;
@ -29,6 +25,11 @@ import buildcraft.api.transport.pluggable.PipePluggable;
import buildcraft.core.CoreConstants;
import buildcraft.core.lib.render.FakeBlock;
import buildcraft.core.lib.utils.ColorUtils;
import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeRenderState;
import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.TransportProxy;
public class PipeRendererWorld implements ISimpleBlockRenderingHandler {

View file

@ -10,7 +10,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.transport.IStripesActivator;
import buildcraft.api.transport.IStripesHandler;
import buildcraft.core.lib.utils.BlockUtils;

View file

@ -10,7 +10,6 @@ package buildcraft.transport.stripes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
@ -23,7 +22,6 @@ import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.ItemPipe;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TileGenericPipe;
public class StripesHandlerPipes implements IStripesHandler {