Cuberite Forum
Health message spam on very fast block breaks - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Health message spam on very fast block breaks (/thread-189.html)



Health message spam on very fast block breaks - rs2k - 10-25-2011

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


RE: Health message spam on very fast block breaks - FakeTruth - 10-25-2011

Yes, it's durability. When you don't increase the health serversided it's simulated on the client (which is what you saw)


RE: Health message spam on very fast block breaks - rs2k - 10-26-2011

(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.


RE: Health message spam on very fast block breaks - rs2k - 10-26-2011

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.