Skip to content

Commit a4ed86f

Browse files
davidmayrHighVirus
andauthored
ASP 4.1.0 - 1.21.7 (#168)
* fix: empty compound tags causing null pointers when e.g. heightmaps are missing Signed-off-by: David Mayr <[email protected]> * chore: update paper Signed-off-by: David Mayr <[email protected]> * Additional chunk data with SRF 13 (#161) * feat: begin working on srf 13 Signed-off-by: David Mayr <[email protected]> * feat: moonrise implementation for entity and poi loading, further improvements Signed-off-by: David Mayr <[email protected]> * fix: dont put the wrong DataVersion in the tag when data fixing Signed-off-by: David Mayr <[email protected]> * feat: document format, swap poi chunks around to match read order, allow for future additions to the format Signed-off-by: David Mayr <[email protected]> * chore: javadoc Signed-off-by: David Mayr <[email protected]> * chore: remove some useless things Signed-off-by: David Mayr <[email protected]> * feat: section flags for sky and block light Signed-off-by: David Mayr <[email protected]> * fix: the thing I just fixed for the other formats for SRF 13 Signed-off-by: David Mayr <[email protected]> * fix: potential entity save errors Signed-off-by: David Mayr <[email protected]> * fix: entities not saving in vanilla worlds on autosave Signed-off-by: David Mayr <[email protected]> --------- Signed-off-by: David Mayr <[email protected]> * 1.21.6 (#165) * fix: make asp compile with file patches only on 1.21.5 Signed-off-by: David <[email protected]> * fix: npe on null cache Signed-off-by: David <[email protected]> * fix: paper server feature patches Signed-off-by: David <[email protected]> * feat: port all patches Signed-off-by: David <[email protected]> * chore: add big fat temporary warning and fail if someone loads an old world Signed-off-by: David <[email protected]> * chore: clarify on why saveIncrementally is commented out Signed-off-by: David <[email protected]> * feat: incremental saving is back in paper Signed-off-by: David <[email protected]> * feat: update to newest 1.21.5 commit Signed-off-by: David Mayr <[email protected]> * feat: initial 1.21.6-pre3 work Signed-off-by: David Mayr <[email protected]> * fix: compilation issues on ASP side Signed-off-by: David Mayr <[email protected]> * fix: update to newest paper Signed-off-by: David Mayr <[email protected]> * fix: compilation problems --nobuild Signed-off-by: David Mayr <[email protected]> * fix: lists with multiple types in conversion Signed-off-by: David Mayr <[email protected]> * feat: full 1.21.6 release Signed-off-by: David Mayr <[email protected]> * feat: update paper Signed-off-by: David Mayr <[email protected]> * fix: temporarily downgrade adventure Signed-off-by: David Mayr <[email protected]> * feat: update to newest paper Signed-off-by: David Mayr <[email protected]> --------- Signed-off-by: David <[email protected]> Signed-off-by: David Mayr <[email protected]> * feat: allow changing sea level using a slime property and change default to vanilla world sea level (Closes #166) Signed-off-by: David Mayr <[email protected]> * feat: change the default back to what it was before to avoid breaking changes, allow sea level modification in plugin config Signed-off-by: David Mayr <[email protected]> * fix: properties being accessed before they are ready Signed-off-by: David Mayr <[email protected]> * feat: use bstats server metrics Signed-off-by: David Mayr <[email protected]> * fix: allow animals was not applied Signed-off-by: David Mayr <[email protected]> * feat: allow to specify biome and environment on world creation as these variables are difficult to change later Signed-off-by: David Mayr <[email protected]> * Constructor with custom HikariDataSource for mysql-loader (#167) * feat(mysql-loader): add constructor that accepts HikariDataSource * feat(mysql-loader): add ApiStatus.Experimental to constructor * feat: update to upstream paper 57c202e01516b653aea9c7e050eaded1448863e5 Signed-off-by: David Mayr <[email protected]> feat: update to upstream paper 57c202e01516b653aea9c7e050eaded1448863e5 Signed-off-by: David Mayr <[email protected]> * chore: update adventure Signed-off-by: David Mayr <[email protected]> * feat: 1.21.7 update Signed-off-by: David Mayr <[email protected]> * chore: change api version to release --nobuild Signed-off-by: David Mayr <[email protected]> --------- Signed-off-by: David Mayr <[email protected]> Signed-off-by: David <[email protected]> Co-authored-by: Edoardo Mannino <[email protected]>
1 parent 2b60acc commit a4ed86f

File tree

54 files changed

+1084
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1084
-306
lines changed

SLIME_FORMAT

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
-------------------------------------
22

3-
“Slime” file format
3+
“Slime” file format (Version 13)
44
2 bytes - magic = 0xB10B
5-
1 byte (ubyte) - version, current = 0x0C
5+
1 byte (ubyte) - version, current = 0x0D
66
4 bytes (int) - world version
7+
1 byte (ubyte) - additional world flags (bitmask - see options below)
78
4 bytes (int) - compressed chunks size
89
4 bytes (int) - uncompressed chunks size
910
<array of chunks> (size determined from bitmask)
@@ -13,35 +14,62 @@
1314
4 bytes (int) - uncompressed “extra” size
1415
[depends] - extra compound tag compressed using zstd (used for PDC, and/or custom data)
1516

17+
-------------------------------------
18+
Additional world flag index
19+
POI_CHUNKS - Enum ordinal 0 - Bitmask value 1
20+
FLUID_TICKS - Enum ordinal 1 - Bitmask value 2
21+
BLOCK_TICKS - Enum ordinal 2 - Bitmask value 4
1622
-------------------------------------
1723

1824
Custom chunk format
1925
4 byte (int) - chunk x
2026
4 byte (int) - chunk z
2127
4 bytes (int) section count
2228
[for each section]
23-
1 byte (boolean) - has sky light
29+
1 byte (ubyte) - section flags (Bitmask value 1 = has block light, 2 = has sky light)
2430
[if has sky light]
2531
2048 bytes - sky light
26-
1 byte (boolean) - has block light
27-
[if has block light]
28-
2048 bytes - block light
32+
[if has block light]
33+
2048 bytes - block light
2934
4 bytes (int) - block states byte size
30-
<block states component>
35+
<block states nbt compound>
36+
same format as mc
3137
4 bytes (int) - biomes byte size
32-
<biomes component>
38+
<biomes nbt compound>
39+
same format as mc
3340
4 bytes (int) - heightmaps size
34-
<array of heightmap nbt compounds>
41+
<nbt compound>
3542
same format as mc, uncompressed
43+
[if poi chunks flag is enabled]
44+
4 bytes (int) - poi chunk size
45+
<nbt compound>
46+
"Sections" tag of the mc poi chunk compound
47+
uncompressed
48+
[if block ticks flag is enabled]
49+
4 bytes (int) - fluid ticks size
50+
<nbt compound>
51+
Same format as mc
52+
inside an nbt list named "block_ticks"
53+
uncompressed
54+
[if fluid ticks flag is enabled]
55+
4 bytes (int) - heightmaps size
56+
<nbt compound>
57+
Same format as mc
58+
inside an nbt list named "fluid_ticks"
59+
uncompressed
60+
[for every flag set that does not exist yet, for backward compatibility of new future flags]
61+
4 bytes (int) - size
62+
<byte array with unsupported yet undocumented data>
63+
3664
4 bytes (int) - tile entities size
37-
<array of tile entity nbt compounds>
65+
<nbt compound>
3866
Same format as mc
39-
inside an nbt list named “tileEntities”, in a global compound
67+
inside an nbt list named “tileEntities”
4068
uncompressed
4169
4 bytes (int) entities size
42-
<array of entity nbt compounds>
43-
Same format as mc EXCEPT optional “CustomId”
44-
inside an nbt list named “entities”, in a global compound
70+
<nbt compound>
71+
Same format as mc
72+
inside an nbt list named “entities”
4573
uncompressed
4674
[depends] - compound tag uncompressed (used for PDC, and/or custom data
4775

@@ -60,3 +88,4 @@ Version history:
6088
- v10: Use minecraft version id, remove legacy version artifacts
6189
- v11: Move entities and tile entities into the chunk structure
6290
- v12: Add support for chunk-based PDC
91+
- v13: Add support for additional world data

api/src/main/java/com/infernalsuite/asp/api/utils/SlimeFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public class SlimeFormat {
99
public static final byte[] SLIME_HEADER = new byte[] { -79, 11 };
1010

1111
/** Latest version of the SRF that SWM supports **/
12-
public static final byte SLIME_VERSION = 12;
12+
public static final byte SLIME_VERSION = 13;
1313
}

api/src/main/java/com/infernalsuite/asp/api/world/SlimeChunk.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.infernalsuite.asp.api.world;
22

3+
import com.infernalsuite.asp.api.world.properties.SlimeProperties;
34
import net.kyori.adventure.nbt.BinaryTag;
45
import net.kyori.adventure.nbt.CompoundBinaryTag;
6+
import net.kyori.adventure.nbt.ListBinaryTag;
57

68
import java.util.List;
79
import java.util.Map;
@@ -38,6 +40,7 @@ public interface SlimeChunk {
3840
*
3941
* @return A {@link CompoundBinaryTag} containing all the height maps of the chunk.
4042
*/
43+
@Nullable
4144
CompoundBinaryTag getHeightMaps();
4245

4346
/**
@@ -73,4 +76,41 @@ public interface SlimeChunk {
7376
*/
7477
@Nullable
7578
CompoundBinaryTag getUpgradeData();
79+
80+
/**
81+
* Returns all block ticks of the chunk. This data is only saved when {@link SlimeProperties#SAVE_BLOCK_TICKS} is true.
82+
* <p>
83+
* Even if {@link SlimeProperties#SAVE_BLOCK_TICKS} is false, this might still return
84+
* a {@link ListBinaryTag} containing the block ticks, if the data was present when the world
85+
* was read or when the chunk is currently loaded.
86+
*
87+
* @return A {@link ListBinaryTag} containing all the block ticks of the chunk, if present.
88+
* @see SlimeProperties#SAVE_FLUID_TICKS
89+
*/
90+
@Nullable
91+
ListBinaryTag getBlockTicks();
92+
93+
/**
94+
* Returns all fluid ticks of the chunk. This data is only saved when {@link SlimeProperties#SAVE_FLUID_TICKS} is true.
95+
* <p>
96+
* Even if {@link SlimeProperties#SAVE_FLUID_TICKS} is false, this might still return a {@link ListBinaryTag}
97+
* containing the fluid ticks, if the data was present when the world was read or when the chunk is currently loaded.
98+
*
99+
* @return A {@link ListBinaryTag} containing all the fluid ticks of the chunk, if present.
100+
* @see SlimeProperties#SAVE_FLUID_TICKS
101+
*/
102+
@Nullable
103+
ListBinaryTag getFluidTicks();
104+
105+
/**
106+
* Returns the poi sections of the chunk. This data is only saved when {@link SlimeProperties#SAVE_POI} is true.
107+
* <p>
108+
* Even if {@link SlimeProperties#SAVE_POI} is false, this might still return a {@link CompoundBinaryTag}
109+
* containing the poi sections, if the data was present when the world was read or when the chunk is currently loaded.
110+
*
111+
* @return A {@link CompoundBinaryTag} containing the poi chunks of the chunk, if present.
112+
* @see SlimeProperties#SAVE_POI
113+
*/
114+
@Nullable
115+
CompoundBinaryTag getPoiChunkSections();
76116
}

api/src/main/java/com/infernalsuite/asp/api/world/properties/SlimeProperties.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,39 @@ public class SlimeProperties {
9898
value.equalsIgnoreCase("aggressive") || value.equalsIgnoreCase("never")
9999
);
100100

101-
102-
103101
@ApiStatus.Experimental
104102
public static final SlimePropertyInt CHUNK_SECTION_MIN = SlimePropertyInt.create("chunkSectionMin", -4);
105103
@ApiStatus.Experimental
106104
public static final SlimePropertyInt CHUNK_SECTION_MAX = SlimePropertyInt.create("chunkSectionMax", 19);
107105

106+
/**
107+
* The sea level to use for the slime world. This affects mob spawning for water specific mobs like squids or turtles.
108+
* To achieve the default vanilla behaviour, change this value to 63 instead of the default of -63.
109+
*/
110+
@ApiStatus.Experimental
111+
public static final SlimePropertyInt SEA_LEVEL = SlimePropertyInt.create("seaLevel", -63);
108112

113+
/**
114+
* Whether to save the POI data in the world or not. Worlds that already have POI data will still load the data
115+
* even if this is set to false. However, the POI data will no longer be saved when the world is saved.
116+
* <p>
117+
* POI data is e.g. used for villager jobs, villager beds, bees, lightning rods. This data is not saved in slime by default.
118+
*/
119+
public static final SlimePropertyBoolean SAVE_POI = SlimePropertyBoolean.create("savePOI", false);
120+
121+
/**
122+
* Whether to save the block ticks in the world or not. Worlds that already have block tick data will still load the data
123+
* even if this is set to false. However, the block tick data will no longer be saved when the world is saved.
124+
* <p>
125+
* Block ticks are used for scheduling e.g. redstone updates. If this data is not saved, redstone will pause when chunks or worlds get re-loaded.
126+
*/
127+
public static final SlimePropertyBoolean SAVE_BLOCK_TICKS = SlimePropertyBoolean.create("saveBlockTicks", false);
128+
129+
/**
130+
* Whether to save the fluid ticks in the world or not. Worlds that already have fluid tick data will still load the data
131+
* even if this is set to false. However, the fluid tick data will no longer be saved when the world is saved.
132+
* <p>
133+
* Fluid ticks are used for scheduling liquid flow updates. If this data is not saved, fluids will freeze when chunks or worlds get re-loaded.
134+
*/
135+
public static final SlimePropertyBoolean SAVE_FLUID_TICKS = SlimePropertyBoolean.create("saveFluidTicks", false);
109136
}

aspaper-api/build.gradle.kts.patch

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
--- a/paper-api/build.gradle.kts
22
+++ b/paper-api/build.gradle.kts
3-
@@ -39,7 +_,7 @@
3+
@@ -40,6 +_,7 @@
44
}
55

66
dependencies {
7-
-
87
+ api(project(":api")) //ASP
98
// api dependencies are listed transitively to API consumers
109
api("com.google.guava:guava:33.3.1-jre")
1110
api("com.google.code.gson:gson:2.11.0")
12-
@@ -93,7 +_,7 @@
11+
@@ -90,7 +_,7 @@
1312
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
1413
}
1514

16-
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
17-
+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
15+
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
16+
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
1817
idea {
1918
module {
20-
generatedSourceDirs.add(generatedApiPath.toFile())
21-
@@ -103,6 +_,18 @@
19+
generatedSourceDirs.add(generatedDir.toFile())
20+
@@ -100,6 +_,18 @@
2221
main {
2322
java {
24-
srcDir(generatedApiPath)
23+
srcDir(generatedDir)
2524
+ srcDir(file("../paper-api/src/main/java"))
2625
+ }
2726
+ resources {
@@ -37,7 +36,7 @@
3736
}
3837
}
3938
}
40-
@@ -169,7 +_,7 @@
39+
@@ -166,7 +_,7 @@
4140

4241
tasks.withType<Javadoc> {
4342
val options = options as StandardJavadocDocletOptions
@@ -46,7 +45,7 @@
4645
options.use()
4746
options.isDocFilesSubDirs = true
4847
options.links(
49-
@@ -202,11 +_,11 @@
48+
@@ -199,11 +_,11 @@
5049
}
5150

5251
// workaround for https://github.com/gradle/gradle/issues/4046

aspaper-server/build.gradle.kts.patch

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
--- a/paper-server/build.gradle.kts
22
+++ b/paper-server/build.gradle.kts
3-
@@ -21,6 +_,17 @@
4-
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
5-
// gitFilePatches = true
3+
@@ -26,6 +_,17 @@
4+
minecraftVersion = providers.gradleProperty("mcVersion")
5+
gitFilePatches = false
66

77
+ val aspaper = forks.register("aspaper") {
88
+ upstream.patchDir("paperServer") {
@@ -16,9 +16,9 @@
1616
+ activeFork = aspaper
1717
+
1818
spigot {
19-
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
20-
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
21-
@@ -101,7 +_,20 @@
19+
enabled = false
20+
buildDataRef = "281ac0de7a76d808753ede97d11b034bc801b63d"
21+
@@ -107,7 +_,19 @@
2222
}
2323
}
2424

@@ -33,25 +33,23 @@
3333
+ resources { srcDir("../paper-server/src/test/resources") }
3434
+ }
3535
+}
36-
+
3736
+val log4jPlugins = sourceSets.create("log4jPlugins") {
3837
+ java { srcDir("../paper-server/src/log4jPlugins/java") }
3938
+}
4039
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
4140
extendsFrom(configurations.compileClasspath.get())
4241
}
43-
@@ -119,7 +_,9 @@
42+
@@ -129,7 +_,8 @@
4443
}
4544

