Skip to content

Add strict ID types for BlockId and BlockStateId#3

Open
EpixScripts wants to merge 3 commits into
PumpkinPlugins:masterfrom
EpixScripts:strict-id-types
Open

Add strict ID types for BlockId and BlockStateId#3
EpixScripts wants to merge 3 commits into
PumpkinPlugins:masterfrom
EpixScripts:strict-id-types

Conversation

@EpixScripts

Copy link
Copy Markdown

Description

This helps prevent misuse of certain ID types as other ID types. I've already found a couple bugs, and I've left FIXMEs on some fluid code that seems to be using

This should be extended in the future to when registries are implemented, for all registries (yes I know the block state registry isn't a real registry but whatever)

Testing

No functionality changes other than correcting a block ID/block state ID confusion

@Commandcracker

Copy link
Copy Markdown

Should we use #[repr(transparent)] ?
I'm not a rust pro so i'm not sure

) -> BlockStateId {
fluid.default_state_index
}
// #[allow(clippy::too_many_arguments)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Whats up with this ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It was an unused function, I can remove it if you like

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

on_place is part of the fluid API I think it should not be removed as we might use it later on or expose it for plugins.

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