mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
39 lines
2.4 KiB
Diff
39 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: GioSDA <gsdambrosio@gmail.com>
|
|
Date: Wed, 10 Mar 2021 10:06:45 -0800
|
|
Subject: [PATCH] Add option to fix items merging through walls
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 467f4bd13c58f6724cdda580b95a0d58f516ec12..25db335f457eefd13798394ebfb6b6684be26610 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -822,4 +822,9 @@ public class PaperWorldConfig {
|
|
private void mapItemFrameCursorLimit() {
|
|
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
|
|
}
|
|
+
|
|
+ public boolean fixItemsMergingThroughWalls;
|
|
+ private void fixItemsMergingThroughWalls() {
|
|
+ fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
|
index 575833807ff647f30d7c2b7abcd01701c7dec85b..8b79220c27292f9b92d9884bbbe4b16d7762343c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
|
@@ -228,6 +228,14 @@ public class EntityItem extends Entity {
|
|
EntityItem entityitem = (EntityItem) iterator.next();
|
|
|
|
if (entityitem.z()) {
|
|
+ // Paper Start - Fix items merging through walls
|
|
+ if (this.world.paperConfig.fixItemsMergingThroughWalls) {
|
|
+ net.minecraft.world.level.RayTrace rayTrace = new net.minecraft.world.level.RayTrace(this.getPositionVector(), entityitem.getPositionVector(),
|
|
+ net.minecraft.world.level.RayTrace.BlockCollisionOption.COLLIDER, net.minecraft.world.level.RayTrace.FluidCollisionOption.NONE, this);
|
|
+ net.minecraft.world.phys.MovingObjectPositionBlock rayTraceResult = world.rayTrace(rayTrace);
|
|
+ if (rayTraceResult.getType() == net.minecraft.world.phys.MovingObjectPosition.EnumMovingObjectType.BLOCK) continue;
|
|
+ }
|
|
+ // Paper End
|
|
this.a(entityitem);
|
|
if (this.dead) {
|
|
break;
|