Posted November 9, 20186 yr 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!
November 9, 20186 yr 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?
November 10, 20186 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
November 10, 20186 yr 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.
November 10, 20186 yr 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.