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

Generify Palettes Implementation #3178

Merged
merged 3 commits into from Nov 13, 2020
Merged

Generify Palettes Implementation #3178

merged 3 commits into from Nov 13, 2020

Conversation

gabizou
Copy link
Member

@gabizou gabizou commented Oct 5, 2020

SpongeAPI | SpongeCommon

This will bring the implementation of Palettes to be more inline with their mutability/immutability aspects, though I still have some questions to answer:

  • How do we want to handle a Palette being built by referring to a Minecraft owned Palette (like the case of BlockStates)
  • How do we want to make a Palette based on a Minecraft registry?
  • Should we always make immutable palettes when presented with a registry for the string serialization handling?

More to come as it gets fleshed out.

@gabizou gabizou marked this pull request as draft October 5, 2020 06:48
A Supplier normally would evaluate every single time being called, but in
some cases, we'd rather be able to memoize the value generated from the
Supplier after the first call. This is not meant to be leaked beyond memoizing
global objects that are referentially transparent themselves (like an object
being comprised of functions/suppliers that rely on other global variables).

Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
Traditionally, Mojang is appearing to want to store a BlockState as a map to better
suit DFU's ability to update a state's values and properties. This map based
representation however, is not ideal to being used for storage with a palette that
retains the integer to string like mapping internally. It may well be possible to
take advantage of DFU in the future, but at this time, a less breakage of the
Schematic Specification is required.

Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
Palettes are much more streamlined now, with global palettes being memoized functions
built off the global registries (meaning they are reload-aware) while copies can be
isolated by themselves and rebuilt however need be.

Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
@gabizou gabizou merged commit 77a6d32 into api-8 Nov 13, 2020
@gabizou gabizou deleted the api8/palettes branch November 13, 2020 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants