private void SearchAndSpawnBlocks() { SpawnMap = new HashMap<String, Boolean>(); DataMap = new HashMap<String, String>(); WideSearchQueue = new LinkedList<Position>(); WideSearchCount = 0; WideSearchQueue.offer(new Position(X, Y, Z)); while (WideSearchCount++ < AnimalCrossing.WideSearchMax && !WideSearchQueue.isEmpty()) { SearchNext(world, WideSearchQueue.poll()); } Set<String> Keys = SpawnMap.keySet(); int SpawnedCount = 0; for (String key : Keys) { if (!SpawnMap.get(key)) continue; Position pos = Position.from(key); int wx = (int) pos.getX(); int wy = (int) pos.getY(); int wz = (int) pos.getZ(); world.setBlockToAir(wx, wy, wz); String[] vals = DataMap.get(key).split(":"); int eID = UtilNumber.getParsedInt(vals[0]); int eMeta = UtilNumber.getParsedInt(vals[1]); EntityFallingTreePart entity = new EntityFallingTreePart( world, pos.getX() + .5D, pos.getY() + .5D, pos.getZ() + .5D, eID, eMeta, new Position(X, Y, Z), Block.blocksList[eID].getBlockDropped( world, wx, wy, wz, eMeta, EnchantmentHelper.getFortuneModifier(player))); entity.setPosition(wx + .5D, wy + .5D, wz + .5D); world.spawnEntityInWorld(entity); ModLoader.getMinecraftInstance().theWorld.spawnEntityInWorld(entity); SpawnedCount++; } player.getCurrentEquippedItem().damageItem(SpawnedCount, player); Achievements.triggerAchievement(player, Achievements.cutATree); }