Posted July 13, 20187 yr Is there some way to mark the player as having a pumpkin on his head without the pumpkin being there? Such as if the player held an item that had the same effect as wearing a pumpkin? Edited July 13, 20187 yr by ironkiller224
July 13, 20187 yr You can replace any entity's AI with your own version, since their AI task list is a public list. So whenever an Enderman spawns you would clear the AI target list and recreate it, but using your own version of the EntityEnderman.AIFindPlayer. So basically you would create your own class and copy the AIFindPlayer code into it. But you would modify it by replacing all the calls to shouldAttackPlayer() with your own version that look for PUMPKIN or your other item. Then you would handle the entity joins world event, check if the entity is an instanceof EntityEnderman and if it is you would clear the AI target list, and rebuilt it using your version of the AI class. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
July 13, 20187 yr Author 16 minutes ago, jabelar said: So basically you would create your own class and copy the AIFindPlayer code into it. But you would modify it by replacing all the calls to shouldAttackPlayer() with your own version that look for PUMPKIN or your other item. Where do I find the AIFindPlayer code?
July 13, 20187 yr AIFindPlayer is actually a sub-class within the EntityEnderman class itself. So just look at the source for the EntityEnderman class. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
July 13, 20187 yr Author this method is in the EntityEnderman.class and is what I am looking for. Thanks! private boolean shouldAttackPlayer(EntityPlayer player) { ItemStack itemstack = (ItemStack)player.inventory.armorInventory.get(3); if (itemstack.getItem() == Item.getItemFromBlock((Block)Blocks.PUMPKIN)) { return false; } Vec3d vec3d = player.getLook(1.0f).normalize(); Vec3d vec3d1 = new Vec3d(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)this.getEyeHeight() - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ); double d0 = vec3d1.lengthVector(); double d1 = vec3d.dotProduct(vec3d1 = vec3d1.normalize()); return d1 > 1.0 - 0.025 / d0 ? player.canEntityBeSeen((Entity)this) : false; }
July 13, 20187 yr Yes, that is the method I mentioned. You have to create your own version of that method, create your own version of the AI class that calls the method, then replace the AI every time an Enderman joins the world. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.