mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 09:12:22 +00:00
Ability Preview GUI
This commit is contained in:
1 parent
216a3dbbf8
commit
55658a7956
37 files changed
+2396
-162
No files matched your search
@@ -347,4 +347,56 @@ public class EntityAbilityLaser extends EntityAbilityProjectile {
|
||||
nbt.setDouble("EndY", endY);
|
||||
nbt.setDouble("EndZ", endZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a laser in preview mode for GUI display.
|
||||
* Laser doesn't have charging state - spawns at active phase and fires immediately.
|
||||
*/
|
||||
public static EntityAbilityLaser createPreview(World world, EntityNPCInterface owner,
|
||||
float laserWidth, int innerColor, int outerColor,
|
||||
boolean outerColorEnabled, float outerColorWidth,
|
||||
float expansionSpeed, float maxDistance,
|
||||
boolean lightningEffect, float lightningDensity, float lightningRadius) {
|
||||
EntityAbilityLaser laser = new EntityAbilityLaser(world);
|
||||
laser.setPreviewMode(true);
|
||||
laser.setPreviewOwner(owner);
|
||||
|
||||
// Set visual properties
|
||||
laser.laserWidth = laserWidth;
|
||||
laser.size = laserWidth;
|
||||
laser.innerColor = innerColor;
|
||||
laser.outerColor = outerColor;
|
||||
laser.outerColorEnabled = outerColorEnabled;
|
||||
laser.outerColorWidth = outerColorWidth;
|
||||
laser.expansionSpeed = expansionSpeed;
|
||||
laser.maxDistance = Math.min(maxDistance, 5.0f); // Limit for GUI preview
|
||||
laser.lightningEffect = lightningEffect;
|
||||
laser.lightningDensity = lightningDensity;
|
||||
laser.lightningRadius = lightningRadius;
|
||||
|
||||
// Position at chest height
|
||||
double x = owner.posX;
|
||||
double y = owner.posY + owner.height * 0.7;
|
||||
double z = owner.posZ;
|
||||
laser.setPosition(x, y, z);
|
||||
laser.prevPosX = x;
|
||||
laser.prevPosY = y;
|
||||
laser.prevPosZ = z;
|
||||
laser.startX = x;
|
||||
laser.startY = y;
|
||||
laser.startZ = z;
|
||||
|
||||
// Fire in owner's facing direction
|
||||
float yaw = (float) Math.toRadians(owner.rotationYaw);
|
||||
laser.dirX = -Math.sin(yaw);
|
||||
laser.dirY = 0;
|
||||
laser.dirZ = Math.cos(yaw);
|
||||
|
||||
// Initialize end point (same as start, will expand)
|
||||
laser.endX = x;
|
||||
laser.endY = y;
|
||||
laser.endZ = z;
|
||||
|
||||
return laser;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user