From 794e2754b52aee825442573f3dbcdf9e820663e5 Mon Sep 17 00:00:00 2001 From: Newwind Date: Sun, 11 Aug 2024 23:16:20 +0100 Subject: [PATCH] Configuration for horizontal-only item merging (#11219) --- ...ion-for-horizontal-only-item-merging.patch | 28 +++++++++++++++++++ patches/server/Paper-config-files.patch | 3 ++ 2 files changed, 31 insertions(+) create mode 100644 patches/server/Configuration-for-horizontal-only-item-merging.patch diff --git a/patches/server/Configuration-for-horizontal-only-item-merging.patch b/patches/server/Configuration-for-horizontal-only-item-merging.patch new file mode 100644 index 0000000000..ecc7fca583 --- /dev/null +++ b/patches/server/Configuration-for-horizontal-only-item-merging.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Newwind +Date: Wed, 7 Aug 2024 13:25:55 +0200 +Subject: [PATCH] Configuration for horizontal-only item merging + +Most of the visual artifacts that result from having item merge radius above vanilla levels is from items merging vertically, +which realistically, only happens when a player is dropping items, or items are dropping from breaking a block. + +Most of the scenarios where item merging makes sense involves the two item entities being on the same Y level. i.e on the ground next to each other. +This is even more apparent since paper fixed items being able to merge through blocks. + +This patch allows us to configure items to only merge horizontally, which is what vanilla does. +This allows us to have both the reduced number of item entities a high item-merge radius provides, +without most of the visual artifacts caused by items merging vertically. + +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -0,0 +0,0 @@ public class ItemEntity extends Entity implements TraceableEntity { + if (this.isMergable()) { + // Spigot start + double radius = this.level().spigotConfig.itemMerge; +- List list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(radius, radius - 0.5D, radius), (entityitem) -> { ++ List list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(radius, this.level().paperConfig().entities.behavior.onlyMergeItemsHorizontally ? 0 : radius - 0.5D, radius), (entityitem) -> { // Paper - configuration to only merge items horizontally + // Spigot end + return entityitem != this && entityitem.isMergable(); + }); diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index b1c9a05e6f..5aa0d8ff70 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -1474,6 +1474,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.slf4j.Logger; +import org.spigotmc.SpigotWorldConfig; +import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.meta.Comment; +import org.spongepowered.configurate.objectmapping.meta.PostProcess; +import org.spongepowered.configurate.objectmapping.meta.Required; +import org.spongepowered.configurate.objectmapping.meta.Setting; @@ -1710,6 +1711,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public boolean disablePlayerCrits = false; + public boolean nerfPigmenFromNetherPortals = false; ++ @Comment("Prevents merging items that are not on the same y level, preventing potential visual artifacts.") ++ public boolean onlyMergeItemsHorizontally = false; + public PillagerPatrols pillagerPatrols; + + public class PillagerPatrols extends ConfigurationPart {