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

[feat] Bedrock Sheep Colors #241

Merged
merged 10 commits into from Apr 1, 2023

Conversation

lonefelidae16
Copy link
Contributor

@lonefelidae16 lonefelidae16 commented Mar 20, 2023

Oooops I’m really sorry! I completely forgot about the code I wrote myself.

This branch was created as a feature for 1.19.3, but it also works on 1.19.4.


resolve #120

This enables the color of sheep wool to be displayed after shearing. It also supports a Disco sheep named “jeb_”.

A new configurable boolean sheepColors is available, and I haven’t added it to SettingsGUI. Please check BedrockifyClientSettings.java.

Also supports user modification by Resource pack. Thank you @Fuzss for your advice!

  • new file client.features.sheepColors.SheepSkinResource

    • create sheared sheep texture at runtime
  • update BedrockifyClientSettings

    • new field: boolean sheepColors
    • register new resource: SheepSkinResource
  • update BedrockIfyMixinPlugin

    • disable this feature when optifabric is present
  • registered mixin

    • mixin.client.features.sheepColors.SheepWoolFeatureRendererMixin

This enables the color of sheep wool to be displayed after shearing.

A new configurable boolean `sheepColors` is available, and I haven't added it to SettingsGUI. Please check `BedrockifyClientSettings.java`.

* update `BedrockifyClientSettings`
  - new field: boolean `sheepColors`

* registered mixin
  - `mixin.client.features.sheepColors.SheepWoolFeatureRendererMixin`

* new file
  - `assets/textures/entity/sheep_sheared.png`
@Fuzss
Copy link
Contributor

Fuzss commented Mar 25, 2023

In case you're interested, this mod uses a better approach to implementing this feature which is compatible with a lot of resource packs. The idea is to dynamically generate sheep_sheared.png at runtime from the vanilla sheared sheep texture. The pixels that need to be colorized can be filtered out dynamically since they use the grayscale color space, while other parts of the texture like skin don't.

@lonefelidae16
Copy link
Contributor Author

I checked it, yes it is very interesting approach.

So, how can I make only the skin transparent from the vanilla texture? If I choose to extract the part with zero saturation, this time even the eye color will change.

@Fuzss
Copy link
Contributor

Fuzss commented Mar 25, 2023

Yeah, I found that issue as well. My approach would be to simply ignore the upper 1-2% of grayscale space. Also limiting this rule to the face region of the texture file would make sense and limit a possible error with resource packs significantly. Might be important to determine the face region using relative uv coordinates since textures might have a higher resolution than vanilla.

I also went through a few resource packs and this approach seems to work well in theory.

@lonefelidae16
Copy link
Contributor Author

Hm... I see. It may take a while, but I’ll try it.

I agree with you that it would be more user-friendly to be able to change it easily from the resource pack, as you mentioned. Thank you for sharing this.

@lonefelidae16 lonefelidae16 marked this pull request as draft March 25, 2023 16:24
Supports the user modification by Resource pack.

If OptiFine is present, its functionality is spoiled by this feature.

* new file `client.features.sheepColors.SheepSkinResource`
  - create sheared sheep texture at runtime

* removed file
  - `assets/textures/entity/sheep_sheared.png`

* update `BedrockifyClient`
  - register a new runtime resource `SheepSkinResource`

* update `SheepWoolFeatureRendererMixin`
  - refers the Identifier that created in `SheepSkinResource`

* update `BedrockIfyMixinPlugin`
  - disable this feature when optifabric is present
@lonefelidae16 lonefelidae16 marked this pull request as ready for review March 26, 2023 02:15
@lonefelidae16
Copy link
Contributor Author

Confirmed with:

@juancarloscp52 juancarloscp52 merged commit e56d98d into juancarloscp52:1.19.4 Apr 1, 2023
@lonefelidae16 lonefelidae16 deleted the feat/sheep-colors branch May 3, 2023 13:07
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.

Suggestion: Bedrock's Sheep colors
3 participants