Skip to content

Instantly share code, notes, and snippets.

@cerus
Created December 29, 2020 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerus/2e54686297980a2d7fda4f29bc29c843 to your computer and use it in GitHub Desktop.
Save cerus/2e54686297980a2d7fda4f29bc29c843 to your computer and use it in GitHub Desktop.
this.getServer().getScheduler().runTaskAsynchronously(this, () -> {
// The raytracing stuff is done here
final byte[][] bytes = new RayTracer().captureFrame(player.getEyeLocation(), 128, 128, false);
// Everything below is just map stuff
final DrawAdapterImpl drawAdapter = new DrawAdapterImpl();
for (int x = 0; x < bytes.length; x++) {
for (int y = 0; y < bytes[x].length; y++) {
drawAdapter.setPixel(x, y, bytes[x][y]);
}
}
// FakeMap is basically a client-side map
final FakeMap fakeMap = new FakeMap(nmsAdapter, drawAdapter);
fakeMap.setId(((MapMeta) player.getInventory().getItemInMainHand().getItemMeta()).getMapId());
fakeMap.addObserver(player);
fakeMap.setLocked(true);
fakeMap.setTrackPos(false);
fakeMap.send();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment