Skip to content
Permalink
Browse files

Fix double chests only triggering block updates on half

  • Loading branch information...
BillyGalbreath authored and me4502 committed May 29, 2019
1 parent 8c25911 commit 9f413c8a9a0aef8f7455d14bc556dd6e32d430fd
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/main/java/com/sk89q/craftbook/util/InventoryUtil.java
@@ -2,10 +2,13 @@

import org.bukkit.block.Block;
import org.bukkit.block.BrewingStand;
import org.bukkit.block.Chest;
import org.bukkit.block.DoubleChest;
import org.bukkit.block.Furnace;
import org.bukkit.block.ShulkerBox;
import org.bukkit.entity.Player;
import org.bukkit.inventory.BrewerInventory;
import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
@@ -54,6 +57,10 @@
stacks = Arrays.stream(stacks).filter(item -> !ItemUtil.isShulkerBox(item.getType())).toArray(ItemStack[]::new);
}
leftovers.addAll(container.getInventory().addItem(stacks).values());
if (container.getInventory() instanceof DoubleChestInventory) {
((Chest) ((DoubleChestInventory) container.getInventory()).getLeftSide().getHolder()).update(true);
((Chest) ((DoubleChestInventory) container.getInventory()).getRightSide().getHolder()).update(true);
}
//if(container instanceof BlockState && update)
// ((BlockState) container).update();
return leftovers;
@@ -301,4 +308,4 @@ public static void setItemInHand(Player player, EquipmentSlot slot, ItemStack it
player.getInventory().setItemInOffHand(itemStack);
}
}
}
}

0 comments on commit 9f413c8

Please sign in to comment.
You can’t perform that action at this time.