Skip to content

Commit

Permalink
block/vine.go: Check downward block is air or vines
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy committed Dec 20, 2024
1 parent 77409b5 commit bea236f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/block/vine.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ func (v Vines) RandomTick(pos cube.Pos, tx *world.Tx, r *rand.Rand) {
return
}

_, air := tx.Block(selectedPos).(Air)
newVines := tx.Block(selectedPos).(Vines)
if face == cube.FaceUp {
_, air := tx.Block(selectedPos).(Air)
if air {
if !v.canSpread(tx, pos) {
return
}
newVines := Vines{}
for _, f := range cube.HorizontalFaces() {
if r.Intn(2) == 0 && v.canSpreadTo(tx, selectedPos.Side(f)) {
newVines = newVines.SetAttachment(f.Direction(), v.Attachment(f.Direction()))
Expand All @@ -212,6 +212,11 @@ func (v Vines) RandomTick(pos cube.Pos, tx *world.Tx, r *rand.Rand) {
if selectedPos.OutOfBounds(tx.Range()) {
return
}
_, air := tx.Block(selectedPos).(Air)
newVines, vines := tx.Block(selectedPos).(Vines)
if !air && !vines {
return
}
var changed bool
for _, f := range cube.HorizontalFaces() {
if r.Intn(2) == 0 && v.Attachment(f.Direction()) && !newVines.Attachment(f.Direction()) {
Expand Down

0 comments on commit bea236f

Please sign in to comment.