Skip to content

Instantly share code, notes, and snippets.

@reedacartwright
Created May 23, 2020 02:19
Show Gist options
  • Save reedacartwright/9c09989cc23e00c65053bb7dc02e6388 to your computer and use it in GitHub Desktop.
Save reedacartwright/9c09989cc23e00c65053bb7dc02e6388 to your computer and use it in GitHub Desktop.
Plotting Overworld Chunks
library(tidyverse)
library(rbedrock)
# generate a list of worlds
list_worlds()
# use the most recent file, adjust as needed
dbpath <- list_worlds()$folder[1]
# open the world db
db <- bedrockdb(dbpath)
# read all the keys in the database
keys <- db$keys()
# extract chunk info
chunks <- parse_chunk_keys(keys)
# extract overworld x,z chunk coords
xz <- chunks %>%
filter(dimension == 0 & tag == "ChunkVersion") %>%
select(x,z)
# create figure
g <- ggplot(aes(xmin=16*x, ymin=16*z, xmax=16*(x+1), ymax=16*(z+1)),data=xz) +
geom_rect()
g <- g + coord_fixed() + scale_y_reverse() + xlab("x") + ylab("z")
print(g)
# close database
db$close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment