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

I can easily detect collisions with other entities in my custom entities, but I'm trying to detect them in vanilla entities.  Since there's no EntityCollision event, I've heard of people polling for collisions via player update events or entityLiving update events, but so far I'm not seeing how I'd go about grabbing that info.  I have a pretty decent understanding of Java and the Minecraft API, so I don't need a lot of details on how to code it; I just need someone to point me in the right direction.  I'm looking for entity/entity collisions and entity/player collisions.

 

By the way, I'd like to make this work with both 1.7 and 1.12.  Would it require similar or different techniques for each version?

 

Thanks in advance!

  • Author

By the way, the way I'm currently trying is Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity() and setting the AABB to the bounding box of the entity and excluding itself.  Seems to work most of the time, but not always.

 

Is there a better way?

10 hours ago, DocBrian said:

Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity() and setting the AABB to the bounding box of the entity and excluding itself.  Seems to work most of the time, but not always.

You could try interpolating the bounding boxes based on time, this might not work very well though.

10 hours ago, DocBrian said:

1.7

Sorry we don't support 1.7 on this forum anymore due to its age (4+ years old). We simply don't know how to help you anymore.

I think theres an onEntityCollideWithEntity method or something that you can override?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

13 hours ago, DocBrian said:

I'm currently trying is Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity() and setting the AABB to the bounding box of the entity and excluding itself.  Seems to work most of the time, but not always.

One reason that it may not always work is that I'm guessing the method only looks for entities that have their origin point within that range.  Ie. something with a large bounding box (like the ender dragon) could have its origin point (the point referred to by its posX, etc) outside your entity's bounding box, but still have a (large) part of its own bounding box overlapping that of your entity.

 

This is all assuming the method you posted doesn't account for entity bounding boxes when you give it a range.

26 minutes ago, Laike_Endaril said:

One reason that it may not always work is that I'm guessing the method only looks for entities that have their origin point within that range

World#getEntitiesWithinAABBExcludingEntity(or rather Chunk#getEntitiesWithinAABBForEntity) iterates all entities and checks whether their bounding boxes intersect with the passed one.

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.