First server patches

This commit is contained in:
Nassim Jahnke 2022-12-07 18:08:55 +01:00
parent fd58a696cb
commit 4fbe8d0b9b
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
9 changed files with 324 additions and 457 deletions

View File

@ -63,7 +63,7 @@ repositories {
dependencies {
paramMappings("net.fabricmc:yarn:1.19.3+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
decompiler("net.minecraftforge:forgeflower:2.0.605.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
paperclip("io.papermc:paperclip:3.0.2")
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remap fixes
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 700fd7f0ef6ba5798389b41a52f887e76917893d..eabf34265470e68b56c0d8787a7acffcf9b49e83 100644
index 954cf20fb9fbf331fe6314590a3edbe73118ceca..d4c46f44f7a998121482c2fc56d7986881d489d8 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -270,9 +270,11 @@ public class BlockPos extends Vec3i {
@@ -274,9 +274,11 @@ public class BlockPos extends Vec3i {
public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) {
int i = rangeX + rangeY + rangeZ;
@ -23,7 +23,7 @@ index 700fd7f0ef6ba5798389b41a52f887e76917893d..eabf34265470e68b56c0d8787a7acffc
return () -> {
return new AbstractIterator<BlockPos>() {
private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
@@ -287,7 +289,7 @@ public class BlockPos extends Vec3i {
@@ -291,7 +293,7 @@ public class BlockPos extends Vec3i {
protected BlockPos computeNext() {
if (this.zMirror) {
this.zMirror = false;
@ -32,7 +32,7 @@ index 700fd7f0ef6ba5798389b41a52f887e76917893d..eabf34265470e68b56c0d8787a7acffc
return this.cursor;
} else {
BlockPos blockPos;
@@ -313,7 +315,7 @@ public class BlockPos extends Vec3i {
@@ -317,7 +319,7 @@ public class BlockPos extends Vec3i {
int k = this.currentDepth - Math.abs(i) - Math.abs(j);
if (k <= rangeZ) {
this.zMirror = k != 0;
@ -41,28 +41,11 @@ index 700fd7f0ef6ba5798389b41a52f887e76917893d..eabf34265470e68b56c0d8787a7acffc
}
}
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
index da83a40a74b291879d236ffccf36ee7a626a811e..556c4fe8d0d044c2995533f4f20cbde7283a2711 100644
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
@@ -53,9 +53,9 @@ public class SummonCommand {
nbttagcompound1.putString("id", entity.toString());
ServerLevel worldserver = source.getLevel();
- Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
- entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
- return entity1;
+ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - remap fix
+ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - remap fix
+ return loadedEntity; // Paper - remap fix
});
if (entity1 == null) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
index b2e9418aaf2b2c87f396304287595e519e72e3ad..098253e92bd95159de93fbbdf95daee341fc5752 100644
index 8f0a2f8d3a34c6b97bc7a933272ccf2689576c76..b9fcff8862e624644fdb73afcb3ef2106b0a76fc 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
@@ -174,11 +174,11 @@ public class BehaviorUtils {
@@ -173,11 +173,11 @@ public class BehaviorUtils {
return optional.map((uuid) -> {
return ((ServerLevel) entity.level).getEntity(uuid);
@ -78,7 +61,7 @@ index b2e9418aaf2b2c87f396304287595e519e72e3ad..098253e92bd95159de93fbbdf95daee3
entityliving1 = entityliving2;
} else {
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index 228e402a4efb6289fba58df3c0eac4cc608d4596..17c72a767e7b749ed78a9b54af19bae5381b296c 100644
index 0b76584d85194f0b60ed51f577353bfead0489f5..d025df087e7b87fbc89a722226f2f2263c54ac47 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -192,7 +192,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
@ -121,28 +104,26 @@ index ad52c3fc6210939a39ef77a382c640a24ee44838..6b7dd01778f0a5d3a96d2d04af4b525d
}
}
diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
index 8c4ad718e113f24a30fd11b345d34d6ca1ef73b0..1e84f541683ddb619c2a8dfcd2a141fba2bd851d 100644
index f0333f01dddb2808eeaa796d9284d5cb3ad4934c..861f60f0ba42c200c039226412024d94057adafe 100644
--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
+++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
@@ -5,7 +5,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.entity.EntityType;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
import org.junit.Test;
@@ -16,8 +15,8 @@ public class EntityTypesTest extends AbstractTestingBase {
@@ -16,7 +15,7 @@ public class EntityTypesTest extends AbstractTestingBase {
public void testMaps() {
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
- for (EntityType<?> nms : Registry.ENTITY_TYPE) {
- ResourceLocation key = EntityType.getKey(nms);
+ for (net.minecraft.world.entity.EntityType<?> nms : Registry.ENTITY_TYPE) { // Paper - remap fix
+ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix
- for (EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) {
+ for (net.minecraft.world.entity.EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) { // Paper - remap fix
ResourceLocation key = EntityType.getKey(nms);
org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath());
Assert.assertNotNull("Missing nms->bukkit " + key, bukkit);
diff --git a/src/test/java/org/bukkit/entity/PandaGeneTest.java b/src/test/java/org/bukkit/entity/PandaGeneTest.java
index 76e2ad676ae68846bdff3c3ef711751445fb0f3c..feee17192bca55a9cf1b2fc5b9609b888db77763 100644
--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java

View File

@ -5,17 +5,17 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts
index d10ff4a52c22033e2adb2a4e7f2cee98a13ea6c5..5d8a84341ab5be52b5c37737e3f82590f06f6073 100644
index 40d1dcd4a0870cf002ee6d0309ce667f49a89d35..a2d2c817cdc1798cd30b3a852b3a495bcbe1b91b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,10 +9,9 @@ plugins {
dependencies {
implementation(project(":paper-api"))
implementation("jline:jline:2.12.1")
- implementation("org.apache.logging.log4j:log4j-iostreams:2.17.0") {
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") {
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
- }
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.3")
+ implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation
implementation("commons-lang:commons-lang:2.6")
@ -29,7 +29,7 @@ index d10ff4a52c22033e2adb2a4e7f2cee98a13ea6c5..5d8a84341ab5be52b5c37737e3f82590
+ implementation("io.netty:netty-all:4.1.77.Final"); // Paper - Bump netty
}
val craftbukkitPackageVersion = "1_19_R1" // Paper
val craftbukkitPackageVersion = "1_19_R2" // Paper
@@ -34,6 +35,7 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
@ -67,7 +67,7 @@ index d10ff4a52c22033e2adb2a4e7f2cee98a13ea6c5..5d8a84341ab5be52b5c37737e3f82590
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f0b6c5d9a4e47c70307bc35ab34dc795b1462b04..62530625dac737b7c7be865f2a86fccdb8e78b3e 100644
index daec3479f451b322934000dc2942cdd6aff122ac..68aafbe2ff05ad2c48b8f3ed23d779680bca574a 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -192,7 +192,7 @@ public class Main {
@ -78,7 +78,7 @@ index f0b6c5d9a4e47c70307bc35ab34dc795b1462b04..62530625dac737b7c7be865f2a86fccd
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -28);
deadline.add(Calendar.DAY_OF_YEAR, -3);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View File

@ -14,11 +14,11 @@ public org.spigotmc.SpigotWorldConfig getString(Ljava/lang/String;Ljava/lang/Str
public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
diff --git a/build.gradle.kts b/build.gradle.kts
index 5d8a84341ab5be52b5c37737e3f82590f06f6073..cfdb20447e6ad3efcdee8889712f77931773beaf 100644
index a2d2c817cdc1798cd30b3a852b3a495bcbe1b91b..ebf3d64afbb5679b97a7565a2f8e5490e4a38275 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,6 +12,7 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.3")
implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation
+ implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
@ -4303,10 +4303,10 @@ index 0000000000000000000000000000000000000000..70cc7b45e7355f6c8476a74a070f1266
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 23e60283a6c99dde5fbb142da678f6569d163c97..4dd3af1416cbdad330365a19ad664079f3598c15 100644
index c1da75eb656d17bac41c1d5c7f57eac217c9996c..b7399e29094c66c88a6f4c0e996a906bcaa3b4ca 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -114,6 +114,11 @@ public class Main {
@@ -117,6 +117,11 @@ public class Main {
DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
dedicatedserversettings.forceSave();
@ -4318,7 +4318,7 @@ index 23e60283a6c99dde5fbb142da678f6569d163c97..4dd3af1416cbdad330365a19ad664079
Path path1 = Paths.get("eula.txt");
Eula eula = new Eula(path1);
@@ -150,7 +155,7 @@ public class Main {
@@ -153,7 +158,7 @@ public class Main {
}
File file = (File) optionset.valueOf("universe"); // CraftBukkit
@ -4328,10 +4328,10 @@ index 23e60283a6c99dde5fbb142da678f6569d163c97..4dd3af1416cbdad330365a19ad664079
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ec2d172cb8fb19b7d0c83b6bb948df66dce320f7..cd9f94b98f9b7072ed7ca1becd779132dfc1dd12 100644
index 84c1c6c433bad1c786bc7400d65d19cfcaa999e4..870db0028becd6b76af76190fae908d0031ed94d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -281,6 +281,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -292,6 +292,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final int SAMPLE_INTERVAL = 100;
public final double[] recentTps = new double[ 3 ];
// Spigot end
@ -4339,7 +4339,7 @@ index ec2d172cb8fb19b7d0c83b6bb948df66dce320f7..cd9f94b98f9b7072ed7ca1becd779132
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -371,6 +372,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -383,6 +384,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
@ -4386,10 +4386,10 @@ index 697ca7457115423a8c4d8a7d1f7a353237b56509..d7d65d0faefa5551480a4090de3a8818
}
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 7d965247833c91dc824e6cc56e8b0fe5f3413d1d..08ae7a96e93c0d8547f560b3f753804525621c6b 100644
index c434bec64863cb9023917e737c9471444f23a110..1fe07773cf9664164b29164caba22800e5a6bdae 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -188,6 +188,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -183,6 +183,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
@ -4413,23 +4413,23 @@ index 7c35fb22df0bca2c2ca885a872ee42d6073d852f..26fc8127024d7b81ffe5c1c81b8ef8a6
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4dae642adcc148bc101a0783c74454709f3243a4..61f1da79bbd0428c4d99f62974c06183230864b6 100644
index 5efdc61dfa1a8d74fead69e76425a45cd97783d5..caae5d862461c7dcf5fa9bf36e51276925668945 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -227,7 +227,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -230,7 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig))); // Paper
- super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig))); // Paper
this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c1194f459414dc6ca9626ab8cec48cb48cdd926b..649df119b24dc8c390f45e9f813cf8c37994e0cf 100644
index bf6f50cfe5225804ae2cab4f50bcc7ee2ddfe36e..ca5cbd7c43d7e263f76d8719a259514c0748a430 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -149,6 +149,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -152,6 +152,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
public boolean populating;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
@ -4442,7 +4442,7 @@ index c1194f459414dc6ca9626ab8cec48cb48cdd926b..649df119b24dc8c390f45e9f813cf8c3
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
public static BlockPos lastPhysicsProblem; // Spigot
@@ -166,8 +172,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -169,8 +175,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@ -4454,10 +4454,10 @@ index c1194f459414dc6ca9626ab8cec48cb48cdd926b..649df119b24dc8c390f45e9f813cf8c3
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 57814d847551122a4d700c397cde62d32b840950..7c3d02a8a3bac227692ad2349981bc8c6c600341 100644
index 030b852353f831a64a9466a2cfdfb0cd76243d8d..64db49f699ebd0baf1cce79c1ef20c5b7a83f2b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -872,6 +872,7 @@ public final class CraftServer implements Server {
@@ -885,6 +885,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
@ -4466,7 +4466,7 @@ index 57814d847551122a4d700c397cde62d32b840950..7c3d02a8a3bac227692ad2349981bc8c
world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 62530625dac737b7c7be865f2a86fccdb8e78b3e..0e80299f212d10d6ec7ffba6b2dbeff937d30f55 100644
index 68aafbe2ff05ad2c48b8f3ed23d779680bca574a..a857f9e20d2fe0f495df884e81489e89a64bea54 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -131,6 +131,19 @@ public class Main {
@ -4490,7 +4490,7 @@ index 62530625dac737b7c7be865f2a86fccdb8e78b3e..0e80299f212d10d6ec7ffba6b2dbeff9
};
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index a96cb7a5f7c94cd9a46b31cf8ec90b544221557b..7c35d86eac0d69ba4be48faf364fd6dc84fa7e87 100644
index b97720e8934121be0f937bff6e257682e5738221..b599e098e6d2e6f78b89114e05cb03d716b7c5f4 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -96,7 +96,7 @@ public class SpigotConfig
@ -4550,10 +4550,10 @@ index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a
+ }
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 6816d8a9fa504ca5a25fa62c0f0974e3e744ead6..e73a9a957cd55bf838e301ed531295162f2cfb89 100644
index 492c1ec28a9f1facb117d05245b32231554385ad..abf31f0fc3e68f3702f0500dbff7bb9d8be26887 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -46,6 +46,7 @@ public abstract class AbstractTestingBase {
@@ -58,6 +58,7 @@ public abstract class AbstractTestingBase {
DummyServer.setup();
DummyEnchantments.setup();

View File

@ -0,0 +1,172 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index d33cce0265a85a23d726742e7752331b63449144..dc7a805d3058244ba13c2268666f274e7ec069dc 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -370,7 +370,7 @@ public class Util {
}
public static <K> Hash.Strategy<K> identityStrategy() {
- return Util.IdentityStrategy.INSTANCE;
+ return (Hash.Strategy<K>) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix
}
public static <V> CompletableFuture<List<V>> sequence(List<? extends CompletableFuture<V>> futures) {
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index d4c46f44f7a998121482c2fc56d7986881d489d8..6801a3aa5f2f1e9a7a72ff81c09b4944ecb8349d 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -379,12 +379,12 @@ public class BlockPos extends Vec3i {
if (this.index == l) {
return this.endOfData();
} else {
- int i = this.index % i;
- int j = this.index / i;
- int k = j % j;
- int l = j / j;
+ int offsetX = this.index % i; // Paper - decomp fix
+ int u = this.index / i; // Paper - decomp fix
+ int offsetY = u % j; // Paper - decomp fix
+ int offsetZ = u / j; // Paper - decomp fix
++this.index;
- return this.cursor.set(startX + i, startY + k, startZ + l);
+ return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix
}
}
};
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 24e864d1cd376e9f94cfa68fd06f96b239eed888..c0fe7c576f2361e599bc23003da7c49bb7cb62b2 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -505,7 +505,7 @@ public final class NbtUtils {
}
public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) {
- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue();
+ return (CompoundTag) fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix
}
public static Component toPrettyComponent(Tag element) {
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
index 2df8fa1ae2dc58291add80fae0599ee4ff5066ee..ed7e1a6fc745df745d5bc79623948bb1015c9252 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
@@ -138,8 +138,7 @@ public class ComponentUtils {
ComponentContents string = text.getContents();
if (string instanceof TranslatableContents) {
TranslatableContents translatableContents = (TranslatableContents)string;
- String string = translatableContents.getKey();
- return Language.getInstance().has(string);
+ return Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 870db0028becd6b76af76190fae908d0031ed94d..06b1da8b559f9d545f1593d81de7b25e0a12f176 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1747,7 +1747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
PackRepository resourcepackrepository = this.packRepository;
Objects.requireNonNull(this.packRepository);
- return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
+ return stream.<Pack>map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore?
}, this).thenCompose((immutablelist) -> {
MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist);
diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java
index 2f66abf62d303342f5fe614fb3e35e7844497ffc..b346fa94b23d81da7da073f71dd12e672e0f079c 100644
--- a/src/main/java/net/minecraft/server/level/Ticket.java
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
@@ -21,7 +21,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
return i;
} else {
int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type));
- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key);
+ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix
}
}
diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java
index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e056b138b1e 100644
--- a/src/main/java/net/minecraft/util/SortedArraySet.java
+++ b/src/main/java/net/minecraft/util/SortedArraySet.java
@@ -28,7 +28,7 @@ public class SortedArraySet<T> extends AbstractSet<T> {
}
public static <T extends Comparable<T>> SortedArraySet<T> create(int initialCapacity) {
- return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder());
+ return new SortedArraySet<>(initialCapacity, Comparator.<T>naturalOrder()); // Paper - decompile fix
}
public static <T> SortedArraySet<T> create(Comparator<T> comparator) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 471b9258320ba0002d741267144c80c149f5f34c..8852cc6253c8bc1a9f7591cd2b0beb95bb4f4d33 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -106,7 +106,7 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@Override
public Brain<Frog> getBrain() {
- return super.getBrain();
+ return (Brain<Frog>) super.getBrain(); // Paper - decompile fix
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 64314cf4dc53a1a0a5f676fa00503858e0120dfa..45741410a13cffe3419e34b5607b048bbcf1c3ff 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -123,7 +123,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
public Brain<Hoglin> getBrain() {
- return super.getBrain();
+ return (Brain<Hoglin>) super.getBrain(); // Paper - decompile fix
}
@Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index d025df087e7b87fbc89a722226f2f2263c54ac47..2f712bfc1f717ba410bf34669d7b0a919ca218cc 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -78,7 +78,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
- return (entry1.getValue()); // CraftBukkit
+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore?
}));
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
index 6b91771a4bf559881a4f3e6c98500e09b33d16e0..21a2800db22f287b9c6a8290326fdf3b94ae94b1 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
@@ -19,7 +19,7 @@ public class EntityLookup<T extends EntityAccess> {
public <U extends T> void getEntities(EntityTypeTest<T, U> filter, AbortableIterationConsumer<U> consumer) {
for(T entityAccess : this.byId.values()) {
U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess));
- if (entityAccess2 != null && consumer.accept((T)entityAccess2).shouldAbort()) {
+ if (entityAccess2 != null && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix
return;
}
}
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
index 69a19dbf58cde41680d086e78b9a12ffee602dbf..5dcb7f9cab097990148f5a7c4ccbe1556afdd514 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
@@ -44,7 +44,7 @@ public class EntitySection<T extends EntityAccess> {
} else {
for(T entityAccess : collection) {
U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess));
- if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept((T)entityAccess2).shouldAbort()) {
+ if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix
return AbortableIterationConsumer.Continuation.ABORT;
}
}

View File

@ -17,23 +17,23 @@ Subject: [PATCH] CB fixes
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 61f1da79bbd0428c4d99f62974c06183230864b6..a3c602f1a1b2dbc6bbb32bffa8745dc71cf20872 100644
index caae5d862461c7dcf5fa9bf36e51276925668945..9908ab936780a88992c2690502c85e4d9074371d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -293,7 +293,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -295,7 +295,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
long l = minecraftserver.getWorldData().worldGenSettings().seed();
long l = minecraftserver.getWorldData().worldGenOptions().seed();
- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
+ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenSettings(), this.structureCheck); // CraftBukkit
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
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
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/entity/Marker.java b/src/main/java/net/minecraft/world/entity/Marker.java
index aef33a96cf8df9400cc60285ef1f7c5ded03b495..059c4c3b59f66ea2b2b23fe1eb106bf9447b607c 100644
index d9f07a311ec5a253bdfb681414e1f8033a576a23..6f110ece5686d1fc73b93fb9e0a73f2c1bcf4586 100644
--- a/src/main/java/net/minecraft/world/entity/Marker.java
+++ b/src/main/java/net/minecraft/world/entity/Marker.java
@@ -38,8 +38,9 @@ public class Marker extends Entity {
@@ -39,8 +39,9 @@ public class Marker extends Entity {
}
@Override
@ -45,10 +45,10 @@ index aef33a96cf8df9400cc60285ef1f7c5ded03b495..059c4c3b59f66ea2b2b23fe1eb106bf9
@Override
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
index 9998e1c94b72b90dd3ba4bcce1b4b3653b9b1b2b..963ad3ce1ef83888ae1537ff01accdbb5b04ffa1 100644
index 99af167b02c1291f9f5fd1a195a3eb65de87002b..874f7ea643d27eec47d51a10ad472af7e8ec402e 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
@@ -43,7 +43,7 @@ public class StructureCheck {
@@ -44,7 +44,7 @@ public class StructureCheck {
private final Registry<Biome> biomes;
private final Registry<Structure> structureConfigs;
private final StructureTemplateManager structureTemplateManager;
@ -57,7 +57,7 @@ index 9998e1c94b72b90dd3ba4bcce1b4b3653b9b1b2b..963ad3ce1ef83888ae1537ff01accdbb
private final ChunkGenerator chunkGenerator;
private final RandomState randomState;
private final LevelHeightAccessor heightAccessor;
@@ -53,7 +53,7 @@ public class StructureCheck {
@@ -54,7 +54,7 @@ public class StructureCheck {
private final Long2ObjectMap<Object2IntMap<Structure>> loadedChunks = new Long2ObjectOpenHashMap<>();
private final Map<Structure, Long2BooleanMap> featureChecks = new HashMap<>();
@ -67,10 +67,10 @@ index 9998e1c94b72b90dd3ba4bcce1b4b3653b9b1b2b..963ad3ce1ef83888ae1537ff01accdbb
this.registryAccess = registryManager;
this.structureTemplateManager = structureTemplateManager;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7c3d02a8a3bac227692ad2349981bc8c6c600341..4dd952faac05f553b28d1252296b0587369865f4 100644
index 64db49f699ebd0baf1cce79c1ef20c5b7a83f2b3..a9cfb4e94e8038ccbbe10669198abb9177fb8ebc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2278,7 +2278,13 @@ public final class CraftServer implements Server {
@@ -2302,7 +2302,13 @@ public final class CraftServer implements Server {
Validate.notNull(key, "NamespacedKey cannot be null");
LootTables registry = this.getServer().getLootTables();

View File

@ -5429,7 +5429,7 @@ index 0000000000000000000000000000000000000000..808d1449ac44ae86a650932365081fba
+ }
+}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index c52be35a75613936cbf1b2dc9b1aa959f5577627..168ab805ecc48dd55db90eb7fe1c56fda3f2776c 100644
index dc7a805d3058244ba13c2268666f274e7ec069dc..4423140df56e64527db470ada17a117656b93114 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -116,7 +116,7 @@ public class Util {
@ -5442,10 +5442,10 @@ index c52be35a75613936cbf1b2dc9b1aa959f5577627..168ab805ecc48dd55db90eb7fe1c56fd
public static long getEpochMillis() {
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index c94084aee70d269a71a5423c13a5eba2babd9a6b..abd6fcab220d5616131e5bdd2f6a68a9105b7891 100644
index 6801a3aa5f2f1e9a7a72ff81c09b4944ecb8349d..a72dfbfa2aa636ac8bac07a62777126cf2696241 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -531,6 +531,7 @@ public class BlockPos extends Vec3i {
@@ -535,6 +535,7 @@ public class BlockPos extends Vec3i {
}
}
@ -5453,7 +5453,7 @@ index c94084aee70d269a71a5423c13a5eba2babd9a6b..abd6fcab220d5616131e5bdd2f6a68a9
@Override
public BlockPos.MutableBlockPos setX(int i) {
super.setX(i);
@@ -548,6 +549,7 @@ public class BlockPos extends Vec3i {
@@ -552,6 +553,7 @@ public class BlockPos extends Vec3i {
super.setZ(i);
return this;
}
@ -5462,7 +5462,7 @@ index c94084aee70d269a71a5423c13a5eba2babd9a6b..abd6fcab220d5616131e5bdd2f6a68a9
@Override
public BlockPos immutable() {
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 853dd203a78537208f81b0023fdca221b6f82684..b965af563f2cb1508d138e4d48e97a44873c4bb9 100644
index 5b111f4543c327169d1c327c873d728009fe3a11..ca7d1d33cfd448673365b615b8609083dcb11da4 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -121,7 +121,7 @@ public class CompoundTag implements Tag {
@ -5474,7 +5474,7 @@ index 853dd203a78537208f81b0023fdca221b6f82684..b965af563f2cb1508d138e4d48e97a44
protected CompoundTag(Map<String, Tag> entries) {
this.tags = entries;
@@ -184,6 +184,10 @@ public class CompoundTag implements Tag {
@@ -197,6 +197,10 @@ public class CompoundTag implements Tag {
this.tags.put(key, NbtUtils.createUUID(value));
}
@ -5499,10 +5499,10 @@ index 207f1c1fc9d4451d27047bb8362bded8cd53e32f..021a26a6b1c258deffc26c035ab52a4e
throw new SkipPacketException(var10);
} else {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 80a3c56fb5e73c09c542b17aac952fb63081a662..d7ece1ae4e9c97935de96eafd6d22cded1f8aa42 100644
index 06b1da8b559f9d545f1593d81de7b25e0a12f176..0f7dd33d51281b383be0fb47d4e6b133f123ce1f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -282,6 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -293,6 +293,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 3 ];
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
@ -5510,7 +5510,7 @@ index 80a3c56fb5e73c09c542b17aac952fb63081a662..d7ece1ae4e9c97935de96eafd6d22cde
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -921,6 +922,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -929,6 +930,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
}
// Spigot start
@ -5520,7 +5520,7 @@ index 80a3c56fb5e73c09c542b17aac952fb63081a662..d7ece1ae4e9c97935de96eafd6d22cde
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json");
this.getProfileCache().save();
@@ -988,6 +992,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -995,6 +999,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.lastOverloadWarning = this.nextTickTime;
}
@ -5528,7 +5528,7 @@ index 80a3c56fb5e73c09c542b17aac952fb63081a662..d7ece1ae4e9c97935de96eafd6d22cde
if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
{
double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL;
@@ -1223,7 +1228,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1230,7 +1235,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.debug("Autosave finished");
SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
@ -5537,7 +5537,7 @@ index 80a3c56fb5e73c09c542b17aac952fb63081a662..d7ece1ae4e9c97935de96eafd6d22cde
this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1285,6 +1290,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1292,6 +1297,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking);
@ -5793,10 +5793,10 @@ index f902b1f7062fc2c81e0ce43e8b8599192469e57c..74d1ae0104e8d0795df50f00317fd860
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac327e3382dc 100644
index 8191d7f243aa10f8535b5f99ac309c1780acdcde..77ff6d46a4361ae1b377fa3cb269c75467a45f01 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -63,6 +63,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
@@ -65,6 +65,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
import net.minecraft.network.protocol.game.DebugPackets;
@ -5804,7 +5804,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -169,6 +170,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -173,6 +174,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
// CraftBukkit end
@ -5861,9 +5861,9 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -218,6 +269,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -226,6 +277,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world.registryAccess(), world);
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
this.setViewDistance(viewDistance);
+ // Paper start
+ this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
@ -5872,7 +5872,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
protected ChunkGenerator generator() {
@@ -311,6 +366,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -323,6 +378,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -5887,7 +5887,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) {
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = new ArrayList();
List<ChunkHolder> list1 = new ArrayList();
@@ -398,9 +461,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -410,9 +473,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
stringbuilder.append("Updating:").append(System.lineSeparator());
@ -5899,7 +5899,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading");
@@ -442,8 +505,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -454,8 +517,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
@ -5914,7 +5914,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
this.updatingChunkMap.put(pos, holder);
this.modified = true;
}
@@ -465,7 +534,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -477,7 +546,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
@ -5923,7 +5923,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -494,7 +563,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -506,7 +575,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
this.flushWorker();
} else {
@ -5932,7 +5932,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
}
@@ -513,7 +582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -525,7 +594,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -5941,7 +5941,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -524,6 +593,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -536,6 +605,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
if (playerchunk != null) {
@ -5949,7 +5949,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -541,7 +611,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -553,7 +623,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
@ -5958,7 +5958,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -559,7 +629,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -571,7 +641,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else {
@ -5971,7 +5971,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -575,7 +649,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -587,7 +661,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
@ -5982,7 +5982,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
};
@@ -956,7 +1032,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -968,7 +1044,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.viewDistance = j;
this.distanceManager.updatePlayerTickets(this.viewDistance + 1);
@ -5991,7 +5991,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -999,7 +1075,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1011,7 +1087,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -6000,7 +6000,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
public DistanceManager getDistanceManager() {
@@ -1007,19 +1083,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1019,19 +1095,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {
@ -6025,7 +6025,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLastAvailable());
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -1145,6 +1221,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1157,6 +1233,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player);
}
@ -6033,7 +6033,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
} else {
SectionPos sectionposition = player.getLastSectionPos();
@@ -1152,6 +1229,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1164,6 +1241,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag2) {
this.distanceManager.removePlayer(sectionposition, player);
}
@ -6041,7 +6041,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) {
@@ -1264,6 +1342,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1276,6 +1354,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -6050,7 +6050,7 @@ index 26b8096e073d8aa386c9c11ee4a81c7e46b6e1f8..8c6ca0acde4cb266a844a1670296ac32
}
@Override
@@ -1467,7 +1547,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1504,7 +1584,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private class ChunkDistanceManager extends DistanceManager {
protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
@ -6105,10 +6105,10 @@ index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..fbe62a31ab199d83a1db0a4e0b1a8138
while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c682a90eea94cc55ac2ccdb49612e915fbffc512..85238e1bcb2a7ac8f824f10409ee5a4bc7e6c002 100644
index b323b8329f534b7020dd595b8b15197c29939590..794ad2dbaea2555d4557124e9d942d3e6919ea09 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -50,6 +50,7 @@ import net.minecraft.world.level.storage.LevelStorageSource;
@@ -51,6 +51,7 @@ import net.minecraft.world.level.storage.LevelStorageSource;
public class ServerChunkCache extends ChunkSource {
@ -6116,7 +6116,7 @@ index c682a90eea94cc55ac2ccdb49612e915fbffc512..85238e1bcb2a7ac8f824f10409ee5a4b
private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList();
private final DistanceManager distanceManager;
final ServerLevel level;
@@ -68,6 +69,231 @@ public class ServerChunkCache extends ChunkSource {
@@ -69,6 +70,231 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@VisibleForDebug
private NaturalSpawner.SpawnState lastSpawnState;
@ -6348,7 +6348,7 @@ index c682a90eea94cc55ac2ccdb49612e915fbffc512..85238e1bcb2a7ac8f824f10409ee5a4b
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory) {
this.level = world;
@@ -120,6 +346,49 @@ public class ServerChunkCache extends ChunkSource {
@@ -121,6 +347,49 @@ public class ServerChunkCache extends ChunkSource {
this.lastChunk[0] = chunk;
}
@ -6398,7 +6398,7 @@ index c682a90eea94cc55ac2ccdb49612e915fbffc512..85238e1bcb2a7ac8f824f10409ee5a4b
@Nullable
@Override
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
@@ -327,6 +596,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -328,6 +597,12 @@ public class ServerChunkCache extends ChunkSource {
}
}
@ -6412,10 +6412,10 @@ index c682a90eea94cc55ac2ccdb49612e915fbffc512..85238e1bcb2a7ac8f824f10409ee5a4b
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a3c602f1a1b2dbc6bbb32bffa8745dc71cf20872..f5ed23104c781098e64850b32963d13c1a611b96 100644
index 9908ab936780a88992c2690502c85e4d9074371d..017e0ae318c15cfce72ed389b250345418e7b876 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -168,6 +168,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@@ -171,6 +171,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.world.GenericGameEvent;
import org.bukkit.event.world.TimeSkipEvent;
// CraftBukkit end
@ -6423,7 +6423,7 @@ index a3c602f1a1b2dbc6bbb32bffa8745dc71cf20872..f5ed23104c781098e64850b32963d13c
public class ServerLevel extends Level implements WorldGenLevel {
@@ -223,6 +224,98 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -226,6 +227,98 @@ public class ServerLevel extends Level implements WorldGenLevel {
return convertable.dimensionType;
}
@ -6521,22 +6521,21 @@ index a3c602f1a1b2dbc6bbb32bffa8745dc71cf20872..f5ed23104c781098e64850b32963d13c
+
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 76eaa034d85d7a02ab6e094161b65fcd3dff71ef..c20f7eb3ee60fce38be2c817278ecaac8982b279 100644
index 9f840f4d1459cc66c6a7ca865dbfbd89289b31cb..9bd9210c3c66d9fa9085cfadb943e1dc93820697 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -243,6 +243,9 @@ public class ServerPlayer extends Player {
@@ -247,6 +247,8 @@ public class ServerPlayer extends Player {
public Integer clientViewDistance;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
+ public boolean isRealPlayer; // Paper
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
+
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey);
this.chatVisibility = ChatVisiblity.FULL;
@@ -306,6 +309,8 @@ public class ServerPlayer extends Player {
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -312,6 +314,8 @@ public class ServerPlayer extends Player {
this.maxUpStep = 1.0F;
this.fudgeSpawnLocation(world);
@ -6558,10 +6557,10 @@ index 3a4f026c73cdd22d30bdadabbcf24bef969b73e4..0d536d72ac918fbd403397ff369d1014
private final String name;
private final Comparator<T> comparator;
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 96ab71f72b43758b86f8990a74a238ad68e10890..32d6e4b194c3c4eca7009059f8d185896b5ae556 100644
index a63d5ba706a5b8e430aedc045bdeb3a410bd0eef..e96a0ca47e4701ba187555bd92c968345bc85677 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -159,6 +159,26 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -160,6 +160,26 @@ public class WorldGenRegion implements WorldGenLevel {
return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z;
}
@ -6589,10 +6588,10 @@ index 96ab71f72b43758b86f8990a74a238ad68e10890..32d6e4b194c3c4eca7009059f8d18589
public BlockState getBlockState(BlockPos pos) {
return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 346cacb7627db45d2cc64ab841643af7e974cacb..efbfa3f82bd19bfe09a483306d97464e1782a0ab 100644
index 8550bd48f51209279e892b212d40b72feb59562a..c9497bead11bf2b3b859f1c91c9692ce6007e5ed 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -175,6 +175,7 @@ public abstract class PlayerList {
@@ -181,6 +181,7 @@ public abstract class PlayerList {
}
public void placeNewPlayer(Connection connection, ServerPlayer player) {
@ -6619,7 +6618,7 @@ index 337e0a7b3c14e1b1a28744920e0dc0a69e0c5a87..f5829ae484d93b547a5437b85a962134
@Override
public void tell(R runnable) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9fdfeab462e5f5c5e09c5fee2dfe1fca89330086..18d56618a1e8ff5ba408523f620333dbdf48a257 100644
index df88a36981524654fb2905782b4b1337ea261a03..742897a534dac2bbbacaca0f6c8196e8d2bc03dd 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -315,6 +315,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -6635,10 +6634,10 @@ index 9fdfeab462e5f5c5e09c5fee2dfe1fca89330086..18d56618a1e8ff5ba408523f620333db
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c7c212fb231f86dd17efb4134976f1ec1d10630b..d2958d4c897d93f81ab4faea2c67783c2f0de37f 100644
index 087cd12b08732a4c62ac4be417b17b1db830097a..f29b109fdef494927f5f894ac962c50c33b1f0b6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -260,6 +260,7 @@ public abstract class LivingEntity extends Entity {
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity {
public boolean collides = true;
public Set<UUID> collidableExemptions = new HashSet<>();
public boolean bukkitPickUpLoot;
@ -6647,7 +6646,7 @@ index c7c212fb231f86dd17efb4134976f1ec1d10630b..d2958d4c897d93f81ab4faea2c67783c
@Override
public float getBukkitYaw() {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index e0131e85b3f2d72d1c6ae64214099b4f67bf5de5..c3357f65d3c5cec3446326b8a68750ee2cc27b9a 100644
index ffac9a8678989decc276b0fa42e87da1d97d3666..10949455cc92ed6cb537fd7f148714c7ade4e360 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -242,6 +242,7 @@ public abstract class Mob extends LivingEntity {
@ -6659,7 +6658,7 @@ index e0131e85b3f2d72d1c6ae64214099b4f67bf5de5..c3357f65d3c5cec3446326b8a68750ee
// CraftBukkit start - fire event
this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index dc8f9714311248bce3facbd879667e4c395fd5e2..2df5b50be11297941d13ec9d17001f488af11750 100644
index fbe69ec9cded766c9b76ed4a1bcba6d4f49d6165..6ae3f5cd42dfd424fc3741957995f47ad5ec8941 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -18,6 +18,8 @@ public abstract class PathfinderMob extends Mob {
@ -6684,10 +6683,10 @@ index a0b5895abc88d297045e05f25bb09527991d43f0..6e0bd0eab0b06a4ac3042496bbb91292
super(type, world);
this.xpReward = 5;
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index cd677153ade91dd56d000fbc2dfc8be0e332a00d..1b83577ec8e78e20051f20a336e5cf3e7836c079 100644
index 3cdb60ba3ba7bf996046d43ddf48523040063dfa..f53d8bb8078109f6ff89121261be46f1cccb2860 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -751,6 +751,25 @@ public final class ItemStack {
@@ -758,6 +758,25 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag();
}
@ -6713,7 +6712,7 @@ index cd677153ade91dd56d000fbc2dfc8be0e332a00d..1b83577ec8e78e20051f20a336e5cf3e
public void setTag(@Nullable CompoundTag nbt) {
this.tag = nbt;
if (this.getItem().canBeDepleted()) {
@@ -1133,6 +1152,7 @@ public final class ItemStack {
@@ -1144,6 +1163,7 @@ public final class ItemStack {
// CraftBukkit start
@Deprecated
public void setItem(Item item) {
@ -6827,10 +6826,10 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671
public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 649df119b24dc8c390f45e9f813cf8c37994e0cf..0fa91ed5ed41c944f7398a88f9352742f34d4af5 100644
index ca5cbd7c43d7e263f76d8719a259514c0748a430..3bf5b8429a25b0f1347cc287f919dec7a66d9b6c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer;
@@ -88,6 +88,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.craftbukkit.block.CapturedBlockState;
@ -6838,7 +6837,7 @@ index 649df119b24dc8c390f45e9f813cf8c37994e0cf..0fa91ed5ed41c944f7398a88f9352742
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftSpawnCategory;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -284,18 +285,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -287,18 +288,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return y < -20000000 || y >= 20000000;
}
@ -6894,7 +6893,7 @@ index 649df119b24dc8c390f45e9f813cf8c37994e0cf..0fa91ed5ed41c944f7398a88f9352742
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
if (ichunkaccess == null && create) {
@@ -306,7 +340,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -309,7 +343,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
@ -6903,7 +6902,7 @@ index 649df119b24dc8c390f45e9f813cf8c37994e0cf..0fa91ed5ed41c944f7398a88f9352742
return this.setBlock(pos, state, flags, 512);
}
@@ -550,7 +584,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -553,7 +587,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (this.isOutsideBuildHeight(pos)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@ -6913,10 +6912,10 @@ index 649df119b24dc8c390f45e9f813cf8c37994e0cf..0fa91ed5ed41c944f7398a88f9352742
return chunk.getBlockState(pos);
}
diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java
index 6d32473b64df28dfe0e668df7abb58d930d14005..4404fa3a083d7ef4578244c924fa4859b9b6edfd 100644
index f5dbac0a13d23413dbdc48cfacc247ef25ef9444..7fe1b8856bf916796fa6d2a984f0a07a2331e23b 100644
--- a/src/main/java/net/minecraft/world/level/LevelReader.java
+++ b/src/main/java/net/minecraft/world/level/LevelReader.java
@@ -19,6 +19,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
@@ -24,6 +24,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.AABB;
public interface LevelReader extends BlockAndTintGetter, CollisionGetter, BiomeManager.NoiseBiomeSource {
@ -6925,12 +6924,12 @@ index 6d32473b64df28dfe0e668df7abb58d930d14005..4404fa3a083d7ef4578244c924fa4859
ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create);
diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
index ccf37eb05846f825d9acc874455cbbcdcdd2ecc2..138f5576a1df6714e754d9829f209f1a1678413f 100644
index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa5718d6f9bb 100644
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
@@ -9,6 +9,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.util.profiling.ProfilerFiller;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
@ -6977,10 +6976,10 @@ index ccf37eb05846f825d9acc874455cbbcdcdd2ecc2..138f5576a1df6714e754d9829f209f1a
public WorldBorder getWorldBorder() {
return this.level.getWorldBorder();
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 11cf00e1a20b3a84c6482f59583bcb5b6402a978..f0bd06ab32e99c188510b3c3fa41f1737ab4fe78 100644
index ec86c786f793da00fdcee7b72f989068cbd750e4..aa2f76ff47699f23474f2e409ef9b773e48d50b8 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -659,14 +659,14 @@ public abstract class BlockBehaviour {
@@ -686,14 +686,14 @@ public abstract class BlockBehaviour implements FeatureElement {
public abstract static class BlockStateBase extends StateHolder<Block, BlockState> {
@ -6998,8 +6997,8 @@ index 11cf00e1a20b3a84c6482f59583bcb5b6402a978..f0bd06ab32e99c188510b3c3fa41f173
private final BlockBehaviour.StatePredicate isRedstoneConductor;
private final BlockBehaviour.StatePredicate isSuffocating;
private final BlockBehaviour.StatePredicate isViewBlocking;
@@ -696,10 +696,18 @@ public abstract class BlockBehaviour {
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState());
@@ -728,12 +728,20 @@ public abstract class BlockBehaviour implements FeatureElement {
this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
}
+ // Paper start
@ -7010,6 +7009,8 @@ index 11cf00e1a20b3a84c6482f59583bcb5b6402a978..f0bd06ab32e99c188510b3c3fa41f173
+ // Paper end
+
public void initCache() {
this.fluidState = ((Block) this.owner).getFluidState(this.asState());
this.isRandomlyTicking = ((Block) this.owner).isRandomlyTicking(this.asState());
if (!this.getBlock().hasDynamicShape()) {
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
}
@ -7017,7 +7018,7 @@ index 11cf00e1a20b3a84c6482f59583bcb5b6402a978..f0bd06ab32e99c188510b3c3fa41f173
}
@@ -735,8 +743,8 @@ public abstract class BlockBehaviour {
@@ -769,8 +777,8 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.getBlock().getOcclusionShape(this.asState(), world, pos);
}
@ -7029,7 +7030,7 @@ index 11cf00e1a20b3a84c6482f59583bcb5b6402a978..f0bd06ab32e99c188510b3c3fa41f173
public boolean useShapeForLightOcclusion() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index d484aaae8614e78fdb984b26304b1de8b649e4bd..fabc7df600c89b01d97a76eb0b1206a32407b906 100644
index db6a64ae4437b76c39e7ddb02adbea27c95fde78..3fdbb777d4722596cc4df79b2d4d7b9c553580fd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -58,7 +58,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@ -7052,7 +7053,7 @@ index d484aaae8614e78fdb984b26304b1de8b649e4bd..fabc7df600c89b01d97a76eb0b1206a3
this.levelHeightAccessor = heightLimitView;
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index b7cb72023dc09a2a39400f457e25417acbd3a7c0..41dda06ac8d9adc263936bc417d35b62a8801565 100644
index 51032b7ba79693882b64ef0fea095a7e94d215c1..272203f71dc9bb525a91f835fd73ca1d03aa982e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundTag;
@ -7296,10 +7297,10 @@ index f66369ddaeab5c5ac643c0979dac3ed21337ff71..038abf2ac104ceecaab11b10d466ea69
return false;
} else {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 93308369f0bbd1e95569d9d573b8b6f42c8ae5a7..452bd97c699261623bf504ee3a177f8f4df97d11 100644
index 3e7207ccb6496b0e04e7cdef2b762601745933dd..f4455d8a45fbd687a21a46a4c2850f9a3e6432c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -234,8 +234,8 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -233,8 +233,8 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public Chunk[] getLoadedChunks() {
@ -7310,7 +7311,7 @@ index 93308369f0bbd1e95569d9d573b8b6f42c8ae5a7..452bd97c699261623bf504ee3a177f8f
}
@Override
@@ -310,7 +310,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -309,7 +309,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean refreshChunk(int x, int z) {
@ -7319,7 +7320,7 @@ index 93308369f0bbd1e95569d9d573b8b6f42c8ae5a7..452bd97c699261623bf504ee3a177f8f
if (playerChunk == null) return false;
playerChunk.getTickingChunkFuture().thenAccept(either -> {
@@ -1943,4 +1943,32 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1942,4 +1942,32 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.spigot;
}
// Spigot end
@ -7353,10 +7354,10 @@ index 93308369f0bbd1e95569d9d573b8b6f42c8ae5a7..452bd97c699261623bf504ee3a177f8f
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 080c0ab395a457d528c34417c102c2db2feec20f..08f6be760cc2f0a6f9c6a3e165e4554ac01654e0 100644
index c3cad46ce064c9581e68db17495dabe2dc2ca161..5f6d4f553cab8f20c2049c706e69de3d79701dfd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1145,4 +1145,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1147,4 +1147,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.spigot;
}
// Spigot end
@ -7617,10 +7618,10 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 3568b1a579716bee7f749eb944784b59b361f6df..d805ac4274fb6149bf8efea6b771ecfe79aea76f 100644
index 5499bdbd0d5e81f2e7dcf784eb80217082090010..ef2640eb9e98e9ce81abc604cc1c2264e0137ef6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -100,8 +100,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -99,8 +99,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>();
private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
private static final Map<Material, net.minecraft.world.level.material.Fluid> MATERIAL_FLUID = new HashMap<>();
@ -7631,14 +7632,14 @@ index 3568b1a579716bee7f749eb944784b59b361f6df..d805ac4274fb6149bf8efea6b771ecfe
static {
+ for (org.bukkit.entity.EntityType type : org.bukkit.entity.EntityType.values()) {
+ if (type == org.bukkit.entity.EntityType.UNKNOWN) continue;
+ ENTITY_TYPE_ENTITY_TYPES.put(type, net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())));
+ ENTITY_TYPES_ENTITY_TYPE.put(net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type);
+ ENTITY_TYPE_ENTITY_TYPES.put(type, BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())));
+ ENTITY_TYPES_ENTITY_TYPE.put(BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type);
+ }
+ // Paper end
for (Block block : net.minecraft.core.Registry.BLOCK) {
BLOCK_MATERIAL.put(block, Material.getMaterial(net.minecraft.core.Registry.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT)));
for (Block block : BuiltInRegistries.BLOCK) {
BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT)));
}
@@ -167,6 +176,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -166,6 +175,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public static ResourceLocation key(Material mat) {
return CraftNamespacedKey.toMinecraft(mat.getKey());
}
@ -7654,10 +7655,10 @@ index 3568b1a579716bee7f749eb944784b59b361f6df..d805ac4274fb6149bf8efea6b771ecfe
public static byte toLegacyData(BlockState data) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 06da639663ead833c620a03d47fa9169c4509183..3bedc22c253c3632b5624c05e78ed3671e5d30ce 100644
index bbc2ab1972d9b88530282225650ec14b521d413f..9a80e0c390d13453a4a79e00d18c20b79afd3c7f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -208,7 +208,23 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@@ -213,7 +213,23 @@ public class DummyGeneratorAccess implements WorldGenLevel {
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634
}
@ -7719,7 +7720,7 @@ index d40c0d8be1b0153d62021b8bcb6e8b37fd0acb4e..e38e57b1f9ef27020de35d7ddcb36a66
public void clear() {
// Create new array to reset memory usage to initial capacity
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 7c35d86eac0d69ba4be48faf364fd6dc84fa7e87..ed8ae212fc0ca781438fa9667f3f5cccc0af4cee 100644
index b599e098e6d2e6f78b89114e05cb03d716b7c5f4..83eabc34d952bbb13ec4b4bdcf34f647189c0b46 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -118,7 +118,11 @@ public class SpigotConfig

File diff suppressed because one or more lines are too long