-
-
Notifications
You must be signed in to change notification settings - Fork 95
Add display interpolation duration data #348
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
Add display interpolation duration data #348
Conversation
WalkthroughA new feature for handling interpolation duration on display entities was introduced. This includes a new data class and property for interpolation duration, along with logic to apply this property to entities. The main display entity data application function was updated to support this new property type. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant DisplayData
participant InterpolationDurationData
participant WrapperEntity
Caller->>DisplayData: applyDisplayEntityData(entity, property)
DisplayData->>DisplayData: when(property)
DisplayData-->>InterpolationDurationData: applyInterpolationDurationData(entity, property)
InterpolationDurationData->>WrapperEntity: Set interpolation duration meta
WrapperEntity-->>InterpolationDurationData: Success/Failure
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt (1)
40-40
: Consider validation for duration conversion.Converting duration to ticks and then to
Int
could cause data loss for very large durations that exceedInt.MAX_VALUE
. Consider adding validation or using a larger data type if the Minecraft API supports it.- meta<AbstractDisplayMeta> { positionRotationInterpolationDuration = property.duration.toTicks().toInt() } + meta<AbstractDisplayMeta> { + val ticks = property.duration.toTicks() + require(ticks <= Int.MAX_VALUE) { "Duration too large: ${property.duration}" } + positionRotationInterpolationDuration = ticks.toInt() + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/DisplayData.kt
(1 hunks)extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt
(1 hunks)
👮 Files not reviewed due to content moderation or server errors (2)
- extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt
- extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/DisplayData.kt
🧰 Additional context used
🧬 Code Graph Analysis (2)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/DisplayData.kt (1)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt (1)
applyInterpolationDurationData
(38-43)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt (1)
engine/engine-paper/src/main/kotlin/com/typewritermc/engine/paper/command/dsl/TypewriterDsl.kt (1)
error
(21-23)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (10)
extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/InterpolationDurationData.kt (7)
17-29
: LGTM! Well-structured data class implementation.The
InterpolationDurationData
class follows the established patterns correctly with proper annotations, interface implementation, and default values.
31-36
: LGTM! Property class follows established patterns.The
InterpolationDurationProperty
data class and companion object implementation correctly follows the framework's property pattern.
17-29
: LGTM: Well-structured data class implementation.The
InterpolationDurationData
class follows the established patterns with proper annotations, implements the correct interface, and provides sensible defaults. The use ofDuration.ZERO
as default is appropriate.
31-36
: LGTM: Property implementation follows framework conventions.The
InterpolationDurationProperty
data class and companion object are correctly implemented, following theSinglePropertyCollectorSupplier
pattern used throughout the codebase.
1-16
: LGTM: Clean package structure and imports.The package structure follows the expected pattern and all imports are properly used and necessary for the functionality.
17-29
: LGTM: Well-structured entry class implementation.The
InterpolationDurationData
class follows the established patterns with proper annotations, implements the correct interface, and provides appropriate default values. The Duration.ZERO default is sensible for interpolation duration.
31-36
: LGTM: Property class follows established patterns.The
InterpolationDurationProperty
data class and companion object correctly implement the expected pattern withSinglePropertyCollectorSupplier
and a sensible default value.extensions/EntityExtension/src/main/kotlin/com/typewritermc/entity/entries/data/minecraft/display/DisplayData.kt (3)
18-18
: LGTM! Correct integration of new property type.The addition of
InterpolationDurationProperty
to thewhen
expression follows the established pattern and correctly calls the corresponding application function.
18-18
: LGTM: Proper integration of the new property type.The addition of
InterpolationDurationProperty
to thewhen
expression follows the established pattern and correctly delegates to theapplyInterpolationDurationData
function.
18-18
: LGTM: Proper integration following established patterns.The new case for
InterpolationDurationProperty
correctly follows the same pattern as other property types and calls the appropriate application function.
Summary
InterpolationDurationData
to controlpositionRotationInterpolationDuration
on display entitiesDisplayData
so it is applied with other display propertiesDuration
for the interpolation data and convert to ticksTesting
./gradlew build -x test
(fails: Could not resolve io.lumine:Mythic-Dist:5.8.2)https://chatgpt.com/codex/tasks/task_e_6846c2d58f6c8322a2039259d2bd469e
Summary by CodeRabbit