aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0720-Add-NamespacedKey-biome-methods.patch
blob: 8420d9c080124a70b6a76555b52c1c61fa901006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
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 {
         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);
     }
+
+    @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));
+    }
     // Paper end
 
     /**