From 88ecb518cd3b2e192453e9ec2769b37074ef2a59 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Fri, 17 Feb 2023 14:01:12 -0500 Subject: [PATCH] Petal: Update patches --- .../0028-Petal-Reduce-sensor-work.patch | 26 --- ...educe-work-done-by-game-event-system.patch | 192 ++++++++++++++++++ .../0029-Petal-Reduce-sensor-work.patch | 47 +++++ ...karin-Save-Json-list-asynchronously.patch} | 0 ...atch => 0031-Slice-Smooth-Teleports.patch} | 0 ...try.patch => 0032-Pufferfish-Sentry.patch} | 0 ...3-Hearse-Paper-chunk-system-changes.patch} | 0 ...034-Hearse-Paper-world-code-changes.patch} | 0 ...0035-Hearse-Paper-util-code-changes.patch} | 0 ...ch => 0036-Hearse-Hearse-base-codes.patch} | 0 ...=> 0037-Hearse-Add-mcmt-collections.patch} | 0 ...atch => 0038-Hearse-MC-Code-changes.patch} | 51 ++--- ...s.patch => 0039-Hearse-Misc-changes.patch} | 0 ...> 0040-Hearse-Multithreaded-tracker.patch} | 0 ...hreading-issue-in-bukkit-event-syst.patch} | 0 15 files changed, 254 insertions(+), 62 deletions(-) delete mode 100644 patches/server/0028-Petal-Reduce-sensor-work.patch create mode 100644 patches/server/0028-Petal-reduce-work-done-by-game-event-system.patch create mode 100644 patches/server/0029-Petal-Reduce-sensor-work.patch rename patches/server/{0029-Akarin-Save-Json-list-asynchronously.patch => 0030-Akarin-Save-Json-list-asynchronously.patch} (100%) rename patches/server/{0030-Slice-Smooth-Teleports.patch => 0031-Slice-Smooth-Teleports.patch} (100%) rename patches/server/{0031-Pufferfish-Sentry.patch => 0032-Pufferfish-Sentry.patch} (100%) rename patches/server/{0032-Hearse-Paper-chunk-system-changes.patch => 0033-Hearse-Paper-chunk-system-changes.patch} (100%) rename patches/server/{0033-Hearse-Paper-world-code-changes.patch => 0034-Hearse-Paper-world-code-changes.patch} (100%) rename patches/server/{0034-Hearse-Paper-util-code-changes.patch => 0035-Hearse-Paper-util-code-changes.patch} (100%) rename patches/server/{0035-Hearse-Hearse-base-codes.patch => 0036-Hearse-Hearse-base-codes.patch} (100%) rename patches/server/{0036-Hearse-Add-mcmt-collections.patch => 0037-Hearse-Add-mcmt-collections.patch} (100%) rename patches/server/{0037-Hearse-MC-Code-changes.patch => 0038-Hearse-MC-Code-changes.patch} (98%) rename patches/server/{0038-Hearse-Misc-changes.patch => 0039-Hearse-Misc-changes.patch} (100%) rename patches/server/{0039-Hearse-Multithreaded-tracker.patch => 0040-Hearse-Multithreaded-tracker.patch} (100%) rename patches/server/{0040-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch => 0041-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch} (100%) diff --git a/patches/server/0028-Petal-Reduce-sensor-work.patch b/patches/server/0028-Petal-Reduce-sensor-work.patch deleted file mode 100644 index c2c5bf25..00000000 --- a/patches/server/0028-Petal-Reduce-sensor-work.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: peaches94 -Date: Sun, 10 Jul 2022 15:44:38 -0500 -Subject: [PATCH] Petal: Reduce sensor work - -Original license: GPL v3 -Original project: https://github.com/Bloom-host/Petal - -this patch is focused around the sensors used for ai -delete the line of sight cache less often and use a faster nearby comparison - -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 27fc50571305132c86497fcb1d5b1bb514610a4e..f1a33fd186fa9c10ac99b7b0e6379902a10dfb14 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -867,8 +867,8 @@ public abstract class Mob extends LivingEntity { - return; - } - // Paper end -- this.sensing.tick(); -- int i = this.level.getServer().getTickCount() + this.getId(); -+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up -+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second - - if (i % 2 != 0 && this.tickCount > 1) { - this.targetSelector.tickRunningGoals(false); diff --git a/patches/server/0028-Petal-reduce-work-done-by-game-event-system.patch b/patches/server/0028-Petal-reduce-work-done-by-game-event-system.patch new file mode 100644 index 00000000..b5d12bae --- /dev/null +++ b/patches/server/0028-Petal-reduce-work-done-by-game-event-system.patch @@ -0,0 +1,192 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: peaches94 +Date: Sun, 10 Jul 2022 13:29:20 -0500 +Subject: [PATCH] Petal: reduce work done by game event system + +Original license: GPL v3 +Original project: https://github.com/Bloom-host/Petal + +1. going into game event dispatching can be expensive so run the checks before dispatching + +2. EuclideanGameEventListenerRegistry is not used concurrently so we ban that usage for improved performance with allays + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +index 163e63e3c538c7c1c75ed634896db9d8c00416f3..d07c31d21c98583f7a387a23697b673feae6ad6b 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +@@ -85,6 +85,13 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi + + } + ++ // petal start ++ @Override ++ public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { ++ return !this.isRemoved() && gameEvent == GameEvent.ENTITY_DIE && context.sourceEntity() instanceof LivingEntity; ++ } ++ // petal end ++ + public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) { + org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. + blockEntity.sculkSpreader.updateCursors(world, pos, world.getRandom(), true); +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index c752545aa67ef6488d8dfa80fa424e123d7c8f0b..4c0f62f95990dc926ced1e4528612904bfbb6399 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -87,7 +87,18 @@ public class LevelChunk extends ChunkAccess { + private Supplier fullStatus; + @Nullable + private LevelChunk.PostLoadProcessor postLoad; +- private final Int2ObjectMap gameEventListenerRegistrySections; ++ // petal start ++ private final GameEventListenerRegistry[] gameEventListenerRegistrySections; ++ private static final int GAME_EVENT_DISPATCHER_RADIUS = 2; ++ ++ private static int getGameEventSectionIndex(int sectionIndex) { ++ return sectionIndex + GAME_EVENT_DISPATCHER_RADIUS; ++ } ++ ++ private static int getGameEventSectionLength(int sectionCount) { ++ return sectionCount + (GAME_EVENT_DISPATCHER_RADIUS * 2); ++ } ++ // petal end + private final LevelChunkTicks blockTicks; + private final LevelChunkTicks fluidTicks; + +@@ -116,7 +127,7 @@ public class LevelChunk extends ChunkAccess { + this.tickersInLevel = Maps.newHashMap(); + this.clientLightReady = false; + this.level = (ServerLevel) world; // CraftBukkit - type +- this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap(); ++ this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // petal + Heightmap.Types[] aheightmap_type = Heightmap.Types.values(); + int j = aheightmap_type.length; + +@@ -449,9 +460,23 @@ public class LevelChunk extends ChunkAccess { + if (world instanceof ServerLevel) { + ServerLevel worldserver = (ServerLevel) world; + +- return (GameEventListenerRegistry) this.gameEventListenerRegistrySections.computeIfAbsent(ySectionCoord, (j) -> { +- return new EuclideanGameEventListenerRegistry(worldserver); +- }); ++ // petal start ++ int sectionIndex = getGameEventSectionIndex(this.getSectionIndexFromSectionY(ySectionCoord)); ++ ++ // drop game events that are too far away (32 blocks) from loaded sections ++ // this matches the highest radius of game events in the game ++ if (sectionIndex < 0 || sectionIndex >= this.gameEventListenerRegistrySections.length) { ++ return GameEventListenerRegistry.NOOP; ++ } ++ ++ var dispatcher = this.gameEventListenerRegistrySections[sectionIndex]; ++ ++ if (dispatcher == null) { ++ dispatcher = this.gameEventListenerRegistrySections[sectionIndex] = new EuclideanGameEventListenerRegistry(worldserver); ++ } ++ ++ return dispatcher; ++ // petal end + } else { + return super.getListenerRegistry(ySectionCoord); + } +@@ -815,7 +840,7 @@ public class LevelChunk extends ChunkAccess { + + gameeventlistenerregistry.unregister(gameeventlistener); + if (gameeventlistenerregistry.isEmpty()) { +- this.gameEventListenerRegistrySections.remove(i); ++ this.gameEventListenerRegistrySections[getGameEventSectionIndex(this.getSectionIndexFromSectionY(i))] = null; // petal + } + } + } +diff --git a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +index 878a42695ecedf0c3f2e6310e3ce44c6b6c36858..3c3168284bfc22dab4037a861aff9f1712cb1c05 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +@@ -12,8 +12,8 @@ import net.minecraft.world.phys.Vec3; + + public class EuclideanGameEventListenerRegistry implements GameEventListenerRegistry { + private final List listeners = Lists.newArrayList(); +- private final Set listenersToRemove = Sets.newHashSet(); +- private final List listenersToAdd = Lists.newArrayList(); ++ //private final Set listenersToRemove = Sets.newHashSet(); // petal - not necessary ++ //private final List listenersToAdd = Lists.newArrayList(); // petal + private boolean processing; + private final ServerLevel level; + +@@ -29,7 +29,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + @Override + public void register(GameEventListener listener) { + if (this.processing) { +- this.listenersToAdd.add(listener); ++ throw new java.util.ConcurrentModificationException(); // petal - disallow concurrent modification + } else { + this.listeners.add(listener); + } +@@ -40,7 +40,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + @Override + public void unregister(GameEventListener listener) { + if (this.processing) { +- this.listenersToRemove.add(listener); ++ throw new java.util.ConcurrentModificationException(); // petal - disallow concurrent modification + } else { + this.listeners.remove(listener); + } +@@ -57,7 +57,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + + while(iterator.hasNext()) { + GameEventListener gameEventListener = iterator.next(); +- if (this.listenersToRemove.remove(gameEventListener)) { ++ if (false) { // petal - disallow concurrent modification + iterator.remove(); + } else { + Optional optional = getPostableListenerPosition(this.level, pos, gameEventListener); +@@ -71,6 +71,8 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + this.processing = false; + } + ++ // petal start ++ /* + if (!this.listenersToAdd.isEmpty()) { + this.listeners.addAll(this.listenersToAdd); + this.listenersToAdd.clear(); +@@ -80,6 +82,8 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + this.listeners.removeAll(this.listenersToRemove); + this.listenersToRemove.clear(); + } ++ */ ++ // petal end + + return bl; + } +diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java +index a6689c03777c2b4b79dcafcae5d70c949519cd8e..f94169a3e177251a05644e3e384ac0514efd3719 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java +@@ -18,4 +18,10 @@ public interface GameEventListener { + UNSPECIFIED, + BY_DISTANCE; + } ++ ++ // petal start - add check for seeing if this listener cares about an event ++ default boolean listensToEvent(net.minecraft.world.level.gameevent.GameEvent gameEvent, net.minecraft.world.level.gameevent.GameEvent.Context context) { ++ return true; ++ } ++ // petal end + } +diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java +index 3288837a406539c4a22464524ffb2e727c6ad32b..f36c53a7f34be7540c805df91454fa614cd3bbb7 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java +@@ -225,6 +225,13 @@ public class VibrationListener implements GameEventListener { + return true; + } + ++ // petal start ++ @Override ++ public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { ++ return this.currentVibration == null && gameEvent.is(this.config.getListenableEvents()); ++ } ++ // petal end ++ + public interface VibrationListenerConfig { + + default TagKey getListenableEvents() { diff --git a/patches/server/0029-Petal-Reduce-sensor-work.patch b/patches/server/0029-Petal-Reduce-sensor-work.patch new file mode 100644 index 00000000..55442225 --- /dev/null +++ b/patches/server/0029-Petal-Reduce-sensor-work.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: peaches94 +Date: Sun, 10 Jul 2022 15:44:38 -0500 +Subject: [PATCH] Petal: Reduce sensor work + +Original license: GPL v3 +Original project: https://github.com/Bloom-host/Petal + +this patch is focused around the sensors used for ai +delete the line of sight cache less often and use a faster nearby comparison + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 87499e82e80a8b7d6d8ca6eeaa1819b74fcf1665..d237f851070ddd780f02c592080d1e521de83444 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1012,12 +1012,14 @@ public abstract class LivingEntity extends Entity { + } + + if (entity != null) { +- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); ++ // petal start - only do itemstack lookup if we need to ++ //ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); + EntityType entitytypes = entity.getType(); + +- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) { ++ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { + d0 *= 0.5D; + } ++ // petal end + } + + return d0; +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index 27fc50571305132c86497fcb1d5b1bb514610a4e..f1a33fd186fa9c10ac99b7b0e6379902a10dfb14 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -867,8 +867,8 @@ public abstract class Mob extends LivingEntity { + return; + } + // Paper end +- this.sensing.tick(); +- int i = this.level.getServer().getTickCount() + this.getId(); ++ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up ++ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second + + if (i % 2 != 0 && this.tickCount > 1) { + this.targetSelector.tickRunningGoals(false); diff --git a/patches/server/0029-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0030-Akarin-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0029-Akarin-Save-Json-list-asynchronously.patch rename to patches/server/0030-Akarin-Save-Json-list-asynchronously.patch diff --git a/patches/server/0030-Slice-Smooth-Teleports.patch b/patches/server/0031-Slice-Smooth-Teleports.patch similarity index 100% rename from patches/server/0030-Slice-Smooth-Teleports.patch rename to patches/server/0031-Slice-Smooth-Teleports.patch diff --git a/patches/server/0031-Pufferfish-Sentry.patch b/patches/server/0032-Pufferfish-Sentry.patch similarity index 100% rename from patches/server/0031-Pufferfish-Sentry.patch rename to patches/server/0032-Pufferfish-Sentry.patch diff --git a/patches/server/0032-Hearse-Paper-chunk-system-changes.patch b/patches/server/0033-Hearse-Paper-chunk-system-changes.patch similarity index 100% rename from patches/server/0032-Hearse-Paper-chunk-system-changes.patch rename to patches/server/0033-Hearse-Paper-chunk-system-changes.patch diff --git a/patches/server/0033-Hearse-Paper-world-code-changes.patch b/patches/server/0034-Hearse-Paper-world-code-changes.patch similarity index 100% rename from patches/server/0033-Hearse-Paper-world-code-changes.patch rename to patches/server/0034-Hearse-Paper-world-code-changes.patch diff --git a/patches/server/0034-Hearse-Paper-util-code-changes.patch b/patches/server/0035-Hearse-Paper-util-code-changes.patch similarity index 100% rename from patches/server/0034-Hearse-Paper-util-code-changes.patch rename to patches/server/0035-Hearse-Paper-util-code-changes.patch diff --git a/patches/server/0035-Hearse-Hearse-base-codes.patch b/patches/server/0036-Hearse-Hearse-base-codes.patch similarity index 100% rename from patches/server/0035-Hearse-Hearse-base-codes.patch rename to patches/server/0036-Hearse-Hearse-base-codes.patch diff --git a/patches/server/0036-Hearse-Add-mcmt-collections.patch b/patches/server/0037-Hearse-Add-mcmt-collections.patch similarity index 100% rename from patches/server/0036-Hearse-Add-mcmt-collections.patch rename to patches/server/0037-Hearse-Add-mcmt-collections.patch diff --git a/patches/server/0037-Hearse-MC-Code-changes.patch b/patches/server/0038-Hearse-MC-Code-changes.patch similarity index 98% rename from patches/server/0037-Hearse-MC-Code-changes.patch rename to patches/server/0038-Hearse-MC-Code-changes.patch index a5e93adc..d7704aaf 100644 --- a/patches/server/0037-Hearse-MC-Code-changes.patch +++ b/patches/server/0038-Hearse-MC-Code-changes.patch @@ -83,7 +83,7 @@ index 1f3f414ede558f590a5e68256a60d9ca3c3edf32..e9a114a4431cedaafef4b427a8baf503 // Paper start - rewrite chunk system // guarantee that nothing can stop the server from halting if it can at least still tick diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index ae0c0c984c512b68a3e48d39743cd41b35674ce7..19899ef661f0c8547aa81b81e420d0b621d5859d 100644 +index 001738c2553cb73a9ed647302a99b462a609e14a..88a9e268d07b9e0fbcba0b3c48fb0c2814614267 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -1,5 +1,6 @@ @@ -1282,7 +1282,7 @@ index b439a6033223269c94e988069c0df3ad6ba5da28..e8833830d2fc1b1311a28316cb4a1fb7 if (this.removalReason == null) { this.removalReason = reason; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 87499e82e80a8b7d6d8ca6eeaa1819b74fcf1665..4d544b6033aebe6214e99747e91e2cceb20f14b2 100644 +index d237f851070ddd780f02c592080d1e521de83444..1ea4e005b93476fa7b2a404413b8c039d77818a7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1,5 +1,6 @@ @@ -1331,7 +1331,7 @@ index 87499e82e80a8b7d6d8ca6eeaa1819b74fcf1665..4d544b6033aebe6214e99747e91e2cce private static class ProcessableEffect { private MobEffect type; -@@ -1778,7 +1783,7 @@ public abstract class LivingEntity extends Entity { +@@ -1780,7 +1785,7 @@ public abstract class LivingEntity extends Entity { } }); // Paper end this.postDeathDropItems(deathEvent); // Paper @@ -1964,7 +1964,7 @@ index b59185cff16528b2e5a0c52807db9f21e2a68dda..760374edf885972b1dbbf8a6fa9e649b public List getContents() { diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 6a5452d6210bcc268d933f0051f1ce65f6dff4a1..3cfc663e3399a35416fe0462b2ed273eba59ff1e 100644 +index f8963e239354020c8e08460058541ddbaa07798c..c20aa5027ad7a7591a399aef236af7c51bc0a472 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -248,7 +248,9 @@ public final class ItemStack { @@ -2085,19 +2085,10 @@ index e254b2d04e4fc1dc76c26f61ea38aeb27755143f..948abd93c64a5b3679f3552945d7a9a2 return lists[index]; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index c752545aa67ef6488d8dfa80fa424e123d7c8f0b..76ca6a1fd3e227ee5e5d3d001c8cadf040a15dbd 100644 +index 4c0f62f95990dc926ced1e4528612904bfbb6399..4cf6578a26889aa7c1cc9a7f0f01c9e608724047 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -87,7 +87,7 @@ public class LevelChunk extends ChunkAccess { - private Supplier fullStatus; - @Nullable - private LevelChunk.PostLoadProcessor postLoad; -- private final Int2ObjectMap gameEventListenerRegistrySections; -+ private final Map gameEventListenerRegistrySections; - private final LevelChunkTicks blockTicks; - private final LevelChunkTicks fluidTicks; - -@@ -113,10 +113,10 @@ public class LevelChunk extends ChunkAccess { +@@ -124,7 +124,7 @@ public class LevelChunk extends ChunkAccess { this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world)); this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world)); // Paper end - rewrite light engine @@ -2105,12 +2096,8 @@ index c752545aa67ef6488d8dfa80fa424e123d7c8f0b..76ca6a1fd3e227ee5e5d3d001c8cadf0 + this.tickersInLevel = Maps.newConcurrentMap(); this.clientLightReady = false; this.level = (ServerLevel) world; // CraftBukkit - type -- this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap(); -+ this.gameEventListenerRegistrySections = Maps.newConcurrentMap(); - Heightmap.Types[] aheightmap_type = Heightmap.Types.values(); - int j = aheightmap_type.length; - -@@ -1074,10 +1074,8 @@ public class LevelChunk extends ChunkAccess { + this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // petal +@@ -1099,10 +1099,8 @@ public class LevelChunk extends ChunkAccess { for (int i = 0; i < this.postProcessing.length; ++i) { if (this.postProcessing[i] != null) { @@ -2243,23 +2230,19 @@ index a77985b2dd7137d8eea03909403fc08e89376d73..6bcbbbfc39432076a3d7714ecc2d05d9 public PersistentEntitySectionManager(Class entityClass, LevelCallback handler, EntityPersistentStorage dataAccess) { diff --git a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java -index 878a42695ecedf0c3f2e6310e3ce44c6b6c36858..b61ed4d03848f86ca5e93b0374bbf4ca05369ad2 100644 +index 3c3168284bfc22dab4037a861aff9f1712cb1c05..34598fbaa08a006fa0c8801adbcd5b2191766a7d 100644 --- a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +++ b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java -@@ -2,18 +2,21 @@ package net.minecraft.world.level.gameevent; +@@ -1,17 +1,13 @@ + package net.minecraft.world.level.gameevent; - import com.google.common.collect.Lists; - import com.google.common.collect.Sets; +-import com.google.common.collect.Lists; +-import com.google.common.collect.Sets; -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import java.util.Set; -+ +import java.util.*; -+ -+import it.unimi.dsi.fastutil.objects.ObjectArrayList; -+import it.unimi.dsi.fastutil.objects.ObjectList; -+import it.unimi.dsi.fastutil.objects.ObjectLists; +import net.himeki.mcmtfabric.parallelised.ConcurrentDoublyLinkedList; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.server.level.ServerLevel; @@ -2267,14 +2250,10 @@ index 878a42695ecedf0c3f2e6310e3ce44c6b6c36858..b61ed4d03848f86ca5e93b0374bbf4ca public class EuclideanGameEventListenerRegistry implements GameEventListenerRegistry { - private final List listeners = Lists.newArrayList(); -- private final Set listenersToRemove = Sets.newHashSet(); -- private final List listenersToAdd = Lists.newArrayList(); + private final List listeners = new ConcurrentDoublyLinkedList<>(); -+ private final Set listenersToRemove = Sets.newConcurrentHashSet(); -+ private final List listenersToAdd = Lists.newCopyOnWriteArrayList(); + //private final Set listenersToRemove = Sets.newHashSet(); // petal - not necessary + //private final List listenersToAdd = Lists.newArrayList(); // petal private boolean processing; - private final ServerLevel level; - diff --git a/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java b/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java index daa03360dd7044f10b20f36023b305dc7e0bb7df..35de9e9a9d211b16a8b945bc512c128709ec6bfc 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/LegacyRandomSource.java diff --git a/patches/server/0038-Hearse-Misc-changes.patch b/patches/server/0039-Hearse-Misc-changes.patch similarity index 100% rename from patches/server/0038-Hearse-Misc-changes.patch rename to patches/server/0039-Hearse-Misc-changes.patch diff --git a/patches/server/0039-Hearse-Multithreaded-tracker.patch b/patches/server/0040-Hearse-Multithreaded-tracker.patch similarity index 100% rename from patches/server/0039-Hearse-Multithreaded-tracker.patch rename to patches/server/0040-Hearse-Multithreaded-tracker.patch diff --git a/patches/server/0040-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch b/patches/server/0041-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch similarity index 100% rename from patches/server/0040-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch rename to patches/server/0041-Hearse-Fix-some-threading-issue-in-bukkit-event-syst.patch