/** * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team * http://www.mod-buildcraft.com * <p/> * 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.robotics.boards; import net.minecraft.nbt.NBTTagCompound; 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.robotics.ai.AIRobotHarvest; public class BoardRobotHarvester extends BoardRobotGenericSearchBlock { public BoardRobotHarvester(EntityRobotBase iRobot) { super(iRobot); } public BoardRobotHarvester(EntityRobotBase iRobot, NBTTagCompound nbt) { super(iRobot); } @Override public RedstoneBoardRobotNBT getNBTHandler() { return BCBoardNBT.REGISTRY.get("harvester"); } @Override public boolean isExpectedBlock(World world, int x, int y, int z) { return BuildCraftAPI.getWorldProperty("harvestable").get(world, x, y, z); } @Override public void update() { if (blockFound() != null) { startDelegateAI(new AIRobotHarvest(robot, blockFound())); } else { super.update(); } } @Override public void delegateAIEnded(AIRobot ai) { if (ai instanceof AIRobotHarvest) { releaseBlockFound(ai.success()); } super.delegateAIEnded(ai); } }