Skip to content

Commit

Permalink
make certain blocks PistonImmovable
Browse files Browse the repository at this point in the history
  • Loading branch information
xNatsuri committed Jan 9, 2025
1 parent a7a95b9 commit e11d3b7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/block/barrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func (Barrier) SideClosed(cube.Pos, cube.Pos, *world.Tx) bool {
return false
}

// PistonImmovable ...
func (Barrier) PistonImmovable() bool {
return true
}

// EncodeItem ...
func (Barrier) EncodeItem() (name string, meta int16) {
return "minecraft:barrier", 0
Expand Down
5 changes: 5 additions & 0 deletions server/block/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (b Beacon) Level() int {
return b.level
}

// PistonImmovable ...
func (Beacon) PistonImmovable() bool {
return true
}

// Tick recalculates level, recalculates the active state of the beacon, and powers players,
// once every 80 ticks (4 seconds).
func (b Beacon) Tick(currentTick int64, pos cube.Pos, tx *world.Tx) {
Expand Down
5 changes: 5 additions & 0 deletions server/block/bedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ func (b Bedrock) EncodeBlock() (name string, properties map[string]any) {
//noinspection SpellCheckingInspection
return "minecraft:bedrock", map[string]any{"infiniburn_bit": b.InfiniteBurning}
}

// PistonImmovable ...
func (Bedrock) PistonImmovable() bool {
return true
}
5 changes: 5 additions & 0 deletions server/block/enchanting_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func (EnchantingTable) LightEmissionLevel() uint8 {
return 7
}

// PistonImmovable ...
func (EnchantingTable) PistonImmovable() bool {
return true
}

// Activate ...
func (EnchantingTable) Activate(pos cube.Pos, _ cube.Face, tx *world.Tx, u item.User, _ *item.UseContext) bool {
if opener, ok := u.(ContainerOpener); ok {
Expand Down
5 changes: 5 additions & 0 deletions server/block/ender_chest.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func (c EnderChest) LightEmissionLevel() uint8 {
return 7
}

// PistonImmovable ...
func (EnderChest) PistonImmovable() bool {
return true
}

// SideClosed ...
func (EnderChest) SideClosed(cube.Pos, cube.Pos, *world.Tx) bool {
return false
Expand Down
5 changes: 5 additions & 0 deletions server/block/invisible_bedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ type InvisibleBedrock struct {
solid
}

// PistonImmovable ...
func (InvisibleBedrock) PistonImmovable() bool {
return true
}

// EncodeItem ...
func (InvisibleBedrock) EncodeItem() (name string, meta int16) {
return "minecraft:invisible_bedrock", 0
Expand Down

0 comments on commit e11d3b7

Please sign in to comment.