Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FDUTCH committed Jan 13, 2025
1 parent 8df259d commit ff6a673
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions server/block/bed.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ type velocityEntity interface {
}

// NeighbourUpdateTick ...
func (b Bed) NeighbourUpdateTick(pos, _ cube.Pos, w *world.Tx) {
if _, _, ok := b.side(pos, w); !ok {
w.SetBlock(pos, nil, nil)
func (b Bed) NeighbourUpdateTick(pos, _ cube.Pos, tx *world.Tx) {
if _, _, ok := b.side(pos, tx); !ok {
breakBlockNoDrops(b, pos, tx)
}
}

Expand Down Expand Up @@ -207,7 +207,7 @@ func (b Bed) head(pos cube.Pos, w *world.Tx) (Bed, cube.Pos, bool) {
return Bed{}, cube.Pos{}, false
}
if b.Head {
headSide, headPos = b, pos
return b, pos, true
}
return headSide, headPos, true
}
Expand Down
13 changes: 7 additions & 6 deletions server/block/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,13 @@ func init() {
registerAll(allComposters())
registerAll(allConcrete())
registerAll(allConcretePowder())
registerAll(allCopper())
registerAll(allCopperDoors())
registerAll(allCopperGrates())
registerAll(allCopperTrapdoors())
registerAll(allCoral())
registerAll(allCoralBlocks())
registerAll(allDecoratedPots())
registerAll(allDeepslate())
registerAll(allDoors())
registerAll(allDoubleFlowers())
Expand Down Expand Up @@ -185,6 +190,7 @@ func init() {
registerAll(allPumpkins())
registerAll(allPurpurs())
registerAll(allQuartz())
registerAll(allRespawnAnchors())
registerAll(allSandstones())
registerAll(allSeaPickles())
registerAll(allSigns())
Expand All @@ -206,12 +212,6 @@ func init() {
registerAll(allWheat())
registerAll(allWood())
registerAll(allWool())
registerAll(allDecoratedPots())
registerAll(allCopper())
registerAll(allCopperDoors())
registerAll(allCopperGrates())
registerAll(allCopperTrapdoors())
registerAll(allRespawnAnchors())
}

func init() {
Expand Down Expand Up @@ -335,6 +335,7 @@ func init() {
world.RegisterItem(ResinBricks{Chiseled: true})
world.RegisterItem(ResinBricks{})
world.RegisterItem(Resin{})
world.RegisterItem(RespawnAnchor{})
world.RegisterItem(Sand{Red: true})
world.RegisterItem(Sand{})
world.RegisterItem(SeaLantern{})
Expand Down
6 changes: 4 additions & 2 deletions server/block/respawn_anchor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
type RespawnAnchor struct {
solid
bassDrum

// Charge is the Glowstone charge of the RespawnAnchor.
Charge int
}

Expand All @@ -22,7 +24,7 @@ func (r RespawnAnchor) LightEmissionLevel() uint8 {

// EncodeItem ...
func (r RespawnAnchor) EncodeItem() (name string, meta int16) {
return "minecraft:respawn_anchor", int16(r.Charge)
return "minecraft:respawn_anchor", 0
}

// EncodeBlock ...
Expand Down Expand Up @@ -65,7 +67,7 @@ func (r RespawnAnchor) Activate(pos cube.Pos, clickedFace cube.Face, tx *world.T
}
sleeper.Messaget(chat.MessageRespawnPointSet)
w.SetPlayerSpawn(sleeper.UUID(), pos)
return false
return true
}
tx.SetBlock(pos, nil, nil)
ExplosionConfig{
Expand Down
2 changes: 1 addition & 1 deletion server/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ func (p *Player) Wake() {
}
p.sleeping = false

tx := p.Tx()
tx := p.tx
tx.BroadcastSleepingIndicator()

for _, v := range p.viewers() {
Expand Down
7 changes: 2 additions & 5 deletions server/world/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ func (t ticker) tick(tx *Tx) {

rain, thunder, tick, tim := w.set.Raining, w.set.Thundering && w.set.Raining, w.set.CurrentTick, int(w.set.Time)

sleep := false
if tx.w.set.RequiredSleepTicks > 0 {
tx.w.set.RequiredSleepTicks--
if tx.w.set.RequiredSleepTicks <= 0 {
sleep = true
t.tryAdvanceDay(tx)
}
}

Expand All @@ -81,9 +80,7 @@ func (t ticker) tick(tx *Tx) {
}
}
}
if sleep {
t.tryAdvanceDay(tx)
}

if thunder {
w.tickLightning(tx)
}
Expand Down

0 comments on commit ff6a673

Please sign in to comment.