Update InventoryView when container layout changed
This commit is contained in:
parent
41a70332a4
commit
2d6b0d6db2
@ -65,14 +65,23 @@ public abstract class ContainerMixin implements ContainerBridge {
|
|||||||
|
|
||||||
public boolean checkReachable = true;
|
public boolean checkReachable = true;
|
||||||
private InventoryView bukkitView;
|
private InventoryView bukkitView;
|
||||||
|
private long bukkitViewHash = 0;
|
||||||
|
|
||||||
public InventoryView getBukkitView() {
|
public InventoryView getBukkitView() {
|
||||||
|
if (bukkitViewHash != bukkitViewHash()) {
|
||||||
|
bukkitView = null;
|
||||||
|
}
|
||||||
if (bukkitView == null) {
|
if (bukkitView == null) {
|
||||||
bukkitView = ArclightContainer.createInvView((Container) (Object) this);
|
bukkitView = ArclightContainer.createInvView((Container) (Object) this);
|
||||||
|
bukkitViewHash = bukkitViewHash();
|
||||||
}
|
}
|
||||||
return bukkitView;
|
return bukkitView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long bukkitViewHash() {
|
||||||
|
return (((long) this.inventorySlots.size()) << 32) | System.identityHashCode(this.inventorySlots);
|
||||||
|
}
|
||||||
|
|
||||||
public void transferTo(Container other, CraftHumanEntity player) {
|
public void transferTo(Container other, CraftHumanEntity player) {
|
||||||
InventoryView source = this.getBukkitView();
|
InventoryView source = this.getBukkitView();
|
||||||
InventoryView destination = ((ContainerBridge) other).bridge$getBukkitView();
|
InventoryView destination = ((ContainerBridge) other).bridge$getBukkitView();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user