massive refactor
This commit is contained in:
parent
93adb6a657
commit
b8e4a0b599
11
api/buildcraft/api/core/IPathProvider.java
Normal file
11
api/buildcraft/api/core/IPathProvider.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package buildcraft.api.core;
|
||||
|
||||
import java.util.List;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
|
||||
/**
|
||||
* To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers.
|
||||
*/
|
||||
public interface IPathProvider {
|
||||
List<BlockIndex> getPath();
|
||||
}
|
|
@ -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|robots")
|
||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics")
|
||||
package buildcraft.api.robots;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
|
|
|
@ -116,16 +116,15 @@ import buildcraft.builders.schematics.SchematicStone;
|
|||
import buildcraft.builders.schematics.SchematicTileCreative;
|
||||
import buildcraft.builders.schematics.SchematicTripWireHook;
|
||||
import buildcraft.builders.schematics.SchematicWallSide;
|
||||
import buildcraft.builders.statements.ActionFiller;
|
||||
import buildcraft.builders.statements.BuildersActionProvider;
|
||||
import buildcraft.builders.urbanism.BlockUrbanist;
|
||||
import buildcraft.builders.urbanism.TileUrbanist;
|
||||
import buildcraft.builders.urbanism.UrbanistToolsIconProvider;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.blueprints.RealBlueprintDeployer;
|
||||
import buildcraft.builders.blueprints.RealBlueprintDeployer;
|
||||
import buildcraft.core.blueprints.SchematicRegistry;
|
||||
import buildcraft.core.builders.patterns.FillerPattern;
|
||||
import buildcraft.core.builders.patterns.FillerRegistry;
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.nio.ByteBuffer;
|
|||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
@ -48,7 +47,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
@ -91,7 +89,7 @@ import buildcraft.core.SpringPopulate;
|
|||
import buildcraft.core.TickHandlerCore;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.blueprints.SchematicRegistry;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.network.ChannelHandler;
|
||||
import buildcraft.core.network.EntityIds;
|
||||
import buildcraft.core.network.PacketHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
@ -114,77 +112,77 @@ import buildcraft.core.statements.TriggerInventoryLevel;
|
|||
import buildcraft.core.statements.TriggerMachine;
|
||||
import buildcraft.core.statements.TriggerRedstoneInput;
|
||||
import buildcraft.core.utils.ColorUtils;
|
||||
import buildcraft.core.utils.WorldPropertyIsDirt;
|
||||
import buildcraft.core.utils.WorldPropertyIsFarmland;
|
||||
import buildcraft.core.utils.WorldPropertyIsFluidSource;
|
||||
import buildcraft.core.utils.WorldPropertyIsHarvestable;
|
||||
import buildcraft.core.utils.WorldPropertyIsLeaf;
|
||||
import buildcraft.core.utils.WorldPropertyIsOre;
|
||||
import buildcraft.core.utils.WorldPropertyIsShoveled;
|
||||
import buildcraft.core.utils.WorldPropertyIsSoft;
|
||||
import buildcraft.core.utils.WorldPropertyIsWood;
|
||||
import buildcraft.core.properties.WorldPropertyIsDirt;
|
||||
import buildcraft.core.properties.WorldPropertyIsFarmland;
|
||||
import buildcraft.core.properties.WorldPropertyIsFluidSource;
|
||||
import buildcraft.core.properties.WorldPropertyIsHarvestable;
|
||||
import buildcraft.core.properties.WorldPropertyIsLeaf;
|
||||
import buildcraft.core.properties.WorldPropertyIsOre;
|
||||
import buildcraft.core.properties.WorldPropertyIsShoveled;
|
||||
import buildcraft.core.properties.WorldPropertyIsSoft;
|
||||
import buildcraft.core.properties.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.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.AIRobotSearchRandomBlock;
|
||||
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;
|
||||
import buildcraft.robots.boards.BoardRobotStripes;
|
||||
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 {
|
||||
|
@ -254,6 +252,7 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
|
||||
public static boolean loadDefaultRecipes = true;
|
||||
public static boolean consumeWaterSources = false;
|
||||
public static float miningMultiplier;
|
||||
|
||||
public static AchievementManager achievementManager;
|
||||
|
||||
|
@ -348,6 +347,8 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
|
||||
consumeWater.comment = "set to true if the Pump should consume water";
|
||||
|
||||
miningMultiplier = BuildCraftCore.mainConfiguration.getFloat("general", "mining.cost.multipler", 1F, 1F, 10F, "cost multiplier for mining operations, range (1.0 - 10.0)\nhigh values may render engines incapable of powering machines directly");
|
||||
|
||||
woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem");
|
||||
CoreProxy.proxy.registerItem(woodenGearItem);
|
||||
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
|
||||
|
@ -383,7 +384,7 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
BuildCraftAPI.proxy = CoreProxy.proxy;
|
||||
|
||||
channels = NetworkRegistry.INSTANCE.newChannel
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-CORE", new BuildCraftChannelHandler(), new PacketHandler());
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-CORE", new ChannelHandler(), new PacketHandler());
|
||||
|
||||
achievementManager = new AchievementManager();
|
||||
FMLCommonHandler.instance().bus().register(achievementManager);
|
||||
|
@ -405,65 +406,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(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");
|
||||
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());
|
||||
|
@ -501,8 +502,6 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
}
|
||||
}
|
||||
|
||||
achievementManager.finalize();
|
||||
|
||||
BuildCraftAPI.softBlocks.add(Blocks.snow);
|
||||
BuildCraftAPI.softBlocks.add(Blocks.vine);
|
||||
BuildCraftAPI.softBlocks.add(Blocks.fire);
|
||||
|
|
|
@ -49,12 +49,12 @@ import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
|||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.BlockSpring;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.network.ChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.energy.BlockBuildcraftFluid;
|
||||
import buildcraft.energy.BlockEnergyEmitter;
|
||||
|
@ -63,6 +63,7 @@ import buildcraft.energy.BlockEngine;
|
|||
import buildcraft.energy.BucketHandler;
|
||||
import buildcraft.energy.EnergyProxy;
|
||||
import buildcraft.energy.GuiHandler;
|
||||
import buildcraft.energy.IMCHandlerEnergy;
|
||||
import buildcraft.energy.ItemBucketBuildcraft;
|
||||
import buildcraft.energy.ItemEngine;
|
||||
import buildcraft.energy.SchematicEngine;
|
||||
|
@ -286,6 +287,8 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
|||
BuildcraftFuelRegistry.coolant.addCoolant(FluidRegistry.WATER, 0.0023f);
|
||||
BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.ice), StackKey.fluid(FluidRegistry.WATER), 2f);
|
||||
|
||||
InterModComms.registerHandler(new IMCHandlerEnergy());
|
||||
|
||||
// Receiver / emitter
|
||||
|
||||
if (!BuildCraftCore.NONRELEASED_BLOCKS) {
|
||||
|
@ -346,7 +349,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
|||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
channels = NetworkRegistry.INSTANCE.newChannel
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new BuildCraftChannelHandler(), new PacketHandlerTransport());
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new ChannelHandler(), new PacketHandlerTransport());
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||
|
||||
|
|
|
@ -39,11 +39,11 @@ import net.minecraftforge.common.config.Property;
|
|||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.blueprints.SchematicTile;
|
||||
import buildcraft.builders.schematics.SchematicIgnoreMeta;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.network.ChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.ConfigUtils;
|
||||
import buildcraft.factory.BlockAutoWorkbench;
|
||||
|
@ -184,13 +184,12 @@ public class BuildCraftFactory extends BuildCraftMod {
|
|||
@Mod.EventHandler
|
||||
public void initialize(FMLPreInitializationEvent evt) {
|
||||
channels = NetworkRegistry.INSTANCE.newChannel
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new BuildCraftChannelHandler(), new PacketHandlerFactory());
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new ChannelHandler(), new PacketHandlerFactory());
|
||||
|
||||
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, "general");
|
||||
|
||||
allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines");
|
||||
quarryOneTimeUse = genCat.get("quarry.one.time.use", false, "Quarry cannot be picked back up after placement");
|
||||
miningMultiplier = genCat.get("mining.cost.multipler", 1F, 1F, 10F, "cost multiplier for mining operations, range (1.0 - 10.0)\nhigh values may render engines incapable of powering machines directly");
|
||||
miningDepth = genCat.get("mining.depth", 2, 256, 256, "how far below the machine can mining machines dig, range (2 - 256), default 256");
|
||||
quarryLoadsChunks = genCat.get("quarry.loads.chunks", true, "Quarry loads chunks required for mining");
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ import cpw.mods.fml.relauncher.Side;
|
|||
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
|
||||
public class BuildCraftMod {
|
||||
public EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||
|
||||
public void sendToPlayers(BuildCraftPacket packet, World world, int x, int y, int z, int maxDistance) {
|
||||
public void sendToPlayers(Packet packet, World world, int x, int y, int z, int maxDistance) {
|
||||
try {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
|
@ -41,15 +41,15 @@ public class BuildCraftMod {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendToPlayersNear(BuildCraftPacket packet, TileEntity tileEntity, int maxDistance) {
|
||||
public void sendToPlayersNear(Packet packet, TileEntity tileEntity, int maxDistance) {
|
||||
sendToPlayers(packet, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, maxDistance);
|
||||
}
|
||||
|
||||
public void sendToPlayersNear(BuildCraftPacket packet, TileEntity tileEntity) {
|
||||
public void sendToPlayersNear(Packet packet, TileEntity tileEntity) {
|
||||
sendToPlayersNear(packet, tileEntity, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
}
|
||||
|
||||
public void sendToWorld(BuildCraftPacket packet, World world) {
|
||||
public void sendToWorld(Packet packet, World world) {
|
||||
try {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
||||
|
@ -61,7 +61,7 @@ public class BuildCraftMod {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) {
|
||||
public void sendToPlayer(EntityPlayer entityplayer, Packet packet) {
|
||||
try {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
|
@ -78,7 +78,7 @@ public class BuildCraftMod {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendToAll(BuildCraftPacket packet) {
|
||||
public void sendToAll(Packet packet) {
|
||||
try {
|
||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
|
@ -88,7 +88,7 @@ public class BuildCraftMod {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendToServer(BuildCraftPacket packet) {
|
||||
public void sendToServer(Packet packet) {
|
||||
try {
|
||||
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
|
||||
channels.get(Side.CLIENT).writeOutbound(packet);
|
||||
|
|
199
common/buildcraft/BuildCraftRobotics.java
Normal file
199
common/buildcraft/BuildCraftRobotics.java
Normal file
|
@ -0,0 +1,199 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
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.GameRegistry;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
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.proxy.CoreProxy;
|
||||
import buildcraft.robotics.BoardProgrammingRecipe;
|
||||
import buildcraft.robotics.ImplRedstoneBoardRegistry;
|
||||
import buildcraft.robotics.ItemRedstoneBoard;
|
||||
import buildcraft.robotics.ItemRobot;
|
||||
import buildcraft.robotics.RobotIntegrationRecipe;
|
||||
import buildcraft.robotics.RoboticsProxy;
|
||||
import buildcraft.robotics.boards.BoardRobotBomberNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotBuilderNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotButcherNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotCarrierNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotCrafterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotDeliveryNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotFarmerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotFluidCarrierNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotHarvesterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotKnightNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotLeaveCutterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotLumberjackNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotMinerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPickerNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPlanterNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotPumpNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotShovelmanNBT;
|
||||
import buildcraft.robotics.boards.BoardRobotStripesNBT;
|
||||
import buildcraft.robotics.statements.ActionRobotFilter;
|
||||
import buildcraft.robotics.statements.ActionRobotFilterTool;
|
||||
import buildcraft.robotics.statements.ActionRobotGotoStation;
|
||||
import buildcraft.robotics.statements.ActionRobotWakeUp;
|
||||
import buildcraft.robotics.statements.ActionRobotWorkInArea;
|
||||
import buildcraft.robotics.statements.ActionStationAcceptFluids;
|
||||
import buildcraft.robotics.statements.ActionStationAcceptItemsInv;
|
||||
import buildcraft.robotics.statements.ActionStationAcceptItemsPipe;
|
||||
import buildcraft.robotics.statements.ActionStationAllowCraft;
|
||||
import buildcraft.robotics.statements.ActionStationForbidRobot;
|
||||
import buildcraft.robotics.statements.ActionStationProvideFluids;
|
||||
import buildcraft.robotics.statements.ActionStationProvideItems;
|
||||
import buildcraft.robotics.statements.ActionStationRequestItems;
|
||||
import buildcraft.robotics.statements.ActionStationRequestItemsMachine;
|
||||
import buildcraft.robotics.statements.RobotsActionProvider;
|
||||
import buildcraft.robotics.statements.RobotsTriggerProvider;
|
||||
import buildcraft.robotics.statements.TriggerRobotSleep;
|
||||
import buildcraft.silicon.ItemRedstoneChipset;
|
||||
|
||||
@Mod(name = "BuildCraft Robotics", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Robotics", dependencies = DefaultProps.DEPENDENCY_SILICON_TRANSPORT)
|
||||
public class BuildCraftRobotics extends BuildCraftMod {
|
||||
@Mod.Instance("BuildCraft|Robotics")
|
||||
public static BuildCraftRobotics instance;
|
||||
|
||||
public static ItemRedstoneBoard redstoneBoard;
|
||||
public static Item robotItem;
|
||||
|
||||
public static ITriggerInternal triggerRobotSleep = new TriggerRobotSleep();
|
||||
|
||||
public static IActionInternal actionRobotGotoStation = new ActionRobotGotoStation();
|
||||
public static IActionInternal actionRobotWakeUp = new ActionRobotWakeUp();
|
||||
public static IActionInternal actionRobotWorkInArea = new ActionRobotWorkInArea();
|
||||
public static IActionInternal actionRobotFilter = new ActionRobotFilter();
|
||||
public static IActionInternal actionRobotFilterTool = new ActionRobotFilterTool();
|
||||
public static IActionInternal actionRobotAllowCraft = new ActionStationAllowCraft();
|
||||
public static IActionInternal actionStationRequestItems = new ActionStationRequestItems();
|
||||
public static IActionInternal actionStationAcceptItems = new ActionStationAcceptItemsInv();
|
||||
public static IActionInternal actionStationProvideItems = new ActionStationProvideItems();
|
||||
public static IActionInternal actionStationAcceptFluids = new ActionStationAcceptFluids();
|
||||
public static IActionInternal actionStationProvideFluids = new ActionStationProvideFluids();
|
||||
public static IActionInternal actionStationForbidRobot = new ActionStationForbidRobot();
|
||||
public static IActionInternal actionStationDropInPipe = new ActionStationAcceptItemsPipe();
|
||||
public static IActionInternal actionStationMachineRequestItems = new ActionStationRequestItemsMachine();
|
||||
|
||||
public static Achievement timeForSomeLogicAchievement;
|
||||
public static Achievement tinglyLaserAchievement;
|
||||
|
||||
public static float chipsetCostMultiplier = 1.0F;
|
||||
|
||||
public static List<String> blacklistedRobots;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
chipsetCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("chipset.costMultiplier", "general", 1.0F, 0.001F, 1000.0F, "The multiplier for chipset recipe cost.");
|
||||
|
||||
blacklistedRobots = new ArrayList<String>();
|
||||
blacklistedRobots.addAll(Arrays.asList(BuildCraftCore.mainConfiguration.get("general", "boards.blacklist", new String[]{}).getStringList()));
|
||||
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
||||
robotItem = new ItemRobot().setUnlocalizedName("robot");
|
||||
CoreProxy.proxy.registerItem(robotItem);
|
||||
|
||||
redstoneBoard = new ItemRedstoneBoard();
|
||||
redstoneBoard.setUnlocalizedName("redstone_board");
|
||||
CoreProxy.proxy.registerItem(redstoneBoard);
|
||||
|
||||
RedstoneBoardRegistry.instance = new ImplRedstoneBoardRegistry();
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPickerNBT.instance, 20);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCarrierNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLumberjackNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotHarvesterNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotMinerNBT.instance, 10);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFluidCarrierNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotButcherNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotShovelmanNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCrafterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotDeliveryNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPumpNBT.instance, 5);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBuilderNBT.instance, 0.5F);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotStripesNBT.instance, 0.5F);
|
||||
|
||||
StatementManager.registerActionProvider(new RobotsActionProvider());
|
||||
StatementManager.registerTriggerProvider(new RobotsTriggerProvider());
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
|
||||
RoboticsProxy.proxy.registerRenderers();
|
||||
}
|
||||
|
||||
public static void loadRecipes() {
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(robotItem),
|
||||
"PPP",
|
||||
"PRP",
|
||||
"C C",
|
||||
'P', "ingotIron",
|
||||
'R', BuildCraftSilicon.redstoneCrystal,
|
||||
'C', ItemRedstoneChipset.Chipset.DIAMOND.getStack());
|
||||
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(redstoneBoard),
|
||||
"PPP",
|
||||
"PRP",
|
||||
"PPP",
|
||||
'R', "dustRedstone",
|
||||
'P', Items.paper);
|
||||
|
||||
BuildcraftRecipeRegistry.programmingTable.addRecipe(new BoardProgrammingRecipe());
|
||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new RobotIntegrationRecipe("buildcraft:robotIntegration"));
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void processRequests(FMLInterModComms.IMCEvent event) {
|
||||
InterModComms.processIMC(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void remap(FMLMissingMappingsEvent event) {
|
||||
for (FMLMissingMappingsEvent.MissingMapping mapping: event.get()) {
|
||||
if (mapping.type == GameRegistry.Type.ITEM) {
|
||||
if (mapping.name.equals("BuildCraft|Silicon:robot")) {
|
||||
mapping.remap(robotItem);
|
||||
} else if (mapping.name.equals("BuildCraft|Silicon:redstone_board")) {
|
||||
mapping.remap(redstoneBoard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,10 +8,6 @@
|
|||
*/
|
||||
package buildcraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -31,63 +27,22 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
import buildcraft.builders.schematics.SchematicRotateMeta;
|
||||
import buildcraft.commander.BlockRequester;
|
||||
import buildcraft.commander.BlockZonePlan;
|
||||
import buildcraft.commander.TileRequester;
|
||||
import buildcraft.commander.TileZonePlan;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.network.ChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.robots.ItemRobot;
|
||||
import buildcraft.robots.RobotIntegrationRecipe;
|
||||
import buildcraft.robots.boards.BoardRobotBomberNBT;
|
||||
import buildcraft.robots.boards.BoardRobotBuilderNBT;
|
||||
import buildcraft.robots.boards.BoardRobotButcherNBT;
|
||||
import buildcraft.robots.boards.BoardRobotCarrierNBT;
|
||||
import buildcraft.robots.boards.BoardRobotCrafterNBT;
|
||||
import buildcraft.robots.boards.BoardRobotDeliveryNBT;
|
||||
import buildcraft.robots.boards.BoardRobotFarmerNBT;
|
||||
import buildcraft.robots.boards.BoardRobotFluidCarrierNBT;
|
||||
import buildcraft.robots.boards.BoardRobotHarvesterNBT;
|
||||
import buildcraft.robots.boards.BoardRobotKnightNBT;
|
||||
import buildcraft.robots.boards.BoardRobotLeaveCutterNBT;
|
||||
import buildcraft.robots.boards.BoardRobotLumberjackNBT;
|
||||
import buildcraft.robots.boards.BoardRobotMinerNBT;
|
||||
import buildcraft.robots.boards.BoardRobotPickerNBT;
|
||||
import buildcraft.robots.boards.BoardRobotPlanterNBT;
|
||||
import buildcraft.robots.boards.BoardRobotPumpNBT;
|
||||
import buildcraft.robots.boards.BoardRobotShovelmanNBT;
|
||||
import buildcraft.robots.boards.BoardRobotStripesNBT;
|
||||
import buildcraft.robots.statements.ActionRobotFilter;
|
||||
import buildcraft.robots.statements.ActionRobotFilterTool;
|
||||
import buildcraft.robots.statements.ActionRobotGotoStation;
|
||||
import buildcraft.robots.statements.ActionRobotWakeUp;
|
||||
import buildcraft.robots.statements.ActionRobotWorkInArea;
|
||||
import buildcraft.robots.statements.ActionStationAcceptFluids;
|
||||
import buildcraft.robots.statements.ActionStationAcceptItemsInv;
|
||||
import buildcraft.robots.statements.ActionStationAcceptItemsPipe;
|
||||
import buildcraft.robots.statements.ActionStationAllowCraft;
|
||||
import buildcraft.robots.statements.ActionStationForbidRobot;
|
||||
import buildcraft.robots.statements.ActionStationProvideFluids;
|
||||
import buildcraft.robots.statements.ActionStationProvideItems;
|
||||
import buildcraft.robots.statements.ActionStationRequestItems;
|
||||
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;
|
||||
|
@ -97,8 +52,6 @@ import buildcraft.silicon.TileChargingTable;
|
|||
import buildcraft.silicon.TileIntegrationTable;
|
||||
import buildcraft.silicon.TileLaser;
|
||||
import buildcraft.silicon.TileProgrammingTable;
|
||||
import buildcraft.silicon.boards.BoardProgrammingRecipe;
|
||||
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)
|
||||
|
@ -107,46 +60,22 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
public static BuildCraftSilicon instance;
|
||||
|
||||
public static ItemRedstoneChipset redstoneChipset;
|
||||
public static ItemRedstoneBoard redstoneBoard;
|
||||
public static BlockLaser laserBlock;
|
||||
public static BlockLaserTable assemblyTableBlock;
|
||||
public static BlockZonePlan zonePlanBlock;
|
||||
public static BlockRequester requesterBlock;
|
||||
public static Item redstoneCrystal;
|
||||
public static Item robotItem;
|
||||
|
||||
public static ITriggerInternal triggerRobotSleep = new TriggerRobotSleep();
|
||||
|
||||
public static IActionInternal actionRobotGotoStation = new ActionRobotGotoStation();
|
||||
public static IActionInternal actionRobotWakeUp = new ActionRobotWakeUp();
|
||||
public static IActionInternal actionRobotWorkInArea = new ActionRobotWorkInArea();
|
||||
public static IActionInternal actionRobotFilter = new ActionRobotFilter();
|
||||
public static IActionInternal actionRobotFilterTool = new ActionRobotFilterTool();
|
||||
public static IActionInternal actionRobotAllowCraft = new ActionStationAllowCraft();
|
||||
public static IActionInternal actionStationRequestItems = new ActionStationRequestItems();
|
||||
public static IActionInternal actionStationAcceptItems = new ActionStationAcceptItemsInv();
|
||||
public static IActionInternal actionStationProvideItems = new ActionStationProvideItems();
|
||||
public static IActionInternal actionStationAcceptFluids = new ActionStationAcceptFluids();
|
||||
public static IActionInternal actionStationProvideFluids = new ActionStationProvideFluids();
|
||||
public static IActionInternal actionStationForbidRobot = new ActionStationForbidRobot();
|
||||
public static IActionInternal actionStationDropInPipe = new ActionStationAcceptItemsPipe();
|
||||
public static IActionInternal actionStationMachineRequestItems = new ActionStationRequestItemsMachine();
|
||||
|
||||
public static Achievement timeForSomeLogicAchievement;
|
||||
public static Achievement tinglyLaserAchievement;
|
||||
|
||||
public static float chipsetCostMultiplier = 1.0F;
|
||||
|
||||
public static List<String> blacklistedRobots;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
chipsetCostMultiplier = BuildCraftCore.mainConfiguration.getFloat("chipset.costMultiplier", "general", 1.0F, 0.001F, 1000.0F, "The multiplier for chipset recipe cost.");
|
||||
|
||||
blacklistedRobots = new ArrayList<String>();
|
||||
blacklistedRobots.addAll(Arrays.asList(BuildCraftCore.mainConfiguration.get("general", "boards.blacklist", new String[]{}).getStringList()));
|
||||
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
||||
laserBlock = (BlockLaser) CompatHooks.INSTANCE.getBlock(BlockLaser.class);
|
||||
laserBlock.setBlockName("laserBlock");
|
||||
|
@ -169,50 +98,16 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
CoreProxy.proxy.registerItem(redstoneChipset);
|
||||
redstoneChipset.registerItemStacks();
|
||||
|
||||
redstoneBoard = new ItemRedstoneBoard();
|
||||
redstoneBoard.setUnlocalizedName("redstone_board");
|
||||
CoreProxy.proxy.registerItem(redstoneBoard);
|
||||
|
||||
redstoneCrystal = (new ItemBuildCraft()).setUnlocalizedName("redstoneCrystal");
|
||||
CoreProxy.proxy.registerItem(redstoneCrystal);
|
||||
OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal));
|
||||
|
||||
robotItem = new ItemRobot().setUnlocalizedName("robot");
|
||||
CoreProxy.proxy.registerItem(robotItem);
|
||||
|
||||
RedstoneBoardRegistry.instance = new ImplRedstoneBoardRegistry();
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPickerNBT.instance, 20);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCarrierNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLumberjackNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotHarvesterNBT.instance, 10);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotMinerNBT.instance, 10);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFluidCarrierNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotButcherNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotShovelmanNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCrafterNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotDeliveryNBT.instance, 5);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPumpNBT.instance, 5);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1);
|
||||
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBuilderNBT.instance, 0.5F);
|
||||
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotStripesNBT.instance, 0.5F);
|
||||
|
||||
StatementManager.registerActionProvider(new RobotsActionProvider());
|
||||
StatementManager.registerTriggerProvider(new RobotsTriggerProvider());
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
channels = NetworkRegistry.INSTANCE
|
||||
.newChannel
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new BuildCraftChannelHandler(), new PacketHandlerSilicon());
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new ChannelHandler(), new PacketHandlerSilicon());
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
|
||||
|
@ -340,24 +235,6 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:redstoneCrystal", 10000000, new ItemStack(
|
||||
redstoneCrystal), new ItemStack(
|
||||
Blocks.redstone_block));
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(redstoneBoard),
|
||||
"PPP",
|
||||
"PRP",
|
||||
"PPP",
|
||||
'R', "dustRedstone",
|
||||
'P', Items.paper);
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(robotItem),
|
||||
"PPP",
|
||||
"PRP",
|
||||
"C C",
|
||||
'P', "ingotIron",
|
||||
'R', redstoneCrystal,
|
||||
'C', Chipset.DIAMOND.getStack());
|
||||
|
||||
BuildcraftRecipeRegistry.programmingTable.addRecipe(new BoardProgrammingRecipe());
|
||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new RobotIntegrationRecipe("buildcraft:robotIntegration"));
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
|
|
@ -45,23 +45,24 @@ import buildcraft.api.statements.ITriggerInternal;
|
|||
import buildcraft.api.statements.StatementManager;
|
||||
import buildcraft.api.transport.PipeManager;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.PowerMode;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.network.BuildCraftChannelHandler;
|
||||
import buildcraft.core.network.ChannelHandler;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.ColorUtils;
|
||||
import buildcraft.robots.ItemRobotStation;
|
||||
import buildcraft.robots.RobotStationPluggable;
|
||||
import buildcraft.robotics.ItemRobotStation;
|
||||
import buildcraft.robotics.RobotStationPluggable;
|
||||
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
|
||||
import buildcraft.transport.BlockFilteredBuffer;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.FacadePluggable;
|
||||
import buildcraft.transport.GuiHandler;
|
||||
import buildcraft.transport.IMCHandlerTransport;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.ItemGateCopier;
|
||||
import buildcraft.transport.ItemPipe;
|
||||
|
@ -82,7 +83,12 @@ import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
|||
import buildcraft.transport.gates.GateExpansionTimer;
|
||||
import buildcraft.transport.gates.GatePluggable;
|
||||
import buildcraft.transport.gates.ItemGate;
|
||||
import buildcraft.transport.network.PacketFluidUpdate;
|
||||
import buildcraft.transport.network.PacketHandlerTransport;
|
||||
import buildcraft.transport.network.PacketPipeTransportItemStack;
|
||||
import buildcraft.transport.network.PacketPipeTransportItemStackRequest;
|
||||
import buildcraft.transport.network.PacketPipeTransportTraveler;
|
||||
import buildcraft.transport.network.PacketPowerUpdate;
|
||||
import buildcraft.transport.pipes.PipeFluidsCobblestone;
|
||||
import buildcraft.transport.pipes.PipeFluidsDiamond;
|
||||
import buildcraft.transport.pipes.PipeFluidsEmerald;
|
||||
|
@ -244,6 +250,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
public static float gateCostMultiplier = 1.0F;
|
||||
|
||||
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
|
||||
private static ChannelHandler transportChannelHandler;
|
||||
|
||||
public IIconProvider pipeIconProvider = new PipeIconProvider();
|
||||
public IIconProvider wireIconProvider = new WireIconProvider();
|
||||
|
@ -434,12 +441,22 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
} finally {
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
}
|
||||
|
||||
InterModComms.registerHandler(new IMCHandlerTransport());
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
transportChannelHandler = new ChannelHandler();
|
||||
|
||||
transportChannelHandler.registerPacketType(PacketFluidUpdate.class);
|
||||
transportChannelHandler.registerPacketType(PacketPipeTransportItemStack.class);
|
||||
transportChannelHandler.registerPacketType(PacketPipeTransportItemStackRequest.class);
|
||||
transportChannelHandler.registerPacketType(PacketPipeTransportTraveler.class);
|
||||
transportChannelHandler.registerPacketType(PacketPowerUpdate.class);
|
||||
|
||||
channels = NetworkRegistry.INSTANCE.newChannel
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new BuildCraftChannelHandler(), new PacketHandlerTransport());
|
||||
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", transportChannelHandler, new PacketHandlerTransport());
|
||||
|
||||
TransportProxy.proxy.registerTileEntities();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.blueprints.BuildingPermission;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.blueprints.BlueprintId;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
|
|
|
@ -29,18 +29,19 @@ import buildcraft.BuildCraftCore;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.builders.blueprints.RecursiveBlueprintReader;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.IBoxProvider;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BlueprintReadConfiguration;
|
||||
import buildcraft.core.blueprints.RecursiveBlueprintReader;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver {
|
||||
|
@ -205,7 +206,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
@Override
|
||||
public void writeData(ByteBuf stream) {
|
||||
box.writeData(stream);
|
||||
Utils.writeUTF(stream, name);
|
||||
NetworkUtils.writeUTF(stream, name);
|
||||
readConfiguration.writeData(stream);
|
||||
stream.writeShort(subLasers.size());
|
||||
for (LaserData ld: subLasers) {
|
||||
|
@ -216,7 +217,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
box.readData(stream);
|
||||
name = Utils.readUTF(stream);
|
||||
name = NetworkUtils.readUTF(stream);
|
||||
readConfiguration.readData(stream);
|
||||
int size = stream.readUnsignedShort();
|
||||
subLasers.clear();
|
||||
|
@ -282,17 +283,17 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
return completeBox.getBoundingBox();
|
||||
}
|
||||
|
||||
public BuildCraftPacket getPacketSetName() {
|
||||
public Packet getPacketSetName() {
|
||||
return new PacketCommand(this, "setName", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeUTF(data, name);
|
||||
NetworkUtils.writeUTF(data, name);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
if ("setName".equals(command)) {
|
||||
this.name = Utils.readUTF(stream);
|
||||
this.name = NetworkUtils.readUTF(stream);
|
||||
if (side.isServer()) {
|
||||
BuildCraftCore.instance.sendToPlayersNear(getPacketSetName(), this);
|
||||
}
|
||||
|
|
|
@ -24,14 +24,15 @@ import cpw.mods.fml.relauncher.Side;
|
|||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
/**
|
||||
|
@ -243,7 +244,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory,
|
|||
new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
bpt.id.writeData(data);
|
||||
Utils.writeByteArray(data, bpt.getData());
|
||||
NetworkUtils.writeByteArray(data, bpt.getData());
|
||||
}
|
||||
}));
|
||||
uploadingPlayer = null;
|
||||
|
@ -303,7 +304,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory,
|
|||
} else if ("downloadBlueprintToClient".equals(command)) {
|
||||
BlueprintId id = new BlueprintId();
|
||||
id.readData(stream);
|
||||
byte[] data = Utils.readByteArray(stream);
|
||||
byte[] data = NetworkUtils.readByteArray(stream);
|
||||
|
||||
try {
|
||||
NBTTagCompound nbt = CompressedStreamTools.func_152457_a(data, NBTSizeTracker.field_152451_a);
|
||||
|
|
|
@ -43,6 +43,7 @@ import buildcraft.api.robots.IRequestProvider;
|
|||
import buildcraft.api.robots.StackRequest;
|
||||
import buildcraft.api.tiles.IControllable;
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
import buildcraft.builders.blueprints.RecursiveBlueprintBuilder;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.LaserData;
|
||||
|
@ -51,7 +52,6 @@ import buildcraft.core.blueprints.BlueprintBase;
|
|||
import buildcraft.core.blueprints.BptBuilderBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBlueprint;
|
||||
import buildcraft.core.blueprints.BptBuilderTemplate;
|
||||
import buildcraft.core.blueprints.RecursiveBlueprintBuilder;
|
||||
import buildcraft.core.builders.TileAbstractBuilder;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
|
@ -61,12 +61,12 @@ import buildcraft.core.inventory.InventoryIterator;
|
|||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
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.NetworkUtils;
|
||||
import buildcraft.robotics.ResourceIdRequest;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
|
||||
public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluidHandler, IRequestProvider, IControllable {
|
||||
|
||||
|
@ -644,7 +644,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
int size = stream.readUnsignedShort();
|
||||
requiredToBuild = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ItemStack stack = Utils.readStack(stream);
|
||||
ItemStack stack = NetworkUtils.readStack(stream);
|
||||
stack.stackSize = Math.min(999, stream.readUnsignedShort());
|
||||
requiredToBuild.add(stack);
|
||||
}
|
||||
|
@ -664,14 +664,14 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
}
|
||||
}
|
||||
|
||||
private BuildCraftPacket getItemRequirementsPacket(final ArrayList<ItemStack> items) {
|
||||
private Packet getItemRequirementsPacket(final ArrayList<ItemStack> items) {
|
||||
if (items != null) {
|
||||
return new PacketCommand(this, "setItemRequirements", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeShort(items.size());
|
||||
if (items != null) {
|
||||
for (ItemStack rb : items) {
|
||||
Utils.writeStack(data, rb);
|
||||
NetworkUtils.writeStack(data, rb);
|
||||
data.writeShort(rb.stackSize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ import buildcraft.core.blueprints.BptBuilderBlueprint;
|
|||
import buildcraft.core.blueprints.BptContext;
|
||||
import buildcraft.core.builders.BuildingItem;
|
||||
import buildcraft.core.builders.IBuildingItemsProvider;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
|
||||
public class TileConstructionMarker extends TileBuildCraft implements IBuildingItemsProvider, IBoxProvider, ICommandReceiver {
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class TileConstructionMarker extends TileBuildCraft implements IBuildingI
|
|||
}
|
||||
}
|
||||
|
||||
private BuildCraftPacket createLaunchItemPacket(final BuildingItem i) {
|
||||
private Packet createLaunchItemPacket(final BuildingItem i) {
|
||||
return new PacketCommand(this, "launchItem", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
i.writeData(data);
|
||||
|
@ -239,7 +239,7 @@ public class TileConstructionMarker extends TileBuildCraft implements IBuildingI
|
|||
laser.writeData(stream);
|
||||
}
|
||||
if (itemBlueprint != null) {
|
||||
Utils.writeStack(stream, itemBlueprint);
|
||||
NetworkUtils.writeStack(stream, itemBlueprint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ public class TileConstructionMarker extends TileBuildCraft implements IBuildingI
|
|||
laser = null;
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
itemBlueprint = Utils.readStack(stream);
|
||||
itemBlueprint = NetworkUtils.readStack(stream);
|
||||
} else {
|
||||
itemBlueprint = null;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import buildcraft.core.inventory.SimpleInventory;
|
|||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileFiller extends TileAbstractBuilder implements IHasWork, IControllable, ICommandReceiver, IStatementContainer {
|
||||
|
@ -302,18 +303,18 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro
|
|||
public void writeData(ByteBuf data) {
|
||||
box.writeData(data);
|
||||
data.writeBoolean(done);
|
||||
Utils.writeUTF(data, currentPattern.getUniqueTag());
|
||||
NetworkUtils.writeUTF(data, currentPattern.getUniqueTag());
|
||||
NBTTagCompound parameterData = new NBTTagCompound();
|
||||
writeParametersToNBT(parameterData);
|
||||
Utils.writeNBT(data, parameterData);
|
||||
NetworkUtils.writeNBT(data, parameterData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf data) {
|
||||
box.readData(data);
|
||||
done = data.readBoolean();
|
||||
FillerPattern pattern = (FillerPattern) FillerManager.registry.getPattern(Utils.readUTF(data));
|
||||
NBTTagCompound parameterData = Utils.readNBT(data);
|
||||
FillerPattern pattern = (FillerPattern) FillerManager.registry.getPattern(NetworkUtils.readUTF(data));
|
||||
NBTTagCompound parameterData = NetworkUtils.readNBT(data);
|
||||
readParametersFromNBT(parameterData);
|
||||
setPattern(pattern);
|
||||
|
||||
|
@ -341,7 +342,7 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro
|
|||
public void rpcSetPatternFromString (final String name) {
|
||||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setPattern", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeUTF(data, name);
|
||||
NetworkUtils.writeUTF(data, name);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -350,10 +351,10 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro
|
|||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
super.receiveCommand(command, side, sender, stream);
|
||||
if (side.isServer() && "setPattern".equals(command)) {
|
||||
String name = Utils.readUTF(stream);
|
||||
String name = NetworkUtils.readUTF(stream);
|
||||
setPattern((FillerPattern) FillerManager.registry.getPattern(name));
|
||||
} else if (side.isServer() && "setParameters".equals(command)) {
|
||||
NBTTagCompound patternData = Utils.readNBT(stream);
|
||||
NBTTagCompound patternData = NetworkUtils.readNBT(stream);
|
||||
readParametersFromNBT(patternData);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +396,7 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro
|
|||
public void write(ByteBuf data) {
|
||||
NBTTagCompound parameterData = new NBTTagCompound();
|
||||
writeParametersToNBT(parameterData);
|
||||
Utils.writeNBT(data, parameterData);
|
||||
NetworkUtils.writeNBT(data, parameterData);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -20,10 +20,11 @@ import net.minecraft.world.World;
|
|||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.core.IPathProvider;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.LaserData;
|
||||
|
||||
public class TilePathMarker extends TileMarker {
|
||||
public class TilePathMarker extends TileMarker implements IPathProvider {
|
||||
// A list with the pathMarkers that aren't fully connected
|
||||
// It only contains markers within the loaded chunks
|
||||
private static LinkedList<TilePathMarker> availableMarkers = new LinkedList<TilePathMarker>();
|
||||
|
|
|
@ -25,7 +25,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
|
||||
public class BlueprintDatabase {
|
||||
|
|
|
@ -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.blueprints;
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -17,8 +17,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.api.blueprints.BlueprintDeployer;
|
||||
import buildcraft.api.blueprints.Translation;
|
||||
import buildcraft.builders.blueprints.BlueprintDatabase;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BptBuilderBlueprint;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
|
||||
public class RealBlueprintDeployer extends BlueprintDeployer {
|
||||
|
|
@ -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.blueprints;
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -16,6 +16,12 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBlueprint;
|
||||
import buildcraft.core.blueprints.BptBuilderTemplate;
|
||||
import buildcraft.core.blueprints.Template;
|
||||
|
||||
public class RecursiveBlueprintBuilder {
|
||||
|
|
@ -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.blueprints;
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -22,7 +22,11 @@ import buildcraft.builders.ItemBlueprintTemplate;
|
|||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.builders.TileBuilder;
|
||||
import buildcraft.builders.TileConstructionMarker;
|
||||
import buildcraft.core.BlockScanner;
|
||||
import buildcraft.core.utils.BlockScanner;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
import buildcraft.core.blueprints.Template;
|
||||
|
||||
public class RecursiveBlueprintReader {
|
||||
|
|
@ -15,7 +15,6 @@ import net.minecraft.inventory.Slot;
|
|||
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import buildcraft.core.gui.slots.SlotArchitect;
|
||||
import buildcraft.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerArchitect extends BuildCraftContainer {
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.inventory.Slot;
|
|||
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import buildcraft.core.gui.slots.SlotBlueprintLibrary;
|
||||
import buildcraft.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerBlueprintLibrary extends BuildCraftContainer {
|
||||
|
|
|
@ -29,6 +29,7 @@ import buildcraft.core.gui.tooltips.ToolTip;
|
|||
import buildcraft.core.gui.tooltips.ToolTipLine;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
|
@ -170,7 +171,7 @@ public class GuiArchitect extends GuiBuildCraft {
|
|||
final String text = textField.getText();
|
||||
BuildCraftCore.instance.sendToServer(new PacketCommand(architect, "setName", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeUTF(data, text);
|
||||
NetworkUtils.writeUTF(data, text);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.GuiBuildCraft;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
* 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.gui.slots;
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.slots.SlotBase;
|
||||
|
||||
public class SlotArchitect extends SlotBase {
|
||||
private TileArchitect architect;
|
|
@ -6,12 +6,13 @@
|
|||
* 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.gui.slots;
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.gui.slots.SlotBase;
|
||||
|
||||
public class SlotBlueprintLibrary extends SlotBase {
|
||||
private TileBlueprintLibrary library;
|
|
@ -28,11 +28,11 @@ import buildcraft.core.Box;
|
|||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.IBoxesProvider;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
|
||||
public class TileUrbanist extends TileBuildCraft implements IInventory, IBoxesProvider, ICommandReceiver {
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class TileUrbanist extends TileBuildCraft implements IInventory, IBoxesPr
|
|||
super.updateEntity();
|
||||
}
|
||||
|
||||
private BuildCraftPacket createXYZPacket(String name, final int x, final int y, final int z) {
|
||||
private Packet createXYZPacket(String name, final int x, final int y, final int z) {
|
||||
return new PacketCommand(this, name, new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeInt(x);
|
||||
|
@ -102,7 +102,7 @@ public class TileUrbanist extends TileBuildCraft implements IInventory, IBoxesPr
|
|||
if (side.isClient() && "setFrameKind".equals(command)) {
|
||||
setFrameKind(stream.readInt(), stream.readInt());
|
||||
} else if (side.isServer() && "startFiller".equals(command)) {
|
||||
String fillerTag = Utils.readUTF(stream);
|
||||
String fillerTag = NetworkUtils.readUTF(stream);
|
||||
Box box = new Box();
|
||||
box.readData(stream);
|
||||
|
||||
|
@ -218,7 +218,7 @@ public class TileUrbanist extends TileBuildCraft implements IInventory, IBoxesPr
|
|||
public void rpcStartFiller (final String fillerTag, final Box box) {
|
||||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "startFiller", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeUTF(data, fillerTag);
|
||||
NetworkUtils.writeUTF(data, fillerTag);
|
||||
box.writeData(data);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -22,6 +22,7 @@ import buildcraft.core.gui.BuildCraftContainer;
|
|||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class ContainerRequester extends BuildCraftContainer implements ICommandReceiver {
|
||||
|
@ -77,14 +78,14 @@ public class ContainerRequester extends BuildCraftContainer implements ICommandR
|
|||
new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
for (ItemStack s : stacks) {
|
||||
Utils.writeStack(data, s);
|
||||
NetworkUtils.writeStack(data, s);
|
||||
}
|
||||
}
|
||||
}));
|
||||
} else if (side.isClient() && "receiveRequestList".equals(command)) {
|
||||
requests = new ItemStack[TileRequester.NB_ITEMS];
|
||||
for (int i = 0; i < TileRequester.NB_ITEMS; i++) {
|
||||
requests[i] = Utils.readStack(stream);
|
||||
requests[i] = NetworkUtils.readStack(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.inventory.Slot;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.BCDynamicTexture;
|
||||
import buildcraft.core.render.BCDynamicTexture;
|
||||
import buildcraft.core.ZonePlan;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import buildcraft.core.gui.slots.SlotOutput;
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.EnumColor;
|
||||
import buildcraft.core.BCDynamicTexture;
|
||||
import buildcraft.core.render.BCDynamicTexture;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.ZonePlan;
|
||||
import buildcraft.core.gui.AdvancedSlot;
|
||||
|
|
|
@ -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.NetworkUtils;
|
||||
import buildcraft.robotics.ResourceIdRequest;
|
||||
import buildcraft.robotics.RobotRegistry;
|
||||
|
||||
public class TileRequester extends TileBuildCraft implements IInventory, IRequestProvider, ICommandReceiver {
|
||||
public static final int NB_ITEMS = 20;
|
||||
|
@ -46,7 +46,7 @@ public class TileRequester extends TileBuildCraft implements IInventory, IReques
|
|||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setRequest", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeByte(index);
|
||||
Utils.writeStack(data, stack);
|
||||
NetworkUtils.writeStack(data, stack);
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
|
@ -57,7 +57,7 @@ public class TileRequester extends TileBuildCraft implements IInventory, IReques
|
|||
@Override
|
||||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
if (side.isServer() && "setRequest".equals(command)) {
|
||||
setRequest(stream.readUnsignedByte(), Utils.readStack(stream));
|
||||
setRequest(stream.readUnsignedByte(), NetworkUtils.readStack(stream));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
@ -13,6 +11,7 @@ public class AchievementManager {
|
|||
|
||||
public AchievementManager() {
|
||||
page = new AchievementPage("BuildCraft");
|
||||
AchievementPage.registerAchievementPage(page);
|
||||
}
|
||||
|
||||
public Achievement registerAchievement(Achievement a) {
|
||||
|
@ -20,10 +19,6 @@ public class AchievementManager {
|
|||
return a;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
AchievementPage.registerAchievementPage(page);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
|
||||
Item item = event.crafting.getItem();
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
|
||||
public class BlockWrapper {
|
||||
public BlockIndex index;
|
||||
public TileEntity tile;
|
||||
public Block block;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
|
||||
public interface BoxProvider {
|
||||
ArrayList<IBox> getBoxes();
|
||||
}
|
|
@ -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.compat;
|
||||
package buildcraft.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.BuildCraftRobotics;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
||||
|
@ -52,7 +53,7 @@ public enum CreativeTabBuildCraft {
|
|||
case FACADES:
|
||||
return BuildCraftTransport.facadeItem.getFacadeForBlock(Blocks.brick_block, 0);
|
||||
case BOARDS:
|
||||
return new ItemStack(BuildCraftSilicon.redstoneBoard, 1);
|
||||
return new ItemStack(BuildCraftRobotics.redstoneBoard, 1);
|
||||
}
|
||||
|
||||
return BuildCraftTransport.facadeItem.getFacadeForBlock(Blocks.brick_block, 0);
|
||||
|
|
|
@ -14,6 +14,8 @@ public final class DefaultProps {
|
|||
|
||||
public static final String DEPENDENCY_CORE = "required-after:BuildCraft|Core@" + Version.VERSION;
|
||||
public static final String DEPENDENCY_TRANSPORT = "required-after:BuildCraft|Transport@" + Version.VERSION;
|
||||
public static final String DEPENDENCY_SILICON = "required-after:BuildCraft|Silicon@" + Version.VERSION;
|
||||
public static final String DEPENDENCY_SILICON_TRANSPORT = DEPENDENCY_TRANSPORT + ";" + DEPENDENCY_SILICON;
|
||||
|
||||
public static final String NET_CHANNEL_NAME = "BC";
|
||||
public static int NETWORK_UPDATE_RANGE = 64;
|
||||
|
@ -28,13 +30,8 @@ public final class DefaultProps {
|
|||
|
||||
public static String PUMP_DIMENSION_LIST = "+/*/*,+/-1/lava";
|
||||
|
||||
public static boolean CURRENT_CONTINUOUS = false;
|
||||
public static double PIPES_DURABILITY = 0.25D;
|
||||
public static int PIPES_FLUIDS_BASE_FLOW_RATE = 10;
|
||||
public static boolean FILLER_DESTROY = false;
|
||||
|
||||
public static final int FILLER_LIFESPAN_TOUGH = 20;
|
||||
public static final int FILLER_LIFESPAN_NORMAL = 6000;
|
||||
public static int PIPES_FLUIDS_BASE_FLOW_RATE = 10;
|
||||
|
||||
public static int BIOME_OIL_OCEAN = 126;
|
||||
public static int BIOME_OIL_DESERT = 127;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBuildCraftItem extends EntityItem {
|
||||
public EntityBuildCraftItem(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
}
|
8
common/buildcraft/core/IMCHandler.java
Normal file
8
common/buildcraft/core/IMCHandler.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public abstract class IMCHandler {
|
||||
public abstract void processIMCEvent(IMCEvent event, IMCMessage m);
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core;
|
||||
|
||||
/**
|
||||
* Left only to stop certain mods depending on it from crashing.
|
||||
* Please move to the classes contained in buildcraft.api.tiles
|
||||
* and IPipeConnection from .transport.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IMachine {
|
||||
boolean isActive();
|
||||
|
||||
boolean manageFluids();
|
||||
|
||||
boolean manageSolids();
|
||||
}
|
|
@ -9,73 +9,49 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
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;
|
||||
|
||||
public final class InterModComms {
|
||||
|
||||
private static final Set<IMCHandler> handlers = new HashSet<IMCHandler>();
|
||||
/**
|
||||
* Deactivate constructor
|
||||
*/
|
||||
private InterModComms() {
|
||||
}
|
||||
|
||||
public static void registerHandler(IMCHandler handler) {
|
||||
handlers.add(handler);
|
||||
}
|
||||
|
||||
public static void processIMC(IMCEvent event) {
|
||||
for (IMCMessage m : event.getMessages()) {
|
||||
if (m.key.equals("add-facade")) {
|
||||
processAddFacadeIMC(event, m);
|
||||
} else if (m.key.equals("blacklist-facade")) {
|
||||
processBlacklistFacadeIMC(event, m);
|
||||
} else if (m.key.equals("oil-lake-biome")) {
|
||||
processOilLakeBiomeIMC(event, m);
|
||||
} else if (m.key.equals("oil-gen-exclude")) {
|
||||
processOilGenExcludeIMC(event, m);
|
||||
} else if (m.key.equals("add-assembly-recipe")) {
|
||||
if (m.key.equals("add-assembly-recipe")) {
|
||||
processAssemblyRecipeAddIMC(event, m);
|
||||
} else if (m.key.equals("add-refinery-recipe")) {
|
||||
processRefineryRecipeAddIMC(event, m);
|
||||
} else if (m.key.equals("add-gate-expansion-recipe")) {
|
||||
processGateExpansionRecipeAddIMC(event, m);
|
||||
} else if (m.key.equals("remove-assembly-recipe")) {
|
||||
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()}));
|
||||
for (IMCHandler h : handlers) {
|
||||
h.processIMCEvent(event, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,32 +71,7 @@ public final class InterModComms {
|
|||
BCLog.logger.info(String.format("Received a refinery recipe '%s' removal request from mod %s", msg.getStringValue(), msg.getSender()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void processGateExpansionRecipeAddIMC(IMCEvent event, IMCMessage msg) {
|
||||
boolean failed = false;
|
||||
if (!msg.isNBTMessage()) {
|
||||
failed = true;
|
||||
} else {
|
||||
NBTTagCompound recipe = msg.getNBTValue();
|
||||
if (!recipe.hasKey("id") || !recipe.hasKey("expansion") || !recipe.hasKey("input")) {
|
||||
failed = true;
|
||||
return;
|
||||
}
|
||||
IGateExpansion exp = GateExpansions.getExpansion(recipe.getString("expansion"));
|
||||
ItemStack is = ItemStack.loadItemStackFromNBT(recipe.getCompoundTag("input"));
|
||||
if (exp == null || is == null) {
|
||||
failed = true;
|
||||
return;
|
||||
}
|
||||
IntegrationRecipeManager.INSTANCE.addRecipe(new GateExpansionRecipe(
|
||||
recipe.getString("id"), exp, is
|
||||
));
|
||||
}
|
||||
if (failed) {
|
||||
BCLog.logger.warn("Received invalid gate expansion recipe IMC message from mod %s!", msg.getSender());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void processAssemblyRecipeAddIMC(IMCEvent event, IMCMessage msg) {
|
||||
boolean failed = false;
|
||||
if (!msg.isNBTMessage()) {
|
||||
|
@ -183,115 +134,4 @@ public final class InterModComms {
|
|||
BCLog.logger.warn("Received invalid refinery recipe IMC message from mod %s!", msg.getSender());
|
||||
}
|
||||
}
|
||||
|
||||
public static void processAddFacadeIMC(IMCEvent event, IMCMessage m) {
|
||||
try {
|
||||
if (m.isStringMessage()) {
|
||||
Splitter splitter = Splitter.on("@").trimResults();
|
||||
|
||||
String[] array = Iterables.toArray(splitter.split(m.getStringValue()), String.class);
|
||||
if (array.length != 2) {
|
||||
BCLog.logger.info(String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
} else {
|
||||
String blockName = array[0];
|
||||
Integer metaId = Ints.tryParse(array[1]);
|
||||
|
||||
if (Strings.isNullOrEmpty(blockName) || metaId == null) {
|
||||
BCLog.logger.info(String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
} else {
|
||||
Block block = (Block) Block.blockRegistry.getObject(blockName);
|
||||
BuildCraftTransport.facadeItem.addFacade(new ItemStack(block, 1, metaId));
|
||||
}
|
||||
}
|
||||
} else if (m.isItemStackMessage()) {
|
||||
ItemStack modItemStack = m.getItemStackValue();
|
||||
BuildCraftTransport.facadeItem.addFacade(modItemStack);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void processBlacklistFacadeIMC(IMCEvent event, IMCMessage message) {
|
||||
try {
|
||||
if (message.isItemStackMessage()) {
|
||||
ItemStack modItemStack = message.getItemStackValue();
|
||||
|
||||
Block block = Block.getBlockFromItem(modItemStack.getItem());
|
||||
if (block != null) {
|
||||
String blockName = Block.blockRegistry.getNameForObject(block);
|
||||
ItemFacade.blacklistFacade(blockName);
|
||||
}
|
||||
} else {
|
||||
BCLog.logger.info(String.format("Invalid blacklist-facade message from mod %s. Send an ItemStackMessage instead.", message.getSender()));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void processOilLakeBiomeIMC(IMCEvent event, IMCMessage m) {
|
||||
try {
|
||||
String biomeID = m.getStringValue().trim();
|
||||
int id = Integer.valueOf(biomeID);
|
||||
if (id >= BiomeGenBase.getBiomeGenArray().length) {
|
||||
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
|
||||
}
|
||||
OilPopulate.INSTANCE.surfaceDepositBiomes.add(id);
|
||||
} catch (Exception ex) {
|
||||
BCLog.logger.warn(String.format("Received an invalid oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
BCLog.logger.info(String.format("Received a successful oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
|
||||
public static void processOilGenExcludeIMC(IMCEvent event, IMCMessage m) {
|
||||
try {
|
||||
String biomeID = m.getStringValue().trim();
|
||||
int id = Integer.valueOf(biomeID);
|
||||
if (id >= BiomeGenBase.getBiomeGenArray().length) {
|
||||
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
|
||||
}
|
||||
OilPopulate.INSTANCE.excludedBiomes.add(id);
|
||||
} catch (Exception ex) {
|
||||
BCLog.logger.warn(String.format("Received an invalid oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.IPathProvider;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.items.IMapLocation;
|
||||
import buildcraft.builders.TileMarker;
|
||||
import buildcraft.builders.TilePathMarker;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -145,24 +145,22 @@ public class ItemMapLocation extends ItemBuildCraft implements IMapLocation {
|
|||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
NBTTagCompound cpt = NBTUtils.getItemData(stack);
|
||||
|
||||
if (tile instanceof TilePathMarker) {
|
||||
if (tile instanceof IPathProvider) {
|
||||
cpt.setByte("kind", (byte) 2);
|
||||
|
||||
TilePathMarker pathTile = (TilePathMarker) tile;
|
||||
|
||||
NBTTagList pathNBT = new NBTTagList();
|
||||
|
||||
for (BlockIndex index : pathTile.getPath()) {
|
||||
for (BlockIndex index : ((IPathProvider) tile).getPath()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
index.writeTo(nbt);
|
||||
pathNBT.appendTag(nbt);
|
||||
}
|
||||
|
||||
cpt.setTag("path", pathNBT);
|
||||
} else if (tile instanceof TileMarker) {
|
||||
} else if (tile instanceof IAreaProvider) {
|
||||
cpt.setByte("kind", (byte) 1);
|
||||
|
||||
TileMarker areaTile = (TileMarker) tile;
|
||||
IAreaProvider areaTile = (IAreaProvider) tile;
|
||||
|
||||
cpt.setInteger("xMin", areaTile.xMin());
|
||||
cpt.setInteger("yMin", areaTile.yMin());
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class StackAtPosition implements ISerializable {
|
||||
|
@ -23,11 +24,11 @@ public class StackAtPosition implements ISerializable {
|
|||
|
||||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
stack = Utils.readStack(stream);
|
||||
stack = NetworkUtils.readStack(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(ByteBuf stream) {
|
||||
Utils.writeStack(stream, stack);
|
||||
NetworkUtils.writeStack(stream, stack);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -27,7 +26,7 @@ import cofh.api.energy.IEnergyHandler;
|
|||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.api.tiles.IControllable;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.ISynchronizedTile;
|
||||
import buildcraft.core.network.PacketTileUpdate;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
@ -120,12 +119,12 @@ public abstract class TileBuildCraft extends TileEntity implements IEnergyHandle
|
|||
|
||||
}
|
||||
|
||||
public BuildCraftPacket getPacketUpdate() {
|
||||
public Packet getPacketUpdate() {
|
||||
return new PacketTileUpdate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
public net.minecraft.network.Packet getDescriptionPacket() {
|
||||
return Utils.toPacket(getPacketUpdate(), 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.core.utils.BitSetUtils;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class ZoneChunk implements ISerializable {
|
||||
|
@ -114,7 +115,7 @@ public class ZoneChunk implements ISerializable {
|
|||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
if (stream.readBoolean()) {
|
||||
property = BitSetUtils.fromByteArray(Utils.readByteArray(stream));
|
||||
property = BitSetUtils.fromByteArray(NetworkUtils.readByteArray(stream));
|
||||
}
|
||||
fullSet = stream.readBoolean();
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ public class ZoneChunk implements ISerializable {
|
|||
public void writeData(ByteBuf stream) {
|
||||
if (property != null) {
|
||||
stream.writeBoolean(true);
|
||||
Utils.writeByteArray(stream, BitSetUtils.toByteArray(property));
|
||||
NetworkUtils.writeByteArray(stream, BitSetUtils.toByteArray(property));
|
||||
} else {
|
||||
stream.writeBoolean(false);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import buildcraft.api.blueprints.SchematicBlock;
|
|||
import buildcraft.api.blueprints.SchematicEntity;
|
||||
import buildcraft.api.blueprints.Translation;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
|
||||
public class Blueprint extends BlueprintBase {
|
||||
|
|
|
@ -30,7 +30,6 @@ import buildcraft.api.blueprints.Translation;
|
|||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.builders.ItemBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Version;
|
||||
|
||||
|
|
|
@ -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.builders.blueprints;
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -20,6 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public final class BlueprintId implements Comparable<BlueprintId>, ISerializable {
|
||||
|
@ -140,15 +141,15 @@ public final class BlueprintId implements Comparable<BlueprintId>, ISerializable
|
|||
|
||||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
uniqueId = Utils.readByteArray(stream);
|
||||
name = Utils.readUTF(stream);
|
||||
uniqueId = NetworkUtils.readByteArray(stream);
|
||||
name = NetworkUtils.readUTF(stream);
|
||||
kind = Kind.values()[stream.readUnsignedByte()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(ByteBuf stream) {
|
||||
Utils.writeByteArray(stream, uniqueId);
|
||||
Utils.writeUTF(stream, name);
|
||||
NetworkUtils.writeByteArray(stream, uniqueId);
|
||||
NetworkUtils.writeUTF(stream, name);
|
||||
stream.writeByte(kind.ordinal());
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import buildcraft.BuildCraftBuilders;
|
|||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
import buildcraft.api.blueprints.SchematicMask;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.builders.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.blueprints.BlueprintId.Kind;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ import buildcraft.core.IBoxProvider;
|
|||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.RFBattery;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
|
@ -59,7 +59,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
|
|||
}
|
||||
}
|
||||
|
||||
private BuildCraftPacket createLaunchItemPacket(final BuildingItem i) {
|
||||
private Packet createLaunchItemPacket(final BuildingItem i) {
|
||||
return new PacketCommand(this, "launchItem", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
i.writeData(data);
|
||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.core.ItemList;
|
|||
import buildcraft.core.network.CommandWriter;
|
||||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class ContainerList extends BuildCraftContainer implements ICommandReceiver {
|
||||
|
@ -60,7 +61,7 @@ public class ContainerList extends BuildCraftContainer implements ICommandReceiv
|
|||
public void write(ByteBuf data) {
|
||||
data.writeByte(lineIndex);
|
||||
data.writeByte(slotIndex);
|
||||
Utils.writeStack(data, stack);
|
||||
NetworkUtils.writeStack(data, stack);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ public class ContainerList extends BuildCraftContainer implements ICommandReceiv
|
|||
if (player.worldObj.isRemote) {
|
||||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setLabel", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeUTF(data, text);
|
||||
NetworkUtils.writeUTF(data, text);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -103,11 +104,11 @@ public class ContainerList extends BuildCraftContainer implements ICommandReceiv
|
|||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
if (side.isServer()) {
|
||||
if ("setLabel".equals(command)) {
|
||||
setLabel(Utils.readUTF(stream));
|
||||
setLabel(NetworkUtils.readUTF(stream));
|
||||
} else if ("switchButton".equals(command)) {
|
||||
switchButton(stream.readUnsignedByte(), stream.readUnsignedByte());
|
||||
} else if ("setStack".equals(command)) {
|
||||
setStack(stream.readUnsignedByte(), stream.readUnsignedByte(), Utils.readStack(stream));
|
||||
setStack(stream.readUnsignedByte(), stream.readUnsignedByte(), NetworkUtils.readStack(stream));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import buildcraft.core.utils.INBTTagable;
|
||||
import buildcraft.api.core.INBTStoreable;
|
||||
|
||||
public class SimpleInventory implements IInventory, INBTTagable {
|
||||
public class SimpleInventory implements IInventory, INBTStoreable {
|
||||
|
||||
private final ItemStack[] contents;
|
||||
private final String name;
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
|
||||
import buildcraft.transport.network.PacketFluidUpdate;
|
||||
import buildcraft.transport.network.PacketPipeTransportItemStack;
|
||||
import buildcraft.transport.network.PacketPipeTransportItemStackRequest;
|
||||
import buildcraft.transport.network.PacketPipeTransportTraveler;
|
||||
import buildcraft.transport.network.PacketPowerUpdate;
|
||||
|
||||
public class BuildCraftChannelHandler extends FMLIndexedMessageToMessageCodec<BuildCraftPacket> {
|
||||
|
||||
public BuildCraftChannelHandler() {
|
||||
addDiscriminator(0, PacketTileUpdate.class);
|
||||
addDiscriminator(1, PacketTileState.class);
|
||||
addDiscriminator(2, PacketFluidUpdate.class);
|
||||
addDiscriminator(3, PacketNBT.class);
|
||||
addDiscriminator(4, PacketPowerUpdate.class);
|
||||
addDiscriminator(5, PacketSlotChange.class);
|
||||
addDiscriminator(6, PacketGuiReturn.class);
|
||||
addDiscriminator(7, PacketGuiWidget.class);
|
||||
addDiscriminator(8, PacketPipeTransportItemStack.class);
|
||||
addDiscriminator(9, PacketPipeTransportItemStackRequest.class);
|
||||
addDiscriminator(10, PacketPipeTransportTraveler.class);
|
||||
addDiscriminator(11, PacketUpdate.class);
|
||||
addDiscriminator(12, PacketCommand.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, BuildCraftPacket packet, ByteBuf data) throws Exception {
|
||||
packet.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
||||
packet.readData(data);
|
||||
}
|
||||
}
|
45
common/buildcraft/core/network/ChannelHandler.java
Executable file
45
common/buildcraft/core/network/ChannelHandler.java
Executable file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
|
||||
public class ChannelHandler extends FMLIndexedMessageToMessageCodec<Packet> {
|
||||
private int maxDiscriminator;
|
||||
|
||||
public ChannelHandler() {
|
||||
// Packets common to buildcraft.core.network
|
||||
addDiscriminator(0, PacketTileUpdate.class);
|
||||
addDiscriminator(1, PacketTileState.class);
|
||||
addDiscriminator(2, PacketNBT.class);
|
||||
addDiscriminator(3, PacketSlotChange.class);
|
||||
addDiscriminator(4, PacketGuiReturn.class);
|
||||
addDiscriminator(5, PacketGuiWidget.class);
|
||||
addDiscriminator(6, PacketUpdate.class);
|
||||
addDiscriminator(7, PacketCommand.class);
|
||||
maxDiscriminator = 8;
|
||||
}
|
||||
|
||||
public void registerPacketType(Class<? extends Packet> packetType) {
|
||||
addDiscriminator(maxDiscriminator++, packetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, Packet packet, ByteBuf data) throws Exception {
|
||||
packet.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, Packet packet) {
|
||||
packet.readData(data);
|
||||
}
|
||||
}
|
|
@ -9,5 +9,5 @@
|
|||
package buildcraft.core.network;
|
||||
|
||||
public interface ISynchronizedTile {
|
||||
BuildCraftPacket getPacketUpdate();
|
||||
Packet getPacketUpdate();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ package buildcraft.core.network;
|
|||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public abstract class BuildCraftPacket {
|
||||
public abstract class Packet {
|
||||
|
||||
protected boolean isChunkDataPacket = false;
|
||||
|
|
@ -16,9 +16,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
|
||||
public class PacketCommand extends BuildCraftPacket {
|
||||
public class PacketCommand extends Packet {
|
||||
public static final ArrayList<CommandTarget> targets;
|
||||
public ByteBuf stream;
|
||||
public String command;
|
||||
|
@ -65,7 +65,7 @@ public class PacketCommand extends BuildCraftPacket {
|
|||
|
||||
@Override
|
||||
public void writeData(ByteBuf data) {
|
||||
Utils.writeUTF(data, command);
|
||||
NetworkUtils.writeUTF(data, command);
|
||||
data.writeByte(targets.indexOf(handler));
|
||||
handler.write(data, target);
|
||||
if (writer != null) {
|
||||
|
@ -75,7 +75,7 @@ public class PacketCommand extends BuildCraftPacket {
|
|||
|
||||
@Override
|
||||
public void readData(ByteBuf data) {
|
||||
command = Utils.readUTF(data);
|
||||
command = NetworkUtils.readUTF(data);
|
||||
handler = targets.get(data.readUnsignedByte());
|
||||
stream = data; // for further reading
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ package buildcraft.core.network;
|
|||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public abstract class PacketCoordinates extends BuildCraftPacket {
|
||||
public abstract class PacketCoordinates extends Packet {
|
||||
|
||||
public int posX;
|
||||
public int posY;
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.DimensionManager;
|
|||
|
||||
import buildcraft.BuildCraftCore;
|
||||
|
||||
public class PacketGuiReturn extends BuildCraftPacket {
|
||||
public class PacketGuiReturn extends Packet {
|
||||
private EntityPlayer sender;
|
||||
private IGuiReturnHandler obj;
|
||||
private byte[] extraData;
|
||||
|
|
|
@ -16,7 +16,7 @@ import cpw.mods.fml.client.FMLClientHandler;
|
|||
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class PacketGuiWidget extends BuildCraftPacket {
|
||||
public class PacketGuiWidget extends Packet {
|
||||
|
||||
private byte windowId, widgetId;
|
||||
private byte[] payload;
|
||||
|
|
|
@ -25,7 +25,7 @@ import buildcraft.api.core.ISerializable;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
@Sharable
|
||||
public class PacketHandler extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||
public class PacketHandler extends SimpleChannelInboundHandler<Packet> {
|
||||
private void onTileUpdate(EntityPlayer player, PacketTileUpdate packet) throws IOException {
|
||||
World world = player.worldObj;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class PacketHandler extends SimpleChannelInboundHandler<BuildCraftPacket>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Packet packet) {
|
||||
try {
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.netty.buffer.ByteBuf;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class PacketSlotChange extends PacketCoordinates {
|
||||
|
@ -33,7 +34,7 @@ public class PacketSlotChange extends PacketCoordinates {
|
|||
super.writeData(data);
|
||||
|
||||
data.writeShort(slot);
|
||||
Utils.writeStack(data, stack);
|
||||
NetworkUtils.writeStack(data, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +42,6 @@ public class PacketSlotChange extends PacketCoordinates {
|
|||
super.readData(data);
|
||||
|
||||
this.slot = data.readUnsignedShort();
|
||||
stack = Utils.readStack(data);
|
||||
stack = NetworkUtils.readStack(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
|
|||
|
||||
import buildcraft.api.core.ISerializable;
|
||||
|
||||
public class PacketUpdate extends BuildCraftPacket {
|
||||
public class PacketUpdate extends Packet {
|
||||
|
||||
public int posX;
|
||||
public int posY;
|
||||
|
|
|
@ -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.properties;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
|
@ -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.properties;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirt;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFarmland;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCactus;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
|
@ -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.properties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockClay;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
|
@ -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.properties;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
|
@ -37,7 +37,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.ICoreProxy;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.ItemBlockBuildCraft;
|
||||
import buildcraft.core.LaserKind;
|
||||
|
@ -78,9 +78,6 @@ public class CoreProxy implements ICoreProxy {
|
|||
}
|
||||
|
||||
/* GFX */
|
||||
public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) {
|
||||
}
|
||||
|
||||
public void initializeRendering() {
|
||||
}
|
||||
|
||||
|
@ -130,14 +127,6 @@ public class CoreProxy implements ICoreProxy {
|
|||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe));
|
||||
}
|
||||
|
||||
public int addCustomTexture(String pathToTexture) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Random createNewRandom(World world) {
|
||||
return new Random(world.getSeed());
|
||||
}
|
||||
|
||||
public String playerName() {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -27,18 +27,12 @@ import net.minecraft.world.World;
|
|||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.LaserKind;
|
||||
import buildcraft.core.render.RenderEntityBlock;
|
||||
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 {
|
||||
|
||||
|
@ -83,12 +77,6 @@ public class CoreProxyClient extends CoreProxy {
|
|||
return stack.getDisplayName();
|
||||
}
|
||||
|
||||
/* GFX */
|
||||
@Override
|
||||
public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) {
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new TileEntityPickupFX(world, item, tile));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeRendering() {
|
||||
BuildCraftCore.blockByEntityModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
@ -98,15 +86,11 @@ public class CoreProxyClient extends CoreProxy {
|
|||
RenderingRegistry.registerBlockHandler(new RenderingEntityBlocks());
|
||||
RenderingRegistry.registerBlockHandler(BuildCraftCore.legacyPipeModel, new RenderingEntityBlocks());
|
||||
RenderingRegistry.registerBlockHandler(new RenderingMarkers());
|
||||
|
||||
// TODO: Move these to a Silicon proxy renderer
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftSilicon.robotItem, new RenderRobot());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeEntityRendering() {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBlock.class, RenderEntityBlock.INSTANCE);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new RenderRobot());
|
||||
}
|
||||
|
||||
/* BUILDCRAFT PLAYER */
|
||||
|
|
|
@ -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;
|
||||
package buildcraft.core.render;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
|
@ -19,8 +19,8 @@ import buildcraft.api.statements.IStatement;
|
|||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementMouseClick;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
public class StatementParameterDirection implements IStatementParameter {
|
||||
|
||||
|
@ -48,10 +48,10 @@ public class StatementParameterDirection implements IStatementParameter {
|
|||
|
||||
@Override
|
||||
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
|
||||
if (source.getTile() instanceof TileGenericPipe) {
|
||||
if (source.getTile() instanceof IPipeTile) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
direction = ForgeDirection.getOrientation((direction.ordinal() + (mouse.getButton() > 0 ? -1 : 1)) % 6);
|
||||
if (((TileGenericPipe) source.getTile()).isPipeConnected(direction)) {
|
||||
if (((IPipeTile) source.getTile()).isPipeConnected(direction)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
*/
|
||||
package buildcraft.core.utils;
|
||||
|
||||
public class AverageUtil {
|
||||
public class Average {
|
||||
private double[] data;
|
||||
private int pos, precise;
|
||||
private double averageRaw, tickValue;
|
||||
|
||||
public AverageUtil(int precise) {
|
||||
public Average(int precise) {
|
||||
this.precise = precise;
|
||||
this.data = new double[precise];
|
||||
this.pos = 0;
|
|
@ -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;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.core.Box;
|
||||
|
||||
public class BlockScanner implements Iterable<BlockIndex> {
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
package buildcraft.core;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.core.BlockScanner.BlockIt;
|
||||
|
||||
public class BlockScannerExpanding implements Iterable<BlockIndex> {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package buildcraft.core;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
|
@ -1,4 +1,4 @@
|
|||
package buildcraft.core;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
|
@ -37,8 +37,6 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.api.blueprints.BuilderAPI;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
|
@ -132,7 +130,8 @@ public final class BlockUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (block == BuildCraftEnergy.blockOil) {
|
||||
// TODO: Make this support all "heavy" liquids, not just oil/lava
|
||||
if (block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null && ((IFluidBlock) block).getFluid().getName().equals("oil")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -220,7 +219,7 @@ public final class BlockUtils {
|
|||
}
|
||||
|
||||
public static int computeBlockBreakEnergy(World world, int x, int y, int z) {
|
||||
return (int) Math.floor(BuilderAPI.BREAK_ENERGY * BuildCraftFactory.miningMultiplier * ((world.getBlock(x, y, z).getBlockHardness(world, x, y, z) + 1) * 2));
|
||||
return (int) Math.floor(BuilderAPI.BREAK_ENERGY * BuildCraftCore.miningMultiplier * ((world.getBlock(x, y, z).getBlockHardness(world, x, y, z) + 1) * 2));
|
||||
}
|
||||
|
||||
public static TileEntity getTileEntity(World world, int x, int y, int z) {
|
||||
|
|
|
@ -19,12 +19,12 @@ import net.minecraft.item.crafting.IRecipe;
|
|||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class CraftingHelper {
|
||||
public final class CraftingUtils {
|
||||
|
||||
/**
|
||||
* Deactivate constructor
|
||||
*/
|
||||
private CraftingHelper() {
|
||||
private CraftingUtils() {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
@ -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.concurrency;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
public interface IIterableAlgorithm {
|
||||
|
|
@ -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.concurrency;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.Date;
|
||||
|
111
common/buildcraft/core/utils/NetworkUtils.java
Normal file
111
common/buildcraft/core/utils/NetworkUtils.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package buildcraft.core.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTSizeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class NetworkUtils {
|
||||
private NetworkUtils() {
|
||||
|
||||
}
|
||||
|
||||
public static void writeUTF (ByteBuf data, String str) {
|
||||
try {
|
||||
if (str == null) {
|
||||
data.writeInt(0);
|
||||
return;
|
||||
}
|
||||
byte [] b = str.getBytes("UTF-8");
|
||||
data.writeInt (b.length);
|
||||
data.writeBytes(b);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
data.writeInt (0);
|
||||
}
|
||||
}
|
||||
|
||||
public static String readUTF (ByteBuf data) {
|
||||
try {
|
||||
int len = data.readInt();
|
||||
if (len == 0) {
|
||||
return "";
|
||||
}
|
||||
byte [] b = new byte [len];
|
||||
data.readBytes(b);
|
||||
return new String (b, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeNBT (ByteBuf data, NBTTagCompound nbt) {
|
||||
try {
|
||||
byte[] compressed = CompressedStreamTools.compress(nbt);
|
||||
data.writeInt(compressed.length);
|
||||
data.writeBytes(compressed);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound readNBT(ByteBuf data) {
|
||||
try {
|
||||
int length = data.readInt();
|
||||
byte[] compressed = new byte[length];
|
||||
data.readBytes(compressed);
|
||||
return CompressedStreamTools.func_152457_a(compressed, NBTSizeTracker.field_152451_a);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeStack (ByteBuf data, ItemStack stack) {
|
||||
if (stack == null || stack.getItem() == null || stack.stackSize < 0) {
|
||||
data.writeByte(0);
|
||||
} else {
|
||||
// ItemStacks generally shouldn't have a stackSize above 64,
|
||||
// so we use this "trick" to save bandwidth by storing it in the first byte.
|
||||
data.writeByte((MathUtils.clamp(stack.stackSize + 1, 0, 64) & 0x7F) | (stack.hasTagCompound() ? 128 : 0));
|
||||
data.writeShort(Item.getIdFromItem(stack.getItem()));
|
||||
data.writeShort(stack.getItemDamage());
|
||||
if (stack.hasTagCompound()) {
|
||||
writeNBT(data, stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack readStack(ByteBuf data) {
|
||||
int flags = data.readUnsignedByte();
|
||||
if (flags == 0) {
|
||||
return null;
|
||||
} else {
|
||||
boolean hasCompound = (flags & 0x80) != 0;
|
||||
int stackSize = (flags & 0x7F) - 1;
|
||||
int itemId = data.readUnsignedShort();
|
||||
int itemDamage = data.readShort();
|
||||
ItemStack stack = new ItemStack(Item.getItemById(itemId), stackSize, itemDamage);
|
||||
if (hasCompound) {
|
||||
stack.setTagCompound(readNBT(data));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeByteArray(ByteBuf stream, byte[] data) {
|
||||
stream.writeInt(data.length);
|
||||
stream.writeBytes(data);
|
||||
}
|
||||
|
||||
public static byte[] readByteArray(ByteBuf stream) {
|
||||
byte[] data = new byte[stream.readInt()];
|
||||
stream.readBytes(data, 0, data.length);
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -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.concurrency;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -17,7 +17,6 @@ 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
|
|
@ -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.concurrency;
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -20,7 +20,6 @@ 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 {
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
*/
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -24,11 +22,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTSizeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -41,9 +35,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.power.IEngine;
|
||||
import buildcraft.api.transport.IInjectable;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.compat.CompatHooks;
|
||||
import buildcraft.core.CompatHooks;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.IDropControlInventory;
|
||||
|
@ -54,9 +49,8 @@ import buildcraft.core.TileBuildCraft;
|
|||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.energy.TileEngine;
|
||||
|
||||
public final class Utils {
|
||||
|
||||
|
@ -88,7 +82,7 @@ public final class Utils {
|
|||
|
||||
TileEntity tileInventory = BlockUtils.getTileEntity(world, (int) pos.x, (int) pos.y, (int) pos.z);
|
||||
ITransactor transactor = Transactor.getTransactorFor(tileInventory);
|
||||
if (transactor != null && !(tileInventory instanceof TileEngine) && transactor.add(stack, orientation.getOpposite(), false).stackSize > 0) {
|
||||
if (transactor != null && !(tileInventory instanceof IEngine) && transactor.add(stack, orientation.getOpposite(), false).stackSize > 0) {
|
||||
return transactor.add(stack, orientation.getOpposite(), true).stackSize;
|
||||
}
|
||||
}
|
||||
|
@ -107,41 +101,6 @@ public final class Utils {
|
|||
return orientationTable[orientationIndex];
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME This is only kept here for the purpose of get3dOrientation, which
|
||||
* should probably be removed following the same principles
|
||||
*/
|
||||
@Deprecated
|
||||
private static ForgeDirection get2dOrientation(Position pos1, Position pos2) {
|
||||
double dX = pos1.x - pos2.x;
|
||||
double dZ = pos1.z - pos2.z;
|
||||
double angle = Math.atan2(dZ, dX) / Math.PI * 180 + 180;
|
||||
|
||||
if (angle < 45 || angle > 315) {
|
||||
return ForgeDirection.EAST;
|
||||
} else if (angle < 135) {
|
||||
return ForgeDirection.SOUTH;
|
||||
} else if (angle < 225) {
|
||||
return ForgeDirection.WEST;
|
||||
} else {
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public static ForgeDirection get3dOrientation(Position pos1, Position pos2) {
|
||||
double dX = pos1.x - pos2.x;
|
||||
double dY = pos1.y - pos2.y;
|
||||
double angle = Math.atan2(dY, dX) / Math.PI * 180 + 180;
|
||||
|
||||
if (angle > 45 && angle < 135) {
|
||||
return ForgeDirection.UP;
|
||||
} else if (angle > 225 && angle < 315) {
|
||||
return ForgeDirection.DOWN;
|
||||
} else {
|
||||
return get2dOrientation(pos1, pos2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look around the tile given in parameter in all 6 position, tries to add
|
||||
* the items to a random injectable tile around. Will make sure that the location
|
||||
|
@ -199,14 +158,6 @@ public final class Utils {
|
|||
InvUtils.dropItems(world, stack, x, y, z);
|
||||
}
|
||||
|
||||
public static TileEntity getTile(World world, Position pos, ForgeDirection step) {
|
||||
Position tmp = new Position(pos);
|
||||
tmp.orientation = step;
|
||||
tmp.moveForwards(1.0);
|
||||
|
||||
return BlockUtils.getTileEntity(world, (int) tmp.x, (int) tmp.y, (int) tmp.z);
|
||||
}
|
||||
|
||||
public static IAreaProvider getNearbyAreaProvider(World world, int i, int j, int k) {
|
||||
TileEntity a1 = BlockUtils.getTileEntity(world, i + 1, j, k);
|
||||
|
||||
|
@ -443,101 +394,6 @@ public final class Utils {
|
|||
return slots;
|
||||
}
|
||||
|
||||
public static void writeUTF (ByteBuf data, String str) {
|
||||
try {
|
||||
if (str == null) {
|
||||
data.writeInt(0);
|
||||
return;
|
||||
}
|
||||
byte [] b = str.getBytes("UTF-8");
|
||||
data.writeInt (b.length);
|
||||
data.writeBytes(b);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
data.writeInt (0);
|
||||
}
|
||||
}
|
||||
|
||||
public static String readUTF (ByteBuf data) {
|
||||
try {
|
||||
int len = data.readInt();
|
||||
if (len == 0) {
|
||||
return "";
|
||||
}
|
||||
byte [] b = new byte [len];
|
||||
data.readBytes(b);
|
||||
return new String (b, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeNBT (ByteBuf data, NBTTagCompound nbt) {
|
||||
try {
|
||||
byte[] compressed = CompressedStreamTools.compress(nbt);
|
||||
data.writeInt(compressed.length);
|
||||
data.writeBytes(compressed);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound readNBT(ByteBuf data) {
|
||||
try {
|
||||
int length = data.readInt();
|
||||
byte[] compressed = new byte[length];
|
||||
data.readBytes(compressed);
|
||||
return CompressedStreamTools.func_152457_a(compressed, NBTSizeTracker.field_152451_a);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeStack (ByteBuf data, ItemStack stack) {
|
||||
if (stack == null || stack.getItem() == null || stack.stackSize < 0) {
|
||||
data.writeByte(0);
|
||||
} else {
|
||||
// ItemStacks generally shouldn't have a stackSize above 64,
|
||||
// so we use this "trick" to save bandwidth by storing it in the first byte.
|
||||
data.writeByte((MathUtils.clamp(stack.stackSize + 1, 0, 64) & 0x7F) | (stack.hasTagCompound() ? 128 : 0));
|
||||
data.writeShort(Item.getIdFromItem(stack.getItem()));
|
||||
data.writeShort(stack.getItemDamage());
|
||||
if (stack.hasTagCompound()) {
|
||||
Utils.writeNBT(data, stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack readStack(ByteBuf data) {
|
||||
int flags = data.readUnsignedByte();
|
||||
if (flags == 0) {
|
||||
return null;
|
||||
} else {
|
||||
boolean hasCompound = (flags & 0x80) != 0;
|
||||
int stackSize = (flags & 0x7F) - 1;
|
||||
int itemId = data.readUnsignedShort();
|
||||
int itemDamage = data.readShort();
|
||||
ItemStack stack = new ItemStack(Item.getItemById(itemId), stackSize, itemDamage);
|
||||
if (hasCompound) {
|
||||
stack.setTagCompound(Utils.readNBT(data));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeByteArray(ByteBuf stream, byte[] data) {
|
||||
stream.writeInt(data.length);
|
||||
stream.writeBytes(data);
|
||||
}
|
||||
|
||||
public static byte[] readByteArray(ByteBuf stream) {
|
||||
byte[] data = new byte[stream.readInt()];
|
||||
stream.readBytes(data, 0, data.length);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* This subprogram transforms a packet into a FML packet to be send in the
|
||||
* minecraft default packet mechanism. This always use BC-CORE as a
|
||||
|
@ -548,7 +404,7 @@ public final class Utils {
|
|||
* member). It is probably opening a maintenance issue and should be
|
||||
* replaced eventually by some more solid mechanism.
|
||||
*/
|
||||
public static FMLProxyPacket toPacket (BuildCraftPacket packet, int discriminator) {
|
||||
public static FMLProxyPacket toPacket (Packet packet, int discriminator) {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
|
||||
buf.writeByte((byte) discriminator);
|
||||
|
|
95
common/buildcraft/energy/IMCHandlerEnergy.java
Normal file
95
common/buildcraft/energy/IMCHandlerEnergy.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package buildcraft.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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 buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.core.IMCHandler;
|
||||
import buildcraft.energy.fuels.CoolantManager;
|
||||
import buildcraft.energy.worldgen.OilPopulate;
|
||||
|
||||
public class IMCHandlerEnergy extends IMCHandler {
|
||||
@Override
|
||||
public void processIMCEvent(IMCEvent event, IMCMessage m) {
|
||||
if (m.key.equals("oil-lake-biome")) {
|
||||
processOilLakeBiomeIMC(event, m);
|
||||
} else if (m.key.equals("oil-gen-exclude")) {
|
||||
processOilGenExcludeIMC(event, m);
|
||||
} else if (m.key.equals("add-coolant")) {
|
||||
processCoolantAddIMC(event, m);
|
||||
} else if (m.key.equals("remove-coolant")) {
|
||||
processCoolantRemoveIMC(event, m);
|
||||
}
|
||||
}
|
||||
|
||||
public static void processOilLakeBiomeIMC(IMCEvent event, IMCMessage m) {
|
||||
try {
|
||||
String biomeID = m.getStringValue().trim();
|
||||
int id = Integer.valueOf(biomeID);
|
||||
if (id >= BiomeGenBase.getBiomeGenArray().length) {
|
||||
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
|
||||
}
|
||||
OilPopulate.INSTANCE.surfaceDepositBiomes.add(id);
|
||||
} catch (Exception ex) {
|
||||
BCLog.logger.warn(String.format("Received an invalid oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
BCLog.logger.info(String.format("Received a successful oil-lake-biome request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
|
||||
public static void processOilGenExcludeIMC(IMCEvent event, IMCMessage m) {
|
||||
try {
|
||||
String biomeID = m.getStringValue().trim();
|
||||
int id = Integer.valueOf(biomeID);
|
||||
if (id >= BiomeGenBase.getBiomeGenArray().length) {
|
||||
throw new IllegalArgumentException("Biome ID must be less than " + BiomeGenBase.getBiomeGenArray().length);
|
||||
}
|
||||
OilPopulate.INSTANCE.excludedBiomes.add(id);
|
||||
} catch (Exception ex) {
|
||||
BCLog.logger.warn(String.format("Received an invalid oil-gen-exclude request %s from mod %s", m.getStringValue(), m.getSender()));
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ import buildcraft.core.inventory.InventoryIterator;
|
|||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.CraftingHelper;
|
||||
import buildcraft.core.utils.CraftingUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory {
|
||||
|
@ -193,7 +193,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
|||
}
|
||||
}
|
||||
|
||||
return CraftingHelper.findMatchingRecipe(craftMatrix, worldObj);
|
||||
return CraftingUtils.findMatchingRecipe(craftMatrix, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import buildcraft.core.TileBuildCraft;
|
|||
import buildcraft.core.fluids.SingleUseTank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
import buildcraft.core.recipes.RefineryRecipeManager;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInventory, IHasWork, IFlexibleCrafter {
|
||||
|
@ -354,14 +355,14 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve
|
|||
// Network
|
||||
public void writeData(ByteBuf stream) {
|
||||
stream.writeFloat(animationSpeed);
|
||||
Utils.writeUTF(stream, currentRecipeId);
|
||||
NetworkUtils.writeUTF(stream, currentRecipeId);
|
||||
tankManager.writeData(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
animationSpeed = stream.readFloat();
|
||||
currentRecipeId = Utils.readUTF(stream);
|
||||
currentRecipeId = NetworkUtils.readUTF(stream);
|
||||
tankManager.readData(stream);
|
||||
|
||||
currentRecipe = RefineryRecipeManager.INSTANCE.getRecipe(currentRecipeId);
|
||||
|
|
|
@ -24,17 +24,17 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.Packet;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.factory.TileRefinery;
|
||||
|
||||
@Sharable
|
||||
public class PacketHandlerFactory extends SimpleChannelInboundHandler<BuildCraftPacket> {
|
||||
public class PacketHandlerFactory extends SimpleChannelInboundHandler<Packet> {
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Packet packet) {
|
||||
try {
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
EntityPlayer player = CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package buildcraft.silicon.boards;
|
||||
package buildcraft.robotics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.BuildCraftRobotics;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.boards.RedstoneBoardNBT;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.recipes.IProgrammingRecipe;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.silicon.ItemRedstoneBoard;
|
||||
|
||||
public class BoardProgrammingRecipe implements IProgrammingRecipe {
|
||||
private class BoardSorter implements Comparator<ItemStack> {
|
||||
|
@ -35,7 +35,7 @@ public class BoardProgrammingRecipe implements IProgrammingRecipe {
|
|||
public List<ItemStack> getOptions(int width, int height) {
|
||||
List<ItemStack> options = new ArrayList<ItemStack>(width * height);
|
||||
for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) {
|
||||
ItemStack stack = new ItemStack(BuildCraftSilicon.redstoneBoard);
|
||||
ItemStack stack = new ItemStack(BuildCraftRobotics.redstoneBoard);
|
||||
nbt.createBoard(NBTUtils.getItemData(stack));
|
||||
options.add(stack);
|
||||
}
|
|
@ -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.robots;
|
||||
package buildcraft.robotics;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
|
@ -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.robots;
|
||||
package buildcraft.robotics;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.WeakHashMap;
|
||||
|
@ -43,6 +43,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftRobotics;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.boards.RedstoneBoardNBT;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
|
@ -61,9 +62,9 @@ import buildcraft.core.network.CommandWriter;
|
|||
import buildcraft.core.network.ICommandReceiver;
|
||||
import buildcraft.core.network.PacketCommand;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.robots.ai.AIRobotMain;
|
||||
import buildcraft.robots.statements.ActionRobotWorkInArea;
|
||||
import buildcraft.core.utils.NetworkUtils;
|
||||
import buildcraft.robotics.ai.AIRobotMain;
|
||||
import buildcraft.robotics.statements.ActionRobotWorkInArea;
|
||||
import buildcraft.transport.PipeTransportPower;
|
||||
import buildcraft.transport.gates.ActionIterator;
|
||||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
@ -561,7 +562,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
tank = null;
|
||||
}
|
||||
|
||||
// Restore robot persistence on pre-6.1.9 robots
|
||||
// Restore robot persistence on pre-6.1.9 robotics
|
||||
this.func_110163_bv();
|
||||
}
|
||||
|
||||
|
@ -671,7 +672,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
BuildCraftCore.instance.sendToWorld(new PacketCommand(this, "clientSetInventory", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeShort(slot);
|
||||
Utils.writeStack(data, inv[slot]);
|
||||
NetworkUtils.writeStack(data, inv[slot]);
|
||||
}
|
||||
}), worldObj);
|
||||
}
|
||||
|
@ -706,7 +707,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
itemInUse = stack;
|
||||
BuildCraftCore.instance.sendToWorld(new PacketCommand(this, "clientSetItemInUse", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeStack(data, itemInUse);
|
||||
NetworkUtils.writeStack(data, itemInUse);
|
||||
}
|
||||
}), worldObj);
|
||||
}
|
||||
|
@ -734,12 +735,12 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
if (side.isClient()) {
|
||||
if ("clientSetItemInUse".equals(command)) {
|
||||
itemInUse = Utils.readStack(stream);
|
||||
itemInUse = NetworkUtils.readStack(stream);
|
||||
} else if ("clientSetInventory".equals(command)) {
|
||||
int slot = stream.readUnsignedShort();
|
||||
inv[slot] = Utils.readStack(stream);
|
||||
inv[slot] = NetworkUtils.readStack(stream);
|
||||
} else if ("initialize".equals(command)) {
|
||||
itemInUse = Utils.readStack(stream);
|
||||
itemInUse = NetworkUtils.readStack(stream);
|
||||
itemActive = stream.readBoolean();
|
||||
} else if ("setItemActive".equals(command)) {
|
||||
itemActive = stream.readBoolean();
|
||||
|
@ -757,7 +758,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
if ("requestInitialization".equals(command)) {
|
||||
BuildCraftCore.instance.sendToPlayer(p, new PacketCommand(this, "initialize", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
Utils.writeStack(data, itemInUse);
|
||||
NetworkUtils.writeStack(data, itemInUse);
|
||||
data.writeBoolean(itemActive);
|
||||
}
|
||||
}));
|
||||
|
@ -767,7 +768,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
BuildCraftCore.instance.sendToPlayer(p, new PacketCommand(this, "clientSetInventory", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeShort(j);
|
||||
Utils.writeStack(data, inv[j]);
|
||||
NetworkUtils.writeStack(data, inv[j]);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -952,7 +953,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
mainAI.abort();
|
||||
}
|
||||
|
||||
ItemStack robotStack = new ItemStack (BuildCraftSilicon.robotItem);
|
||||
ItemStack robotStack = new ItemStack (BuildCraftRobotics.robotItem);
|
||||
NBTUtils.getItemData(robotStack).setTag("board", originalBoardNBT);
|
||||
NBTUtils.getItemData(robotStack).setInteger("energy", battery.getEnergyStored());
|
||||
entityDropItem(robotStack, 0);
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue