Misc fixes (#7883)

This commit is contained in:
Owen1212055 2022-06-08 09:03:33 -04:00
parent 4d7d4e996e
commit bf30d497ba
4 changed files with 5 additions and 5 deletions

View File

@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (xx == chunkPos.x && zz == chunkPos.z) { + if (xx == chunkPos.x && zz == chunkPos.z) {
+ chunks.add(protoChunk); + chunks.add(protoChunk);
+ } else { + } else {
+ final Holder<net.minecraft.world.level.biome.Biome> biomeHolder = serverLevel.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); + final net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeHolder = serverLevel.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).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); + 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); + chunks.add(chunk);
+ } + }

View File

@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return new BiomeProvider() { + return new BiomeProvider() {
+ @Override + @Override
+ public Biome getBiome(final org.bukkit.generator.WorldInfo worldInfo, final int x, final int y, final int z) { + public Biome getBiome(final org.bukkit.generator.WorldInfo worldInfo, final int x, final int y, final int z) {
+ return CraftBlock.biomeBaseToBiome(biomeRegistry, chunkGenerator.getNoiseBiome(x >> 2, y >> 2, z >> 2)); + return CraftBlock.biomeBaseToBiome(biomeRegistry, CraftWorld.this.getHandle().getNoiseBiome(x >> 2, y >> 2, z >> 2));
+ } + }
+ +
+ @Override + @Override

View File

@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) { + public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); + BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
+ BlockPos nearest = getHandle().findNearestBiome( holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step).getFirst(); + BlockPos nearest = getHandle().findClosestBiome3d( holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step).getFirst();
+ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); + return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
+ } + }
+ +

View File

@ -44,9 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ private net.minecraft.nbt.StringTag convert(String json) { + private net.minecraft.nbt.StringTag convert(String json) {
+ Component component = Component.Serializer.fromJson(json); + Component component = Component.Serializer.fromJson(json);
+ if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) { + if (component.getContents() instanceof net.minecraft.network.chat.contents.LiteralContents literalContents && literalContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components + // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0]; + component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(literalContents.text())[0];
+ } + }
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component)); + return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ } + }