Jump to content

3D items not rendering


MrNegaBlox

Recommended Posts

I was trying to make a 3D item in my hand with a mod like the Trail Mix mod. I looked at iChun's tutorial and did everything right. I still get this stack trace every time i go in third person to render it:

 

 

2013-12-03 19:25:28 [sEVERE] [Minecraft-Client] ########## GL ERROR ##########

2013-12-03 19:25:28 [sEVERE] [Minecraft-Client] @ Post render

2013-12-03 19:25:28 [sEVERE] [Minecraft-Client] 1283: Stack overflow

2013-12-03 19:25:28 [iNFO] [sTDERR] java.lang.NullPointerException

2013-12-03 19:25:28 [iNFO] [sTDERR] at bettermc.test.ItemRender.renderItem(ItemRender.java:45)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraftforge.client.ForgeHooksClient.renderEquippedItem(ForgeHooksClient.java:207)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:89)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:68)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderPlayer.renderSpecials(RenderPlayer.java:408)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderPlayer.renderEquippedItems(RenderPlayer.java:519)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RendererLivingEntity.func_130000_a(RendererLivingEntity.java:218)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderPlayer.func_130009_a(RenderPlayer.java:166)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:553)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.client.main.Main.main(Main.java:93)

2013-12-03 19:25:28 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-12-03 19:25:28 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-12-03 19:25:28 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-12-03 19:25:28 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)

2013-12-03 19:25:28 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

 

 

Main Mod File:

 

 

 
package bettermc.test;

import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
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;

@Mod(modid="BMC", name="BetterMC", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class Test {
public static CreativeTabs tabBlasters = new CreativeTabs("tabBlasters") {
        public ItemStack getIconItemStack() {
                return new ItemStack(blasterRifle, 1, 0);
                
        }
};
public EnumToolMaterial mat;

        // The instance of your mod that Forge uses.
        @Instance("Test")
        public static Test instance;
        public final static Item Oore  = new GraxOre(5000).func_111206_d("bettermc:GraxOre").setCreativeTab(tabBlasters).setUnlocalizedName("GraxOre");;;
        public final static Item PhoenixBlade  = new BlazeBlade(5002).func_111206_d("bettermc:BlazeBlade").setCreativeTab(tabBlasters).setUnlocalizedName("PhoenixBlade");;;
        public final static Item blasterRifle = new Blaster(5001).setCreativeTab(tabBlasters).setUnlocalizedName("Blaster").func_111206_d("bettermc:Blaster");
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="bettermc.test.client.ClientProxy", serverSide="bettermc.test.CommonProxy")
        public static CommonProxy proxy;
        

        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        	config.load();
            //example
            int randomBlockID = config.getItem("GraxOre", 20001).getInt();

            int randomItemID = config.getItem("Phoenix Blaster", 20000).getInt();
            
            int PhoenixBladeID = config.getItem("PhoenixBlade", 20002).getInt();
        	config.save();
        	
        }
        
        @EventHandler
        public void Init(FMLInitializationEvent event) {

        	    //Register mob
        	

        	    //Localize mob name        	
        	LanguageRegistry.addName(Oore, "Nether Essence");
        	LanguageRegistry.addName(PhoenixBlade, "Phoenix Blade");
        	GameRegistry.registerItem(Oore, "Nether Essence");
        	GameRegistry.registerItem(PhoenixBlade, "Phoenix Blade");
        	GameRegistry.registerItem(blasterRifle, "Phoenix Blaster");
            proxy.registerRenderers();
            LanguageRegistry.addName(blasterRifle, "§4§lPhoenix §6Blaster");
            RenderingRegistry.registerEntityRenderingHandler(EntityBlasterBolt.class, new RenderSnowball(Oore));
            LanguageRegistry.instance().addStringLocalization("itemGroup.tabBlasters", "en_US", "Blaze Phoenix Mod");
            ItemStack dirtStack = new ItemStack(Item.ingotIron);
            ItemStack cobblestack = new ItemStack(blasterRifle);
            ItemStack gravelStack = new ItemStack(Oore);
            GameRegistry.addRecipe(cobblestack, "x  ", " x ", " yx",
                    'x', dirtStack, 'y', gravelStack);
            ItemStack quartzstack = new ItemStack(Item.netherQuartz);
            ItemStack blazestack = new ItemStack(Item.blazePowder);
            GameRegistry.addShapelessRecipe(gravelStack, quartzstack, blazestack);
         
                }
        
            
        
            
        
        
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                // Stub Method
        }
}
            

