Connector icon indicating copy to clipboard operation
Connector copied to clipboard

Forgero and Sinytra incompatible textures caused by offsets being ignored

Open JorisDeBeer opened this issue 1 year ago • 4 comments

Mod Name

Forgero

Mod Homepage

https://modrinth.com/mod/forgero

Minecraft version

1.20.1

Describe the bug

Offset values on textures dont seem to work.

Steps to reproduce

  1. Add Forgero
  2. Start game
  3. Use upgrade station to modify tools
  4. Certain layers/textures do not seem to respect their offset values defined in files resulting in weird offcentered textures.

Logs

https://mclo.gs/uofuxgc

Additional context

We want to have full compat with sinytra and forge. So getting some help on this would be great. Everything else seems to work great. We want to know if there is a reason for this on the sinytra side before we start adjusting our textures to fit.

Also keep in mind I have a modified version of forgero that doesnt crash on startup, the modrinth one does atm because of a reach mixin.

There is no log needed as this there are zero crashes so thats pointless.

image

JorisDeBeer avatar Jul 12 '24 08:07 JorisDeBeer

Hi could you please send a screenshot of what the expected result is? I'll try to look into the issue

Su5eD avatar Jul 12 '24 13:07 Su5eD

Hi, thanks for looking into the issue!

This is a screenshot with connector: image

this is a screenshot on fabric: image

Another example with connector: image

The same on fabric: image

The only difference between these textures is the offset we specify in the json files as following:

(a photo of the json for the binding texture, where the other tools that dont have offsets work fine) image

(a photo of the json file for the gem, alot of offsets so the reason why this one is the most seen) image

Hopefully we can find a solution for this. Again keep in mind the modrinth version doesnt currently run with sinytra. If you need the modified version (without our broken mixin nothing else) just say it and I can send it your way!

JorisDeBeer avatar Jul 12 '24 17:07 JorisDeBeer

Hi! Mod author of Forgero here, just thought I would pop in and provide some context. That json follows a custom format that is specific for finding and correcting textures based on tools parts, it is only ever parsed and handled by my own code. So I would not spend a lot of time looking for issues in the json files.

Here is the code that is translating the offsets after the model has been built using an ItemModelGenerator that is building regular JsonUnbakedModel using a dynamically generated json formatted string. The goal is to dynamically build models on the fly based on the underlying structure of tools and parts. I would assume that if this approach could be problematic considering how Sinytra is interfacing with Forge, the issue might be in the translation somewhere, but if this should be fine, then the problem is very likely in my own code, and it is struggling to behave correctly in a Forge environment.

private void applyOffset(ModelElement element) {
        for (ModelElementFace face : element.faces.values()) {
            var offset = offsetMap.getOrDefault(face.textureId, new Offset(0, 0));
            if (offset.x() != 0 || offset.y() != 0) {
                element.from.add(offset.x(), offset.y(), 0);
                element.to.add(offset.x(), offset.y(), 0);
                break;
            }

        }
...
}

Source

Awesome work on the Sinytra project btw! :star:

SigmundGranaas avatar Jul 12 '24 17:07 SigmundGranaas

Any update on this? Otherwise I am gonna to start changing our offset textures, to make forgero more compatible with sinytra.

JorisDeBeer avatar Jul 23 '24 13:07 JorisDeBeer