Skip to content

Commit

Permalink
block/copper_door.go: Fixed copper doors not dropping when breaking t…
Browse files Browse the repository at this point in the history
…he block under them.
  • Loading branch information
Sandertv committed Dec 15, 2024
1 parent 1044909 commit 721851d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 3 additions & 1 deletion server/block/copper_door.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ func (d CopperDoor) NeighbourUpdateTick(pos, changedNeighbour cube.Pos, tx *worl
tx.SetBlock(pos, d, nil)
}
} else if solid := tx.Block(pos.Side(cube.FaceDown)).Model().FaceSolid(pos.Side(cube.FaceDown), cube.FaceUp, tx); !solid {
breakBlock(d, pos, tx)
// CopperDoor is pickaxeHarvestable, so don't use breakBlock() here.
breakBlockNoDrops(d, pos, tx)
dropItem(tx, item.NewStack(d, 1), pos.Vec3Centre())
} else if b, ok := tx.Block(pos.Side(cube.FaceUp)).(CopperDoor); !ok {
breakBlockNoDrops(d, pos, tx)
} else if d.Oxidation != b.Oxidation || d.Waxed != b.Waxed {
Expand Down
9 changes: 1 addition & 8 deletions server/block/crop.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package block

import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/item"
"github.com/df-mc/dragonfly/server/world"
)

Expand All @@ -26,13 +25,7 @@ type crop struct {
// NeighbourUpdateTick ...
func (c crop) NeighbourUpdateTick(pos, _ cube.Pos, tx *world.Tx) {
if _, ok := tx.Block(pos.Side(cube.FaceDown)).(Farmland); !ok {
b := tx.Block(pos)
tx.SetBlock(pos, nil, nil)
if breakable, ok := b.(Breakable); ok {
for _, drop := range breakable.BreakInfo().Drops(item.ToolNone{}, []item.Enchantment{}) {
dropItem(tx, drop, pos.Vec3Centre())
}
}
breakBlock(tx.Block(pos), pos, tx)
}
}

Expand Down

0 comments on commit 721851d

Please sign in to comment.