mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 19:19:43 +00:00
Add energy projectile types and events: implement IEnergyOrb, IEnergyBeam, IEnergyDisc, and IEnergyLaser interfaces, along with their respective script handlers and event hooks
This commit is contained in:
1 parent
1ed012331b
commit
071d89cc15
23 files changed
+1363
-94
No files matched your search
@@ -3,6 +3,7 @@ package kamkeel.npcs.entity;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import kamkeel.npcs.util.AnchorPointHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.EventHooks;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -145,6 +146,9 @@ public class EntityAbilityLaser extends EntityAbilityProjectile {
|
||||
endZ = startZ + dirZ * currentLength;
|
||||
|
||||
if (ticksSinceFullExtension >= lingerTicks) {
|
||||
if (!worldObj.isRemote) {
|
||||
EventHooks.onEnergyProjectileExpired(this);
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
@@ -236,6 +240,9 @@ public class EntityAbilityLaser extends EntityAbilityProjectile {
|
||||
MovingObjectPosition blockHit = worldObj.func_147447_a(start, end, false, true, false);
|
||||
|
||||
if (blockHit != null && blockHit.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (!worldObj.isRemote) {
|
||||
EventHooks.onEnergyProjectileBlockImpact(this, blockHit.blockX, blockHit.blockY, blockHit.blockZ);
|
||||
}
|
||||
// Laser stops at block
|
||||
currentLength = (float) Math.sqrt(
|
||||
(blockHit.hitVec.xCoord - startX) * (blockHit.hitVec.xCoord - startX) +
|
||||
@@ -355,6 +362,32 @@ public class EntityAbilityLaser extends EntityAbilityProjectile {
|
||||
return laserWidth;
|
||||
}
|
||||
|
||||
public void setLaserWidth(float width) {
|
||||
this.laserWidth = width;
|
||||
}
|
||||
|
||||
public float getExpansionSpeed() {
|
||||
return expansionSpeed;
|
||||
}
|
||||
|
||||
public void setExpansionSpeed(float speed) {
|
||||
this.expansionSpeed = speed;
|
||||
}
|
||||
|
||||
public int getLingerTicks() {
|
||||
return lingerTicks;
|
||||
}
|
||||
|
||||
public void setLingerTicks(int ticks) {
|
||||
this.lingerTicks = ticks;
|
||||
}
|
||||
|
||||
public void setDirection(double x, double y, double z) {
|
||||
this.dirX = x;
|
||||
this.dirY = y;
|
||||
this.dirZ = z;
|
||||
}
|
||||
|
||||
public float getCurrentLength() {
|
||||
return currentLength;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user