mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 22:15:06 +00:00
Used interfaces in implementations instead of the real classes for most scripted classes.
This commit is contained in:
1 parent
6896cec417
commit
cf33b90b26
63 files changed
+466
-551
No files matched your search
@@ -1,8 +1,10 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLiving;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
|
||||
public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> implements IEntityLiving {
|
||||
|
||||
@@ -18,17 +20,17 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackTarget(ScriptLivingBase living){
|
||||
public void setAttackTarget(IEntityLivingBase living){
|
||||
if(living == null)
|
||||
entity.setAttackTarget(null);
|
||||
else
|
||||
entity.setAttackTarget(living.entity);
|
||||
entity.setAttackTarget(living.getMCEntity());
|
||||
super.setAttackTarget(living);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptLivingBase getAttackTarget(){
|
||||
ScriptLivingBase base = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAttackTarget());
|
||||
public IEntityLivingBase getAttackTarget(){
|
||||
IEntityLivingBase base = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAttackTarget());
|
||||
return (base != null)? base: super.getAttackTarget();
|
||||
}
|
||||
|
||||
@@ -58,7 +60,7 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeeEntity(ScriptEntity entity){
|
||||
return this.entity.getEntitySenses().canSee(entity.entity);
|
||||
public boolean canSeeEntity(IEntity entity){
|
||||
return this.entity.getEntitySenses().canSee(entity.getMCEntity());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user