geforkt von Mirrors/Paper
SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
Ursprung
46dda8a1e6
Commit
b0576f313f
@ -63,6 +63,15 @@
|
|||||||
this.items.clear();
|
this.items.clear();
|
||||||
ContainerUtil.loadAllItems(nbttagcompound, this.items);
|
ContainerUtil.loadAllItems(nbttagcompound, this.items);
|
||||||
this.lastInteractedSlot = nbttagcompound.getInt("last_interacted_slot");
|
this.lastInteractedSlot = nbttagcompound.getInt("last_interacted_slot");
|
||||||
|
@@ -91,7 +134,7 @@
|
||||||
|
|
||||||
|
this.items.set(i, ItemStack.EMPTY);
|
||||||
|
if (!itemstack.isEmpty()) {
|
||||||
|
- this.updateState(i);
|
||||||
|
+ if (level != null) this.updateState(i); // CraftBukkit - SPIGOT-7381: check for null world
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
@@ -106,7 +149,7 @@
|
@@ -106,7 +149,7 @@
|
||||||
public void setItem(int i, ItemStack itemstack) {
|
public void setItem(int i, ItemStack itemstack) {
|
||||||
if (itemstack.is(TagsItem.BOOKSHELF_BOOKS)) {
|
if (itemstack.is(TagsItem.BOOKSHELF_BOOKS)) {
|
||||||
|
@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.inventory;
|
|||||||
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
|
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
|
||||||
import org.bukkit.block.ChiseledBookshelf;
|
import org.bukkit.block.ChiseledBookshelf;
|
||||||
import org.bukkit.inventory.ChiseledBookshelfInventory;
|
import org.bukkit.inventory.ChiseledBookshelfInventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class CraftInventoryChiseledBookshelf extends CraftInventory implements ChiseledBookshelfInventory {
|
public class CraftInventoryChiseledBookshelf extends CraftInventory implements ChiseledBookshelfInventory {
|
||||||
|
|
||||||
@ -11,6 +12,17 @@ public class CraftInventoryChiseledBookshelf extends CraftInventory implements C
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItem(int index, ItemStack item) {
|
||||||
|
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||||
|
|
||||||
|
if (nms.isEmpty()) {
|
||||||
|
this.getInventory().removeItemNoUpdate(index);
|
||||||
|
} else {
|
||||||
|
this.getInventory().setItem(index, nms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChiseledBookshelf getHolder() {
|
public ChiseledBookshelf getHolder() {
|
||||||
return (ChiseledBookshelf) inventory.getOwner();
|
return (ChiseledBookshelf) inventory.getOwner();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren