-
Notifications
You must be signed in to change notification settings - Fork 0
How It Works
A Minecraft entity is convenient while it stays near a player. A drone flies kilometres away while the operator stays put, and at that point the entity gets in the way: it stops being tracked past the tracking radius, it ticks with the rest of the world, and it needs a client to "see" it.
So the aircraft are built differently.
| State | What it is | What draws it |
|---|---|---|
| On the ground |
airsystem:drone block with a block entity |
DroneBlockRenderer |
| Airborne |
DroneFlight object in DroneFlightManager
|
DroneFlightRenderer, in the world pass |
| Released bomb |
Munition object in the same place |
the same renderer |
Range. A flight is not tied to the entity tracking radius. The server sends
compact snapshots to everyone within drone.syncRange and instrument data only
to the operator.
Cost. None of the entity overhead — no tracker, no attribute sync, no collision search every tick. Motion is one ray from the last point to the next, and that same ray finds the collision.
Persistence. Flights live in the dimension's saved data and survive a server restart.
Bullets will not hit a non-entity by themselves, so the server looks for projectiles near each aircraft every tick and checks whether their movement segment passed through the hull.
The volume query for that is the single most expensive operation in the tick, so it is gated on a cheap test first: every projectile in the mod originates from a player, so with no player within 160 blocks there is nothing that could have hit the drone, and the expensive query is skipped entirely.
There is nothing for a spectator camera to attach to. Instead the operator is put into spectator mode and the server quietly carries their position along with the drone — quietly meaning without a teleport packet, because the client already knows where the aircraft is and moves the camera itself from the same snapshots. The server needs that position only so chunks keep loading around the operator. Head movement stays with the player, so the camera behaves like a gimbal.
Rebuilding the list of entities a player can see is the expensive part of moving one, so it runs on a chunk change plus a rare refresh, not every tick.
A drone kilometres from any player would stall at the edge of the loaded area, so the chunks under it are force-loaded. Two things keep that affordable:
- the held area is recomputed only when the drone changes chunk — at cruise speed that is once every ten ticks or so, and recomputing it every tick used to cost more than the whole of the rest of the flight logic;
- the area is biased along the course. Behind the aircraft only one row is kept, in case it turns; ahead, the full radius. The server has to tick every held chunk in full, and the drone is not coming back.
Snapshots go out every two ticks, and the client eases each aircraft towards the position it was sent over three ticks. Taking the position directly makes the model stutter — it freezes, then jumps.
The exception is a far jump: a drone entering view range, or a teleport. Those are applied at once, or the aircraft would visibly glide in from a distance.
The engine sound source is updated every tick rather than replayed at a fixed point, because a flying aircraft moves tens of blocks per second and a static source audibly lags behind what you can see.
Pitch is live. Engine rpm follows the throttle with a lag, the way a real engine does, and Doppler shift is computed from the closing speed along the line to the listener. That is what makes a pass overhead recognisable — the pitch drops on its own as the aircraft goes by. Because in-game speeds are compressed relative to real ones, an honest Doppler calculation would be nearly inaudible, so the effect is scaled up until a pass reads the way it does in life.
The mod does not compile against TACZ and does not require it. Bullets are
recognised by projectile type, and ammunition by item id: anything in the tacz
namespace containing "ammo" or a matching calibre works. Without TACZ the guns
run on airsystem:ammo_35mm and airsystem:ammo_30mm.
Project AirSystem — NeoForge 1.21.1 — GPL-3.0-or-later
Project AirSystem
Aircraft
Ground
Playing
Development