Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] RandomPositionGenerator crashes Minecraft


ChaKha
 Share

Recommended Posts

I've been working on some custom AI for my custom mob (flying penguin), but I've currently run into a snag. I'm trying to set it like so:

public boolean shouldExecute() {
	if (theEntityCreature.worldObj.getClosestPlayerToEntity(theEntityCreature, 3.0D) == null) {
		return false;
	}
	Vec3 vec3 = RandomPositionGenerator.findRandomTarget((EntityCreature) theEntityCreature, 30, 10);//ERROR
        if (vec3 == null) {
            return false;
        } else {
            randPosX = vec3.xCoord;
            randPosY = vec3.yCoord;
            randPosZ = vec3.zCoord;
            return true;
        }
}

It crashes when it reaches the RandomPositonGenerator. What's wrong with it?

Link to comment
Share on other sites

Somehow I missed it in the console, but apparently its a class cast exception. I need a way to cast though. RandomPositionGenerator wants an EntityCreature, but I can't seem to cast from EntityPenguinMob (custom entity). How could I get around the cast?

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

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