Package net.minheur.techno_lib.otherItem
Class OtherModItem
java.lang.Object
net.minheur.techno_lib.otherItem.OtherModItem
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOtherModItem(String modid, String id) Construct an object which represents the other mod item. -
Method Summary
-
Field Details
-
MODID
The item's mod ID (ex. "ae2") -
ID
The item's ID (ex. "calculation_processor") -
RAW_ITEM
private final net.minecraft.world.item.Item RAW_ITEMThe raw item. Warning : id the mod isn't loaded, it'll be null.Only for hard dependencies.
-
-
Constructor Details
-
OtherModItem
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
- Returns:
- the item's mod ID
-
getId
- Returns:
- the item's ID
-
getAsIngredient
public net.minecraft.world.item.crafting.Ingredient getAsIngredient()Returns aIngredientwhich 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 usinggetAsIngredient()when the mod is optional.- Returns:
- the raw item or an exeption if null
-