Skip to content

Commit

Permalink
feat(predicates): Add movementAffectedBy field in Entity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Aug 15, 2024
1 parent 2b1b959 commit d3e3769
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ data class Entity(
var flags: EntityFlags? = null,
var location: Location? = null,
var movement: Movement? = null,
var movementAffectedBy: Location? = null,
@Serializable(NbtAsJsonSerializer::class) var nbt: NbtCompound? = null,
var passenger: Entity? = null,
var periodicTicks: Int? = null,
Expand Down Expand Up @@ -86,6 +87,10 @@ fun Entity.movement(init: Movement.() -> Unit = {}) {
movement = Movement().apply(init)
}

fun Entity.movementAffectedBy(init: Location.() -> Unit = {}) {
movementAffectedBy = Location().apply(init)
}

fun Entity.nbt(block: NbtCompoundBuilder.() -> Unit) {
nbt = buildNbtCompound(block)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ fun DataPack.predicateTests() {
horizontalSpeed(1.0)
}

movementAffectedBy {
canSeeSky = true
}

nbt {
this["foo"] = "bar"
}
Expand Down Expand Up @@ -161,6 +165,9 @@ fun DataPack.predicateTests() {
},
"horizontal_speed": 1.0
},
"movement_affected_by": {
"can_see_sky": true
},
"nbt": {
"foo": "bar"
},
Expand Down

0 comments on commit d3e3769

Please sign in to comment.