Exemplo n.º 1
0
  @Override
  public void draw(Graphics2D g) {
    String string =
        WorldMapRenderer.pixelsToTiles(map.getCenterX())
            + " | "
            + WorldMapRenderer.pixelsToTiles(map.getCenterY())
            + "\n"
            + renderer.getRenderCenterX()
            + "|"
            + renderer.getRenderCenterY();

    renderer.draw(g, map, wm.getWidth(), wm.getHeight());
    g.drawString(string, 0, FONT_SIZE);
  }
Exemplo n.º 2
0
  public void a(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {
    if (!world.isStatic) {
      WorldMap worldmap = this.a(itemstack, world);

      if (entity instanceof EntityHuman) {
        EntityHuman entityhuman = (EntityHuman) entity;

        worldmap.a(entityhuman, itemstack);
      }

      if (flag) {
        this.a(world, entity, worldmap);
      }
    }
  }
Exemplo n.º 3
0
 public void init() {
   super.init();
   initInput();
   // create and start a new Resource Manager.  The resource Manager is responsible for loading
   // game elements.
   ResourceManager rM = new ResourceManager(wm.getFullScreenWindow().getGraphicsConfiguration());
   world = generateGameWorld(SIZE_H, SIZE_W);
   // load our resources!
   renderer = new WorldMapRenderer();
   map = new WorldMap(world, SIZE_H, SIZE_W);
   // initialize the renderer at the center of the map(Or of course, whereever the hell we want to
   // really)
   renderer.setRenderCenterX(wm.getWidth() / 2 - map.getCenterX());
   renderer.setRenderCenterY(wm.getHeight() / 2 - map.getCenterY());
 }
Exemplo n.º 4
0
  @Override
  public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
      WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world);

      world =
          world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps

      itemstack.setData(world.b("map"));
      WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

      worldmap1.scale = (byte) (worldmap.scale + 1);
      if (worldmap1.scale > 4) {
        worldmap1.scale = 4;
      }

      worldmap1.centerX = worldmap.centerX;
      worldmap1.centerZ = worldmap.centerZ;
      worldmap1.map = worldmap.map;
      worldmap1.c();
      world.a("map_" + itemstack.getData(), worldmap1);

      // CraftBukkit start
      MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
      Bukkit.getServer().getPluginManager().callEvent(event);
      // CraftBukkit end
    }
  }
