@@ -42,8 +42,8 @@ func (Bed) SideClosed(cube.Pos, cube.Pos, *world.Tx) bool {
4242
4343// BreakInfo ...
4444func (b Bed ) BreakInfo () BreakInfo {
45- return newBreakInfo (0.2 , alwaysHarvestable , nothingEffective , oneOf (b )).withBreakHandler (func (pos cube.Pos , tx * world.Tx , _ item.User ) {
46- headSide , _ , ok := b .head (pos , tx )
45+ return newBreakInfo (0.2 , alwaysHarvestable , nothingEffective , oneOf (b )).withBreakHandler (func (pos cube.Pos , w * world.Tx , _ item.User ) {
46+ headSide , _ , ok := b .head (pos , w )
4747 if ! ok {
4848 return
4949 }
@@ -201,8 +201,8 @@ func (b Bed) DecodeNBT(data map[string]interface{}) interface{} {
201201}
202202
203203// head returns the head side of the bed. If neither side is a head side, the third return value is false.
204- func (b Bed ) head (pos cube.Pos , tx * world.Tx ) (Bed , cube.Pos , bool ) {
205- headSide , headPos , ok := b .side (pos , tx )
204+ func (b Bed ) head (pos cube.Pos , w * world.Tx ) (Bed , cube.Pos , bool ) {
205+ headSide , headPos , ok := b .side (pos , w )
206206 if ! ok {
207207 return Bed {}, cube.Pos {}, false
208208 }
@@ -213,14 +213,14 @@ func (b Bed) head(pos cube.Pos, tx *world.Tx) (Bed, cube.Pos, bool) {
213213}
214214
215215// side returns the other side of the bed. If the other side is not a bed, the third return value is false.
216- func (b Bed ) side (pos cube.Pos , tx * world.Tx ) (Bed , cube.Pos , bool ) {
216+ func (b Bed ) side (pos cube.Pos , w * world.Tx ) (Bed , cube.Pos , bool ) {
217217 face := b .Facing .Face ()
218218 if b .Head {
219219 face = face .Opposite ()
220220 }
221221
222222 sidePos := pos .Side (face )
223- o , ok := tx .Block (sidePos ).(Bed )
223+ o , ok := w .Block (sidePos ).(Bed )
224224 return o , sidePos , ok
225225}
226226
@@ -237,19 +237,7 @@ func (Bed) CanRespawnOn() bool {
237237 return true
238238}
239239
240- func (Bed ) RespawnOn (pos cube.Pos , u item.User , tx * world.Tx ) {}
241-
242- // SleepOn called to set Bed.Head if succeed startSleeping called.
243- func (b Bed ) SleepOn (pos cube.Pos , sleeper world.Sleeper , tx * world.Tx , startSleeping func () bool ) {
244- head , headPos , ok := b .head (pos , tx )
245- if ! ok {
246- return
247- }
248- if startSleeping () {
249- head .Sleeper = sleeper .H ()
250- tx .SetBlock (headPos , head , nil )
251- }
252- }
240+ func (Bed ) RespawnOn (pos cube.Pos , u item.User , w * world.Tx ) {}
253241
254242// RespawnBlock represents a block using which player can set his spawn point.
255243type RespawnBlock interface {
@@ -260,7 +248,7 @@ type RespawnBlock interface {
260248}
261249
262250// supportedFromBelow ...
263- func supportedFromBelow (pos cube.Pos , tx * world.Tx ) bool {
251+ func supportedFromBelow (pos cube.Pos , w * world.Tx ) bool {
264252 below := pos .Side (cube .FaceDown )
265- return tx .Block (below ).Model ().FaceSolid (below , cube .FaceUp , tx )
253+ return w .Block (below ).Model ().FaceSolid (below , cube .FaceUp , w )
266254}
0 commit comments