jstN0body Posted September 22, 2021 Share Posted September 22, 2021 @SubscribeEvent public void onSizeChange(PlayerEvent.Size event) { if (!(event.getEntity() instanceof PlayerEntity)) return; EntitySize newSize; switch (event.getPose()) { case CROUCHING: newSize = EntitySize.fixed(0.6f * SizeMod.sizePercentage, 1.5f * SizeMod.sizePercentage); break; case SWIMMING: case FALL_FLYING: newSize = EntitySize.fixed(0.6f * SizeMod.sizePercentage, 0.6f * SizeMod.sizePercentage); break; case SLEEPING: newSize = EntitySize.fixed(0.2f * SizeMod.sizePercentage, 0.2f * SizeMod.sizePercentage); break; case DYING: newSize = EntitySize.fixed(0.01f, 0.01f); break; default: newSize = EntitySize.fixed(0.6f * SizeMod.sizePercentage, 1.8f * SizeMod.sizePercentage); } event.setNewSize(newSize); event.setNewEyeHeight(newSize.height * 0.9f); } I can't seem to figure out what's going wrong with my code. It seems like it should only affect players but any mob that spawns has its hitbox changed as well as any item that's dropped. Does anyone happen to know what's going on here? Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted September 23, 2021 Share Posted September 23, 2021 the Event dosen't exist in this class, it's in EntityEvent.Size, I think the Event was moved to the Entity class, because it affects all Entities Quote Link to comment Share on other sites More sharing options...
jstN0body Posted September 23, 2021 Author Share Posted September 23, 2021 Ok, but I still have the line if (!(event.getEntity() instanceof PlayerEntity)) return; so do you know why it's not only affecting players? Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted September 24, 2021 Share Posted September 24, 2021 use debugger and look what's wrong 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.