up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
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"
|
||||
"github.com/go-gl/mathgl/mgl64"
|
||||
)
|
||||
|
||||
// LitPumpkin is a decorative light emitting block crafted with a Carved Pumpkin & Torch
|
||||
type LitPumpkin struct {
|
||||
solid
|
||||
|
||||
// Facing is the direction the pumpkin is facing.
|
||||
Facing cube.Direction
|
||||
}
|
||||
|
||||
// LightEmissionLevel ...
|
||||
func (l LitPumpkin) LightEmissionLevel() uint8 {
|
||||
return 15
|
||||
}
|
||||
|
||||
// UseOnBlock ...
|
||||
func (l LitPumpkin) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, tx *world.Tx, user item.User, ctx *item.UseContext) (used bool) {
|
||||
pos, _, used = firstReplaceable(tx, pos, face, l)
|
||||
if !used {
|
||||
return
|
||||
}
|
||||
l.Facing = user.Rotation().Direction().Opposite()
|
||||
|
||||
place(tx, pos, l, user, ctx)
|
||||
return placed(ctx)
|
||||
}
|
||||
|
||||
// BreakInfo ...
|
||||
func (l LitPumpkin) BreakInfo() BreakInfo {
|
||||
return newBreakInfo(1, alwaysHarvestable, axeEffective, oneOf(l))
|
||||
}
|
||||
|
||||
// EncodeItem ...
|
||||
func (l LitPumpkin) EncodeItem() (name string, meta int16) {
|
||||
return "minecraft:lit_pumpkin", 0
|
||||
}
|
||||
|
||||
// EncodeBlock ...
|
||||
func (l LitPumpkin) EncodeBlock() (name string, properties map[string]any) {
|
||||
return "minecraft:lit_pumpkin", map[string]any{"minecraft:cardinal_direction": l.Facing.String()}
|
||||
}
|
||||
|
||||
func allLitPumpkins() (pumpkins []world.Block) {
|
||||
for i := cube.Direction(0); i <= 3; i++ {
|
||||
pumpkins = append(pumpkins, LitPumpkin{Facing: i})
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user