Drop async pathfinder and biome conversion optimisations

Async pathfinder seems to do more bad than good. This is a wanted change, however akarin's implementation
seems a little bit off.

Biome conversion did nothing so it gets completely nuked.
This commit is contained in:
Ivan Pekov 2020-08-13 22:32:28 +03:00 committed by GitHub
parent 4f90ed4545
commit 3f737ea7f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 70 deletions

View File

@ -68,7 +68,6 @@ # Patches
| server | Remove vanilla profiler callers | Sotr | | | server | Remove vanilla profiler callers | Sotr | |
| server | Skip events if there's no listeners | William Blake Galbreath | | | server | Skip events if there's no listeners | William Blake Galbreath | |
| server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | | | server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | |
| server | Tuinity Optimise biome conversion | Spottedleaf | |
| server | Tweak Explosions | Aikar | | | server | Tweak Explosions | Aikar | |
| server | Use block distance in portal search radius | Patrick Hemmer | | | server | Use block distance in portal search radius | Patrick Hemmer | |
| api | Yatopia API Bundle | Bud Gidiere | | | api | Yatopia API Bundle | Bud Gidiere | |

View File

@ -1,69 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Thu, 13 Aug 2020 19:42:25 +0300
Subject: [PATCH] Tuinity Optimise biome conversion
For some reason this patch was dropped from Tuinity (maybe not needed?), however we ported this
just in case.
Ported by MrIvanPlays <ivan@mrivanplays.com>
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index bfae77f129859fba5e0f53723ba62a1626773b7c..0e9e3e75487ffedb4128f12a34af7733f05ffa75 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -97,6 +97,16 @@ public final class BiomeBase {
this.p = biomefog;
}
+ // Yatopia start - optimise biome conversion
+ private org.bukkit.block.Biome bukkitBiome;
+ public final org.bukkit.block.Biome getBukkitBiome(IRegistry<BiomeBase> registry) {
+ if (this.bukkitBiome == null) {
+ this.bukkitBiome = org.bukkit.block.Biome.valueOf(registry.getKey(this).getKey().toUpperCase(java.util.Locale.ENGLISH));
+ }
+ return this.bukkitBiome;
+ }
+ // Yatopia end
+
public BiomeSettingsMobs b() {
return this.l;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 0677ff98d530da5d4ae2194ebd0c229298d594a6..2155f794a97237b5288d4c7760e41a52993dd19a 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -506,12 +506,14 @@ public class CraftBlock implements Block {
getWorld().setBiome(getX(), getY(), getZ(), bio);
}
+ private static final java.util.EnumMap<Biome, BiomeBase> BUKKIT_BIOME_TO_NMS_CACHE = new java.util.EnumMap<>(Biome.class); // Yatopia
+
public static Biome biomeBaseToBiome(IRegistry<BiomeBase> registry, BiomeBase base) {
if (base == null) {
return null;
}
- return Registry.BIOME.get(CraftNamespacedKey.fromMinecraft(registry.getKey(base)));
+ return base.getBukkitBiome(registry); // Yatopia
}
public static BiomeBase biomeToBiomeBase(IRegistry<BiomeBase> registry, Biome bio) {
@@ -519,7 +521,16 @@ public class CraftBlock implements Block {
return null;
}
- return registry.get(CraftNamespacedKey.toMinecraft(bio.getKey()));
+ // Yatopia start - optimise biome conversion
+ BiomeBase cached = BUKKIT_BIOME_TO_NMS_CACHE.get(bio);
+ if (cached != null) return cached;
+
+ BiomeBase ret = registry.get(CraftNamespacedKey.toMinecraft(bio.getKey()));
+ synchronized (BUKKIT_BIOME_TO_NMS_CACHE) {
+ BUKKIT_BIOME_TO_NMS_CACHE.put(bio, ret);
+ }
+ return ret;
+ // Yatopia end
}
@Override