示例#1
0
  /**
   * Render overlay icons
   *
   * @param world
   * @param chunky
   * @param g
   * @param renderBuffer
   */
  public void renderHUD(World world, Chunky chunky, Graphics g, RenderBuffer renderBuffer) {

    boolean loadIndicator = chunky.isLoading();
    Chunk.Renderer renderer = chunky.getChunkRenderer();

    ChunkView view = renderBuffer.getView();

    if (loadIndicator) {
      g.drawImage(MiscImages.clock, view.width - 32, 0, 32, 32, null);
    }

    if (world.havePlayerPos()) {
      renderPlayer(
          world,
          g,
          view,
          renderer == Chunk.surfaceRenderer || world.playerLocY() == world.currentLayer());
    }

    if (world.haveSpawnPos()) {
      renderSpawn(
          world,
          g,
          view,
          renderer == Chunk.surfaceRenderer || world.spawnPosY() == world.currentLayer());
    }

    Chunk hoveredChunk = chunky.getHoveredChunk();
    if (!hoveredChunk.isEmpty()) {

      g.setFont(font);
      g.setColor(Color.white);
      g.drawString("Chunk: " + hoveredChunk.getPosition(), 5, view.height - 5);
    }
  }
示例#2
0
  /**
   * Constructor
   *
   * @param chunky
   */
  public WorldSelector(Chunky chunky) {
    super(chunky.getFrame());
    this.chunky = chunky;

    setTitle(Messages.getString("WorldSelector.0")); // $NON-NLS-1$

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(Dialog.ModalityType.MODELESS);

    initComponents();
    fillWorldList();

    pack();
    setLocationRelativeTo(chunky.getFrame());
    setVisible(true);
  }
示例#3
0
 @Override
 public void valueChanged(ListSelectionEvent event) {
   int selected = event.getFirstIndex();
   if (selected >= 0 && selected < worlds.size()) {
     chunky.loadWorld(worlds.get(selected));
     WorldSelector.this.dispose();
   }
 }
示例#4
0
 private void fillWorldList() {
   fillWorldList(WorldDirectoryPicker.getWorldDirectory(chunky.getFrame()));
 }