PaperMC/patches/server/0720-Add-NamespacedKey-biome-methods.patch

29 lines
1.6 KiB
Diff
Raw Permalink Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
Date: Sun, 14 Aug 2022 12:23:11 -0400
Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
2024-12-03 20:34:55 +01:00
index d7698f8ae59195458148397406a104224676b76e..088ff124ca82e69e59e02e6604959e399e4aff03 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -598,6 +598,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
2024-10-27 18:11:15 +01:00
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
}
2024-10-27 18:11:15 +01:00
+
+ @Override
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
+ return accessor.getBiome(x, y, z).getKey();
+ }
+
+ @Override
+ public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
+ accessor.setBiome(x, y, z, org.bukkit.Registry.BIOME.getOrThrow(biomeKey));
+ }
2024-10-27 18:11:15 +01:00
// Paper end
/**