Inventory getHolder method without block snapshot

This commit is contained in:
Phoenix616 2020-06-10 23:55:15 +01:00
parent 4c32788db0
commit 1b1ab34ecd
2 changed files with 14 additions and 0 deletions

View file

@ -531,6 +531,13 @@ public class CraftInventory implements Inventory {
return this.inventory.getOwner(); return this.inventory.getOwner();
} }
// Paper start - getHolder without snapshot
@Override
public InventoryHolder getHolder(boolean useSnapshot) {
return inventory instanceof net.minecraft.world.level.block.entity.BlockEntity ? ((net.minecraft.world.level.block.entity.BlockEntity) inventory).getOwner(useSnapshot) : getHolder();
}
// Paper end
@Override @Override
public int getMaxStackSize() { public int getMaxStackSize() {
return this.inventory.getMaxStackSize(); return this.inventory.getMaxStackSize();

View file

@ -63,6 +63,13 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC
return new DoubleChest(this); return new DoubleChest(this);
} }
// Paper start - getHolder without snapshot
@Override
public DoubleChest getHolder(boolean useSnapshot) {
return getHolder();
}
// Paper end
@Override @Override
public Location getLocation() { public Location getLocation() {
return this.getLeftSide().getLocation().add(this.getRightSide().getLocation()).multiply(0.5); return this.getLeftSide().getLocation().add(this.getRightSide().getLocation()).multiply(0.5);