mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 07:39:41 +00:00
More fixes to global NPC scripts not executing on servers, and added more functions to IEntityLivingBase.
This commit is contained in:
1 parent
8d52e9356c
commit
699b24e467
6 files changed
+51
-21
No files matched your search
@@ -53,13 +53,47 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
public void hurt(float damage, IDamageSource damageSource) {
|
||||
entity.attackEntityFrom(damageSource.getMCDamageSource(),damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Entity's max health
|
||||
*/
|
||||
|
||||
public double getMaxHealth(){
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getFollowRange() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.followRange).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getKnockbackResistance() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
|
||||
}
|
||||
|
||||
public double getMeleeStrength() {
|
||||
return entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
||||
}
|
||||
|
||||
public void setMaxHealth(double health){
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health);
|
||||
}
|
||||
|
||||
public void setFollowRange(double range) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(range);
|
||||
}
|
||||
|
||||
public void setKnockbackResistance(double knockbackResistance) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(knockbackResistance);
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(speed);
|
||||
}
|
||||
|
||||
public void setMeleeStrength(double attackDamage) {
|
||||
entity.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackDamage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not this entity is attacking something
|
||||
*/
|
||||
|
||||
@@ -779,14 +779,14 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @return The melee strength
|
||||
*/
|
||||
public float getMeleeStrength(){
|
||||
public double getMeleeStrength(){
|
||||
return npc.stats.getAttackStrength();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param strength The melee strength
|
||||
*/
|
||||
public void setMeleeStrength(float strength){
|
||||
public void setMeleeStrength(double strength){
|
||||
npc.stats.setAttackStrength(strength);
|
||||
}
|
||||
|
||||
@@ -1007,14 +1007,14 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @param resistance Knockback resistance (0-2) default is 1
|
||||
*/
|
||||
public void setKnockbackResistance(float resistance){
|
||||
npc.stats.resistances.knockback = ValueUtil.correctFloat(resistance, 0, 2);
|
||||
public void setKnockbackResistance(double resistance){
|
||||
npc.stats.resistances.knockback = ValueUtil.correctFloat((float) resistance, 0, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns Knockback Resistance
|
||||
*/
|
||||
public float getKnockbackResistance(){
|
||||
public double getKnockbackResistance(){
|
||||
return npc.stats.resistances.knockback;
|
||||
}
|
||||
|
||||
@@ -1141,11 +1141,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
return this.npc.ai.hasFlyLimit;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed) {
|
||||
public void setSpeed(double speed) {
|
||||
npc.ai.setWalkingSpeed(speed);
|
||||
}
|
||||
|
||||
public int getSpeed() {
|
||||
public double getSpeed() {
|
||||
return npc.ai.getWalkingSpeed();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user