Proper Reformating

This commit is contained in:
Kam committed 2025-03-13 17:14:45 -04:00
1 parent ce75880aba
commit 180d257024
1179 files changed
+59847 -61583

No files matched your search

+52 -51
View File
@@ -9,64 +9,65 @@ import noppes.npcs.entity.EntityNPCInterface;
import java.util.ArrayList;
import java.util.List;
public class JobHealer extends JobInterface{
private long healTicks = 0;
public int range = 5;
public int speed = 5;
public class JobHealer extends JobInterface {
private long healTicks = 0;
public int range = 5;
public int speed = 5;
public JobHealer(EntityNPCInterface npc) {
super(npc);
}
public JobHealer(EntityNPCInterface npc) {
super(npc);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("HealerRange", range);
nbttagcompound.setInteger("HealerSpeed", speed);
return nbttagcompound;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("HealerRange", range);
nbttagcompound.setInteger("HealerSpeed", speed);
return nbttagcompound;
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
range = nbttagcompound.getInteger("HealerRange");
speed = nbttagcompound.getInteger("HealerSpeed");
}
private List<EntityLivingBase> toHeal = new ArrayList<EntityLivingBase>();
public boolean aiShouldExecute() {
healTicks++;
if (healTicks < speed * 10)
return false;
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
range = nbttagcompound.getInteger("HealerRange");
speed = nbttagcompound.getInteger("HealerSpeed");
}
for(Object plObj: npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range/2.0, range))){
EntityLivingBase entity = (EntityLivingBase) plObj;
private List<EntityLivingBase> toHeal = new ArrayList<EntityLivingBase>();
if(entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer) entity;
if(player.getHealth() < player.getMaxHealth() && !npc.faction.isAggressiveToPlayer(player))
toHeal.add(player);
}
if(entity instanceof EntityNPCInterface){
EntityNPCInterface npc = (EntityNPCInterface) entity;
if(npc.getHealth() < npc.getMaxHealth() && !this.npc.faction.isAggressiveToNpc(npc))
toHeal.add(npc);
}
public boolean aiShouldExecute() {
healTicks++;
if (healTicks < speed * 10)
return false;
}
for (Object plObj : npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range / 2.0, range))) {
EntityLivingBase entity = (EntityLivingBase) plObj;
healTicks = 0;
return !toHeal.isEmpty();
}
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (player.getHealth() < player.getMaxHealth() && !npc.faction.isAggressiveToPlayer(player))
toHeal.add(player);
}
if (entity instanceof EntityNPCInterface) {
EntityNPCInterface npc = (EntityNPCInterface) entity;
if (npc.getHealth() < npc.getMaxHealth() && !this.npc.faction.isAggressiveToNpc(npc))
toHeal.add(npc);
}
public void aiStartExecuting() {
for(EntityLivingBase entity : toHeal){
float heal = entity.getMaxHealth() / 20; //heal 5% of max health
heal(entity, heal > 0?heal:1);
}
toHeal.clear();
}
}
public void heal(EntityLivingBase entity, float amount){
entity.heal(amount);
NoppesUtilServer.spawnParticle(entity, "heal",entity.dimension);
}
healTicks = 0;
return !toHeal.isEmpty();
}
public void aiStartExecuting() {
for (EntityLivingBase entity : toHeal) {
float heal = entity.getMaxHealth() / 20; //heal 5% of max health
heal(entity, heal > 0 ? heal : 1);
}
toHeal.clear();
}
public void heal(EntityLivingBase entity, float amount) {
entity.heal(amount);
NoppesUtilServer.spawnParticle(entity, "heal", entity.dimension);
}
}