diff --git a/leaf-server/minecraft-patches/features/0026-Petal-reduce-work-done-by-game-event-system.patch b/leaf-server/minecraft-patches/features/0026-Petal-reduce-work-done-by-game-event-system.patch index b0b47b9b..381b1056 100644 --- a/leaf-server/minecraft-patches/features/0026-Petal-reduce-work-done-by-game-event-system.patch +++ b/leaf-server/minecraft-patches/features/0026-Petal-reduce-work-done-by-game-event-system.patch @@ -11,7 +11,7 @@ Original project: https://github.com/Bloom-host/Petal 2. EuclideanGameEventListenerRegistry is not used concurrently so we ban that usage for improved performance with allays diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -index 1638eccef431fb68775af624110f1968f0c6dabd..1b63730f508813f380460860a6193d419112c08f 100644 +index 1638eccef431fb68775af624110f1968f0c6dabd..62038854696bd946f58e0e8d26da02415c34e4b1 100644 --- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java @@ -65,7 +65,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi @@ -19,7 +19,7 @@ index 1638eccef431fb68775af624110f1968f0c6dabd..1b63730f508813f380460860a6193d41 } - public static class CatalystListener implements GameEventListener { -+ public class CatalystListener implements GameEventListener { // Leaf - petal ++ public class CatalystListener implements GameEventListener { // Leaf - petal - reduce work done by game event system public static final int PULSE_TICKS = 8; final SculkSpreader sculkSpreader; private final BlockState blockState; @@ -27,18 +27,18 @@ index 1638eccef431fb68775af624110f1968f0c6dabd..1b63730f508813f380460860a6193d41 level.playSound(null, pos, SoundEvents.SCULK_CATALYST_BLOOM, SoundSource.BLOCKS, 2.0F, 0.6F + random.nextFloat() * 0.4F); } -+ // Leaf start - petal ++ // Leaf start - petal - reduce work done by game event system + @Override + public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { + return !SculkCatalystBlockEntity.this.isRemoved() && gameEvent == GameEvent.ENTITY_DIE.value() && context.sourceEntity() instanceof LivingEntity; + } -+ // Leaf end - petal ++ // Leaf end - petal - reduce work done by game event system + private void tryAwardItSpreadsAdvancement(Level level, LivingEntity entity) { if (entity.getLastHurtByMob() instanceof ServerPlayer serverPlayer) { DamageSource damageSource = entity.getLastDamageSource() == null diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f11289bb28 100644 +index a5f76c81dfb148fc184d137395d5961229cb799b..265e890557dd6557b327b6252dd3177fdd112777 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -79,7 +79,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -46,7 +46,7 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 @Nullable private LevelChunk.PostLoadProcessor postLoad; - private final Int2ObjectMap gameEventListenerRegistrySections; -+ // Leaf start - petal ++ // Leaf start - petal - reduce work done by game event system + private final GameEventListenerRegistry[] gameEventListenerRegistrySections; + private static final int GAME_EVENT_DISPATCHER_RADIUS = 2; + @@ -58,7 +58,7 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 + return sectionCount + (GAME_EVENT_DISPATCHER_RADIUS * 2); + } + -+ // Leaf end - petal ++ // Leaf end - petal - reduce work done by game event system private final LevelChunkTicks blockTicks; private final LevelChunkTicks fluidTicks; private LevelChunk.UnsavedListener unsavedListener = chunkPos -> {}; @@ -67,7 +67,7 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 super(pos, data, level, net.minecraft.server.MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry this.level = (ServerLevel) level; // CraftBukkit - type - this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>(); -+ this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // Leaf - petal ++ this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // Leaf - petal - reduce work done by game event system for (Heightmap.Types types : Heightmap.Types.values()) { if (ChunkStatus.FULL.heightmapsAfter().contains(types)) { @@ -79,7 +79,7 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 - ? this.gameEventListenerRegistrySections - .computeIfAbsent(sectionY, i -> new EuclideanGameEventListenerRegistry(serverLevel, sectionY, this::removeGameEventListenerRegistry)) - : super.getListenerRegistry(sectionY); -+ // Leaf start - petal ++ // Leaf start - petal - reduce work done by game event system + if (this.level instanceof ServerLevel serverLevel) { + int sectionIndex = getGameEventSectionIndex(this.getSectionIndexFromSectionY(sectionY)); + @@ -99,7 +99,7 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 + } + + return super.getListenerRegistry(sectionY); -+ // Leaf end - petal ++ // Leaf end - petal - reduce work done by game event system } // Paper start - Perf: Reduce instructions and provide final method @@ -108,12 +108,12 @@ index a5f76c81dfb148fc184d137395d5961229cb799b..d97d8e79034eb1484d4e3646faacc6f1 private void removeGameEventListenerRegistry(int sectionY) { - this.gameEventListenerRegistrySections.remove(sectionY); -+ this.gameEventListenerRegistrySections[getGameEventSectionIndex(this.getSectionIndexFromSectionY(sectionY))] = null; // Leaf - petal ++ this.gameEventListenerRegistrySections[getGameEventSectionIndex(this.getSectionIndexFromSectionY(sectionY))] = null; // Leaf - petal - reduce work done by game event system } private void removeBlockEntityTicker(BlockPos pos) { diff --git a/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java b/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java -index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61cafc58461f 100644 +index 5175fc90a1fc61c832c6697997a97ae199b195ac..fc56ef2d5ed813db51e35b635e373b6f8035593b 100644 --- a/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +++ b/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java @@ -14,8 +14,8 @@ import net.minecraft.world.phys.Vec3; @@ -122,8 +122,8 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca private final List listeners = Lists.newArrayList(); - private final Set listenersToRemove = Sets.newHashSet(); - private final List listenersToAdd = Lists.newArrayList(); -+ //private final Set listenersToRemove = Sets.newHashSet(); // Leaf - petal - Not necessary -+ //private final List listenersToAdd = Lists.newArrayList(); // Leaf - petal ++ //private final Set listenersToRemove = Sets.newHashSet(); // Leaf - petal - reduce work done by game event system - Not necessary ++ //private final List listenersToAdd = Lists.newArrayList(); // Leaf - petal - reduce work done by game event system private boolean processing; private final ServerLevel level; private final int sectionY; @@ -132,7 +132,7 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca public void register(GameEventListener listener) { if (this.processing) { - this.listenersToAdd.add(listener); -+ throw new java.util.ConcurrentModificationException(); // Leaf - petal - Disallow concurrent modification ++ throw new java.util.ConcurrentModificationException(); // Leaf - petal - reduce work done by game event system - Disallow concurrent modification } else { this.listeners.add(listener); } @@ -141,7 +141,7 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca public void unregister(GameEventListener listener) { if (this.processing) { - this.listenersToRemove.add(listener); -+ throw new java.util.ConcurrentModificationException(); // Leaf - petal - Disallow concurrent modification ++ throw new java.util.ConcurrentModificationException(); // Leaf - petal - reduce work done by game event system - Disallow concurrent modification } else { this.listeners.remove(listener); } @@ -150,7 +150,7 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca while (iterator.hasNext()) { GameEventListener gameEventListener = iterator.next(); - if (this.listenersToRemove.remove(gameEventListener)) { -+ if (false) { // Leaf - petal - Disallow concurrent modification ++ if (false) { // Leaf - petal - reduce work done by game event system - Disallow concurrent modification iterator.remove(); } else { Optional postableListenerPosition = getPostableListenerPosition(this.level, pos, gameEventListener); @@ -158,7 +158,7 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca this.processing = false; } -+ // Leaf start - petal ++ // Leaf start - petal - reduce work done by game event system + /* if (!this.listenersToAdd.isEmpty()) { this.listeners.addAll(this.listenersToAdd); @@ -168,34 +168,35 @@ index 5175fc90a1fc61c832c6697997a97ae199b195ac..17ba3e94021365f0ea28126b5bef61ca this.listenersToRemove.clear(); } + */ -+ // Leaf end - petal ++ // Leaf end - petal - reduce work done by game event system return flag; } diff --git a/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/net/minecraft/world/level/gameevent/GameEventDispatcher.java -index 1e9b066ef468ae840eda3c1f6c4b68111a5e862c..a0c7debc62cbbc3f8911e06d453f51d239917d8d 100644 +index 1e9b066ef468ae840eda3c1f6c4b68111a5e862c..1074ab996b48782a76d5afeb6fc790bdd33210ee 100644 --- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java +++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java @@ -44,6 +44,7 @@ public class GameEventDispatcher { int sectionPosCoord5 = SectionPos.blockToSectionCoord(blockPos.getZ() + notificationRadius); List list = new ArrayList<>(); GameEventListenerRegistry.ListenerVisitor listenerVisitor = (listener, pos1) -> { -+ if (!listener.listensToEvent(gameEvent.value(), context)) return; // Leaf - petal - If they don't listen, ignore ++ if (!listener.listensToEvent(gameEvent.value(), context)) return; // Leaf - petal - reduce work done by game event system - If they don't listen, ignore if (listener.getDeliveryMode() == GameEventListener.DeliveryMode.BY_DISTANCE) { list.add(new GameEvent.ListenerInfo(gameEvent, pos, context, listener, pos1)); } else { diff --git a/net/minecraft/world/level/gameevent/GameEventListener.java b/net/minecraft/world/level/gameevent/GameEventListener.java -index 5a31b5f1e75dd7b412ab577ea6621b7e87fc0590..6411c12392c4989ed3ce9ead52d42c49dfdfa201 100644 +index 5a31b5f1e75dd7b412ab577ea6621b7e87fc0590..4d991ab3290646ec3fd6645154abfa5b4e42d00a 100644 --- a/net/minecraft/world/level/gameevent/GameEventListener.java +++ b/net/minecraft/world/level/gameevent/GameEventListener.java -@@ -23,4 +23,10 @@ public interface GameEventListener { +@@ -23,4 +23,11 @@ public interface GameEventListener { public interface Provider { T getListener(); } + -+ // Leaf start - petal - Add check for seeing if this listener cares about an event ++ // Leaf start - petal - reduce work done by game event system ++ // Add check for seeing if this listener cares about an event + default boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { + return true; + } -+ // Leaf end - petal - Add check for seeing if this listener cares about an event ++ // Leaf end - petal - reduce work done by game event system } diff --git a/leaf-server/minecraft-patches/features/0027-Reduce-canSee-work.patch b/leaf-server/minecraft-patches/features/0027-Reduce-canSee-work.patch index 53d3c326..7a0af77a 100644 --- a/leaf-server/minecraft-patches/features/0027-Reduce-canSee-work.patch +++ b/leaf-server/minecraft-patches/features/0027-Reduce-canSee-work.patch @@ -7,7 +7,7 @@ Co-authored by: Martijn Muijsers Co-authored by: MachineBreaker diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 78654e7ae26c0b2b2512f4e29a331e2ead2d6916..b7cbf1c7bb56668763c4f968ea0d69f730cb5285 100644 +index 78654e7ae26c0b2b2512f4e29a331e2ead2d6916..13edbcdabc159e3694e7dbe824ccb5bb447fe788 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -1006,17 +1006,19 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -19,14 +19,14 @@ index 78654e7ae26c0b2b2512f4e29a331e2ead2d6916..b7cbf1c7bb56668763c4f968ea0d69f7 - continue; - } - -+ // Leaf - move up ++ // Leaf - Reduce canSee work - move up // !entity1.dead && entity1.i && (entity == null || !entity1.x(entity)); // elide the last check since vanilla calls with entity = null // only we care about the source for the canSee check if (entity.isRemoved() || !entity.blocksBuilding) { continue; } -+ // Leaf end ++ // Leaf end - Reduce canSee work - move up + + if (checkCanSee && source instanceof net.minecraft.server.level.ServerPlayer && entity instanceof net.minecraft.server.level.ServerPlayer + && !((net.minecraft.server.level.ServerPlayer) source).getBukkitEntity().canSee(((net.minecraft.server.level.ServerPlayer) entity).getBukkitEntity())) { diff --git a/leaf-server/minecraft-patches/features/0028-Fix-sprint-glitch.patch b/leaf-server/minecraft-patches/features/0028-Fix-sprint-glitch.patch index b5d996ab..27dea9e2 100644 --- a/leaf-server/minecraft-patches/features/0028-Fix-sprint-glitch.patch +++ b/leaf-server/minecraft-patches/features/0028-Fix-sprint-glitch.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix sprint glitch diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 956c1b5422c177e0da5140c4184720d10aa4e790..c041cba43b4687e2f2f057edfae448a42f6d8753 100644 +index 9f36d063168c262fec7e69a96bad375b4eaff797..d7bb99b6d0a5818ccd68aa361c77a8733023f1ea 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -1379,7 +1379,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -13,8 +13,8 @@ index 956c1b5422c177e0da5140c4184720d10aa4e790..c041cba43b4687e2f2f057edfae448a4 } - player.updateScaledHealth(false); -+ //player.updateScaledHealth(false); // Leaf - Commented out to fix sprint glitch -+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // Leaf - Sprint glitch fixed by pafias ++ //player.updateScaledHealth(false); // Leaf - Fix sprint glitch - commented out ++ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // Leaf - Fix sprint glitch return; } // CraftBukkit end diff --git a/leaf-server/minecraft-patches/features/0029-Configurable-movement-speed-of-more-entities.patch b/leaf-server/minecraft-patches/features/0029-Configurable-movement-speed-of-more-entities.patch index 2ff0ed6e..7d6acaee 100644 --- a/leaf-server/minecraft-patches/features/0029-Configurable-movement-speed-of-more-entities.patch +++ b/leaf-server/minecraft-patches/features/0029-Configurable-movement-speed-of-more-entities.patch @@ -5,38 +5,38 @@ Subject: [PATCH] Configurable movement speed of more entities diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index f5e6673ff2bd3029585b9ffea10df5d549f1cdd6..6b328ea277bb3adcb674b05845f82f7427237555 100644 +index f5e6673ff2bd3029585b9ffea10df5d549f1cdd6..d44ed0d6a672a0b1eb0a8781e3e094096a2b753d 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -97,6 +97,7 @@ public class Drowned extends Zombie implements RangedAttackMob { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.drownedMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.drownedScale); -+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.drownedMovementSpeed); // Leaf - Configurable drowned movement speed ++ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.drownedMovementSpeed); // Leaf - Configurable movement speed of more entities - drowned } @Override diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java -index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..a500584a3736d289bca2f7a76fec2d1567065229 100644 +index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..5fe02c322def05265445bf8876ea75d9f3732d0f 100644 --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java @@ -43,6 +43,7 @@ public class Husk extends Zombie { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.huskMaxHealth); -+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.huskMovementSpeed); // Leaf - Configurable husk movement speed ++ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.huskMovementSpeed); // Leaf - Configurable movement speed of more entities - husk } @Override diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java -index 7af71c777dca26cd94b1807a2a77ea0d30e92976..cab69c308a0524137636fd50dc7a0dd0d2a4a2c3 100644 +index 7af71c777dca26cd94b1807a2a77ea0d30e92976..e64f9308fc848c0f22d8dbd6e544b7862054be7b 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java @@ -123,6 +123,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombieScale); -+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieMovementSpeed); // Leaf - Configurable zombie movement speed ++ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieMovementSpeed); // Leaf - Configurable movement speed of more entities - zombie } // Purpur end - Configurable entity base attributes @@ -45,31 +45,31 @@ index 7af71c777dca26cd94b1807a2a77ea0d30e92976..cab69c308a0524137636fd50dc7a0dd0 return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) - .add(Attributes.MOVEMENT_SPEED, 0.23F) -+ //.add(Attributes.MOVEMENT_SPEED, 0.23F) // Leaf - Configurable zombie movement speed ++ //.add(Attributes.MOVEMENT_SPEED, 0.23F) // Leaf - Configurable movement speed of more entities - zombie .add(Attributes.ATTACK_DAMAGE, 3.0) .add(Attributes.ARMOR, 2.0) .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE); diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java -index 1ca0514732916d325c4a76d73120aaf613c3f780..750f63e337661b5448d0d863ab4dc99398fd5655 100644 +index 1ca0514732916d325c4a76d73120aaf613c3f780..970f6bdb0d0c15f7d814926472daec689beb82f4 100644 --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java @@ -99,6 +99,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieVillagerMaxHealth); -+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieVillagerMovementSpeed); // Leaf - Configurable zombieVillager movement speed ++ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieVillagerMovementSpeed); // Leaf - Configurable movement speed of more entities - zombieVillager } @Override diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index fddbbffafea275dad187b7908386cf4c05c86743..10eac072872b9e61c25d368d19e86b18bc3d19e7 100644 +index fddbbffafea275dad187b7908386cf4c05c86743..89a67db9bbdb31661fa4f71f1270198ba2d56c7a 100644 --- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -85,6 +85,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombifiedPiglinMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombifiedPiglinScale); -+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombifiedPiglinMovementSpeed); // Leaf - Configurable zombifiedPiglin movement speed ++ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombifiedPiglinMovementSpeed); // Leaf - Configurable movement speed of more entities - zombifiedPiglin } // Purpur end - Configurable entity base attributes @@ -78,19 +78,19 @@ index fddbbffafea275dad187b7908386cf4c05c86743..10eac072872b9e61c25d368d19e86b18 return Zombie.createAttributes() .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0) - .add(Attributes.MOVEMENT_SPEED, 0.23F) -+ //.add(Attributes.MOVEMENT_SPEED, 0.23F) // Leaf - Configurable zombie movement speed ++ //.add(Attributes.MOVEMENT_SPEED, 0.23F) // Leaf - Configurable movement speed of more entities - zombie .add(Attributes.ATTACK_DAMAGE, 5.0); } diff --git a/org/purpurmc/purpur/PurpurWorldConfig.java b/org/purpurmc/purpur/PurpurWorldConfig.java -index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c756265b300 100644 +index 2aac26f50958d8653eb1472daa7761d36093cf4c..8fd8732149f9f134ed6f8666918432c4a160556e 100644 --- a/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1563,6 +1563,7 @@ public class PurpurWorldConfig { public boolean drownedTakeDamageFromWater = false; public boolean drownedBreakDoors = false; public boolean drownedAlwaysDropExp = false; -+ public double drownedMovementSpeed = 0.23F; // Leaf - Configurable drowned movement speed ++ public double drownedMovementSpeed = 0.23F; // Leaf - Configurable movement speed of more entities - drowned private void drownedSettings() { drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable); drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater); @@ -98,7 +98,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 drownedTakeDamageFromWater = getBoolean("mobs.drowned.takes-damage-from-water", drownedTakeDamageFromWater); drownedBreakDoors = getBoolean("mobs.drowned.can-break-doors", drownedBreakDoors); drownedAlwaysDropExp = getBoolean("mobs.drowned.always-drop-exp", drownedAlwaysDropExp); -+ drownedMovementSpeed = getDouble("mobs.drowned.movement-speed", drownedMovementSpeed); // Leaf - Configurable drowned movement speed ++ drownedMovementSpeed = getDouble("mobs.drowned.movement-speed", drownedMovementSpeed); // Leaf - Configurable movement speed of more entities - drowned } public boolean elderGuardianRidable = false; @@ -106,7 +106,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 public boolean huskJockeyTryExistingChickens = true; public boolean huskTakeDamageFromWater = false; public boolean huskAlwaysDropExp = false; -+ public double huskMovementSpeed = 0.23F; // Leaf - Configurable husk movement speed ++ public double huskMovementSpeed = 0.23F; // Leaf - Configurable movement speed of more entities - husk private void huskSettings() { huskRidable = getBoolean("mobs.husk.ridable", huskRidable); huskRidableInWater = getBoolean("mobs.husk.ridable-in-water", huskRidableInWater); @@ -114,7 +114,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 huskJockeyTryExistingChickens = getBoolean("mobs.husk.jockey.try-existing-chickens", huskJockeyTryExistingChickens); huskTakeDamageFromWater = getBoolean("mobs.husk.takes-damage-from-water", huskTakeDamageFromWater); huskAlwaysDropExp = getBoolean("mobs.husk.always-drop-exp", huskAlwaysDropExp); -+ huskMovementSpeed = getDouble("mobs.husk.movement-speed", huskMovementSpeed); // Leaf - Configurable husk movement speed ++ huskMovementSpeed = getDouble("mobs.husk.movement-speed", huskMovementSpeed); // Leaf - Configurable movement speed of more entities - husk } public boolean illusionerRidable = false; @@ -122,7 +122,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 public boolean zombieTakeDamageFromWater = false; public boolean zombieAlwaysDropExp = false; public double zombieHeadVisibilityPercent = 0.5D; -+ public double zombieMovementSpeed = 0.23F; // Leaf - Configurable zombie movement speed ++ public double zombieMovementSpeed = 0.23F; // Leaf - Configurable movement speed of more entities - zombie private void zombieSettings() { zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable); zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater); @@ -130,7 +130,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 zombieTakeDamageFromWater = getBoolean("mobs.zombie.takes-damage-from-water", zombieTakeDamageFromWater); zombieAlwaysDropExp = getBoolean("mobs.zombie.always-drop-exp", zombieAlwaysDropExp); zombieHeadVisibilityPercent = getDouble("mobs.zombie.head-visibility-percent", zombieHeadVisibilityPercent); -+ zombieMovementSpeed = getDouble("mobs.zombie.movement-speed", zombieMovementSpeed); // Leaf - Configurable zombie movement speed ++ zombieMovementSpeed = getDouble("mobs.zombie.movement-speed", zombieMovementSpeed); // Leaf - Configurable movement speed of more entities - zombie } public boolean zombieHorseRidable = false; @@ -138,7 +138,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 public int zombieVillagerCuringTimeMax = 6000; public boolean zombieVillagerCureEnabled = true; public boolean zombieVillagerAlwaysDropExp = false; -+ public double zombieVillagerMovementSpeed = 0.23F; // Leaf - Configurable zombieVillager movement speed ++ public double zombieVillagerMovementSpeed = 0.23F; // Leaf - Configurable movement speed of more entities - zombieVillager private void zombieVillagerSettings() { zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable); zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater); @@ -146,7 +146,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax); zombieVillagerCureEnabled = getBoolean("mobs.zombie_villager.cure.enabled", zombieVillagerCureEnabled); zombieVillagerAlwaysDropExp = getBoolean("mobs.zombie_villager.always-drop-exp", zombieVillagerAlwaysDropExp); -+ zombieVillagerMovementSpeed = getDouble("mobs.zombie_villager.movement-speed", zombieVillagerMovementSpeed); // Leaf - Configurable zombieVillager movement speed ++ zombieVillagerMovementSpeed = getDouble("mobs.zombie_villager.movement-speed", zombieVillagerMovementSpeed); // Leaf - Configurable movement speed of more entities - zombieVillager } public boolean zombifiedPiglinRidable = false; @@ -154,7 +154,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = true; public boolean zombifiedPiglinTakeDamageFromWater = false; public boolean zombifiedPiglinAlwaysDropExp = false; -+ public double zombifiedPiglinMovementSpeed = 0.23F; // Leaf - Configurable zombifiedPiglin movement speed ++ public double zombifiedPiglinMovementSpeed = 0.23F; // Leaf - Configurable movement speed of more entities - zombifiedPiglin private void zombifiedPiglinSettings() { zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable); zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater); @@ -162,7 +162,7 @@ index 2aac26f50958d8653eb1472daa7761d36093cf4c..fd5a5b9cb9958e96ecfeb4846e290c75 zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry); zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater); zombifiedPiglinAlwaysDropExp = getBoolean("mobs.zombified_piglin.always-drop-exp", zombifiedPiglinAlwaysDropExp); -+ zombifiedPiglinMovementSpeed = getDouble("mobs.zombified_piglin.movement-speed", zombifiedPiglinMovementSpeed); // Leaf - Configurable zombifiedPiglin movement speed ++ zombifiedPiglinMovementSpeed = getDouble("mobs.zombified_piglin.movement-speed", zombifiedPiglinMovementSpeed); // Leaf - Configurable movement speed of more entities - zombifiedPiglin } public float hungerStarvationDamage = 1.0F; diff --git a/leaf-server/minecraft-patches/features/0030-Faster-sequencing-of-futures-for-chunk-structure-gen.patch b/leaf-server/minecraft-patches/features/0030-Faster-sequencing-of-futures-for-chunk-structure-gen.patch index 0b7dfafb..96e6c9b7 100644 --- a/leaf-server/minecraft-patches/features/0030-Faster-sequencing-of-futures-for-chunk-structure-gen.patch +++ b/leaf-server/minecraft-patches/features/0030-Faster-sequencing-of-futures-for-chunk-structure-gen.patch @@ -7,10 +7,10 @@ Replace `thenApply` with `thenCompose`. Once one task is completed then the next to prevent blocking threads while waiting to complete all tasks. But may cause the sequence of future compose disorder. diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java -index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..ad41d6d5723d1194344fd9c5a9151356be8bb602 100644 +index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..b097f685e826e70008e3a096ee5f1d4fccf25680 100644 --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -607,17 +607,44 @@ public class Util { +@@ -607,17 +607,42 @@ public class Util { return map; } @@ -18,6 +18,7 @@ index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..ad41d6d5723d1194344fd9c5a9151356 public static CompletableFuture> sequence(List> futures) { + return sequence(futures, false); + } ++ + public static CompletableFuture> sequence(List> futures, boolean useFaster) { + // Leaf end - Faster sequencing of futures for chunk structure gen if (futures.isEmpty()) { @@ -26,11 +27,8 @@ index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..ad41d6d5723d1194344fd9c5a9151356 return futures.get(0).thenApply(List::of); } else { CompletableFuture completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); -+ // Leaf start - Faster sequencing of futures for chunk structure gen -+ if (org.dreeam.leaf.config.modules.opt.FasterStructureGenFutureSequencing.enabled && useFaster) { -+ return sequenceFaster(futures, completableFuture); -+ } -+ // Leaf end - Faster sequencing of futures for chunk structure gen ++ ++ if (useFaster) return sequenceFaster(futures, completableFuture); // Leaf - Faster sequencing of futures for chunk structure gen + return completableFuture.thenApply(_void -> futures.stream().map(CompletableFuture::join).toList()); } @@ -69,7 +67,7 @@ index d8c472b8c6aadcaadef14abd8ab43f466e94417e..bc079b6c3d751f2a63d089bf209cf7d8 list2 -> createAndValidateFullContext(registryAccess, provider, (List>)list2), backgroundExecutor ); diff --git a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index 619b98e42e254c0c260c171a26a2472ddf59b885..4483d7764ddca635fb6fb841fdc2185357106fc5 100644 +index 619b98e42e254c0c260c171a26a2472ddf59b885..f07a5416e5dc7e9a798a78ce9573a0c42bc59d04 100644 --- a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -255,7 +255,7 @@ public class ChunkGeneratorStructureState { @@ -77,7 +75,7 @@ index 619b98e42e254c0c260c171a26a2472ddf59b885..4483d7764ddca635fb6fb841fdc21853 } - return Util.sequence(list).thenApply(completed -> { -+ return Util.sequence(list, true).thenApply(completed -> { // Leaf - Faster sequencing of futures for chunk structure gen ++ return Util.sequence(list, org.dreeam.leaf.config.modules.opt.FasterStructureGenFutureSequencing.enabled).thenApply(completed -> { // Leaf - Faster sequencing of futures for chunk structure gen double d2 = stopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000.0; LOGGER.debug("Calculation for {} took {}s", structureSet, d2); return completed; diff --git a/leaf-server/minecraft-patches/features/0031-Reduce-active-items-finding-hopper-nearby-check.patch b/leaf-server/minecraft-patches/features/0031-Reduce-active-items-finding-hopper-nearby-check.patch index f7ece2b6..c219f8e7 100644 --- a/leaf-server/minecraft-patches/features/0031-Reduce-active-items-finding-hopper-nearby-check.patch +++ b/leaf-server/minecraft-patches/features/0031-Reduce-active-items-finding-hopper-nearby-check.patch @@ -9,17 +9,19 @@ But still recommend to turn-off `checkForMinecartNearItemWhileActive` Since `Reduce-hopper-item-checks.patch` will cause lag under massive dropped items diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java -index 0e21c644d62597cf3425c8717ab1e70c766e22f2..6287f5d84f961968b82d350c3d15b587e8d19236 100644 +index 0e21c644d62597cf3425c8717ab1e70c766e22f2..3fbdb1cdb2c69340cbca6b154cdb7eae95f6391f 100644 --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -241,7 +241,9 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -241,7 +241,11 @@ public class ItemEntity extends Entity implements TraceableEntity { this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause return; // Gale - EMC - reduce hopper item checks } - this.markNearbyHopperCartsAsImmune(); // Gale - EMC - reduce hopper item checks -+ if (level().galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart.temporaryImmunity.checkForMinecartNearItemWhileActive) { // Leaf - Reduce items finding hopper nearby check ++ // Leaf start - Reduce active items finding hopper nearby check ++ if (level().galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart.temporaryImmunity.checkForMinecartNearItemWhileActive) { + this.markNearbyHopperCartsAsImmune(); // Gale - EMC - reduce hopper item checks + } ++ // Leaf end - Reduce active items finding hopper nearby check } } diff --git a/leaf-server/paper-patches/features/0002-Leaf-Bootstrap.patch b/leaf-server/paper-patches/features/0002-Leaf-Bootstrap.patch index cea76d2e..06a070a3 100644 --- a/leaf-server/paper-patches/features/0002-Leaf-Bootstrap.patch +++ b/leaf-server/paper-patches/features/0002-Leaf-Bootstrap.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Leaf Bootstrap org.bukkit.craftbukkit.Main#main -> LeafBootstrap -> PaperBootstrap -> ... diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ecb0fcd1f3b3f3d7751eded3cdf0977c1889c9ed..1df9bed6d3dc1e28898af8d5ad6a854dd5ccab1b 100644 +index ecb0fcd1f3b3f3d7751eded3cdf0977c1889c9ed..d0becb56a9911ef4cc55ae8d7c47832f442ad52f 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -278,7 +278,8 @@ public class Main { @@ -14,8 +14,8 @@ index ecb0fcd1f3b3f3d7751eded3cdf0977c1889c9ed..1df9bed6d3dc1e28898af8d5ad6a854d //System.out.println("Loading libraries, please wait..."); //net.minecraft.server.Main.main(options); - io.papermc.paper.PaperBootstrap.boot(options); -+ //io.papermc.paper.PaperBootstrap.boot(options); // Leaf - LeafBoostrap - diff on change -+ org.dreeam.leaf.LeafBootstrap.boot(options); // Leaf - LeafBoostrap ++ //io.papermc.paper.PaperBootstrap.boot(options); // Leaf - Leaf Boostrap - diff on change ++ org.dreeam.leaf.LeafBootstrap.boot(options); // Leaf - Leaf Boostrap } catch (Throwable t) { t.printStackTrace(); } diff --git a/todos.md b/todos.md index 8f6be409..5f348746 100644 --- a/todos.md +++ b/todos.md @@ -8,7 +8,6 @@ - [ ] refactor leaves protocol manager opt and pr it. - [ ] check multithreaded tracker, that moonrise change - [ ] Check and apply work patches -- [ ] Backport Cache canHoldAnyFluid result to 1.21.1 - [ ] Transfer patch notes to file for Gale and Leaf - [ ] Add spigot config unknown message to leaf docs - [ ] Add server full join config explaination to docs