mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Add option to fix items merging through walls
This commit is contained in:
parent
c4f8064fb9
commit
c9533ae126
@ -163,7 +163,22 @@
|
||||
return entityitem != this && entityitem.isMergable();
|
||||
});
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -251,7 +298,7 @@
|
||||
@@ -238,6 +285,14 @@
|
||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||
|
||||
if (entityitem.isMergable()) {
|
||||
+ // Paper start - Fix items merging through walls
|
||||
+ 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);
|
||||
if (this.isRemoved()) {
|
||||
break;
|
||||
@@ -251,7 +306,7 @@
|
||||
private boolean isMergable() {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
@ -172,7 +187,7 @@
|
||||
}
|
||||
|
||||
private void tryToMerge(ItemEntity other) {
|
||||
@@ -259,7 +306,7 @@
|
||||
@@ -259,7 +314,7 @@
|
||||
ItemStack itemstack1 = other.getItem();
|
||||
|
||||
if (Objects.equals(this.target, other.target) && ItemEntity.areMergable(itemstack, itemstack1)) {
|
||||
@ -181,7 +196,7 @@
|
||||
ItemEntity.merge(this, itemstack, other, itemstack1);
|
||||
} else {
|
||||
ItemEntity.merge(other, itemstack1, this, itemstack);
|
||||
@@ -287,11 +334,16 @@
|
||||
@@ -287,11 +342,16 @@
|
||||
}
|
||||
|
||||
private static void merge(ItemEntity targetEntity, ItemStack targetStack, ItemEntity sourceEntity, ItemStack sourceStack) {
|
||||
@ -199,7 +214,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -320,12 +372,17 @@
|
||||
@@ -320,12 +380,17 @@
|
||||
} else if (!this.getItem().canBeHurtBy(source)) {
|
||||
return false;
|
||||
} else {
|
||||
@ -218,7 +233,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -382,22 +439,86 @@
|
||||
@@ -382,22 +447,86 @@
|
||||
}
|
||||
|
||||
if (this.getItem().isEmpty()) {
|
||||
@ -308,7 +323,7 @@
|
||||
itemstack.setCount(i);
|
||||
}
|
||||
|
||||
@@ -438,6 +559,7 @@
|
||||
@@ -438,6 +567,7 @@
|
||||
|
||||
public void setItem(ItemStack stack) {
|
||||
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
||||
@ -316,7 +331,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -492,7 +614,7 @@
|
||||
@@ -492,7 +622,7 @@
|
||||
|
||||
public void makeFakeItem() {
|
||||
this.setNeverPickUp();
|
||||
|
Loading…
Reference in New Issue
Block a user