diff options
author | Kyle Wood <[email protected]> | 2021-06-24 01:21:17 -0500 |
---|---|---|
committer | Kyle Wood <[email protected]> | 2021-06-24 01:21:17 -0500 |
commit | 6ab98f8e35c9c941759ff1d15e15f66293c1983a (patch) | |
tree | 4635cf11ddcc351d65044664d17924067f373fb2 /Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch | |
parent | 216bd81bef963ff595eff88b68e9737977c40f66 (diff) | |
download | Paper-6ab98f8e35c9c941759ff1d15e15f66293c1983a.tar.gz Paper-6ab98f8e35c9c941759ff1d15e15f66293c1983a.zip |
More changes for new paperweight
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch')
-rw-r--r-- | Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch deleted file mode 100644 index 727414b274..0000000000 --- a/Spigot-Server-Patches-Unmapped/0272-Optimize-CraftBlockData-Creation.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: miclebrick <[email protected]> -Date: Thu, 23 Aug 2018 11:45:32 -0400 -Subject: [PATCH] Optimize CraftBlockData Creation - -Avoids a hashmap lookup by cacheing a reference to the CraftBlockData -and cloning it when one is needed. - -diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java -index 10f4015b8c36e4e27cf7d0745ba70b8a9e60aff3..57857cc33603cf278de424b540a3d4a5943584c9 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java -+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java -@@ -375,6 +375,14 @@ public abstract class BlockBase { - this.o = blockbase_info.t; - this.p = blockbase_info.u; - } -+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time -+ private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; -+ -+ public org.bukkit.craftbukkit.block.data.CraftBlockData createCraftBlockData() { -+ if (cachedCraftBlockData == null) cachedCraftBlockData = org.bukkit.craftbukkit.block.data.CraftBlockData.createData(getBlockData()); -+ return (org.bukkit.craftbukkit.block.data.CraftBlockData) cachedCraftBlockData.clone(); -+ } -+ // Paper end - - public void a() { - if (!this.getBlock().o()) { -diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 76fd1fea386d0e65c63c529dba772f01d9888407..ed88da727feddc319a650fb35710d16727f6dbd7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -509,7 +509,17 @@ public class CraftBlockData implements BlockData { - return craft; - } - -+ // Paper start - optimize creating BlockData to not need a map lookup -+ static { -+ // Initialize cached data for all IBlockData instances after registration -+ Block.REGISTRY_ID.iterator().forEachRemaining(IBlockData::createCraftBlockData); -+ } - public static CraftBlockData fromData(IBlockData data) { -+ return data.createCraftBlockData(); -+ } -+ -+ public static CraftBlockData createData(IBlockData data) { -+ // Paper end - return MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data); - } - |