Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine useAnimations feature #207

Merged

Conversation

lonefelidae16
Copy link
Contributor

@lonefelidae16 lonefelidae16 commented Jan 3, 2023

close #206

Bobbing animation with S2C network interaction.
It also works when played on a vanilla server.

Known issues

  • Non-mining tools such as “Flint and Steel” are always animated when destroying a block using it.
    Solved.
  • Using Bone Meal will cause double-bobbing due to ClientPlayerInteractionManager#interactItem returns ActionResult.SUCCESS and decreasing in stack.
    edit: Solved in commit: c2395f6 and da10b9d.
  • Firing Arrows with a Bow / Crossbow wont do bobbing animation until they get damage because there is no status to handle.
    • It is possible to define a brand new status in LivingEntity and handle it in ClientPlayerEntity, but this solution doesn’t work on a vanilla server. Also, there may be a conflict in the magic number of the statuses in a future update.
  • Extinguishing a lit candle still does not animate.

Bobbing animation with S2C network interaction.

* unregister mixin
  - `mixin.common.features.useAnimations.ItemStackMixin`

* new files
  - `client.features.useAnimatins.AnimationsHelper`
  - `mixin.client.features.useAnimations.ClientPlayerEntityMixin`
  - `mixin.client.features.useAnimations.ClientPlayerInteractionManagerMixin`
  - `mixin.client.features.useAnimations.ClientPlayNetworkHandlerMixin`
* update `AnimationsHelper.java`
  - new constant `COOLDOWN_TIME_MILLIS` based on Minecraft tick millis
  - new fields `lastBobbingStack` and `lastBobbingTime`
  - check the animated stack and the currentTimeMillis

* new files
  - `mixin.client.features.useAnimations.MinecraftClientAccessor`
  - `mixin.client.features.useAnimations.RenderTickCounterAccessor`

* some minor fixes
* constant has changed
  - `COOLDOWN_TIME_MILLIS` is now half of `ANIMATION_TIME` * tickTimeMillis
* boolean `pickupAnimations` has moved
  - BedrockifySettings#pickupAnimations -> BedrockifyClientSettings#pickupAnimations
@lonefelidae16
Copy link
Contributor Author

I will end my commit with this comment for now.

Works fine for me (and I enjoying on my server), but there are still issues:

  • Firing Arrows with a Bow / Crossbow do not animate until they get damage.
  • May cause a double-bobbing using tools. e.g.) Destroying any blocks, Extinguishing a campfire.
    • If this had prevented, mending tools by xp orb doesn’t animate.
  • Extinguishing a lit candle using tools still doesn’t animate.

Sorry for the many commits. If I should squash these, it doesn’t matter to combine them into a reasonable amount of granularity. But please note, it needs to FORCE push with -f option.

Please let me know if you have any further suggestions.

@juancarloscp52
Copy link
Owner

Hey! Sorry for the late response. I'll be testing this implementation and its differences with the previous one this week

@lonefelidae16
Copy link
Contributor Author

Thank you! Whenever you’re ready.

@juancarloscp52
Copy link
Owner

Looks good! I think that the remaining issues are not as noticeable, and is a comprehensible compromise for having item animations client-side.

Thank you.

@juancarloscp52 juancarloscp52 merged commit bcee18f into juancarloscp52:1.19.3 Jan 15, 2023
@lonefelidae16 lonefelidae16 deleted the feat/client-use-anim branch January 15, 2023 22:15
This was referenced Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refine feature] useAnimations impl on multiplayer
2 participants