4645
dependencies {
4746
- implementation(project(":paper-api"))
4847
+ implementation(project(":aspaper-api")) //ASP
4948
+ implementation(project(":core")) //ASP
50-
+ implementation("commons-io:commons-io:2.11.0")
5149
implementation("ca.spottedleaf:concurrentutil:0.0.3")
5250
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
5351
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
54-
@@ -189,14 +_,14 @@
52+
@@ -205,14 +_,14 @@
5553
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
5654
attributes(
5755
"Main-Class" to "org.bukkit.craftbukkit.Main",
@@ -71,3 +69,12 @@
7169
"Build-Number" to (build ?: ""),
7270
"Build-Time" to buildTime.toString(),
7371
"Git-Branch" to gitBranch,
72+
@@ -271,7 +_,7 @@
73+
jvmArgumentProviders.add(provider)
74+
}
75+
76+
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
77+
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-server/src/generated/java").asFile.toPath()
78+
idea {
79+
module {
80+
generatedSourceDirs.add(generatedDir.toFile())

aspaper-server/minecraft-patches/features/0001-Disable-dragon-battle.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable dragon battle
55

66

77
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
8-
index c5ddf6c0f0ff795da2f7aec8915a081b334423ec..a373f5b8e03f4179a4d9f63d79abc19a38f952b6 100644
8+
index 53ec0565a76663de74bb228c23c3d74a640a20f9..2c85ace929aeb9078fe868bcc56a2be08ac2f7ba 100644
99
--- a/net/minecraft/server/level/ServerLevel.java
1010
+++ b/net/minecraft/server/level/ServerLevel.java
11-
@@ -689,7 +689,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
11+
@@ -684,7 +684,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1212
);
1313
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
1414
if (this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END

aspaper-server/minecraft-patches/features/0002-World-overrides.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Subject: [PATCH] World overrides
55

66

77
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
8-
index 1509c96ae9247d1d5ddd0fc50210f88da10bf3de..bbc4be3c3811ee19bd791cb6626474038d35a298 100644
8+
index 3349baa2ab971db435b88083688bd0f99474607e..610e58bede7e1482fc861ab6559f4f3a6e7e3633 100644
99
--- a/net/minecraft/server/MinecraftServer.java
1010
+++ b/net/minecraft/server/MinecraftServer.java
1111
@@ -516,18 +516,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

aspaper-server/minecraft-patches/features/0003-Avoid-IO-call-for-UUID.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Subject: [PATCH] Avoid IO call for UUID
55

66

77
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
8-
index 8429a97047f4321df96fd11559867bce74d0a49c..60608cea4e564c1ce47f8a4de2c1a48986bbdecb 100644
8+
index 2c85ace929aeb9078fe868bcc56a2be08ac2f7ba..939605ce630ab66b7236962dec3ae61ed23dc222 100644
99
--- a/net/minecraft/server/level/ServerLevel.java
1010
+++ b/net/minecraft/server/level/ServerLevel.java
11-
@@ -617,7 +617,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
11+
@@ -612,7 +612,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1212
super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
1313
this.pvpMode = server.isPvpAllowed();
1414
this.levelStorageAccess = levelStorageAccess;
15-
- this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile());
16-
+ this.uuid = bootstrap == null ? org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile()) : UUID.randomUUID(); //ASP - avoid IO calls
15+
- this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile());
16+
+ this.uuid = bootstrap == null ? org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile()) : java.util.UUID.randomUUID(); //ASP - avoid IO calls
1717
// CraftBukkit end
1818
this.tickTime = tickTime;
1919
this.server = server;

