mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 04:35:03 +00:00
Fixed overloaded hurt(damage,entity) function not working when an entity is to be hurt by a player
This commit is contained in:
1 parent
06c730b166
commit
092b3ce0c1
3 files changed
+10
-4
No files matched your search
@@ -472,10 +472,10 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource damagesource, float i) {
|
||||
if (this.worldObj.isRemote || CustomNpcs.FreezeNPCs || damagesource.damageType.equals("inWall")){
|
||||
if (this.worldObj.isRemote || CustomNpcs.FreezeNPCs || (damagesource.damageType != null && damagesource.damageType.equals("inWall"))){
|
||||
return false;
|
||||
}
|
||||
if(damagesource.damageType.equals("outOfWorld") && isKilled()){
|
||||
if(damagesource.damageType != null && damagesource.damageType.equals("outOfWorld") && isKilled()){
|
||||
reset();
|
||||
}
|
||||
i = stats.resistances.applyResistance(damagesource, i);
|
||||
|
||||
@@ -41,7 +41,10 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
}
|
||||
|
||||
public void hurt(float damage, ScriptEntity source) {
|
||||
entity.attackEntityFrom(new EntityDamageSource(source.getTypeName(),source.getMCEntity()),damage);
|
||||
if(source.getType() == 1)//if player
|
||||
entity.attackEntityFrom(new EntityDamageSource("player",source.getMCEntity()),damage);
|
||||
else
|
||||
entity.attackEntityFrom(new EntityDamageSource(source.getTypeName(),source.getMCEntity()),damage);
|
||||
}
|
||||
|
||||
public void hurt(float damage, ScriptDamageSource damageSource) {
|
||||
|
||||
@@ -233,7 +233,10 @@ public class WrapperNpcAPI extends NpcAPI {
|
||||
}
|
||||
|
||||
public IDamageSource getIDamageSource(IEntity entity) {
|
||||
return new ScriptDamageSource(new EntityDamageSource(entity.getTypeName(),entity.getMCEntity()));
|
||||
if(entity.getType() == 1)//if player
|
||||
return new ScriptDamageSource(new EntityDamageSource("player",entity.getMCEntity()));
|
||||
else
|
||||
return new ScriptDamageSource(new EntityDamageSource(entity.getTypeName(),entity.getMCEntity()));
|
||||
}
|
||||
|
||||
public void executeCommand(IWorld world, String command) {
|
||||
|
||||
Reference in new issue
Block a user