summaryrefslogtreecommitdiff
path: root/src/main/java/lv/enes/mc/eris_alchemy/menu/AlchemicalChestMenu.java
blob: 35db476ef89c389bcf53a99de67ae5a2031f484b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package lv.enes.mc.eris_alchemy.menu;

import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry;
import net.minecraft.world.Container;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.Slot;

public class AlchemicalChestMenu extends ChestLikeMenu {
	private static final int WIDTH = 13;
	private static final int HEIGHT = 8;

	public AlchemicalChestMenu(int syncId, Inventory playerInventory) {
		this(syncId, playerInventory, new SimpleContainer(WIDTH * HEIGHT));
	}

	public AlchemicalChestMenu(int syncId, Inventory playerInventory, Container container) {
		super(ErisAlchemyRegistry.Menus.ALCHEMICAL_CHEST, syncId, playerInventory, container);
	}

	@Override
	protected void addSlots(Inventory playerInventory) {
		var x_off = 8;
		var y_off = 8;

		for (var y = 0; y < HEIGHT; y++) {
			for (var x = 0; x < WIDTH; x++) {
				addSlot(new Slot(container, y * WIDTH + x, x_off + x * 18, y_off + y * 18));
			}
		}

		addPlayerInventorySlots(playerInventory, 44, 155);
		addPlayerHotbarSlots(playerInventory, 44, 213);
	}

	@Override
	protected int getRequiredSize() {
		return WIDTH * HEIGHT;
	}
}