refactor: display blocks. fix item spin glitch on high tick rate - #48
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the display-block/container implementation and rendering timing to address an item spin glitch at high tick rates, while also extending display blocks with lock/unlock behavior and related localization.
Changes:
- Refactors single-slot display block entities to use
ContainerSingleItemAPIs and Data Components (LOCK,CONTAINER) instead of the priorContainer/inventory-style implementation. - Updates item display spin computation to use client tick timing (
Minecraft.clientTickCount) for smoother rotation behavior. - Adds lock/unlock UX messaging and new localization keys across English/Chinese resources (including generated lang output).
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/META-INF/accesstransformer.cfg | Exposes Minecraft.clientTickCount for renderer timing. |
| src/main/resources/assets/xkdeco/lang/zh_cn.json | Adds tip.xkdeco.block_unlocked localization key. |
| src/main/resources/assets/xkdeco/lang/en_us.existing.json | Adds tip.xkdeco.block_unlocked localization key. |
| src/main/java/org/teacon/xkdeco/client/renderer/ItemDisplayRenderer.java | Switches spin source to clientTickCount for non-fixed spin; updates item getter. |
| src/main/java/org/teacon/xkdeco/blockentity/SingleSlotContainerBlockEntity.java | Migrates to ContainerSingleItem + Data Components; introduces lock state and unlock logic. |
| src/main/java/org/teacon/xkdeco/blockentity/ItemDisplayBlockEntity.java | Simplifies projector check and fixed spin accessor behavior. |
| src/main/java/org/teacon/xkdeco/blockentity/BlockDisplayBlockEntity.java | Adapts to setTheItem and refactor-driven item flow. |
| src/main/java/org/teacon/xkdeco/block/ItemDisplayBlock.java | Uses Block.UPDATE_CLIENTS for powered updates; continues fixed-spin interactions. |
| src/main/java/org/teacon/xkdeco/block/DisplayBlock.java | Adds lock checking/unlock messaging; migrates interaction logic to ContainerSingleItem; initializes container component on item. |
| src/main/java/org/teacon/xkdeco/block/AirDuctBlock.java | Uses Block.UPDATE_SHAPE_ORDER for neighbor iteration order. |
| src/generated/resources/assets/xkdeco/lang/en_us.json | Regenerates en_us with the new tip translation. |
| src/generated/resources/.cache/190dc8cc9e260d5273a6d094a2d5cfe3ccdbd9b6 | Updates the generated lang cache hash. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
190
to
192
| public boolean canBeDestroyed(BlockState blockState, Level level, BlockPos pos, Player player, BlockHitResult hit) { | ||
| return !(level.getBlockEntity(pos) instanceof Container container) || container.isEmpty(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.