Exemplo n.º 5
0
  public WorldMap getSavedMap(ItemStack itemstack, World world) {
    World worldMain =
        world
            .getServer()
            .getServer()
            .worlds
            .get(0); // CraftBukkit - store reference to primary world
    String s = "map_" + itemstack.getData();
    WorldMap worldmap =
        (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps

    if (worldmap == null && !world.isStatic) {
      itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps
      s = "map_" + itemstack.getData();
      worldmap = new WorldMap(s);
      worldmap.scale = 3;
      int i = 128 * (1 << worldmap.scale);

      worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i;
      worldmap.centerZ = Math.round(world.getWorldData().e() / i) * i;
      worldmap.map =
          (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
      worldmap.c();
      worldMain.a(s, worldmap); // CraftBukkit - use primary world for maps

      // CraftBukkit start
      MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
      Bukkit.getServer().getPluginManager().callEvent(event);
      // CraftBukkit end
    }

    return worldmap;
  }
Exemplo n.º 6
0
  /**
   * paintComponent schreibt alle Laendernamen an die entsprechende Stelle der Landkarte
   * (Hintergrundgrafik) und zeichnet die Laendergrenzen auf der Landkarte nach.
   *
   * @param g Zeichenflaeche der Landkarte
   */
  public void paintComponent(Graphics g) {
    Shape shape;

    Graphics2D g2d = (Graphics2D) g;
    g2d.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
    Font myFont = new Font("Times New Roman", Font.BOLD, 12);
    g2d.setFont(myFont);

    g2d.setStroke(new BasicStroke(2.0f));

    Territory territory;
    Color color;

    ListIterator territories = worldMap.getTerritories().listIterator();

    while (territories.hasNext()) {
      territory = (Territory) territories.next();

      if (territory.getOwner() != null) {
        color = territory.getOwner().getPlayerColor();
      } else {
        color = Color.WHITE;
      }

      g2d.setColor(color);
      g2d.drawString(
          territory.getName(),
          (int) territory.getMidpoint().getX() - 15,
          (int) territory.getMidpoint().getY() - 10);

      g2d.drawString(
          new Integer(territory.getArmySize()).toString(),
          (int) territory.getMidpoint().getX(),
          (int) territory.getMidpoint().getY());
    }

    if (territoryBattle.size() != 0) {
      for (int j = 0; j < territoryBattle.size(); j++) {
        g2d.setColor(territoryBattle.get(j).getOwner().getPlayerColor());
        // g2d.fillPolygon(territoryTmp.getFrontiers());   Sieht bei unseren Grenzen nicht huebsch
        // aus
        g2d.drawPolygon(territoryBattle.get(j).getFrontiers());
      }
    }

    repaint();
  }
Exemplo n.º 7
0
  public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    itemstack.b(world.b("map"));
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = new WorldMap(s);

    world.a(s, (WorldMapBase) worldmap);
    worldmap.b = MathHelper.floor(entityhuman.locX);
    worldmap.c = MathHelper.floor(entityhuman.locZ);
    worldmap.e = 3;
    worldmap.map = (byte) world.worldProvider.dimension;
    worldmap.a();
  }
Exemplo n.º 8
0
  /**
   * Konstruktor MapView Aufgabe ist das Setzen der WorldMap und die Hintergrundgrafik (Landkarte)
   * zu setzen.
   *
   * @param worldMap Zum View gehoerige Instanz der Klasse WorldMap.
   */
  public MapView(WorldMap worldMap) {

    this.worldMap = worldMap;
    this.territoryBattle = new ArrayList<Territory>();
    this.setLayout(null);

    String path = System.getProperty("java.class.path") + "/risk/maps/" + worldMap.getGraphic();
    // String path = "/home/swa/Desktop/maps/"+worldMap.getGraphic();

    MediaTracker mt = new MediaTracker(this);
    this.img = Toolkit.getDefaultToolkit().getImage(path);
    mt.addImage(this.img, 0);
    try {
      mt.waitForAll();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    this.setPreferredSize(new Dimension(img.getWidth(null), img.getHeight(null)));

    this.setVisible(true);
  }
Exemplo n.º 9
0
  public WorldMap a(ItemStack itemstack, World world) {

    WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData());

    if (worldmap == null) {
      itemstack.b(world.b("map"));
      String s = "map_" + itemstack.getData();

      worldmap = new WorldMap(s);
      worldmap.b = world.r().c();
      worldmap.c = world.r().e();
      worldmap.e = 3;
      worldmap.map = (byte) world.worldProvider.dimension;
      worldmap.a();
      world.a(s, (WorldMapBase) worldmap);
    }

    return worldmap;
  }
Exemplo n.º 10
0
 /** Enables the world map. Called by dialogue boxes. */
 public static void enableWorldMap() {
   map.setEnabled(true);
 }
  public void track(List<EntityHuman> list) {
    this.b = false;
    if (!this.isMoving || this.tracker.d(this.q, this.r, this.s) > 16.0D) {
      this.q = this.tracker.locX;
      this.r = this.tracker.locY;
      this.s = this.tracker.locZ;
      this.isMoving = true;
      this.b = true;
      this.scanPlayers(list);
    }

    List list1 = this.tracker.bx();

    if (!list1.equals(this.w)) {
      this.w = list1;
      this.broadcast(new PacketPlayOutMount(this.tracker));
    }

    // PAIL : rename
    if (this.tracker
        instanceof
        EntityItemFrame /*&& this.a % 10 == 0*/) { // CraftBukkit - Moved below, should always enter
                                                   // this block
      EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
      ItemStack itemstack = entityitemframe.getItem();

      if (this.a % 10 == 0
          && itemstack.getItem()
              instanceof
              ItemWorldMap) { // CraftBukkit - Moved this.a % 10 logic here so item frames do not
                              // enter the other blocks
        WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, this.tracker.world);
        Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit

        while (iterator.hasNext()) {
          EntityHuman entityhuman = (EntityHuman) iterator.next();
          EntityPlayer entityplayer = (EntityPlayer) entityhuman;

          worldmap.a(entityplayer, itemstack);
          Packet packet =
              Items.FILLED_MAP.a(itemstack, this.tracker.world, (EntityHuman) entityplayer);

          if (packet != null) {
            entityplayer.playerConnection.sendPacket(packet);
          }
        }
      }

      this.d();
    }

    if (this.a % this.g == 0 || this.tracker.impulse || this.tracker.getDataWatcher().a()) {
      int i;

      if (this.tracker.isPassenger()) {
        i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
        int j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
        boolean flag = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;

        if (flag) {
          this.broadcast(
              new PacketPlayOutEntity.PacketPlayOutEntityLook(
                  this.tracker.getId(), (byte) i, (byte) j, this.tracker.onGround));
          this.yRot = i;
          this.xRot = j;
        }

        this.xLoc = EntityTracker.a(this.tracker.locX);
        this.yLoc = EntityTracker.a(this.tracker.locY);
        this.zLoc = EntityTracker.a(this.tracker.locZ);
        this.d();
        this.x = true;
      } else {
        ++this.v;
        long k = EntityTracker.a(this.tracker.locX);
        long l = EntityTracker.a(this.tracker.locY);
        long i1 = EntityTracker.a(this.tracker.locZ);
        int j1 = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
        int k1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
        long l1 = k - this.xLoc;
        long i2 = l - this.yLoc;
        long j2 = i1 - this.zLoc;
        Object object = null;
        boolean flag1 = l1 * l1 + i2 * i2 + j2 * j2 >= 128L || this.a % 60 == 0;
        boolean flag2 = Math.abs(j1 - this.yRot) >= 1 || Math.abs(k1 - this.xRot) >= 1;

        // CraftBukkit start - Code moved from below
        if (flag1) {
          this.xLoc = k;
          this.yLoc = l;
          this.zLoc = i1;
        }

        if (flag2) {
          this.yRot = j1;
          this.xRot = k1;
        }
        // CraftBukkit end

        if (this.a > 0 || this.tracker instanceof EntityArrow) {
          if (l1 >= -32768L
              && l1 < 32768L
              && i2 >= -32768L
              && i2 < 32768L
              && j2 >= -32768L
              && j2 < 32768L
              && this.v <= 400
              && !this.x
              && this.y == this.tracker.onGround) {
            if ((!flag1 || !flag2) && !(this.tracker instanceof EntityArrow)) {
              if (flag1) {
                object =
                    new PacketPlayOutEntity.PacketPlayOutRelEntityMove(
                        this.tracker.getId(), l1, i2, j2, this.tracker.onGround);
              } else if (flag2) {
                object =
                    new PacketPlayOutEntity.PacketPlayOutEntityLook(
                        this.tracker.getId(), (byte) j1, (byte) k1, this.tracker.onGround);
              }
            } else {
              object =
                  new PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook(
                      this.tracker.getId(),
                      l1,
                      i2,
                      j2,
                      (byte) j1,
                      (byte) k1,
                      this.tracker.onGround);
            }
          } else {
            this.y = this.tracker.onGround;
            this.v = 0;
            // CraftBukkit start - Refresh list of who can see a player before sending teleport
            // packet
            if (this.tracker instanceof EntityPlayer) {
              this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
            }
            // CraftBukkit end
            this.c();
            object = new PacketPlayOutEntityTeleport(this.tracker);
          }
        }

        boolean flag3 = this.u;

        if (this.tracker instanceof EntityLiving && ((EntityLiving) this.tracker).cH()) {
          flag3 = true;
        }

        if (flag3 && this.a > 0) {
          double d0 = this.tracker.motX - this.n;
          double d1 = this.tracker.motY - this.o;
          double d2 = this.tracker.motZ - this.p;
          double d3 = 0.02D;
          double d4 = d0 * d0 + d1 * d1 + d2 * d2;

          if (d4 > 4.0E-4D
              || d4 > 0.0D
                  && this.tracker.motX == 0.0D
                  && this.tracker.motY == 0.0D
                  && this.tracker.motZ == 0.0D) {
            this.n = this.tracker.motX;
            this.o = this.tracker.motY;
            this.p = this.tracker.motZ;
            this.broadcast(
                new PacketPlayOutEntityVelocity(this.tracker.getId(), this.n, this.o, this.p));
          }
        }

        if (object != null) {
          this.broadcast((Packet) object);
        }

        this.d();
        /* CraftBukkit start - Code moved up
        if (flag1) {
            this.xLoc = k;
            this.yLoc = l;
            this.zLoc = i1;
        }

        if (flag2) {
            this.yRot = j1;
            this.xRot = k1;
        }
        // CraftBukkit end */

        this.x = false;
      }

      i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
      if (Math.abs(i - this.headYaw) >= 1) {
        this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i));
        this.headYaw = i;
      }

      this.tracker.impulse = false;
    }

    ++this.a;
    if (this.tracker.velocityChanged) {
      // CraftBukkit start - Create PlayerVelocity event
      boolean cancelled = false;

      if (this.tracker instanceof EntityPlayer) {
        Player player = (Player) this.tracker.getBukkitEntity();
        org.bukkit.util.Vector velocity = player.getVelocity();

        PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
        this.tracker.world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
          cancelled = true;
        } else if (!velocity.equals(event.getVelocity())) {
          player.setVelocity(event.getVelocity());
        }
      }

      if (!cancelled) {
        this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
      }
      // CraftBukkit end
      this.tracker.velocityChanged = false;
    }
  }
