-
-
Notifications
You must be signed in to change notification settings - Fork 30
Datapack Control Animations #1974
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: main
Are you sure you want to change the base?
Conversation
fix: increment control
perf: cache console in generator
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.
Pull request overview
This pull request adds per-control animations for datapack consoles, allowing console controls to have customizable animations that reflect their state. The implementation introduces a new Transformations utility class, updates the control system to support animation references, and modifies rendering logic to apply per-control animations.
Changes:
- Added animation support to
ControlTypesallowing datapack consoles to define control-specific animations - Implemented
getTargetProgressmethod across all control classes to determine animation state - Created
Transformationsrecord to consolidate scale, offset, and rotation transformations
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tardim.geo.json | New Bedrock geometry file for a TARDIS model |
| Transformations.java | New utility class for managing model transformations (offset, scale, rotation) |
| ControlTypes.java | Added animation reference field and updated constructor to support per-control animations |
| Control.java | Added getTargetProgress method to determine animation progress based on control state |
| ControlRegistry.java | Added fallback method to return a default control when lookup fails |
| ConsoleControlEntity.java | Integrated animation state tracking and client/server synchronization for control animations |
| DatapackConsole.java | Updated to use Transformations class and support animation inheritance from parent consoles |
| ClientConsoleVariantRegistry.java | Enhanced texture/emission/model fallback logic with predicate-based parent lookup |
| ConsoleVariantRegistry.java | Updated syncing to use Transformations and added null safety check for parent() |
| BedrockConsoleModel.java | Implemented control animation application with caching and integration with console rendering |
| ConsoleBlockEntity.java | Added client-side control entity caching with periodic refresh for animation rendering |
| ConsoleRenderer.java | Changed render layer from EntityCutout to EntityTranslucentCull |
| ConsoleGeneratorRenderer.java | Added model caching and reordered transformation application |
| BedrockExteriorModel.java | Removed non-looping animation check that was logging errors |
| All Control implementations | Implemented getTargetProgress to expose control state for animations |
| IncrementControl.java, IncrementManager.java | Added methods to support animation progress calculation |
| PosControl.java | Changed shouldHaveDelay to return true |
| PowerControl.java | Removed unnecessary cast to ServerPlayerEntity |
| ControlAnimationState.java | Deleted file (replaced by TargetedAnimationState from amblekit) |
| gradle.properties | Updated amblekit version to support new animation features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import net.minecraft.entity.EntityDimensions; | ||
| import net.minecraft.util.Identifier; | ||
| import org.jetbrains.annotations.Nullable; | ||
| import org.joml.Vector3f; |
Copilot
AI
Feb 3, 2026
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.
Duplicate imports for EntityDimensions, Identifier, Vector3f, and Optional. These imports appear twice (lines 8/17, 10/18, 6/20, 22/14). Only one import for each is needed.
| import net.minecraft.entity.EntityDimensions; | |
| import net.minecraft.util.Identifier; | |
| import org.jetbrains.annotations.Nullable; | |
| import org.joml.Vector3f; | |
| import org.jetbrains.annotations.Nullable; |
| Control control = entity.getControl(); | ||
| if (control == null) return; | ||
|
|
||
| BedrockAnimation anim = this.animationCache.computeIfAbsent(entity.getControl().id(), k -> findAnimationById(entity)); |
Copilot
AI
Feb 3, 2026
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.
The animationCache uses the control ID as a key, but the lambda findAnimationById is only called once per control ID. If a control entity changes its animation reference, the cache will still return the old animation. Consider using a composite key that includes both the control ID and animation reference ID, or clearing the cache when animations change.
| if (cachedClientControls == null || this.age % CLIENT_CACHE_REFRESH_INTERVAL == 0) { | ||
| cachedClientControls = findControlEntitiesInWorld(); |
Copilot
AI
Feb 3, 2026
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.
The client-side cache refreshes every CLIENT_CACHE_REFRESH_INTERVAL ticks (2400 = 2 minutes). This means control entities that spawn or despawn won't be reflected in animations for up to 2 minutes. Consider reducing this interval or adding a mechanism to invalidate the cache when control entities are added/removed.
| "minecraft:geometry": [ | ||
| { | ||
| "description": { | ||
| "identifier": "geometry.unknown", |
Copilot
AI
Feb 3, 2026
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.
The geometry identifier is "geometry.unknown" (line 6). This should be changed to a more descriptive and unique identifier to avoid conflicts with other models and to make debugging easier. Consider using something like "geometry.tardim" or "geometry.ait.tardim".
| matrices.translate(-0.5, 1.5, 0.5); | ||
| bedrockConsoleModel.applyOffsets(matrices, entity.getConsoleVariant()); |
Copilot
AI
Feb 3, 2026
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.
The order of translate and applyOffsets was swapped. The translate is now before applyOffsets (line 92 before line 93), whereas in the old code it was after. This could change the visual positioning of the console model. Please verify this reordering is intentional and doesn't break the rendering.
| matrices.translate(-0.5, 1.5, 0.5); | |
| bedrockConsoleModel.applyOffsets(matrices, entity.getConsoleVariant()); | |
| bedrockConsoleModel.applyOffsets(matrices, entity.getConsoleVariant()); | |
| matrices.translate(-0.5, 1.5, 0.5); |
|
|
||
| @Environment(EnvType.CLIENT) | ||
| public void apply(MatrixStack stack) { | ||
| stack.translate(offset.x, offset.y * -1, offset.z); |
Copilot
AI
Feb 3, 2026
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.
The apply method performs offset.y * -1 (line 33), but this inversion is inconsistent with how offset.x and offset.z are handled. This might be intentional for coordinate system conversion, but should be documented in a comment to explain why Y is inverted.
|
loser review comments |
closes #1953