szeweq / Flux

Repositiory for Flux Machinery (Energy and processing Mod for Minecraft) and Flux Library
https://szeweq.xyz/flux/home
MIT License
1 stars 2 forks source link

[1.15.2] Machines can go to negative energy. #5

Closed ProsperCraft closed 4 years ago

ProsperCraft commented 4 years ago

2020-02-04_21 06 48

flux-4.5.1

Modpack - https://www.curseforge.com/minecraft/modpacks/towncraft/

TownCraft 2 the 1.15.2 version.

szeweq commented 4 years ago

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.

ProsperCraft commented 4 years ago

come test with us on the server :)

I can do more testing and screenshots when I get home from work.

DemianTV commented 4 years ago

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

szeweq commented 4 years ago

I have found the cause of this. Server sends data values (including energy) as shorts in "non-local SMP". These values are the proof:

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.