McJtyMods / TheOneProbe

This simple mod adds a probe and an API for other mods to show information with that probe
MIT License
137 stars 67 forks source link

the one probe and moofluids bug #220

Open MadRatSRP opened 6 years ago

MadRatSRP commented 6 years ago

Hello. Cow model of mod MooFluids is flickering or blicking in the TheOneProbe interface. Please fix it if possible.

McJty commented 6 years ago

Please. More info: version number of mod, Minecraft. Also report this to MooFluids as it may very well be a bug on their side as well

MadRatSRP commented 6 years ago

Minecraft 1.12.2, MooFluids 1.7.11.02a, theoneprobe 1.4.19, top addons 1.2.1, i did.

Tora-B commented 5 years ago

So I've investigated this issue, and while Moo Fluids is probably doing something less than ideal (picking fluid too early, on entity construction, rather than on spawning or reading from NBT), this is fundamentally caused by TheOneProbe. It's creating a new entity every frame that the probe is displaying information about an entity. By the time Moo Fluids has set the fluid type correctly on the displayed entity, TheOneProbe is already creating a new one with a random fluid. Even if the behavior in Moo Fluids was corrected, TheOneProbe would probably either display the cow with no fluid, or it would flicker between none and the correct one.

Minecraft 1.12.2 forge-1.12.2-14.23.5.2768 theoneprobe-1.12-1.4.24 MooFluids-1.12.2-1.7.11.02a

McJty commented 5 years ago

I actually have to create that entity to be able to display it. I could potentially try to cache this so I'll see if that's a possibility

Tora-B commented 5 years ago

Theoretically, it should be possible to attach a second renderer to an existing entity, but I'd have to go digging into the Minecraft render code to see whether or not that's a reasonable approach.

Regardless, I would think you would create the entity when you create an ElementEntity, store it there for the lifetime of the ElementEntity, and pass it to the renderer, rather than reconstructing the entity every time you render.

McJty commented 5 years ago

Problem is that the Element tree is recreated every frame. I cannot easily reuse it since the data I get from the server might change. i.e. I don't know that the next tick the server will still send over the same data. So it is of course possible to make this smarter and cache but it isn't as easy as simply keeping the element tree

Tora-B commented 5 years ago

Keep it until you get different data? It seems like you don't have a synchronization model, so you're just blindly passing everything back and forth every time you need it, regardless of the cost. Keep state. Send messages when the state changes. Imagine if Minecraft synchronized all currently loaded chunks between the server and all the clients every tick.

McJty commented 5 years ago

Yes, but keeping it until I get different data means I need to cache that data and compare it to what I already have so that I know I have something to keep in the first place. i.e. 'state change detection' requires that the state is kept and compared. It is possible but not always as trivial