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 == Entity IDs
Entities are the dynamic movable objects in the game. Minecraft tracks every entity with a unique Entities are the dynamic movable objects in the game. Minecraft tracks every entity with a unique ID
ID number. Whenever an entity is added to the game world, a global counter is incremented number. Whenever an entity is added to the game world, a global counter is incremented and the new
and the new entity is assigned the current value. 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 A large number of game objects are tracked in this way, and so creating any one of them will
counter. To reiterate, *this is a global counter, shared for all entities in the game*. increment that global counter. To reiterate, *this is a global counter, shared for all entities in
the game*.
== Stationary Item Optimization == 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 #note[ `onGround` is only ever updated from `move()`, and this branch is the *only* place that
`move()` is called. ] `move()` is called. ]
```java ```java public class ItemEntity extends Entity { public void tick() { ... if (this.onGround() &&
public class ItemEntity extends Entity { !(this.getDeltaMovement().horizontalDistanceSqr() > (double)1.0E-5F) && (this.tickCount +
public void tick() { this.getId()) % 4 != 0) { ... } else { this.move(MoverType.SELF, this.getDeltaMovement()); ... } ...
... } }
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 class Entity { public void move(final MoverType moverType, Vec3 delta) { ...
public void move(final MoverType moverType, Vec3 delta) { this.setOnGroundWithMovement(this.verticalCollisionBelow, this.horizontalCollision, movement); ... }
...
this.setOnGroundWithMovement(this.verticalCollisionBelow, this.horizontalCollision, movement);
...
}
public void setOnGroundWithMovement(final boolean onGround, final boolean horizontalCollision, final Vec3 movement) { public void setOnGroundWithMovement(final boolean onGround, final boolean horizontalCollision,
this.onGround = onGround; final Vec3 movement) { this.onGround = onGround; ... } } ```
...
}
}
```
== Observable Drop Delay == Observable Drop Delay
The effect is that if the item is on a block and has negligible horizontal momentum, it *cannot 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 fall* until the condition is satisfied, even if it's no longer on the ground. It can only fall early
it gains horizontal momentum or is pushed. if it gains horizontal momentum or is pushed.
#tip[ You can rewrite the condition as `(age % 4 == (-id) % 4)` ] #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, #todo[ An animation. Spawn a few items, note their ID and age. Let them settle on a block, then
then remove that supporting block. There will be a few ticks where the item hovers in place before remove that supporting block. There will be a few ticks where the item hovers in place before it
it falls. ] falls. ]
For simplicity, suppose we spawn all our items on the same tick. Then `this.tickCount` will be the 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. 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 callout(kind: str, label: str, body) = context if target() == "html" {
let depth = counter(heading).at(here()).len() + 1 html.section(class: kind + " callout", context {
heading( let depth = counter(heading).at(here()).len() + 1
depth: depth, heading(
outlined: false, depth: depth,
numbering: none, outlined: false,
label, 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 warn = callout.with(kind: "warn", label: "Warning:")
#let tip = callout.with(kind: "tip", label: "Tip:") #let tip = callout.with(kind: "tip", label: "Tip:")
#let todo = callout.with(kind: "todo", label: "TODO:") #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 heading(numbering: "1.1 -")
#set document(title: [The EID Wireless Masterclass]) #set document(title: [The EID Wireless Masterclass])
#asset("/mojangles-ascii.woff2", read("static/mojangles-ascii.woff2", encoding: none)) #context if target() == "bundle" {
#asset("/style.css", read("static/style.css", encoding: none)) 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 index() = query(document).first()
#let chapter = state("chapter", context (doc: index(), top: none, loc: index().location())) #let chapter = state("chapter", context (doc: index(), top: none, loc: index().location()))
#let rawdoc(path, body) = document(path, html.html({ #let rawdoc(path, body) = context if target() == "bundle" {
html.head({ document(path, html.html({
html.meta(charset: "utf-8") html.head({
html.meta(name: "viewport", content: "width=device-width, initial-scale=1") html.meta(charset: "utf-8")
html.meta(name: "color-scheme", content: "dark light") html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
html.link(rel: "stylesheet", href: "/style.css") html.meta(name: "color-scheme", content: "dark light")
html.title(context document.title) html.link(rel: "stylesheet", href: "/style.css")
}) html.title(context document.title)
html.body({ })
body html.body({
}) body
})) })
}))
} else {
body
}
#show document: it => { #show document: it => {
set document(title: context { set document(title: context {
@@ -33,26 +40,47 @@
it it
} }
#let doc(path, main) = rawdoc(path, { #let doc(path, main) = context if target() == "bundle" {
html.header(context { rawdoc(path, {
link(index().location(), title(index().title)) html.header(context {
let target = selector(heading).within(chapter.get().loc).or(heading.where(level: 1)) link(index().location(), title(index().title))
outline(title: none, target: target) let target = selector(heading).within(chapter.get().loc).or(heading.where(level: 1))
divider() outline(title: none, target: target)
})
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() 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") rawdoc("/index.html", include "content/00-index.typ")
doc("/core.html", include "content/01-core.typ") doc("/core.html", include "content/01-core.typ")
doc("/interference.html", include "content/02-interference.typ") doc("/interference.html", include "content/02-interference.typ")