mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 18:39:23 +00:00
Petal: Update patches
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: peaches94 <peachescu94@gmail.com>
|
||||
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);
|
||||
@@ -0,0 +1,192 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: peaches94 <peachescu94@gmail.com>
|
||||
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<ChunkHolder.FullChunkStatus> fullStatus;
|
||||
@Nullable
|
||||
private LevelChunk.PostLoadProcessor postLoad;
|
||||
- private final Int2ObjectMap<GameEventListenerRegistry> 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<Block> blockTicks;
|
||||
private final LevelChunkTicks<Fluid> 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<GameEventListener> listeners = Lists.newArrayList();
|
||||
- private final Set<GameEventListener> listenersToRemove = Sets.newHashSet();
|
||||
- private final List<GameEventListener> listenersToAdd = Lists.newArrayList();
|
||||
+ //private final Set<GameEventListener> listenersToRemove = Sets.newHashSet(); // petal - not necessary
|
||||
+ //private final List<GameEventListener> 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<Vec3> 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<GameEvent> getListenableEvents() {
|
||||
47
patches/server/0029-Petal-Reduce-sensor-work.patch
Normal file
47
patches/server/0029-Petal-Reduce-sensor-work.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: peaches94 <peachescu94@gmail.com>
|
||||
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);
|
||||
@@ -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<ItemStack> 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<ChunkHolder.FullChunkStatus> fullStatus;
|
||||
@Nullable
|
||||
private LevelChunk.PostLoadProcessor postLoad;
|
||||
- private final Int2ObjectMap<GameEventListenerRegistry> gameEventListenerRegistrySections;
|
||||
+ private final Map<Integer,GameEventListenerRegistry> gameEventListenerRegistrySections;
|
||||
private final LevelChunkTicks<Block> blockTicks;
|
||||
private final LevelChunkTicks<Fluid> 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<T> entityClass, LevelCallback<T> handler, EntityPersistentStorage<T> 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<GameEventListener> listeners = Lists.newArrayList();
|
||||
- private final Set<GameEventListener> listenersToRemove = Sets.newHashSet();
|
||||
- private final List<GameEventListener> listenersToAdd = Lists.newArrayList();
|
||||
+ private final List<GameEventListener> listeners = new ConcurrentDoublyLinkedList<>();
|
||||
+ private final Set<GameEventListener> listenersToRemove = Sets.newConcurrentHashSet();
|
||||
+ private final List<GameEventListener> listenersToAdd = Lists.newCopyOnWriteArrayList();
|
||||
//private final Set<GameEventListener> listenersToRemove = Sets.newHashSet(); // petal - not necessary
|
||||
//private final List<GameEventListener> 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
|
||||
Reference in New Issue
Block a user