diff --git a/patches/server/Add-GameEvent-tags.patch b/patches/server/Add-GameEvent-tags.patch index 69eb437337..0e4845e139 100644 --- a/patches/server/Add-GameEvent-tags.patch +++ b/patches/server/Add-GameEvent-tags.patch @@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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/Add-Player-Warden-Warning-API.patch b/patches/server/Add-Player-Warden-Warning-API.patch index e6a4a3f383..3b3166e958 100644 --- a/patches/server/Add-Player-Warden-Warning-API.patch +++ b/patches/server/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 diff --git a/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch index 46d4be37c1..ee67f767be 100644 --- a/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch index 201035c9f8..789a17b9bb 100644 --- a/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Anti-Xray.patch b/patches/server/Anti-Xray.patch index 2a60892dd9..4eb29464cf 100644 --- a/patches/server/Anti-Xray.patch +++ b/patches/server/Anti-Xray.patch @@ -209,7 +209,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + } + + 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..00000000000000000000000000000000 + } + } + -+ 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/Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch index 38855b27bf..bbec48085e 100644 --- a/patches/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch +++ b/patches/server/Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); + // Paper start - option to use the dimension_type to check if spawners should be added. I imagine mojang will add some datapack-y way of managing this in the future. + final List 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/Paper-command.patch b/patches/server/Paper-command.patch index 4f444a428f..f5e7afd765 100644 --- a/patches/server/Paper-command.patch +++ b/patches/server/Paper-command.patch @@ -302,7 +302,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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/Paper-dumpitem-command.patch b/patches/server/Paper-dumpitem-command.patch index ab224aaf7d..2ed9c43bfe 100644 --- a/patches/server/Paper-dumpitem-command.patch +++ b/patches/server/Paper-dumpitem-command.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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 -> {