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

Make spawn egg colours visible #10158

Merged
merged 7 commits into from
Jan 27, 2024

Conversation

luisc99
Copy link
Contributor

@luisc99 luisc99 commented Jan 11, 2024

Adds an unsafe method for getting the underlying colour definitions for spawn eggs, based on the entity type. I recognise this is probably a fairly niche thing, but it can be useful to have a consistent way of getting some colours for entities when doing certain visual effects.

I've added this to UnsafeValues as it's accessing data directly from the SpawnEggItem class rather than reading data from an individual ItemStack's meta, although I'm happy for it to be moved somewhere more appropriate if desired.

The code is based on ItemFactory#getSpawnEgg, as found in this patch.

@luisc99 luisc99 requested a review from a team as a code owner January 11, 2024 19:14
@yannicklamprecht
Copy link
Contributor

Please squash commits in each submodule and rebuildPatches.

@luisc99
Copy link
Contributor Author

luisc99 commented Jan 14, 2024

Whoops, didn't notice it made a new patch, fixed

Copy link
Member

@Warriorrrr Warriorrrr left a comment

Choose a reason for hiding this comment

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

I think it might be nice to add getters for the background & highlight color to spawn egg meta, but currently also lgtm

Copy link
Member

@Machine-Maker Machine-Maker left a comment

Choose a reason for hiding this comment

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

If this wasn't in Unsafe, I would have some comments, but I think since it is, and therefore API compat isn't guaranteed, I think its fine.

Perhaps some more stable API can be added once we have subtypes of ItemType and BlockType in the API.

@Machine-Maker Machine-Maker force-pushed the spawn-egg-colour-visibility branch from b5271a0 to e2efd1e Compare January 27, 2024 18:17
@lynxplay lynxplay merged commit b333831 into PaperMC:master Jan 27, 2024
3 checks passed
lynxplay pushed a commit to lynxplay/paper that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

6 participants