public synchronized void tick(World tickedWorld) { if (fluidCrafters.isEmpty()) return; int dim = tickedWorld.provider.getDimension(); HashMultimap<BlockPos, FluidCraftInstance> worldCrafters = fluidCrafters.get(dim); if (worldCrafters == null || worldCrafters.isEmpty()) return; HashMultimap<BlockPos, FluidCraftInstance> crafterToRemove = HashMultimap.create(); Multimaps.asMap(worldCrafters).forEach((pos, crafterList) -> { if (!tickedWorld.isBlockLoaded(pos)) return; List<EntityItem> items = tickedWorld.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos).grow(1)); crafterList.forEach(crafter -> { if (!crafter.isValid(tickedWorld, pos, items)) { crafterToRemove.put(pos, crafter); } else { crafter.tick(tickedWorld, pos, items); if (crafter.isFinished()) { crafter.finish(tickedWorld, pos, items); crafterToRemove.put(pos, crafter); } } }); }); crafterToRemove.forEach(worldCrafters::remove); if (worldCrafters.isEmpty()) fluidCrafters.remove(dim); } }