Skip to content

Conversation

@Zleub
Copy link

@Zleub Zleub commented Oct 14, 2025

Hello, this is a new provider for the mod, texture provider. The aim is to allow quick texture derivation as shown for processor blocks and water texture.

This is a proposition to get #295 out of the way without tweaking anything from a FluidBlock.

Copy link
Contributor

@immortius immortius left a comment

Choose a reason for hiding this comment

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

Overall this is looking like a good solution to our texture needs, and should also help with some of the motr needs as well (duplicating minecraft textures so that translucency/alpha can be applied).

sourceSets.main.resources { srcDir 'src/generated/resources' }

processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we expecting duplicates in the long term?

Copy link
Author

Choose a reason for hiding this comment

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

So, I got this added at the point where I had both textures, the original and the generated one. It seems that gradle copies over the generated ones when running the game and fail if no duplicate strategy is in place. There's only one discord message from mcjty that address this issue so I feel like we should keep it somehow even commented out

Idk how you want to handle that, let me know

this.textureOutput = textureOutput;
}

public void tintGenerator(ResourceLocation sourcePath, ResourceLocation destinationPath, int color) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Little thing, but I would suggest generateTinted or createTinted or even just tint - something a little more verb like.

Copy link
Author

Choose a reason for hiding this comment

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

Yep, makes sense

public void registerTextures(TextureGenerator textureGenerator) {
processorBlockColorMap.forEach((number, color) -> {
// Make all processor blocks textures
Arrays.stream(TextureVariant.values()).toList().forEach((variant) -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably could skip the toList in this.

import java.awt.Color;

public class TintTransform extends TextureTransform {
Color tint;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be private.

Copy link
Author

Choose a reason for hiding this comment

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

True

public ResourceLocation sourcePath;
public ResourceLocation destinationPath;

TextureTransform(ResourceLocation sourcePath, ResourceLocation destinationPath) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better public unless there is a good reason to have it package-private?

Copy link
Author

Choose a reason for hiding this comment

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

Is there any reason to have those derived in another place than the datagen\texture folder ? If no then package private is fine no ?

ResourceMetadata resourceMeta = input.metadata();
AnimationMetadataSection textureMeta = resourceMeta.getSection(AnimationMetadataSection.TYPE).orElse(null);

InputStream r = input.open();
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to ensure this is closed after use, either via a try-with-resources or an explicit close in a finally block.

Copy link
Author

Choose a reason for hiding this comment

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

So, as the java doc stated, this stream is closed after use by ImageIO.read (doc). I guess the edge case would be it to be null, which is going to be catch

@immortius
Copy link
Contributor

Oops, just realised this was still in draft, sorry >_<

@Zleub
Copy link
Author

Zleub commented Oct 16, 2025

Hey, no worries, I'm not the best at writing idiomatic java so those review are always welcomed

@WarrenGore
Copy link
Contributor

@Zleub Is there anything more you were looking to do with this? I see it is still a draft.

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