mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Configuration for horizontal-only item merging (#11219)
This commit is contained in:
parent
3cb3616012
commit
794e2754b5
2 changed files with 31 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Newwind <support@newwindserver.com>
|
||||||
|
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<ItemEntity> list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(radius, radius - 0.5D, radius), (entityitem) -> {
|
||||||
|
+ List<ItemEntity> 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();
|
||||||
|
});
|
|
@ -1474,6 +1474,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import org.slf4j.Logger;
|
+import org.slf4j.Logger;
|
||||||
+import org.spigotmc.SpigotWorldConfig;
|
+import org.spigotmc.SpigotWorldConfig;
|
||||||
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
+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.PostProcess;
|
||||||
+import org.spongepowered.configurate.objectmapping.meta.Required;
|
+import org.spongepowered.configurate.objectmapping.meta.Required;
|
||||||
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||||
|
@ -1710,6 +1711,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ public boolean disablePlayerCrits = false;
|
+ public boolean disablePlayerCrits = false;
|
||||||
+ public boolean nerfPigmenFromNetherPortals = 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 PillagerPatrols pillagerPatrols;
|
||||||
+
|
+
|
||||||
+ public class PillagerPatrols extends ConfigurationPart {
|
+ public class PillagerPatrols extends ConfigurationPart {
|
||||||
|
|
Loading…
Reference in a new issue