Merge pull request #2440 from hea3ven/robot-new-pathfind
Robot new pathfind
This commit is contained in:
commit
1b1a075f49
52 changed files with 481 additions and 319 deletions
|
@ -8,10 +8,6 @@
|
|||
*/
|
||||
package buildcraft.api.filler;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.statements.IStatement;
|
||||
|
||||
public interface IFillerPattern extends IStatement {
|
||||
|
|
|
@ -148,7 +148,7 @@ public class AIRobot {
|
|||
}
|
||||
|
||||
public final void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setString("aiName", AIRobotManager.getAIRobotName(getClass()));
|
||||
nbt.setString("aiName", RobotManager.getAIRobotName(getClass()));
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
writeSelfToNBT(data);
|
||||
|
@ -172,9 +172,9 @@ public class AIRobot {
|
|||
Class<?> aiRobotClass = null;
|
||||
if (sub.hasKey("class")) {
|
||||
// Migration support for 6.4.x
|
||||
aiRobotClass = AIRobotManager.getAIRobotByLegacyClassName(sub.getString("class"));
|
||||
aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class"));
|
||||
} else {
|
||||
aiRobotClass = AIRobotManager.getAIRobotByName(sub.getString("aiName"));
|
||||
aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName"));
|
||||
}
|
||||
delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
|
||||
.newInstance(robot);
|
||||
|
@ -196,9 +196,9 @@ public class AIRobot {
|
|||
Class<?> aiRobotClass = null;
|
||||
if (nbt.hasKey("class")) {
|
||||
// Migration support for 6.4.x
|
||||
aiRobotClass = AIRobotManager.getAIRobotByLegacyClassName(nbt.getString("class"));
|
||||
aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class"));
|
||||
} else {
|
||||
aiRobotClass = AIRobotManager.getAIRobotByName(nbt.getString("aiName"));
|
||||
aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName"));
|
||||
}
|
||||
ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
|
||||
.newInstance(robot);
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.api.robots;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AIRobotManager {
|
||||
|
||||
public static ArrayList<Class<? extends AIRobot>> aiRobots = new ArrayList<Class<? extends AIRobot>>();
|
||||
private static Map<Class<? extends AIRobot>, String> aiRobotsNames =
|
||||
new HashMap<Class<? extends AIRobot>, String>();
|
||||
private static Map<String, Class<? extends AIRobot>> aiRobotsByNames =
|
||||
new HashMap<String, Class<? extends AIRobot>>();
|
||||
private static Map<String, Class<? extends AIRobot>> aiRobotsByLegacyClassNames =
|
||||
new HashMap<String, Class<? extends AIRobot>>();
|
||||
|
||||
public static void registerAIRobot(Class<? extends AIRobot> aiRobot, String name) {
|
||||
registerAIRobot(aiRobot, name, null);
|
||||
}
|
||||
|
||||
public static void registerAIRobot(Class<? extends AIRobot> pluggable, String name, String legacyClassName) {
|
||||
aiRobots.add(pluggable);
|
||||
aiRobotsByNames.put(name, pluggable);
|
||||
aiRobotsNames.put(pluggable, name);
|
||||
if(legacyClassName != null) {
|
||||
aiRobotsByLegacyClassNames.put(legacyClassName, pluggable);
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<?> getAIRobotByName(String pluggableName) {
|
||||
return aiRobotsByNames.get(pluggableName);
|
||||
}
|
||||
|
||||
public static String getAIRobotName(Class<? extends AIRobot> aClass) {
|
||||
return aiRobotsNames.get(aClass);
|
||||
}
|
||||
|
||||
public static Class<?> getAIRobotByLegacyClassName(String string) {
|
||||
return aiRobotsByLegacyClassNames.get(string);
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public abstract class ResourceId {
|
|||
nbt.setTag("index", indexNBT);
|
||||
nbt.setByte("side", (byte) side.ordinal());
|
||||
nbt.setInteger("localId", localId);
|
||||
nbt.setString("class", getClass().getCanonicalName());
|
||||
nbt.setString("resourceName", RobotManager.getResourceIdName(getClass()));
|
||||
}
|
||||
|
||||
protected void readFromNBT(NBTTagCompound nbt) {
|
||||
|
@ -58,9 +58,15 @@ public abstract class ResourceId {
|
|||
|
||||
public static ResourceId load(NBTTagCompound nbt) {
|
||||
try {
|
||||
Class clas = Class.forName(nbt.getString("class"));
|
||||
Class cls = null;
|
||||
if (nbt.hasKey("class")) {
|
||||
// Migration support for 6.4.x
|
||||
cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class"));
|
||||
} else {
|
||||
cls = RobotManager.getResourceIdByName("resourceName");
|
||||
}
|
||||
|
||||
ResourceId id = (ResourceId) clas.newInstance();
|
||||
ResourceId id = (ResourceId) cls.newInstance();
|
||||
id.readFromNBT(nbt);
|
||||
|
||||
return id;
|
||||
|
|
80
api/buildcraft/api/robots/RobotManager.java
Normal file
80
api/buildcraft/api/robots/RobotManager.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.api.robots;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class RobotManager {
|
||||
|
||||
public static ArrayList<Class<? extends AIRobot>> aiRobots = new ArrayList<Class<? extends AIRobot>>();
|
||||
private static Map<Class<? extends AIRobot>, String> aiRobotsNames =
|
||||
new HashMap<Class<? extends AIRobot>, String>();
|
||||
private static Map<String, Class<? extends AIRobot>> aiRobotsByNames =
|
||||
new HashMap<String, Class<? extends AIRobot>>();
|
||||
private static Map<String, Class<? extends AIRobot>> aiRobotsByLegacyClassNames =
|
||||
new HashMap<String, Class<? extends AIRobot>>();
|
||||
|
||||
private static Map<Class<? extends ResourceId>, String> resourceIdNames =
|
||||
new HashMap<Class<? extends ResourceId>, String>();
|
||||
private static Map<String, Class<? extends ResourceId>> resourceIdByNames =
|
||||
new HashMap<String, Class<? extends ResourceId>>();
|
||||
private static Map<String, Class<? extends ResourceId>> resourceIdLegacyClassNames =
|
||||
new HashMap<String, Class<? extends ResourceId>>();
|
||||
|
||||
public static void registerAIRobot(Class<? extends AIRobot> aiRobot, String name) {
|
||||
registerAIRobot(aiRobot, name, null);
|
||||
}
|
||||
|
||||
public static void registerAIRobot(Class<? extends AIRobot> aiRobot, String name, String legacyClassName) {
|
||||
aiRobots.add(aiRobot);
|
||||
aiRobotsByNames.put(name, aiRobot);
|
||||
aiRobotsNames.put(aiRobot, name);
|
||||
if (legacyClassName != null) {
|
||||
aiRobotsByLegacyClassNames.put(legacyClassName, aiRobot);
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<?> getAIRobotByName(String aiRobotName) {
|
||||
return aiRobotsByNames.get(aiRobotName);
|
||||
}
|
||||
|
||||
public static String getAIRobotName(Class<? extends AIRobot> aiRobotClass) {
|
||||
return aiRobotsNames.get(aiRobotClass);
|
||||
}
|
||||
|
||||
public static Class<?> getAIRobotByLegacyClassName(String aiRobotLegacyClassName) {
|
||||
return aiRobotsByLegacyClassNames.get(aiRobotLegacyClassName);
|
||||
}
|
||||
|
||||
public static void registerResourceId(Class<? extends ResourceId> resourceId, String name) {
|
||||
registerResourceId(resourceId, name, null);
|
||||
}
|
||||
|
||||
public static void registerResourceId(Class<? extends ResourceId> resourceId, String name, String legacyClassName) {
|
||||
resourceIdByNames.put(name, resourceId);
|
||||
resourceIdNames.put(resourceId, name);
|
||||
if (legacyClassName != null) {
|
||||
resourceIdLegacyClassNames.put(legacyClassName, resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<?> getResourceIdByName(String resourceIdName) {
|
||||
return resourceIdByNames.get(resourceIdName);
|
||||
}
|
||||
|
||||
public static String getResourceIdName(Class<? extends ResourceId> resouceIdClass) {
|
||||
return resourceIdNames.get(resouceIdClass);
|
||||
}
|
||||
|
||||
public static Class<?> getResourceIdByLegacyClassName(String resourceIdLegacyClassName) {
|
||||
return resourceIdLegacyClassNames.get(resourceIdLegacyClassName);
|
||||
}
|
||||
}
|
|
@ -3,8 +3,11 @@ package buildcraft.api.transport.pluggable;
|
|||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IFacadePluggable {
|
||||
public Block getCurrentBlock();
|
||||
public int getCurrentMetadata();
|
||||
public boolean isTransparent();
|
||||
public boolean isHollow();
|
||||
Block getCurrentBlock();
|
||||
|
||||
int getCurrentMetadata();
|
||||
|
||||
boolean isTransparent();
|
||||
|
||||
boolean isHollow();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ import buildcraft.api.core.IWorldProperty;
|
|||
import buildcraft.api.core.JavaTools;
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import buildcraft.api.robots.AIRobotManager;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.statements.IActionExternal;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IStatement;
|
||||
|
@ -125,6 +125,9 @@ import buildcraft.core.utils.WorldPropertyIsWood;
|
|||
import buildcraft.energy.fuels.CoolantManager;
|
||||
import buildcraft.energy.fuels.FuelManager;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.ResourceIdAssemblyTable;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.ResourceIdRequest;
|
||||
import buildcraft.robots.ai.AIRobotAttack;
|
||||
import buildcraft.robots.ai.AIRobotBreak;
|
||||
import buildcraft.robots.ai.AIRobotCraftAssemblyTable;
|
||||
|
@ -411,61 +414,64 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
StatementManager.registerTriggerProvider(new DefaultTriggerProvider());
|
||||
StatementManager.registerActionProvider(new DefaultActionProvider());
|
||||
|
||||
AIRobotManager.registerAIRobot(AIRobotMain.class, "aiRobotMain","buildcraft.core.robots.AIRobotMain");
|
||||
AIRobotManager.registerAIRobot(BoardRobotBomber.class, "boardRobotBomber", "buildcraft.core.robots.boards.BoardRobotBomber");
|
||||
AIRobotManager.registerAIRobot(BoardRobotBuilder.class, "boardRobotBuilder", "buildcraft.core.robots.boards.BoardRobotBuilder");
|
||||
AIRobotManager.registerAIRobot(BoardRobotButcher.class, "boardRobotButcher", "buildcraft.core.robots.boards.BoardRobotButcher");
|
||||
AIRobotManager.registerAIRobot(BoardRobotCarrier.class, "boardRobotCarrier", "buildcraft.core.robots.boards.BoardRobotCarrier");
|
||||
AIRobotManager.registerAIRobot(BoardRobotCrafter.class, "boardRobotCrafter", "buildcraft.core.robots.boards.BoardRobotCrafter");
|
||||
AIRobotManager.registerAIRobot(BoardRobotDelivery.class, "boardRobotDelivery", "buildcraft.core.robots.boards.BoardRobotDelivery");
|
||||
AIRobotManager.registerAIRobot(BoardRobotFarmer.class, "boardRobotFarmer", "buildcraft.core.robots.boards.BoardRobotFarmer");
|
||||
AIRobotManager.registerAIRobot(BoardRobotFluidCarrier.class, "boardRobotFluidCarrier", "buildcraft.core.robots.boards.BoardRobotFluidCarrier");
|
||||
AIRobotManager.registerAIRobot(BoardRobotHarvester.class, "boardRobotHarvester", "buildcraft.core.robots.boards.BoardRobotHarvester");
|
||||
AIRobotManager.registerAIRobot(BoardRobotKnight.class, "boardRobotKnight", "buildcraft.core.robots.boards.BoardRobotKnight");
|
||||
AIRobotManager.registerAIRobot(BoardRobotLeaveCutter.class, "boardRobotLeaveCutter", "buildcraft.core.robots.boards.BoardRobotLeaveCutter");
|
||||
AIRobotManager.registerAIRobot(BoardRobotLumberjack.class, "boardRobotLumberjack", "buildcraft.core.robots.boards.BoardRobotLumberjack");
|
||||
AIRobotManager.registerAIRobot(BoardRobotMiner.class, "boardRobotMiner", "buildcraft.core.robots.boards.BoardRobotMiner");
|
||||
AIRobotManager.registerAIRobot(BoardRobotPicker.class, "boardRobotPicker", "buildcraft.core.robots.boards.BoardRobotPicker");
|
||||
AIRobotManager.registerAIRobot(BoardRobotPlanter.class, "boardRobotPlanter", "buildcraft.core.robots.boards.BoardRobotPlanter");
|
||||
AIRobotManager.registerAIRobot(BoardRobotPump.class, "boardRobotPump", "buildcraft.core.robots.boards.BoardRobotPump");
|
||||
AIRobotManager.registerAIRobot(BoardRobotShovelman.class, "boardRobotShovelman", "buildcraft.core.robots.boards.BoardRobotShovelman");
|
||||
AIRobotManager.registerAIRobot(AIRobotAttack.class, "aiRobotAttack", "buildcraft.core.robots.AIRobotAttack");
|
||||
AIRobotManager.registerAIRobot(AIRobotBreak.class, "aiRobotBreak", "buildcraft.core.robots.AIRobotBreak");
|
||||
AIRobotManager.registerAIRobot(AIRobotCraftAssemblyTable.class, "aiRobotCraftAssemblyTable", "buildcraft.core.robots.AIRobotCraftAssemblyTable");
|
||||
AIRobotManager.registerAIRobot(AIRobotCraftFurnace.class, "aiRobotCraftFurnace", "buildcraft.core.robots.AIRobotCraftFurnace");
|
||||
AIRobotManager.registerAIRobot(AIRobotCraftWorkbench.class, "aiRobotCraftWorkbench", "buildcraft.core.robots.AIRobotCraftWorkbench");
|
||||
AIRobotManager.registerAIRobot(AIRobotDeliverRequested.class, "aiRobotDeliverRequested", "buildcraft.core.robots.AIRobotDeliverRequested");
|
||||
AIRobotManager.registerAIRobot(AIRobotDisposeItems.class, "aiRobotDisposeItems", "buildcraft.core.robots.AIRobotDisposeItems");
|
||||
AIRobotManager.registerAIRobot(AIRobotFetchAndEquipItemStack.class, "aiRobotFetchAndEquipItemStack", "buildcraft.core.robots.AIRobotFetchAndEquipItemStack");
|
||||
AIRobotManager.registerAIRobot(AIRobotFetchItem.class, "aiRobotFetchItem", "buildcraft.core.robots.AIRobotFetchItem");
|
||||
AIRobotManager.registerAIRobot(AIRobotGoAndLinkToDock.class, "aiRobotGoAndLinkToDock", "buildcraft.core.robots.AIRobotGoAndLinkToDock");
|
||||
AIRobotManager.registerAIRobot(AIRobotGoto.class, "aiRobotGoto", "buildcraft.core.robots.AIRobotGoto");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoBlock.class, "aiRobotGotoBlock", "buildcraft.core.robots.AIRobotGotoBlock");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoRandomGroundBlock.class, "aiRobotGotoRandomGroundBlock", "buildcraft.core.robots.AIRobotGotoRandomGroundBlock");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoSleep.class, "aiRobotGotoSleep", "buildcraft.core.robots.AIRobotGotoSleep");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStation.class, "aiRobotGotoStation", "buildcraft.core.robots.AIRobotGotoStation");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationAndLoad.class, "aiRobotGotoStationAndLoad", "buildcraft.core.robots.AIRobotGotoStationAndLoad");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationAndLoadFluids.class, "aiRobotGotoStationAndLoadFluids", "buildcraft.core.robots.AIRobotGotoStationAndLoadFluids");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationAndUnload.class, "aiRobotGotoStationAndUnload", "buildcraft.core.robots.AIRobotGotoStationAndUnload");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationToLoad.class, "aiRobotGotoStationToLoad", "buildcraft.core.robots.AIRobotGotoStationToLoad");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationToLoadFluids.class, "aiRobotGotoStationToLoadFluids", "buildcraft.core.robots.AIRobotGotoStationToLoadFluids");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationToUnload.class, "aiRobotGotoStationToUnload", "buildcraft.core.robots.AIRobotGotoStationToUnload");
|
||||
AIRobotManager.registerAIRobot(AIRobotGotoStationToUnloadFluids.class, "aiRobotGotoStationToUnloadFluids", "buildcraft.core.robots.AIRobotGotoStationToUnloadFluids");
|
||||
AIRobotManager.registerAIRobot(AIRobotLoad.class, "aiRobotLoad", "buildcraft.core.robots.AIRobotLoad");
|
||||
AIRobotManager.registerAIRobot(AIRobotLoadFluids.class, "aiRobotLoadFluids", "buildcraft.core.robots.AIRobotLoadFluids");
|
||||
AIRobotManager.registerAIRobot(AIRobotPumpBlock.class, "aiRobotPumpBlock", "buildcraft.core.robots.AIRobotPumpBlock");
|
||||
AIRobotManager.registerAIRobot(AIRobotRecharge.class, "aiRobotRecharge", "buildcraft.core.robots.AIRobotRecharge");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchAndGotoStation.class, "aiRobotSearchAndGotoStation", "buildcraft.core.robots.AIRobotSearchAndGotoStation");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchBlock.class, "aiRobotSearchBlock", "buildcraft.core.robots.AIRobotSearchBlock");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchEntity.class, "aiRobotSearchEntity", "buildcraft.core.robots.AIRobotSearchEntity");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchRandomGroundBlock.class, "aiRobotSearchRandomGroundBlock", "buildcraft.core.robots.AIRobotSearchRandomGroundBlock");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchStackRequest.class, "aiRobotSearchStackRequest", "buildcraft.core.robots.AIRobotSearchStackRequest");
|
||||
AIRobotManager.registerAIRobot(AIRobotSearchStation.class, "aiRobotSearchStation", "buildcraft.core.robots.AIRobotSearchStation");
|
||||
AIRobotManager.registerAIRobot(AIRobotSleep.class, "aiRobotSleep", "buildcraft.core.robots.AIRobotSleep");
|
||||
AIRobotManager.registerAIRobot(AIRobotStraightMoveTo.class, "aiRobotStraightMoveTo", "buildcraft.core.robots.AIRobotStraightMoveTo");
|
||||
AIRobotManager.registerAIRobot(AIRobotUnload.class, "aiRobotUnload", "buildcraft.core.robots.AIRobotUnload");
|
||||
AIRobotManager.registerAIRobot(AIRobotUnloadFluids.class, "aiRobotUnloadFluids", "buildcraft.core.robots.AIRobotUnloadFluids");
|
||||
AIRobotManager.registerAIRobot(AIRobotUseToolOnBlock.class, "aiRobotUseToolOnBlock", "buildcraft.core.robots.AIRobotUseToolOnBlock");
|
||||
RobotManager.registerAIRobot(AIRobotMain.class, "aiRobotMain", "buildcraft.core.robots.AIRobotMain");
|
||||
RobotManager.registerAIRobot(BoardRobotBomber.class, "boardRobotBomber", "buildcraft.core.robots.boards.BoardRobotBomber");
|
||||
RobotManager.registerAIRobot(BoardRobotBuilder.class, "boardRobotBuilder", "buildcraft.core.robots.boards.BoardRobotBuilder");
|
||||
RobotManager.registerAIRobot(BoardRobotButcher.class, "boardRobotButcher", "buildcraft.core.robots.boards.BoardRobotButcher");
|
||||
RobotManager.registerAIRobot(BoardRobotCarrier.class, "boardRobotCarrier", "buildcraft.core.robots.boards.BoardRobotCarrier");
|
||||
RobotManager.registerAIRobot(BoardRobotCrafter.class, "boardRobotCrafter", "buildcraft.core.robots.boards.BoardRobotCrafter");
|
||||
RobotManager.registerAIRobot(BoardRobotDelivery.class, "boardRobotDelivery", "buildcraft.core.robots.boards.BoardRobotDelivery");
|
||||
RobotManager.registerAIRobot(BoardRobotFarmer.class, "boardRobotFarmer", "buildcraft.core.robots.boards.BoardRobotFarmer");
|
||||
RobotManager.registerAIRobot(BoardRobotFluidCarrier.class, "boardRobotFluidCarrier", "buildcraft.core.robots.boards.BoardRobotFluidCarrier");
|
||||
RobotManager.registerAIRobot(BoardRobotHarvester.class, "boardRobotHarvester", "buildcraft.core.robots.boards.BoardRobotHarvester");
|
||||
RobotManager.registerAIRobot(BoardRobotKnight.class, "boardRobotKnight", "buildcraft.core.robots.boards.BoardRobotKnight");
|
||||
RobotManager.registerAIRobot(BoardRobotLeaveCutter.class, "boardRobotLeaveCutter", "buildcraft.core.robots.boards.BoardRobotLeaveCutter");
|
||||
RobotManager.registerAIRobot(BoardRobotLumberjack.class, "boardRobotLumberjack", "buildcraft.core.robots.boards.BoardRobotLumberjack");
|
||||
RobotManager.registerAIRobot(BoardRobotMiner.class, "boardRobotMiner", "buildcraft.core.robots.boards.BoardRobotMiner");
|
||||
RobotManager.registerAIRobot(BoardRobotPicker.class, "boardRobotPicker", "buildcraft.core.robots.boards.BoardRobotPicker");
|
||||
RobotManager.registerAIRobot(BoardRobotPlanter.class, "boardRobotPlanter", "buildcraft.core.robots.boards.BoardRobotPlanter");
|
||||
RobotManager.registerAIRobot(BoardRobotPump.class, "boardRobotPump", "buildcraft.core.robots.boards.BoardRobotPump");
|
||||
RobotManager.registerAIRobot(BoardRobotShovelman.class, "boardRobotShovelman", "buildcraft.core.robots.boards.BoardRobotShovelman");
|
||||
RobotManager.registerAIRobot(AIRobotAttack.class, "aiRobotAttack", "buildcraft.core.robots.AIRobotAttack");
|
||||
RobotManager.registerAIRobot(AIRobotBreak.class, "aiRobotBreak", "buildcraft.core.robots.AIRobotBreak");
|
||||
RobotManager.registerAIRobot(AIRobotCraftAssemblyTable.class, "aiRobotCraftAssemblyTable", "buildcraft.core.robots.AIRobotCraftAssemblyTable");
|
||||
RobotManager.registerAIRobot(AIRobotCraftFurnace.class, "aiRobotCraftFurnace", "buildcraft.core.robots.AIRobotCraftFurnace");
|
||||
RobotManager.registerAIRobot(AIRobotCraftWorkbench.class, "aiRobotCraftWorkbench", "buildcraft.core.robots.AIRobotCraftWorkbench");
|
||||
RobotManager.registerAIRobot(AIRobotDeliverRequested.class, "aiRobotDeliverRequested", "buildcraft.core.robots.AIRobotDeliverRequested");
|
||||
RobotManager.registerAIRobot(AIRobotDisposeItems.class, "aiRobotDisposeItems", "buildcraft.core.robots.AIRobotDisposeItems");
|
||||
RobotManager.registerAIRobot(AIRobotFetchAndEquipItemStack.class, "aiRobotFetchAndEquipItemStack", "buildcraft.core.robots.AIRobotFetchAndEquipItemStack");
|
||||
RobotManager.registerAIRobot(AIRobotFetchItem.class, "aiRobotFetchItem", "buildcraft.core.robots.AIRobotFetchItem");
|
||||
RobotManager.registerAIRobot(AIRobotGoAndLinkToDock.class, "aiRobotGoAndLinkToDock", "buildcraft.core.robots.AIRobotGoAndLinkToDock");
|
||||
RobotManager.registerAIRobot(AIRobotGoto.class, "aiRobotGoto", "buildcraft.core.robots.AIRobotGoto");
|
||||
RobotManager.registerAIRobot(AIRobotGotoBlock.class, "aiRobotGotoBlock", "buildcraft.core.robots.AIRobotGotoBlock");
|
||||
RobotManager.registerAIRobot(AIRobotGotoRandomGroundBlock.class, "aiRobotGotoRandomGroundBlock", "buildcraft.core.robots.AIRobotGotoRandomGroundBlock");
|
||||
RobotManager.registerAIRobot(AIRobotGotoSleep.class, "aiRobotGotoSleep", "buildcraft.core.robots.AIRobotGotoSleep");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStation.class, "aiRobotGotoStation", "buildcraft.core.robots.AIRobotGotoStation");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndLoad.class, "aiRobotGotoStationAndLoad", "buildcraft.core.robots.AIRobotGotoStationAndLoad");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndLoadFluids.class, "aiRobotGotoStationAndLoadFluids", "buildcraft.core.robots.AIRobotGotoStationAndLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndUnload.class, "aiRobotGotoStationAndUnload", "buildcraft.core.robots.AIRobotGotoStationAndUnload");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToLoad.class, "aiRobotGotoStationToLoad", "buildcraft.core.robots.AIRobotGotoStationToLoad");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToLoadFluids.class, "aiRobotGotoStationToLoadFluids", "buildcraft.core.robots.AIRobotGotoStationToLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToUnload.class, "aiRobotGotoStationToUnload", "buildcraft.core.robots.AIRobotGotoStationToUnload");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToUnloadFluids.class, "aiRobotGotoStationToUnloadFluids", "buildcraft.core.robots.AIRobotGotoStationToUnloadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotLoad.class, "aiRobotLoad", "buildcraft.core.robots.AIRobotLoad");
|
||||
RobotManager.registerAIRobot(AIRobotLoadFluids.class, "aiRobotLoadFluids", "buildcraft.core.robots.AIRobotLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotPumpBlock.class, "aiRobotPumpBlock", "buildcraft.core.robots.AIRobotPumpBlock");
|
||||
RobotManager.registerAIRobot(AIRobotRecharge.class, "aiRobotRecharge", "buildcraft.core.robots.AIRobotRecharge");
|
||||
RobotManager.registerAIRobot(AIRobotSearchAndGotoStation.class, "aiRobotSearchAndGotoStation", "buildcraft.core.robots.AIRobotSearchAndGotoStation");
|
||||
RobotManager.registerAIRobot(AIRobotSearchBlock.class, "aiRobotSearchBlock", "buildcraft.core.robots.AIRobotSearchBlock");
|
||||
RobotManager.registerAIRobot(AIRobotSearchEntity.class, "aiRobotSearchEntity", "buildcraft.core.robots.AIRobotSearchEntity");
|
||||
RobotManager.registerAIRobot(AIRobotSearchRandomGroundBlock.class, "aiRobotSearchRandomGroundBlock", "buildcraft.core.robots.AIRobotSearchRandomGroundBlock");
|
||||
RobotManager.registerAIRobot(AIRobotSearchStackRequest.class, "aiRobotSearchStackRequest", "buildcraft.core.robots.AIRobotSearchStackRequest");
|
||||
RobotManager.registerAIRobot(AIRobotSearchStation.class, "aiRobotSearchStation", "buildcraft.core.robots.AIRobotSearchStation");
|
||||
RobotManager.registerAIRobot(AIRobotSleep.class, "aiRobotSleep", "buildcraft.core.robots.AIRobotSleep");
|
||||
RobotManager.registerAIRobot(AIRobotStraightMoveTo.class, "aiRobotStraightMoveTo", "buildcraft.core.robots.AIRobotStraightMoveTo");
|
||||
RobotManager.registerAIRobot(AIRobotUnload.class, "aiRobotUnload", "buildcraft.core.robots.AIRobotUnload");
|
||||
RobotManager.registerAIRobot(AIRobotUnloadFluids.class, "aiRobotUnloadFluids", "buildcraft.core.robots.AIRobotUnloadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotUseToolOnBlock.class, "aiRobotUseToolOnBlock", "buildcraft.core.robots.AIRobotUseToolOnBlock");
|
||||
RobotManager.registerResourceId(ResourceIdAssemblyTable.class, "resourceIdAssemblyTable", "buildcraft.core.robots.ResourceIdAssemblyTable");
|
||||
RobotManager.registerResourceId(ResourceIdBlock.class, "resourceIdBlock", "buildcraft.core.robots.ResourceIdBlock");
|
||||
RobotManager.registerResourceId(ResourceIdRequest.class, "resourceIdRequest", "buildcraft.core.robots.ResourceIdRequest");
|
||||
|
||||
if (BuildCraftCore.modifyWorld) {
|
||||
MinecraftForge.EVENT_BUS.register(new SpringPopulate());
|
||||
|
|
|
@ -42,10 +42,10 @@ import buildcraft.compat.CompatHooks;
|
|||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.robots.RobotIntegrationRecipe;
|
||||
import buildcraft.robots.boards.BoardRobotBomberNBT;
|
||||
import buildcraft.robots.boards.BoardRobotBuilderNBT;
|
||||
|
@ -64,22 +64,6 @@ import buildcraft.robots.boards.BoardRobotPickerNBT;
|
|||
import buildcraft.robots.boards.BoardRobotPlanterNBT;
|
||||
import buildcraft.robots.boards.BoardRobotPumpNBT;
|
||||
import buildcraft.robots.boards.BoardRobotShovelmanNBT;
|
||||
import buildcraft.silicon.BlockLaser;
|
||||
import buildcraft.silicon.BlockLaserTable;
|
||||
import buildcraft.silicon.GuiHandler;
|
||||
import buildcraft.silicon.ItemLaserTable;
|
||||
import buildcraft.silicon.ItemRedstoneBoard;
|
||||
import buildcraft.silicon.ItemRedstoneChipset;
|
||||
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
|
||||
import buildcraft.silicon.SiliconProxy;
|
||||
import buildcraft.silicon.TileAdvancedCraftingTable;
|
||||
import buildcraft.silicon.TileAssemblyTable;
|
||||
import buildcraft.silicon.TileChargingTable;
|
||||
import buildcraft.silicon.TileIntegrationTable;
|
||||
import buildcraft.silicon.TileLaser;
|
||||
import buildcraft.silicon.boards.BoardRecipe;
|
||||
import buildcraft.silicon.boards.ImplRedstoneBoardRegistry;
|
||||
import buildcraft.silicon.network.PacketHandlerSilicon;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
import buildcraft.robots.statements.ActionRobotGotoStation;
|
||||
import buildcraft.robots.statements.ActionRobotWakeUp;
|
||||
|
@ -96,6 +80,22 @@ import buildcraft.robots.statements.ActionStationRequestItemsMachine;
|
|||
import buildcraft.robots.statements.RobotsActionProvider;
|
||||
import buildcraft.robots.statements.RobotsTriggerProvider;
|
||||
import buildcraft.robots.statements.TriggerRobotSleep;
|
||||
import buildcraft.silicon.BlockLaser;
|
||||
import buildcraft.silicon.BlockLaserTable;
|
||||
import buildcraft.silicon.GuiHandler;
|
||||
import buildcraft.silicon.ItemLaserTable;
|
||||
import buildcraft.silicon.ItemRedstoneBoard;
|
||||
import buildcraft.silicon.ItemRedstoneChipset;
|
||||
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
|
||||
import buildcraft.silicon.SiliconProxy;
|
||||
import buildcraft.silicon.TileAdvancedCraftingTable;
|
||||
import buildcraft.silicon.TileAssemblyTable;
|
||||
import buildcraft.silicon.TileChargingTable;
|
||||
import buildcraft.silicon.TileIntegrationTable;
|
||||
import buildcraft.silicon.TileLaser;
|
||||
import buildcraft.silicon.boards.BoardRecipe;
|
||||
import buildcraft.silicon.boards.ImplRedstoneBoardRegistry;
|
||||
import buildcraft.silicon.network.PacketHandlerSilicon;
|
||||
|
||||
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
|
||||
public class BuildCraftSilicon extends BuildCraftMod {
|
||||
|
|
|
@ -56,6 +56,8 @@ import buildcraft.core.Version;
|
|||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.ColorUtils;
|
||||
import buildcraft.robots.ItemRobotStation;
|
||||
import buildcraft.robots.RobotStationPluggable;
|
||||
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
|
||||
import buildcraft.transport.BlockFilteredBuffer;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
|
@ -120,10 +122,8 @@ import buildcraft.transport.pipes.PipePowerWood;
|
|||
import buildcraft.transport.pipes.PipeStructureCobblestone;
|
||||
import buildcraft.transport.pluggable.ItemLens;
|
||||
import buildcraft.transport.pluggable.ItemPlug;
|
||||
import buildcraft.robots.ItemRobotStation;
|
||||
import buildcraft.transport.pluggable.LensPluggable;
|
||||
import buildcraft.transport.pluggable.PlugPluggable;
|
||||
import buildcraft.robots.RobotStationPluggable;
|
||||
import buildcraft.transport.recipes.AdvancedFacadeRecipe;
|
||||
import buildcraft.transport.recipes.GateExpansionRecipe;
|
||||
import buildcraft.transport.recipes.GateLogicSwapRecipe;
|
||||
|
@ -500,8 +500,9 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
public void loadRecipes() {
|
||||
// Add base recipe for pipe waterproof.
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));
|
||||
if(additionalWaterproofingRecipe)
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.slime_ball, 1, 2));
|
||||
if (additionalWaterproofingRecipe) {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.slime_ball, 1, 2));
|
||||
}
|
||||
|
||||
// Add pipe recipes
|
||||
for (PipeRecipe pipe : pipeRecipes) {
|
||||
|
|
|
@ -64,9 +64,9 @@ import buildcraft.core.inventory.Transactor;
|
|||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robots.ResourceIdRequest;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluidHandler, IRequestProvider, IControllable {
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
package buildcraft.builders.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import buildcraft.api.filler.FillerManager;
|
||||
|
@ -23,14 +21,12 @@ import buildcraft.core.DefaultProps;
|
|||
import buildcraft.core.builders.patterns.FillerPattern;
|
||||
import buildcraft.core.gui.AdvancedSlot;
|
||||
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||
import buildcraft.core.gui.GuiBuildCraft;
|
||||
import buildcraft.core.gui.GuiTools;
|
||||
import buildcraft.core.gui.StatementParameterSlot;
|
||||
import buildcraft.core.gui.StatementSlot;
|
||||
import buildcraft.core.gui.buttons.GuiBetterButton;
|
||||
import buildcraft.core.gui.buttons.StandardButtonTextureSets;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Pipe;
|
||||
|
||||
public class GuiFiller extends GuiAdvancedInterface {
|
||||
class FillerParameterSlot extends StatementParameterSlot {
|
||||
|
|
|
@ -27,9 +27,9 @@ import buildcraft.core.inventory.StackHelper;
|
|||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robots.ResourceIdRequest;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileRequester extends TileBuildCraft implements IInventory, IRequestProvider, ICommandReceiver {
|
||||
public static final int NB_ITEMS = 20;
|
||||
|
|
|
@ -11,8 +11,6 @@ package buildcraft.core;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.energy.fuels.CoolantManager;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -33,11 +31,13 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.api.gates.GateExpansions;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager;
|
||||
import buildcraft.core.recipes.IntegrationRecipeManager;
|
||||
import buildcraft.core.recipes.RefineryRecipeManager;
|
||||
import buildcraft.energy.fuels.CoolantManager;
|
||||
import buildcraft.energy.worldgen.OilPopulate;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.recipes.GateExpansionRecipe;
|
||||
|
@ -258,7 +258,7 @@ public final class InterModComms {
|
|||
|
||||
public static void processCoolantAddIMC(IMCEvent event, IMCMessage m) {
|
||||
boolean failed = false;
|
||||
if (!m.isNBTMessage()){
|
||||
if (!m.isNBTMessage()) {
|
||||
failed = true;
|
||||
} else {
|
||||
NBTTagCompound tag = m.getNBTValue();
|
||||
|
|
|
@ -3,8 +3,6 @@ package buildcraft.core.gui;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gui.GuiGateInterface;
|
||||
|
||||
/**
|
||||
* Created by asie on 1/24/15.
|
||||
|
|
|
@ -5,8 +5,6 @@ import net.minecraft.util.IIcon;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.statements.IStatement;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gui.GuiGateInterface;
|
||||
|
||||
/**
|
||||
* Created by asie on 1/24/15.
|
||||
|
|
|
@ -34,10 +34,10 @@ import buildcraft.BuildCraftSilicon;
|
|||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.LaserKind;
|
||||
import buildcraft.core.render.RenderEntityBlock;
|
||||
import buildcraft.robots.render.RenderRobot;
|
||||
import buildcraft.core.render.RenderingEntityBlocks;
|
||||
import buildcraft.core.render.RenderingMarkers;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.render.RenderRobot;
|
||||
import buildcraft.transport.render.TileEntityPickupFX;
|
||||
|
||||
public class CoreProxyClient extends CoreProxy {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core.utils.concurrency;
|
||||
|
||||
public interface IIterableAlgorithm {
|
||||
|
||||
void iterate();
|
||||
|
||||
boolean isDone();
|
||||
|
||||
}
|
|
@ -6,33 +6,32 @@
|
|||
* 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.core.utils;
|
||||
package buildcraft.core.utils.concurrency;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class PathFindingJob extends Thread {
|
||||
public class IterableAlgorithmRunner extends Thread {
|
||||
|
||||
private PathFinding pathFinding;
|
||||
private IIterableAlgorithm pathFinding;
|
||||
|
||||
private boolean stop = false;
|
||||
private int maxIterations;
|
||||
|
||||
private boolean done = false;
|
||||
|
||||
public PathFindingJob(PathFinding iPathFinding, int iMaxIterations) {
|
||||
public IterableAlgorithmRunner(IIterableAlgorithm iPathFinding, int iMaxIterations) {
|
||||
super("Path Finding");
|
||||
pathFinding = iPathFinding;
|
||||
maxIterations = iMaxIterations;
|
||||
}
|
||||
|
||||
public PathFindingJob(PathFinding iPathFinding) {
|
||||
public IterableAlgorithmRunner(IIterableAlgorithm iPathFinding) {
|
||||
this(iPathFinding, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
pathFinding.preRun();
|
||||
for (int i = 0; i < maxIterations; ++i) {
|
||||
if (isTerminated() || pathFinding.isDone()) {
|
||||
break;
|
|
@ -6,7 +6,7 @@
|
|||
* 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.core.utils;
|
||||
package buildcraft.core.utils.concurrency;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -17,26 +17,23 @@ import net.minecraft.world.World;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
|
||||
/**
|
||||
* This class implements a 3D path finding based on the A* algorithm, following
|
||||
* guidelines documented on http://www.policyalmanac.org/games/aStarTutorial.htm
|
||||
* .
|
||||
*/
|
||||
public class PathFinding {
|
||||
public class PathFinding implements IIterableAlgorithm {
|
||||
|
||||
public static int PATH_ITERATIONS = 1000;
|
||||
|
||||
private World world;
|
||||
private BlockIndex start;
|
||||
private BlockIndex end;
|
||||
private BlockIndex boxEnd;
|
||||
private IBlockFilter pathFound;
|
||||
private float maxDistance = -1;
|
||||
private float sqrMaxDistance = -1;
|
||||
private IZone zone;
|
||||
private double maxDistanceToEnd = 0;
|
||||
private boolean targetNotFound;
|
||||
|
||||
private HashMap<BlockIndex, Node> openList = new HashMap<BlockIndex, PathFinding.Node>();
|
||||
private HashMap<BlockIndex, Node> closedList = new HashMap<BlockIndex, PathFinding.Node>();
|
||||
|
@ -68,58 +65,7 @@ public class PathFinding {
|
|||
maxDistanceToEnd = iMaxDistanceToEnd;
|
||||
}
|
||||
|
||||
// TODO: It's probably more efficient to start a search first, and then to
|
||||
// compute the path, instead of computing all possible path from the get
|
||||
// go.
|
||||
public PathFinding(World iWorld, BlockIndex iStart, IBlockFilter iPathFound, float iMaxDistance, IZone iZone) {
|
||||
world = iWorld;
|
||||
start = iStart;
|
||||
pathFound = iPathFound;
|
||||
|
||||
Node startNode = new Node();
|
||||
startNode.parent = null;
|
||||
startNode.movementCost = 0;
|
||||
startNode.destinationCost = 0;
|
||||
startNode.totalWeight = startNode.movementCost + startNode.destinationCost;
|
||||
startNode.index = iStart;
|
||||
openList.put(start, startNode);
|
||||
nextIteration = startNode;
|
||||
maxDistance = iMaxDistance;
|
||||
sqrMaxDistance = maxDistance * maxDistance;
|
||||
maxDistance = maxDistance * 1.25f;
|
||||
zone = iZone;
|
||||
targetNotFound = false;
|
||||
}
|
||||
|
||||
public void preRun() {
|
||||
if (end == null) {
|
||||
targetNotFound = searchForTarget(64);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean searchForTarget(int range) {
|
||||
for (int dx = -range; dx <= range; dx++) {
|
||||
for (int dz = -range; dz <= range; dz++) {
|
||||
int x = start.x + dx;
|
||||
int z = start.z + dz;
|
||||
if (world.getChunkProvider().chunkExists (x >> 4, z >> 4)) {
|
||||
int height = world.getChunkFromChunkCoords(x >> 4, z >> 4).getHeightValue(x & 0xF, z & 0xF);
|
||||
for (int dy = -range; dy <= height; dy++) {
|
||||
int y = Math.max(0, start.y + dy);
|
||||
if (zone != null && !zone.contains(x, y, z)) {
|
||||
continue;
|
||||
}
|
||||
if (pathFound.matches(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterate() {
|
||||
iterate(PATH_ITERATIONS);
|
||||
}
|
||||
|
@ -145,8 +91,9 @@ public class PathFinding {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
return nextIteration == null || (end == null && targetNotFound);
|
||||
return nextIteration == null;
|
||||
}
|
||||
|
||||
public LinkedList<BlockIndex> getResult() {
|
||||
|
@ -400,33 +347,7 @@ public class PathFinding {
|
|||
resultMoves[2][2][2] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (maxDistance != -1) {
|
||||
for (int dx = -1; dx <= +1; ++dx) {
|
||||
for (int dy = -1; dy <= +1; ++dy) {
|
||||
for (int dz = -1; dz <= +1; ++dz) {
|
||||
int x = from.index.x + dx;
|
||||
int y = from.index.y + dy;
|
||||
int z = from.index.z + dz;
|
||||
|
||||
float distX = x - start.x;
|
||||
float distY = y - start.y;
|
||||
float distZ = z - start.z;
|
||||
float sqrDist = distX * distX + distY * distY + distZ * distZ;
|
||||
|
||||
if (sqrDist > sqrMaxDistance) {
|
||||
resultMoves[dx + 1][dy + 1][dz + 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultMoves;
|
||||
}
|
||||
|
||||
private boolean totalDistanceExceeded(Node nextNode) {
|
||||
return maxDistance != -1 && nextNode.totalWeight > maxDistance;
|
||||
}
|
||||
|
||||
}
|
188
common/buildcraft/core/utils/concurrency/PathFindingSearch.java
Normal file
188
common/buildcraft/core/utils/concurrency/PathFindingSearch.java
Normal file
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, 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.core.utils.concurrency;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
|
||||
public class PathFindingSearch implements IIterableAlgorithm {
|
||||
|
||||
public static int PATH_ITERATIONS = 1000;
|
||||
|
||||
private static HashMap<Integer, HashSet<BlockIndex>> reservations = new HashMap<Integer, HashSet<BlockIndex>>();
|
||||
|
||||
private World world;
|
||||
private BlockIndex start;
|
||||
private List<PathFinding> pathFinders;
|
||||
private IBlockFilter pathFound;
|
||||
private IZone zone;
|
||||
|
||||
private int searchRadius;
|
||||
private int searchX;
|
||||
private int searchY;
|
||||
private int searchZ;
|
||||
private int searchHeight;
|
||||
|
||||
public PathFindingSearch(World iWorld, BlockIndex iStart, IBlockFilter iPathFound, float iMaxDistance, IZone iZone) {
|
||||
world = iWorld;
|
||||
start = iStart;
|
||||
pathFound = iPathFound;
|
||||
|
||||
pathFinders = new LinkedList<PathFinding>();
|
||||
searchRadius = 1;
|
||||
searchX = -1;
|
||||
searchY = -1;
|
||||
searchZ = -1;
|
||||
getSearchHeight(start.x + searchX, start.z + searchZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterate() {
|
||||
if (pathFinders.size() < 5 && searchRadius < 64) {
|
||||
iterateSearch(PATH_ITERATIONS * 50);
|
||||
}
|
||||
iteratePathFind(PATH_ITERATIONS);
|
||||
}
|
||||
|
||||
private void iterateSearch(int itNumber) {
|
||||
for (int i = 0; i < itNumber; ++i) {
|
||||
int currX = start.x + searchX;
|
||||
int currY = start.y + searchY;
|
||||
int currZ = start.z + searchZ;
|
||||
if (0 <= currY && currY <= searchHeight) {
|
||||
if (isTarget(currX, currY, currZ)) {
|
||||
pathFinders.add(new PathFinding(world, start, new BlockIndex(currX, currY, currZ)));
|
||||
}
|
||||
}
|
||||
|
||||
searchY += 1;
|
||||
if (searchY > searchRadius) {
|
||||
searchY = -searchRadius;
|
||||
searchZ += 1;
|
||||
if (searchZ > searchRadius) {
|
||||
searchZ = -searchRadius;
|
||||
searchX += 1;
|
||||
if (searchX > searchRadius) {
|
||||
searchRadius += 1;
|
||||
searchX = -searchRadius;
|
||||
searchY = -searchRadius;
|
||||
searchZ = -searchRadius;
|
||||
}
|
||||
}
|
||||
searchHeight = getSearchHeight(start.x + searchX, start.z + searchZ);
|
||||
}
|
||||
if (pathFinders.size() >= 5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTarget(int x, int y, int z) {
|
||||
if (zone != null && !zone.contains(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
if (!pathFound.matches(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
synchronized (reservations) {
|
||||
if (reservations.containsKey(world.provider.dimensionId)) {
|
||||
HashSet<BlockIndex> dimReservations = reservations
|
||||
.get(world.provider.dimensionId);
|
||||
if (dimReservations.contains(new BlockIndex(x, y, z))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!BuildCraftAPI.isSoftBlock(world, x - 1, y, z)
|
||||
&& !BuildCraftAPI.isSoftBlock(world, x + 1, y, z)
|
||||
&& !BuildCraftAPI.isSoftBlock(world, x, y, z - 1)
|
||||
&& !BuildCraftAPI.isSoftBlock(world, x, y, z + 1)
|
||||
&& !BuildCraftAPI.isSoftBlock(world, x, y - 1, z)
|
||||
&& !BuildCraftAPI.isSoftBlock(world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getSearchHeight(int x, int z) {
|
||||
if (world.getChunkProvider().chunkExists(x >> 4, z >> 4)) {
|
||||
return 256;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void iteratePathFind(int itNumber) {
|
||||
for (PathFinding pathFinding : new ArrayList<PathFinding>(pathFinders)) {
|
||||
pathFinding.iterate(itNumber / pathFinders.size());
|
||||
if (pathFinding.isDone()) {
|
||||
LinkedList<BlockIndex> path = pathFinding.getResult();
|
||||
if (path != null && path.size() > 0) {
|
||||
if (reserve(path.getLast())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
pathFinders.remove(pathFinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDone() {
|
||||
for (PathFinding pathFinding : pathFinders) {
|
||||
if (pathFinding.isDone()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return searchRadius >= 64;
|
||||
}
|
||||
|
||||
public LinkedList<BlockIndex> getResult() {
|
||||
for (PathFinding pathFinding : pathFinders) {
|
||||
if (pathFinding.isDone()) {
|
||||
return pathFinding.getResult();
|
||||
}
|
||||
}
|
||||
return new LinkedList<BlockIndex>();
|
||||
}
|
||||
|
||||
private boolean reserve(BlockIndex block) {
|
||||
synchronized (reservations) {
|
||||
if (!reservations.containsKey(world.provider.dimensionId)) {
|
||||
reservations.put(world.provider.dimensionId,
|
||||
new HashSet<BlockIndex>());
|
||||
}
|
||||
HashSet<BlockIndex> dimReservations = reservations
|
||||
.get(world.provider.dimensionId);
|
||||
if (dimReservations.contains(block)) {
|
||||
return false;
|
||||
}
|
||||
dimReservations.add(block);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void unreserve(BlockIndex block) {
|
||||
synchronized (reservations) {
|
||||
if (reservations.containsKey(world.provider.dimensionId)) {
|
||||
reservations.get(world.provider.dimensionId).remove(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -247,6 +247,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
@Override
|
||||
public void onEntityUpdate() {
|
||||
this.worldObj.theProfiler.startSection("bcEntityRobot");
|
||||
if (!firstUpdateDone) {
|
||||
firstUpdate();
|
||||
firstUpdateDone = true;
|
||||
|
@ -305,7 +306,9 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
}
|
||||
|
||||
if (linkedDockingStation != null) {
|
||||
this.worldObj.theProfiler.startSection("bcRobotAIMainCycle");
|
||||
mainAI.cycle();
|
||||
this.worldObj.theProfiler.endSection();
|
||||
|
||||
if (energySpendPerCycle != mainAI.getActiveAI().getEnergyCost()) {
|
||||
energySpendPerCycle = mainAI.getActiveAI().getEnergyCost();
|
||||
|
@ -319,6 +322,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
}
|
||||
|
||||
super.onEntityUpdate();
|
||||
this.worldObj.theProfiler.endSection();
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnEnergyFX() {
|
||||
|
|
|
@ -30,7 +30,6 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
|||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
|
||||
public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem {
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.recipes.CraftingResult;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.silicon.ItemRedstoneBoard;
|
||||
import buildcraft.silicon.TileIntegrationTable;
|
||||
import buildcraft.transport.recipes.IntegrationTableRecipe;
|
||||
|
|
|
@ -2,12 +2,11 @@ package buildcraft.robots;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
/**
|
||||
* Created by asie on 1/24/15.
|
||||
*/
|
||||
public class RobotUtils {
|
||||
public final class RobotUtils {
|
||||
private RobotUtils() {
|
||||
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ import buildcraft.robots.IStationFilter;
|
|||
import buildcraft.robots.ResourceIdAssemblyTable;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.silicon.BlockLaserTable;
|
||||
import buildcraft.silicon.TileAssemblyTable;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
import buildcraft.robots.statements.ActionStationAllowCraft;
|
||||
import buildcraft.silicon.BlockLaserTable;
|
||||
import buildcraft.silicon.TileAssemblyTable;
|
||||
|
||||
public class AIRobotCraftAssemblyTable extends AIRobotCraftGeneric {
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ import net.minecraftforge.common.util.Constants;
|
|||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.utils.PathFinding;
|
||||
import buildcraft.core.utils.PathFindingJob;
|
||||
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
|
||||
import buildcraft.core.utils.concurrency.PathFinding;
|
||||
|
||||
public class AIRobotGotoBlock extends AIRobotGoto {
|
||||
|
||||
public boolean unreachable = false;
|
||||
|
||||
private PathFinding pathSearch;
|
||||
private PathFindingJob pathSearchJob;
|
||||
private IterableAlgorithmRunner pathSearchJob;
|
||||
private LinkedList<BlockIndex> path;
|
||||
private double prevDistance = Double.MAX_VALUE;
|
||||
private float finalX, finalY, finalZ;
|
||||
|
@ -70,7 +70,7 @@ public class AIRobotGotoBlock extends AIRobotGoto {
|
|||
(int) Math.floor(robot.posY), (int) Math.floor(robot.posZ)), new BlockIndex(
|
||||
(int) Math.floor(finalX), (int) Math.floor(finalY), (int) Math.floor(finalZ)), maxDistance);
|
||||
|
||||
pathSearchJob = new PathFindingJob(pathSearch, 100);
|
||||
pathSearchJob = new IterableAlgorithmRunner(pathSearch, 100);
|
||||
pathSearchJob.start();
|
||||
} else if (path != null) {
|
||||
double distance = robot.getDistance(nextX, nextY, nextZ);
|
||||
|
|
|
@ -15,8 +15,8 @@ import buildcraft.api.core.IZone;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.core.utils.PathFinding;
|
||||
import buildcraft.core.utils.PathFindingJob;
|
||||
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
|
||||
import buildcraft.core.utils.concurrency.PathFinding;
|
||||
|
||||
public class AIRobotGotoRandomGroundBlock extends AIRobot {
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class AIRobotGotoRandomGroundBlock extends AIRobot {
|
|||
|
||||
private int range;
|
||||
private PathFinding pathFinding;
|
||||
private PathFindingJob pathFindingJob;
|
||||
private IterableAlgorithmRunner pathFindingJob;
|
||||
private IBlockFilter filter;
|
||||
private IZone zone;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class AIRobotGotoRandomGroundBlock extends AIRobot {
|
|||
|
||||
blockFound = aiFind.blockFound;
|
||||
pathFinding = new PathFinding(robot.worldObj, new BlockIndex(robot), blockFound);
|
||||
pathFindingJob = new PathFindingJob(pathFinding);
|
||||
pathFindingJob = new IterableAlgorithmRunner(pathFinding);
|
||||
pathFindingJob.start();
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
terminate();
|
||||
|
|
|
@ -16,17 +16,16 @@ import buildcraft.api.core.BlockIndex;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.core.utils.PathFinding;
|
||||
import buildcraft.core.utils.PathFindingJob;
|
||||
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
|
||||
import buildcraft.core.utils.concurrency.PathFindingSearch;
|
||||
|
||||
public class AIRobotSearchBlock extends AIRobot {
|
||||
|
||||
public BlockIndex blockFound;
|
||||
public LinkedList<BlockIndex> path;
|
||||
private PathFinding blockScanner = null;
|
||||
private PathFindingJob blockScannerJob;
|
||||
private PathFindingSearch blockScanner = null;
|
||||
private IterableAlgorithmRunner blockScannerJob;
|
||||
private IBlockFilter pathFound;
|
||||
private int stopBefore = 0;
|
||||
|
||||
public AIRobotSearchBlock(EntityRobotBase iRobot) {
|
||||
super(iRobot);
|
||||
|
@ -36,13 +35,12 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
super(iRobot);
|
||||
|
||||
pathFound = iPathFound;
|
||||
stopBefore = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
blockScanner = new PathFinding(robot.worldObj, new BlockIndex(robot), pathFound, 64, robot.getZoneToWork());
|
||||
blockScannerJob = new PathFindingJob(blockScanner);
|
||||
blockScanner = new PathFindingSearch(robot.worldObj, new BlockIndex(robot), pathFound, 64, robot.getZoneToWork());
|
||||
blockScannerJob = new IterableAlgorithmRunner(blockScanner, 40000);
|
||||
blockScannerJob.start();
|
||||
}
|
||||
|
||||
|
@ -94,4 +92,8 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
blockFound = new BlockIndex(nbt.getCompoundTag("blockFound"));
|
||||
}
|
||||
}
|
||||
|
||||
public void unreserve() {
|
||||
blockScanner.unreserve(blockFound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ import buildcraft.core.inventory.ITransactor;
|
|||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.inventory.filters.ArrayStackFilter;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoStationToLoad;
|
||||
import buildcraft.robots.ai.AIRobotLoad;
|
||||
import buildcraft.robots.ai.AIRobotSearchRandomGroundBlock;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
|
||||
public class BoardRobotBomber extends RedstoneBoardRobot {
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.IEntityFilter;
|
||||
import buildcraft.robots.ai.AIRobotAttack;
|
||||
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotSearchEntity;
|
||||
import buildcraft.core.utils.IEntityFilter;
|
||||
|
||||
public class BoardRobotButcher extends RedstoneBoardRobot {
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@ import buildcraft.api.core.BuildCraftAPI;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robots.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robots.ai.AIRobotUseToolOnBlock;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
|
||||
public class BoardRobotFarmer extends RedstoneBoardRobot {
|
||||
|
||||
|
@ -71,6 +71,7 @@ public class BoardRobotFarmer extends RedstoneBoardRobot {
|
|||
if (searchAI.blockFound != null
|
||||
&& RobotRegistry.getRegistry(robot.worldObj).take(
|
||||
new ResourceIdBlock(searchAI.blockFound), robot)) {
|
||||
((AIRobotSearchBlock) ai).unreserve();
|
||||
|
||||
if (blockFound != null) {
|
||||
robot.getRegistry().release(new ResourceIdBlock(blockFound));
|
||||
|
@ -79,11 +80,12 @@ public class BoardRobotFarmer extends RedstoneBoardRobot {
|
|||
blockFound = searchAI.blockFound;
|
||||
startDelegateAI(new AIRobotGotoBlock(robot, searchAI.path));
|
||||
} else {
|
||||
if (searchAI.blockFound != null) {
|
||||
((AIRobotSearchBlock) ai).unreserve();
|
||||
}
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
AIRobotGotoBlock gotoBlock = (AIRobotGotoBlock) ai;
|
||||
|
||||
startDelegateAI(new AIRobotUseToolOnBlock(robot, blockFound));
|
||||
} else if (ai instanceof AIRobotFetchAndEquipItemStack) {
|
||||
if (robot.getHeldItem() == null) {
|
||||
|
|
|
@ -23,14 +23,14 @@ import buildcraft.api.robots.EntityRobotBase;
|
|||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.ai.AIRobotBreak;
|
||||
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robots.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
@ -104,6 +104,7 @@ public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
|||
if (robot.getRegistry().take(new ResourceIdBlock(indexStored), robot)) {
|
||||
startDelegateAI(new AIRobotGotoBlock(robot, ((AIRobotSearchBlock) ai).path));
|
||||
}
|
||||
((AIRobotSearchBlock) ai).unreserve();
|
||||
}
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
startDelegateAI(new AIRobotBreak(robot, indexStored));
|
||||
|
|
|
@ -18,11 +18,11 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.IEntityFilter;
|
||||
import buildcraft.robots.ai.AIRobotAttack;
|
||||
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotSearchEntity;
|
||||
import buildcraft.core.utils.IEntityFilter;
|
||||
|
||||
public class BoardRobotKnight extends RedstoneBoardRobot {
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.util.ResourceLocation;
|
|||
import buildcraft.api.boards.RedstoneBoardRobot;
|
||||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
|
||||
public final class BoardRobotPickerNBT extends RedstoneBoardRobotNBT {
|
||||
|
||||
|
|
|
@ -31,15 +31,14 @@ import buildcraft.core.inventory.filters.ArrayStackFilter;
|
|||
import buildcraft.core.inventory.filters.ArrayStackOrListFilter;
|
||||
import buildcraft.core.inventory.filters.CompositeFilter;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.inventory.filters.OreStackFilter;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robots.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoRandomGroundBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robots.ai.AIRobotUseToolOnBlock;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
|
||||
public class BoardRobotPlanter extends RedstoneBoardRobot {
|
||||
|
@ -140,10 +139,15 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
|
|||
robot.getRegistry().release(new ResourceIdBlock(blockFound));
|
||||
}
|
||||
|
||||
((AIRobotSearchBlock) ai).unreserve();
|
||||
|
||||
blockFound = gotoBlock.blockFound;
|
||||
gotoBlock.path.removeLast();
|
||||
startDelegateAI(new AIRobotGotoBlock(robot, gotoBlock.path));
|
||||
} else {
|
||||
if (gotoBlock.blockFound != null) {
|
||||
gotoBlock.unreserve();
|
||||
}
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
|
|
|
@ -28,14 +28,14 @@ import buildcraft.api.robots.AIRobot;
|
|||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robots.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robots.ai.AIRobotGotoStationAndUnloadFluids;
|
||||
import buildcraft.robots.ai.AIRobotPumpBlock;
|
||||
import buildcraft.robots.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.core.utils.IBlockFilter;
|
||||
import buildcraft.robots.ResourceIdBlock;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
@ -92,6 +92,7 @@ public class BoardRobotPump extends RedstoneBoardRobot {
|
|||
} else {
|
||||
startDelegateAI(new AIRobotGotoBlock(robot, ((AIRobotSearchBlock) ai).path));
|
||||
}
|
||||
((AIRobotSearchBlock) ai).unreserve();
|
||||
}
|
||||
} else if (ai instanceof AIRobotGotoBlock) {
|
||||
if (!ai.success()) {
|
||||
|
|
|
@ -31,8 +31,8 @@ import buildcraft.core.DefaultProps;
|
|||
import buildcraft.core.EntityLaser;
|
||||
import buildcraft.core.render.RenderLaser;
|
||||
import buildcraft.core.render.RenderUtils;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
|
||||
public class RenderRobot extends Render implements IItemRenderer {
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import buildcraft.core.inventory.filters.IStackFilter;
|
|||
import buildcraft.core.inventory.filters.PassThroughFluidFilter;
|
||||
import buildcraft.core.inventory.filters.PassThroughStackFilter;
|
||||
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
|
|
@ -21,15 +21,13 @@ import buildcraft.api.statements.IStatementParameter;
|
|||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.core.ItemMapLocation;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
import buildcraft.robots.ai.AIRobotGoAndLinkToDock;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Gate;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
import buildcraft.robots.ai.AIRobotGoAndLinkToDock;
|
||||
|
||||
public class ActionRobotGotoStation extends BCStatement implements IActionInternal {
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import buildcraft.api.statements.IStatementParameter;
|
|||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
||||
public class ActionStationAcceptItemsInv extends ActionStationInputItems {
|
||||
|
|
|
@ -13,9 +13,9 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.PipeTransportItems;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
|
|
@ -16,10 +16,10 @@ import buildcraft.api.statements.IActionInternal;
|
|||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import buildcraft.api.statements.IActionInternal;
|
|||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
||||
public abstract class ActionStationInputItems extends BCStatement implements IActionInternal {
|
||||
|
|
|
@ -20,9 +20,9 @@ import buildcraft.api.statements.IStatementParameter;
|
|||
import buildcraft.api.statements.StatementParameterItemStack;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
||||
public class ActionStationRequestItems extends ActionStationInputItems {
|
||||
|
|
|
@ -27,7 +27,6 @@ import buildcraft.api.statements.IActionExternal;
|
|||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IActionProvider;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
|
@ -25,7 +24,6 @@ import buildcraft.api.statements.ITriggerProvider;
|
|||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
public class RobotsTriggerProvider implements ITriggerProvider {
|
||||
|
||||
|
|
|
@ -12,19 +12,16 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
import buildcraft.robots.ai.AIRobotSleep;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.statements.BCStatement;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.RobotUtils;
|
||||
import buildcraft.robots.ai.AIRobotSleep;
|
||||
|
||||
public class TriggerRobotSleep extends BCStatement implements ITriggerInternal {
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ import buildcraft.core.network.CommandWriter;
|
|||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.ResourceIdAssemblyTable;
|
||||
import buildcraft.robots.RobotRegistry;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileAssemblyTable extends TileLaserTableBase implements IInventory, IFlexibleCrafter, ICommandReceiver {
|
||||
public String currentRecipeId = "";
|
||||
|
|
|
@ -66,15 +66,15 @@ import buildcraft.core.BlockBuildCraft;
|
|||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemMapLocation;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.core.utils.MatrixTranformations;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robots.DockingStation;
|
||||
import buildcraft.robots.EntityRobot;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.robots.RobotStationPluggable;
|
||||
import buildcraft.transport.gates.GateDefinition;
|
||||
import buildcraft.transport.gates.GatePluggable;
|
||||
import buildcraft.robots.RobotStationPluggable;
|
||||
import buildcraft.transport.render.PipeRendererWorld;
|
||||
|
||||
public class BlockGenericPipe extends BlockBuildCraft {
|
||||
|
|
|
@ -426,8 +426,9 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
|
|||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
if (!block.getMaterial().blocksMovement())
|
||||
if (!block.getMaterial().blocksMovement()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String recipeId = "buildcraft:facade{" + Block.blockRegistry.getNameForObject(block) + "#"
|
||||
+ itemStack.getItemDamage() + "}";
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.api.transport.pluggable.IFacadePluggable;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.FacadePluggable;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
public class FacadeBlockAccess implements IBlockAccess {
|
||||
|
|
|
@ -22,7 +22,6 @@ import buildcraft.api.transport.pluggable.PipePluggable;
|
|||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.utils.MatrixTranformations;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.FacadePluggable;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
|
Loading…
Reference in a new issue