Range Entity
Overview
Class: crazypants.enderio.machine.ranged.RangeEntity
Extends: Entity
RangeEntity is a registry-only entity used by EnderIO’s ranged machines (e.g., the Attractor, Soul Binder, and other machines that have a range) to visually display the machine’s activation range in the world.
Usage
RangeEntity is spawned by machines that implement the IRanged interface when the player enable range display. It renders as a wireframe-like overlay showing the machine’s operational range.
Attributes
| Attribute | Value |
|---|---|
| Default Lifespan | 20 ticks (1 second) |
| Color | Determined by IRanged.getColor() |
| Frustum Check | Disabled (ignoreFrustumCheck = true) |
| Triggers Walking | false |
| Bounding Box | Dynamic, based on IRanged.getRange() and IRanged.getBounds() |
Key Methods
getBoundingBox()
Returns the axis-aligned bounding box computed from the spawn guard’s location and range:
- If
IRanged.getBounds()is available, uses that. - Otherwise, computes a box centered on the entity position with extents from
IRanged.getRange().
onUpdate()
Each tick:
- Decrements
lifeSpan - Updates range if the
IRangedreference’s range/bounds changed - If the tile entity at the spawn location is no longer an
IRanged, or ifspawnGuard.isShowingRange()is false, the entity sets itself dead
Color Rendering
The color is stored as an integer and unpacked as RGBA:
(float) (color >> 16 & 255) / 255.0F, // Red
(float) (color >> 8 & 255) / 255.0F, // Green
(float) (color & 255) / 255.0F, // Blue
(float) (color >> 24 & 255) / 255.0F // Alpha
Spawn Guard
The RangeEntity holds a reference to its IRanged spawn guard (the machine that created it). If the machine is removed or range display is disabled, the entity dies.
Notes
- This is a registry-only entity — it is not a spawnable mob.
- It is always rendered regardless of camera distance (frustum check disabled).
- It is purely a visual/debug overlay entity with no physical presence or collision.
- It reads/writes no NBT data and is not persisted across world restarts.
第三方集成
| 集成 Mod | 集成类型 | 功能 |
|---|---|---|
| Thaumcraft | 要素注册 | 物品要素标签 |