Got it to work, for anyone that has this same question, here's the code:
- In the EntityMenu
this.blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> {
this.addSlot(new SlotItemHandler(iItemHandler, 0, 12, 15) {
@Override
public int getMaxStackSize() {
return 1;
}
@Override
public int getMaxStackSize(@NotNull ItemStack stack) {
return 1;
}
@Override
public void set(@NotNull ItemStack stack) {
ItemStack copiedItemStack = stack.copyWithCount(1);
super.set(copiedItemStack);
return;
}
});
this.addSlot(new SlotItemHandler(iItemHandler, 1, 86, 15));
this.addSlot(new SlotItemHandler(iItemHandler, 2, 86, 60));
});
Adding an anonymous class to the slot you want to have this, and in the class you override the three methods.
Now if you want other number of items, replace the 1's in the methods with the number you want.
PS. The return line at the end of set() is not needed.