diff --git a/patches/server/0095-Optimize-villager-data-storage.patch b/patches/server/0095-Optimize-villager-data-storage.patch new file mode 100644 index 0000000..afcbc8b --- /dev/null +++ b/patches/server/0095-Optimize-villager-data-storage.patch @@ -0,0 +1,314 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 11:20:37 +0100 +Subject: [PATCH] Optimize villager data storage + +License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/net/minecraft/world/Container.java b/src/main/java/net/minecraft/world/Container.java +index f5bed0f18b2a3dbe7d52c1b83717298fa5acf561..5f5347ea42ea589ef3d5da88b88cc45a810e9426 100644 +--- a/src/main/java/net/minecraft/world/Container.java ++++ b/src/main/java/net/minecraft/world/Container.java +@@ -118,6 +118,20 @@ public interface Container extends Clearable { + }); + } + ++ // Gale start - optimize villager data storage ++ default boolean hasAnyOf(Item[] items) { ++ for (int i = 0; i < this.getContainerSize(); ++i) { ++ ItemStack itemstack = this.getItem(i); ++ for (Item item : items) { ++ if (itemstack.is(item)) { ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ // Gale end - optimize villager data storage ++ + default boolean hasAnyMatching(Predicate predicate) { + for (int i = 0; i < this.getContainerSize(); ++i) { + ItemStack itemstack = this.getItem(i); +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java +index 3af715e2f3f3949af614a8fcebbc4a835d48ca49..94fb9bcf601832ee934331c0376de8707b5043c5 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java +@@ -1,9 +1,8 @@ + package net.minecraft.world.entity.ai.behavior; + + import com.google.common.collect.ImmutableMap; +-import com.google.common.collect.ImmutableSet; +-import java.util.Set; +-import java.util.stream.Collectors; ++ ++import java.util.Arrays; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.world.SimpleContainer; + import net.minecraft.world.entity.EntityType; +@@ -15,11 +14,16 @@ import net.minecraft.world.entity.npc.VillagerProfession; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; + import net.minecraft.world.item.Items; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + + public class TradeWithVillager extends Behavior { + private static final int INTERACT_DIST_SQR = 5; + private static final float SPEED_MODIFIER = 0.5F; +- private Set trades = ImmutableSet.of(); ++ // Gale start - optimize villager data storage ++ private static final Item[] WHEAT_SINGLETON_ARRAY = {Items.WHEAT}; ++ private @NotNull Item @Nullable [] trades = null; ++ // Gale end - optimize villager data storage + + public TradeWithVillager() { + super(ImmutableMap.of(MemoryModuleType.INTERACTION_TARGET, MemoryStatus.VALUE_PRESENT, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryStatus.VALUE_PRESENT)); +@@ -49,15 +53,17 @@ public class TradeWithVillager extends Behavior { + BehaviorUtils.lockGazeAndWalkToEachOther(entity, villager, 0.5F); + entity.gossip(world, villager, time); + if (entity.hasExcessFood() && (entity.getVillagerData().getProfession() == VillagerProfession.FARMER || villager.wantsMoreFood())) { +- throwHalfStack(entity, Villager.FOOD_POINTS.keySet(), villager); ++ throwHalfStack(entity, Villager.FOOD_POINTS_KEY_ARRAY, villager); // Gale - optimize villager data storage + } + + if (villager.getVillagerData().getProfession() == VillagerProfession.FARMER && entity.getInventory().countItem(Items.WHEAT) > Items.WHEAT.getMaxStackSize() / 2) { +- throwHalfStack(entity, ImmutableSet.of(Items.WHEAT), villager); ++ throwHalfStack(entity, WHEAT_SINGLETON_ARRAY, villager); // Gale - optimize villager data storage + } + +- if (!this.trades.isEmpty() && entity.getInventory().hasAnyOf(this.trades)) { ++ // Gale start - optimize villager data storage ++ if (this.trades != null && entity.getInventory().hasAnyOf(this.trades)) { + throwHalfStack(entity, this.trades, villager); ++ // Gale end - optimize villager data storage + } + + } +@@ -68,15 +74,35 @@ public class TradeWithVillager extends Behavior { + villager.getBrain().eraseMemory(MemoryModuleType.INTERACTION_TARGET); + } + +- private static Set figureOutWhatIAmWillingToTrade(Villager entity, Villager target) { +- ImmutableSet immutableSet = target.getVillagerData().getProfession().requestedItems(); +- ImmutableSet immutableSet2 = entity.getVillagerData().getProfession().requestedItems(); +- return immutableSet.stream().filter((item) -> { +- return !immutableSet2.contains(item); +- }).collect(Collectors.toSet()); ++ // Gale start - optimize villager data storage ++ private static @NotNull Item @Nullable [] figureOutWhatIAmWillingToTrade(Villager entity, Villager target) { ++ @NotNull Item @Nullable [] immutableSet = target.getVillagerData().getProfession().requestedItems(); ++ if (immutableSet == null) { ++ return null; ++ } ++ @NotNull Item @Nullable [] immutableSet2 = entity.getVillagerData().getProfession().requestedItems(); ++ if (immutableSet2 == null) { ++ return immutableSet; ++ } ++ if (immutableSet == immutableSet2) { ++ return null; ++ } ++ Item[] willingToTrade = new Item[immutableSet.length]; ++ int willingToTradeSize = 0; ++ forImmutableSet: for (Item item : immutableSet) { ++ for (Item item2 : immutableSet2) { ++ if (item == item2) { ++ continue forImmutableSet; ++ } ++ } ++ willingToTrade[willingToTradeSize] = item; ++ willingToTradeSize++; ++ } ++ return Arrays.copyOf(willingToTrade, willingToTradeSize); ++ // Gale end - optimize villager data storage + } + +- private static void throwHalfStack(Villager villager, Set validItems, LivingEntity target) { ++ private static void throwHalfStack(Villager villager, @NotNull Item @NotNull [] validItems, LivingEntity target) { // Gale - optimize villager data storage + SimpleContainer simpleContainer = villager.getInventory(); + ItemStack itemStack = ItemStack.EMPTY; + int i = 0; +@@ -89,7 +115,16 @@ public class TradeWithVillager extends Behavior { + itemStack2 = simpleContainer.getItem(i); + if (!itemStack2.isEmpty()) { + item = itemStack2.getItem(); +- if (validItems.contains(item)) { ++ // Gale start - optimize villager data storage ++ boolean inValidItems = false; ++ for (Item validItem : validItems) { ++ if (validItem == item) { ++ inValidItems = true; ++ break; ++ } ++ } ++ if (inValidItems) { ++ // Gale end - optimize villager data storage + if (itemStack2.getCount() > itemStack2.getMaxStackSize() / 2) { + j = itemStack2.getCount() / 2; + break label28; +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java +index 75dc06a3041bfdfb08c914eb50cfa282ae9eb2fe..53b0519bbc5d52490040eaf0fe449648f021d0c2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java +@@ -2,7 +2,8 @@ package net.minecraft.world.entity.ai.sensing; + + import com.google.common.collect.ImmutableSet; + import com.google.common.collect.Lists; +-import java.util.List; ++ ++import java.util.ArrayList; + import java.util.Set; + import net.minecraft.core.BlockPos; + import net.minecraft.core.GlobalPos; +@@ -12,6 +13,7 @@ import net.minecraft.world.entity.ai.Brain; + import net.minecraft.world.entity.ai.memory.MemoryModuleType; + import net.minecraft.world.entity.npc.Villager; + import net.minecraft.world.level.Level; ++import org.jetbrains.annotations.Nullable; + + public class SecondaryPoiSensor extends Sensor { + private static final int SCAN_RATE = 40; +@@ -24,21 +26,26 @@ public class SecondaryPoiSensor extends Sensor { + protected void doTick(ServerLevel world, Villager entity) { + // Gale start - Lithium - skip secondary POI sensor if absent + var secondaryPoi = entity.getVillagerData().getProfession().secondaryPoi(); +- if (secondaryPoi.isEmpty()) { ++ if (secondaryPoi == null) { // Gale - optimize villager data storage + entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE); + return; + } + // Gale end - Lithium - skip secondary POI sensor if absent + ResourceKey resourceKey = world.dimension(); + BlockPos blockPos = entity.blockPosition(); +- List list = Lists.newArrayList(); ++ @Nullable ArrayList list = null; // Gale - optimize villager data storage + int i = 4; + + for(int j = -4; j <= 4; ++j) { + for(int k = -2; k <= 2; ++k) { + for(int l = -4; l <= 4; ++l) { + BlockPos blockPos2 = blockPos.offset(j, k, l); +- if (entity.getVillagerData().getProfession().secondaryPoi().contains(world.getBlockState(blockPos2).getBlock())) { ++ // Gale start - optimize villager data storage ++ if (secondaryPoi == world.getBlockState(blockPos2).getBlock()) { ++ if (list == null) { ++ list = Lists.newArrayList(); ++ } ++ // Gale end - optimize villager data storage + list.add(GlobalPos.of(resourceKey, blockPos2)); + } + } +@@ -46,7 +53,10 @@ public class SecondaryPoiSensor extends Sensor { + } + + Brain brain = entity.getBrain(); +- if (!list.isEmpty()) { ++ // Gale start - optimize villager data storage ++ if (list != null) { ++ list.trimToSize(); ++ // Gale end - optimize villager data storage + brain.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, list); + } else { + brain.eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE); +diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java +index a4029cd16d964cd3a58f9f6e8471fbdf07de578b..3a5e51aed3223527e42affdebd93633ec06eb7ca 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +@@ -103,8 +103,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + private static final EntityDataAccessor DATA_VILLAGER_DATA = SynchedEntityData.defineId(Villager.class, EntityDataSerializers.VILLAGER_DATA); + public static final int BREEDING_FOOD_THRESHOLD = 12; + public static final Map FOOD_POINTS = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1); ++ public static final Item[] FOOD_POINTS_KEY_ARRAY = FOOD_POINTS.keySet().toArray(Item[]::new); // Gale - optimize villager data storage + private static final int TRADES_PER_LEVEL = 2; +- private static final Set WANTED_ITEMS = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS}); ++ private static final Item[] WANTED_ITEMS = {Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, Items.BEETROOT_SEEDS}; // Gale - optimize villager data storage + private static final int MAX_GOSSIP_TOPICS = 10; + private static final int GOSSIP_COOLDOWN = 1200; + private static final int GOSSIP_DECAY_INTERVAL = 24000; +@@ -896,7 +897,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + public boolean wantsToPickUp(ItemStack stack) { + Item item = stack.getItem(); + +- return (Villager.WANTED_ITEMS.contains(item) || this.getVillagerData().getProfession().requestedItems().contains(item)) && this.getInventory().canAddItem(stack); ++ // Gale start - optimize villager data storage ++ boolean isDesired = false; ++ for (Item wantedItem : WANTED_ITEMS) { ++ if (wantedItem == item) { ++ isDesired = true; ++ break; ++ } ++ } ++ if (!isDesired) { ++ for (Item requestedItem : this.getVillagerData().getProfession().requestedItems()) { ++ if (requestedItem == item) { ++ isDesired = true; ++ break; ++ } ++ } ++ } ++ return isDesired && this.getInventory().canAddItem(stack); ++ // Gale end - optimize villager data storage + } + + public boolean hasExcessFood() { +diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java +index ac70c2c03241e73943bd517a8c69dd05e0873634..95197b601d93c30a7645d67c89c7608fc00a8de6 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java ++++ b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java +@@ -1,8 +1,6 @@ + package net.minecraft.world.entity.npc; + +-import com.google.common.collect.ImmutableSet; + import java.util.function.Predicate; +-import javax.annotation.Nullable; + import net.minecraft.core.Holder; + import net.minecraft.core.Registry; + import net.minecraft.core.registries.BuiltInRegistries; +@@ -17,8 +15,10 @@ import net.minecraft.world.item.Item; + import net.minecraft.world.item.Items; + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.block.Blocks; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + +-public record VillagerProfession(String name, Predicate> heldJobSite, Predicate> acquirableJobSite, ImmutableSet requestedItems, ImmutableSet secondaryPoi, @Nullable SoundEvent workSound) { ++public record VillagerProfession(String name, Predicate> heldJobSite, Predicate> acquirableJobSite, @NotNull Item @Nullable [] requestedItems, @Nullable Block secondaryPoi, @Nullable SoundEvent workSound) { // Gale - optimize villager data storage + public static final Predicate> ALL_ACQUIRABLE_JOBS = (poiType) -> { + return poiType.is(PoiTypeTags.ACQUIRABLE_JOB_SITE); + }; +@@ -27,7 +27,7 @@ public record VillagerProfession(String name, Predicate> heldJob + public static final VillagerProfession BUTCHER = register("butcher", PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER); + public static final VillagerProfession CARTOGRAPHER = register("cartographer", PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER); + public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, SoundEvents.VILLAGER_WORK_CLERIC); +- public static final VillagerProfession FARMER = register("farmer", PoiTypes.FARMER, ImmutableSet.of(Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT_SEEDS, Items.BONE_MEAL), ImmutableSet.of(Blocks.FARMLAND), SoundEvents.VILLAGER_WORK_FARMER); ++ public static final VillagerProfession FARMER = register("farmer", PoiTypes.FARMER, new Item[] {Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT_SEEDS, Items.BONE_MEAL}, Blocks.FARMLAND, SoundEvents.VILLAGER_WORK_FARMER); // Gale - optimize villager data storage + public static final VillagerProfession FISHERMAN = register("fisherman", PoiTypes.FISHERMAN, SoundEvents.VILLAGER_WORK_FISHERMAN); + public static final VillagerProfession FLETCHER = register("fletcher", PoiTypes.FLETCHER, SoundEvents.VILLAGER_WORK_FLETCHER); + public static final VillagerProfession LEATHERWORKER = register("leatherworker", PoiTypes.LEATHERWORKER, SoundEvents.VILLAGER_WORK_LEATHERWORKER); +@@ -52,18 +52,20 @@ public record VillagerProfession(String name, Predicate> heldJob + } + + private static VillagerProfession register(String id, Predicate> heldWorkstation, Predicate> acquirableWorkstation, @Nullable SoundEvent workSound) { +- return register(id, heldWorkstation, acquirableWorkstation, ImmutableSet.of(), ImmutableSet.of(), workSound); ++ return register(id, heldWorkstation, acquirableWorkstation, null, null, workSound); // Gale - optimize villager data storage + } + +- private static VillagerProfession register(String id, ResourceKey heldWorkstation, ImmutableSet gatherableItems, ImmutableSet secondaryJobSites, @Nullable SoundEvent workSound) { ++ private static VillagerProfession register(String id, ResourceKey heldWorkstation, @NotNull Item @Nullable [] gatherableItems, @Nullable Block secondaryJobSite, @Nullable SoundEvent workSound) { // Gale - optimize villager data storage + return register(id, (entry) -> { + return entry.is(heldWorkstation); + }, (entry) -> { + return entry.is(heldWorkstation); +- }, gatherableItems, secondaryJobSites, workSound); ++ }, gatherableItems, secondaryJobSite, workSound); // Gale - optimize villager data storage + } + +- private static VillagerProfession register(String id, Predicate> heldWorkstation, Predicate> acquirableWorkstation, ImmutableSet gatherableItems, ImmutableSet secondaryJobSites, @Nullable SoundEvent workSound) { +- return Registry.register(BuiltInRegistries.VILLAGER_PROFESSION, new ResourceLocation(id), new VillagerProfession(id, heldWorkstation, acquirableWorkstation, gatherableItems, secondaryJobSites, workSound)); ++ // Gale start - optimize villager data storage ++ private static VillagerProfession register(String id, Predicate> heldWorkstation, Predicate> acquirableWorkstation, @NotNull Item @Nullable [] gatherableItems, @Nullable Block secondaryJobSite, @Nullable SoundEvent workSound) { ++ return Registry.register(BuiltInRegistries.VILLAGER_PROFESSION, new ResourceLocation(id), new VillagerProfession(id, heldWorkstation, acquirableWorkstation, gatherableItems != null && gatherableItems.length == 0 ? null : gatherableItems, secondaryJobSite, workSound)); ++ // Gale end - optimize villager data storage + } + } diff --git a/patches/server/0095-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0096-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0095-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0096-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0096-Store-mob-counts-in-an-array.patch b/patches/server/0097-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0096-Store-mob-counts-in-an-array.patch rename to patches/server/0097-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0097-Use-linked-map-for-entity-trackers.patch b/patches/server/0098-Use-linked-map-for-entity-trackers.patch similarity index 100% rename from patches/server/0097-Use-linked-map-for-entity-trackers.patch rename to patches/server/0098-Use-linked-map-for-entity-trackers.patch diff --git a/patches/server/0098-Optimize-noise-generation.patch b/patches/server/0099-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0098-Optimize-noise-generation.patch rename to patches/server/0099-Optimize-noise-generation.patch diff --git a/patches/server/0099-Optimize-sheep-offspring-color.patch b/patches/server/0100-Optimize-sheep-offspring-color.patch similarity index 100% rename from patches/server/0099-Optimize-sheep-offspring-color.patch rename to patches/server/0100-Optimize-sheep-offspring-color.patch diff --git a/patches/server/0100-Ignore-durability-change-equipment-updates.patch b/patches/server/0101-Ignore-durability-change-equipment-updates.patch similarity index 100% rename from patches/server/0100-Ignore-durability-change-equipment-updates.patch rename to patches/server/0101-Ignore-durability-change-equipment-updates.patch diff --git a/patches/server/0101-Hide-flames-on-entities-with-fire-resistance.patch b/patches/server/0102-Hide-flames-on-entities-with-fire-resistance.patch similarity index 100% rename from patches/server/0101-Hide-flames-on-entities-with-fire-resistance.patch rename to patches/server/0102-Hide-flames-on-entities-with-fire-resistance.patch diff --git a/patches/server/0102-Skip-cloning-advancement-criteria.patch b/patches/server/0103-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0102-Skip-cloning-advancement-criteria.patch rename to patches/server/0103-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0103-Reduce-block-destruction-packet-allocations.patch b/patches/server/0104-Reduce-block-destruction-packet-allocations.patch similarity index 100% rename from patches/server/0103-Reduce-block-destruction-packet-allocations.patch rename to patches/server/0104-Reduce-block-destruction-packet-allocations.patch diff --git a/patches/server/0104-Send-set-head-rotation-packets-only-for-living-entit.patch b/patches/server/0105-Send-set-head-rotation-packets-only-for-living-entit.patch similarity index 100% rename from patches/server/0104-Send-set-head-rotation-packets-only-for-living-entit.patch rename to patches/server/0105-Send-set-head-rotation-packets-only-for-living-entit.patch diff --git a/patches/server/0105-Player-canSee-by-entity-UUID.patch b/patches/server/0106-Player-canSee-by-entity-UUID.patch similarity index 100% rename from patches/server/0105-Player-canSee-by-entity-UUID.patch rename to patches/server/0106-Player-canSee-by-entity-UUID.patch diff --git a/patches/server/0106-Spread-out-sending-all-player-info.patch b/patches/server/0107-Spread-out-sending-all-player-info.patch similarity index 100% rename from patches/server/0106-Spread-out-sending-all-player-info.patch rename to patches/server/0107-Spread-out-sending-all-player-info.patch diff --git a/patches/server/0107-Optimize-player-list-for-sending-player-info.patch b/patches/server/0108-Optimize-player-list-for-sending-player-info.patch similarity index 100% rename from patches/server/0107-Optimize-player-list-for-sending-player-info.patch rename to patches/server/0108-Optimize-player-list-for-sending-player-info.patch diff --git a/patches/server/0108-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/patches/server/0109-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch similarity index 100% rename from patches/server/0108-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch rename to patches/server/0109-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch diff --git a/patches/server/0109-Send-multiple-keep-alive-packets.patch b/patches/server/0110-Send-multiple-keep-alive-packets.patch similarity index 100% rename from patches/server/0109-Send-multiple-keep-alive-packets.patch rename to patches/server/0110-Send-multiple-keep-alive-packets.patch diff --git a/patches/server/0111-Make-max-interaction-distance-configurable.patch b/patches/server/0111-Make-max-interaction-distance-configurable.patch deleted file mode 100644 index 35b20df..0000000 --- a/patches/server/0111-Make-max-interaction-distance-configurable.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Martijn Muijsers -Date: Sat, 24 Dec 2022 23:30:35 +0100 -Subject: [PATCH] Make max interaction distance configurable - -License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html) -Gale - https://galemc.org - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 58b093bb1de78ee3b3b2ea364aa50474883f443a..9a511c8e86f7a8b96c450af811bf9d5bb3b28f18 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -173,7 +173,11 @@ public class ServerPlayerGameMode { - private void debugLogging(BlockPos pos, boolean success, int sequence, String reason) {} - - public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) { -- if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { -+ // Gale start - make max interaction distance configurable -+ double configuredMaxInteractionDistance = this.player.level.galeConfig().gameplayMechanics.playerMaxInteractionDistance; -+ double maxInteractionDistanceSquared = configuredMaxInteractionDistance < 0 ? ServerGamePacketListenerImpl.DEFAULT_MAX_INTERACTION_DISTANCE : configuredMaxInteractionDistance * configuredMaxInteractionDistance; -+ if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > maxInteractionDistanceSquared) { -+ // Gale end - make max interaction distance configurable - if (true) return; // Paper - Don't notify if unreasonably far away - this.debugLogging(pos, false, sequence, "too far"); - } else if (pos.getY() >= worldHeight) { -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 315c7737f75c426a7e5c091fb340187df12235de..c7f996e8ef77671de4134db37e96022343f223a1 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -249,7 +249,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - - static final Logger LOGGER = LogUtils.getLogger(); - private static final int LATENCY_CHECK_INTERVAL = 15000; -- public static final double MAX_INTERACTION_DISTANCE = Mth.square(6.0D); -+ public static final double DEFAULT_MAX_INTERACTION_DISTANCE = Mth.square(6.0D); // Gale - make max interaction distance configurable - private static final int NO_BLOCK_UPDATES_TO_ACK = -1; - private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; - private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed"); -diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -index ffc39061f2363b979590888e736dd7a53a0d256a..c5598c0ba356dfc9e1ca66be8dbe7aaffaff316c 100644 ---- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -@@ -267,6 +267,18 @@ public class GaleWorldConfiguration extends ConfigurationPart { - public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable - public boolean hideFlamesOnEntitiesWithFireResistance = false; // Gale - Slice - hide flames on entities with fire resistance - -+ // Gale start - make max interaction distance configurable -+ /** -+ * The maximum distance for blocks with which a player can interact with left- or right-clicking. -+ * Any value < 0 uses the default max distance, which is currently 6.0. -+ *
    -+ *
  • Default: -1.0
  • -+ *
  • Vanilla: -1.0
  • -+ *
-+ */ -+ public double playerMaxInteractionDistance = -1.0; -+ // Gale end - make max interaction distance configurable -+ - public Fixes fixes; - public class Fixes extends ConfigurationPart { - diff --git a/patches/server/0110-Make-slow-login-timeout-configurable.patch b/patches/server/0111-Make-slow-login-timeout-configurable.patch similarity index 100% rename from patches/server/0110-Make-slow-login-timeout-configurable.patch rename to patches/server/0111-Make-slow-login-timeout-configurable.patch diff --git a/patches/server/0112-Make-max-interaction-distance-configurable.patch b/patches/server/0112-Make-max-interaction-distance-configurable.patch new file mode 100644 index 0000000..f8a11ff --- /dev/null +++ b/patches/server/0112-Make-max-interaction-distance-configurable.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 24 Dec 2022 23:30:35 +0100 +Subject: [PATCH] Make max interaction distance configurable + +License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index 58b093bb1de78ee3b3b2ea364aa50474883f443a..7be34e5df2b6d33c1d7943c9c0b6fd065b010c34 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -173,7 +173,7 @@ public class ServerPlayerGameMode { + private void debugLogging(BlockPos pos, boolean success, int sequence, String reason) {} + + public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) { +- if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { ++ if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.getMaxInteractionDistanceSquared(this.player.level)) { // Gale - make max interaction distance configurable + if (true) return; // Paper - Don't notify if unreasonably far away + this.debugLogging(pos, false, sequence, "too far"); + } else if (pos.getY() >= worldHeight) { +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 315c7737f75c426a7e5c091fb340187df12235de..9e45e69b16f483d1b94b21f4510d056eb0ceb8b1 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -184,7 +184,6 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; +-import org.apache.commons.lang3.StringUtils; + import org.galemc.gale.configuration.GaleGlobalConfiguration; + import org.slf4j.Logger; + +@@ -249,7 +248,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + + static final Logger LOGGER = LogUtils.getLogger(); + private static final int LATENCY_CHECK_INTERVAL = 15000; +- public static final double MAX_INTERACTION_DISTANCE = Mth.square(6.0D); ++ public static final double DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED = Mth.square(6.0D); // Gale - make max interaction distance configurable + private static final int NO_BLOCK_UPDATES_TO_ACK = -1; + private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; + private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed"); +@@ -346,6 +345,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + // CraftBukkit end + ++ // Gale start - make max interaction distance configurable ++ public static double getMaxInteractionDistanceSquared(Level level) { ++ var config = level.galeConfig().gameplayMechanics; ++ return config.playerMaxInteractionDistance < 0 ? ServerGamePacketListenerImpl.DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED : config.playerMaxInteractionDistanceSquared; ++ } ++ // Gale end - make max interaction distance configurable ++ + @Override + public void tick() { + if (this.ackBlockChangesUpTo > -1) { +@@ -1962,7 +1968,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + BlockPos blockposition = movingobjectpositionblock.getBlockPos(); + Vec3 vec3d1 = Vec3.atCenterOf(blockposition); + +- if (this.player.getEyePosition().distanceToSqr(vec3d1) <= ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { ++ if (this.player.getEyePosition().distanceToSqr(vec3d1) <= ServerGamePacketListenerImpl.getMaxInteractionDistanceSquared(this.player.level)) { // Gale - make max interaction distance configurable + Vec3 vec3d2 = vec3d.subtract(vec3d1); + double d0 = 1.0000001D; + +@@ -2777,7 +2783,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + return; + } + +- if (entity.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { ++ if (entity.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.getMaxInteractionDistanceSquared(this.player.level)) { // Gale - make max interaction distance configurable + packet.dispatch(new ServerboundInteractPacket.Handler() { + private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit + ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); +diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +index ffc39061f2363b979590888e736dd7a53a0d256a..53bc702695674ea969a3a0b7c7946e1d9b4a4f82 100644 +--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java ++++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +@@ -261,12 +261,26 @@ public class GaleWorldConfiguration extends ConfigurationPart { + } + + public GameplayMechanics gameplayMechanics; +- public class GameplayMechanics extends ConfigurationPart { ++ public class GameplayMechanics extends ConfigurationPart.Post { + + public boolean entitiesCanEatBlocksInNonTickingChunks = false; // Gale - Purpur - prevent entities eating blocks in non-ticking chunks + public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable + public boolean hideFlamesOnEntitiesWithFireResistance = false; // Gale - Slice - hide flames on entities with fire resistance + ++ // Gale start - make max interaction distance configurable ++ /** ++ * The maximum distance for blocks with which a player can interact with left- or right-clicking. ++ * Any value < 0 uses the default max distance, which is currently 6.0. ++ *
    ++ *
  • Default: -1.0
  • ++ *
  • Vanilla: -1.0
  • ++ *