Exemplo n.º 12
0
  public void a(World world, Entity entity, WorldMap worldmap) {
    if (world.worldProvider.dimension == worldmap.map) {
      short short1 = 128;
      short short2 = 128;
      int i = 1 << worldmap.e;
      int j = worldmap.b;
      int k = worldmap.c;
      int l = MathHelper.floor(entity.locX - (double) j) / i + short1 / 2;
      int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
      int j1 = 128 / i;

      if (world.worldProvider.e) {
        j1 /= 2;
      }

      ++worldmap.g;

      for (int k1 = l - j1 + 1; k1 < l + j1; ++k1) {
        if ((k1 & 15) == (worldmap.g & 15)) {
          int l1 = 255;
          int i2 = 0;
          double d0 = 0.0D;

          for (int j2 = i1 - j1 - 1; j2 < i1 + j1; ++j2) {
            if (k1 >= 0 && j2 >= -1 && k1 < short1 && j2 < short2) {
              int k2 = k1 - l;
              int l2 = j2 - i1;
              boolean flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2);
              int i3 = (j / i + k1 - short1 / 2) * i;
              int j3 = (k / i + j2 - short2 / 2) * i;
              byte b0 = 0;
              byte b1 = 0;
              byte b2 = 0;
              int[] aint = new int[256];
              Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
              int k3 = i3 & 15;
              int l3 = j3 & 15;
              int i4 = 0;
              double d1 = 0.0D;
              int j4;
              int k4;
              int l4;
              int i5;

              if (world.worldProvider.e) {
                l4 = i3 + j3 * 231871;
                l4 = l4 * l4 * 31287121 + l4 * 11;
                if ((l4 >> 20 & 1) == 0) {
                  aint[Block.DIRT.id] += 10;
                } else {
                  aint[Block.STONE.id] += 10;
                }

                d1 = 100.0D;
              } else {
                for (l4 = 0; l4 < i; ++l4) {
                  for (j4 = 0; j4 < i; ++j4) {
                    k4 = chunk.b(l4 + k3, j4 + l3) + 1;
                    int j5 = 0;

                    if (k4 > 1) {
                      boolean flag1 = false;

                      do {
                        flag1 = true;
                        j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
                        if (j5 == 0) {
                          flag1 = false;
                        } else if (k4 > 0
                            && j5 > 0
                            && Block.byId[j5].material.E == MaterialMapColor.b) {
                          flag1 = false;
                        }

                        if (!flag1) {
                          --k4;
                          j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
                        }
                      } while (k4 > 0 && !flag1);

                      if (k4 > 0 && j5 != 0 && Block.byId[j5].material.isLiquid()) {
                        i5 = k4 - 1;
                        boolean flag2 = false;

                        int k5;

                        do {
                          k5 = chunk.getTypeId(l4 + k3, i5--, j4 + l3);
                          ++i4;
                        } while (i5 > 0 && k5 != 0 && Block.byId[k5].material.isLiquid());
                      }
                    }

                    d1 += (double) k4 / (double) (i * i);
                    ++aint[j5];
                  }
                }
              }

              i4 /= i * i;
              int l5 = b0 / (i * i);

              l5 = b1 / (i * i);
              l5 = b2 / (i * i);
              l4 = 0;
              j4 = 0;

              for (k4 = 0; k4 < 256; ++k4) {
                if (aint[k4] > l4) {
                  j4 = k4;
                  l4 = aint[k4];
                }
              }

              double d2 =
                  (d1 - d0) * 4.0D / (double) (i + 4) + ((double) (k1 + j2 & 1) - 0.5D) * 0.4D;
              byte b3 = 1;

              if (d2 > 0.6D) {
                b3 = 2;
              }

              if (d2 < -0.6D) {
                b3 = 0;
              }

              i5 = 0;
              if (j4 > 0) {
                MaterialMapColor materialmapcolor = Block.byId[j4].material.E;

                if (materialmapcolor == MaterialMapColor.n) {
                  d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
                  b3 = 1;
                  if (d2 < 0.5D) {
                    b3 = 2;
                  }

                  if (d2 > 0.9D) {
                    b3 = 0;
                  }
                }

                i5 = materialmapcolor.q;
              }

              d0 = d1;
              if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) {
                byte b4 = worldmap.f[k1 + j2 * short1];
                byte b5 = (byte) (i5 * 4 + b3);

                if (b4 != b5) {
                  if (l1 > j2) {
                    l1 = j2;
                  }

                  if (i2 < j2) {
                    i2 = j2;
                  }

                  worldmap.f[k1 + j2 * short1] = b5;
                }
              }
            }
          }

          if (l1 <= i2) {
            worldmap.a(k1, l1, i2);
          }
        }
      }
    }
  }
