diff --git a/patches/server/0010-Paper-command.patch b/patches/server/0010-Paper-command.patch index 9829a7421a..d73d845974 100644 --- a/patches/server/0010-Paper-command.patch +++ b/patches/server/0010-Paper-command.patch @@ -287,7 +287,7 @@ index 0000000000000000000000000000000000000000..6ff5d42a866d2752c73a766815aa190b +} diff --git a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..68f99e93ed3e843b4001a7a27620f88a48b85e67 +index 0000000000000000000000000000000000000000..9e51b3d1217ad6dc5c0c11d2febac7144e5721af --- /dev/null +++ b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java @@ -0,0 +1,145 @@ @@ -302,7 +302,7 @@ index 0000000000000000000000000000000000000000..68f99e93ed3e843b4001a7a27620f88a +import java.util.Map; +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.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; @@ -335,7 +335,7 @@ index 0000000000000000000000000000000000000000..68f99e93ed3e843b4001a7a27620f88a + if (args.length == 1) { + return CommandUtil.getListMatchingLast(sender, args, "help", "list"); + } else if (args.length == 2) { -+ return CommandUtil.getListMatchingLast(sender, args, Registry.ENTITY_TYPE.keySet().stream().map(ResourceLocation::toString).sorted().toArray(String[]::new)); ++ return CommandUtil.getListMatchingLast(sender, args, BuiltInRegistries.ENTITY_TYPE.keySet().stream().map(ResourceLocation::toString).sorted().toArray(String[]::new)); + } + return Collections.emptyList(); + } @@ -360,7 +360,7 @@ index 0000000000000000000000000000000000000000..68f99e93ed3e843b4001a7a27620f88a + filter = args[1]; + } + final String cleanfilter = filter.replace("?", ".?").replace("*", ".*?"); -+ Set names = Registry.ENTITY_TYPE.keySet().stream() ++ Set names = BuiltInRegistries.ENTITY_TYPE.keySet().stream() + .filter(n -> n.toString().matches(cleanfilter)) + .collect(Collectors.toSet()); + if (names.isEmpty()) { diff --git a/patches/server/0345-Anti-Xray.patch b/patches/server/0345-Anti-Xray.patch index f7c6166ec9..62ed136a2c 100644 --- a/patches/server/0345-Anti-Xray.patch +++ b/patches/server/0345-Anti-Xray.patch @@ -199,17 +199,18 @@ index 0000000000000000000000000000000000000000..bd86dc2ad2f87969da4add06de2a629f +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..dabd93c35bdbac6a8b668a82d5f3d4173a1baa4a +index 0000000000000000000000000000000000000000..4f3670b2bdb8b1b252e9f074a6af56a018a8c465 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +1,635 @@ +@@ -0,0 +1,636 @@ +package com.destroystokyo.paper.antixray; + +import io.papermc.paper.configuration.WorldConfiguration; +import io.papermc.paper.configuration.type.EngineMode; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; -+import net.minecraft.core.Registry; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.resources.ResourceLocation; @@ -284,7 +285,7 @@ index 0000000000000000000000000000000000000000..dabd93c35bdbac6a8b668a82d5f3d417 + List presetBlockStateList = new LinkedList<>(); + + for (String id : paperWorldConfig.hiddenBlocks) { -+ Block block = Registry.BLOCK.getOptional(new ResourceLocation(id)).orElse(null); ++ Block block = BuiltInRegistries.BLOCK.getOptional(new ResourceLocation(id)).orElse(null); + + if (block != null && !(block instanceof EntityBlock)) { + toObfuscate.add(id); @@ -315,7 +316,7 @@ index 0000000000000000000000000000000000000000..dabd93c35bdbac6a8b668a82d5f3d417 + } + + for (String id : toObfuscate) { -+ Block block = Registry.BLOCK.getOptional(new ResourceLocation(id)).orElse(null); ++ Block block = BuiltInRegistries.BLOCK.getOptional(new ResourceLocation(id)).orElse(null); + + // Don't obfuscate air because air causes unnecessary block updates and causes block updates to fail in the void + if (block != null && !block.defaultBlockState().isAir()) { @@ -326,7 +327,7 @@ index 0000000000000000000000000000000000000000..dabd93c35bdbac6a8b668a82d5f3d417 + } + } + -+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getHolderOrThrow(Biomes.PLAINS)); ++ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS)); + BlockPos zeroPos = new BlockPos(0, 0, 0); + + for (int i = 0; i < solidGlobal.length; i++) { diff --git a/patches/server/0430-Paper-dumpitem-command.patch b/patches/server/0430-Paper-dumpitem-command.patch index 77cf770637..1f5d0868be 100644 --- a/patches/server/0430-Paper-dumpitem-command.patch +++ b/patches/server/0430-Paper-dumpitem-command.patch @@ -27,7 +27,7 @@ index 04bf08cbe45763f1338390c5ab4b0dcb334bd07a..a7b78508ef78229835805300e62a306a .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) diff --git a/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java b/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..771503ff637fea10d4d8be0f37f3f146c41791d9 +index 0000000000000000000000000000000000000000..5f0b0fe73a47e6a5ca8706f11e78b4b08e6ccd9a --- /dev/null +++ b/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java @@ -0,0 +1,59 @@ @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..771503ff637fea10d4d8be0f37f3f146 +import java.util.Objects; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.event.ClickEvent; -+import net.minecraft.core.Registry; ++import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; +import org.bukkit.Bukkit; @@ -73,7 +73,7 @@ index 0000000000000000000000000000000000000000..771503ff637fea10d4d8be0f37f3f146 + final @Nullable CompoundTag tag = itemStack.getTag(); + final @Nullable Component nbtComponent = tag == null ? null : PaperAdventure.asAdventure(net.minecraft.nbt.NbtUtils.toPrettyComponent(tag)); + final String itemId = Objects.requireNonNull(((CraftWorld) ((CraftPlayer) sender).getWorld()).getHandle().registryAccess() -+ .registryOrThrow(Registry.ITEM_REGISTRY).getKey(itemStack.getItem())).toString(); ++ .registryOrThrow(Registries.ITEM).getKey(itemStack.getItem())).toString(); + final Component message = text() + .append(text(itemId, YELLOW)) + .apply(b -> { diff --git a/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch index 397f9049f0..1941a0ff8d 100644 --- a/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -31,7 +31,7 @@ index a7b78508ef78229835805300e62a306a3f1ddf6d..724592234e2a178a518f6ab7d09c3180 .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) diff --git a/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java b/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..2e02d94e2903c48f6d08e743c1cf8bad9f9662df +index 0000000000000000000000000000000000000000..99c41a39cdad0271d089c6e03bebfdafba1aaa57 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java @@ -0,0 +1,229 @@ @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..2e02d94e2903c48f6d08e743c1cf8bad +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.TextColor; -+import net.minecraft.core.Registry; ++import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.MobCategory; @@ -225,7 +225,7 @@ index 0000000000000000000000000000000000000000..2e02d94e2903c48f6d08e743c1cf8bad + Component.text(':', NamedTextColor.GRAY), + Component.newline(), + Component.newline(), -+ Registry.ENTITY_TYPE.entrySet().stream() ++ BuiltInRegistries.ENTITY_TYPE.entrySet().stream() + .filter(it -> it.getValue().getCategory() == category) + .map(it -> Component.translatable(it.getValue().getDescriptionId())) + .collect(Component.toComponent(Component.text(", ", NamedTextColor.GRAY))) diff --git a/patches/server/0762-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0762-Allow-delegation-to-vanilla-chunk-gen.patch index 3bfed3844b..6b6c1c6f35 100644 --- a/patches/server/0762-Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/0762-Allow-delegation-to-vanilla-chunk-gen.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3af2e5d3bdbf82c142f5ea2629456329bda7666f..9e0f99cdc544bdf1ca7ddd1fe7893592bafca2fd 100644 +index 3af2e5d3bdbf82c142f5ea2629456329bda7666f..961a68252baabb0b7ccc9f7aa88dcb7516d0865f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2353,6 +2353,90 @@ public final class CraftServer implements Server { @@ -31,7 +31,7 @@ index 3af2e5d3bdbf82c142f5ea2629456329bda7666f..9e0f99cdc544bdf1ca7ddd1fe7893592 + public ChunkGenerator.ChunkData createVanillaChunkData(World world, int x, int z) { + // do bunch of vanilla shit + final net.minecraft.server.level.ServerLevel serverLevel = ((CraftWorld) world).getHandle(); -+ final net.minecraft.core.Registry biomeRegistry = serverLevel.getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY); ++ final net.minecraft.core.Registry biomeRegistry = serverLevel.getServer().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME); + final net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk( + new net.minecraft.world.level.ChunkPos(x, z), + net.minecraft.world.level.chunk.UpgradeData.EMPTY, @@ -61,7 +61,7 @@ index 3af2e5d3bdbf82c142f5ea2629456329bda7666f..9e0f99cdc544bdf1ca7ddd1fe7893592 + if (xx == chunkPos.x && zz == chunkPos.z) { + chunks.add(protoChunk); + } else { -+ final net.minecraft.core.Holder biomeHolder = serverLevel.registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY).getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); ++ final net.minecraft.core.Holder biomeHolder = serverLevel.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); + final net.minecraft.world.level.chunk.ChunkAccess chunk = new net.minecraft.world.level.chunk.EmptyLevelChunk(serverLevel, new net.minecraft.world.level.ChunkPos(xx, zz), biomeHolder); + chunks.add(chunk); + } diff --git a/patches/server/0802-Add-GameEvent-tags.patch b/patches/server/0802-Add-GameEvent-tags.patch index f096b1a04c..7e1597fb41 100644 --- a/patches/server/0802-Add-GameEvent-tags.patch +++ b/patches/server/0802-Add-GameEvent-tags.patch @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..cb78a3d4e21376ea24347187478525d5 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 278bbd6b1bfc3abc434d982a77f18e7b5fe1a70f..462b1732205d4d36ff5f6d8f2ce56fe851080bf0 100644 +index d4ae0bc664b2c616b4b15edf8e5567478b98c959..f719644331175bd09e059ecb6629a53bcd7bf03d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2599,6 +2599,15 @@ public final class CraftServer implements Server { @@ -55,9 +55,9 @@ index 278bbd6b1bfc3abc434d982a77f18e7b5fe1a70f..462b1732205d4d36ff5f6d8f2ce56fe8 + // Paper start + case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> { + Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class, "Game Event namespace must have GameEvent type"); -+ TagKey gameEventTagKey = TagKey.create(net.minecraft.core.Registry.GAME_EVENT_REGISTRY, key); -+ if (net.minecraft.core.Registry.GAME_EVENT.isKnownTagName(gameEventTagKey)) { -+ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(net.minecraft.core.Registry.GAME_EVENT, gameEventTagKey); ++ TagKey gameEventTagKey = TagKey.create(net.minecraft.core.registries.Registries.GAME_EVENT, key); ++ if (net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getTag(gameEventTagKey).isPresent()) { ++ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT, gameEventTagKey); + } + } + // Paper end @@ -71,7 +71,7 @@ index 278bbd6b1bfc3abc434d982a77f18e7b5fe1a70f..462b1732205d4d36ff5f6d8f2ce56fe8 + // Paper start + case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> { + Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class); -+ net.minecraft.core.Registry gameEvents = net.minecraft.core.Registry.GAME_EVENT; ++ net.minecraft.core.Registry gameEvents = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT; + return gameEvents.getTags().map(pair -> (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList()); + // Paper end + } diff --git a/patches/server/0807-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0807-Option-to-have-default-CustomSpawners-in-custom-worl.patch index ceba333c7b..0beda0f316 100644 --- a/patches/server/0807-Option-to-have-default-CustomSpawners-in-custom-worl.patch +++ b/patches/server/0807-Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which is one level below that. Defaults to off to keep vanilla behavior. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fa28023738fc50ac6c28e12bb7bbe249ddfc9a4a..b029b04d53b1a9253942de0b2252707f779dde4e 100644 +index fa28023738fc50ac6c28e12bb7bbe249ddfc9a4a..d2409599c9d9765a2e1dc7418339923049abc416 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -588,7 +588,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop spawners; -+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(worlddimension.typeHolder().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useDimensionTypeForCustomSpawners && this.registryAccess().registryOrThrow(Registries.DIMENSION_TYPE).getResourceKey(worlddimension.type().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) { + spawners = list; + } else { + spawners = Collections.emptyList(); diff --git a/patches/server/0930-Add-Player-Warden-Warning-API.patch b/patches/server/0930-Add-Player-Warden-Warning-API.patch index fff671c1fe..d836a56eff 100644 --- a/patches/server/0930-Add-Player-Warden-Warning-API.patch +++ b/patches/server/0930-Add-Player-Warden-Warning-API.patch @@ -4,7 +4,7 @@ Date: Sat, 15 Oct 2022 00:46:57 +0200 Subject: [PATCH] Add Player Warden Warning API == AT == -public net.minecraft.world.entity.player.Player wardenSpawnTracker +public net.minecraft.server.level.ServerPlayer wardenSpawnTracker public net.minecraft.world.entity.monster.warden.WardenSpawnTracker ticksSinceLastWarning public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTicks public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V