refactor: simplify ChainResolver and RayCaster interfaces, enhance ChainDamageApplier logic

- Updated ChainResolver to remove unused shooterOrigin and shooterDirection parameters, streamlining the resolve method.
- Modified RayCaster interface to reflect changes in method signature, focusing on maxBlocks only.
- Enhanced ChainDamageApplier to utilize a new CauseIndexHolder for resolving the PHYSICAL damage cause index, improving clarity and performance.
- Refactored ChainDamageApplier.apply method to use HytaleEntityAdapter for target references, ensuring correct damage application.
- Adjusted tests in ChainResolverTest and ChainDamageApplierTest to align with the new method signatures and logic.

Tests: All tests passing. Build: ./gradlew clean build successful.
This commit is contained in:
2026-04-28 08:20:07 +02:00
parent 03754a0646
commit f6ca35bfc4
9 changed files with 101 additions and 143 deletions
@@ -9,6 +9,7 @@ import com.hypixel.hytale.server.core.modules.entitystats.EntityStatValue;
import com.hypixel.hytale.server.core.modules.entitystats.asset.DefaultEntityStatTypes;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.mythlane.chainlightning.chain.ChainEntity;
import com.mythlane.chainlightning.chain.ChainHit;
import com.mythlane.chainlightning.chain.Vec3;
import javax.annotation.Nonnull;
@@ -54,6 +55,12 @@ public final class HytaleEntityAdapter implements ChainEntity {
return new HytaleEntityAdapter(ref, id, vec, alive);
}
/** Single cast point so callers stop reaching into ChainEntity to recover the runtime adapter. */
@Nonnull
public static HytaleEntityAdapter from(@Nonnull ChainHit hit) {
return (HytaleEntityAdapter) hit.target();
}
/** Underlying Hytale ref, exposed so DamageSystems and EffectControllerComponent can address the entity. */
@Nonnull
public Ref<EntityStore> ref() {