Client Proxy:

 

 

 

 

package bettermc.test.client;

import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import bettermc.test.CommonProxy;
import bettermc.test.ItemRender;

public class ClientProxy extends CommonProxy {
        
        @Override
        public void registerRenderers() {
        	MinecraftForgeClient.registerItemRenderer(bettermc.test.Test.blasterRifle.itemID, (IItemRenderer)new ItemRender());
        }
        
}

 

 

Item Renderer Class

 

 

package bettermc.test;
import bettermc.test.Blaster;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

public class ItemRender implements IItemRenderer {

protected ModelPhoenixBlastereModel phoenix;
ResourceLocation texture =  new ResourceLocation("bettermc", "textures/items/PhoenixModel.png)");
        private static RenderItem renderItem = new RenderItem();
        

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

        @Override
        public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
                        ItemRendererHelper helper) {
                return false;
        }

        @Override
        public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) {
        	switch(type){
        	case EQUIPPED:{
        		GL11.glPushMatrix();
        		Minecraft.getMinecraft().renderEngine.func_110581_b(texture);
        		phoenix.render((Entity)data[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f);
        		GL11.glPopMatrix();
        	}
		default:
			break;
        	}
        }
}

 

 

Client Proxy Class

 

 

package bettermc.test.client;

import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import bettermc.test.CommonProxy;
import bettermc.test.ItemRender;

public class ClientProxy extends CommonProxy {
        
        @Override
        public void registerRenderers() {
        	MinecraftForgeClient.registerItemRenderer(bettermc.test.Test.blasterRifle.itemID, (IItemRenderer)new ItemRender());
        }
        
}

 

 

Model Itself Exported from Techne

 

 

// Date: 12/3/2013 5:05:18 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX






package bettermc.test;

