Used interfaces in implementations instead of the real classes for most scripted classes.

This commit is contained in:
Luis C.M committed 2022-05-11 22:08:31 -05:00
1 parent 6896cec417
commit cf33b90b26
63 files changed
+466 -551

No files matched your search

@@ -18,7 +18,7 @@ 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;
import noppes.npcs.scripted.wrapper.NpcAPI;
import noppes.npcs.scripted.NpcAPI;
public class NpcEvent extends CustomNPCsEvent {
public final ICustomNpc npc;
@@ -41,7 +41,7 @@ public class NpcEvent extends CustomNPCsEvent {
public CollideEvent(ICustomNpc npc, Entity entity) {
super(npc);
this.entity = ScriptController.Instance.getScriptForEntity(entity);
this.entity = NpcAPI.Instance().getIEntity(entity);
}
}
@@ -54,7 +54,7 @@ public class NpcEvent extends CustomNPCsEvent {
public DamagedEvent(ICustomNpc npc, Entity source, float damage, DamageSource damagesource) {
super(npc);
this.source = ScriptController.Instance.getScriptForEntity(source);
this.source = NpcAPI.Instance().getIEntity(source);
this.damage = damage;
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
}
@@ -71,7 +71,7 @@ public class NpcEvent extends CustomNPCsEvent {
public RangedLaunchedEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
super(npc);
this.target = (IEntityLivingBase)ScriptController.Instance.getScriptForEntity(target);
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
this.damage = damage;
}
}
@@ -83,7 +83,7 @@ public class NpcEvent extends CustomNPCsEvent {
public MeleeAttackEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
super(npc);
this.target = (IEntityLivingBase)ScriptController.Instance.getScriptForEntity(target);
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
this.damage = damage;
}
}
@@ -93,7 +93,7 @@ public class NpcEvent extends CustomNPCsEvent {
public KilledEntityEvent(ICustomNpc npc, EntityLivingBase entity) {
super(npc);
this.entity = (IEntityLivingBase)ScriptController.Instance.getScriptForEntity(entity);
this.entity = (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity);
}
}
@@ -108,7 +108,7 @@ public class NpcEvent extends CustomNPCsEvent {
super(npc);
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
this.type = damagesource.damageType;
this.source = ScriptController.Instance.getScriptForEntity(entity);
this.source = NpcAPI.Instance().getIEntity(entity);
}
public String getType(){
@@ -122,7 +122,7 @@ public class NpcEvent extends CustomNPCsEvent {
public InteractEvent(ICustomNpc npc, EntityPlayer player) {
super(npc);
this.player = (IPlayer)ScriptController.Instance.getScriptForEntity(player);
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
}
}
@@ -134,7 +134,7 @@ public class NpcEvent extends CustomNPCsEvent {
public DialogEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
super(npc);
this.player = (IPlayer)ScriptController.Instance.getScriptForEntity(player);
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
this.id = id;
this.optionId = optionId;
this.dialog = dialog;
@@ -149,7 +149,7 @@ public class NpcEvent extends CustomNPCsEvent {
public DialogClosedEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
super(npc);
this.player = (IPlayer)ScriptController.Instance.getScriptForEntity(player);
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
this.id = id;
this.optionId = optionId;
this.dialog = dialog;
@@ -162,7 +162,7 @@ public class NpcEvent extends CustomNPCsEvent {
public TargetLostEvent(ICustomNpc npc, EntityLivingBase entity) {
super(npc);
this.entity = (IEntityLivingBase) ScriptController.Instance.getScriptForEntity(entity);
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
}
}
@@ -172,7 +172,7 @@ public class NpcEvent extends CustomNPCsEvent {
public TargetEvent(ICustomNpc npc, EntityLivingBase entity) {
super(npc);
this.entity = (IEntityLivingBase) ScriptController.Instance.getScriptForEntity(entity);
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
}
}