Posted January 31, 201510 yr Hi guys, I would really like to use this method: _vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom((EntityCreature)this.closestEntity, 8, 4, Vec3.createVectorHelper(this.closestEntity.posX, this.closestEntity.posY, this.closestEntity.posZ)); In my code, this.closestentity is the player ... and minecraft hate this with the following error. I would really like to use that method, but how come it cannot be use with an entity. Am I missing something ... ? java.lang.ClassCastException: net.minecraft.entity.player.EntityPlayerMP cannot be cast to net.minecraft.entity.EntityCreature What I am trying to do is for a water mob to flee away from the player when they get too close. Someone knows another method I could use?
January 31, 201510 yr You can't use it with EntityPlayer - only with entities that inherit from EntityCreature, which players do not. If you can't find another method that works for you, you could just look at the method and re-implement the logic but allow for any type of Entity, or perhaps EntityLivingBase. http://i.imgur.com/NdrFdld.png[/img]
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.