import cpw.mods.fml.common.network.Player;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelPhoenixBlastereModel extends ModelBase
{

  //fields
    ModelRenderer Bow_Base;
    ModelRenderer Bow_Crosshair;
    ModelRenderer Bar_Left;
    ModelRenderer Bar_Right;
    ModelRenderer Handle;
    ModelRenderer F1L;
    ModelRenderer F2L;
    ModelRenderer F3L;
    ModelRenderer F1R;
    ModelRenderer F2R;
    ModelRenderer F3R;
  
  public ModelPhoenixBlastereModel()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      Bow_Base.mirror = false;
      Bow_Base = new ModelRenderer(this, 0, 5);
      Bow_Base.addBox(0F, 0F, 0F, 3, 1, 11);
      Bow_Base.setRotationPoint(0F, 0F, 0F);
      Bow_Base.setTextureSize(64, 32);
      Bow_Base.mirror = true;
      setRotation(Bow_Base, 0F, 0F, 0F);
      Bow_Base.mirror = false;
      Bow_Crosshair = new ModelRenderer(this, 28, 0);
      Bow_Crosshair.addBox(0F, 0F, 0F, 2, 1, 1);
      Bow_Crosshair.setRotationPoint(0.5F, -1F, 10F);
      Bow_Crosshair.setTextureSize(64, 32);
      Bow_Crosshair.mirror = true;
      setRotation(Bow_Crosshair, 0F, 0F, 0F);
      Bar_Left.mirror = false;
      Bar_Left = new ModelRenderer(this, 34, 0);
      Bar_Left.addBox(0F, 0F, 0F, 1, 1, ;
      Bar_Left.setRotationPoint(1F, 0F, 10F);
      Bar_Left.setTextureSize(64, 32);
      Bar_Left.mirror = false;
      setRotation(Bar_Left, 0F, -1.970466F, 0F);
      Bar_Left.mirror = false;
      Bar_Right = new ModelRenderer(this, 34, 0);
      Bar_Right.addBox(0F, 0F, 0F, 1, 1, ;
      Bar_Right.setRotationPoint(2F, 0F, 11F);
      Bar_Right.setTextureSize(64, 32);
      Bar_Right.mirror = true;
      setRotation(Bar_Right, 0F, 1.954769F, 0F);
      Handle = new ModelRenderer(this, 10, 0);
      Handle.addBox(0F, 0F, 0F, 2, 2, 1);
      Handle.setRotationPoint(0.5F, 1F, 1F);
      Handle.setTextureSize(64, 32);
      Handle.mirror = false;
      setRotation(Handle, 0F, 0F, 0F);
      F1L.mirror = false;
      F1L = new ModelRenderer(this, 0, 0);
      F1L.addBox(0F, 0F, -4F, 1, 1, 4);
      F1L.setRotationPoint(-1.5F, 0F, 9F);
      F1L.setTextureSize(64, 32);
      F1L.mirror = false;
      setRotation(F1L, 0F, -0.0827224F, 0F);
      F1L.mirror = false;
      F2L = new ModelRenderer(this, 0, 17);
      F2L.addBox(0F, 0F, 0F, 1, 1, 4);
      F2L.setRotationPoint(-2.666667F, 0F, 5F);
      F2L.setTextureSize(64, 32);
      F2L.mirror = false;
      setRotation(F2L, 0F, -0.3187033F, 0F);
      F3L = new ModelRenderer(this, 0, 22);
      F3L.addBox(0F, 0F, -3F, 1, 1, 4);
      F3L.setRotationPoint(-6F, 0F, 7F);
      F3L.setTextureSize(64, 32);
      F3L.mirror = false;
      setRotation(F3L, 0F, -0.5660444F, 0F);
      F1R = new ModelRenderer(this, 0, 0);
      F1R.addBox(0F, 0F, -4F, 1, 1, 4);
      F1R.setRotationPoint(4F, 0F, 9F);
      F1R.setTextureSize(64, 32);
      F1R.mirror = false;
      setRotation(F1R, 0F, 0.1403493F, 0F);
      F2R = new ModelRenderer(this, 0, 17);
      F2R.addBox(0F, 0F, -3F, 1, 1, 4);
      F2R.setRotationPoint(6F, 0F, 8F);
      F2R.setTextureSize(64, 32);
      F2R.mirror = false;
      setRotation(F2R, 0F, 0.2518851F, 0F);
      F3R = new ModelRenderer(this, 0, 22);
      F3R.addBox(0F, 0F, -3F, 1, 1, 4);
      F3R.setRotationPoint(8F, 0F, 7F);
      F3R.setTextureSize(64, 32);
      F3R.mirror = false;
      setRotation(F3R, 0F, 0.3634209F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Bow_Base.render(f5);
    Bow_Crosshair.render(f5);
    Bar_Left.render(f5);
    Bar_Right.render(f5);
    Handle.render(f5);
    F1L.render(f5);
    F2L.render(f5);
    F3L.render(f5);
    F1R.render(f5);
    F2R.render(f5);
    F3R.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);
  }

}

 

 

 

Please Tell Me whats wrong with it. Thank you in advance!

Link to comment
Share on other sites

Please Tell Me whats wrong with it. Thank you in advance!

 

protected ModelPhoenixBlastereModel phoenix;

phoenix.render((Entity)data[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f);

 

And those are the only references to that variable.

 

(Pro-tip: the variable is undefined)

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.

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