Jump to content

Simple Render Error


TrunkS
 Share

Recommended Posts

First off thank you for deciding to take a look at my problem :)

 

I am currently trying to make a 3D rendered item.

It is just a simple one by one cube because I am just testing out the whole render thing before jumping into more complicated models.

After having managed to get the proxy registry right for it I am experiencing an error which is pretty embarrassing.

Every time I switch to the slot where my item is located I am getting a Texture not found type of error though I already tried every path combination possible.

In game the inventory slot icon is currently just a simple placeholder but the item is simply not showing up when held in hand.  :-\

I know that this problem may sound a little nooby but I have the strange feeling that this has nothing to do with the path error.

 

Well if you're still with me here's my code:

 

Main mod class:

package trunkS.mod;

import trunkS.mod.common.CommonProxyTrunkS;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.src.BaseMod;
import net.minecraft.src.ModLoader;
import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.common.Mod;

@Mod(modid = "TrunkSMod", name = "TrunkS Mod", version = "Dev v1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class mod_Particles extends BaseMod
{
        //Creative Tabs
        public static CreativeTabs tabParticles = new CreativeTabParticles(CreativeTabs.getNextID(), "tabParticles");
       
        //Items
        public static Item particleWood = new ItemParticle(5001, "GhastSoul1").setCreativeTab(mod_Particles.tabParticles).setFull3D();
       
        //Proxys
        @SidedProxy(clientSide = "trunkS.mod.client.ClientProxyTrunkS", serverSide = "Tutorial.common.CommonProxyTrunkS")
        public static CommonProxyTrunkS proxy;
       
        @Init
        public void load()
        {
                //Loading Screen
                System.out.println("Loading TrunkS Particles Mod...");
                System.out.println("TrunkS Particles Mod loaded!");
               
                //Proxys
                proxy.registerRenderThings();
               
                GameRegistry.registerItem(particleWood, "woodParticle");
               
                //Name Registry
                LanguageRegistry.addName(particleWood, "Wood Particle");
               
        }
       
        public String getVersion()
        {
                return "Dev v1";
        }
       
}

 

Common Proxy:

package trunkS.mod.common;

public class CommonProxyTrunkS {

        public void registerRender(){
               
        }
}

 

Client Proxy:

package trunkS.mod.client;

import net.minecraftforge.client.MinecraftForgeClient;
import trunkS.mod.ItemRenderWoodParticle;
import trunkS.mod.mod_Particles;
import trunkS.mod.common.CommonProxyTrunkS;

public class ClientProxyTrunkS extends CommonProxyTrunkS {

        @Override
        public void registerRender(){
               
                MinecraftForgeClient.registerItemRenderer(mod_Particles.particleWood.itemID, new ItemRenderWoodParticle());
               
        }
       
}

 

ItemParticle Class:

package trunkS.mod;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;

public class ItemParticle extends Item
{
        private String iconPath;
       
        @SideOnly(Side.CLIENT)
        private Icon icon;
       
        public ItemParticle(int par1, String par2Str)
        {
                super(par1);
               
                this.iconPath = par2Str;
        }
       
        @SideOnly(Side.CLIENT)
        public void registerIcons(IconRegister par1IconRegister)
        {
                this.icon = par1IconRegister.registerIcon("modParticles/" + this.iconPath);
        }
       
        @SideOnly(Side.CLIENT)
        public Icon getIconFromDamage(int par1)
        {
                return this.icon;
        }
}

 

The Model Class:

package trunkS.mod;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;

public class ItemParticle extends Item
{
        private String iconPath;
       
        @SideOnly(Side.CLIENT)
        private Icon icon;
       
        public ItemParticle(int par1, String par2Str)
        {
                super(par1);
               
                this.iconPath = par2Str;
        }
       
        @SideOnly(Side.CLIENT)
        public void registerIcons(IconRegister par1IconRegister)
        {
                this.icon = par1IconRegister.registerIcon("modParticles/" + this.iconPath);
        }
       
        @SideOnly(Side.CLIENT)
        public Icon getIconFromDamage(int par1)
        {
                return this.icon;
        }
}

 

The Renderer Class:

package trunkS.mod;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderWoodParticle implements IItemRenderer
{      
        protected ModelParticleMod particleModel;
       
        public ItemRenderWoodParticle()
        {
               
                particleModel = new ModelParticleMod();
               
        }
       

        @Override
        public boolean handleRenderType(ItemStack item, ItemRenderType type)
        {
                switch(type)
                {
                        case EQUIPPED: return true;
                        case ENTITY: return true;
                        default: return false;
                }

        }

        @Override
        public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
                        ItemRendererHelper helper)
        {

                return false;
        }

        @Override
        public void renderItem(ItemRenderType type, ItemStack item, Object... data)
        {

                switch(type)
                {
                case ENTITY:
                {
                        GL11.glPushMatrix();
                       
                        //This is were it should get its texture from
                        Minecraft.getMinecraft().renderEngine.bindTexture("/textures/items/modParticles/woodParticle");
                       
                        float scale = 6F;
                        GL11.glScalef(scale, scale, scale);
                       
                        particleModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
                       
                         FMLClientHandler.instance().getClient().renderEngine.resetBoundTexture();
                       
                        GL11.glPopMatrix();
                       
                }
                        case EQUIPPED:
                        {
                                GL11.glPushMatrix();

                                Minecraft.getMinecraft().renderEngine.bindTexture("/textures/items/modParticles/woodParticle");
                               
                                particleModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
                               
                                GL11.glPopMatrix();
                        }
                        default:
                                break;
                }
               
        }

}

 

And the error log:

