@Override
    protected void paintComponent(Graphics g)
    {
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, getWidth(), getHeight());

        int xMin = divideDown(xPos, CHUNK_SIZE);
        int xMax = divideDown(xPos + getWidth() + CHUNK_SIZE, CHUNK_SIZE);
        int zMin = divideDown(zPos, CHUNK_SIZE);
        int zMax = divideDown(zPos + getHeight() + CHUNK_SIZE, CHUNK_SIZE);

        chunks.move(xMin, zMin, xMax - xMin + 1, zMax - zMin + 1);

        for (int x = xMin; x <= xMax; x++)
            for (int z = zMin; z <= zMax; z++)
            {
                BiomeChunk c = chunks.getChunk(x, z);
                if (c != null)
                    g.drawImage(c.img, x * CHUNK_SIZE - xPos, z * CHUNK_SIZE - zPos, null);
            }
        
        if(in && !down)
        {
            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
            
            g.setColor(new Color(0, 0, 0, 128));
            g.fillRect(mouseX+10, mouseZ+10, 100, 50);
            g.setColor(Color.WHITE);
            Biome b = null;
            int cx = divideDown(xPos+mouseX, CHUNK_SIZE);
            int cz = divideDown(zPos+mouseZ, CHUNK_SIZE);
            BiomeChunk c = chunks.getChunk(cx, cz);
            if(c != null && c.biomes != null)
                b = c.biomes[(xPos+mouseX)- cx*CHUNK_SIZE][(zPos+mouseZ)- cz*CHUNK_SIZE];
            String s = "???";
            if(b != null)
                s = b.name;
            g.drawString(s, mouseX+16, mouseZ+30);
            g.drawString((mouseX + xPos) + ", " + (mouseZ + zPos), mouseX+16, mouseZ+50);
        }
    }