Architecture
MineGun is split into two concerns: the library core (com.minegun) which is what you integrate, and the demo (com.minegun.demo) which is a runnable reference you don't need in production.
com.minegun
├── HealthManagement.java ← Custom HP/shield system
├── minegunLogger.java ← ANSI console logger
└── Weapons/
├── weapons.java ← Shared raycast hitbox utility
├── Rifle.java ← Hitscan rifle implementation
└── RocketLauncher.java ← Explosive launcher implementation
com.minegun.demo ← Example only (delete in prod)
├── Main.java
├── giveCommand.java
└── TestDummy.javacom.minegun and com.minegun.Weapons. The demo package has a hardcoded arena and is purely for reference.How Hitscan Works
When a player right-clicks a weapon item, the server casts a ray from their eye position in their look direction:
- Eye position =
player.getPosition().add(0, eyeHeight, 0) - Steps at 0.5 block increments along the look vector
- At each point: checks for a solid block (stops / explodes on hit)
- Calls
weapons.isPlayerAtPosition()to check for player hitbox overlap - On player hit: applies damage, sounds, kill detection
- On miss: spawns a particle at the step point