How i get mods items


#1

Hi, how do I get mod mekanism items?
I tried mekanism:MachineBlock but all machines use this id, how i get other machines?

My code:

Code
  public static Map<String, String> getMap(){
        Map<String, String> map = new HashMap<>();
        map.put("mekanism:MachineBlock", "10");
        return map;
    }

public static void addItems(Map<String, String> map, Inventory inventory){
    List<ItemStack> itemList = new ArrayList<>();
    for(String key : map.keySet()){
        ItemStack i = ItemStack.of(Sponge.getRegistry().getType(ItemType.class, key).get(), Integer.valueOf(map.get(key)));
        itemList.add(i);
    }
    for(ItemStack item : itemList){
        inventory.offer(item);
    }
}

#2

This could be wrong, because I don’t know much about Mekanism. But I’m pretty sure this will work.

BlockState state = Sponge.getRegistry().getType(BlockState.class, "mekanism:MachineBlock2[type=QuantumEntangloporter]").get();
ItemStack stack = ItemStack.builder().fromBlockState(state).quantity(10).build();



#3

It doesn’t work.


#4

Didn’t work how? What did you expect to happen, what happened instead, where exactly did the two diverge?