fruehlingsrollen Posted October 15, 2022 Share Posted October 15, 2022 I have a custom entity that resizes accordingly to it's contents inside. I checked if the bounding box of the entity is correct after the resize and it is, the real problem is when I check for getEntitiesInAABB. With IntelliJ breakpoints I inspected the code and Chunk::getEntitiesWithinAABBForEntity does not find my custom entity, even when my player is right in it's bounding box. Whenever I spawn my entity without resizing it's contents the AABB check works fine, it only appears once I resize my entity and update it's bounding box. I really can't explain why this is happening and my only solution would be to check if the player is inside any of the custom entities at any given time, for that I would need access to every loaded entity in the world though, and I haven't found anything for that either. Help would be great! If you need any specific code snippets Im glad to share them Quote Link to comment Share on other sites More sharing options...
warjort Posted October 15, 2022 Share Posted October 15, 2022 Your question is unanswerable if you don't show the code. I can tell you that you need to call entity.refreshDimensions() to allow the game to recalculate everything size related after you change something that affects the dimensions. e.g. the game calls that method when an Ageable mob changes from a baby to an adult. Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post. Link to comment Share on other sites More sharing options...
fruehlingsrollen Posted October 15, 2022 Author Share Posted October 15, 2022 Okay so I've found the solution, thanks warjort because you led me to the assumption that I had to somewhere update the chunks that keep track of the entity. I took a look at Entity::resetPositionToBB and it had the line "if (this.isAddedToWorld() && !this.world.isRemote && world instanceof ServerWorld) ((ServerWorld)this.world).chunkCheck(this);" which is the solution to all my problems, so I just added it into my setPosition Override. Quote Link to comment Share on other sites More sharing options...
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.