TeamMoegMC / TheWinterRescue

Use your hands and wisdom to ignite the last hope of mankind in the wind and snow ❄️ - Minecraft 1.16.5 Modpack
https://www.curseforge.com/minecraft/modpacks/the-winter-rescue
Other
59 stars 16 forks source link

[Bug] Mechanical calculator does not produce research points when there is a deployer with a rubbing tool acting on it #59

Closed gedeknepper closed 1 year ago

gedeknepper commented 1 year ago

Error Behaviour

Mechanical calculator does not produce research points when there is a deployer with a rubbing tool pointing at it

Expected Behaviour

Mechanical calculator should produce research points regardless of whether there is a deployer with a rubbing tool pointing at it.

Reproduce

Screenshot from 2022-12-27 22-18-20

As seen in the screenshot, place down a mechanical calculator, a deployer pointing at it, and power them both. If the deployer is unpowered, the mechanical calculator will produce research points until it's full (100/100 points); this should take about a minute, at maximum speed. If the deployer is powered, but empty-handed, the same result. Now unpower the calculator. Make a rubbing tool, bind it to an active research project by inspecting it in the drawing desk, and place it in the deployer. When the deployer deploys, the mechanical calculator is empty (0/100 points). Remove the rubbing tool and do the command "/data get entity @s SelectedItem". This will show that the rubbing tool now contains 100 points. Now place the rubbing tool back in the deployer, power the calculator, and wait for several minutes (long enough that the calculator should have produced points). Then remove the rubbing tool and do the command again. This shows that the rubbing tool still contains only 100 points, although it should have gathered more from the calculator.

A different test one can do is to bind a rubbing tool, put it in the deployer, then power the calculator. Wait a few minutes, then remove the rubbing tool. Do the /data command, and it is seen that the rubbing tool contains no points whatsoever, indeed the relevant tag is not even defined.

Conclusion: being acted on by a deployer with a rubbing tool somehow disables or resets the calculator's production of additional research points.

Crash Report

No response

Modpack version

0.5.4-hf1

Server version

No response

Other mods and plugins

No response

gedeknepper commented 1 year ago

Okay, I've found the problem myself. Look at this file: https://github.com/TeamMoegMC/FrostedHeart/blob/master/src/main/java/com/teammoeg/frostedheart/research/machines/MechCalcTileEntity.java

You've got this integer called "process", which basically counts "partial research points". When the calculator is powered and not full, process increments until it reaches the value processMax (currently 6400), at which point it's reset to 0, and currentPoints is incremented by 20. In onClick(), you call updatePoints(), which resets process to zero. This means that those "partial research points" are wasted every time the calculator is pressed.

Now, in my survival world, I set the speed of the deployer as low as possible using a speed controller. But, even this speed is too high; the calculator does not have time to get to 20 research points before it's forcibly reset by the deployer. Thus the rubbing tool is pretty much useless, until the code is rewritten.

khjxiaogu commented 1 year ago

You can use a redstone timer to do that, quite easy.
Here's my design. img

gedeknepper commented 1 year ago

Oh, so it's intentional? That... never even occurred to me. It's pretty counter-intuitive, imo. Maybe leave a note in the relevant quest book entry?