Posted January 11, 201411 yr I copy fishing rod and edit its code. It's working good, but I have some problem. When I use fishing rod (original one) and don't pull it off, I save game and restart. When I join game, it cancelled and working without problem. However, I try same thing for new fishing rods and this.angler return null and game crashes. When I use new fishing rods this works and this.angler = player, return player. public EntityNewFishHook(World world, EntityPlayer player) { super(world); this.xTile = -1; this.yTile = -1; this.zTile = -1; this.inTile = 0; this.inGround = false; this.shake = 0; this.ticksInAir = 0; this.ticksCatchable = 0; this.bobber = null; this.ignoreFrustumCheck = true; this.angler = player; this.angler.fishEntity = this; this.setSize(0.25F, 0.25F); this.setLocationAndAngles(player.posX, player.posY + 1.62D - (double)player.yOffset, player.posZ, player.rotationYaw, player.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; float f = 0.4F; this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f); this.calculateVelocity(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); } But when I restart my game when the rod in use, this not working and return this.angler = null; So game crashes. How can I fix this problem? The problem is; ---- Minecraft Crash Report ---- // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~] Time: 10.01.2014 20:15 Description: Ticking entity java.lang.NullPointerException at acidmod.proxies.EntityNewFishHook.onUpdate(EntityNewFishHook.java:187) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:721) at net.minecraft.world.World.updateEntity(World.java:2311) at net.minecraft.world.World.updateEntities(World.java:2157) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:552) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:666) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at acidmod.proxies.EntityNewFishHook.onUpdate(EntityNewFishHook.java:187) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:721) at net.minecraft.world.World.updateEntity(World.java:2311) -- Entity being ticked -- Details: Entity Type: acidmod.Entity New Fish hook (acidmod.proxies.EntityNewFishHook) Entity ID: 108 Entity Name: entity.acidmod.Entity New Fish hook.name Entity's Exact location: 157,16, 62,90, 8,22 Entity's Block location: World: (157,62,, Chunk: (at 13,3,8 in 9,0; contains blocks 144,0,0 to 159,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: -0,00, -0,00, 0,00 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2157) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:552) -- Affected level -- Details: Level name: New World All players: 0 total; [] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: -503050008478225795 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (166,64,-, Chunk: (at 6,4,8 in 10,-1; contains blocks 160,0,-16 to 175,255,-1), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1) Level time: 223 game time, 223 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 72937 (now: false), thunder time: 167280 (now: false) Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:666) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) -- System Details -- Details: Minecraft Version: 1.6.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_45, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 841851600 bytes (802 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 1305 (73080 bytes; 0 MB) allocated, 1305 (73080 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 1, tallocated: 63 FML: MCP v8.04 FML v6.2.62.871 Minecraft Forge 9.10.1.871 4 mods loaded, 4 mods active mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{6.2.62.871} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{9.10.1.871} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available acidmod{0.0.1} [AcidMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 1032 (57792 bytes; 0 MB) allocated, 1032 (57792 bytes; 0 MB) used Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' and the line is; ItemStack itemstack = this.angler.getCurrentEquippedItem(); I check this section and this.angler return null; So I know the problem is this.angler returns null. Thanks.
January 16, 201411 yr It's an NPE, right? If you can, please show all your code that you think is part of the error, not just the constructor. I have an idea, but I need to see the code -Mitchellbrine Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible. It may be freaking fucking hard though, but still possible If you create a topic on Modder Support, live by this motto: I don't want your charity, I want your information
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.