restore the randomness to the planter robot

This commit is contained in:
Hea3veN 2015-02-18 22:25:50 -03:00
parent 6fe8ec37db
commit e9af8230e6
12 changed files with 347 additions and 264 deletions

View file

@ -140,7 +140,6 @@ import buildcraft.robots.ai.AIRobotFetchItem;
import buildcraft.robots.ai.AIRobotGoAndLinkToDock;
import buildcraft.robots.ai.AIRobotGoto;
import buildcraft.robots.ai.AIRobotGotoBlock;
import buildcraft.robots.ai.AIRobotGotoRandomGroundBlock;
import buildcraft.robots.ai.AIRobotGotoSleep;
import buildcraft.robots.ai.AIRobotGotoStation;
import buildcraft.robots.ai.AIRobotGotoStationAndLoad;
@ -158,6 +157,7 @@ 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;
@ -444,7 +444,6 @@ public class BuildCraftCore extends BuildCraftMod {
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(AIRobotGotoRandomGroundBlock.class, "aiRobotGotoRandomGroundBlock", "buildcraft.core.robots.AIRobotGotoRandomGroundBlock");
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");
@ -461,6 +460,7 @@ public class BuildCraftCore extends BuildCraftMod {
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");

View file

@ -0,0 +1,75 @@
package buildcraft.core;
import java.util.Iterator;
import buildcraft.api.core.BlockIndex;
import buildcraft.core.BlockScanner.BlockIt;
public class BlockScannerExpanding implements Iterable<BlockIndex> {
private int searchRadius;
private int searchX;
private int searchY;
private int searchZ;
class BlockIt implements Iterator<BlockIndex> {
@Override
public boolean hasNext() {
return searchRadius < 64;
}
@Override
public BlockIndex next() {
// Step through each block in a hollow cube of size (searchRadius * 2 -1), if done
// add 1 to the radius and start over.
BlockIndex next = new BlockIndex(searchX, searchY, searchZ);
// Step to the next Y
if (Math.abs(searchX) == searchRadius || Math.abs(searchZ) == searchRadius) {
searchY += 1;
} else {
searchY += searchRadius * 2;
}
if (searchY > searchRadius) {
// Step to the next Z
searchY = -searchRadius;
searchZ += 1;
if (searchZ > searchRadius) {
// Step to the next X
searchZ = -searchRadius;
searchX += 1;
if (searchX > searchRadius) {
// Step to the next radius
searchRadius += 1;
searchX = -searchRadius;
searchY = -searchRadius;
searchZ = -searchRadius;
}
}
}
return next;
}
@Override
public void remove() {
}
}
public BlockScannerExpanding() {
searchRadius = 1;
searchX = -1;
searchY = -1;
searchZ = -1;
}
@Override
public Iterator<BlockIndex> iterator() {
return new BlockIt();
}
}

View file

@ -0,0 +1,48 @@
package buildcraft.core;
import java.util.Iterator;
import java.util.Random;
import buildcraft.api.core.BlockIndex;
public class BlockScannerRandom implements Iterable<BlockIndex> {
private Random rand;
private int maxDistance;
class BlockIt implements Iterator<BlockIndex> {
@Override
public boolean hasNext() {
return true;
}
@Override
public BlockIndex next() {
double radius = rand.nextFloat() * maxDistance;
double polarAngle = rand.nextFloat() * 2.0 * Math.PI;
double azimuthAngle = rand.nextFloat() * Math.PI;
int searchX = (int) (radius * Math.cos(polarAngle) * Math.sin(azimuthAngle));
int searchY = (int) (radius * Math.cos(azimuthAngle));
int searchZ = (int) (radius * Math.sin(polarAngle) * Math.sin(azimuthAngle));
return new BlockIndex(searchX, searchY, searchZ);
}
@Override
public void remove() {
}
}
public BlockScannerRandom(Random iRand, int iMaxDistance) {
rand = iRand;
maxDistance = iMaxDistance;
}
@Override
public Iterator<BlockIndex> iterator() {
return new BlockIt();
}
}

View file

@ -0,0 +1,48 @@
package buildcraft.core;
import java.util.Iterator;
import java.util.Random;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IZone;
public class BlockScannerZoneRandom implements Iterable<BlockIndex> {
private Random rand;
private IZone zone;
private int x;
private int y;
private int z;
class BlockIt implements Iterator<BlockIndex> {
@Override
public boolean hasNext() {
return true;
}
@Override
public BlockIndex next() {
BlockIndex block = zone.getRandomBlockIndex(rand);
return new BlockIndex(block.x - x, block.y - y, block.z - z);
}
@Override
public void remove() {
}
}
public BlockScannerZoneRandom(int iX, int iY, int iZ, Random iRand, IZone iZone) {
x = iX;
y = iY;
z = iZ;
rand = iRand;
zone = iZone;
}
@Override
public Iterator<BlockIndex> iterator() {
return new BlockIt();
}
}

View file

@ -364,7 +364,7 @@ public class Box implements IBox, ISerializable {
@Override
public BlockIndex getRandomBlockIndex(Random rand) {
int x = xMin + rand.nextInt(xMax - xMin);
int y = yMin + rand.nextInt(yMax - yMin);
int y = (yMax > yMin) ? yMin + rand.nextInt(yMax - yMin) : yMin;
int z = zMin + rand.nextInt(zMax - zMin);
return new BlockIndex(x, y, z);

View file

@ -11,6 +11,7 @@ package buildcraft.core.utils.concurrency;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ -33,32 +34,25 @@ public class PathFindingSearch implements IIterableAlgorithm {
private IBlockFilter pathFound;
private IZone zone;
private float maxDistance;
private Iterator<BlockIndex> blockIter;
private int searchRadius;
private int searchX;
private int searchY;
private int searchZ;
private int searchHeight;
public PathFindingSearch(World iWorld, BlockIndex iStart, IBlockFilter iPathFound, float iMaxDistance, IZone iZone) {
public PathFindingSearch(World iWorld, BlockIndex iStart,
Iterator<BlockIndex> iBlockIter, IBlockFilter iPathFound,
float iMaxDistance, IZone iZone) {
world = iWorld;
start = iStart;
pathFound = iPathFound;
maxDistance = iMaxDistance;
zone = iZone;
blockIter = iBlockIter;
pathFinders = new LinkedList<PathFinding>();
searchRadius = 1;
searchX = -1;
searchY = -1;
searchZ = -1;
getSearchHeight(start.x + searchX, start.z + searchZ);
}
@Override
public void iterate() {
if (pathFinders.size() < 5 && searchRadius < 64) {
if (pathFinders.size() < 5 && blockIter.hasNext()) {
iterateSearch(PATH_ITERATIONS * 50);
}
iteratePathFind(PATH_ITERATIONS);
@ -66,16 +60,17 @@ public class PathFindingSearch implements IIterableAlgorithm {
private void iterateSearch(int itNumber) {
for (int i = 0; i < itNumber; ++i) {
int currX = start.x + searchX;
int currY = start.y + searchY;
int currZ = start.z + searchZ;
if (0 <= currY && currY <= searchHeight) {
if (isTarget(currX, currY, currZ)) {
pathFinders.add(new PathFinding(world, start, new BlockIndex(currX, currY, currZ), 0, maxDistance));
}
if (!blockIter.hasNext()) {
return;
}
nextSearchStep();
BlockIndex delta = blockIter.next();
BlockIndex block = new BlockIndex(start.x + delta.x, start.y + delta.y, start.z + delta.z);
if (isLoadedChunk(block.x, block.z)) {
if (isTarget(block)) {
pathFinders.add(new PathFinding(world, start, block, 0, maxDistance));
}
}
if (pathFinders.size() >= 5) {
return;
@ -83,72 +78,35 @@ public class PathFindingSearch implements IIterableAlgorithm {
}
}
private void nextSearchStep() {
// Step through each block in a hollow cube of size (searchRadius * 2 -1), if done
// add 1 to the radius and start over.
// Step to the next Y
if (Math.abs(searchX) == searchRadius || Math.abs(searchZ) == searchRadius) {
searchY += 1;
} else {
searchY += searchRadius * 2;
}
if (searchY > searchRadius) {
// Step to the next Z
searchY = -searchRadius;
searchZ += 1;
if (searchZ > searchRadius) {
// Step to the next X
searchZ = -searchRadius;
searchX += 1;
if (searchX > searchRadius) {
// Step to the next radius
searchRadius += 1;
searchX = -searchRadius;
searchY = -searchRadius;
searchZ = -searchRadius;
}
}
searchHeight = getSearchHeight(start.x + searchX, start.z + searchZ);
}
}
private boolean isTarget(int x, int y, int z) {
if (zone != null && !zone.contains(x, y, z)) {
private boolean isTarget(BlockIndex block) {
if (zone != null && !zone.contains(block.x, block.y, block.z)) {
return false;
}
if (!pathFound.matches(world, x, y, z)) {
if (!pathFound.matches(world, block.x, block.y, block.z)) {
return false;
}
synchronized (reservations) {
if (reservations.containsKey(world.provider.dimensionId)) {
HashSet<BlockIndex> dimReservations = reservations
.get(world.provider.dimensionId);
if (dimReservations.contains(new BlockIndex(x, y, z))) {
if (dimReservations.contains(block)) {
return false;
}
}
}
if (!BuildCraftAPI.isSoftBlock(world, x - 1, y, z)
&& !BuildCraftAPI.isSoftBlock(world, x + 1, y, z)
&& !BuildCraftAPI.isSoftBlock(world, x, y, z - 1)
&& !BuildCraftAPI.isSoftBlock(world, x, y, z + 1)
&& !BuildCraftAPI.isSoftBlock(world, x, y - 1, z)
&& !BuildCraftAPI.isSoftBlock(world, x, y + 1, z)) {
if (!BuildCraftAPI.isSoftBlock(world, block.x - 1, block.y, block.z)
&& !BuildCraftAPI.isSoftBlock(world, block.x + 1, block.y, block.z)
&& !BuildCraftAPI.isSoftBlock(world, block.x, block.y, block.z - 1)
&& !BuildCraftAPI.isSoftBlock(world, block.x, block.y, block.z + 1)
&& !BuildCraftAPI.isSoftBlock(world, block.x, block.y - 1, block.z)
&& !BuildCraftAPI.isSoftBlock(world, block.x, block.y + 1, block.z)) {
return false;
}
return true;
}
private int getSearchHeight(int x, int z) {
if (world.getChunkProvider().chunkExists(x >> 4, z >> 4)) {
return 256;
} else {
return -1;
}
private boolean isLoadedChunk(int x, int z) {
return world.getChunkProvider().chunkExists(x >> 4, z >> 4);
}
public void iteratePathFind(int itNumber) {
@ -173,7 +131,7 @@ public class PathFindingSearch implements IIterableAlgorithm {
return true;
}
}
return searchRadius >= 64;
return !blockIter.hasNext();
}
public LinkedList<BlockIndex> getResult() {

View file

@ -1,84 +0,0 @@
/**
* 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.robots.ai;
import java.util.LinkedList;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.utils.IBlockFilter;
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
import buildcraft.core.utils.concurrency.PathFinding;
public class AIRobotGotoRandomGroundBlock extends AIRobot {
public BlockIndex blockFound;
private int range;
private PathFinding pathFinding;
private IterableAlgorithmRunner pathFindingJob;
private IBlockFilter filter;
private IZone zone;
public AIRobotGotoRandomGroundBlock(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotGotoRandomGroundBlock(EntityRobotBase iRobot, int iRange, IBlockFilter iFilter, IZone iZone) {
super(iRobot);
range = iRange;
filter = iFilter;
zone = iZone;
}
@Override
public void update() {
if (pathFindingJob == null) {
startDelegateAI(new AIRobotSearchRandomGroundBlock(robot, range, filter, zone));
} else {
if (!pathFindingJob.isAlive()) {
LinkedList<BlockIndex> path = pathFinding.getResult();
if (path.size() == 0) {
terminate();
} else {
path.removeLast();
startDelegateAI(new AIRobotGotoBlock(robot, path));
}
}
}
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotSearchRandomGroundBlock) {
AIRobotSearchRandomGroundBlock aiFind = (AIRobotSearchRandomGroundBlock) ai;
if (aiFind.blockFound == null) {
terminate();
}
blockFound = aiFind.blockFound;
pathFinding = new PathFinding(robot.worldObj, new BlockIndex(robot), blockFound);
pathFindingJob = new IterableAlgorithmRunner(pathFinding);
pathFindingJob.start();
} else if (ai instanceof AIRobotGotoBlock) {
terminate();
}
}
@Override
public void end() {
if (pathFindingJob != null) {
pathFindingJob.terminate();
}
}
}

View file

@ -8,98 +8,14 @@
*/
package buildcraft.robots.ai;
import java.util.LinkedList;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.BlockScannerExpanding;
import buildcraft.core.utils.IBlockFilter;
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
import buildcraft.core.utils.concurrency.PathFindingSearch;
public class AIRobotSearchBlock extends AIRobot {
public BlockIndex blockFound;
public LinkedList<BlockIndex> path;
private PathFindingSearch blockScanner = null;
private IterableAlgorithmRunner blockScannerJob;
private IBlockFilter pathFound;
public AIRobotSearchBlock(EntityRobotBase iRobot) {
super(iRobot);
}
public class AIRobotSearchBlock extends AIRobotSearchBlockBase {
public AIRobotSearchBlock(EntityRobotBase iRobot, IBlockFilter iPathFound) {
super(iRobot);
pathFound = iPathFound;
}
@Override
public void start() {
blockScanner = new PathFindingSearch(robot.worldObj, new BlockIndex(robot), pathFound, 96, robot.getZoneToWork());
blockScannerJob = new IterableAlgorithmRunner(blockScanner, 40000);
blockScannerJob.start();
}
@Override
public void update() {
if (blockScannerJob == null) {
// This is probably due to a load from NBT. Abort the ai in
// that case, since there's no filter to analyze either.
abort();
return;
}
if (blockScannerJob.isDone()) {
path = blockScanner.getResult();
if (path != null && path.size() > 0) {
blockFound = path.removeLast();
} else {
path = null;
}
terminate();
}
}
@Override
public void end() {
if (blockScannerJob != null) {
blockScannerJob.terminate();
}
}
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
if (blockFound != null) {
NBTTagCompound sub = new NBTTagCompound();
blockFound.writeTo(sub);
nbt.setTag("blockFound", sub);
}
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
super.loadSelfFromNBT(nbt);
if (nbt.hasKey("blockFound")) {
blockFound = new BlockIndex(nbt.getCompoundTag("blockFound"));
}
}
public void unreserve() {
blockScanner.unreserve(blockFound);
}
@Override
public int getEnergyCost() {
return 2;
super(iRobot, iPathFound, new BlockScannerExpanding().iterator());
}
}

View file

@ -0,0 +1,98 @@
package buildcraft.robots.ai;
import java.util.Iterator;
import java.util.LinkedList;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.utils.IBlockFilter;
import buildcraft.core.utils.concurrency.IterableAlgorithmRunner;
import buildcraft.core.utils.concurrency.PathFindingSearch;
public class AIRobotSearchBlockBase extends AIRobot {
public BlockIndex blockFound;
public LinkedList<BlockIndex> path;
private PathFindingSearch blockScanner = null;
private IterableAlgorithmRunner blockScannerJob;
private IBlockFilter pathFound;
private Iterator<BlockIndex> blockIter;
public AIRobotSearchBlockBase(EntityRobotBase iRobot, IBlockFilter iPathFound, Iterator<BlockIndex> iBlockIter) {
super(iRobot);
pathFound = iPathFound;
blockIter = iBlockIter;
}
@Override
public void start() {
blockScanner = new PathFindingSearch(robot.worldObj, new BlockIndex(
robot), blockIter, pathFound, 96, robot
.getZoneToWork());
blockScannerJob = new IterableAlgorithmRunner(blockScanner, 40000);
blockScannerJob.start();
}
@Override
public void update() {
if (blockScannerJob == null) {
// This is probably due to a load from NBT. Abort the ai in
// that case, since there's no filter to analyze either.
abort();
return;
}
if (blockScannerJob.isDone()) {
path = blockScanner.getResult();
if (path != null && path.size() > 0) {
blockFound = path.removeLast();
} else {
path = null;
}
terminate();
}
}
@Override
public void end() {
if (blockScannerJob != null) {
blockScannerJob.terminate();
}
}
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
if (blockFound != null) {
NBTTagCompound sub = new NBTTagCompound();
blockFound.writeTo(sub);
nbt.setTag("blockFound", sub);
}
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
super.loadSelfFromNBT(nbt);
if (nbt.hasKey("blockFound")) {
blockFound = new BlockIndex(nbt.getCompoundTag("blockFound"));
}
}
public void unreserve() {
blockScanner.unreserve(blockFound);
}
@Override
public int getEnergyCost() {
return 2;
}
}

View file

@ -0,0 +1,36 @@
/**
* 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.robots.ai;
import java.util.Iterator;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.BlockScannerRandom;
import buildcraft.core.BlockScannerZoneRandom;
import buildcraft.core.utils.IBlockFilter;
public class AIRobotSearchRandomBlock extends AIRobotSearchBlockBase {
public AIRobotSearchRandomBlock(EntityRobotBase iRobot, IBlockFilter iPathFound) {
super(iRobot, iPathFound, getBlockIterator(iRobot));
}
private static Iterator<BlockIndex> getBlockIterator(EntityRobotBase iRobot) {
IZone zone = iRobot.getZoneToWork();
if (zone != null) {
BlockIndex pos = new BlockIndex(iRobot);
return new BlockScannerZoneRandom(pos.x, pos.y, pos.z, iRobot.worldObj.rand, zone).iterator();
} else {
return new BlockScannerRandom(iRobot.worldObj.rand, 64).iterator();
}
}
}

View file

@ -25,10 +25,6 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot {
private IZone zone;
private int attempts = 0;
public AIRobotSearchRandomGroundBlock(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotSearchRandomGroundBlock(EntityRobotBase iRobot, int iRange, IBlockFilter iFilter, IZone iZone) {
super(iRobot);

View file

@ -35,9 +35,9 @@ import buildcraft.core.utils.IBlockFilter;
import buildcraft.robots.ResourceIdBlock;
import buildcraft.robots.ai.AIRobotFetchAndEquipItemStack;
import buildcraft.robots.ai.AIRobotGotoBlock;
import buildcraft.robots.ai.AIRobotGotoRandomGroundBlock;
import buildcraft.robots.ai.AIRobotGotoSleep;
import buildcraft.robots.ai.AIRobotSearchBlock;
import buildcraft.robots.ai.AIRobotSearchBlockBase;
import buildcraft.robots.ai.AIRobotSearchRandomBlock;
import buildcraft.robots.ai.AIRobotUseToolOnBlock;
import buildcraft.robots.statements.ActionRobotFilter;
@ -115,22 +115,14 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
}
};
}
startDelegateAI(new AIRobotSearchBlock(robot, blockFilter));
startDelegateAI(new AIRobotSearchRandomBlock(robot, blockFilter));
}
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoRandomGroundBlock) {
AIRobotGotoRandomGroundBlock gotoBlock = (AIRobotGotoRandomGroundBlock) ai;
if (gotoBlock.blockFound == null) {
startDelegateAI(new AIRobotGotoSleep(robot));
} else {
startDelegateAI(new AIRobotUseToolOnBlock(robot, gotoBlock.blockFound));
}
} else if (ai instanceof AIRobotSearchBlock) {
AIRobotSearchBlock gotoBlock = (AIRobotSearchBlock) ai;
if (ai instanceof AIRobotSearchRandomBlock) {
AIRobotSearchBlockBase gotoBlock = (AIRobotSearchBlockBase) ai;
if (gotoBlock.blockFound != null
&& robot.getRegistry().take(new ResourceIdBlock(gotoBlock.blockFound), robot)) {
@ -139,7 +131,7 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
robot.getRegistry().release(new ResourceIdBlock(blockFound));
}
((AIRobotSearchBlock) ai).unreserve();
gotoBlock.unreserve();
blockFound = gotoBlock.blockFound;
gotoBlock.path.removeLast();