@@ -42,8 +42,8 @@ func (Bed) SideClosed(cube.Pos, cube.Pos, *world.Tx) bool {
42
42
43
43
// BreakInfo ...
44
44
func (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 )
47
47
if ! ok {
48
48
return
49
49
}
@@ -201,8 +201,8 @@ func (b Bed) DecodeNBT(data map[string]interface{}) interface{} {
201
201
}
202
202
203
203
// 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 )
206
206
if ! ok {
207
207
return Bed {}, cube.Pos {}, false
208
208
}
@@ -213,14 +213,14 @@ func (b Bed) head(pos cube.Pos, tx *world.Tx) (Bed, cube.Pos, bool) {
213
213
}
214
214
215
215
// 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 ) {
217
217
face := b .Facing .Face ()
218
218
if b .Head {
219
219
face = face .Opposite ()
220
220
}
221
221
222
222
sidePos := pos .Side (face )
223
- o , ok := tx .Block (sidePos ).(Bed )
223
+ o , ok := w .Block (sidePos ).(Bed )
224
224
return o , sidePos , ok
225
225
}
226
226
@@ -237,19 +237,7 @@ func (Bed) CanRespawnOn() bool {
237
237
return true
238
238
}
239
239
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 ) {}
253
241
254
242
// RespawnBlock represents a block using which player can set his spawn point.
255
243
type RespawnBlock interface {
@@ -260,7 +248,7 @@ type RespawnBlock interface {
260
248
}
261
249
262
250
// supportedFromBelow ...
263
- func supportedFromBelow (pos cube.Pos , tx * world.Tx ) bool {
251
+ func supportedFromBelow (pos cube.Pos , w * world.Tx ) bool {
264
252
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 )
266
254
}
0 commit comments