Skip to content

Commit 5fb3e1e

Browse files
committed
Initial commit
0 parents  commit 5fb3e1e

13 files changed

Lines changed: 118 additions & 0 deletions

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 violine1101
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# MC-Region-Pregen
2+
3+
A data pack for pregenerating larger regions in Minecraft
4+
5+
## Usage
6+
7+
1. Teleport to the lowest coordinates where the region starts
8+
2. Run `/function regiongen:start`
9+
3. Wait for the data pack to teleport you around
10+
4. Done!
11+
12+
In order to stop the pregeneration prematurely, use `/function regiongen:stop`.
13+
14+
## Configuration
15+
16+
These configuration options are available:
17+
18+
### Teleportation speed
19+
20+
You can change the teleportation speed by using:
21+
22+
```
23+
/scoreboard players set stepLength regiongen <timeInTicks>
24+
```
25+
26+
The higher this value is, the slower the teleportation will go.
27+
28+
The lower this value is, the more likely it is that your computer won't keep up with world generation.
29+
It is recommended to use lower values with low render distance (2-4 chunks).
30+
31+
By default, the teleportation speed is 1 teleportation per second.
32+
33+
### Region size
34+
35+
You can change the size of the pregenerated region:
36+
37+
```
38+
/scoreboard players set xRegionSize regiongen <sizeInChunks>
39+
/scoreboard players set zRegionSize regiongen <sizeInChunks>
40+
```
41+
42+
By default, the region size is 32x32 chunks (size of a `.mca` file).
43+
44+
## Drawbacks
45+
The current version of this pack only teleports one chunk at a time, meaning that it might take a long time for an entire region to be pregenerated.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"values": [
3+
"regiongen:load"
4+
]
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"values": [
3+
"regiongen:tick"
4+
]
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
scoreboard objectives add regiongen dummy
2+
3+
scoreboard players set xRegionSize regiongen 32
4+
scoreboard players set zRegionSize regiongen 32
5+
scoreboard players set curX regiongen 0
6+
scoreboard players set curZ regiongen 0
7+
scoreboard players set stepLength regiongen 20
8+
scoreboard players set #nextStep regiongen 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tag @s add regiongen
2+
summon armor_stand ~ ~ ~ {Tags: [regiongen_as], NoGravity: 1b, Marker: 1b}
3+
execute as @e[tag=regiongen_as] at @s run forceload add ~ ~
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
execute if score #nextStep regiongen >= stepLength regiongen run function regiongen:teleport
2+
scoreboard players add #nextStep regiongen 1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tag @a remove regiongen
2+
scoreboard players set curX regiongen 0
3+
scoreboard players set curZ regiongen 0
4+
scoreboard players set #nextStep regiongen 0
5+
6+
kill @e[tag=regiongen_as]
7+
forceload remove all
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
execute unless score curX regiongen matches 0 run function regiongen:teleport_next_row
2+
execute if score curX regiongen matches 0 if score curZ regiongen matches 0 run function regiongen:teleport_next_row
3+
execute if score curX regiongen matches 0 unless score curZ regiongen matches 0 run function regiongen:teleport_next_col
4+
5+
execute unless score curZ regiongen < zRegionSize regiongen run function regiongen:stop
6+
7+
scoreboard players add curX regiongen 1
8+
scoreboard players operation curX regiongen %= xRegionSize regiongen
9+
execute if score curX regiongen matches 0 run scoreboard players add curZ regiongen 1
10+
11+
scoreboard players set #nextStep regiongen 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
execute as @e[tag=regiongen_as] at @s run tp @s ~ ~ ~16
2+
execute as @a[tag=regiongen] run tp @s @e[tag=regiongen_as,limit=1,sort=nearest]
3+
execute as @e[tag=regiongen_as] at @s run forceload add ~ ~

0 commit comments

Comments
 (0)