feat(03-04): FallDamageSuppressorSystem + wiring + cleanup [DBG throttle] (Task 3)
- FallDamageSuppressorSystem: subclass DamageEventSystem, cancel Damage cause=Fall quand guard.shouldSuppressFallDamage; FALL_INDEX lazy via DamageCause.getAssetMap().getIndex; groupe inspectDamageGroup - GravityApplier: 3-arg constructor avec FallDamageGuard; first-match region, filtres AffectPlayers/Npcs/Items avant wake, seed addForce paramétré par VerticalForce (remplace hardcode 0.1); notifie guard.markInRegion / markExit (via lastKnownRegion map pour Pass 2) - Cleanup: retire les AtomicInteger counters + log [DBG tick=...] throttle 1s; conserve logs one-shot [DBG npc.woken]/[DBG npc.ctrlNull] - GravityFlipPlugin.setup(): instancie FallDamageGuard, registerSystem sur entityStoreRegistry; start() passe guard au GravityApplier - Imports Query + CommandBuffer alignés sur FlockMembershipSystems
This commit is contained in:
@@ -6,6 +6,8 @@ import com.hypixel.hytale.server.core.universe.Universe;
|
||||
import com.hypixel.hytale.server.core.universe.world.World;
|
||||
import com.hypixel.hytale.server.core.util.Config;
|
||||
import com.mythlane.gravityflip.config.GravityFlipConfig;
|
||||
import com.mythlane.gravityflip.physics.FallDamageGuard;
|
||||
import com.mythlane.gravityflip.physics.FallDamageSuppressorSystem;
|
||||
import com.mythlane.gravityflip.physics.GravityApplier;
|
||||
import com.mythlane.gravityflip.region.RegionRegistry;
|
||||
import com.mythlane.gravityflip.tick.RegionTickLoop;
|
||||
@@ -38,6 +40,7 @@ public class GravityFlipPlugin extends JavaPlugin {
|
||||
private RegionRegistry registry;
|
||||
private RegionTickLoop tickLoop;
|
||||
private GravityApplier gravityApplier;
|
||||
private FallDamageGuard fallDamageGuard;
|
||||
|
||||
public GravityFlipPlugin(JavaPluginInit init) {
|
||||
super(init);
|
||||
@@ -55,6 +58,13 @@ public class GravityFlipPlugin extends JavaPlugin {
|
||||
// a Supplier<World> that resolves Universe.get().getDefaultWorld() lazily on each
|
||||
// tick (matching the MythWorld WorldBorderManager precedent). Until the universe
|
||||
// is ready, the supplier returns null and the tick is a no-op.
|
||||
// Plan 03-04 : enregistrer le FallDamageSuppressorSystem DANS setup() (fenêtre ECS
|
||||
// de registration). Pattern identique à FlockPlugin.java → entityStoreRegistry.registerSystem(...).
|
||||
this.fallDamageGuard = new FallDamageGuard();
|
||||
getEntityStoreRegistry().registerSystem(new FallDamageSuppressorSystem(
|
||||
fallDamageGuard,
|
||||
th -> getLogger().at(Level.WARNING).withCause(th).log("fallDamageSuppressor handle failed")));
|
||||
|
||||
getLogger().at(Level.INFO).log("Gravity Flip enabled");
|
||||
}
|
||||
|
||||
@@ -65,7 +75,8 @@ public class GravityFlipPlugin extends JavaPlugin {
|
||||
this.registry = new RegionRegistry(cfg, configHolder);
|
||||
this.gravityApplier = new GravityApplier(
|
||||
th -> getLogger().at(Level.WARNING).withCause(th).log("gravityApply failed"),
|
||||
msg -> getLogger().at(Level.INFO).log("%s", msg));
|
||||
msg -> getLogger().at(Level.INFO).log("%s", msg),
|
||||
fallDamageGuard);
|
||||
this.tickLoop = new RegionTickLoop(registry, gravityApplier, th ->
|
||||
getLogger().at(Level.WARNING).withCause(th).log("detectTick failed"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user