eutro / MultiblockTweaker

Add GregTech CE Multiblocks via CraftTweaker
GNU Lesser General Public License v3.0
8 stars 11 forks source link

Error with loading textures #9

Open hacatu opened 3 years ago

hacatu commented 3 years ago

With some blocks, multiblocktweaker seems to fail to load textures, reporting Error executing {[99:crafttweaker]: multiblocks/pizza_oven.zs}: Duplicate key TextureAtlasSprite{name='missingno', frameCount=1, rotated=false, x=2192, y=2112, height=16, width=16, u0=0.53515625, u1=0.5390625, v0=0.515625, v1=0.51953125}

The blocks I've had this problem with are twilight forest underbricks and chisel voidstone. For underbricks, the item is item:twilightforest:underbrick:0 and the is metastate:twilightforest:underbrick:0. However, when I let mbt infer the texture from the most common block in the design, it gives me the texture error. I'm 99.9% sure it also gives the same error if I use .withTexture on either the item or block form of underbricks.

I glanced over the code (the problem manifests SidedCubeRenderer.java:86) but I don't know the finer points of texture baking. I think it's caused by these blocks not being directly textured, instead they have blockstates which dictate other textures. The texture for underbrick with metadata 0 is really twilightforest:blocks/knightbrick. If I use .withTexture on that resource id the error goes away.

Here's the relevant part of the ct log and my script. About the .withTexture: lines: having no .withTexture line should reproduce the bug, and having the .withTexture(ICubeRenderer.nonSided("twilightforest:blocks/knightbrick")) line should have no error. Ignore the .withTexture(ICubeRenderer.fromBlock(<minecraft:brick_block>)) line.

crafttweaker.log.snip

pizza_oven.zs.snip

Also, the aisle orders are really confusing because the default for the pattern and design are different. In the design, aisles go left to right, arguments go bottom to top, and strings go front to back, but in the pattern, aisles go back to front, arguments go bottom to top, and strings go left to right. Patterns can have the order changed but designs can't.

eutro commented 3 years ago

If the blocks are using unconventional models there's really not much I can do to support them. The dedicated factory methods (sided and nonSided) are there for this purpose.

That said, the error could be handled and reported much better.

As for aisle orders and directions, there's unfortunately nothing I can do about that; I am simply wrapping GTCE's API.

hacatu commented 3 years ago

That's unfortunate, I did resort to using ICubeModel.nonSided. There's a lot of ways to handle block models and textures (especially chisel/ctm) which is kind of out of scope for mbt but it would be nice if ct could get the resource location of the texture of a block so it could easily be passed to mbt.

Yeah it looks like if you added a merge function to the toMap call you could find collisions due to not finding textures there or just use the first map entry with each key so the exception would be higher level.