Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. public class BackpackContainer extends BaseContainer {
  2.  
  3. public BackpackContainer(int synchronizationID, PlayerInventory linkedPlayerInventory) {
  4. super(synchronizationID, linkedPlayerInventory);
  5.  
  6. // inventories
  7. BasicInventory basicInventory = new BasicInventory(27);
  8. getInventories().put(PLAYER_INVENTORY, linkedPlayerInventory);
  9. getInventories().put(1, basicInventory);
  10.  
  11. // WInterface
  12. WInterface mainInterface = new WInterface(WPosition.of(WType.FREE, 0, 0, 0), this);
  13. getInterfaces().add(mainInterface);
  14.  
  15. // tab
  16. WTabHolder tabHolderA = new WTabHolder(WPosition.of(WType.ANCHORED, 0, 0, 1, mainInterface), WSize.of(175, 200), mainInterface);
  17. WTabHolder.WTab tabA = tabHolderA.addTab(Items.DIAMOND, new LiteralText("Inventory"));
  18. tabHolderA.addTab(Items.DEAD_BUSH, new LiteralText("Settings"));
  19.  
  20. // inventory
  21. for (int y = 0; y < 3; y++) {
  22. for (int x = 0; x < 9; x++) {
  23. tabA.add(new WSlot(
  24. WPosition.of(WType.FREE, 6 + 18 * x, 34 + 18 * y, 1),
  25. WSize.of(18, 18),
  26. mainInterface,
  27. y * 9 + x,
  28. 1
  29. ));
  30. }
  31. }
  32.  
  33. // player inventory
  34. for (int y = 0; y < 3; y++) {
  35. for (int x = 0; x < 9; x++) {
  36. tabA.add(new WSlot(
  37. WPosition.of(WType.FREE, 6 + 18 * x, 112 + 18 * y, 1),
  38. WSize.of(18, 18),
  39. mainInterface,
  40. 36 - y * 9 + x,
  41. 0
  42. ));
  43. }
  44. }
  45.  
  46. // hotbar
  47. for (int x = 0; x < 9; x++) {
  48. tabA.add(new WSlot(
  49. WPosition.of(WType.FREE, 6 + 18 * x, 172, 1),
  50. WSize.of(18, 18),
  51. mainInterface,
  52. x,
  53. 0
  54. ));
  55. }
  56.  
  57. mainInterface.add(tabHolderA);
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement