[1.12.2] Texture



  • Hello !

    Je débute dans le modding en 1.12.2.
    J'ai créer mon item, tout va bien sauf pour la texture, elle ne charge pas.
    Voici les différents code :

    Ma classe ItemSoufre

    package fr.avaloon.asphaltcorp.items;
    
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    
    public class ItemSoufre extends Item {
    	
        public static final String NAME = "SOUFRE";
        public ItemSoufre()
        {
            super();
     
            AsphatlcorpItems.setItemName(this, NAME);
            setCreativeTab(CreativeTabs.MISC);
            setMaxStackSize(64);
    
        }
    }
    

    Mon SOUFRE.json

    {
        "parent": "item/generated",
        "textures": {
            "layer0": "asphaltcorp:items/SOUFRE"
        }
    }
    

    Et voici la hiérarchie de mes dossiers ressources.
    Capture.PNG

    Si une âme charitable passe dans le coin pour m'aider !
    Merci et bon week-end 🙂


  • Administrateurs

    C'est normal.
    Déjà, il ne doit pas y avoir de majuscule dans les noms de ressources, ensuite, je ne vois pas où tu enregistres tes modèles.
    En 1.12.2, il faut passer par l'event ModelRegistryEvent pour enregistrer les modèles.



  • @Superloup10 a dit dans [1.12.2] Texture :

    ModelRegistryEvent

    J'ai remis tout en minuscule,

    Je l'ai mis dans la classe item comme dans le tuto (https://www.minecraftforgefrance.fr/topic/4095/créer-un-item-simple).

    package fr.avaloon.asphaltcorp.items;
    import fr.avaloon.asphaltcorp.AsphaltCorp;
    import net.minecraft.client.renderer.block.model.ModelResourceLocation;
    import net.minecraft.item.Item;
    import net.minecraftforge.client.event.ModelRegistryEvent;
    import net.minecraftforge.client.model.ModelLoader;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class AsphatlcorpItems {
    	 
    	public static final Item soufre = new ItemSoufre();
    
        public static void setItemName(Item item, String name)
        {
        	
            item.setRegistryName(AsphaltCorp.MODID, name).setUnlocalizedName(AsphaltCorp.MODID + "." + name);
    
        	
        }
     
        @SideOnly(Side.CLIENT)
    @SubscribeEvent
        public static void registerItemModels(ModelRegistryEvent event)
        {
        	
        	registerModel(soufre, 0);
    
        }
     
        @SideOnly(Side.CLIENT)
        public static void registerModel(Item item, int metadata)
        {
            if (metadata < 0) metadata = 0;
            String resourceName = item.getUnlocalizedName().substring(5).replace('.', ':');
            if (metadata > 0) resourceName += "_m" + String.valueOf(metadata);
         
            ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(resourceName, "inventory"));
        }
    }
    

  • Administrateurs

    Voilà le code corrigé :

        @SideOnly(Side.CLIENT)
        public static void registerModel(Item item, int metadata)
        {
            ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(item.getRegistryName(), "inventory"));
        }
    

    Avec ce code, ça devrait beaucoup mieux fonctionner.



  • Non toujours un item sans texture


  • Administrateurs

    Salut,
    Peux-tu envoyer les logs ?



  • J'ai regarder mais je ne trouve aucune ligne relatif à l'item,
    Ligne 63 et 64 le mod fonctionne pour mes printout,

    [14:12:37] [main/INFO] [GradleStart]: Extra: []
    [14:12:37] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/FOM/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
    [14:12:37] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
    [14:12:37] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
    [14:12:37] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
    [14:12:37] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
    [14:12:37] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading
    [14:12:37] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_202, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_202
    [14:12:37] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
    [14:12:37] [main/ERROR] [FML]: Full: C:\Users\FOM\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
    [14:12:37] [main/ERROR] [FML]: Trimmed: c:/users/fom/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
    [14:12:37] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
    [14:12:37] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
    2019-01-19 14:12:38,688 main WARN Disabling terminal, you're running in an unsupported environment.
    [14:12:38] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
    [14:12:38] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
    [14:12:38] [main/INFO] [FML]: Searching C:\Users\FOM\HUBIC\Minecraft\forge\run\.\mods for mods
    [14:12:38] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
    [14:12:38] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
    [14:12:38] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
    [14:12:38] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
    [14:12:38] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
    [14:12:38] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
    [14:12:38] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
    [14:12:38] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
    [14:12:38] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
    [14:12:41] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
    [14:12:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
    [14:12:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
    [14:12:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
    [14:12:41] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
    [14:12:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
    [14:12:41] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
    [14:12:42] [main/INFO] [minecraft/Minecraft]: Setting user: Player460
    [14:12:45] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
    [14:12:45] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
    [14:12:46] [main/INFO] [FML]: -- System Details --
    Details:
    	Minecraft Version: 1.12.2
    	Operating System: Windows 10 (amd64) version 10.0
    	Java Version: 1.8.0_202, Oracle Corporation
    	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    	Memory: 863353448 bytes (823 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    	FML: 
    	Loaded coremods (and transformers): 
    	GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 23.20.16.4849' Renderer: 'Intel(R) HD Graphics 630'
    [14:12:46] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized
    [14:12:46] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
    [14:12:47] [main/INFO] [FML]: Replaced 1036 ore ingredients
    [14:12:47] [main/INFO] [FML]: Searching C:\Users\FOM\HUBIC\Minecraft\forge\run\.\mods for mods
    [14:12:49] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
    [14:12:49] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, asphaltcorp] at CLIENT
    [14:12:49] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, asphaltcorp] at SERVER
    [14:12:49] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 215659635 nanos
    [14:12:50] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Asphalt Corp
    [14:12:50] [main/INFO] [FML]: Processing ObjectHolder annotations
    [14:12:50] [main/INFO] [FML]: Found 1168 ObjectHolder annotations
    [14:12:50] [main/INFO] [FML]: Identifying ItemStackHolder annotations
    [14:12:50] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
    [14:12:50] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
    [14:12:50] [main/INFO] [STDOUT]: [fr.avaloon.asphaltcorp.AsphaltCommon:preInit:9]: pre init côté serveur
    [14:12:50] [main/INFO] [STDOUT]: [fr.avaloon.asphaltcorp.AsphaltClient:preInit:10]: pre init côté client
    [14:12:50] [main/INFO] [FML]: Applying holder lookups
    [14:12:50] [main/INFO] [FML]: Holder lookups applied
    [14:12:50] [main/INFO] [FML]: Applying holder lookups
    [14:12:50] [main/INFO] [FML]: Holder lookups applied
    [14:12:50] [main/INFO] [FML]: Applying holder lookups
    [14:12:50] [main/INFO] [FML]: Holder lookups applied
    [14:12:50] [main/INFO] [FML]: Applying holder lookups
    [14:12:50] [main/INFO] [FML]: Holder lookups applied
    [14:12:50] [main/INFO] [FML]: Injecting itemstacks
    [14:12:50] [main/INFO] [FML]: Itemstack injection complete
    [14:12:50] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
    [14:12:51] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
    [14:12:55] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem...
    [14:12:55] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL
    [14:12:55] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
    [14:12:55] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized.
    [14:12:55] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started
    [14:13:02] [main/INFO] [FML]: Max texture size: 16384
    [14:13:02] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas
    [14:13:04] [main/INFO] [FML]: Applying holder lookups
    [14:13:04] [main/INFO] [FML]: Holder lookups applied
    [14:13:04] [main/INFO] [FML]: Injecting itemstacks
    [14:13:04] [main/INFO] [FML]: Itemstack injection complete
    [14:13:05] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
    [14:13:05] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
    [14:13:05] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
    [14:13:06] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
    

    Code de ma base

    package fr.avaloon.asphaltcorp;
    
    import org.apache.logging.log4j.Logger;
    
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.fml.common.Mod;
    import net.minecraftforge.fml.common.SidedProxy;
    import net.minecraftforge.fml.common.Mod.EventHandler;
    import net.minecraftforge.fml.common.Mod.Instance;
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
    @Mod(modid = AsphaltCorp.MODID, name ="asphaltcorp", version ="0.1", acceptedMinecraftVersions = "[1.12.2]")
    
    
    public class AsphaltCorp {
    	
        public static final String MODID = "asphaltcorp";
        @Instance(AsphaltCorp.MODID)
        public static AsphaltCorp instance;
        
        @SidedProxy(clientSide = "fr.avaloon.asphaltcorp.AsphaltClient", serverSide = "fr.avaloon.asphaltcorp.AsphaltServer")
        public static AsphaltCommon proxy;
        
        public static Logger logger;
        
        @EventHandler
        public void onServerStart(FMLServerStartingEvent event)
        {
     
        }  
        
        public AsphaltCorp() {
            MinecraftForge.EVENT_BUS.register(new RegisteringHandler());
        }
        @EventHandler
        public void preInit(FMLPreInitializationEvent event)
        {
            logger = event.getModLog();
            proxy.preInit(event.getSuggestedConfigurationFile());
        }
     
        @EventHandler
        public void init(FMLInitializationEvent event)
        {
            proxy.init();
        }
    
    }
    
    

  • Administrateurs

    Ta classe AsphatlcorpItems n'est pas enregistré comme étant une classe d'event, du-coup l'event ModelRegistryEvent n'est jamais appelé.



  • Yes c'est bon ca marche 🙂
    Merci !


Log in to reply