started integration of robots in research tree, for #1951
This commit is contained in:
parent
4a1bc66d63
commit
23e841f323
6 changed files with 169 additions and 12 deletions
|
@ -58,6 +58,7 @@ import buildcraft.core.robots.boards.BoardRobotMinerNBT;
|
|||
import buildcraft.core.robots.boards.BoardRobotPickerNBT;
|
||||
import buildcraft.core.robots.boards.BoardRobotPlanterNBT;
|
||||
import buildcraft.core.robots.boards.BoardRobotShovelmanNBT;
|
||||
import buildcraft.core.science.TechnoRobot;
|
||||
import buildcraft.core.science.TechnoSimpleItem;
|
||||
import buildcraft.core.science.TechnoStatement;
|
||||
import buildcraft.core.science.Tier;
|
||||
|
@ -142,6 +143,20 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
public static TechnoStatement technoActionStationForbidRobot = new TechnoStatement();
|
||||
public static TechnoStatement technoActionStationDropInPipe = new TechnoStatement();
|
||||
|
||||
public static TechnoRobot technoRobotPicker = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotCarrier = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotLumberjack = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotHarvester = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotMiner = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotPlanter = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotFarmer = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotLeaveCutter = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotButcher = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotShovelman = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotKnight = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotBomber = new TechnoRobot();
|
||||
public static TechnoRobot technoRobotBuilder = new TechnoRobot();
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
SchematicRegistry.declareBlueprintSupport("BuildCraft|Silicon");
|
||||
|
@ -322,6 +337,87 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
"",
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
// Robots
|
||||
|
||||
technoRobotPicker.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotPickerNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotCarrier.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotCarrierNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotLumberjack.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotLumberjackNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotHarvester.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotHarvesterNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotMiner.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotMinerNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotPlanter.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotPlanterNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotFarmer.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotFarmerNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotLeaveCutter.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotLeaveCutterNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotButcher.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotButcherNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotShovelman.initialize(
|
||||
Tier.DiamondChipset,
|
||||
BoardRobotShovelmanNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotBuilder.initialize(
|
||||
Tier.EmeraldChipset,
|
||||
BoardRobotBuilderNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotKnight.initialize(
|
||||
Tier.EmeraldChipset,
|
||||
BoardRobotKnightNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
technoRobotBomber.initialize(
|
||||
Tier.EmeraldChipset,
|
||||
BoardRobotBomberNBT.instance,
|
||||
Chipset.RED.getStack(5),
|
||||
BuildCraftCore.technoRobotics);
|
||||
|
||||
}
|
||||
|
||||
public static void loadRecipes() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.boards.RedstoneBoardNBT;
|
||||
import buildcraft.api.boards.RedstoneBoardRegistry;
|
||||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||
|
@ -89,4 +90,11 @@ public class ItemRobot extends ItemBuildCraft {
|
|||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
// cancels default BC icon registering
|
||||
}
|
||||
|
||||
public static ItemStack createRobotStack(ItemStack board) {
|
||||
ItemStack robot = new ItemStack(BuildCraftSilicon.robotItem);
|
||||
NBTUtils.getItemData(robot).setTag("board", NBTUtils.getItemData(board));
|
||||
|
||||
return robot;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.item.ItemStack;
|
|||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.recipes.CraftingResult;
|
||||
import buildcraft.core.ItemRobot;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.silicon.ItemRedstoneBoard;
|
||||
import buildcraft.silicon.TileIntegrationTable;
|
||||
import buildcraft.silicon.recipes.IntegrationTableRecipe;
|
||||
|
@ -40,11 +39,7 @@ public class RobotIntegrationRecipe extends IntegrationTableRecipe {
|
|||
CraftingResult<ItemStack> result = super.craft(crafter, preview, inputA, inputB);
|
||||
|
||||
if (result != null) {
|
||||
ItemStack robot = new ItemStack(BuildCraftSilicon.robotItem);
|
||||
|
||||
NBTUtils.getItemData(robot).setTag("board", NBTUtils.getItemData(inputB));
|
||||
|
||||
result.crafted = robot;
|
||||
result.crafted = ItemRobot.createRobotStack(inputB);
|
||||
|
||||
return result;
|
||||
} else {
|
||||
|
|
61
common/buildcraft/core/science/TechnoRobot.java
Executable file
61
common/buildcraft/core/science/TechnoRobot.java
Executable file
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.science;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||
import buildcraft.core.ItemRobot;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
|
||||
public class TechnoRobot extends Technology {
|
||||
|
||||
ItemStack robotItem;
|
||||
RedstoneBoardRobotNBT robot;
|
||||
|
||||
public void initialize(Tier iTier,
|
||||
RedstoneBoardRobotNBT robot,
|
||||
ItemStack requirement,
|
||||
Technology... iPrerequisites) {
|
||||
initialize(iTier, robot, requirement, null, null, iPrerequisites);
|
||||
}
|
||||
|
||||
public void initialize(Tier iTier,
|
||||
RedstoneBoardRobotNBT robot,
|
||||
ItemStack requirement1,
|
||||
ItemStack requirement2,
|
||||
Technology... iPrerequisites) {
|
||||
initialize(iTier, robot, requirement1, requirement2, null, iPrerequisites);
|
||||
}
|
||||
|
||||
public void initialize(Tier iTier,
|
||||
RedstoneBoardRobotNBT iRobot,
|
||||
ItemStack requirement1,
|
||||
ItemStack requirement2,
|
||||
ItemStack requirement3,
|
||||
Technology... iPrerequisites) {
|
||||
|
||||
super.initialize("robot:" + iRobot.getID(),
|
||||
iTier, requirement1, requirement2, requirement3, iPrerequisites);
|
||||
|
||||
robot = iRobot;
|
||||
ItemStack robotStack = new ItemStack(BuildCraftSilicon.robotItem);
|
||||
NBTTagCompound nbt = NBTUtils.getItemData(robotStack);
|
||||
nbt.setString("id", robot.getID());
|
||||
robot.createDefaultBoard(nbt);
|
||||
robotItem = ItemRobot.createRobotStack(robotStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackToDisplay() {
|
||||
return robotItem;
|
||||
}
|
||||
}
|
|
@ -49,11 +49,6 @@ public class TechnoSimpleItem extends Technology {
|
|||
return itemToDisplay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack toStack(Object obj) {
|
||||
if (obj instanceof ItemStack) {
|
||||
return (ItemStack) obj;
|
||||
|
|
|
@ -69,7 +69,9 @@ public abstract class Technology {
|
|||
return null;
|
||||
}
|
||||
|
||||
public abstract String getLocalizedName();
|
||||
public String getLocalizedName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final ArrayList<Technology> getPrerequisites() {
|
||||
return prerequisites;
|
||||
|
|
Loading…
Reference in a new issue