[1.15.2] Machines can go to negative energy.
ProsperCraft opened this issue ยท 4 comments
flux-4.5.1
Modpack - https://www.curseforge.com/minecraft/modpacks/towncraft/
TownCraft 2 the 1.15.2 version.
come test with us on the server :)
I can do more testing and screenshots when I get home from work.
How did this happen? Which cables were used to power these machines?
I added some fixes to prevent sending negative amounts of energy but it may not be enough. I cannot reproduce this bug if i don't know which mod is supplying power to the machines.
Currently using a self modded Version of Flux 4.7.4 and this bug happens Multiplayer only.
The machine will stop at Energy < Required Energy at Singleplayer, while on the other hand the server doesnt check if theres enough energy to do the next tick, causind the negative energy amount. Also looking for a solution by myself
I have found the cause of this. Server sends data values (including energy) as shorts in "non-local SMP". These values are the proof:
- 1 000 000 -> 0xF4240 (max energy in Flux machines)
- 16960 -> 0x4240 (value shown on Client side)
This is actually documented in IContainerListener
class. It is very disappointing that every function handles integers correctly except the packet itself (SWindowPropertyPacket
class). The easiest solution is to split energy into two values.