-
Notifications
You must be signed in to change notification settings - Fork 4
Animation Cleanup (2.4.4) #198
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
base: 1.21-1.21.3
Are you sure you want to change the base?
Changes from all commits
115c74b
264dce6
d743c08
c3d806a
2f37c9e
1dd96cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,49 @@ | ||
| # 2.4.3 | ||
| # 2.4.4 | ||
|
|
||
| ## Added | ||
|
|
||
| - New `AnimationExtraData` class for managing animation-related data with type-safe `DataTicket` support | ||
| - New `AnimationSnapshot` record to encapsulate immutable animation state (limbSwing, limbSwingAmount, partialTick, | ||
| isMoving) | ||
| - New `InterpolationData` record replacing `AnimationPoint` with added `getProgress()` method for calculating normalized | ||
| interpolation progress | ||
| - New `AnimationFrameVector` record to group X, Y, Z animation frames together | ||
| - Utility methods `isEmpty()` and `size()` added to `Animation` class | ||
| - `isWait()` helper method added to `Animation.Frame` record | ||
| - `toString()` method added to `Animation` and `AnimationState` for better debugging | ||
| - Input validation with `IllegalArgumentException` for negative ticks, non-positive play counts, and NaN animation | ||
| values | ||
| - New packet that syncs the Variant Name with all clients when changed on the server | ||
| - Shouldn't be necessary to add this manually, but due to a high amount of reports about desyncs, we added it just | ||
| to be sure | ||
|
|
||
| ## Changed | ||
|
|
||
| * Massive cleanup in the way we register Codecs and Data ComponentTypes. | ||
| - Renamed `Animation.Stage` to `Animation.Frame` for clearer semantics | ||
| - Renamed `AnimationPoint` to `InterpolationData` with updated field names (`animationStartValue` → `startValue`, | ||
| `animationEndValue` → `endValue`) | ||
| - Renamed `AnimationPointFrame` to `AnimationFrame` and moved to `frame` subpackage | ||
| - Renamed `getAnimationStages()` to `getAnimationFrames()` in `Animation` class | ||
| - Renamed `BoneSnapshot` to `BoneFrame` for consistency | ||
| - Refactored `BoneAnimationFrame` to be a final class instead of record to avoid a misleading immutable structure. | ||
| - Refactored `BoneAnimationFrame` to use `AnimationFrameVector` instead of individual X/Y/Z queues | ||
| - Renamed methods in `BoneAnimationFrame`: `addRotations` → `addNextRotation`, `addPositions` → `addNextPosition`, | ||
| `addScales` → `addNextScale` | ||
| - `AnimationState` now uses composition with `AnimationSnapshot` and `AnimationExtraData` instead of individual fields | ||
| - `getAnimationFrames()` now returns an unmodifiable list | ||
| - `getController()` in `AnimationState` now throws `IllegalStateException` if controller is not set | ||
| - `setControllerSpeed()` parameter changed from `Double` to primitive `double` | ||
| - `animationTick` field in `AnimationState` is now private with getter/setter methods | ||
| - Improved `equals()` and `hashCode()` implementations for `Animation` and `Animation.Frame` | ||
|
|
||
| ## Deleted | ||
|
|
||
| - Removed `AnimationPoint` class (replaced by `InterpolationData`) | ||
| - Removed individual rotation/position/scale queue fields from `BoneAnimationFrame` (consolidated into | ||
| `AnimationFrameVector`) | ||
| - Removed individual `addRotationXPoint`, `addRotationYPoint`, etc. methods (replaced with vector-based methods) | ||
|
|
||
| ## Bug Fixes | ||
|
|
||
| * Fixed a critical issue where Fabric Server where enable to be started due to trying to load Client sided Code on the | ||
| Server. | ||
| * Fixed a critical issue where Clients would crash when trying to send a Packet. | ||
| * Fixed a crash where the Client was looking for the Controller file. | ||
| - Fixed `equals()` method in `Animation` and `Animation.Frame` to properly compare field values instead of just hashCode | ||
| - Added proper null handling in `AnimationExtraData.set()` method |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright (C) 2024 BlueLib Contributors | ||
| * | ||
| * This Source Code Form is subject to the terms of the MIT License. | ||
| * If a copy of the MIT License was not distributed with this file, | ||
| * You can obtain one at https://opensource.org/licenses/MIT. | ||
| */ | ||
| package software.bluelib.client.net.variant; | ||
|
|
||
| import net.minecraft.client.Minecraft; | ||
| import net.minecraft.client.multiplayer.ClientLevel; | ||
| import net.minecraft.world.entity.Entity; | ||
| import net.minecraft.world.entity.LivingEntity; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import software.bluelib.api.net.ClientNetworkPacketHandler; | ||
| import software.bluelib.entity.variant.IVariantAccessor; | ||
| import software.bluelib.net.messages.client.variant.SetVariantPacket; | ||
|
|
||
| public class SetVariantPacketHandler implements ClientNetworkPacketHandler<SetVariantPacket> { | ||
|
|
||
| @Override | ||
| public void handle(@NotNull SetVariantPacket pPacket, @NotNull Minecraft pClient) { | ||
| pClient.execute(() -> { | ||
| ClientLevel level = pClient.level; | ||
| if (level == null) return; | ||
|
|
||
| Entity e = level.getEntity(pPacket.entityId()); | ||
| if (!(e instanceof LivingEntity living)) return; | ||
|
|
||
| ((IVariantAccessor) living).setEntityVariantName(pPacket.variant()); | ||
| }); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,8 +12,8 @@ | |
| public class LoggerConfig { | ||
|
|
||
| // TODO: BlueLib Logging should remain false by default | ||
| public static boolean isBlueLibLoggingEnabled = false; | ||
| public static boolean isLoggingEnabled = false; | ||
| public static boolean isBlueLibLoggingEnabled = true; | ||
| public static boolean isLoggingEnabled = true; | ||
|
Comment on lines
14
to
+16
|
||
| @ApiStatus.Internal | ||
| public static final boolean isExampleEnabled = false; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |||||||
| import org.jetbrains.annotations.NotNull; | ||||||||
| import org.jetbrains.annotations.Nullable; | ||||||||
| import software.bluelib.loader.animation.AnimationController; | ||||||||
| import software.bluelib.loader.animation.bone.BoneSnapshot; | ||||||||
| import software.bluelib.loader.animation.keyframe.BoneFrame; | ||||||||
| import software.bluelib.loader.geckolib.constant.dataticket.DataTicket; | ||||||||
|
|
||||||||
| public abstract class ContextAwareAnimatableManager<T extends BlueAnimatable, C> extends AnimatableManager<T> { | ||||||||
|
|
@@ -48,7 +48,7 @@ public void removeController(@NotNull String pName) { | |||||||
| return getManagerForContext(getCurrentContext()).getAnimationControllers(); | ||||||||
| } | ||||||||
|
|
||||||||
|
||||||||
| @Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entity.getServer()can be null (e.g., when called on the client), which would cause an NPE when callingNetworkRegistry.sendToAllPlayers(...). Also, sending to all players is broader than necessary for an entity-scoped update. Guard against a null server and prefer sending only to players tracking the entity (e.g., viasendToAllPlayersTrackingEntity).