Merge branch '6.4.x' of github.com:BuildCraft/BuildCraft into 6.4.x

Conflicts:
	common/buildcraft/BuildCraftTransport.java
This commit is contained in:
asiekierka 2015-02-11 16:52:14 +01:00
commit 27decec743
53 changed files with 625 additions and 224 deletions

View file

@ -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 {

View file

@ -148,7 +148,7 @@ public class AIRobot {
}
public final void writeToNBT(NBTTagCompound nbt) {
nbt.setString("class", getClass().getCanonicalName());
nbt.setString("aiName", RobotManager.getAIRobotName(getClass()));
NBTTagCompound data = new NBTTagCompound();
writeSelfToNBT(data);
@ -169,7 +169,14 @@ public class AIRobot {
NBTTagCompound sub = nbt.getCompoundTag("delegateAI");
try {
delegateAI = (AIRobot) Class.forName(sub.getString("class")).getConstructor(EntityRobotBase.class)
Class<?> aiRobotClass = null;
if (sub.hasKey("class")) {
// Migration support for 6.4.x
aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class"));
} else {
aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName"));
}
delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
.newInstance(robot);
if (delegateAI.canLoadFromNBT()) {
@ -186,7 +193,14 @@ public class AIRobot {
AIRobot ai = null;
try {
ai = (AIRobot) Class.forName(nbt.getString("class")).getConstructor(EntityRobotBase.class)
Class<?> aiRobotClass = null;
if (nbt.hasKey("class")) {
// Migration support for 6.4.x
aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class"));
} else {
aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName"));
}
ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
.newInstance(robot);
ai.loadFromNBT(nbt);
} catch (Throwable e) {

View file

@ -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;

View 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);
}
}

View file

@ -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();
}

View file

@ -65,6 +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.RobotManager;
import buildcraft.api.statements.IActionExternal;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.IStatement;
@ -97,7 +98,6 @@ import buildcraft.core.recipes.AssemblyRecipeManager;
import buildcraft.core.recipes.IntegrationRecipeManager;
import buildcraft.core.recipes.RefineryRecipeManager;
import buildcraft.core.render.BlockHighlightHandler;
import buildcraft.robots.EntityRobot;
import buildcraft.core.statements.ActionMachineControl;
import buildcraft.core.statements.ActionRedstoneOutput;
import buildcraft.core.statements.DefaultActionProvider;
@ -124,6 +124,65 @@ import buildcraft.core.utils.WorldPropertyIsSoft;
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;
import buildcraft.robots.ai.AIRobotCraftFurnace;
import buildcraft.robots.ai.AIRobotCraftWorkbench;
import buildcraft.robots.ai.AIRobotDeliverRequested;
import buildcraft.robots.ai.AIRobotDisposeItems;
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
import buildcraft.robots.ai.AIRobotFetchItem;
import buildcraft.robots.ai.AIRobotGoAndLinkToDock;
import buildcraft.robots.ai.AIRobotGoto;
import buildcraft.robots.ai.AIRobotGotoBlock;
import buildcraft.robots.ai.AIRobotGotoRandomGroundBlock;
import buildcraft.robots.ai.AIRobotGotoSleep;
import buildcraft.robots.ai.AIRobotGotoStation;
import buildcraft.robots.ai.AIRobotGotoStationAndLoad;
import buildcraft.robots.ai.AIRobotGotoStationAndLoadFluids;
import buildcraft.robots.ai.AIRobotGotoStationAndUnload;
import buildcraft.robots.ai.AIRobotGotoStationToLoad;
import buildcraft.robots.ai.AIRobotGotoStationToLoadFluids;
import buildcraft.robots.ai.AIRobotGotoStationToUnload;
import buildcraft.robots.ai.AIRobotGotoStationToUnloadFluids;
import buildcraft.robots.ai.AIRobotLoad;
import buildcraft.robots.ai.AIRobotLoadFluids;
import buildcraft.robots.ai.AIRobotMain;
import buildcraft.robots.ai.AIRobotPumpBlock;
import buildcraft.robots.ai.AIRobotRecharge;
import buildcraft.robots.ai.AIRobotSearchAndGotoStation;
import buildcraft.robots.ai.AIRobotSearchBlock;
import buildcraft.robots.ai.AIRobotSearchEntity;
import buildcraft.robots.ai.AIRobotSearchRandomGroundBlock;
import buildcraft.robots.ai.AIRobotSearchStackRequest;
import buildcraft.robots.ai.AIRobotSearchStation;
import buildcraft.robots.ai.AIRobotSleep;
import buildcraft.robots.ai.AIRobotStraightMoveTo;
import buildcraft.robots.ai.AIRobotUnload;
import buildcraft.robots.ai.AIRobotUnloadFluids;
import buildcraft.robots.ai.AIRobotUseToolOnBlock;
import buildcraft.robots.boards.BoardRobotBomber;
import buildcraft.robots.boards.BoardRobotBuilder;
import buildcraft.robots.boards.BoardRobotButcher;
import buildcraft.robots.boards.BoardRobotCarrier;
import buildcraft.robots.boards.BoardRobotCrafter;
import buildcraft.robots.boards.BoardRobotDelivery;
import buildcraft.robots.boards.BoardRobotFarmer;
import buildcraft.robots.boards.BoardRobotFluidCarrier;
import buildcraft.robots.boards.BoardRobotHarvester;
import buildcraft.robots.boards.BoardRobotKnight;
import buildcraft.robots.boards.BoardRobotLeaveCutter;
import buildcraft.robots.boards.BoardRobotLumberjack;
import buildcraft.robots.boards.BoardRobotMiner;
import buildcraft.robots.boards.BoardRobotPicker;
import buildcraft.robots.boards.BoardRobotPlanter;
import buildcraft.robots.boards.BoardRobotPump;
import buildcraft.robots.boards.BoardRobotShovelman;
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.10,1.8)", dependencies = "required-after:Forge@[10.13.0.1207,)")
public class BuildCraftCore extends BuildCraftMod {
@ -355,6 +414,65 @@ public class BuildCraftCore extends BuildCraftMod {
StatementManager.registerTriggerProvider(new DefaultTriggerProvider());
StatementManager.registerActionProvider(new DefaultActionProvider());
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());
}

View file

@ -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 {

View file

@ -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;
@ -163,6 +163,7 @@ public class BuildCraftTransport extends BuildCraftMod {
public static float pipeDurability;
public static int pipeFluidsBaseFlowRate;
public static boolean facadeTreatBlacklistAsWhitelist;
public static boolean additionalWaterproofingRecipe;
public static BlockGenericPipe genericPipeBlock;
public static BlockFilteredBuffer filteredBufferBlock;
@ -213,7 +214,7 @@ public class BuildCraftTransport extends BuildCraftMod {
public static Item pipePowerDiamond;
public static Item pipePowerEmerald;
public static Item pipePowerSandstone;
public static int groupItemsTrigger;
public static String[] facadeBlacklist;
@ -238,7 +239,7 @@ public class BuildCraftTransport extends BuildCraftMod {
public static boolean debugPrintFacadeList = false;
public static float gateCostMultiplier = 1.0F;
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
public IIconProvider pipeIconProvider = new PipeIconProvider();
@ -263,6 +264,10 @@ public class BuildCraftTransport extends BuildCraftMod {
Property printFacadeList = BuildCraftCore.mainConfiguration.get("debug", "facades.printFacadeList", false);
debugPrintFacadeList = printFacadeList.getBoolean();
Property enableAdditionalWaterproofingRecipe = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.fluids.enableAdditionalWaterproofingRecipe", true);
enableAdditionalWaterproofingRecipe.comment = "Enable the slimeball based pipe waterproofing recipe";
additionalWaterproofingRecipe = enableAdditionalWaterproofingRecipe.getBoolean();
gateCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("gate.recipeCostMultiplier", Configuration.CATEGORY_GENERAL, 1.0F, 0.001F, 1000.0F, "The multiplier for gate recipe cost.");
filteredBufferBlock = new BlockFilteredBuffer();
@ -388,7 +393,7 @@ public class BuildCraftTransport extends BuildCraftMod {
gateCopier = new ItemGateCopier();
CoreProxy.proxy.registerItem(gateCopier);
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
}
@ -452,7 +457,7 @@ public class BuildCraftTransport extends BuildCraftMod {
StatementManager.registerParameterClass(ActionParameterSignal.class);
StatementManager.registerTriggerProvider(new PipeTriggerProvider());
StatementManager.registerActionProvider(new PipeActionProvider());
PipeManager.registerStripesHandler(new StripesHandlerRightClick());
PipeManager.registerStripesHandler(new StripesHandlerBucket());
PipeManager.registerStripesHandler(new StripesHandlerArrow());
@ -463,7 +468,7 @@ public class BuildCraftTransport extends BuildCraftMod {
PipeManager.registerPipePluggable(LensPluggable.class, "lens");
PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
PipeManager.registerPipePluggable(RobotStationPluggable.class, "robotStation");
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
@ -475,7 +480,7 @@ public class BuildCraftTransport extends BuildCraftMod {
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
facadeItem.initialize();
if (debugPrintFacadeList) {
try {
PrintWriter writer = new PrintWriter("FacadeDebug.txt", "UTF-8");
@ -495,6 +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));
}
// Add pipe recipes
for (PipeRecipe pipe : pipeRecipes) {
@ -526,7 +534,7 @@ public class BuildCraftTransport extends BuildCraftMod {
if (Loader.isModLoaded("BuildCraft|Silicon")) {
GameRegistry.addShapelessRecipe(new ItemStack(gateCopier, 1), new ItemStack(BuildCraftCore.wrenchItem), Chipset.RED.getStack(1));
// PIPE WIRE
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:redWire", 5000, PipeWire.RED.getStack(8),
"dyeRed", "dustRedstone", "ingotIron");
@ -587,7 +595,7 @@ public class BuildCraftTransport extends BuildCraftMod {
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:orGate" + materialName, energyCost,
ItemGate.makeGateItem(material, GateLogic.OR), inputs);
}
@Mod.EventHandler
public void processIMCRequests(IMCEvent event) {
InterModComms.processIMC(event);
@ -598,19 +606,19 @@ public class BuildCraftTransport extends BuildCraftMod {
Object... ingredients) {
ItemPipe res = BlockGenericPipe.registerPipe(clas, creativeTab);
res.setUnlocalizedName(clas.getSimpleName());
// Add appropriate recipes to temporary list
if (ingredients.length == 3) {
for (int i = 0; i < 17; i++) {
PipeRecipe recipe = new PipeRecipe();
ItemStack glass;
if (i == 0) {
glass = new ItemStack(Blocks.glass);
} else {
glass = new ItemStack(Blocks.stained_glass, 1, i - 1);
}
recipe.result = new ItemStack(res, 8, i);
recipe.input = new Object[]{"ABC", 'A', ingredients[0], 'B', glass, 'C', ingredients[2]};
@ -619,20 +627,20 @@ public class BuildCraftTransport extends BuildCraftMod {
} else if (ingredients.length == 2) {
for (int i = 0; i < 17; i++) {
PipeRecipe recipe = new PipeRecipe();
Object left = ingredients[0];
Object right = ingredients[1];
if (ingredients[1] instanceof ItemPipe) {
right = new ItemStack((Item) right, 1, i);
}
recipe.isShapeless = true;
recipe.result = new ItemStack(res, 1, i);
recipe.input = new Object[]{left, right};
pipeRecipes.add(recipe);
if (ingredients[1] instanceof ItemPipe) {
PipeRecipe uncraft = new PipeRecipe();
uncraft.isShapeless = true;

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -25,15 +25,19 @@ import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
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;
@ -66,6 +70,10 @@ public final class InterModComms {
processAssemblyRecipeRemoveIMC(event, m);
} else if (m.key.equals("remove-refinery-recipe")) {
processRefineryRecipeRemoveIMC(event, m);
} else if (m.key.equals("add-coolant")) {
processCoolantAddIMC(event, m);
} else if (m.key.equals("remove-coolant")) {
processCoolantRemoveIMC(event, m);
} else {
BCLog.logger.warn(String.format("Received an IMC message with unknown key ('%s') from %s!", new Object[]{m.key, m.getSender()}));
}
@ -247,4 +255,43 @@ public final class InterModComms {
}
BCLog.logger.info(String.format("Received a successful oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
}
public static void processCoolantAddIMC(IMCEvent event, IMCMessage m) {
boolean failed = false;
if (!m.isNBTMessage()) {
failed = true;
} else {
NBTTagCompound tag = m.getNBTValue();
if (!tag.hasKey("coolant") || !tag.hasKey("degrees", 3)) {
failed = true;
} else {
Fluid coolant = FluidRegistry.getFluid(tag.getString("coolant"));
if (coolant != null) {
CoolantManager.INSTANCE.addCoolant(coolant, tag.getInteger("degrees"));
} else {
failed = true;
}
}
}
if (failed) {
BCLog.logger.warn("Received invalid coolant IMC message from mod %s!", m.getSender());
}
}
public static void processCoolantRemoveIMC(IMCEvent event, IMCMessage m) {
boolean failed = false;
if (m.isStringMessage()) {
ICoolant coolant = CoolantManager.INSTANCE.getCoolant(FluidRegistry.getFluid(m.getStringValue()));
if (coolant != null) {
CoolantManager.INSTANCE.getCoolants().remove(coolant);
} else {
failed = true;
}
} else {
failed = true;
}
if (failed) {
BCLog.logger.warn("Received invalid coolant IMC message from mod %s!", m.getSender());
}
}
}

View file

@ -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.

View file

@ -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.

View file

@ -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 {

View file

@ -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();
}

View file

@ -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;

View file

@ -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;
}
}

View 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);
}
}
}
}

View file

@ -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() {

View file

@ -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 {

View file

@ -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;

View file

@ -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() {
}

View file

@ -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 {

View file

@ -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);

View file

@ -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();

View file

@ -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);
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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) {

View file

@ -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));

View file

@ -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 {

View file

@ -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 {

View file

@ -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) {

View file

@ -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()) {

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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 = "";

View file

@ -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 {

View file

@ -426,6 +426,9 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
if (block == null) {
return;
}
if (!block.getMaterial().blocksMovement()) {
return;
}
String recipeId = "buildcraft:facade{" + Block.blockRegistry.getNameForObject(block) + "#"
+ itemStack.getItemDamage() + "}";
@ -564,7 +567,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
public int getSpriteNumber() {
return 0;
}
@Override
public ItemStack getFacadeForBlock(Block block, int metadata) {
return getFacade(FacadeState.create(block, metadata));

View file

@ -141,7 +141,8 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
pluggableClass = FacadePluggable.class;
} else if ("buildcraft.transport.ItemPlug$PlugPluggable".equals(c)) {
pluggableClass = PlugPluggable.class;
} else if ("buildcraft.transport.gates.ItemRobotStation$RobotStationPluggable".equals(c)) {
} else if ("buildcraft.transport.gates.ItemRobotStation$RobotStationPluggable".equals(c)
|| "buildcraft.transport.ItemRobotStation$RobotStationPluggable".equals(c)) {
pluggableClass = PipeManager.getPluggableByName("robotStation");
}
} else {

View file

@ -37,8 +37,11 @@ public abstract class PipeLogicWood {
break;
}
}
if (newFacing == null) {
newFacing = ForgeDirection.UNKNOWN;
}
if (newFacing != null && newFacing.ordinal() != meta) {
if (newFacing.ordinal() != meta) {
pipe.container.getWorldObj().setBlockMetadataWithNotify(pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, newFacing.ordinal(), 3);
pipe.container.scheduleRenderUpdate();
}
@ -67,6 +70,10 @@ public abstract class PipeLogicWood {
return true;
}
if (pipe.container.hasBlockingPluggable(side)) {
return false;
}
TileEntity tile = tileBuffer[side.ordinal()].getTile();
return isValidConnectingTile(tile);
}

View file

@ -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 {

View file

@ -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;