Jump to content

[1.7.10] Client crash on attempt to access World.isRemote


Recommended Posts

Posted (edited)

Title is pretty explanatory. Debugging a crash related to spawning an item revealed that my World object has no isRemote member.

 

Stack trace for crash

Spoiler

java.lang.NullPointerException at net.minecraft.entity.DataWatcher.func_75687_a(SourceFile:303) at net.minecraft.client.network.NetHandlerPlayClient.func_147284_a(NetHandlerPlayClient.java:452) at net.minecraft.network.play.server.S1CPacketEntityMetadata.func_148833_a(SourceFile:41) at net.minecraft.network.play.server.S1CPacketEntityMetadata.func_148833_a(SourceFile:11) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

Code

@Override
    public boolean onBlockActivated(World world, int parX, int parY, int parZ, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
        Item heldItem = player.getHeldItem().getItem();

        if( (PollenScoopItem) heldItem != null && !world.isRemote ) // Debugger tells me that world doesnt have a "isRemote" member
        {
            PollenItem pollenItem = new PollenItem();
            pollenItem.setGenetics( ( (PlantTileEntity) world.getTileEntity(parX, parY, parZ) ).geneticMaterial );
            EntityItem pollen = new EntityItem(world, parX, parY, parZ, new ItemStack( pollenItem, 1));
            world.spawnEntityInWorld(pollen);
        }

        return false;
    }

 

Pretty sure this has nothing to do with a broken world object or anything crazy like that, I most likely haven't sided things correctly.

Thanks,

Tez

Edited by tezuni
Posted

That can't be due to sided issues because isRemote is intended specifically to be used on both sides. 

 

But what do you mean that the debugger says there is no isRemote member? You shouldn't even be able to compile or run code if the class doesn't have a member. Is Eclipse warning you in the source code that there is a problem? Did you choose to run with errors or something?

 

If Eclipse is warning you about error then maybe you did the wrong import for the World class.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted (edited)
52 minutes ago, jabelar said:

That can't be due to sided issues because isRemote is intended specifically to be used on both sides. 

 

But what do you mean that the debugger says there is no isRemote member? You shouldn't even be able to compile or run code if the class doesn't have a member. Is Eclipse warning you in the source code that there is a problem? Did you choose to run with errors or something?

 

If Eclipse is warning you about error then maybe you did the wrong import for the World class.

I attached the IntelliJ debugger to my client and set a breakpoint on:

Item heldItem = player.getHeldItem().getItem();

 

It reported to me that isRemote did not exist.

Other data reported by the debugger was correct so I have no suspicions that this is an issue with my debugger / jvm.

Additionally note that I am building on forge 10.13.4.1492 for MC 1.7.10

 

Edit: Attached is a screenshot of debugger watches. As you can see I have a valid world object. To my knowledge this shouldn't have compiled, which leads me to believe the problem is rooted elsewhere.

 

Capture.PNG

Edited by tezuni
  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.