private ForgeDirection getMovementDirection(
     int x, int y, int z, ForgeDirection last, Random rand) {
   // if (rand.nextInt(3) == 0 && this.canMove(x, y, z, last) && !this.hasCellFrom(x, y, z, last))
   // //bias towards continuing direction
   //	return last;
   last = pathCache.getLast().getOpposite();
   // ReikaJavaLibrary.pConsole("Data at "+x+", "+y+", "+z+"; last is "+last);
   ArrayList<ForgeDirection> li =
       ReikaJavaLibrary.makeListFromArray(ForgeDirection.VALID_DIRECTIONS);
   int idx = rand.nextInt(li.size());
   while (li.get(idx) == last
       || !this.canMove(x, y, z, li.get(idx))
       || this.hasCellFrom(x, y, z, li.get(idx))) {
     li.remove(idx);
     // dir = ForgeDirection.VALID_DIRECTIONS[rand.nextInt(6)];
     if (li.isEmpty()) {
       for (int i = 0; i < 6; i++) {
         ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[i];
         // ReikaJavaLibrary.pConsole(dir+": LAST="+(dir == last)+"| CANMOVE="+!this.canMove(x, y,
         // z, dir)+"| HAS="+this.hasCellFrom(x, y, z, dir));
       }
       // ReikaJavaLibrary.pConsole("UNVISIT="+this.hasUnvisitedNeighbors(x, y, z));
       // ReikaJavaLibrary.pConsole("Had no paths yet has an unvisited neighbor?!!");
     }
     idx = rand.nextInt(li.size());
     // ReikaJavaLibrary.pConsole("Random testing "+idx+" of "+li.size());
   }
   if (li.isEmpty()) {
     // ReikaJavaLibrary.pConsole("Had no paths yet has an unvisited neighbor?!!");
   }
   return li.get(idx);
 }
示例#2
0
 private void collectSortAndReplace(Comparator c) {
   ArrayList<CreativeTabs> list =
       ReikaJavaLibrary.makeListFromArray(CreativeTabs.creativeTabArray);
   for (CreativeTabs t : childTabs) {
     list.remove(t);
   }
   Collections.sort(list, c);
   for (CreativeTabs p : tabGroups.keySet()) {
     LinkedList<CreativeTabs> ch = tabGroups.get(p);
     int index = list.indexOf(p) + 1;
     for (CreativeTabs t : ch) {
       list.add(index, t);
       index++;
     }
   }
   CreativeTabs.creativeTabArray = new CreativeTabs[list.size()];
   for (int i = 0; i < list.size(); i++) {
     CreativeTabs t = list.get(i);
     t.tabIndex = i;
     CreativeTabs.creativeTabArray[i] = t;
   }
 }
示例#3
0
 public final void renderAll(boolean a, boolean b, boolean c, boolean d) {
   Object[] arr = {a, b, c, d};
   this.renderAll(ReikaJavaLibrary.makeListFromArray(arr), 0);
 }
 public ArrayList<MazePath> getPaths() {
   return ReikaJavaLibrary.makeListFromArray(solutions);
 }