geforkt von Mirrors/Paper
Add option to fix items merging through walls
Dieser Commit ist enthalten in:
Ursprung
c4f8064fb9
Commit
c9533ae126
@ -163,7 +163,22 @@
|
|||||||
return entityitem != this && entityitem.isMergable();
|
return entityitem != this && entityitem.isMergable();
|
||||||
});
|
});
|
||||||
Iterator iterator = list.iterator();
|
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() {
|
private boolean isMergable() {
|
||||||
ItemStack itemstack = this.getItem();
|
ItemStack itemstack = this.getItem();
|
||||||
|
|
||||||
@ -172,7 +187,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryToMerge(ItemEntity other) {
|
private void tryToMerge(ItemEntity other) {
|
||||||
@@ -259,7 +306,7 @@
|
@@ -259,7 +314,7 @@
|
||||||
ItemStack itemstack1 = other.getItem();
|
ItemStack itemstack1 = other.getItem();
|
||||||
|
|
||||||
if (Objects.equals(this.target, other.target) && ItemEntity.areMergable(itemstack, itemstack1)) {
|
if (Objects.equals(this.target, other.target) && ItemEntity.areMergable(itemstack, itemstack1)) {
|
||||||
@ -181,7 +196,7 @@
|
|||||||
ItemEntity.merge(this, itemstack, other, itemstack1);
|
ItemEntity.merge(this, itemstack, other, itemstack1);
|
||||||
} else {
|
} else {
|
||||||
ItemEntity.merge(other, itemstack1, this, itemstack);
|
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) {
|
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)) {
|
} else if (!this.getItem().canBeHurtBy(source)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -218,7 +233,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -382,22 +439,86 @@
|
@@ -382,22 +447,86 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getItem().isEmpty()) {
|
if (this.getItem().isEmpty()) {
|
||||||
@ -308,7 +323,7 @@
|
|||||||
itemstack.setCount(i);
|
itemstack.setCount(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,6 +559,7 @@
|
@@ -438,6 +567,7 @@
|
||||||
|
|
||||||
public void setItem(ItemStack stack) {
|
public void setItem(ItemStack stack) {
|
||||||
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
||||||
@ -316,7 +331,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -492,7 +614,7 @@
|
@@ -492,7 +622,7 @@
|
||||||
|
|
||||||
public void makeFakeItem() {
|
public void makeFakeItem() {
|
||||||
this.setNeverPickUp();
|
this.setNeverPickUp();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren