Open double-chest directly

This commit is contained in:
Gabriel Tofvesson 2021-05-04 04:21:07 +02:00
parent 5e8a0ebc54
commit f3a061a942

View File

@ -94,15 +94,10 @@ public class SearchCommandExecutor implements CommandExecutor {
return false; return false;
} }
if (result instanceof DoubleChest) { // Issue with double-chest: lid stays open after inventory is closed
final DoubleChest dChest = (DoubleChest) result; // Solution requires reflection and probably breaks backward compatibility
// TODO: Replace with EntityPlayer.openContainer (?)
//final InventoryView view = player.openInventory(dChest.getInventory()); player.openInventory(result.getInventory());
System.out.println("Opened inventory");
player.openInventory(new SearchInventoryView(dChest, player, ((Chest)dChest.getLeftSide()).getCustomName() == null ? "Large Chest" : Objects.requireNonNull(((Container) result).getCustomName())));
} else {
player.openInventory(result.getInventory());
}
return true; return true;
} }