Untitled

mail@pastecode.io avatar
unknown
julia
a year ago
4.0 kB
1
Indexable
Never
# Loading the R Packages
library(rbedrock)
library(tidyverse)

# Creating a Normal World
# 1L is Creative
dpath <- create_world(LevelName="Void World with Borders",
                      showcoordinates=TRUE,
                      GameType=1L,
                      SpawnX=0L,
                      SpawnY=65535L,
                      SpawnZ=0L)

db <- bedrockdb(fs::path_real(dpath))

# Making the Void Chunks(Overworld)
# 2625 in the Grid is the number of Chunks => 42,000 Blocks from 0,0,0
g <- expand_grid(x = -2625:2624, z = -2625:2624)

# Initializing chunk data to plains biome
biomes <- biome_id("plains")
put_chunk_version_values(db, g$x, g$z, 0, 16L)
put_finalization_values(db, g$x, g$z, 0, 2L)
put_2dmaps_values(db, g$x, g$z, 0, list(list(
  height_map = 0L,
  biome_map = biomes
)))

# Adding a Bedrock Block at 0 64 0 (Overworld)
blocks <- array("minecraft:air", c(16,16,16))
blocks[1,16,1] <- "minecraft:bedrock"
put_subchunk_blocks_value(db, 0, 0, 0, 3, blocks)

# Adding Border at 40,000 (Overworld)
blocks <- array("minecraft:air", c(16, 16, 16))
blocks[,1,1] <- "minecraft:border_block"
g <- expand_grid(x = -2500:2500, z = -2500, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 0, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[,1,1] <- "minecraft:border_block"
g <- expand_grid(x = -2500:2500, z = 2500, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 0, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[1,1,] <- "minecraft:border_block"
g <- expand_grid(x = -2500, z = -2500:2500, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 0, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[1,1,] <- "minecraft:border_block"
g <- expand_grid(x = 2500, z = -2500:2500, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 0, 
                           subchunk = 0, value = g$value)






# Making the Void Chunks(Nether)
# 428 in the Grid is the number of Chunks => 6,848 Blocks from 0,0,0
g <- expand_grid(x=-428:428, z=-428:428, dimension=1)

# Initializing chunk data to nether wastes biome
put_chunk_version_values(g$x, g$z, g$dimension, values = 40, db = db)
put_finalized_state_values(g$x, g$z, g$dimension, values = 2, db = db)
put_biomes_values(g$x, g$z, g$dimension, values = "hell", missing_height=128L, db = db)

# Adding a Roof of Bedrock to create a perimeter in these new chunks
#blocks <- array("minecraft:air", c(16,128,16))
#blocks[,128,] <- "minecraft:bedrock@infiniburn_bit=false"
#chunk_origin(blocks) <- c(0,0,0)
#put_chunk_blocks_values(g$x, g$z, g$dimension, values = list(blocks), db = db)

# Adding Border at 5,000 (Nether)
blocks <- array("minecraft:air", c(16, 16, 16))
blocks[,1,9] <- "minecraft:border_block"
g <- expand_grid(x = -313:313, z = -313, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 1, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[,1,9] <- "minecraft:border_block"
g <- expand_grid(x = -313:313, z = 312, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 1, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[9,1,] <- "minecraft:border_block"
g <- expand_grid(x = -313, z = -312:313, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 1, 
                           subchunk = 0, value = g$value)

blocks <- array("minecraft:air", c(16, 16, 16))
blocks[9,1,] <- "minecraft:border_block"
g <- expand_grid(x = 312, z = -313:313, value = list(blocks))
put_subchunk_blocks_values(db = db, x = g$x, z = g$z, dimension = 1, 
                           subchunk = 0, value = g$value)

close(db)