aspaper-server/minecraft-patches/features/0004-Prevent-config-disk-io-on-world-load.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ Subject: [PATCH] Prevent config disk io on world load
55

66

77
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
8-
index 60608cea4e564c1ce47f8a4de2c1a48986bbdecb..1b5d65136421b63353b1c6cd8ae5d413ec070b92 100644
8+
index 939605ce630ab66b7236962dec3ae61ed23dc222..51cfeb87385b7e40922049a197a417a3892c2fce 100644
99
--- a/net/minecraft/server/level/ServerLevel.java
1010
+++ b/net/minecraft/server/level/ServerLevel.java
11-
@@ -614,7 +614,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
11+
@@ -609,7 +609,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1212
) {
1313
//ASP end
1414
// CraftBukkit start
1515
- super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
1616
+ super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> bootstrap != null ? com.infernalsuite.asp.config.SlimePaperWorldConfig.initializeOrGet() : server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor //ASP - Optimize world config
1717
this.pvpMode = server.isPvpAllowed();
1818
this.levelStorageAccess = levelStorageAccess;
19-
this.uuid = bootstrap == null ? org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile()) : UUID.randomUUID(); //ASP - avoid IO calls
19+
this.uuid = bootstrap == null ? org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile()) : java.util.UUID.randomUUID(); //ASP - avoid IO calls
2020
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
21-
index 1dbe7c7c1051c3972105534a07ce50d4cf98fc85..e1d3c292b9efccb032245f4f1618f2650f0bc619 100644
21+
index e4b9a564aad3d9b673808caa18265b06592ceab8..8bb30eba86b74f155ef9580dc6c01d761e23dd5a 100644
2222
--- a/net/minecraft/world/level/Level.java
2323
+++ b/net/minecraft/world/level/Level.java
24-
@@ -851,7 +851,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
24+
@@ -838,7 +838,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
2525
this.maxSectionY = this.maxY >> 4;
2626
this.sectionsCount = this.maxSectionY - this.minSectionY + 1;
2727
// Paper end - getblock optimisations - cache world height/sections
2828
- this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
2929
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), !(this instanceof com.infernalsuite.asp.level.SlimeLevelInstance)); // Spigot //ASP - Improve Slime IO
3030
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
31-
this.generator = gen;
32-
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
31+
this.generator = generator;
32+
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);

0 commit comments

Comments
 (0)