Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BackpackContainer extends BaseContainer {
- public BackpackContainer(int synchronizationID, PlayerInventory linkedPlayerInventory) {
- super(synchronizationID, linkedPlayerInventory);
- // inventories
- BasicInventory basicInventory = new BasicInventory(27);
- getInventories().put(PLAYER_INVENTORY, linkedPlayerInventory);
- getInventories().put(1, basicInventory);
- // WInterface
- WInterface mainInterface = new WInterface(WPosition.of(WType.FREE, 0, 0, 0), this);
- getInterfaces().add(mainInterface);
- // tab
- WTabHolder tabHolderA = new WTabHolder(WPosition.of(WType.ANCHORED, 0, 0, 1, mainInterface), WSize.of(175, 200), mainInterface);
- WTabHolder.WTab tabA = tabHolderA.addTab(Items.DIAMOND, new LiteralText("Inventory"));
- tabHolderA.addTab(Items.DEAD_BUSH, new LiteralText("Settings"));
- // inventory
- for (int y = 0; y < 3; y++) {
- for (int x = 0; x < 9; x++) {
- tabA.add(new WSlot(
- WPosition.of(WType.FREE, 6 + 18 * x, 34 + 18 * y, 1),
- WSize.of(18, 18),
- mainInterface,
- y * 9 + x,
- 1
- ));
- }
- }
- // player inventory
- for (int y = 0; y < 3; y++) {
- for (int x = 0; x < 9; x++) {
- tabA.add(new WSlot(
- WPosition.of(WType.FREE, 6 + 18 * x, 112 + 18 * y, 1),
- WSize.of(18, 18),
- mainInterface,
- 36 - y * 9 + x,
- 0
- ));
- }
- }
- // hotbar
- for (int x = 0; x < 9; x++) {
- tabA.add(new WSlot(
- WPosition.of(WType.FREE, 6 + 18 * x, 172, 1),
- WSize.of(18, 18),
- mainInterface,
- x,
- 0
- ));
- }
- mainInterface.add(tabHolderA);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement