public IItemRailing findNearestInventory(IItemRailingTransfer itemwrapper) { IItemRailing[] arr = (IItemRailing[]) this.getNodes().toArray(); Arrays.sort( arr, new RailingDistanceComparator.RailingInventoryDistanceComparator(itemwrapper.getRailing())); return arr[0]; }
public IItemRailing chooseNextInstantGoal(IItemRailingTransfer itemwrapper) { IItemRailing[] arr = (IItemRailing[]) itemwrapper.getRailing().getConnectionMap().entrySet().toArray(); Arrays.sort(arr, new RailingDistanceComparator(itemwrapper.getEndGoal())); return arr[0]; }