mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 08:29:05 +00:00
Fix some Firing Script Behavior for Energy Projectiles
This commit is contained in:
1 parent
ee7e8c17e8
commit
393abc08ed
7 files changed
+56
-113
No files matched your search
@@ -3,7 +3,6 @@ package noppes.npcs.scripted.entity;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.api.entity.IEnergyBeam;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptEnergyBeam<T extends EntityAbilityBeam> extends ScriptEnergyProjectile<T> implements IEnergyBeam {
|
||||
@@ -60,27 +59,7 @@ public class ScriptEnergyBeam<T extends EntityAbilityBeam> extends ScriptEnergyP
|
||||
// ==================== FIRE ====================
|
||||
|
||||
@Override
|
||||
public void fireAt(IEntity target) {
|
||||
ensureSpawned();
|
||||
EntityLivingBase mcTarget = null;
|
||||
if (target != null && target.getMCEntity() instanceof EntityLivingBase) {
|
||||
mcTarget = (EntityLivingBase) target.getMCEntity();
|
||||
}
|
||||
entity.startFiring(mcTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAt(double x, double y, double z) {
|
||||
ensureSpawned();
|
||||
double dx = x - entity.posX;
|
||||
double dy = y - entity.posY;
|
||||
double dz = z - entity.posZ;
|
||||
double len = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
if (len > 0) {
|
||||
entity.motionX = (dx / len) * entity.getSpeed();
|
||||
entity.motionY = (dy / len) * entity.getSpeed();
|
||||
entity.motionZ = (dz / len) * entity.getSpeed();
|
||||
}
|
||||
entity.startFiring(null);
|
||||
protected void launchFromOwner(EntityLivingBase target) {
|
||||
entity.startFiring(target);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user