-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinterfaces.go
More file actions
118 lines (101 loc) · 4.27 KB
/
Copy pathinterfaces.go
File metadata and controls
118 lines (101 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package bedsim
import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
"github.com/oomph-ac/bedsim/block"
)
// WorldProvider bridges the world/chunk system for collision and block lookups.
type WorldProvider interface {
Block(pos cube.Pos) world.Block
// BlockCollisions returns block-local collision boxes at pos.
BlockCollisions(pos cube.Pos) []cube.BBox32
GetNearbyBBoxes(aabb cube.BBox32) []cube.BBox32
IsChunkLoaded(chunkX, chunkZ int32) bool
}
// MovementAreaProvider can provide a precise loaded/known check for a swept
// movement volume in world space. Worlds that only expose chunk loading use BedSim's
// conservative chunk-range fallback.
type MovementAreaProvider interface {
// IsMovementAreaLoaded receives a world-space movement volume.
IsMovementAreaLoaded(aabb cube.BBox32) bool
}
// LiquidProvider returns liquids from either block layer at a position.
type LiquidProvider interface {
Liquid(pos cube.Pos) (world.Liquid, bool)
}
// LiquidFlowProvider resolves block face and material properties used by
// liquid-flow calculations. It is optional; BedSim otherwise uses block models
// for faces and collision boxes for falling-current barriers.
type LiquidFlowProvider interface {
// LiquidFlowFaceClosed reports whether face at pos blocks horizontal flow.
LiquidFlowFaceClosed(pos cube.Pos, face cube.Face) bool
// LiquidFlowBarrier reports whether the block material at pos bends falling
// liquid flow downward.
LiquidFlowBarrier(pos cube.Pos) bool
}
// MovementCollisionContext contains player-dependent state needed by dynamic
// collision shapes such as scaffolding and powder snow.
type MovementCollisionContext struct {
Position [3]float32
Sneaking bool
Descending bool
WantDown bool
LeatherBoots bool
}
// MovementCollisionProvider optionally resolves collision boxes whose shape
// depends on current player input or equipment.
type MovementCollisionProvider interface {
GetMovementBBoxes(aabb cube.BBox32, context MovementCollisionContext) []cube.BBox32
}
// ClimbableContactProvider resolves orientation-aware ladder and vine contact.
// aabb is in world space.
// The built-in fallback uses the climbable semantics of the player's current
// block cell when this provider is absent.
type ClimbableContactProvider interface {
// HasClimbableContact receives a world-space movement volume.
HasClimbableContact(aabb cube.BBox32) bool
}
// MovementSupportProvider resolves the exact support block for dynamic shapes.
// aabb is in world space.
// It is optional because a generic collision provider may not retain source
// block identities.
type MovementSupportProvider interface {
// SupportingBlock receives a world-space movement volume.
SupportingBlock(aabb cube.BBox32, context MovementCollisionContext) (cube.Pos, bool)
}
// BlockMovementSemanticsProvider resolves the complete movement behavior for a
// block from a custom world registry or block data. GroundFriction and
// GroundAccelerationFrictionMultiplier must be finite and positive; invalid
// values fall back to BedSim's built-in semantics. Boolean and enum values are
// used as returned, including their zero values.
type BlockMovementSemanticsProvider interface {
BlockMovementSemantics(world.Block) block.MovementSemantics
}
// DefaultBlockSemantics uses bedsim's built-in Dragonfly-backed block helpers.
type DefaultBlockSemantics struct{}
// EffectsProvider bridges effect tracking (jump boost, levitation, slow falling, etc.).
type EffectsProvider interface {
GetEffect(effectID int32) (amplifier int32, ok bool)
}
// InventoryProvider exposes equipment checks needed by movement (elytra, etc.).
type InventoryProvider interface {
HasElytra() bool
}
// DepthStriderProvider exposes the equipped Depth Strider level.
type DepthStriderProvider interface {
DepthStriderLevel() int
}
// MovementEnchantment identifies enchantments that directly affect movement.
type MovementEnchantment uint8
const (
EnchantmentDepthStrider MovementEnchantment = iota
EnchantmentSoulSpeed
EnchantmentSwiftSneak
EnchantmentRiptide
)
// MovementEquipmentProvider exposes equipment and enchantments whose effects
// are part of client movement physics.
type MovementEquipmentProvider interface {
EnchantmentLevel(enchantment MovementEnchantment) int
WearingLeatherBoots() bool
}