Botania

Botania

133M Downloads

Desync issue with mana tablets and manapools

Zaflis opened this issue ยท 2 comments

commented

This is a bit weird thing that happens when playing on server, and has happened as long as i've known Botania. When i first drain a little bit of mana to a mana tablet, i then see the durability of mana tablet very low as supposed to. But then i put it on empty manapool to fill the pool, the pool goes all the way full. Then i reconnect to server and i see the pool wasn't actually full, but only got the bit of mana that was on tablet. It just keeps animating the "lightning" forever pretty much (when filling the tablet too?).

So there should be some event on server that tells players that tablet no longer has any mana to send?

I think that the item texture on mana tablet isn't updating either, representing on how much mana is stored in it. Full should be blue-ish and empty white-ish.

commented

I can confirm these observations, with the following addition: right-clicking with the wand of the forest to check the current fill of the Pool causes the Pool's level to update accordingly.

commented

i always thought this was intentionally to not cause any update flood, but an "transfer finished" update would indeed be 1) nice to have, and 2) could also update with this "one" package sent the state of the involved item and the according mana pool (either sent on tablet full or tablet empty while resting on a mana pool only)
you could probably chaneg the transfer of your mana pool:

int manaVal = Math.min(transfRate, Math.min(getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
if(!worldObj.isRemote)
    mana.addMana(stack, manaVal);

if((mana.getMaxMana(stack) == mana.getMana(stack)) && manaVal > 0)
    sendUpdateToClient(mana,this);

recieveMana(-manaVal);

i can't remember is this needs to be guarded with worldObj.isRemote or not, but you get the idea :)