Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by ironkiller224

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/

  • 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?

  • 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;
    }

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.