make transport and silicon independent from robotics
This commit is contained in:
parent
b8e4a0b599
commit
8c098dc69e
|
@ -12,6 +12,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
@ -70,4 +71,6 @@ public abstract class EntityRobotBase extends EntityLiving implements IInventory
|
|||
public abstract void releaseResources();
|
||||
|
||||
public abstract void onChunkUnload();
|
||||
|
||||
public abstract ItemStack receiveItem(TileEntity tile, ItemStack stack);
|
||||
}
|
||||
|
|
7
api/buildcraft/api/robots/IRobotRegistryProvider.java
Normal file
7
api/buildcraft/api/robots/IRobotRegistryProvider.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package buildcraft.api.robots;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IRobotRegistryProvider {
|
||||
IRobotRegistry getRegistry(World world);
|
||||
}
|
|
@ -13,8 +13,9 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
public abstract class RobotManager {
|
||||
|
||||
public static IRobotRegistryProvider registryProvider;
|
||||
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 =
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Please check the contents of the license, which should be located
|
||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics")
|
||||
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics")
|
||||
package buildcraft.api.robots;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ 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;
|
||||
|
@ -123,66 +122,6 @@ import buildcraft.core.properties.WorldPropertyIsSoft;
|
|||
import buildcraft.core.properties.WorldPropertyIsWood;
|
||||
import buildcraft.energy.fuels.CoolantManager;
|
||||
import buildcraft.energy.fuels.FuelManager;
|
||||
import buildcraft.robotics.EntityRobot;
|
||||
import buildcraft.robotics.ResourceIdAssemblyTable;
|
||||
import buildcraft.robotics.ResourceIdBlock;
|
||||
import buildcraft.robotics.ResourceIdRequest;
|
||||
import buildcraft.robotics.ai.AIRobotAttack;
|
||||
import buildcraft.robotics.ai.AIRobotBreak;
|
||||
import buildcraft.robotics.ai.AIRobotCraftAssemblyTable;
|
||||
import buildcraft.robotics.ai.AIRobotCraftFurnace;
|
||||
import buildcraft.robotics.ai.AIRobotCraftWorkbench;
|
||||
import buildcraft.robotics.ai.AIRobotDeliverRequested;
|
||||
import buildcraft.robotics.ai.AIRobotDisposeItems;
|
||||
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robotics.ai.AIRobotFetchItem;
|
||||
import buildcraft.robotics.ai.AIRobotGoAndLinkToDock;
|
||||
import buildcraft.robotics.ai.AIRobotGoto;
|
||||
import buildcraft.robotics.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStation;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndLoad;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndUnload;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToLoad;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToUnload;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToUnloadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotLoad;
|
||||
import buildcraft.robotics.ai.AIRobotLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotMain;
|
||||
import buildcraft.robotics.ai.AIRobotPumpBlock;
|
||||
import buildcraft.robotics.ai.AIRobotRecharge;
|
||||
import buildcraft.robotics.ai.AIRobotSearchAndGotoStation;
|
||||
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchEntity;
|
||||
import buildcraft.robotics.ai.AIRobotSearchRandomBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchRandomGroundBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchStackRequest;
|
||||
import buildcraft.robotics.ai.AIRobotSearchStation;
|
||||
import buildcraft.robotics.ai.AIRobotSleep;
|
||||
import buildcraft.robotics.ai.AIRobotStraightMoveTo;
|
||||
import buildcraft.robotics.ai.AIRobotUnload;
|
||||
import buildcraft.robotics.ai.AIRobotUnloadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotUseToolOnBlock;
|
||||
import buildcraft.robotics.boards.BoardRobotBomber;
|
||||
import buildcraft.robotics.boards.BoardRobotBuilder;
|
||||
import buildcraft.robotics.boards.BoardRobotButcher;
|
||||
import buildcraft.robotics.boards.BoardRobotCarrier;
|
||||
import buildcraft.robotics.boards.BoardRobotCrafter;
|
||||
import buildcraft.robotics.boards.BoardRobotDelivery;
|
||||
import buildcraft.robotics.boards.BoardRobotFarmer;
|
||||
import buildcraft.robotics.boards.BoardRobotFluidCarrier;
|
||||
import buildcraft.robotics.boards.BoardRobotHarvester;
|
||||
import buildcraft.robotics.boards.BoardRobotKnight;
|
||||
import buildcraft.robotics.boards.BoardRobotLeaveCutter;
|
||||
import buildcraft.robotics.boards.BoardRobotLumberjack;
|
||||
import buildcraft.robotics.boards.BoardRobotMiner;
|
||||
import buildcraft.robotics.boards.BoardRobotPicker;
|
||||
import buildcraft.robotics.boards.BoardRobotPlanter;
|
||||
import buildcraft.robotics.boards.BoardRobotPump;
|
||||
import buildcraft.robotics.boards.BoardRobotShovelman;
|
||||
import buildcraft.robotics.boards.BoardRobotStripes;
|
||||
|
||||
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.10,1.8)", dependencies = "required-after:Forge@[10.13.2.1236,)")
|
||||
public class BuildCraftCore extends BuildCraftMod {
|
||||
|
@ -406,66 +345,6 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
StatementManager.registerTriggerProvider(new DefaultTriggerProvider());
|
||||
StatementManager.registerActionProvider(new DefaultActionProvider());
|
||||
|
||||
RobotManager.registerAIRobot(AIRobotMain.class, "aiRobotMain", "buildcraft.core.robotics.AIRobotMain");
|
||||
RobotManager.registerAIRobot(BoardRobotBomber.class, "boardRobotBomber", "buildcraft.core.robotics.boards.BoardRobotBomber");
|
||||
RobotManager.registerAIRobot(BoardRobotBuilder.class, "boardRobotBuilder", "buildcraft.core.robotics.boards.BoardRobotBuilder");
|
||||
RobotManager.registerAIRobot(BoardRobotButcher.class, "boardRobotButcher", "buildcraft.core.robotics.boards.BoardRobotButcher");
|
||||
RobotManager.registerAIRobot(BoardRobotCarrier.class, "boardRobotCarrier", "buildcraft.core.robotics.boards.BoardRobotCarrier");
|
||||
RobotManager.registerAIRobot(BoardRobotCrafter.class, "boardRobotCrafter", "buildcraft.core.robotics.boards.BoardRobotCrafter");
|
||||
RobotManager.registerAIRobot(BoardRobotDelivery.class, "boardRobotDelivery", "buildcraft.core.robotics.boards.BoardRobotDelivery");
|
||||
RobotManager.registerAIRobot(BoardRobotFarmer.class, "boardRobotFarmer", "buildcraft.core.robotics.boards.BoardRobotFarmer");
|
||||
RobotManager.registerAIRobot(BoardRobotFluidCarrier.class, "boardRobotFluidCarrier", "buildcraft.core.robotics.boards.BoardRobotFluidCarrier");
|
||||
RobotManager.registerAIRobot(BoardRobotHarvester.class, "boardRobotHarvester", "buildcraft.core.robotics.boards.BoardRobotHarvester");
|
||||
RobotManager.registerAIRobot(BoardRobotKnight.class, "boardRobotKnight", "buildcraft.core.robotics.boards.BoardRobotKnight");
|
||||
RobotManager.registerAIRobot(BoardRobotLeaveCutter.class, "boardRobotLeaveCutter", "buildcraft.core.robotics.boards.BoardRobotLeaveCutter");
|
||||
RobotManager.registerAIRobot(BoardRobotLumberjack.class, "boardRobotLumberjack", "buildcraft.core.robotics.boards.BoardRobotLumberjack");
|
||||
RobotManager.registerAIRobot(BoardRobotMiner.class, "boardRobotMiner", "buildcraft.core.robotics.boards.BoardRobotMiner");
|
||||
RobotManager.registerAIRobot(BoardRobotPicker.class, "boardRobotPicker", "buildcraft.core.robotics.boards.BoardRobotPicker");
|
||||
RobotManager.registerAIRobot(BoardRobotPlanter.class, "boardRobotPlanter", "buildcraft.core.robotics.boards.BoardRobotPlanter");
|
||||
RobotManager.registerAIRobot(BoardRobotPump.class, "boardRobotPump", "buildcraft.core.robotics.boards.BoardRobotPump");
|
||||
RobotManager.registerAIRobot(BoardRobotShovelman.class, "boardRobotShovelman", "buildcraft.core.robotics.boards.BoardRobotShovelman");
|
||||
RobotManager.registerAIRobot(BoardRobotStripes.class, "boardRobotStripes", "buildcraft.core.robotics.boards.BoardRobotStripes");
|
||||
RobotManager.registerAIRobot(AIRobotAttack.class, "aiRobotAttack", "buildcraft.core.robotics.AIRobotAttack");
|
||||
RobotManager.registerAIRobot(AIRobotBreak.class, "aiRobotBreak", "buildcraft.core.robotics.AIRobotBreak");
|
||||
RobotManager.registerAIRobot(AIRobotCraftAssemblyTable.class, "aiRobotCraftAssemblyTable", "buildcraft.core.robotics.AIRobotCraftAssemblyTable");
|
||||
RobotManager.registerAIRobot(AIRobotCraftFurnace.class, "aiRobotCraftFurnace", "buildcraft.core.robotics.AIRobotCraftFurnace");
|
||||
RobotManager.registerAIRobot(AIRobotCraftWorkbench.class, "aiRobotCraftWorkbench", "buildcraft.core.robotics.AIRobotCraftWorkbench");
|
||||
RobotManager.registerAIRobot(AIRobotDeliverRequested.class, "aiRobotDeliverRequested", "buildcraft.core.robotics.AIRobotDeliverRequested");
|
||||
RobotManager.registerAIRobot(AIRobotDisposeItems.class, "aiRobotDisposeItems", "buildcraft.core.robotics.AIRobotDisposeItems");
|
||||
RobotManager.registerAIRobot(AIRobotFetchAndEquipItemStack.class, "aiRobotFetchAndEquipItemStack", "buildcraft.core.robotics.AIRobotFetchAndEquipItemStack");
|
||||
RobotManager.registerAIRobot(AIRobotFetchItem.class, "aiRobotFetchItem", "buildcraft.core.robotics.AIRobotFetchItem");
|
||||
RobotManager.registerAIRobot(AIRobotGoAndLinkToDock.class, "aiRobotGoAndLinkToDock", "buildcraft.core.robotics.AIRobotGoAndLinkToDock");
|
||||
RobotManager.registerAIRobot(AIRobotGoto.class, "aiRobotGoto", "buildcraft.core.robotics.AIRobotGoto");
|
||||
RobotManager.registerAIRobot(AIRobotGotoBlock.class, "aiRobotGotoBlock", "buildcraft.core.robotics.AIRobotGotoBlock");
|
||||
RobotManager.registerAIRobot(AIRobotGotoSleep.class, "aiRobotGotoSleep", "buildcraft.core.robotics.AIRobotGotoSleep");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStation.class, "aiRobotGotoStation", "buildcraft.core.robotics.AIRobotGotoStation");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndLoad.class, "aiRobotGotoStationAndLoad", "buildcraft.core.robotics.AIRobotGotoStationAndLoad");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndLoadFluids.class, "aiRobotGotoStationAndLoadFluids", "buildcraft.core.robotics.AIRobotGotoStationAndLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationAndUnload.class, "aiRobotGotoStationAndUnload", "buildcraft.core.robotics.AIRobotGotoStationAndUnload");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToLoad.class, "aiRobotGotoStationToLoad", "buildcraft.core.robotics.AIRobotGotoStationToLoad");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToLoadFluids.class, "aiRobotGotoStationToLoadFluids", "buildcraft.core.robotics.AIRobotGotoStationToLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToUnload.class, "aiRobotGotoStationToUnload", "buildcraft.core.robotics.AIRobotGotoStationToUnload");
|
||||
RobotManager.registerAIRobot(AIRobotGotoStationToUnloadFluids.class, "aiRobotGotoStationToUnloadFluids", "buildcraft.core.robotics.AIRobotGotoStationToUnloadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotLoad.class, "aiRobotLoad", "buildcraft.core.robotics.AIRobotLoad");
|
||||
RobotManager.registerAIRobot(AIRobotLoadFluids.class, "aiRobotLoadFluids", "buildcraft.core.robotics.AIRobotLoadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotPumpBlock.class, "aiRobotPumpBlock", "buildcraft.core.robotics.AIRobotPumpBlock");
|
||||
RobotManager.registerAIRobot(AIRobotRecharge.class, "aiRobotRecharge", "buildcraft.core.robotics.AIRobotRecharge");
|
||||
RobotManager.registerAIRobot(AIRobotSearchAndGotoStation.class, "aiRobotSearchAndGotoStation", "buildcraft.core.robotics.AIRobotSearchAndGotoStation");
|
||||
RobotManager.registerAIRobot(AIRobotSearchBlock.class, "aiRobotSearchBlock", "buildcraft.core.robotics.AIRobotSearchBlock");
|
||||
RobotManager.registerAIRobot(AIRobotSearchEntity.class, "aiRobotSearchEntity", "buildcraft.core.robotics.AIRobotSearchEntity");
|
||||
RobotManager.registerAIRobot(AIRobotSearchRandomBlock.class, "aiRobotSearchRandomBlock", "buildcraft.core.robotics.AIRobotSearchRandomBlock");
|
||||
RobotManager.registerAIRobot(AIRobotSearchRandomGroundBlock.class, "aiRobotSearchRandomGroundBlock", "buildcraft.core.robotics.AIRobotSearchRandomGroundBlock");
|
||||
RobotManager.registerAIRobot(AIRobotSearchStackRequest.class, "aiRobotSearchStackRequest", "buildcraft.core.robotics.AIRobotSearchStackRequest");
|
||||
RobotManager.registerAIRobot(AIRobotSearchStation.class, "aiRobotSearchStation", "buildcraft.core.robotics.AIRobotSearchStation");
|
||||
RobotManager.registerAIRobot(AIRobotSleep.class, "aiRobotSleep", "buildcraft.core.robotics.AIRobotSleep");
|
||||
RobotManager.registerAIRobot(AIRobotStraightMoveTo.class, "aiRobotStraightMoveTo", "buildcraft.core.robotics.AIRobotStraightMoveTo");
|
||||
RobotManager.registerAIRobot(AIRobotUnload.class, "aiRobotUnload", "buildcraft.core.robotics.AIRobotUnload");
|
||||
RobotManager.registerAIRobot(AIRobotUnloadFluids.class, "aiRobotUnloadFluids", "buildcraft.core.robotics.AIRobotUnloadFluids");
|
||||
RobotManager.registerAIRobot(AIRobotUseToolOnBlock.class, "aiRobotUseToolOnBlock", "buildcraft.core.robotics.AIRobotUseToolOnBlock");
|
||||
RobotManager.registerResourceId(ResourceIdAssemblyTable.class, "resourceIdAssemblyTable", "buildcraft.core.robotics.ResourceIdAssemblyTable");
|
||||
RobotManager.registerResourceId(ResourceIdBlock.class, "resourceIdBlock", "buildcraft.core.robotics.ResourceIdBlock");
|
||||
RobotManager.registerResourceId(ResourceIdRequest.class, "resourceIdRequest", "buildcraft.core.robotics.ResourceIdRequest");
|
||||
|
||||
if (BuildCraftCore.modifyWorld) {
|
||||
MinecraftForge.EVENT_BUS.register(new SpringPopulate());
|
||||
}
|
||||
|
@ -482,7 +361,6 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
|
||||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
|
||||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");
|
||||
|
||||
|
|
|
@ -20,39 +20,104 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.EntityIds;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.robotics.BoardProgrammingRecipe;
|
||||
import buildcraft.robotics.EntityRobot;
|
||||
import buildcraft.robotics.ImplRedstoneBoardRegistry;
|
||||
import buildcraft.robotics.ItemRedstoneBoard;
|
||||
import buildcraft.robotics.ItemRobot;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
import buildcraft.robotics.RobotRegistryProvider;
|
||||
import buildcraft.silicon.ResourceIdAssemblyTable;
|
||||
import buildcraft.robotics.ResourceIdBlock;
|
||||
import buildcraft.robotics.ResourceIdRequest;
|
||||
import buildcraft.robotics.RobotIntegrationRecipe;
|
||||
import buildcraft.robotics.RoboticsProxy;
|
||||
import buildcraft.robotics.ai.AIRobotAttack;
|
||||
import buildcraft.robotics.ai.AIRobotBreak;
|
||||
import buildcraft.robotics.ai.AIRobotCraftAssemblyTable;
|
||||
import buildcraft.robotics.ai.AIRobotCraftFurnace;
|
||||
import buildcraft.robotics.ai.AIRobotCraftWorkbench;
|
||||
import buildcraft.robotics.ai.AIRobotDeliverRequested;
|
||||
import buildcraft.robotics.ai.AIRobotDisposeItems;
|
||||
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robotics.ai.AIRobotFetchItem;
|
||||
import buildcraft.robotics.ai.AIRobotGoAndLinkToDock;
|
||||
import buildcraft.robotics.ai.AIRobotGoto;
|
||||
import buildcraft.robotics.ai.AIRobotGotoBlock;
|
||||
import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStation;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndLoad;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationAndUnload;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToLoad;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToUnload;
|
||||
import buildcraft.robotics.ai.AIRobotGotoStationToUnloadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotLoad;
|
||||
import buildcraft.robotics.ai.AIRobotLoadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotMain;
|
||||
import buildcraft.robotics.ai.AIRobotPumpBlock;
|
||||
import buildcraft.robotics.ai.AIRobotRecharge;
|
||||
import buildcraft.robotics.ai.AIRobotSearchAndGotoStation;
|
||||
import buildcraft.robotics.ai.AIRobotSearchBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchEntity;
|
||||
import buildcraft.robotics.ai.AIRobotSearchRandomBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchRandomGroundBlock;
|
||||
import buildcraft.robotics.ai.AIRobotSearchStackRequest;
|
||||
import buildcraft.robotics.ai.AIRobotSearchStation;
|
||||
import buildcraft.robotics.ai.AIRobotSleep;
|
||||
import buildcraft.robotics.ai.AIRobotStraightMoveTo;
|
||||
import buildcraft.robotics.ai.AIRobotUnload;
|
||||
import buildcraft.robotics.ai.AIRobotUnloadFluids;
|
||||
import buildcraft.robotics.ai.AIRobotUseToolOnBlock;
|
||||
import buildcraft.robotics.boards.BoardRobotBomber;
|
||||
import buildcraft.robotics.boards.BoardRobotBomberNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotBuilder;
|
||||
import buildcraft.robotics.boards.BoardRobotBuilderNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotButcher;
|
||||
import buildcraft.robotics.boards.BoardRobotButcherNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotCarrier;
|
||||
import buildcraft.robotics.boards.BoardRobotCarrierNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotCrafter;
|
||||
import buildcraft.robotics.boards.BoardRobotCrafterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotDelivery;
|
||||
import buildcraft.robotics.boards.BoardRobotDeliveryNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotFarmer;
|
||||
import buildcraft.robotics.boards.BoardRobotFarmerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotFluidCarrier;
|
||||
import buildcraft.robotics.boards.BoardRobotFluidCarrierNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotHarvester;
|
||||
import buildcraft.robotics.boards.BoardRobotHarvesterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotKnight;
|
||||
import buildcraft.robotics.boards.BoardRobotKnightNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotLeaveCutter;
|
||||
import buildcraft.robotics.boards.BoardRobotLeaveCutterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotLumberjack;
|
||||
import buildcraft.robotics.boards.BoardRobotLumberjackNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotMiner;
|
||||
import buildcraft.robotics.boards.BoardRobotMinerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPicker;
|
||||
import buildcraft.robotics.boards.BoardRobotPickerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPlanter;
|
||||
import buildcraft.robotics.boards.BoardRobotPlanterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPump;
|
||||
import buildcraft.robotics.boards.BoardRobotPumpNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotShovelman;
|
||||
import buildcraft.robotics.boards.BoardRobotShovelmanNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotStripes;
|
||||
import buildcraft.robotics.boards.BoardRobotStripesNBT;
|
||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||
import buildcraft.robotics.statements.ActionRobotFilterTool;
|
||||
|
@ -155,6 +220,70 @@ public class BuildCraftRobotics extends BuildCraftMod {
|
|||
loadRecipes();
|
||||
}
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
|
||||
|
||||
RobotManager.registryProvider = new RobotRegistryProvider();
|
||||
|
||||
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(BoardRobotStripes.class, "boardRobotStripes", "buildcraft.core.robots.boards.BoardRobotStripes");
|
||||
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(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(AIRobotSearchRandomBlock.class, "aiRobotSearchRandomBlock", "buildcraft.core.robots.AIRobotSearchRandomBlock");
|
||||
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");
|
||||
|
||||
RoboticsProxy.proxy.registerRenderers();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ import buildcraft.silicon.TileLaser;
|
|||
import buildcraft.silicon.TileProgrammingTable;
|
||||
import buildcraft.silicon.network.PacketHandlerSilicon;
|
||||
|
||||
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
|
||||
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
public class BuildCraftSilicon extends BuildCraftMod {
|
||||
@Mod.Instance("BuildCraft|Silicon")
|
||||
public static BuildCraftSilicon instance;
|
||||
|
|
|
@ -163,7 +163,7 @@ import buildcraft.transport.stripes.StripesHandlerPlaceBlock;
|
|||
import buildcraft.transport.stripes.StripesHandlerRightClick;
|
||||
import buildcraft.transport.stripes.StripesHandlerShears;
|
||||
|
||||
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_SILICON)
|
||||
public class BuildCraftTransport extends BuildCraftMod {
|
||||
|
||||
@Mod.Instance("BuildCraft|Transport")
|
||||
|
|
|
@ -40,6 +40,7 @@ import buildcraft.api.core.IInvSlot;
|
|||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IRequestProvider;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.robots.StackRequest;
|
||||
import buildcraft.api.tiles.IControllable;
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
|
@ -65,8 +66,6 @@ import buildcraft.core.network.Packet;
|
|||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.robotics.ResourceIdRequest;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
|
||||
public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluidHandler, IRequestProvider, IControllable {
|
||||
|
||||
|
@ -876,7 +875,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
} else if (!(currentBuilder instanceof BptBuilderBlueprint)) {
|
||||
return false;
|
||||
} else {
|
||||
return RobotRegistry.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot);
|
||||
return RobotManager.registryProvider.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IRequestProvider;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.robots.StackRequest;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
|
@ -174,7 +175,7 @@ public class TileRequester extends TileBuildCraft implements IInventory, IReques
|
|||
return null;
|
||||
} else if (isFulfilled(i)) {
|
||||
return null;
|
||||
} else if (RobotRegistry.getRegistry(worldObj).isTaken(new ResourceIdRequest(this, i))) {
|
||||
} else if (RobotManager.registryProvider.getRegistry(worldObj).isTaken(new ResourceIdRequest(this, i))) {
|
||||
return null;
|
||||
} else {
|
||||
StackRequest r = new StackRequest();
|
||||
|
@ -194,7 +195,7 @@ public class TileRequester extends TileBuildCraft implements IInventory, IReques
|
|||
} else if (isFulfilled(i)) {
|
||||
return false;
|
||||
} else {
|
||||
return RobotRegistry.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot);
|
||||
return RobotManager.registryProvider.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
public class DockingStation implements IDockingStation {
|
||||
|
@ -56,7 +57,7 @@ public class DockingStation implements IDockingStation {
|
|||
|
||||
if (pipe == null || pipe.isInvalid()) {
|
||||
// Inconsistency - remove this pipe from the registry.
|
||||
RobotRegistry.getRegistry(world).removeStation(this);
|
||||
RobotManager.registryProvider.getRegistry(world).removeStation(this);
|
||||
pipe = null;
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,7 @@ public class DockingStation implements IDockingStation {
|
|||
if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) {
|
||||
return null;
|
||||
} else if (robotTaking == null) {
|
||||
robotTaking = RobotRegistry.getRegistry(world).getLoadedRobot(robotTakingId);
|
||||
robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId);
|
||||
}
|
||||
|
||||
return robotTaking;
|
||||
|
@ -109,9 +110,9 @@ public class DockingStation implements IDockingStation {
|
|||
robotTaking = robot;
|
||||
robotTakingId = robot.getRobotId();
|
||||
getPipe().scheduleRenderUpdate();
|
||||
RobotRegistry.getRegistry(world).markDirty();
|
||||
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
|
||||
((EntityRobot) robot).setMainStation(this);
|
||||
RobotRegistry.getRegistry(world).take(this, robot.getRobotId());
|
||||
RobotManager.registryProvider.getRegistry(world).take(this, robot.getRobotId());
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -126,8 +127,8 @@ public class DockingStation implements IDockingStation {
|
|||
robotTaking = robot;
|
||||
robotTakingId = robot.getRobotId();
|
||||
getPipe().scheduleRenderUpdate();
|
||||
RobotRegistry.getRegistry(world).markDirty();
|
||||
RobotRegistry.getRegistry(world).take(this, robot.getRobotId());
|
||||
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
|
||||
RobotManager.registryProvider.getRegistry(world).take(this, robot.getRobotId());
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -138,8 +139,8 @@ public class DockingStation implements IDockingStation {
|
|||
public void release(EntityRobotBase robot) {
|
||||
if (robotTaking == robot && !linkIsMain) {
|
||||
unsafeRelease(robot);
|
||||
RobotRegistry.getRegistry(world).markDirty();
|
||||
RobotRegistry.getRegistry(world).release(this, robot.getRobotId());
|
||||
((RobotRegistry) RobotManager.registryProvider.getRegistry(world)).markDirty();
|
||||
RobotManager.registryProvider.getRegistry(world).release(this, robot.getRobotId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ import buildcraft.api.core.SafeTimeTracker;
|
|||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.RFBattery;
|
||||
|
@ -283,7 +284,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
if (!worldObj.isRemote) {
|
||||
if (linkedDockingStation == null) {
|
||||
linkedDockingStation = RobotRegistry.getRegistry(worldObj).getStation(
|
||||
linkedDockingStation = RobotManager.registryProvider.getRegistry(worldObj).getStation(
|
||||
linkedDockingStationIndex.x,
|
||||
linkedDockingStationIndex.y,
|
||||
linkedDockingStationIndex.z,
|
||||
|
@ -301,7 +302,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
if (currentDockingStationIndex != null && currentDockingStation == null) {
|
||||
currentDockingStation = (DockingStation)
|
||||
RobotRegistry.getRegistry(worldObj).getStation(
|
||||
RobotManager.registryProvider.getRegistry(worldObj).getStation(
|
||||
currentDockingStationIndex.x,
|
||||
currentDockingStationIndex.y,
|
||||
currentDockingStationIndex.z,
|
||||
|
@ -1003,7 +1004,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
@Override
|
||||
public RobotRegistry getRegistry() {
|
||||
return RobotRegistry.getRegistry(worldObj);
|
||||
return (RobotRegistry) RobotManager.registryProvider.getRegistry(worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1015,6 +1016,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
* Tries to receive items in parameters, return items that are left after
|
||||
* the operation.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack receiveItem(TileEntity tile, ItemStack stack) {
|
||||
if (currentDockingStation != null
|
||||
&& currentDockingStation.index().nextTo(new BlockIndex(tile))
|
||||
|
|
|
@ -10,6 +10,7 @@ package buildcraft.robotics;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -19,19 +20,22 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import buildcraft.BuildCraftRobotics;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.boards.RedstoneBoardNBT;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||
import buildcraft.api.events.RobotPlacementEvent;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.Pipe;
|
||||
|
||||
public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem {
|
||||
|
||||
|
@ -172,4 +176,61 @@ public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem {
|
|||
}
|
||||
return EntityRobotBase.MAX_ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack currentItem, EntityPlayer player, World world, int x, int y, int z, int side, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
|
||||
if (!world.isRemote) {
|
||||
Block b = world.getBlock(x, y, z);
|
||||
if (!(b instanceof BlockGenericPipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Pipe<?> pipe = BlockGenericPipe.getPipe(world, x, y, z);
|
||||
if (pipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockGenericPipe pipeBlock = (BlockGenericPipe) b;
|
||||
BlockGenericPipe.RaytraceResult rayTraceResult = pipeBlock.doRayTrace(world, x, y, z, player);
|
||||
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == BlockGenericPipe.Part.Pluggable
|
||||
&& pipe.container.getPipePluggable(rayTraceResult.sideHit) instanceof RobotStationPluggable) {
|
||||
RobotStationPluggable pluggable = (RobotStationPluggable) pipe.container.getPipePluggable(rayTraceResult.sideHit);
|
||||
DockingStation station = pluggable.getStation();
|
||||
|
||||
if (!station.isTaken()) {
|
||||
if (ItemRobot.getRobotNBT(currentItem) == null) {
|
||||
return true;
|
||||
}
|
||||
RobotPlacementEvent robotEvent = new RobotPlacementEvent(player, ((NBTTagCompound) currentItem.stackTagCompound.getTag("board")).getString("id"));
|
||||
FMLCommonHandler.instance().bus().post(robotEvent);
|
||||
if (robotEvent.isCanceled()) {
|
||||
return true;
|
||||
}
|
||||
EntityRobot robot = ((ItemRobot) currentItem.getItem())
|
||||
.createRobot(currentItem, world);
|
||||
|
||||
if (robot != null && robot.getRegistry() != null) {
|
||||
robot.setUniqueRobotId(robot.getRegistry().getNextRobotId());
|
||||
|
||||
float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F;
|
||||
float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;
|
||||
float pz = z + 0.5F + rayTraceResult.sideHit.offsetZ * 0.5F;
|
||||
|
||||
robot.setPosition(px, py, pz);
|
||||
station.takeAsMain(robot);
|
||||
robot.dock(robot.getLinkedStation());
|
||||
world.spawnEntityInWorld(robot);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.getCurrentEquippedItem().stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import net.minecraftforge.event.world.ChunkEvent;
|
|||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.api.robots.IRobotRegistry;
|
||||
import buildcraft.api.robots.IRobotRegistryProvider;
|
||||
import buildcraft.api.robots.ResourceId;
|
||||
|
||||
public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
|
||||
|
||||
public static HashMap<Integer, RobotRegistry> registries = new HashMap<Integer, RobotRegistry>();
|
||||
|
||||
protected World world;
|
||||
protected HashMap<StationIndex, IDockingStation> stations = new HashMap<StationIndex, IDockingStation>();
|
||||
|
||||
private long nextRobotID = Long.MIN_VALUE;
|
||||
|
||||
|
@ -44,7 +44,6 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
|
|||
private HashMap<ResourceId, Long> resourcesTaken = new HashMap<ResourceId, Long>();
|
||||
private HashMap<Long, HashSet<ResourceId>> resourcesTakenByRobot = new HashMap<Long, HashSet<ResourceId>>();
|
||||
|
||||
private HashMap<StationIndex, IDockingStation> stations = new HashMap<StationIndex, IDockingStation>();
|
||||
private HashMap<Long, HashSet<StationIndex>> stationsTakenByRobot = new HashMap<Long, HashSet<StationIndex>>();
|
||||
|
||||
public RobotRegistry(String id) {
|
||||
|
@ -290,33 +289,6 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
public static synchronized RobotRegistry getRegistry(World world) {
|
||||
if (!registries.containsKey(world.provider.dimensionId)
|
||||
|| registries.get(world.provider.dimensionId).world != world) {
|
||||
|
||||
RobotRegistry newRegistry = (RobotRegistry) world.perWorldStorage.loadData(RobotRegistry.class, "robotRegistry");
|
||||
|
||||
if (newRegistry == null) {
|
||||
newRegistry = new RobotRegistry("robotRegistry");
|
||||
world.perWorldStorage.setData("robotRegistry", newRegistry);
|
||||
}
|
||||
|
||||
newRegistry.world = world;
|
||||
|
||||
for (IDockingStation d : newRegistry.stations.values()) {
|
||||
((DockingStation) d).world = world;
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(newRegistry);
|
||||
|
||||
registries.put(world.provider.dimensionId, newRegistry);
|
||||
|
||||
return newRegistry;
|
||||
}
|
||||
|
||||
return registries.get(world.provider.dimensionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setLong("nextRobotID", nextRobotID);
|
||||
|
|
39
common/buildcraft/robotics/RobotRegistryProvider.java
Normal file
39
common/buildcraft/robotics/RobotRegistryProvider.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
package buildcraft.robotics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.api.robots.IRobotRegistryProvider;
|
||||
|
||||
public class RobotRegistryProvider implements IRobotRegistryProvider {
|
||||
private static HashMap<Integer, RobotRegistry> registries = new HashMap<Integer, RobotRegistry>();
|
||||
|
||||
@Override
|
||||
public synchronized RobotRegistry getRegistry(World world) {
|
||||
if (!registries.containsKey(world.provider.dimensionId)
|
||||
|| registries.get(world.provider.dimensionId).world != world) {
|
||||
|
||||
RobotRegistry newRegistry = (RobotRegistry) world.perWorldStorage.loadData(RobotRegistry.class, "robotRegistry");
|
||||
|
||||
if (newRegistry == null) {
|
||||
newRegistry = new RobotRegistry("robotRegistry");
|
||||
world.perWorldStorage.setData("robotRegistry", newRegistry);
|
||||
}
|
||||
|
||||
newRegistry.world = world;
|
||||
|
||||
for (IDockingStation d : newRegistry.stations.values()) {
|
||||
((DockingStation) d).world = world;
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(newRegistry);
|
||||
|
||||
registries.put(world.provider.dimensionId, newRegistry);
|
||||
|
||||
return newRegistry;
|
||||
}
|
||||
|
||||
return registries.get(world.provider.dimensionId);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import cofh.api.energy.IEnergyReceiver;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableItem;
|
||||
|
@ -184,7 +185,7 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
if (station != null
|
||||
&& station.getPipe() != null
|
||||
&& !station.getPipe().getWorld().isRemote) {
|
||||
RobotRegistry.getRegistry(station.world).removeStation(station);
|
||||
RobotManager.registryProvider.getRegistry(station.world).removeStation(station);
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
TileGenericPipe gPipe = (TileGenericPipe) pipe;
|
||||
if (!isValid && !gPipe.getWorld().isRemote) {
|
||||
station = (DockingStation)
|
||||
RobotRegistry.getRegistry(gPipe.getWorld()).getStation(
|
||||
RobotManager.registryProvider.getRegistry(gPipe.getWorld()).getStation(
|
||||
gPipe.xCoord,
|
||||
gPipe.yCoord,
|
||||
gPipe.zCoord,
|
||||
|
@ -202,7 +203,7 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
|
||||
if (station == null) {
|
||||
station = new DockingStation(gPipe, direction);
|
||||
RobotRegistry.getRegistry(gPipe.getWorld()).registerStation(station);
|
||||
RobotManager.registryProvider.getRegistry(gPipe.getWorld()).registerStation(station);
|
||||
}
|
||||
|
||||
isValid = true;
|
||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.api.core.IInvSlot;
|
|||
import buildcraft.api.recipes.CraftingResult;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.inventory.InventoryCopy;
|
||||
|
@ -31,7 +32,7 @@ import buildcraft.core.inventory.filters.ArrayStackFilter;
|
|||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.robotics.DockingStation;
|
||||
import buildcraft.robotics.IStationFilter;
|
||||
import buildcraft.robotics.ResourceIdAssemblyTable;
|
||||
import buildcraft.silicon.ResourceIdAssemblyTable;
|
||||
import buildcraft.robotics.ResourceIdBlock;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||
|
@ -96,7 +97,7 @@ public class AIRobotCraftAssemblyTable extends AIRobotCraftGeneric {
|
|||
}
|
||||
}
|
||||
|
||||
RobotRegistry.getRegistry(robot.worldObj).take(new ResourceIdAssemblyTable(table), robot);
|
||||
RobotManager.registryProvider.getRegistry(robot.worldObj).take(new ResourceIdAssemblyTable(table), robot);
|
||||
table.planOutput(expectedResult.recipe);
|
||||
// TODO: How to make sure this output is not crafted more than
|
||||
// once??
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.items.IMapLocation;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
|
@ -52,7 +53,7 @@ public class ActionRobotGotoStation extends BCStatement implements IActionIntern
|
|||
}
|
||||
|
||||
IPipeTile tile = (IPipeTile) container.getTile();
|
||||
RobotRegistry registry = RobotRegistry.getRegistry(tile.getWorld());
|
||||
RobotRegistry registry = (RobotRegistry) RobotManager.registryProvider.getRegistry(tile.getWorld());
|
||||
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
|
||||
DockingStation station = RobotUtils.getStation(tile, d);
|
||||
|
|
|
@ -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.robotics;
|
||||
package buildcraft.silicon;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.robots.ResourceId;
|
|
@ -32,6 +32,8 @@ import buildcraft.BuildCraftCore;
|
|||
import buildcraft.api.recipes.CraftingResult;
|
||||
import buildcraft.api.recipes.IFlexibleCrafter;
|
||||
import buildcraft.api.recipes.IFlexibleRecipe;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
|
@ -39,9 +41,6 @@ import buildcraft.core.recipes.AssemblyRecipeManager;
|
|||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robotics.EntityRobot;
|
||||
import buildcraft.robotics.ResourceIdAssemblyTable;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
|
||||
public class TileAssemblyTable extends TileLaserTableBase implements IInventory, IFlexibleCrafter, ICommandReceiver {
|
||||
public String currentRecipeId = "";
|
||||
|
@ -99,7 +98,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
|||
if (currentRecipe.canBeCrafted(this)) {
|
||||
ItemStack remaining = currentRecipe.craft(this, false).crafted.copy();
|
||||
|
||||
EntityRobot robot = RobotRegistry.getRegistry(worldObj)
|
||||
EntityRobotBase robot = RobotManager.registryProvider.getRegistry(worldObj)
|
||||
.robotTaking(new ResourceIdAssemblyTable(this));
|
||||
|
||||
if (robot != null) {
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
@ -52,7 +51,6 @@ import buildcraft.api.core.BCLog;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.events.BlockInteractionEvent;
|
||||
import buildcraft.api.events.PipePlacedEvent;
|
||||
import buildcraft.api.events.RobotPlacementEvent;
|
||||
import buildcraft.api.gates.GateExpansions;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.api.items.IMapLocation;
|
||||
|
@ -68,10 +66,6 @@ import buildcraft.core.CreativeTabBuildCraft;
|
|||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.utils.MatrixTranformations;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robotics.DockingStation;
|
||||
import buildcraft.robotics.EntityRobot;
|
||||
import buildcraft.robotics.ItemRobot;
|
||||
import buildcraft.robotics.RobotStationPluggable;
|
||||
import buildcraft.transport.gates.GateDefinition;
|
||||
import buildcraft.transport.gates.GatePluggable;
|
||||
import buildcraft.transport.render.PipeRendererWorld;
|
||||
|
@ -86,12 +80,12 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
private static final ForgeDirection[] DIR_VALUES = ForgeDirection.values();
|
||||
|
||||
static enum Part {
|
||||
public static enum Part {
|
||||
Pipe,
|
||||
Pluggable
|
||||
}
|
||||
|
||||
static class RaytraceResult {
|
||||
public static class RaytraceResult {
|
||||
public final Part hitPart;
|
||||
public final MovingObjectPosition movingObjectPosition;
|
||||
public final AxisAlignedBB boundingBox;
|
||||
|
@ -645,49 +639,6 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
if (addOrStripPipePluggable(world, x, y, z, currentItem, player, ForgeDirection.getOrientation(side), pipe)) {
|
||||
return true;
|
||||
}
|
||||
} else if (currentItem.getItem () instanceof ItemRobot) {
|
||||
if (!world.isRemote) {
|
||||
RaytraceResult rayTraceResult = doRayTrace(world, x, y, z,
|
||||
player);
|
||||
|
||||
if (rayTraceResult != null && rayTraceResult.hitPart == Part.Pluggable
|
||||
&& pipe.container.getPipePluggable(rayTraceResult.sideHit) instanceof RobotStationPluggable) {
|
||||
RobotStationPluggable pluggable = (RobotStationPluggable) pipe.container.getPipePluggable(rayTraceResult.sideHit);
|
||||
DockingStation station = pluggable.getStation();
|
||||
|
||||
if (!station.isTaken()) {
|
||||
if (ItemRobot.getRobotNBT(currentItem) == null) {
|
||||
return true;
|
||||
}
|
||||
RobotPlacementEvent robotEvent = new RobotPlacementEvent(player, ((NBTTagCompound) currentItem.stackTagCompound.getTag("board")).getString("id"));
|
||||
FMLCommonHandler.instance().bus().post(robotEvent);
|
||||
if (robotEvent.isCanceled()) {
|
||||
return true;
|
||||
}
|
||||
EntityRobot robot = ((ItemRobot) currentItem.getItem())
|
||||
.createRobot(currentItem, world);
|
||||
|
||||
if (robot != null && robot.getRegistry() != null) {
|
||||
robot.setUniqueRobotId(robot.getRegistry().getNextRobotId());
|
||||
|
||||
float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F;
|
||||
float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;
|
||||
float pz = z + 0.5F + rayTraceResult.sideHit.offsetZ * 0.5F;
|
||||
|
||||
robot.setPosition(px, py, pz);
|
||||
station.takeAsMain(robot);
|
||||
robot.dock(robot.getLinkedStation());
|
||||
world.spawnEntityInWorld(robot);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.getCurrentEquippedItem().stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gate clickedGate = null;
|
||||
|
|
Loading…
Reference in a new issue