2013-05-22 20:53:59 [information] [sTDERR] java.io.FileNotFoundException: /textures/items/modParticles/woodParticle
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.texturepacks.TexturePackDefault.func_98139_b(TexturePackDefault.java:42)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.texturepacks.TexturePackImplementation.func_98137_a(TexturePackImplementation.java:149)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.texturepacks.TexturePackImplementation.getResourceAsStream(TexturePackImplementation.java:169)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.RenderEngine.getTexture(RenderEngine.java:208)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.RenderEngine.bindTexture(RenderEngine.java:148)
2013-05-22 20:53:59 [information] [sTDERR]      at trunkS.mod.ItemRenderWoodParticle.renderItem(ItemRenderWoodParticle.java:74)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraftforge.client.ForgeHooksClient.renderEquippedItem(ForgeHooksClient.java:208)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:89)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:505)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:697)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1273)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:991)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:871)
2013-05-22 20:53:59 [information] [sTDERR]      at net.minecraft.client.Minecraft.run(Minecraft.java:760)
2013-05-22 20:53:59 [information] [sTDERR]      at java.lang.Thread.run(Unknown Source)

 

I guess this is it.

If you have any idea what the problem is, I'd be very thankful for helping me. ;)

And no my name is not inspired by DBZ ^^

Link to comment
Share on other sites

shouldn't it be:

Minecraft.getMinecraft().renderEngine.bindTexture("/textures/items/modParticles/woodParticle.png");

?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

it DOES need the .png in the end, given your texture file should be a .png !

 

also, where did you put your texture file ? given of how you code it, your texture should be in

 

forge\mcp\src\minecraft\textures\items\modParticles

 

given from that > does the item render when you go out of first person mode ?

for first person view rendering, use

 

case  EQUIPPED_FIRST_PERSON:

Link to comment
Share on other sites

Okey I've added a .png and the path now looks like this:

"/trunkS/mod/textures/items/woodParticle.png"

I created the textures/items folders and placed the texturemap in it realising that there was no textures/items folder

directly in the src/minecraft one ;D

Now I don't get errors any more but the items is still not showing up, wether in First- (I've added the EQUIPPED_FIRST_PERSON case) or Third-Person mode.

And no my name is not inspired by DBZ ^^

Link to comment
Share on other sites

you dont have to unbind your texture.

and try adding these :

 

                GL11.glPushMatrix();
	Minecraft.getMinecraft().renderEngine.bindTexture(name);
	GL11.glScalef(3f, 3f,3f);
	GL11.glRotatef(0, 0.0f, 0.0f, 1.0f);
	GL11.glRotatef(0, 0.0f, 1.0f, 0.0f);
	GL11.glRotatef(-180, 1.0f, 0.0f, 0.0f);
	GL11.glTranslatef(0f,0f,0F);
                theItem.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
                GL11.glPopMatrix();

Link to comment
Share on other sites

  • 2 weeks later...

I really don't know what's wrong. I still think there's something about the render registry...but I'm not sure.

Oh boy, hopefully there'll be a solution for this somewhere in the near future.

And no my name is not inspired by DBZ ^^

Link to comment
Share on other sites

I don't think the problem is your path anymore. I'm not sure how much I can help without seeing your model class. When you pasted your model class you actually just pasted your ItemParticle class again.

What catches my eye in your renderer class is

particleModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

You have lots of zeros in there and without seeing what the method does in your model class I'm not sure if those zeros aren't making your model come up as a single point instead of a cube.

 

Assuming you did that right, go into your renderer class and go to one of your switch cases where you actually render your item. Add in some sort of print statement (if you can figure out where it prints: I haven't yet and it bugs me to no end) or add a set of statements that will result in an error: I make a small array and intentionally get an out of bounds error. If your statement prints/your game crashes when you have the item in the case you trapped, then you do know that it is being used, just not correctly. If it doesn't trigger, then you know that it isn't being used which would explain it not showing up.

 

Let us know if all of your rendering code is being run and send us your model class.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

I don't think the problem is your path anymore. I'm not sure how much I can help without seeing your model class. When you pasted your model class you actually just pasted your ItemParticle class again.

What catches my eye in your renderer class is

particleModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

You have lots of zeros in there and without seeing what the method does in your model class I'm not sure if those zeros aren't making your model come up as a single point instead of a cube.

 

Assuming you did that right, go into your renderer class and go to one of your switch cases where you actually render your item. Add in some sort of print statement (if you can figure out where it prints: I haven't yet and it bugs me to no end) or add a set of statements that will result in an error: I make a small array and intentionally get an out of bounds error. If your statement prints/your game crashes when you have the item in the case you trapped, then you do know that it is being used, just not correctly. If it doesn't trigger, then you know that it isn't being used which would explain it not showing up.

 

Let us know if all of your rendering code is being run and send us your model class.

Those 0s are supposed to be there; they're normally used for data relating to mobs that he doesn't need. What he's missing is the entity registry line in his mod file: EntityRegistry.registerModEntity(...);

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

I guess I just solved the problem!?

Well, actually it solved itself.

There's some background info you need to know first: I changed the model (and texture) to a bigger one some time ago to see if it was the model class which was causing problems.

So when I changed it back while I was trying out some of the suggestions given here it just worked (And it's spaming: "I guess I just rendered!" to my console).

Because of the model beeing a bit tiny, I scaled it a little. But when I did so the model went up in the air relatively high.

Maybe this effect was even bigger the bigger my model was and maybe I just couldn't see anything because  the model was floating way above my head ^^.

Anyway thank you all for helping me out, you were really helpful.

Solved!

And no my name is not inspired by DBZ ^^

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

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