mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 23:25:07 +00:00
Fix Beam and Laser Scripting
This commit is contained in:
1 parent
f546bd72b8
commit
2e21b36796
3 files changed
+53
-1
No files matched your search
@@ -3,6 +3,7 @@ package noppes.npcs.scripted.entity;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.api.entity.IEnergyLaser;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptEnergyLaser<T extends EntityAbilityLaser> extends ScriptEnergyProjectile<T> implements IEnergyLaser {
|
||||
@@ -95,8 +96,15 @@ public class ScriptEnergyLaser<T extends EntityAbilityLaser> extends ScriptEnerg
|
||||
entity.startMoving(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAt(IEntity target) {
|
||||
entity.setTrackOwnerOrigin(false);
|
||||
super.fireAt(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAt(double x, double y, double z) {
|
||||
entity.setTrackOwnerOrigin(false);
|
||||
double dx = x - entity.posX;
|
||||
double dy = y - entity.posY;
|
||||
double dz = z - entity.posZ;
|
||||
@@ -106,4 +114,17 @@ public class ScriptEnergyLaser<T extends EntityAbilityLaser> extends ScriptEnerg
|
||||
}
|
||||
ensureSpawned();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDirection(float yaw, float pitch) {
|
||||
entity.setTrackOwnerOrigin(false);
|
||||
float yawRad = (float) Math.toRadians(yaw);
|
||||
float pitchRad = (float) Math.toRadians(pitch);
|
||||
entity.setDirection(
|
||||
-Math.sin(yawRad) * Math.cos(pitchRad),
|
||||
-Math.sin(pitchRad),
|
||||
Math.cos(yawRad) * Math.cos(pitchRad)
|
||||
);
|
||||
ensureSpawned();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user