mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 19:02:58 +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
@@ -0,0 +1,132 @@
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.event.IEnergyProjectileEvent;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
|
||||
public class EnergyProjectileEvent extends CustomNPCsEvent implements IEnergyProjectileEvent {
|
||||
public final IEnergyProjectile projectile;
|
||||
public final IEntity owner;
|
||||
|
||||
public EnergyProjectileEvent(IEnergyProjectile projectile) {
|
||||
this.projectile = projectile;
|
||||
this.owner = projectile.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnergyProjectile getProjectile() {
|
||||
return projectile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntity getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return "energyProjectileEvent";
|
||||
}
|
||||
|
||||
/**
|
||||
* energyProjectileFired
|
||||
*/
|
||||
public static class FiredEvent extends EnergyProjectileEvent implements IEnergyProjectileEvent.FiredEvent {
|
||||
public FiredEvent(IEnergyProjectile projectile) {
|
||||
super(projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ENERGY_PROJECTILE_FIRED.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* energyProjectileTick
|
||||
*/
|
||||
public static class UpdateEvent extends EnergyProjectileEvent implements IEnergyProjectileEvent.UpdateEvent {
|
||||
public UpdateEvent(IEnergyProjectile projectile) {
|
||||
super(projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ENERGY_PROJECTILE_TICK.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* energyProjectileEntityImpact
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityImpactEvent extends EnergyProjectileEvent implements IEnergyProjectileEvent.EntityImpactEvent {
|
||||
private final IEntity target;
|
||||
private float damage;
|
||||
|
||||
public EntityImpactEvent(IEnergyProjectile projectile, IEntity target, float damage) {
|
||||
super(projectile);
|
||||
this.target = target;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ENERGY_PROJECTILE_ENTITY_IMPACT.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* energyProjectileBlockImpact
|
||||
*/
|
||||
public static class BlockImpactEvent extends EnergyProjectileEvent implements IEnergyProjectileEvent.BlockImpactEvent {
|
||||
private final IBlock block;
|
||||
|
||||
public BlockImpactEvent(IEnergyProjectile projectile, IBlock block) {
|
||||
super(projectile);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlock getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ENERGY_PROJECTILE_BLOCK_IMPACT.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* energyProjectileExpired
|
||||
*/
|
||||
public static class ExpiredEvent extends EnergyProjectileEvent implements IEnergyProjectileEvent.ExpiredEvent {
|
||||
public ExpiredEvent(IEnergyProjectile projectile) {
|
||||
super(projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ENERGY_PROJECTILE_EXPIRED.function;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package noppes.npcs.scripted.event.player;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
@@ -38,6 +40,108 @@ public class PlayerAbilityEvent extends PlayerEvent implements IPlayerAbilityEve
|
||||
return "playerAbilityEvent";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability starts executing (enters WINDUP phase).
|
||||
*/
|
||||
@Cancelable
|
||||
public static class StartEvent extends PlayerAbilityEvent implements IPlayerAbilityEvent.StartEvent {
|
||||
public StartEvent(IPlayer player, Ability ability, EntityLivingBase target) {
|
||||
super(player, ability, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_START.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability enters the ACTIVE phase and performs its effect.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class ExecuteEvent extends PlayerAbilityEvent implements IPlayerAbilityEvent.ExecuteEvent {
|
||||
public ExecuteEvent(IPlayer player, Ability ability, EntityLivingBase target) {
|
||||
super(player, ability, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_EXECUTE.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability is interrupted by damage.
|
||||
*/
|
||||
public static class InterruptEvent extends PlayerAbilityEvent implements IPlayerAbilityEvent.InterruptEvent {
|
||||
private final IDamageSource damageSource;
|
||||
private final float damage;
|
||||
|
||||
public InterruptEvent(IPlayer player, Ability ability, EntityLivingBase target, DamageSource source, float damage) {
|
||||
super(player, ability, target);
|
||||
this.damageSource = source != null ? NpcAPI.Instance().getIDamageSource(source) : null;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDamageSource getDamageSource() {
|
||||
return damageSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_INTERRUPT.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability completes its full execution cycle.
|
||||
*/
|
||||
public static class CompleteEvent extends PlayerAbilityEvent implements IPlayerAbilityEvent.CompleteEvent {
|
||||
public CompleteEvent(IPlayer player, Ability ability, EntityLivingBase target) {
|
||||
super(player, ability, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_COMPLETE.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every tick while a player's ability is executing.
|
||||
*/
|
||||
public static class TickEvent extends PlayerAbilityEvent implements IPlayerAbilityEvent.TickEvent {
|
||||
private final int abilityPhase;
|
||||
private final int tick;
|
||||
|
||||
public TickEvent(IPlayer player, Ability ability, EntityLivingBase target, int phase, int tick) {
|
||||
super(player, ability, target);
|
||||
this.abilityPhase = phase;
|
||||
this.tick = tick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAbilityPhase() {
|
||||
return abilityPhase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTick() {
|
||||
return tick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_TICK.function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability hits an entity with damage.
|
||||
* Canceling prevents the damage from being applied.
|
||||
|
||||
Reference in new issue
Block a user