2021-10-20 23:04:52 -05:00
|
|
|
//
|
|
|
|
|
// Source code recreated from a .class file by IntelliJ IDEA
|
|
|
|
|
// (powered by FernFlower decompiler)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package noppes.npcs.scripted.event;
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.Cancelable;
|
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.util.DamageSource;
|
2022-03-23 03:54:06 -05:00
|
|
|
import noppes.npcs.controllers.Dialog;
|
2022-05-11 13:30:13 -05:00
|
|
|
import noppes.npcs.controllers.ScriptController;
|
2021-10-20 23:04:52 -05:00
|
|
|
import noppes.npcs.scripted.interfaces.*;
|
2022-05-11 16:43:14 -05:00
|
|
|
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
2022-05-11 22:08:31 -05:00
|
|
|
import noppes.npcs.scripted.NpcAPI;
|
2021-10-20 23:04:52 -05:00
|
|
|
|
|
|
|
|
public class NpcEvent extends CustomNPCsEvent {
|
|
|
|
|
public final ICustomNpc npc;
|
|
|
|
|
|
|
|
|
|
public NpcEvent(ICustomNpc npc) {
|
|
|
|
|
this.npc = npc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class TimerEvent extends NpcEvent {
|
|
|
|
|
public final int id;
|
|
|
|
|
|
|
|
|
|
public TimerEvent(ICustomNpc npc, int id) {
|
|
|
|
|
super(npc);
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class CollideEvent extends NpcEvent {
|
|
|
|
|
public final IEntity entity;
|
|
|
|
|
|
|
|
|
|
public CollideEvent(ICustomNpc npc, Entity entity) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.entity = NpcAPI.Instance().getIEntity(entity);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class DamagedEvent extends NpcEvent {
|
|
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
public float damage;
|
|
|
|
|
public boolean clearTarget = false;
|
|
|
|
|
|
|
|
|
|
public DamagedEvent(ICustomNpc npc, Entity source, float damage, DamageSource damagesource) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.source = NpcAPI.Instance().getIEntity(source);
|
2021-10-20 23:04:52 -05:00
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
2022-03-23 03:54:06 -05:00
|
|
|
|
|
|
|
|
public String getType(){
|
|
|
|
|
return damageSource.getMCDamageSource().damageType;
|
|
|
|
|
}
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class RangedLaunchedEvent extends NpcEvent {
|
|
|
|
|
public final IEntityLivingBase target;
|
|
|
|
|
public float damage;
|
|
|
|
|
//public List<IProjectile> projectiles = new ArrayList();
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
public RangedLaunchedEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
|
2021-10-20 23:04:52 -05:00
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
|
2021-10-20 23:04:52 -05:00
|
|
|
this.damage = damage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class MeleeAttackEvent extends NpcEvent {
|
|
|
|
|
public final IEntityLivingBase target;
|
|
|
|
|
public float damage;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
public MeleeAttackEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
|
2021-10-20 23:04:52 -05:00
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
|
2021-10-20 23:04:52 -05:00
|
|
|
this.damage = damage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class KilledEntityEvent extends NpcEvent {
|
|
|
|
|
public final IEntityLivingBase entity;
|
|
|
|
|
|
|
|
|
|
public KilledEntityEvent(ICustomNpc npc, EntityLivingBase entity) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.entity = (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class DiedEvent extends NpcEvent {
|
|
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final String type;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
public IItemStack[] droppedItems;
|
|
|
|
|
public int expDropped;
|
|
|
|
|
|
|
|
|
|
public DiedEvent(ICustomNpc npc, DamageSource damagesource, Entity entity) {
|
|
|
|
|
super(npc);
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
this.type = damagesource.damageType;
|
2022-05-11 22:08:31 -05:00
|
|
|
this.source = NpcAPI.Instance().getIEntity(entity);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
2022-03-23 03:54:06 -05:00
|
|
|
|
|
|
|
|
public String getType(){
|
|
|
|
|
return damageSource.getMCDamageSource().damageType;
|
|
|
|
|
}
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class InteractEvent extends NpcEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
|
|
|
|
|
public InteractEvent(ICustomNpc npc, EntityPlayer player) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
public static class DialogEvent extends NpcEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int id;
|
2022-04-09 00:17:16 -05:00
|
|
|
public final int optionId;
|
2022-03-23 03:54:06 -05:00
|
|
|
public final Dialog dialog;
|
|
|
|
|
|
2022-04-09 00:17:16 -05:00
|
|
|
public DialogEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
|
2022-03-23 03:54:06 -05:00
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
|
2022-03-23 03:54:06 -05:00
|
|
|
this.id = id;
|
2022-04-09 00:17:16 -05:00
|
|
|
this.optionId = optionId;
|
2022-03-23 03:54:06 -05:00
|
|
|
this.dialog = dialog;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class DialogClosedEvent extends NpcEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int id;
|
|
|
|
|
public final int optionId;
|
|
|
|
|
public final Dialog dialog;
|
|
|
|
|
|
|
|
|
|
public DialogClosedEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
|
2022-03-23 03:54:06 -05:00
|
|
|
this.id = id;
|
|
|
|
|
this.optionId = optionId;
|
|
|
|
|
this.dialog = dialog;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 23:04:52 -05:00
|
|
|
@Cancelable
|
|
|
|
|
public static class TargetLostEvent extends NpcEvent {
|
|
|
|
|
public final IEntityLivingBase entity;
|
|
|
|
|
|
|
|
|
|
public TargetLostEvent(ICustomNpc npc, EntityLivingBase entity) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class TargetEvent extends NpcEvent {
|
|
|
|
|
public IEntityLivingBase entity;
|
|
|
|
|
|
|
|
|
|
public TargetEvent(ICustomNpc npc, EntityLivingBase entity) {
|
|
|
|
|
super(npc);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class UpdateEvent extends NpcEvent {
|
|
|
|
|
public UpdateEvent(ICustomNpc npc) {
|
|
|
|
|
super(npc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class InitEvent extends NpcEvent {
|
|
|
|
|
public InitEvent(ICustomNpc npc) {
|
|
|
|
|
super(npc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|