Skip to content

Commit

Permalink
server/block: Fix new copper block break infos
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy committed Nov 17, 2024
1 parent 32946c9 commit 8daad99
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion server/block/copper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ type Copper struct {

// BreakInfo ...
func (c Copper) BreakInfo() BreakInfo {
return newBreakInfo(3, pickaxeHarvestable, pickaxeEffective, oneOf(c))
return newBreakInfo(3, func(t item.Tool) bool {
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierStone.HarvestLevel
}, pickaxeEffective, oneOf(c)).withBlastResistance(30)
}

// Wax waxes the copper block to stop it from oxidising further.
Expand Down
8 changes: 3 additions & 5 deletions server/block/copper_door.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package block

import (
"fmt"
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/block/model"
"github.com/df-mc/dragonfly/server/item"
Expand Down Expand Up @@ -71,7 +70,6 @@ func (d CopperDoor) NeighbourUpdateTick(pos, changedNeighbour cube.Pos, w *world
} else if d.Oxidation != b.Oxidation || d.Waxed != b.Waxed {
d.Oxidation = b.Oxidation
d.Waxed = b.Waxed
fmt.Println("NeighbourUpdateTick 1", d, b)
w.SetBlock(pos, d, nil)
}
return
Expand All @@ -85,7 +83,6 @@ func (d CopperDoor) NeighbourUpdateTick(pos, changedNeighbour cube.Pos, w *world
} else if d.Oxidation != b.Oxidation || d.Waxed != b.Waxed {
d.Oxidation = b.Oxidation
d.Waxed = b.Waxed
fmt.Println("NeighbourUpdateTick 2", d, b)
w.SetBlock(pos, d, nil)
}
}
Expand Down Expand Up @@ -148,7 +145,6 @@ func (d CopperDoor) SneakingActivate(pos cube.Pos, _ cube.Face, w *world.World,
var ok bool
d.Oxidation, d.Waxed, ok = activateOxidizable(pos, w, user, d.Oxidation, d.Waxed)
if ok {
fmt.Println("SneakingActivate", d)
w.SetBlock(pos, d, nil)
return true
}
Expand All @@ -161,7 +157,9 @@ func (d CopperDoor) RandomTick(pos cube.Pos, w *world.World, r *rand.Rand) {

// BreakInfo ...
func (d CopperDoor) BreakInfo() BreakInfo {
return newBreakInfo(3, alwaysHarvestable, axeEffective, oneOf(d))
return newBreakInfo(3, func(t item.Tool) bool {
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierStone.HarvestLevel
}, pickaxeEffective, oneOf(d))
}

// SideClosed ...
Expand Down
4 changes: 3 additions & 1 deletion server/block/copper_grate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ type CopperGrate struct {

// BreakInfo ...
func (c CopperGrate) BreakInfo() BreakInfo {
return newBreakInfo(3, pickaxeHarvestable, pickaxeEffective, oneOf(c)).withBlastResistance(30)
return newBreakInfo(3, func(t item.Tool) bool {
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierStone.HarvestLevel
}, pickaxeEffective, oneOf(c)).withBlastResistance(30)
}

// Wax waxes the copper grate to stop it from oxidising further.
Expand Down
4 changes: 3 additions & 1 deletion server/block/copper_trapdoor.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ func (t CopperTrapdoor) RandomTick(pos cube.Pos, w *world.World, r *rand.Rand) {

// BreakInfo ...
func (t CopperTrapdoor) BreakInfo() BreakInfo {
return newBreakInfo(3, alwaysHarvestable, axeEffective, oneOf(t)).withBlastResistance(15.0)
return newBreakInfo(3, func(t item.Tool) bool {
return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierStone.HarvestLevel
}, pickaxeEffective, oneOf(t))
}

// SideClosed ...
Expand Down

0 comments on commit 8daad99

Please sign in to comment.