Skip to content

refactor: display blocks. fix item spin glitch on high tick rate - #48

Merged
Snownee merged 1 commit into
26.1.2-neoforgefrom
refactor-display
Jul 14, 2026
Merged

refactor: display blocks. fix item spin glitch on high tick rate#48
Snownee merged 1 commit into
26.1.2-neoforgefrom
refactor-display

Conversation

@Snownee

@Snownee Snownee commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ContainerSingleItem APIs and Data Components (LOCK, CONTAINER) instead of the prior Container/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();
}
@Snownee
Snownee merged commit efd1b2a into 26.1.2-neoforge Jul 14, 2026
1 check passed
@Snownee
Snownee deleted the refactor-display branch July 14, 2026 13:39
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.

2 participants