mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-26 20:55:30 +01:00
Port tuinity biome conversion optimisations and a nitpick
This commit is contained in:
parent
5f55124016
commit
4f90ed4545
@ -68,6 +68,7 @@ # Patches
|
||||
| server | Remove vanilla profiler callers | Sotr | |
|
||||
| server | Skip events if there's no listeners | William Blake Galbreath | |
|
||||
| server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | |
|
||||
| server | Tuinity Optimise biome conversion | Spottedleaf | |
|
||||
| server | Tweak Explosions | Aikar | |
|
||||
| server | Use block distance in portal search radius | Patrick Hemmer | |
|
||||
| api | Yatopia API Bundle | Bud Gidiere | |
|
||||
|
@ -19,7 +19,7 @@ index 0ed01f40edfdbeeeea9db55fcba7501ee597c1fb..795fd9308dcd9edce4ef12da2e8bc5a6
|
||||
if (!this.a(pathtype)) {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index ed37caf036ef9ae4c39622caf9b582678fecdccf..666ac7227e273aabb3f8e5ca78b5ac9652486229 100644
|
||||
index ed37caf036ef9ae4c39622caf9b582678fecdccf..d1306caa5f98cd6b3fc0614dc6a4edeb0ad6a53a 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -28,6 +28,15 @@ public abstract class NavigationAbstract {
|
||||
@ -145,7 +145,7 @@ index ed37caf036ef9ae4c39622caf9b582678fecdccf..666ac7227e273aabb3f8e5ca78b5ac96
|
||||
+ BaseBlockPosition baseblockposition = pathEntity.g();
|
||||
+
|
||||
+ if (baseblockposition.equals(this.h)) {
|
||||
+ this.i = SystemUtils.getMonotonicMillis() - this.j;
|
||||
+ this.i += SystemUtils.getMonotonicMillis() - this.j;
|
||||
+ } else {
|
||||
+ this.h = baseblockposition;
|
||||
+ double d0 = vec3d.f(Vec3D.c(this.h));
|
||||
|
69
patches/server/0034-Tuinity-Optimise-biome-conversion.patch
Normal file
69
patches/server/0034-Tuinity-Optimise-biome-conversion.patch
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
Loading…
Reference in New Issue
Block a user