fix(Physics): Fixed the physics of loose snow with leather boots.#358
fix(Physics): Fixed the physics of loose snow with leather boots.#358Semleks wants to merge 2 commits into
Conversation
adepierre
left a comment
There was a problem hiding this comment.
Thanks for the PR. I added a few comments if you want to take a look.
Powder snow has other interactions with the boots that are currently not handled (going down to the next block top surface when crouching, walking on them without sinking).
Are you interested in adding these too or is this PR limited to just the up direction?
Also it might be a good idea to add dedicated physics tests for the powder snow physics to be sure the implementation is correct. Feel free to let me know if it's something you want to do.
| player->speed.y = 0.2; | ||
| } | ||
|
|
||
| #if PROTOCOL_VERSION > 754 /* > 1.17+ */ |
There was a problem hiding this comment.
It should be > 1.17 without the + sign to be consistent with the repo
| )); | ||
|
|
||
| if (feet_block != nullptr && feet_block->IsPowderSnow()) { | ||
| const auto feet_slot = inventory_manager->GetPlayerInventory()->GetSlot(Window::INVENTORY_FEET_ARMOR); |
There was a problem hiding this comment.
There's no reason to use auto here it's a ProtocolCraft::Slot and with the using namespace we can just use Slot.
| static_cast<int>(std::floor(player->position.z)) | ||
| )); | ||
|
|
||
| if (feet_block != nullptr && feet_block->IsPowderSnow()) { |
There was a problem hiding this comment.
The { should be on the next line to be consistent with the rest of the codebase.
Also the condition in java code is this.wasInPowderSnow, did you check that your feet block check is the exact same thing (i.e. feet block check only and without a tick delay)?
Hi!
This PR addresses the TODO for powder snow physics and wearing leather boots inside the
PhysicsManager.What changed:
0.2speed when wearing leather boots and holding the jump key.leather_boots_iteminitialization to the constructor viaAssetsManagerto prevent version-specific ID hardcoding.feet_block->IsPowderSnow()), meaning we only read the inventory and incur ref-count operations when the bot is actually standing in powder snow.Let me know if this looks good to merge!