-
Notifications
You must be signed in to change notification settings - Fork 11
Fix methods for occupied state in Bed MaterialData #66
base: master
Are you sure you want to change the base?
Conversation
Setting the bed as occupied should not be possible unless occupied means something other than "there is a player in here" |
I don't get it, why shouldn't it be possible? |
Because a bed should not falsely report that a player is contained within the bed unless an actual player is within the bed. This would also be additional API that would need to be supported and is not clear as intended functionality. If there is a valid use case for this (that does not have a more optimal solution), I am willing to reconsider. |
I see, makes sense. Well, the use case is in the other PR - this is yet another of those "glowstone needs too much of bukkit to be able to do stuff" |
That's not a valid use case. Glowstone should, and can, still operate without a heavy dependency on Glowkit. Although it's easy, it should not be maintained as such. |
So, |
Without doing heavy review that does appear to be the solution, yes. |
I can remove the two new methods. As you said they aren't really necessary and might cause unexpected behavior.. |
The occupied state should remain read only. If a plugin plays with data values then they can deal with that consequence. The setter also doesn't appear to do anything that can't be done in Glowstone. |
I approve that statement and will update the PR accordingly.
That's correct. However Glowstone has to be able to modify the data value which it currently is not.
|
The get and set methods don't appear to need to be changed with the removal of the method. The only thing that would happen would be the removal of |
The Issue:
Currently there is no way to set whether a bed is occupied. Setting it using
Block.setData(byte)
does not work either (and is deprecated).Neither is it possible to do this in Glowstone itself as the
setFacingDirection
overrides the the occupied flag and thegetFacingDirection
produces incorrect results due to using a 3 bits mask (& 0x7
) instead of the necessary 2 bit mask (& 0x3
).PR Breakdown:
This PR adds methods to set and get whether a bed is occupied.It also fixes the
getFacingDirection
method by using the correct bit mask and thesetFacingDirection
by modifying the current data value instead of recalculating it.All changes should be backwards compatible.
While the new methods introduced can be omitted, the fixes for the other two methods are mandatory for correctly implementing beds in Glowstone.