fix robots not keeping their energy when being reprogrammed and make new robots start with a small amount of energy

This commit is contained in:
Hea3veN 2015-06-02 19:48:17 -03:00
parent 3c9398a5e5
commit 500207a00d
3 changed files with 12 additions and 9 deletions

View file

@ -2,6 +2,7 @@ Additions:
* [#2692] Restore config option to make filler/builder drop blocks (hea3ven)
* [#2709] Add a loop mode to the quarry (hea3ven)
* Robots start with a small amount of energy after being programmed (hea3ven)
Bugs fixed:
@ -10,3 +11,4 @@ Bugs fixed:
* Fix gate expansion recipe ignoring the input's stack size (hea3ven)
* Fix planters dropping items in stead of planting (hea3ven)
* Use the OreDict for the pipes recipes (ganymedes01)
* Fix robots not keeping their energy when being reprogrammed (hea3ven)

View file

@ -100,11 +100,6 @@ public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem {
// cancels default BC icon registering
}
public static ItemStack createRobotStack(ItemStack board, int energy) {
return createRobotStack((RedstoneBoardRobotNBT) ItemRedstoneBoard.getBoardNBT(board),
energy);
}
public static ItemStack createRobotStack(RedstoneBoardRobotNBT board, int energy) {
ItemStack robot = new ItemStack(BuildCraftRobotics.robotItem);
NBTTagCompound boardCpt = new NBTTagCompound();

View file

@ -16,6 +16,8 @@ import net.minecraft.item.ItemStack;
import buildcraft.BuildCraftRobotics;
import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.lib.utils.NBTUtils;
import buildcraft.core.recipes.IntegrationRecipeBC;
@ -48,9 +50,7 @@ public class RobotIntegrationRecipe extends IntegrationRecipeBC {
public List<ItemStack> generateExampleOutput() {
ArrayList<ItemStack> example = new ArrayList<ItemStack>();
for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) {
ItemStack stack = new ItemStack(BuildCraftRobotics.redstoneBoard);
nbt.createBoard(NBTUtils.getItemData(stack));
example.add(ItemRobot.createRobotStack(stack, 0));
example.add(ItemRobot.createRobotStack((RedstoneBoardRobotNBT) nbt, 0));
}
return example;
}
@ -70,6 +70,12 @@ public class RobotIntegrationRecipe extends IntegrationRecipeBC {
if (!preview) {
expansions.get(0).stackSize--;
}
return ItemRobot.createRobotStack(expansions.get(0), 0);
RedstoneBoardRobotNBT boardNBT = (RedstoneBoardRobotNBT) ItemRedstoneBoard.getBoardNBT(expansions.get(0));
int energy = ItemRobot.getEnergy(input);
if (energy == 0) {
energy = EntityRobotBase.SAFETY_ENERGY;
}
return ItemRobot.createRobotStack(boardNBT, energy);
}
}