Exemplo n.º 13
0
  public void a(World world, Entity entity, WorldMap worldmap) {
    // CraftBukkit - world.worldProvider -> ((WorldServer) world)
    if (((WorldServer) world).dimension == worldmap.map && entity instanceof EntityHuman) {
      int i = 1 << worldmap.scale;
      int j = worldmap.centerX;
      int k = worldmap.centerZ;
      int l = MathHelper.floor(entity.locX - j) / i + 64;
      int i1 = MathHelper.floor(entity.locZ - k) / i + 64;
      int j1 = 128 / i;

      if (world.worldProvider.g) {
        j1 /= 2;
      }

      WorldMapHumanTracker worldmaphumantracker = worldmap.a((EntityHuman) entity);

      ++worldmaphumantracker.d;

      for (int k1 = l - j1 + 1; k1 < l + j1; ++k1) {
        if ((k1 & 15) == (worldmaphumantracker.d & 15)) {
          int l1 = 255;
          int i2 = 0;
          double d0 = 0.0D;

          for (int j2 = i1 - j1 - 1; j2 < i1 + j1; ++j2) {
            if (k1 >= 0 && j2 >= -1 && k1 < 128 && j2 < 128) {
              int k2 = k1 - l;
              int l2 = j2 - i1;
              boolean flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2);
              int i3 = (j / i + k1 - 64) * i;
              int j3 = (k / i + j2 - 64) * i;
              HashMultiset hashmultiset = HashMultiset.create();
              Chunk chunk = world.getChunkAtWorldCoords(i3, j3);

              if (!chunk.isEmpty()) {
                int k3 = i3 & 15;
                int l3 = j3 & 15;
                int i4 = 0;
                double d1 = 0.0D;
                int j4;

                if (world.worldProvider.g) {
                  j4 = i3 + j3 * 231871;
                  j4 = j4 * j4 * 31287121 + j4 * 11;
                  if ((j4 >> 20 & 1) == 0) {
                    hashmultiset.add(Blocks.DIRT.f(0), 10);
                  } else {
                    hashmultiset.add(Blocks.STONE.f(0), 100);
                  }

                  d1 = 100.0D;
                } else {
                  for (j4 = 0; j4 < i; ++j4) {
                    for (int k4 = 0; k4 < i; ++k4) {
                      int l4 = chunk.b(j4 + k3, k4 + l3) + 1;
                      Block block = Blocks.AIR;
                      int i5 = 0;

                      if (l4 > 1) {
                        do {
                          --l4;
                          block = chunk.getType(j4 + k3, l4, k4 + l3);
                          i5 = chunk.getData(j4 + k3, l4, k4 + l3);
                        } while (block.f(i5) == MaterialMapColor.b && l4 > 0);

                        if (l4 > 0 && block.getMaterial().isLiquid()) {
                          int j5 = l4 - 1;

                          Block block1;

                          do {
                            block1 = chunk.getType(j4 + k3, j5--, k4 + l3);
                            ++i4;
                          } while (j5 > 0 && block1.getMaterial().isLiquid());
                        }
                      }

                      d1 += (double) l4 / (double) (i * i);
                      hashmultiset.add(block.f(i5));
                    }
                  }
                }

                i4 /= i * i;
                double d2 = (d1 - d0) * 4.0D / (i + 4) + ((k1 + j2 & 1) - 0.5D) * 0.4D;
                byte b0 = 1;

                if (d2 > 0.6D) {
                  b0 = 2;
                }

                if (d2 < -0.6D) {
                  b0 = 0;
                }

                MaterialMapColor materialmapcolor =
                    Iterables.getFirst(
                        Multisets.copyHighestCountFirst(hashmultiset), MaterialMapColor.b);

                if (materialmapcolor == MaterialMapColor.n) {
                  d2 = i4 * 0.1D + (k1 + j2 & 1) * 0.2D;
                  b0 = 1;
                  if (d2 < 0.5D) {
                    b0 = 2;
                  }

                  if (d2 > 0.9D) {
                    b0 = 0;
                  }
                }

                d0 = d1;
                if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) {
                  byte b1 = worldmap.colors[k1 + j2 * 128];
                  byte b2 = (byte) (materialmapcolor.M * 4 + b0);

                  if (b1 != b2) {
                    if (l1 > j2) {
                      l1 = j2;
                    }

                    if (i2 < j2) {
                      i2 = j2;
                    }

                    worldmap.colors[k1 + j2 * 128] = b2;
                  }
                }
              }
            }
          }

          if (l1 <= i2) {
            worldmap.flagDirty(k1, l1, i2);
          }
        }
      }
    }
  }