Skip to content
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

Fix multiblock strcuture checking #2247

Merged
merged 3 commits into from
Oct 26, 2024

Conversation

Yefancy
Copy link
Collaborator

@Yefancy Yefancy commented Oct 25, 2024

What

This mixin is used to notify structure changes for multiblock. I added it based on vanilla code before, because gtm was based on multiple platform.

I didn't notice that the forge modifies LevelChunk code. They add a new feature (captureBlockSnapshots) to speed up blockstate updates. However, it will block multiblock strcuture validation checking in some cases.

There is no problem when breaking blocks, but nomore checking when placing blocks into structures.
I am surprised that this bug has not had an impact for so long. (Mainly, the act of placing blocks in pattern is barely(never) happens for multiblocks of gtm)

Implementation Details

original mixin injection:

if (!this.level.isClientSide && !this.level.captureBlockSnapshots) {
    // <!-here>
    state.onPlace(this.level, pos, blockstate, isMoving);
}

if (state.hasBlockEntity()) {
    // ......
}

new injection:

if (!this.level.isClientSide && !this.level.captureBlockSnapshots) {
    state.onPlace(this.level, pos, blockstate, isMoving);
}

// <!-here>
if (state.hasBlockEntity()) {
    // ......
}

@Yefancy Yefancy requested a review from a team as a code owner October 25, 2024 12:13
Copy link
Member

@screret screret left a comment

Choose a reason for hiding this comment

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

@screret
Copy link
Member

screret commented Oct 25, 2024

also, spotless.

@Yefancy
Copy link
Collaborator Author

Yefancy commented Oct 25, 2024

could you also remove https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/java/com/gregtechceu/gtceu/core/mixins/ForgeHooksMixin.java ?

oh, it got fixed. its also fine to keep current version.

@screret screret added the type: bugfix general bug fixes label Oct 25, 2024
@screret screret merged commit 8e68f88 into 1.20.1 Oct 26, 2024
2 of 3 checks passed
@screret screret deleted the kila/fix_multiblock_strcture_chaecking branch October 26, 2024 10:34
krossgg pushed a commit that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bugfix general bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants