Adityagupta Posted April 2, 2019 Posted April 2, 2019 I have created an entity that is ~70 blocks tall and ~6 blocks wide, and I have set its hitbox so that when I press F3 + B, it fills up the entire entity. However, I can only interact (hit) the bottom ~4 blocks, and when I look too far up, the entity disappears entirely (I think this is because the subchunk in which those ~4 blocks are in is not loaded). I have noticed the same issue with the vanilla giant mob, which also disappears at certain angles and also has a bugged hitbox. I have seen a few threads about this same problem, but none of them had a solution for this problem. Entity hitbox: Same view but a bit higher up: I tried setting ignoreFrustumCheck to true, as well as forcing some render methods to always return true for "should render", but none of that worked. The source code can be found here. The entity in question is here. Any ideas? Quote
DavidM Posted April 2, 2019 Posted April 2, 2019 11 minutes ago, Adityagupta said: when I look too far up, the entity disappears entirely AFAIK this s due to the chunk(s) the entity is in is being culled; there is not much you can do about it. One way too circumvent this problem would be to break your large entity into multiple smaller entity (like how "dragon" entities are handled in some mods). Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
Adityagupta Posted April 2, 2019 Author Posted April 2, 2019 1 minute ago, DavidM said: AFAIK this s due to the chunk(s) the entity is in is being culled; there is not much you can do about it. I know this is the problem, but wouldn't fixing the hitbox size put the entity in more chunks so it wouldn't be culled? Or can entities only be tied to a single chunk? If there isn't a fix for the hitbox/culling, I'll just go with multiple parts. Also, I saw an issue on Advanced Rocketry for the same problem, and it said there was a pull request that fixed it, but the same issue seems to be happening here. Quote
Laike_Endaril Posted April 3, 2019 Posted April 3, 2019 (edited) While I haven't looked into the actual code for it, I believe MC entities are only tied to a single chunk (ie. the chunk containing their origin point), which would cause these kinds of issues (based on several related forum/chat posts I've seen). Also, based on how the collision detection and several other systems work... Going along with the "I've seen posts of" line of thought, I've seen several posts suggesting to do as DavidM said, and split your entity into smaller parts, basically improving the "granularity" of what's culled due to chunk culling. Edit: I believe for entities which are holding still, you could just split the entity into one part per chunk, if you get my drift. For large moving entities, I'm guessing it would be better to have a pre-defined set of parts instead of trying to constantly recalculate entity sections based on chunk boundaries in relation to the entity Edited April 3, 2019 by Laike_Endaril Quote
Adityagupta Posted April 3, 2019 Author Posted April 3, 2019 Could a possible solution be to constantly move the origin of the entity so that it's always in the frustum and simply translate the model so it looks like it's staying in the same place? Quote
DavidM Posted April 3, 2019 Posted April 3, 2019 46 minutes ago, Adityagupta said: Could a possible solution be to constantly move the origin of the entity so that it's always in the frustum and simply translate the model so it looks like it's staying in the same place? If I understood correctly, no. Different players might be looking at different directions, but the entity can only have one position. Even if the mod is for single player only, the position of an entity shouldn't be abused for cosmetic (rendering) purposes; the position of an entity does a lot more than "keeping the entity visible", and messing with it can break other things. Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
Adityagupta Posted April 3, 2019 Author Posted April 3, 2019 14 minutes ago, DavidM said: Even if the mod is for single player only, the position of an entity shouldn't be abused for cosmetic (rendering) purposes; the position of an entity does a lot more than "keeping the entity visible", and messing with it can break other things. Good point, I think I'll just stick with multiple parts. Are IEntityMultiPart and MultiPartEntityPart (the ones used in EntityDragon) the best for this or is there a better method? Quote
Adityagupta Posted April 6, 2019 Author Posted April 6, 2019 I did some more testing and I found the point in vanilla where the bug was fixed. The bug exists up to snapshot 19w05a, but in 19w06a, it seems to be fixed. I can't seem to find the exact bug that caused it (https://minecraft.gamepedia.com/19w06a#Fixes), so does anyone know if there is a way to find out and maybe implement that in my own code? Quote
Recommended Posts
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.