Drachenbauer Posted March 1, 2020 Posted March 1, 2020 Hello I have an entity, that changes it´s model to an inflated variant, if i collide with it in the game. How do i make ir change it´s collision-box- / boundingbox-size, too? Quote
imacatlolol Posted March 1, 2020 Posted March 1, 2020 Override Entity#getSize Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Drachenbauer Posted March 1, 2020 Author Posted March 1, 2020 In this method now i have an if else, that uses my already existing boolean to provide two size values. But it doesn´t change the size of the box, that i can see, if i press F3 and B. I have the structure, that changes the model: @Override public void livingTick() { if (timeUntilDeflating > 0) { timeUntilDeflating--; if (timeUntilDeflating == 0) { isInflated = false; } } else { super.livingTick(); } } @Override public void onCollideWithPlayer(PlayerEntity entityIn) { if (timeUntilDeflating == 0) { timeUntilDeflating = 80; isInflated = true; } } How do i now call it in there? Quote
Drachenbauer Posted March 1, 2020 Author Posted March 1, 2020 (edited) Bump: Now i found out, that i have to use recalculateSize(); there. But the bigger box doesn´t fit to his position... And if he is in water, he disappears after inflating (i was glitched into him, maybe that´s a reason, too) how do i fix this? Edit: now i use this to change his boundingbox: AxisAlignedBB aabb = this.getBoundingBox(); this.setBoundingBox(new AxisAlignedBB(aabb.minX + 0.5d, aabb.minY, aabb.minZ + 0.5d, aabb.maxX - 0.5d, aabb.maxY - 1.0d, aabb.maxZ - 0.5d)); I use it in "livengTick" and "onCollidewithPlayer" Now the key F3 + B shows his boundingbox matching his bodysize, but i can run through him... How do i make this boundingbox act as collisionbox and hitbox, too? Edited March 2, 2020 by Drachenbauer 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.