Class OtherModItem

java.lang.Object
net.minheur.techno_lib.otherItem.OtherModItem

public class OtherModItem extends Object
Represents an item from another mod for compat recipes.

This class allow to create an Ingredient for recipes even if the target mod isn't loaded in the dev environment. The item can be referenced with his ResourceLocation.

  • Field Details

    • MODID

      private final String MODID
      The item's mod ID (ex. "ae2")
    • ID

      private final String ID
      The item's ID (ex. "calculation_processor")
    • RAW_ITEM

      private final net.minecraft.world.item.Item RAW_ITEM
      The raw item. Warning : id the mod isn't loaded, it'll be null.

      Only for hard dependencies.

  • Constructor Details

    • OtherModItem

      public OtherModItem(String modid, String id)
      Construct an object which represents the other mod item.
      Parameters:
      modid - the item's mod ID (ex. "ae2")
      id - the item's ID (ex. "calculation_processor")
  • Method Details

    • getModId

      public String getModId()
      Returns:
      the item's mod ID
    • getId

      public String getId()
      Returns:
      the item's ID
    • getAsIngredient

      public net.minecraft.world.item.crafting.Ingredient getAsIngredient()
      Returns a Ingredient which represents the item.

      The Ingredient can be used in recipes for compat. This method work even if the mod isn't loaded in the dev environment.

      Returns:
      a recipe-usable Ingredient
    • getAsRawItem

      public net.minecraft.world.item.Item getAsRawItem()
      Only use it if you are sure the mod is loaded. Prefer using getAsIngredient() when the mod is optional.
      Returns:
      the raw item or an exeption if null