From c9cd94f3c6e5dba0693230ff9142a8a086260be0 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:46:02 +0800 Subject: [PATCH] Fix fixItemsMergingThroughWalls check (#9707) --- ...d-option-to-fix-items-merging-through-walls.patch | 12 +++++++----- ...event-empty-items-from-being-added-to-world.patch | 4 ++-- patches/server/0901-Friction-API.patch | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/patches/server/0619-Add-option-to-fix-items-merging-through-walls.patch b/patches/server/0619-Add-option-to-fix-items-merging-through-walls.patch index a0c0b55990..ce33ff909f 100644 --- a/patches/server/0619-Add-option-to-fix-items-merging-through-walls.patch +++ b/patches/server/0619-Add-option-to-fix-items-merging-through-walls.patch @@ -5,17 +5,19 @@ Subject: [PATCH] Add option to fix items merging through walls 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 5d742d072d2cc532ce86bff3de15a5f0f381d1c5..3f479cdca77ad051a8fcf56e99c7811998a92f2a 100644 +index 5d742d072d2cc532ce86bff3de15a5f0f381d1c5..b8db8750125315b15cc3d3e76ee629a60c4546a1 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -258,6 +258,12 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -258,6 +258,14 @@ public class ItemEntity extends Entity implements TraceableEntity { ItemEntity entityitem = (ItemEntity) iterator.next(); if (entityitem.isMergable()) { + // Paper start - Fix items merging through walls -+ if (this.level().clipDirect(this.position(), entityitem.position(), -+ net.minecraft.world.phys.shapes.CollisionContext.of(this)) == net.minecraft.world.phys.HitResult.Type.BLOCK) { -+ continue; ++ if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) { ++ if (this.level().clipDirect(this.position(), entityitem.position(), ++ net.minecraft.world.phys.shapes.CollisionContext.of(this)) == net.minecraft.world.phys.HitResult.Type.BLOCK) { ++ continue; ++ } + } + // Paper end - Fix items merging through walls this.tryToMerge(entityitem); diff --git a/patches/server/0837-Prevent-empty-items-from-being-added-to-world.patch b/patches/server/0837-Prevent-empty-items-from-being-added-to-world.patch index 940a013bf3..b55dfc5661 100644 --- a/patches/server/0837-Prevent-empty-items-from-being-added-to-world.patch +++ b/patches/server/0837-Prevent-empty-items-from-being-added-to-world.patch @@ -19,10 +19,10 @@ index 653c9c41ab7c5cd332565436564396d18f26c17c..06df21e55fdb70558b85fc095a04b3bb if (captureDrops != null && entity instanceof net.minecraft.world.entity.item.ItemEntity) { captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity); 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 3f479cdca77ad051a8fcf56e99c7811998a92f2a..3b8c76a89249ea4edcae4b59f1fe828f584fb1c1 100644 +index b8db8750125315b15cc3d3e76ee629a60c4546a1..6b3a17e6717b8c03c5bd674771b29e4becd42c71 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -518,7 +518,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -520,7 +520,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } public void setItem(ItemStack stack) { diff --git a/patches/server/0901-Friction-API.patch b/patches/server/0901-Friction-API.patch index 44b44a55e6..ccd49c453f 100644 --- a/patches/server/0901-Friction-API.patch +++ b/patches/server/0901-Friction-API.patch @@ -54,7 +54,7 @@ index f5eb57cf35a11d135e3bf998d1cb1ce06fc360ce..279d3ff3e1568fdf396faf635854e5f8 if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) { this.getAttributes().load(nbt.getList("Attributes", 10)); 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 f9c2274c060efdd9b6627ced8485b766aca8951c..b3d809c48b041af03471942213070cc3e0b19f2f 100644 +index 22d29a2e58c5615dcee04ba68752fb76489c8a28..d39f31e7cf315c7cdc1daab28164380e44dd8341 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -55,6 +55,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -78,7 +78,7 @@ index f9c2274c060efdd9b6627ced8485b766aca8951c..b3d809c48b041af03471942213070cc3 f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; } -@@ -367,6 +372,11 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -369,6 +374,11 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public void addAdditionalSaveData(CompoundTag nbt) { @@ -90,7 +90,7 @@ index f9c2274c060efdd9b6627ced8485b766aca8951c..b3d809c48b041af03471942213070cc3 nbt.putShort("Health", (short) this.health); nbt.putShort("Age", (short) this.age); nbt.putShort("PickupDelay", (short) this.pickupDelay); -@@ -400,6 +410,17 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -402,6 +412,17 @@ public class ItemEntity extends Entity implements TraceableEntity { this.thrower = nbt.getUUID("Thrower"); }