Cuberite Forum

Full Version: Health message spam on very fast block breaks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This line:

m_Player->GetInventory().GetEquippedItem().m_ItemHealth ++;

in:
cClientHandle.cpp


What is its purpose?
I can see it increases the Player's current equipped item's m_ItemHealth by 1 every time a block is broken, but why?

I thought it may have something to do with durability, so I disabled the line, but durability on the item went down like normal.

This value can overflow if someone breaks a large amount of blocks with either their hand, or an item that doesn't use durability.

In creative mode I'd assume this value is useless.


Oh yeah, the LOG and LOGWARN functions are great!Big Grin
Yes, it's durability. When you don't increase the health serversided it's simulated on the client (which is what you saw)
(10-25-2011, 10:46 PM)FakeTruth Wrote: [ -> ]Yes, it's durability. When you don't increase the health serversided it's simulated on the client (which is what you saw)

I'll look into having the code check to see if the item in hand should have durability or not, and have the tool's durability checked against max durability for that item. Once reached the tool should be destroyed. I'm not sure how to destroy the item in hand yet, but the rest is easy to do.
Simple code, but it does the job:

http://code.google.com/p/mc-server/source/detail?r=12



Still need to check to see what block was broken. If you break dirt with an axe the durability should go up more than one.