*
* @throws Cauldron.NotACauldronException
*/
public void findCauldronContents(LocalPlayer player, World world, Block block, int minY, int maxY, Map<Location, ItemInfo> visited) {
ItemInfo blockID = cauldronBlock;
// Don't want to go too low or high
if (block.getY() < minY) return;
if (block.getY() > maxY) return;
// There is likely a leak in the cauldron (or this isn't a cauldron)
if (visited.size() > 24) {
player.printError("mech.cauldron.leaky");
return;
}
// Prevent infinite looping
if (visited.containsKey(block.getLocation())) return;
Material type = block.getType();
// Make water work reliably
if (type == Material.STATIONARY_WATER)
type = Material.WATER;
// Make lava work reliably
if (type == Material.STATIONARY_LAVA)
type = Material.LAVA;
visited.put(block.getLocation(), new ItemInfo(type, block.getData()));
// It's a wall -- we only needed to remember that we visited it but
// we don't need to recurse
if (type == blockID.getType()) return;
// Must have a lava floor
Block lavaPos = recurse(0, block.getY() - minY + 1, 0, block);
if (world.getBlockTypeIdAt(lavaPos.getX(), lavaPos.getY(), lavaPos.getZ()) == BlockID.LAVA) {
player.printError("mech.cauldron.no-lava");