started implementation of shovelman and bucher, #1924 and #1925

This commit is contained in:
SpaceToad 2014-07-01 00:33:00 +02:00
parent 1917f11f97
commit 4c86502701
8 changed files with 281 additions and 0 deletions

View file

@ -10,6 +10,8 @@ buildcraft.boardRobotKnight=Knight
buildcraft.boardRobotMiner=Miner buildcraft.boardRobotMiner=Miner
buildcraft.boardRobotFarmer=Farmer buildcraft.boardRobotFarmer=Farmer
buildcraft.boardRobotHarvester=Harvester buildcraft.boardRobotHarvester=Harvester
buildcraft.boardRobotShovelman=Shovelman
buildcraft.boardRobotBucher=Bucher
buildcraft.boardDetail.parameters=Parameters buildcraft.boardDetail.parameters=Parameters
buildcraft.boardDetail.range=Range buildcraft.boardDetail.range=Range

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -43,6 +43,7 @@ import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.robots.RobotIntegrationRecipe; import buildcraft.core.robots.RobotIntegrationRecipe;
import buildcraft.core.robots.boards.BoardRobotBomberNBT; import buildcraft.core.robots.boards.BoardRobotBomberNBT;
import buildcraft.core.robots.boards.BoardRobotBucherNBT;
import buildcraft.core.robots.boards.BoardRobotCarrierNBT; import buildcraft.core.robots.boards.BoardRobotCarrierNBT;
import buildcraft.core.robots.boards.BoardRobotFarmerNBT; import buildcraft.core.robots.boards.BoardRobotFarmerNBT;
import buildcraft.core.robots.boards.BoardRobotHarvesterNBT; import buildcraft.core.robots.boards.BoardRobotHarvesterNBT;
@ -52,6 +53,7 @@ import buildcraft.core.robots.boards.BoardRobotLumberjackNBT;
import buildcraft.core.robots.boards.BoardRobotMinerNBT; import buildcraft.core.robots.boards.BoardRobotMinerNBT;
import buildcraft.core.robots.boards.BoardRobotPickerNBT; import buildcraft.core.robots.boards.BoardRobotPickerNBT;
import buildcraft.core.robots.boards.BoardRobotPlanterNBT; import buildcraft.core.robots.boards.BoardRobotPlanterNBT;
import buildcraft.core.robots.boards.BoardRobotShovelmanNBT;
import buildcraft.silicon.BlockLaser; import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable; import buildcraft.silicon.BlockLaserTable;
import buildcraft.silicon.GuiHandler; import buildcraft.silicon.GuiHandler;
@ -153,6 +155,8 @@ public class BuildCraftSilicon extends BuildCraftMod {
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5); RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5); RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5); RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBucherNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotShovelmanNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1); RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1); RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1);

View file

@ -0,0 +1,66 @@
/**
* 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.robots.boards;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.inventory.filters.IStackFilter;
import buildcraft.core.robots.AIRobotAttack;
import buildcraft.core.robots.AIRobotFetchAndEquipItemStack;
import buildcraft.core.robots.AIRobotGotoSleep;
import buildcraft.core.robots.AIRobotSearchMob;
public class BoardRobotBucher extends RedstoneBoardRobot {
public BoardRobotBucher(EntityRobotBase iRobot) {
super(iRobot);
}
@Override
public RedstoneBoardRobotNBT getNBTHandler() {
return BoardRobotBucherNBT.instance;
}
@Override
public final void update() {
if (robot.getHeldItem() == null) {
startDelegateAI(new AIRobotFetchAndEquipItemStack(robot, new IStackFilter() {
@Override
public boolean matches(ItemStack stack) {
return stack.getItem() instanceof ItemSword;
}
}));
} else {
startDelegateAI(new AIRobotSearchMob(robot, 250, robot.getAreaToWork()));
}
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotFetchAndEquipItemStack) {
if (robot.getHeldItem() == null) {
startDelegateAI(new AIRobotGotoSleep(robot));
}
} else if (ai instanceof AIRobotSearchMob) {
AIRobotSearchMob mobAI = (AIRobotSearchMob) ai;
if (mobAI.target != null) {
startDelegateAI(new AIRobotAttack(robot, ((AIRobotSearchMob) ai).target));
} else {
startDelegateAI(new AIRobotGotoSleep(robot));
}
}
}
}

View file

@ -0,0 +1,72 @@
/**
* 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.robots.boards;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.DefaultProps;
import buildcraft.core.utils.StringUtils;
public final class BoardRobotBucherNBT extends RedstoneBoardRobotNBT {
public static BoardRobotBucherNBT instance = new BoardRobotBucherNBT();
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft",
DefaultProps.TEXTURE_PATH_ENTITIES + "/robot_bucher.png");
private IIcon icon;
@Override
public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) {
return new BoardRobotKnight(robot);
}
@Override
public ResourceLocation getRobotTexture() {
return TEXTURE;
}
@Override
public String getID() {
return "buildcraft:boardRobotBucher";
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobotBucher"));
}
@Override
public void registerIcons(IIconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcraft:board_blue");
}
@Override
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -0,0 +1,65 @@
/**
* 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.robots.boards;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.robots.AIRobotFetchAndEquipItemStack;
public class BoardRobotShovelman extends BoardRobotGenericBreakBlock {
private boolean extendedOre = false;
public BoardRobotShovelman(EntityRobotBase iRobot) {
super(iRobot);
}
@Override
public void delegateAIEnded(AIRobot ai) {
super.delegateAIEnded(ai);
if (ai instanceof AIRobotFetchAndEquipItemStack) {
ItemStack stack = robot.getHeldItem();
if (stack != null && stack.getItem() instanceof ItemPickaxe) {
ItemPickaxe pickaxe = (ItemPickaxe) stack.getItem();
extendedOre = pickaxe.func_150913_i() == Item.ToolMaterial.EMERALD
|| pickaxe.func_150913_i() == Item.ToolMaterial.IRON;
}
}
}
@Override
public RedstoneBoardRobotNBT getNBTHandler() {
return BoardRobotShovelmanNBT.instance;
}
@Override
public boolean isExpectedTool(ItemStack stack) {
return stack != null && stack.getItem() instanceof ItemPickaxe;
}
@Override
public boolean isExpectedBlock(World world, int x, int y, int z) {
if (!extendedOre) {
return BuildCraftAPI.isBasicOreProperty.get(world, x, y, z);
} else {
return BuildCraftAPI.isExtendedOreProperty.get(world, x, y, z);
}
}
}

View file

@ -0,0 +1,72 @@
/**
* 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.robots.boards;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.DefaultProps;
import buildcraft.core.utils.StringUtils;
public final class BoardRobotShovelmanNBT extends RedstoneBoardRobotNBT {
public static BoardRobotShovelmanNBT instance = new BoardRobotShovelmanNBT();
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft",
DefaultProps.TEXTURE_PATH_ENTITIES + "/robot_shovelman.png");
private IIcon icon;
@Override
public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) {
return new BoardRobotShovelman(robot);
}
@Override
public ResourceLocation getRobotTexture() {
return TEXTURE;
}
@Override
public String getID() {
return "buildcraft:shovelman";
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobotShovelman"));
}
@Override
public void registerIcons(IIconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcraft:board_blue");
}
@Override
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound itemData) {
}
}