Chisel-Team/ConnectedTexturesMod

LittleTiles connected textures compatibility

Closed this issue · 8 comments

Hey there,
LittleTiles is using the IFacade interface to support connected textures for it's custom blocks. Therefore it requires the BlockPos connection parameter (I requested it some time ago). Everything was working fine till the latest release of CTM (CTM - MC1.12.2-1.0.1.30).

Since then I have tried to debug the issue, but it doesn't occur in my workspace for some reason. I finally figured out that the connection parameter seems to be broken. It will always have the same value (which seems to differ every game start, but doesn't change afterwards). I looked at the recent commits of CTM, but could find anything suspicious.

Maybe you have an idea?

In Regards
CreativeMD

The same as in, the exact same position for all blocks, or the same as the position of that block? I don't do any caching of that position, so I don't see how it could persist between renders.

Exact same positions for all blocks. Looks like it gets set once the game launches. If you want to I can redo the test and send you some logs.

Not sure what to say in that case. The CTMExtendedState is created fresh in the block's getExtendedState every time. CTM does not cache it anywhere, so the caching must be happening in whatever mod owns the blocks.

Ok, I'm very confused by myself. I tested it many times, but as it turns out I was completely wrong :D Maybe I'm dump or I was very tired back then. Anyway, the position parameter works fine, so it's definitely not an issue on your end.

If I'm not mistaken the recent update uses a ChunkCache in RegionCache. Previously it used the world directly and that's why the newest update screwed up the connected textures of LittleTiles.

Let me explain
Not sure if you are familiar with LittleTiles, It's similar to c&b and microblocks. So there can be multiple "blocks" in one blockspace. Unfortunately there is no good way to add connected textures for it. My solution was kinda hacky. When my block is rendered I create a FakeWorld which fakes the currently rendered block at the position (source). This is done for all the different block types. Furthermore I had to clear out the state cache in RegionCache (source).

The problem is that there is no proper way to tell CTM which block it's supposed to be. This hack worked the versions before but if a ChunkCache is used the fake does not work anymore. I have no idea how to fix it. Maybe you have a better idea to do it? Would love to continue support connected textures.

Why do you need to clear out the state cache? It's always used ChunkCache, or more accurately whatever IBlockAccess impl is passed into getExtendedState.

Because it will remember faked blocks which results in some weird connection issues.

I need to know which block is currently being rendered in getFacade (source). Things would be a lot easier if the getFacade would pass the currently rendered block state instead of the position, but this is actually not the issue at the moment (as I can get it through other ways).

Not sure why the connection is broken at the moment, something must have changed in the last update.

I'm not sure what can be done at this point without breaking API. The IFacade API will be reconsidered in 1.15.

Yeah, no problem! People can use the older version without any issues.

I would be very happy if we could find a proper solution for 1.15. You can contact at any time, I will try to respond as fast as possible. Furthermore I will close this issue for now (as 1.12 will stay as it is).