Give a modded item in inventory


I search how we can give easily a modded item in player’s inventory. I use flan’s mod and i want to give some weapons to player.
I found that for give vanilla items players.getInventory().offer(ItemStack.of(Sponge.getGame().getRegistry().getType(ItemType.class, "stone").get(), 1));



For modded items its the same. Only you need to have the modded items id instead of stone


Like players.getInventory().offer(ItemStack.of(Sponge.getGame().getRegistry().getType(ItemType.class, "flansmod:m16a4").get(), 1)); ?
I tested, it does’nt work


What happens instead? An error? Please post the whole server log to a pastebin-like website.


Sorry, I just looked at the toolbar, not in the entire inventory. That’s work thank you! How place this item in a specified position please ?


Or with SlotPos (untested code):

GridInventory gridInv = ((MainPlayerInventory) inventory.query(MainPlayerInventory.class)).getGrid()
gridInv.query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotPos.of(x, y))).first().set(itemStack);