Jump to content

Recommended Posts

Posted

Here is the code i`m using for the generic class:

 

package tutorial.generic;

 

// This Import list will grow longer with each additional tutorial.

// It's not pruned between full class postings, unlike other tutorial code.

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import net.minecraft.client.renderer.texture.IconRegister;

 

@Mod(modid="generic", name="Generic", version="0.0.0")

@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class Generic

{

        // See Basic items tutorial for Generic Ingot

        public static Item genericIngot;

       

        public static Block genericDirt;

        public static Block genericOre;

       

        @Instance(value="generic")

        public static Generic instance;

       

        @SidedProxy(clientSide="tutorial.generic.client.ClientProxy",

                        serverSide="tutorial.generic.CommonProxy")

        public static CommonProxy proxy;

       

        @EventHandler

        public void preInit(FMLPreInitializationEvent event)

        {

       

        genericIngot = new GenericItem(201).setMaxStackSize(16)

                    .setUnlocalizedName("genericIngot");

genericDirt = new GenericBlock(500, Material.ground)

                .setHardness(0.5F).setStepSound(Block.soundGravelFootstep)

                .setUnlocalizedName("genericDirt").setCreativeTab(CreativeTabs.tabBlock);

genericOre = new GenericOre(501, Material.rock);

        }

       

        @EventHandler

        public void load(FMLInitializationEvent event)

        {

                // See Basic items tutorial for Generic Ingot

                LanguageRegistry.addName(genericIngot, "Generic Ingot");

                LanguageRegistry.addName(genericOre, "Generic Ore");

                MinecraftForge.setBlockHarvestLevel(genericOre, "pickaxe", 3);

                GameRegistry.registerBlock(genericOre, "genericOre");

                // End Basic Blocks

               

                proxy.registerRenderers();

        }

       

        @EventHandler

        public void postInit(FMLPostInitializationEvent event)

        {

                // Stub Method

        }

}

 

 

Here is the code for the ItemClass:

 

package tutorial.generic;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.item.Item;

 

public class GenericItem extends Item {

 

        public GenericItem(int id) {

                super(id); 

                // Constructor Configuration

                maxStackSize = 64;

                setCreativeTab(CreativeTabs.tabMisc);

                setUnlocalizedName("genericItem");

}

}

 

I have the picture which is a .png in the correct folder named Items as is meant to. I Kepp getting these errors, however the bottom two occur as I do not have textures for them yet, but for the first one I do. Can anyone tell me what i`m doing wrong? Here are the errors I`m getting regarding the textures.

 

2013-11-04 13:50:12 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/items/MISSING_ICON_ITEM_457_genericIngot.png

 

2013-11-04 13:50:12 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_500_genericDirt.png

 

2013-11-04 13:50:12 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_501_genericOre.png

Posted

Hi

 

You need to set the texture name for the blocks and the item.

eg

  @Override

  public void registerIcons(IconRegister iconRegister)

  {

    itemIcon = iconRegister.registerIcon("generic:picturename");

  }

 

-TGG

Posted

Hi

 

No worries mate, we've all got to start somewhere and the documentation is a bit patchy to say the least :-)

 

Put it in your GenericItem and GenericBlock as is, you'll need to replace "generic:picturename" with the name of your mod ("generic" in this case I think) and the name of the file you're using for the texture.

 

If you're just starting out, this sample code might be helpful

http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html

and especially

https://github.com/TheGreyGhost/ItemRendering/blob/master/src/TestItemRendering/items/ItemSmileyFace.java

https://github.com/TheGreyGhost/ItemRendering/blob/master/src/TestItemRendering/TestItemRenderingMod.java

 

For now ignore all the bits that aren't ItemSmileyFace, they use more advanced rendering methods that you probably don't need yet...

 

-TGG

 

 

 

Posted

Hi

 

You need to set the texture name for the blocks and the item.

eg

  @Override

  public void registerIcons(IconRegister iconRegister)

  {

    itemIcon = iconRegister.registerIcon("generic:picturename");

  }

 

-TGG

 

You only need this if you use more than one texture per block/item.  If it's one texture you can do setTextureName("generic:picturename");

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Thank you both for your effort to try and help me understand, but for some reason, the textures wont apper. (Also I have not yet added textures for the other two blocks) Here is the entire console log I get after I tried both your changes:

 

Nov 04, 2013 3:37:41 PM net.minecraft.launchwrapper.LogWrapper log

INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

Nov 04, 2013 3:37:41 PM net.minecraft.launchwrapper.LogWrapper log

INFO: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker

Nov 04, 2013 3:37:41 PM net.minecraft.launchwrapper.LogWrapper log

INFO: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker

2013-11-04 15:37:41 [iNFO] [ForgeModLoader] Forge Mod Loader version 6.4.20.916 for Minecraft 1.6.4 loading

2013-11-04 15:37:41 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_25, running on Windows 8:amd64:6.2, installed at C:\Program Files\Java\jre7

2013-11-04 15:37:41 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-11-04 15:37:41 [iNFO] [sTDOUT] Loaded 40 rules from AccessTransformer config file fml_at.cfg

2013-11-04 15:37:41 [iNFO] [sTDOUT] Loaded 109 rules from AccessTransformer config file forge_at.cfg

2013-11-04 15:37:41 [sEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!

2013-11-04 15:37:42 [iNFO] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker

2013-11-04 15:37:42 [iNFO] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

2013-11-04 15:37:42 [iNFO] [ForgeModLoader] Launching wrapped minecraft {net.minecraft.client.main.Main}

2013-11-04 15:37:43 [iNFO] [Minecraft-Client] Setting user: Player93

2013-11-04 15:37:43 [iNFO] [Minecraft-Client] (Session ID is null)

2013-11-04 15:37:44 [iNFO] [Minecraft-Client] LWJGL Version: 2.9.0

2013-11-04 15:37:44 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default

2013-11-04 15:37:45 [iNFO] [sTDOUT]

2013-11-04 15:37:45 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-11-04 15:37:45 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-11-04 15:37:45 [iNFO] [sTDOUT] MinecraftForge v9.11.1.916 Initialized

2013-11-04 15:37:45 [iNFO] [ForgeModLoader] MinecraftForge v9.11.1.916 Initialized

2013-11-04 15:37:45 [iNFO] [sTDOUT] Replaced 101 ore recipies

2013-11-04 15:37:45 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-11-04 15:37:45 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-11-04 15:37:45 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-11-04 15:37:45 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Karl\Documents\MinecraftFolders\PersonalMods\Modding\mcp\jars\config\logging.properties

2013-11-04 15:37:45 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-11-04 15:37:45 [iNFO] [sTDOUT] OpenAL initialized.

2013-11-04 15:37:45 [iNFO] [ForgeModLoader] Searching C:\Users\Karl\Documents\MinecraftFolders\PersonalMods\Modding\mcp\jars\mods for mods

2013-11-04 15:37:45 [iNFO] [sTDOUT]

2013-11-04 15:37:47 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-11-04 15:37:47 [iNFO] [mcp] Activating mod mcp

2013-11-04 15:37:47 [iNFO] [FML] Activating mod FML

2013-11-04 15:37:47 [iNFO] [Forge] Activating mod Forge

2013-11-04 15:37:47 [iNFO] [generic] Activating mod generic

2013-11-04 15:37:47 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:47 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:47 [WARNING] [Generic] Mod Generic is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:47 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Generic

2013-11-04 15:37:47 [iNFO] [sTDOUT]

2013-11-04 15:37:47 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-11-04 15:37:47 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-11-04 15:37:47 [iNFO] [sTDOUT]

2013-11-04 15:37:47 [iNFO] [sTDOUT]

2013-11-04 15:37:47 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-11-04 15:37:47 [iNFO] [ForgeModLoader] Registering Forge Packet Handler

2013-11-04 15:37:47 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler

2013-11-04 15:37:47 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0

2013-11-04 15:37:47 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-11-04 15:37:47 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-11-04 15:37:47 [iNFO] [sTDOUT] OpenAL initialized.

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_500_genericDirt.png

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_501_genericOre.png

2013-11-04 15:37:48 [iNFO] [sTDOUT]

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: generic:textures/items/picturename.png

2013-11-04 15:37:48 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods

2013-11-04 15:37:48 [WARNING] [Forge Mod Loader] Mod Forge Mod Loader is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:48 [WARNING] [Minecraft Forge] Mod Minecraft Forge is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:48 [WARNING] [Generic] Mod Generic is missing a pack.mcmeta file, things may not work well

2013-11-04 15:37:48 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Generic

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: generic:textures/items/picturename.png

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_500_genericDirt.png

2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_501_genericOre.png

2013-11-04 15:37:49 [iNFO] [sTDOUT]

2013-11-04 15:37:49 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-11-04 15:37:49 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-11-04 15:37:49 [iNFO] [sTDOUT]

2013-11-04 15:37:49 [iNFO] [sTDOUT]

2013-11-04 15:37:49 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-11-04 15:37:49 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-11-04 15:37:49 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-11-04 15:37:49 [iNFO] [sTDOUT] OpenAL initialized.

2013-11-04 15:37:49 [iNFO] [sTDOUT]

2013-11-04 15:37:50 [sEVERE] [Minecraft-Client] Realms: Invalid session id

 

Posted
2013-11-04 15:37:48 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: generic:textures/items/picturename.png

 

It can't find your texture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Here is the code of the GenericItem class:

 

package tutorial.generic;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.item.Item;

 

public class GenericItem extends Item {

 

        public GenericItem(int id) {

                super(id); 

                // Constructor Configuration

                maxStackSize = 64;

                setCreativeTab(CreativeTabs.tabMisc);

                setUnlocalizedName("genericItem");

                setTextureName("generic:picturename");

        }

 

}

Posted

That is out of date.......

 

It's actually not.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

The icons sections is as it doesnt use the setTextureName("generic:picturename"); function, it uses an older one which is no longer in use.

 

You know how a wiki works, right?

 

You can update the section yourself.

 

What's in that article still works even if there's a cleaner way of doing it in some situations.  As soon as someone needs two icons (say, logs), then setTextureName won't work and so the existing section would have to be added back again if it was removed.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

As someone who is doing my first mod and am asking for help, I dont feel like im the most qualified to be updating the tutorial which I myself am using. When I tried doing what the article did I recieved an error, and some research later reveled that the method used is a bit outdated. Hopefully someone will update it but it will definitely not be me due to my inexperience.

Posted

The rest of us aren't updating it because we don't realize that it is out of date.  Whereas you do, and then you figure out what the problem is, you're in the unique position of both having the answer and knowing that the tutorial needs to be changed.

 

I'd do it myself (now that I'm aware of the problem), but I don't have the time.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well a small update. I have successfully managed to get the program to locate the textures, but now these errors have cropped up:

 

2013-11-05 19:11:47 [WARNING] [Generic] Mod Generic is missing a pack.mcmeta file, things may not work well

2013-11-05 19:11:47 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Generic

2013-11-05 19:11:47 [sEVERE] [Minecraft-Client] Unable to parse animation metadata from genericmod:textures/items/genericIngot.png: broken aspect ratio and not an animation

 

To fix the previous error I used this coding which was given to me by TheGreyGhost (also after doing some research I also found out why the texture was originally not being found):

 

public void registerIcons(IconRegister iconRegister)

        {

          itemIcon = iconRegister.registerIcon("genericmod:genericIngot");

        }

 

 

}

 

Can anyone shed some light on what this error means? Thanks in advance.

Posted

Thanks, I was looking at the wiki and realized my answer was there as well. Major derp on my part  :P:)

 

EDIT: I`d like to give a huge thank you to all who posted in this topic and helped me out as I have successfully added the textures :D Thank-you guys :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.