SpaceWalkerRS / alternate-current

An efficient and non-locational redstone dust implementation
MIT License
203 stars 12 forks source link

TNT duper relying on block-updates not working #23

Closed sofianedjerbi closed 1 year ago

sofianedjerbi commented 1 year ago

Hello,

This TNT duper does not works with alternate-current. This might be related to MC-11193.

Front

Back

Inside

Usage: Use the noteblock Region file: https://file.io/TvsCwtlLgiiy

Works fine with eigencraft.

Minecraft version: 1.19.2 with 1.5 alternate-current TNT don't trigger at all.

SpaceWalkerRS commented 1 year ago

Thanks for the report! The good news is that I can reproduce the issue. The bad news is that I don't see a good way to fix it. You're right that it is related to MC-11193, and you mentioned the duper does work with Eigencraft, which got me curious, so I looked into that as well.

For context, this duper relies on a quirk in the way pistons move blocks. The new 'moving block' is placed before the old stationary block is removed, which means there's a brief window during which both the moving block and the old stationary block exist at the same time. This duper exploits that by updating a redstone wire in this brief window, igniting the old stationary TNT while the moving TNT has already been placed.

Now, notice that the wire that powers the TNT is also redirected by the observer. This is important because we only want to power the TNT in that brief window where the moving TNT is already placed. If the dust weren't redirected it would power the TNT too early. Thus, the observer is used to redirect the wire, and only when the moving TNT is placed, replacing the observer, is the dust directed into the block and able to power the TNT.

Unfortunately, a wire changing connections does not cause any block updates, or this would already be enough to make the duper work. Instead, we must rely on block updates caused by a wire changing its power level. That is where MC-11193 comes in. In Vanilla a wire that is part of a larger network (i.e. more than one wire connected to each other) will update its power level multiple times, each time only decreasing by 2 before it's finally fully depowered.

That is why this bug will be very hard for me to fix. The duper relies on updates caused by a wire changing its power level to update the TNT, which has to then still be powered by that wire, so it can ignite. But Alternate Current depowers the wire in the most efficient way (that is to say, all the way off immediately) and so when the TNT is updated, it is no longer being powered by the wire.

It looks like Eigencraft does something in between. It might update a wire's power level multiple times but it keeps track of it so it's not as chaotic as Vanilla. I haven't looked into how its algorithm works, so I can't give a proper explanation for it, but this is what I gathered from running it through the debugger lol.

Sorry for the lengthy post. I'm giving detailed explanations partially so as to have the issue documented for when I look at it again with fresh ideas to see if I can do anything to fix it.

chillfox commented 1 year ago

I ran into this issue trying to follow this Versatile Tree Farm tutorial by ianxofour.

evoandroidevo commented 1 year ago

Is there an update to this issue?

SpaceWalkerRS commented 1 year ago

Unfortunately, I don't think I'll be able to fix this without a major redesign or a janky hack fix. The duper ultimately relies on something this mod is specifically designed to fix. Any path I see to resolving this issue would lead to worse performance overall. I'm sorry to do it, but I think I'm gonna have to close this issue as "won't fix".

youmukonpaku1337 commented 7 months ago

https://youtu.be/povFs7-MjLQ a solution to this issue for ianxofour's farm, if anyone needs it