Posted November 14, 201410 yr Hello! I just joined the forums. Nice to meet you all. c: I have just gotten started on this project, and as I'm fairly new to Minecraft modding am running into quite a few kinks. One of the suggestions were to override the entity renderer hashmap with the model that I wanted to use. However, I am getting this crash log, and I... don't even know where to begin with it, to be honest. ---- Minecraft Crash Report ---- // On the bright side, I bought you a teddy bear! Time: 11/12/14 3:28 PM Description: Initializing game java.lang.NullPointerException: Initializing game at ruirui.minecraft.livelyanimals.LAModelPig.<init>(LAModelPig.java:93) at ruirui.minecraft.livelyanimals.LivelyAnimals.swapModels(LivelyAnimals.java:32) at ruirui.minecraft.livelyanimals.LivelyAnimals.init(LivelyAnimals.java:23) 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.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) at net.minecraft.client.Minecraft.run(Minecraft.java:931) 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:135) 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 ruirui.minecraft.livelyanimals.LAModelPig.<init>(LAModelPig.java:93) at ruirui.minecraft.livelyanimals.LivelyAnimals.swapModels(LivelyAnimals.java:32) at ruirui.minecraft.livelyanimals.LivelyAnimals.init(LivelyAnimals.java:23) 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.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) 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:135) 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.7.0_55, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 210489192 bytes (200 MB) / 338690048 bytes (323 MB) up to 1882718208 bytes (1795 MB) JVM Flags: 0 total; 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.85.1232 Minecraft Forge 10.13.2.1232 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.10.85.1232} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.13.2.1232} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized Constants.MODID{Constants.VERSION} [Constants.MODNAME] (bin) Unloaded->Constructed->Pre-initialized->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel® HD Graphics 4600 GL version 4.0.0 - Build 9.18.10.3071, Intel 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) Here are my classes so far: main: package ruirui.minecraft.livelyanimals; import net.minecraft.client.renderer.entity.RenderPig; import net.minecraft.entity.passive.EntityPig; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = "Constants.MODID", name = "Constants.MODNAME", version = "Constants.VERSION") public class LivelyAnimals { @Mod.EventHandler public void preInit(FMLPreInitializationEvent event){ } @Mod.EventHandler public void init(FMLInitializationEvent event){ MinecraftForge.EVENT_BUS.register(this); swapModels(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event){ } public void swapModels() { RenderingRegistry.registerEntityRenderingHandler(EntityPig.class, new RenderPig(new LAModelPig(), new LAModelPig(), 0.8F)); } } LAModelPig: package ruirui.minecraft.livelyanimals; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class LAModelPig extends ModelBase { //fields ModelRenderer body; ModelRenderer FRleg_top; ModelRenderer FRleg_bot; ModelRenderer FLleg_top; ModelRenderer FLleg_bot; ModelRenderer BRleg_top; ModelRenderer BRleg_bot; ModelRenderer BLleg_top; ModelRenderer BLleg_bot; ModelRenderer belly; ModelRenderer tail_base; ModelRenderer tail_tip; ModelRenderer main; ModelRenderer R_ear; ModelRenderer L_ear; ModelRenderer snout_top; ModelRenderer snout_bot; public LAModelPig() { textureWidth = 64; textureHeight = 64; body = new ModelRenderer(this, 0, 0); body.addBox(-5F, -10F, -7F, 10, 18, 10); body.setRotationPoint(0F, 11F, 3F); body.setTextureSize(64, 64); body.mirror = true; setRotation(body, 1.570796F, 0F, 0F); FRleg_top = new ModelRenderer(this, 40, 0); FRleg_top.addBox(-1.5F, 0F, -1.5F, 3, 6, 3); FRleg_top.setRotationPoint(-2.5F, 15F, -4.5F); FRleg_top.setTextureSize(64, 64); FRleg_top.mirror = true; setRotation(FRleg_top, 0F, 0F, 0F); FRleg_bot = new ModelRenderer(this, 40, 9); FRleg_bot.addBox(-1.5F, 0F, -1.5F, 3, 3, 3); FRleg_bot.setRotationPoint(-2.5F, 21F, -4.5F); FRleg_bot.setTextureSize(64, 64); FRleg_bot.mirror = true; setRotation(FRleg_bot, 0F, 0F, 0F); FLleg_top = new ModelRenderer(this, 40, 0); FLleg_top.addBox(-1.5F, 0F, -1.5F, 3, 6, 3); FLleg_top.setRotationPoint(2.5F, 15F, -4.5F); FLleg_top.setTextureSize(64, 64); FLleg_top.mirror = true; setRotation(FLleg_top, 0F, 0F, 0F); FLleg_bot = new ModelRenderer(this, 40, 9); FLleg_bot.addBox(-1.5F, 0F, -1.5F, 3, 3, 3); FLleg_bot.setRotationPoint(2.5F, 21F, -4.5F); FLleg_bot.setTextureSize(64, 64); FLleg_bot.mirror = true; setRotation(FLleg_bot, 0F, 0F, 0F); BRleg_top = new ModelRenderer(this, 40, 0); BRleg_top.addBox(-1.5F, 0F, -1.5F, 3, 6, 3); BRleg_top.setRotationPoint(-2.5F, 15F, 9F); BRleg_top.setTextureSize(64, 64); BRleg_top.mirror = true; setRotation(BRleg_top, 0F, 0F, 0F); BRleg_bot = new ModelRenderer(this, 40, 9); BRleg_bot.addBox(-1.5F, 0F, -1.5F, 3, 3, 3); BRleg_bot.setRotationPoint(-2.5F, 21F, 9F); BRleg_bot.setTextureSize(64, 64); BRleg_bot.mirror = true; setRotation(BRleg_bot, 0F, 0F, 0F); BLleg_top = new ModelRenderer(this, 40, 0); BLleg_top.addBox(-1.5F, 0F, -1.5F, 3, 6, 3); BLleg_top.setRotationPoint(2.473333F, 15F, 9F); BLleg_top.setTextureSize(64, 64); BLleg_top.mirror = true; setRotation(BLleg_top, 0F, 0F, 0F); BLleg_bot = new ModelRenderer(this, 40, 9); BLleg_bot.addBox(-1.5F, 0F, -1.5F, 3, 3, 3); BLleg_bot.setRotationPoint(2.5F, 21F, 9F); BLleg_bot.setTextureSize(64, 64); BLleg_bot.mirror = true; setRotation(BLleg_bot, 0F, 0F, 0F); belly = new ModelRenderer(this, 40, 15); belly.addBox(-3F, -4.5F, -1F, 6, 10, 3); belly.setRotationPoint(0F, 18F, 1.75F); belly.setTextureSize(64, 64); belly.mirror = true; setRotation(belly, 1.570796F, 0F, 0F); tail_base.mirror = true; tail_base = new ModelRenderer(this, 18, 44); tail_base.addBox(-0.5F, -0.5F, 0F, 1, 1, 3); tail_base.setRotationPoint(0F, 10F, 10.5F); tail_base.setTextureSize(64, 64); tail_base.mirror = true; setRotation(tail_base, -1.020656F, 0F, 0F); tail_base.mirror = false; tail_tip = new ModelRenderer(this, 18, 48); tail_tip.addBox(-0.5F, -0.5F, 0F, 1, 1, 3); tail_tip.setRotationPoint(0F, 12F, 12F); tail_tip.setTextureSize(64, 64); tail_tip.mirror = true; setRotation(tail_tip, -1.347828F, 0F, 0F); main = new ModelRenderer(this, 0, 28); main.addBox(-4F, -4F, -8F, 8, 8, ; main.setRotationPoint(0F, 14F, -6F); main.setTextureSize(64, 64); main.mirror = true; setRotation(main, 0F, 0F, 0F); R_ear = new ModelRenderer(this, 32, 28); R_ear.addBox(-4F, -0.5F, 0F, 4, 1, 6); R_ear.setRotationPoint(-3F, 9F, -13F); R_ear.setTextureSize(64, 64); R_ear.mirror = true; setRotation(R_ear, 0.4758862F, -3.004032F, -2.379431F); L_ear = new ModelRenderer(this, 32, 28); L_ear.addBox(0F, -0.5F, 0F, 4, 1, 6); L_ear.setRotationPoint(3F, 9F, -13F); L_ear.setTextureSize(64, 64); L_ear.mirror = true; setRotation(L_ear, -2.617374F, -0.2082002F, 0.781577F); snout_top = new ModelRenderer(this, 0, 44); snout_top.addBox(-2.5F, -1.5F, -4F, 5, 3, 4); snout_top.setRotationPoint(0F, 15F, -14F); snout_top.setTextureSize(64, 64); snout_top.mirror = true; setRotation(snout_top, 0F, 0F, 0F); snout_bot = new ModelRenderer(this, 0, 51); snout_bot.addBox(-2.5F, 0F, -4F, 5, 1, 4); snout_bot.setRotationPoint(0F, 16.5F, -14F); snout_bot.setTextureSize(64, 64); snout_bot.mirror = true; setRotation(snout_bot, 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, null); body.render(f5); FRleg_top.render(f5); FRleg_bot.render(f5); FLleg_top.render(f5); FLleg_bot.render(f5); BRleg_top.render(f5); BRleg_bot.render(f5); BLleg_top.render(f5); BLleg_bot.render(f5); belly.render(f5); tail_base.render(f5); tail_tip.render(f5); main.render(f5); R_ear.render(f5); L_ear.render(f5); snout_top.render(f5); snout_bot.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, null); } } Thank you for your time and help!
November 15, 201410 yr Author Wow, I'm pretty surprised at how simple a change that was! How did you find that bug, if you don't mind me asking? Was it just by looking through the Model base that I made? Because I can't seem to find it in the crash log at all.
November 15, 201410 yr That bug has been in Techne a long time now, so we know where to look if there's a NPE in the model class. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
November 15, 201410 yr Author I see! Gotcha. Also I don't want to spam up the forums, so can I get help on something unrelated? For some reason, my mcmod.info file refuses to work. I have a screenshot of the file and my mod setup here. Also made the silly mistake of putting my constants as string literals rather than fields of a class, but upon taking out the parentheses, my main class is unable to find the Constants class. Here is how the file shows up on the console (before I took out the parentheses): And here is my (very short) Constants class from my lib folder: package ruirui.minecraft.livelyanimals.lib; public class Constants { public static final String MODID = "livelyanimals"; public static final String MODNAME = "Lively Animals"; public static final String VERSION = "0.1"; }
November 15, 201410 yr Well, your mod setup is kinda weird. You have java and resources source folders, but they need to be src/main/java and src/main/resources . Maybe that's what's wrong. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
November 15, 201410 yr Do you have a @Mod tag in your main mod file? I have a similar working setup as following: @Mod(modid = Constants.MODID, name = Constants.NAME, version = Constants.VERSION) Also, is your mod in a different java project? Because I see that you got a Minecraft project AND a "LivelyAnimals" project that your files are located in. Try moving the java files into the Minecraft project under "src/main/java" and the mcmod.info to "src/main/resources" (As noted by Iarsgerrits) --Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--
November 17, 201410 yr Author Moved the files as suggested, but it still does not work unfortunately. Oh Eclipse, you are a piece of work. I took out my files and then did refresh-dependencies to see if I could fix it that way, and now the only thing that shows up in the workspace is HerdCraft and when I go to add existing projects into the workspace, it says "No projects are found to import".
November 18, 201410 yr Author Okay, whatever. mcmod.info is pretty much the least important part of the mod anyway. New problem: Can't seem to find my texture. LARenderPig (same as RenderPig, just with the texture locations swapped) package ruirui.minecraft.livelyanimals; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityPig; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class LARenderPig extends RenderLiving { private static final ResourceLocation saddledPigTextures = new ResourceLocation(LivelyAnimals.AID, "textures/animals/LAPig.png"); private static final ResourceLocation pigTextures = new ResourceLocation("textures/animals/LAPig.png"); private static final String __OBFID = "CL_00001019"; public LARenderPig(ModelBase p_i1265_1_, ModelBase p_i1265_2_, float p_i1265_3_) { super(p_i1265_1_, p_i1265_3_); this.setRenderPassModel(p_i1265_2_); } /** * Queries whether should render the specified pass or not. */ protected int shouldRenderPass(EntityPig p_77032_1_, int p_77032_2_, float p_77032_3_) { if (p_77032_2_ == 0 && p_77032_1_.getSaddled()) { this.bindTexture(saddledPigTextures); return 1; } else { return -1; } } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityPig p_110775_1_) { return pigTextures; } /** * Queries whether should render the specified pass or not. */ protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_) { return this.shouldRenderPass((EntityPig)p_77032_1_, p_77032_2_, p_77032_3_); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityPig)p_110775_1_); } } Folder layout: I've also tried "assets/textures/animals/LAPig.png" and "ruirui/assets/textures/animals/LAPig.png". LivelyAnimals.AID is just "livelyanimals".
November 18, 201410 yr Author Sorry, but I'm still not sure what to put. I tried to put the full path name and it failed.
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.