Skip to content

Refactor block material - #2997

Open
TomyLobo wants to merge 2 commits into
masterfrom
refactor-block-material
Open

Refactor block material#2997
TomyLobo wants to merge 2 commits into
masterfrom
refactor-block-material

Conversation

@TomyLobo

@TomyLobo TomyLobo commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator
  • Add BlockState.getMaterial()
  • Add ShapeType parameter to BlockMaterial.isFullCube

@TomyLobo
TomyLobo requested a review from a team as a code owner August 2, 2026 12:53
@TomyLobo
TomyLobo changed the base branch from version/7.3.x to master August 2, 2026 13:00
]
}
],
"Why on earth is this even an issue?": [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If someone was implementing BlockMaterial, this can sometimes cause weird issues that I don't recall exactly. But we should have the actual reasoning here, e.g.

Suggested change
"Why on earth is this even an issue?": [
"No one should be implementing BlockMaterial": [

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I moved that under "Removal of deprecated API for WorldEdit 8" and deprecated the method.
I think that's what we settled on as a long-term goal anyway when we discussed this a few months back.


import java.util.EnumSet;

public abstract class AbstractBlockMaterial<VS> implements BlockMaterial {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of having a VS parameter, can we just push getShape into isShapeFullBlock? There doesn't really seem to be an advantage to having it here.

Also, we should probably just call isShapeFullBlock -> isFullCubeUncached?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What about isFaceFull though?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It can have the same thing done to it as well? You literally just do isFaceFull(getShape(shapeType), face) and do not store the shape in any way.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made getShape a private helper instead of an overridden method and made the other methods take ShapeType directly
thought it'd be more code duplication, for some reason, but that didn't pan out when I actually tried it :)

@TomyLobo TomyLobo Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I also renamed the method as suggested (and the other one to isFaceFullUncached in the other PR, too)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems like this still has the type parameter on the class?

@me4502

me4502 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Also alongside octy's review, this currently does not compile, if you'd be able to please fix that too

@TomyLobo
TomyLobo force-pushed the refactor-block-material branch 4 times, most recently from 23ba7f5 to d4805b3 Compare August 16, 2026 13:49
@TomyLobo
TomyLobo force-pushed the refactor-block-material branch from c8b8ac1 to 1b9e3b1 Compare August 18, 2026 23:55
@TomyLobo
TomyLobo enabled auto-merge August 23, 2026 10:51
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.

3 participants