Search in sources :

Example 1 with IStringSerializable

use of net.minecraft.util.IStringSerializable in project ImmersiveEngineering by BluSunrize.

the class MysticalAgricultureHelper method postInit.

@Override
public void postInit() {
    try {
        Class c_Types = Class.forName("com.blakebr0.mysticalagriculture.lib.CropType$Type");
        Method m_isEnabled = c_Types.getMethod("isEnabled");
        if (c_Types != null && m_isEnabled != null)
            for (Object type : c_Types.getEnumConstants()) if ((Boolean) m_isEnabled.invoke(type))
                addType(((IStringSerializable) type).getName());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : IStringSerializable(net.minecraft.util.IStringSerializable) Method(java.lang.reflect.Method)

Example 2 with IStringSerializable

use of net.minecraft.util.IStringSerializable in project Witchworks by Um-Mitternacht.

the class ModelHandler method registerEnums.

/**
	 * Set a new model resource location to an Item for as many enums there are.
	 *
	 * @param item     The Item
	 * @param values   The enum which holds the different Item Types
	 * @param itemName The name of the Item
	 */
public static void registerEnums(Item item, IStringSerializable[] values, String itemName) {
    for (int i = 0; i < values.length; i++) {
        final IStringSerializable e = values[i];
        ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(LibMod.MOD_ID + ":" + itemName + "_" + e.getName(), "inventory"));
    }
}
Also used : IStringSerializable(net.minecraft.util.IStringSerializable) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

IStringSerializable (net.minecraft.util.IStringSerializable)2 Method (java.lang.reflect.Method)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1