mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 23:09:05 +00:00
Sweeper Height and Width Configs
This commit is contained in:
1 parent
747918c4dc
commit
86fe9fd6bb
4 files changed
+56
-47
No files matched your search
@@ -34,7 +34,7 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
// Beam properties
|
||||
private float beamLength = 10.0f;
|
||||
private float beamWidth = 0.3f; // Thin like beam trail
|
||||
private float beamHeight = 0.8f;
|
||||
private float beamHeight = 1.0f;
|
||||
|
||||
// Combat properties
|
||||
private float damage = 5.0f;
|
||||
@@ -100,8 +100,8 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
this.baseYaw = owner.rotationYaw;
|
||||
}
|
||||
|
||||
// Position at owner
|
||||
this.setPosition(owner.posX, owner.posY + beamHeight, owner.posZ);
|
||||
// Position at beam center (bottom at feet, top at feet + beamHeight)
|
||||
this.setPosition(owner.posX, owner.posY + beamHeight / 2.0, owner.posZ);
|
||||
|
||||
// Ready to deal damage immediately
|
||||
this.ticksSinceDamage = damageInterval;
|
||||
@@ -149,7 +149,7 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
}
|
||||
|
||||
if (owner != null) {
|
||||
this.setPosition(owner.posX, owner.posY + beamHeight, owner.posZ);
|
||||
this.setPosition(owner.posX, owner.posY + beamHeight / 2.0, owner.posZ);
|
||||
}
|
||||
|
||||
// Check if sweep is done
|
||||
@@ -204,10 +204,10 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
double checkY = startY;
|
||||
double checkZ = startZ + dirZ * beamLength * progress;
|
||||
|
||||
// Narrow hitbox for thin beam
|
||||
// Hitbox: beam center ± half-height vertically, generous width for thin beams
|
||||
AxisAlignedBB checkBox = AxisAlignedBB.getBoundingBox(
|
||||
checkX - beamWidth * 2, checkY - 0.5, checkZ - beamWidth * 2,
|
||||
checkX + beamWidth * 2, checkY + 1.0, checkZ + beamWidth * 2
|
||||
checkX - beamWidth * 2, checkY - beamHeight / 2.0, checkZ - beamWidth * 2,
|
||||
checkX + beamWidth * 2, checkY + beamHeight / 2.0, checkZ + beamWidth * 2
|
||||
);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -259,11 +259,14 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Height check - entity's feet must be below beam top (allows jumping over)
|
||||
// Height check - entity must overlap beam vertically
|
||||
double beamTopY = startY + beamHeight / 2.0;
|
||||
double beamBottomY = startY - beamHeight / 2.0;
|
||||
double entityFeetY = entity.posY;
|
||||
double beamTopY = startY + 0.5;
|
||||
double entityTopY = entity.posY + entity.height;
|
||||
|
||||
return entityFeetY < beamTopY;
|
||||
// Entity feet must be below beam top AND entity top must be above beam bottom
|
||||
return entityFeetY < beamTopY && entityTopY > beamBottomY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +369,7 @@ public class EntityAbilitySweeper extends EntityEnergyAbility {
|
||||
readEnergyBaseNBT(nbt);
|
||||
this.beamLength = sanitize(nbt.getFloat("BeamLength"), 10.0f, MAX_ENTITY_SIZE);
|
||||
this.beamWidth = sanitize(nbt.getFloat("BeamWidth"), 0.3f, MAX_ENTITY_SIZE);
|
||||
this.beamHeight = sanitize(nbt.getFloat("BeamHeight"), 0.8f, MAX_ENTITY_SIZE);
|
||||
this.beamHeight = sanitize(nbt.getFloat("BeamHeight"), 1.0f, MAX_ENTITY_SIZE);
|
||||
this.sweepSpeed = nbt.hasKey("SweepSpeed") ? nbt.getFloat("SweepSpeed") : 3.0f;
|
||||
if (Float.isNaN(sweepSpeed) || Float.isInfinite(sweepSpeed) || sweepSpeed <= 0) sweepSpeed = 3.0f;
|
||||
this.numberOfRotations = nbt.hasKey("NumRotations") ? nbt.getInteger("NumRotations") : 2;
|
||||
|
||||
Reference in new issue
Block a user