Jump to content

Recommended Posts

Posted

[Reposting because I thought this was not up to standards, but I think I was wrong]

 

Hi there! First time modder but I'm experienced with Java through my time in school. I've been playing around with various modding tutorials over the past few days, but I recently got stuck when I tried to jump into creating a custom block model. I may have been a little too eager, and I should probably go make sure I'm versed in the basics. But Neale Gaming's tutorial's been fairly helpful.

 

Anyways! I got this error in the setRotation code of my custom block's .java file

 

 

package assets.runicweapons.models;

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

public class blockInscriptionTable extends ModelBase
{
  //fields
    ModelRenderer TableBase;
    ModelRenderer Leg;
    ModelRenderer Leg2;
    ModelRenderer Leg3;
    ModelRenderer Leg4;
    ModelRenderer InscriptionSet11;
    ModelRenderer InscriptionSet12;
    ModelRenderer InscriptionSet21;
    ModelRenderer InscriptionSet22;
  
  public blockInscriptionTable()
  {
    textureWidth = 64;
    textureHeight = 64;
    
      TableBase = new ModelRenderer(this, 0, 0);
      TableBase.addBox(0F, 0F, 0F, 16, 7, 16);
      TableBase.setRotationPoint(0F, 0F, 0F);
      TableBase.setTextureSize(64, 64);
      TableBase.mirror = true;
      setRotation(TableBase, 0F, 0F, 0F);
      Leg = new ModelRenderer(this, 0, 23);
      Leg.addBox(0F, 0F, 0F, 2, 8, 2);
      Leg.setRotationPoint(0F, 7F, 0F);
      Leg.setTextureSize(64, 64);
      Leg.mirror = true;
      setRotation(Leg, 0F, 0F, 0F);
      Leg2 = new ModelRenderer(this, 8, 23);
      Leg2.addBox(0F, 0F, 0F, 2, 8, 2);
      Leg2.setRotationPoint(14F, 7F, 0F);
      Leg2.setTextureSize(64, 64);
      Leg2.mirror = true;
      setRotation(Leg2, 0F, 0F, 0F);
      Leg3 = new ModelRenderer(this, 16, 23);
      Leg3.addBox(0F, 0F, 0F, 2, 8, 2);
      Leg3.setRotationPoint(0F, 7F, 14F);
      Leg3.setTextureSize(64, 64);
      Leg3.mirror = true;
      setRotation(Leg3, 0F, 0F, 0F);
      Leg4 = new ModelRenderer(this, 24, 23);
      Leg4.addBox(0F, 0F, 0F, 2, 8, 2);
      Leg4.setRotationPoint(14F, 7F, 14F);
      Leg4.setTextureSize(64, 64);
      Leg4.mirror = true;
      setRotation(Leg4, 0F, 0F, 0F);
      InscriptionSet11 = new ModelRenderer(this, 0, 33);
      InscriptionSet11.addBox(0F, 0F, 0F, 14, 1, 1);
      InscriptionSet11.setRotationPoint(1F, -1F, 1F);
      InscriptionSet11.setTextureSize(64, 64);
      InscriptionSet11.mirror = true;
      setRotation(InscriptionSet11, 0F, 0F, 0F);
      InscriptionSet12 = new ModelRenderer(this, 0, 35);
      InscriptionSet12.addBox(0F, 0F, 0F, 14, 1, 1);
      InscriptionSet12.setRotationPoint(1F, -1F, 14F);
      InscriptionSet12.setTextureSize(64, 64);
      InscriptionSet12.mirror = true;
      setRotation(InscriptionSet12, 0F, 0F, 0F);
      InscriptionSet21 = new ModelRenderer(this, 0, 37);
      InscriptionSet21.addBox(0F, 0F, 0F, 1, 1, 12);
      InscriptionSet21.setRotationPoint(1F, -1F, 2F);
      InscriptionSet21.setTextureSize(64, 64);
      InscriptionSet21.mirror = true;
      setRotation(InscriptionSet22, 0F, 0F, 0F);
      InscriptionSet22 = new ModelRenderer(this, 26, 37);
      InscriptionSet22.addBox(0F, 0F, 0F, 1, 1, 12);
      InscriptionSet22.setRotationPoint(14F, -1F, 2F);
      InscriptionSet22.setTextureSize(64, 64);
      InscriptionSet22.mirror = true;
      setRotation(InscriptionSet22, 0F, 0F, 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);
    TableBase.render(f5);
    Leg.render(f5);
    Leg2.render(f5);
    Leg3.render(f5);
    Leg4.render(f5);
    InscriptionSet11.render(f5);
    InscriptionSet12.render(f5);
    InscriptionSet21.render(f5);
    InscriptionSet22.render(f5);
  }
  
  public void renderModel(float f)
  {
TableBase.render(f);
Leg.render(f);
Leg2.render(f);
Leg3.render(f);
Leg4.render(f);
InscriptionSet11.render(f);
InscriptionSet12.render(f);
InscriptionSet21.render(f);
InscriptionSet22.render(f); 
  }
  
  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);
  }

}

 

 

error

 

 

[16:39:30] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[16:39:30] [Client thread/ERROR] [FML]: 
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.10.25.1198} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1198.jar) Unloaded->Constructed->Pre-initialized
Forge{10.13.0.1198} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1198.jar) Unloaded->Constructed->Pre-initialized
RunicWeapons{1.0} [RunicWeapons] (bin) Unloaded->Constructed->Errored
examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized
[16:39:30] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[16:39:30] [Client thread/ERROR] [FML]: Caught exception from RunicWeapons
java.lang.NullPointerException
at assets.runicweapons.models.blockInscriptionTable.setRotation(blockInscriptionTable.java:111) ~[bin/:?]
at assets.runicweapons.models.blockInscriptionTable.<init>(blockInscriptionTable.java:72) ~[bin/:?]
at com.arcadius.runicweapons.renderer.RenderInscriptionTable.<init>(RenderInscriptionTable.java:21) ~[bin/:?]
at com.arcadius.runicweapons.proxy.ClientProxy.registerRenderThings(ClientProxy.java:18) ~[bin/:?]
at com.arcadius.runicweapons.RunicWeapons.preInit(RunicWeapons.java:54) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.0.1198.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.0.1198.jar:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.0.1198.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?]
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:941) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at GradleStart.bounce(GradleStart.java:108) [start/:?]
at GradleStart.startClient(GradleStart.java:101) [start/:?]
at GradleStart.main(GradleStart.java:56) [start/:?]

 

 

I must be missing something blatantly obvious here, but hopefully you guys might see something that I missed.

 

Thanks!

Posted

I see this twice:

 

      setRotation(InscriptionSet22, 0F, 0F, 0F);

 

Not sure if it would crash though.

 

Not sure myself, but thanks for catching that!

 

 

EDIT: OH MY GOD THAT FIXED IT. Thank you!

Posted

No problem! :)

 

Looking at the crash report you can see:

 

java.lang.NullPointerException

at assets.runicweapons.models.blockInscriptionTable.setRotation(blockInscriptionTable.java:111) ~[bin/:?]

 

So, I believe that you must have to define each rotation point, since you got a null pointer exception. I thought these rotations were (0,0,0) by default, but there aren't... That's good to know, haha.

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.