Skip to content

Commit

Permalink
Fix incorrect Minecraft -> Bukkit entity type cache obtain and update…
Browse files Browse the repository at this point in the history
… & Remove removed patches source
  • Loading branch information
Dreeam-qwq committed Jan 19, 2025
1 parent 75a16c4 commit 8400629
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 404 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ and the results are always same, thus there is no need to do the convert process
Save ~0.16ms per tick, and improve 11660ms -> 60ms in around 1 hour.

diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
index 47db4546242974a40f7fc1e34f237fd1f06d5f37..f73fa612a63f2a24646261988843fa8a6e7c3e04 100644
index 47db4546242974a40f7fc1e34f237fd1f06d5f37..5efe81d85ffb91614308c442ec1afcff4c7855a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
@@ -15,15 +15,25 @@ import org.bukkit.entity.EntityType;
@@ -15,14 +15,26 @@ import org.bukkit.entity.EntityType;

public class CraftEntityType {

Expand All @@ -33,8 +33,8 @@ index 47db4546242974a40f7fc1e34f237fd1f06d5f37..f73fa612a63f2a24646261988843fa8a

Preconditions.checkArgument(bukkit != null);

- return bukkit;
+ return MINECRAFT_TO_BUKKIT_KEY_CACHE.put(minecraft, bukkit); // Leaf - Cache CraftEntityType#minecraftToBukkit convert
+ MINECRAFT_TO_BUKKIT_KEY_CACHE.put(minecraft, bukkit); // Leaf - Cache CraftEntityType#minecraftToBukkit convert
+
return bukkit;
}

private static final java.util.Map<EntityType, net.minecraft.resources.ResourceKey<net.minecraft.world.entity.EntityType<?>>> KEY_CACHE = java.util.Collections.synchronizedMap(new java.util.EnumMap<>(EntityType.class)); // Paper

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8400629

Please sign in to comment.