Misc fixes (#7883)
This commit is contained in:
parent
301cf577c2
commit
2259098789
|
@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..7c41d18004bd4ef980e0c142d59a5563e77f257f 100644
|
||||
index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..8df392c0c607e4775debdac97ad564ddcbaf0607 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -168,6 +168,44 @@ public final class ItemStack {
|
||||
|
@ -44,9 +44,9 @@ index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..7c41d18004bd4ef980e0c142d59a5563
|
|||
+
|
||||
+ private net.minecraft.nbt.StringTag convert(String 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
|
||||
+ 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));
|
||||
+ }
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] More World API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0440a9e3449cdf1a969ba8c7863b73842afebe48..a56071592420f9b649c84437fff336b03d6c93ba 100644
|
||||
index 0440a9e3449cdf1a969ba8c7863b73842afebe48..1dd7f21b6088f94bd523578fe6a1bb2c542145c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1967,6 +1967,65 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
@ -21,7 +21,7 @@ index 0440a9e3449cdf1a969ba8c7863b73842afebe48..a56071592420f9b649c84437fff336b0
|
|||
+ @Override
|
||||
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
|
||||
+ 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());
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -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 a97565735bf6005b77859e8453171cd8eaefab81..5bfd4457f551e5e71e0f74a0d52568e165404e22 100644
|
||||
index a97565735bf6005b77859e8453171cd8eaefab81..46ff259c64560ac7371e138627bf1b71227d308b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2299,6 +2299,90 @@ public final class CraftServer implements Server {
|
||||
|
@ -61,7 +61,7 @@ index a97565735bf6005b77859e8453171cd8eaefab81..5bfd4457f551e5e71e0f74a0d52568e1
|
|||
+ if (xx == chunkPos.x && zz == chunkPos.z) {
|
||||
+ chunks.add(protoChunk);
|
||||
+ } 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);
|
||||
+ chunks.add(chunk);
|
||||
+ }
|
||||
|
|
|
@ -18,7 +18,7 @@ index 6279b843ad04769b202b74913e328c86f256ee13..718b477b2f53a3b2decb4c045ece12ab
|
|||
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5bfd4457f551e5e71e0f74a0d52568e165404e22..f8b7cd7026fcd73c8cf0245d9f7ba58a453fb733 100644
|
||||
index 46ff259c64560ac7371e138627bf1b71227d308b..ebf70b414c63cdb715d739c3333adbafc3bd01e7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1202,7 +1202,7 @@ public final class CraftServer implements Server {
|
||||
|
@ -31,7 +31,7 @@ index 5bfd4457f551e5e71e0f74a0d52568e165404e22..f8b7cd7026fcd73c8cf0245d9f7ba58a
|
|||
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 24d2a9b4a1c602b8ac5960ed9668ab70f34d6620..63e4b8e4e44d6885b537ca3dd052dd806411f618 100644
|
||||
index 58f6348b04d776d510c0ede4e36a202e2fcb765c..425e0940159e335f3919a6f623a56968864b8fc1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -195,6 +195,31 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
@ -54,7 +54,7 @@ index 24d2a9b4a1c602b8ac5960ed9668ab70f34d6620..63e4b8e4e44d6885b537ca3dd052dd80
|
|||
+ return new BiomeProvider() {
|
||||
+ @Override
|
||||
+ 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
|
||||
|
|
Loading…
Reference in New Issue