Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.irisya.irisyamod.container;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.entity.player.PlayerInventory;
- import net.minecraft.inventory.container.Container;
- import net.minecraft.inventory.container.Slot;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.IIntArray;
- import net.minecraft.util.IntArray;
- import net.minecraftforge.items.CapabilityItemHandler;
- import net.minecraftforge.items.IItemHandler;
- import net.minecraftforge.items.SlotItemHandler;
- public class FoundryContainer extends Container {
- private final IIntArray data;
- public FoundryContainer(int windowId, PlayerInventory playerInventory, TileEntity tileEntity) {
- super(ModContainers.FOUNDRY_CONTAINER.get(), windowId);
- this.data = new IntArray(4);
- IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(NullPointerException::new);
- this.addSlot(new SlotItemHandler(itemHandler, 0, 56, 17));
- this.addSlot(new SlotItemHandler(itemHandler, 1, 56, 53));
- this.addSlot(new SlotItemHandler(itemHandler, 2, 116, 35));
- this.addSlot(new SlotItemHandler(itemHandler, 3, 76, 35));
- // Emplacements pour l'inventaire
- for (int row = 0; row < 3; ++row) {
- for (int col = 0; col < 9; ++col) {
- this.addSlot(new Slot(playerInventory, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
- }
- }
- for (int col = 0; col < 9; ++col) {
- this.addSlot(new Slot(playerInventory, col, 8 + col * 18, 142));
- }
- this.addDataSlots(this.data);
- }
- @Override
- public boolean stillValid(PlayerEntity player) {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement