コード例 #1
0
  private void print(int x, int y, int z) {
    ReikaJavaLibrary.pConsole(
        "================================================================================================");

    for (int n = 0; n <= ANCHORS; n++) {

      world.clear();
      for (int i = 0; i < MAX_SIZE_X; i++) {
        for (int k = 0; k < MAX_SIZE_Z; k++) {
          Point pt = new Point(i, k);
          if (!anchorRadii.containsKey(pt)) {
            MazePiece p = new MazePiece(this, partSize, pt);
            for (ForgeDirection dir : dirs) {
              if (locationCache[n].get(pt).contains(dir)) p.connect(dir, true);
            }
            int dx = x + i * partSize;
            int dz = z + k * partSize;

            p.generate(world, dx, y, dz);
          }
        }
      }

      ReikaJavaLibrary.pConsole(
          "------------------------------------------------------------------------------------");
      int r = MAX_SIZE_X * partSize;
      char[][] data = new char[r][r];
      for (int i = 0; i < r; i++) {
        for (int k = 0; k < r; k++) {
          int dx = x + i;
          int dz = z + k;
          BlockKey bk = world.getBlock(dx, y + 1, dz); // +1 to not be floor
          char c = '?';
          if (bk != null) {
            if (bk.blockID == Blocks.air) {
              c = ' ';
            } else if (bk.blockID == ChromaBlocks.STRUCTSHIELD.getBlockInstance()) {
              c = '#';
            }
          }
          data[i][k] = c;
        }
      }
      for (int i = 0; i < r; i++) {
        String s = new String(data[i]);
        ReikaJavaLibrary.pConsole(s);
      }
      ReikaJavaLibrary.pConsole(
          "------------------------------------------------------------------------------------");
    }

    ReikaJavaLibrary.pConsole(
        "================================================================================================");
  }
コード例 #2
0
 public static void addTracker(PlayerTracker pt) {
   String s = pt.getID();
   if (tags.contains(s)) throw new MisuseException("Duplicate PlayerTracker ID: " + s);
   ReikaJavaLibrary.pConsole("DRAGONAPI: Creating player tracker " + s);
   list.add(pt);
   tags.add(s);
 }
コード例 #3
0
 private boolean breakCoil() {
   if (inslot[0] == null) return false;
   if (inslot[0].itemID != ItemRegistry.SPRING.getShiftedID()) return false;
   int dmg = inslot[0].getItemDamage();
   float diff = (float) dmg / 65536 * 0.05F;
   boolean rand = ReikaMathLibrary.doWithChance(diff);
   if (rand) ReikaJavaLibrary.pConsole(dmg, Side.SERVER);
   return rand;
 }
コード例 #4
0
 public void readFromNBT(NBTTagCompound tag) {
   NBTTagList li = tag.getTagList("locs", NBTTypes.COMPOUND.ID);
   for (Object o : li.tagList) {
     NBTTagCompound data = (NBTTagCompound) o;
     WorldLocation loc = WorldLocation.readFromNBT(data);
     TileEntity te = loc.getTileEntity();
     try {
       V v = (V) te;
       this.data.put(loc, v);
     } catch (ClassCastException e) { // ugly, but no other way to test if te instanceof V
       ReikaJavaLibrary.pConsole("Tried to load a TileEntityCache from invalid NBT!");
     }
   }
 }
コード例 #5
0
 protected void printSafeList() {
   for (int i = 0; i < safePlayers.size(); i++) {
     String player = safePlayers.get(i);
     if (player == null) player = "NULL PLAYER IN SLOT " + i;
     else if (player.isEmpty()) player = "EMPTY STRING PLAYER IN SLOT " + i;
     ReikaJavaLibrary.pConsole(
         "Side "
             + FMLCommonHandler.instance().getEffectiveSide()
             + ": Safe Player "
             + (i + 1)
             + " of "
             + safePlayers.size()
             + ": "
             + player);
   }
 }