multimodal

This commit is contained in:
2026-06-20 01:32:32 -04:00
parent 0e93efe76d
commit 7575c514c3
3 changed files with 111 additions and 76 deletions

View File

@@ -4,12 +4,13 @@
== Entity IDs
Entities are the dynamic movable objects in the game. Minecraft tracks every entity with a unique
ID number. Whenever an entity is added to the game world, a global counter is incremented
and the new entity is assigned the current value.
Entities are the dynamic movable objects in the game. Minecraft tracks every entity with a unique ID
number. Whenever an entity is added to the game world, a global counter is incremented and the new
entity is assigned the current value.
A large number of game objects are tracked in this way, and so creating any one of them will increment that global
counter. To reiterate, *this is a global counter, shared for all entities in the game*.
A large number of game objects are tracked in this way, and so creating any one of them will
increment that global counter. To reiterate, *this is a global counter, shared for all entities in
the game*.
== Stationary Item Optimization
@@ -22,45 +23,28 @@ Here is the relevant code path for the optimization.
#note[ `onGround` is only ever updated from `move()`, and this branch is the *only* place that
`move()` is called. ]
```java
public class ItemEntity extends Entity {
public void tick() {
...
if (this.onGround() && !(this.getDeltaMovement().horizontalDistanceSqr() > (double)1.0E-5F) && (this.tickCount + this.getId()) % 4 != 0) {
...
} else {
this.move(MoverType.SELF, this.getDeltaMovement());
...
}
...
}
}
```java public class ItemEntity extends Entity { public void tick() { ... if (this.onGround() &&
!(this.getDeltaMovement().horizontalDistanceSqr() > (double)1.0E-5F) && (this.tickCount +
this.getId()) % 4 != 0) { ... } else { this.move(MoverType.SELF, this.getDeltaMovement()); ... } ...
} }
public class Entity {
public void move(final MoverType moverType, Vec3 delta) {
...
this.setOnGroundWithMovement(this.verticalCollisionBelow, this.horizontalCollision, movement);
...
}
public class Entity { public void move(final MoverType moverType, Vec3 delta) { ...
this.setOnGroundWithMovement(this.verticalCollisionBelow, this.horizontalCollision, movement); ... }
public void setOnGroundWithMovement(final boolean onGround, final boolean horizontalCollision, final Vec3 movement) {
this.onGround = onGround;
...
}
}
```
public void setOnGroundWithMovement(final boolean onGround, final boolean horizontalCollision,
final Vec3 movement) { this.onGround = onGround; ... } } ```
== Observable Drop Delay
The effect is that if the item is on a block and has negligible horizontal momentum, it *cannot
fall* until the condition is satisfied, even if it's no longer on the ground. It can fall early if
it gains horizontal momentum or is pushed.
fall* until the condition is satisfied, even if it's no longer on the ground. It can only fall early
if it gains horizontal momentum or is pushed.
#tip[ You can rewrite the condition as `(age % 4 == (-id) % 4)` ]
#todo[ An animation. Spawn a few items, note their ID and age. Let them settle on a block,
then remove that supporting block. There will be a few ticks where the item hovers in place before
it falls. ]
#todo[ An animation. Spawn a few items, note their ID and age. Let them settle on a block, then
remove that supporting block. There will be a few ticks where the item hovers in place before it
falls. ]
For simplicity, suppose we spawn all our items on the same tick. Then `this.tickCount` will be the
same for all of them, and we only need to consider the ID.

45
lib.typ
View File

@@ -1,16 +1,39 @@
#let callout(kind: str, label: str, body) = html.section(class: kind + " callout", context {
let depth = counter(heading).at(here()).len() + 1
heading(
depth: depth,
outlined: false,
numbering: none,
label,
#let callout(kind: str, label: str, body) = context if target() == "html" {
html.section(class: kind + " callout", context {
let depth = counter(heading).at(here()).len() + 1
heading(
depth: depth,
outlined: false,
numbering: none,
label,
)
" "
body
})
} else {
let col = (
note: color.rgb("#0000cd"),
warn: color.rgb("#a52a2a"),
tip: color.rgb("#228b22"),
todo: color.rgb("#ff0000"),
).at(kind)
block(
fill: col.transparentize(85%),
stroke: (y: col),
width: 100%,
outset: (x: 1em, y: 0.5em),
spacing: par.spacing + 0.5em,
inset: (y: 0.5em),
{
set text(fill: col)
strong(label)
body
},
)
" "
body
})
}
#let note = callout.with(kind: "note", label: "Note:")
}#let note = callout.with(kind: "note", label: "Note:")
#let warn = callout.with(kind: "warn", label: "Warning:")
#let tip = callout.with(kind: "tip", label: "Tip:")
#let todo = callout.with(kind: "todo", label: "TODO:")

View File

@@ -1,24 +1,31 @@
#set page("us-letter", margin: 0.5in)
#set heading(numbering: "1.1 -")
#set document(title: [The EID Wireless Masterclass])
#asset("/mojangles-ascii.woff2", read("static/mojangles-ascii.woff2", encoding: none))
#asset("/style.css", read("static/style.css", encoding: none))
#context if target() == "bundle" {
asset("/mojangles-ascii.woff2", read("static/mojangles-ascii.woff2", encoding: none))
asset("/style.css", read("static/style.css", encoding: none))
}
#let index() = query(document).first()
#let chapter = state("chapter", context (doc: index(), top: none, loc: index().location()))
#let rawdoc(path, body) = document(path, html.html({
html.head({
html.meta(charset: "utf-8")
html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
html.meta(name: "color-scheme", content: "dark light")
html.link(rel: "stylesheet", href: "/style.css")
html.title(context document.title)
})
html.body({
body
})
}))
#let rawdoc(path, body) = context if target() == "bundle" {
document(path, html.html({
html.head({
html.meta(charset: "utf-8")
html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
html.meta(name: "color-scheme", content: "dark light")
html.link(rel: "stylesheet", href: "/style.css")
html.title(context document.title)
})
html.body({
body
})
}))
} else {
body
}
#show document: it => {
set document(title: context {
@@ -33,26 +40,47 @@
it
}
#let doc(path, main) = rawdoc(path, {
html.header(context {
link(index().location(), title(index().title))
let target = selector(heading).within(chapter.get().loc).or(heading.where(level: 1))
outline(title: none, target: target)
divider()
})
html.main(id: "main", main)
html.footer(context {
let next = query(selector(heading.where(level: 1, outlined: true)).after(here())).first(default: none)
if next != none {
#let doc(path, main) = context if target() == "bundle" {
rawdoc(path, {
html.header(context {
link(index().location(), title(index().title))
let target = selector(heading).within(chapter.get().loc).or(heading.where(level: 1))
outline(title: none, target: target)
divider()
show outline.entry: it => [Next: #it]
outline(title: none, target: next.location())
}
})
html.main(id: "main", main)
html.footer(context {
let next = query(selector(heading.where(level: 1, outlined: true)).after(here())).first(default: none)
if next != none {
divider()
show outline.entry: it => [Next: #it]
outline(title: none, target: next.location())
}
})
})
})
} else {
main
}
#{
show: it => context if target() == "html" {
html.html({
html.head({
html.meta(charset: "utf-8")
html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
html.meta(name: "color-scheme", content: "dark light")
html.title(context document.title)
html.style(read("static/style.css"))
})
html.body({
html.main(id: "main", { it })
})
})
} else {
it
}
rawdoc("/index.html", include "content/00-index.typ")
doc("/core.html", include "content/01-core.typ")
doc("/interference.html", include "content/02-interference.typ")