++ */ ++ public double playerMaxInteractionDistance = -1.0; ++ ++ public transient double playerMaxInteractionDistanceSquared; ++ // Gale end - make max interaction distance configurable ++ + public Fixes fixes; + public class Fixes extends ConfigurationPart { + +@@ -301,6 +315,11 @@ public class GaleWorldConfiguration extends ConfigurationPart { + + } + ++ @Override ++ public void postProcess() { ++ this.playerMaxInteractionDistanceSquared = this.playerMaxInteractionDistance * this.playerMaxInteractionDistance; // Gale - make max interaction distance configurable ++ } ++ + } + + } diff --git a/patches/server/0112-Prevent-entities-random-strolling-into-non-ticking-c.patch b/patches/server/0113-Prevent-entities-random-strolling-into-non-ticking-c.patch similarity index 94% rename from patches/server/0112-Prevent-entities-random-strolling-into-non-ticking-c.patch rename to patches/server/0113-Prevent-entities-random-strolling-into-non-ticking-c.patch index ebb755b..4a9ca12 100644 --- a/patches/server/0112-Prevent-entities-random-strolling-into-non-ticking-c.patch +++ b/patches/server/0113-Prevent-entities-random-strolling-into-non-ticking-c.patch @@ -36,11 +36,11 @@ index 216929c838446c3c14d9b9906ffa625ef35fcbc8..29c7f53a4fa88a77c4076a6294e689e4 } else { this.wantedX = vec3.x; diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -index c5598c0ba356dfc9e1ca66be8dbe7aaffaff316c..4dd431440caf1ce8cd77e11664a9de51eaaf8322 100644 +index 53bc702695674ea969a3a0b7c7946e1d9b4a4f82..885afe06ed3cc323325a63b82b587abb3883195a 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java @@ -264,6 +264,7 @@ public class GaleWorldConfiguration extends ConfigurationPart { - public class GameplayMechanics extends ConfigurationPart { + public class GameplayMechanics extends ConfigurationPart.Post { public boolean entitiesCanEatBlocksInNonTickingChunks = false; // Gale - Purpur - prevent entities eating blocks in non-ticking chunks + public boolean entitiesCanRandomStrollIntoNonTickingChunks = true; // Gale - MultiPaper - prevent entities random strolling into non-ticking chunks diff --git a/patches/server/0113-CraftBukkit-UUID-to-world-map.patch b/patches/server/0114-CraftBukkit-UUID-to-world-map.patch similarity index 100% rename from patches/server/0113-CraftBukkit-UUID-to-world-map.patch rename to patches/server/0114-CraftBukkit-UUID-to-world-map.patch diff --git a/patches/server/0114-Don-t-double-save-stored-user-lists.patch b/patches/server/0115-Don-t-double-save-stored-user-lists.patch similarity index 100% rename from patches/server/0114-Don-t-double-save-stored-user-lists.patch rename to patches/server/0115-Don-t-double-save-stored-user-lists.patch diff --git a/patches/server/0115-Specific-interval-TPS-API.patch b/patches/server/0116-Specific-interval-TPS-API.patch similarity index 100% rename from patches/server/0115-Specific-interval-TPS-API.patch rename to patches/server/0116-Specific-interval-TPS-API.patch diff --git a/patches/server/0116-5-second-TPS-average.patch b/patches/server/0117-5-second-TPS-average.patch similarity index 100% rename from patches/server/0116-5-second-TPS-average.patch rename to patches/server/0117-5-second-TPS-average.patch diff --git a/patches/server/0117-Measure-last-tick-time.patch b/patches/server/0118-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0117-Measure-last-tick-time.patch rename to patches/server/0118-Measure-last-tick-time.patch diff --git a/patches/server/0118-Last-tick-time-API.patch b/patches/server/0119-Last-tick-time-API.patch similarity index 100% rename from patches/server/0118-Last-tick-time-API.patch rename to patches/server/0119-Last-tick-time-API.patch diff --git a/patches/server/0119-Show-last-tick-time-in-tps-command.patch b/patches/server/0120-Show-last-tick-time-in-tps-command.patch similarity index 100% rename from patches/server/0119-Show-last-tick-time-in-tps-command.patch rename to patches/server/0120-Show-last-tick-time-in-tps-command.patch diff --git a/patches/server/0120-Increase-time-statistics-in-intervals.patch b/patches/server/0121-Increase-time-statistics-in-intervals.patch similarity index 100% rename from patches/server/0120-Increase-time-statistics-in-intervals.patch rename to patches/server/0121-Increase-time-statistics-in-intervals.patch diff --git a/patches/server/0121-For-collision-check-has-physics-before-same-vehicle.patch b/patches/server/0122-For-collision-check-has-physics-before-same-vehicle.patch similarity index 100% rename from patches/server/0121-For-collision-check-has-physics-before-same-vehicle.patch rename to patches/server/0122-For-collision-check-has-physics-before-same-vehicle.patch diff --git a/patches/server/0122-Skip-negligible-planar-movement-multiplication.patch b/patches/server/0123-Skip-negligible-planar-movement-multiplication.patch similarity index 100% rename from patches/server/0122-Skip-negligible-planar-movement-multiplication.patch rename to patches/server/0123-Skip-negligible-planar-movement-multiplication.patch diff --git a/patches/server/0123-Reduce-RandomSource-instances.patch b/patches/server/0124-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0123-Reduce-RandomSource-instances.patch rename to patches/server/0124-Reduce-RandomSource-instances.patch diff --git a/patches/server/0124-Server-thread-priority-environment-variable.patch b/patches/server/0125-Server-thread-priority-environment-variable.patch similarity index 100% rename from patches/server/0124-Server-thread-priority-environment-variable.patch rename to patches/server/0125-Server-thread-priority-environment-variable.patch diff --git a/patches/server/0125-Thread-safety-annotations.patch b/patches/server/0126-Thread-safety-annotations.patch similarity index 100% rename from patches/server/0125-Thread-safety-annotations.patch rename to patches/server/0126-Thread-safety-annotations.patch diff --git a/patches/server/0126-CPU-cores-estimation.patch b/patches/server/0127-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0126-CPU-cores-estimation.patch rename to patches/server/0127-CPU-cores-estimation.patch diff --git a/patches/server/0127-Mutex-utility.patch b/patches/server/0128-Mutex-utility.patch similarity index 100% rename from patches/server/0127-Mutex-utility.patch rename to patches/server/0128-Mutex-utility.patch diff --git a/patches/server/0128-Paired-lock-and-condition-utility.patch b/patches/server/0129-Paired-lock-and-condition-utility.patch similarity index 100% rename from patches/server/0128-Paired-lock-and-condition-utility.patch rename to patches/server/0129-Paired-lock-and-condition-utility.patch diff --git a/patches/server/0129-Unterminable-executor-utility.patch b/patches/server/0130-Unterminable-executor-utility.patch similarity index 100% rename from patches/server/0129-Unterminable-executor-utility.patch rename to patches/server/0130-Unterminable-executor-utility.patch diff --git a/patches/server/0130-FIFO-concurrent-queue-utility.patch b/patches/server/0131-FIFO-concurrent-queue-utility.patch similarity index 100% rename from patches/server/0130-FIFO-concurrent-queue-utility.patch rename to patches/server/0131-FIFO-concurrent-queue-utility.patch diff --git a/patches/server/0131-Base-thread-pools.patch b/patches/server/0132-Base-thread-pools.patch similarity index 99% rename from patches/server/0131-Base-thread-pools.patch rename to patches/server/0132-Base-thread-pools.patch index d52928b..292f9a8 100644 --- a/patches/server/0131-Base-thread-pools.patch +++ b/patches/server/0132-Base-thread-pools.patch @@ -1384,19 +1384,19 @@ index 37e0b6212fec71ec9662e6be3b1e8bea487eb4a6..251f098fa2203d06e5e5aa68a31a7653 for (Object o : worldData.cache.values() ) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6ea4e006a 100644 +index 9e45e69b16f483d1b94b21f4510d056eb0ceb8b1..4e7042630c5f11bc62b40d3c8c979d357f086bcd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -186,6 +186,8 @@ import net.minecraft.world.phys.shapes.Shapes; +@@ -185,6 +185,8 @@ import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; - import org.apache.commons.lang3.StringUtils; import org.galemc.gale.configuration.GaleGlobalConfiguration; +import org.galemc.gale.executor.queue.BaseTaskQueues; +import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues; import org.slf4j.Logger; // CraftBukkit start -@@ -544,7 +546,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -550,7 +552,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic Objects.requireNonNull(this.connection); // CraftBukkit - Don't wait @@ -1405,7 +1405,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 } private CompletableFuture filterTextPacket(T text, BiFunction> filterer) { -@@ -875,21 +877,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -881,21 +883,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper start @@ -1430,7 +1430,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 return; } // Paper end -@@ -914,7 +915,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -920,7 +921,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!event.isHandled()) { if (!event.isCancelled()) { @@ -1439,7 +1439,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -@@ -925,7 +926,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -931,7 +932,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); // Paper end - Brigadier API }); @@ -1448,7 +1448,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 } } else if (!completions.isEmpty()) { final com.mojang.brigadier.suggestion.SuggestionsBuilder builder0 = new com.mojang.brigadier.suggestion.SuggestionsBuilder(command, stringreader.getTotalLength()); -@@ -1234,7 +1235,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1240,7 +1241,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -1457,7 +1457,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 return; } byteTotal += byteLength; -@@ -1257,14 +1258,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1263,14 +1264,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -1474,7 +1474,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -2068,10 +2069,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2074,10 +2075,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleTeleportToEntityPacket(ServerboundTeleportToEntityPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.isSpectator()) { @@ -1486,7 +1486,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 Entity entity = packet.getEntity(worldserver); if (entity != null) { -@@ -2220,9 +2218,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2226,9 +2224,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // CraftBukkit end if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { @@ -1498,7 +1498,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 } else { Optional optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages()); -@@ -2256,9 +2254,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2262,9 +2260,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleChatCommand(ServerboundChatCommandPacket packet) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { @@ -1510,7 +1510,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 } else { Optional optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages()); -@@ -2338,9 +2336,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2344,9 +2342,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private Optional tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { if (!this.updateChatOrder(timestamp)) { ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper @@ -1523,7 +1523,7 @@ index c7f996e8ef77671de4134db37e96022343f223a1..37c36f94f5dcc8470b1f1d3776d393e6 return Optional.empty(); } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); -@@ -3270,7 +3268,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3276,7 +3274,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { diff --git a/patches/server/0132-Non-blocking-PooledObjects.patch b/patches/server/0133-Non-blocking-PooledObjects.patch similarity index 100% rename from patches/server/0132-Non-blocking-PooledObjects.patch rename to patches/server/0133-Non-blocking-PooledObjects.patch