Jump to content

Recommended Posts

Posted

after creating my class to render my custom mob (a fish) my minecraft (that is in eclipse) would crash every time i tried to run it. I will post the code and the crash log. I did use the vanilla cow render. If that is the problem, can you please tell me what i should use?

 

crash log:

---- Minecraft Crash Report ----

// Daisy, daisy...

 

Time: 8/18/14 9:34 AM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at com.extraores.model.Fish.<init>(Fish.java:45)

at com.extraores.extraoresmod.ClientProxy.registerRenderThings(ClientProxy.java:13)

at com.extraores.extraoresmod.ExtraOresMod.init(ExtraOresMod.java:72)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)

at net.minecraft.client.Minecraft.run(Minecraft.java:941)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at GradleStart.bounce(GradleStart.java:107)

at GradleStart.startClient(GradleStart.java:100)

at GradleStart.main(GradleStart.java:55)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.extraores.model.Fish.<init>(Fish.java:45)

at com.extraores.extraoresmod.ClientProxy.registerRenderThings(ClientProxy.java:13)

at com.extraores.extraoresmod.ExtraOresMod.init(ExtraOresMod.java:72)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:941)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at GradleStart.bounce(GradleStart.java:107)

at GradleStart.startClient(GradleStart.java:100)

at GradleStart.main(GradleStart.java:55)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_11, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 934128224 bytes (890 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.25.1205 Minecraft Forge 10.13.0.1205 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized

FML{7.10.25.1205} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1205.jar) Unloaded->Constructed->Pre-initialized

Forge{10.13.0.1205} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1205.jar) Unloaded->Constructed->Pre-initialized

extraoresmod{1.0} [extraoresmod] (bin) Unloaded->Constructed->Errored

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce GT 540M/PCI/SSE2 GL version 4.1.0, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

Class to render my fish:

 

package com.extraores.extraoresmod;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

 

 

@SideOnly(Side.CLIENT)

public class RenderMyFishMob extends RenderLiving

{

    private static final ResourceLocation mobTextures = new ResourceLocation("extraoresmod/textures/entity/Fish.png");

    private static final String __OBFID = "CL_00000984";

 

    public RenderMyFishMob(ModelBase par1ModelBase, float par2)

    {

        super(par1ModelBase, par2);

    }

   

@Override

protected ResourceLocation getEntityTexture(Entity p_110775_1_) {

return null;

}

}

 

Thanks!

Posted

The first line of your stack trace says you are calling a method on a null object in the constructor of your class Fish, on line 45.

 

java.lang.NullPointerException: Initializing game

  at com.extraores.model.Fish.<init>(Fish.java:45)

 

Your problem is not in class RenderMyFishMob. Go to line 45 of class Fish and look for an object you are calling a method on. For some reason, it is null.

Posted

your Class RenderMyFishMob is not correct to, you must return your return location instead of null:

@Override

  protected ResourceLocation getEntityTexture(Entity p_110775_1_) {

      return null;

  }

 

But I think you have more problems than that.

Posted

Thanks for replying. I looked at my Fish.class and didn't find anything that i used or that was null. Also, what should i return instead of null? The class location or the texture location?

 

Here is my code in Fish.class (it is a techne model file):

// Date: 8/17/2014 4:45:31 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX






package com.extraores.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class Fish extends ModelBase
{
  //fields
    ModelRenderer Body;
    ModelRenderer Top_Fin;
    ModelRenderer Right_Fin;
    ModelRenderer Left_Fin;
    ModelRenderer Shape1;
    ModelRenderer Shape2;
  
  public Fish()
  {
    textureWidth = 32;
    textureHeight = 32;
    
      Body = new ModelRenderer(this, 0, 0);
      Body.addBox(0F, 0F, 0F, 6, 3, 1);
      Body.setRotationPoint(0F, 0F, 0F);
      Body.setTextureSize(32, 32);
      Body.mirror = true;
      setRotation(Body, 0F, 0F, 0F);
      Top_Fin = new ModelRenderer(this, 0, 0);
      Top_Fin.addBox(0F, 0F, 0F, 3, 1, 0);
      Top_Fin.setRotationPoint(1.3F, 0F, 0.5F);
      Top_Fin.setTextureSize(32, 32);
      Top_Fin.mirror = true;
      setRotation(Top_Fin, 0F, 0F, -0.2974289F);
      Right_Fin.mirror = true;
      Right_Fin = new ModelRenderer(this, 0, 0);
      Right_Fin.addBox(0F, 0F, 0F, 2, 1, 0);
      Right_Fin.setRotationPoint(2F, 1.3F, 0F);
      Right_Fin.setTextureSize(32, 32);
      Right_Fin.mirror = true;
      setRotation(Right_Fin, 0F, 0.2974289F, 0.2974289F);
      Right_Fin.mirror = false;
      Left_Fin = new ModelRenderer(this, 0, 0);
      Left_Fin.addBox(0F, 0F, 0F, 2, 1, 0);
      Left_Fin.setRotationPoint(2F, 1.3F, 1F);
      Left_Fin.setTextureSize(32, 32);
      Left_Fin.mirror = true;
      setRotation(Left_Fin, 0F, -0.2974289F, 0.2974289F);
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(0F, 0F, 0F, 3, 1, 0);
      Shape1.setRotationPoint(5.5F, 0.9F, 0.5F);
      Shape1.setTextureSize(32, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0.7853982F);
      Shape2 = new ModelRenderer(this, 0, 0);
      Shape2.addBox(0F, 0F, 0F, 2, 1, 0);
      Shape2.setRotationPoint(5.5F, 0.9F, 0.5F);
      Shape2.setTextureSize(32, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, -0.7853982F);
  }
  
  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);
    Body.render(f5);
    Top_Fin.render(f5);
    Right_Fin.render(f5);
    Left_Fin.render(f5);
    Shape1.render(f5);
    Shape2.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 entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }

}

 

Thanks for helping guys!

Posted

You set RightFin.mirror to true twice then set it to false. I have had this problem with techne before. Just take out the extra RightFin.mirror s and it should work.

Posted

You have set field mirror on Right_Fin before you initialize it on the next line, so, Right_Fin is null.

 

      Right_Fin.mirror = true;
      Right_Fin = new ModelRenderer(this, 0, 0);

 

If you are running from inside Eclipse (and you should be during development) exceptions and their stacktraces are printed to the console window. The file name and line number of each call are links that are hightlighted in red and underlined. You can click on the link and it will bring you directly to the line in the file where the call was made. In your case, clicking on Fish.java:45 will open Fish.java with the line

 

Right_Fin.mirror = true;

 

highlighted. There is only one thing that can be null here.

 

Incidentally, does Techne really generate uppercase variable names?

 

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.