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

+47 -49
View File
@@ -15,57 +15,55 @@ import noppes.npcs.entity.EntityNPCInterface;
import java.util.ArrayList;
import java.util.List;
public class JobGuard extends JobInterface{
public class JobGuard extends JobInterface {
public boolean attacksAnimals = false;
public boolean attackHostileMobs = true;
public boolean attackCreepers = false;
public List<String> targets = new ArrayList<String>();
public boolean specific = false;
public JobGuard(EntityNPCInterface npc) {
super(npc);
}
public boolean attacksAnimals = false;
public boolean attackHostileMobs = true;
public boolean attackCreepers = false;
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("GuardAttackAnimals", attacksAnimals);
nbttagcompound.setBoolean("GuardAttackMobs", attackHostileMobs);
nbttagcompound.setBoolean("GuardAttackCreepers", attackCreepers);
nbttagcompound.setBoolean("GuardSpecific", specific);
nbttagcompound.setTag("GuardTargets", NBTTags.nbtStringList(targets));
return nbttagcompound;
}
public List<String> targets = new ArrayList<String>();
public boolean specific = false;
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
attacksAnimals = nbttagcompound.getBoolean("GuardAttackAnimals");
attackHostileMobs = nbttagcompound.getBoolean("GuardAttackMobs");
attackCreepers = nbttagcompound.getBoolean("GuardAttackCreepers");
specific = nbttagcompound.getBoolean("GuardSpecific");
public JobGuard(EntityNPCInterface npc) {
super(npc);
}
targets = NBTTags.getStringList(nbttagcompound.getTagList("GuardTargets", 10));
}
public boolean isEntityApplicable(Entity entity) {
if(entity instanceof EntityPlayer || entity instanceof EntityNPCInterface)
return false;
if(specific && targets.contains("entity." + EntityList.getEntityString(entity) + ".name"))
return true;
if(entity instanceof EntityAnimal){
if(!attacksAnimals || entity instanceof EntityTameable && ((EntityTameable)entity).getOwner() != null)
return false;
return true;
}
else if (entity instanceof EntityCreeper) {
return attackCreepers;
}
else if(entity instanceof IMob || entity instanceof EntityDragon){
return attackHostileMobs;
}
return false;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("GuardAttackAnimals", attacksAnimals);
nbttagcompound.setBoolean("GuardAttackMobs", attackHostileMobs);
nbttagcompound.setBoolean("GuardAttackCreepers", attackCreepers);
nbttagcompound.setBoolean("GuardSpecific", specific);
nbttagcompound.setTag("GuardTargets", NBTTags.nbtStringList(targets));
return nbttagcompound;
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
attacksAnimals = nbttagcompound.getBoolean("GuardAttackAnimals");
attackHostileMobs = nbttagcompound.getBoolean("GuardAttackMobs");
attackCreepers = nbttagcompound.getBoolean("GuardAttackCreepers");
specific = nbttagcompound.getBoolean("GuardSpecific");
targets = NBTTags.getStringList(nbttagcompound.getTagList("GuardTargets", 10));
}
public boolean isEntityApplicable(Entity entity) {
if (entity instanceof EntityPlayer || entity instanceof EntityNPCInterface)
return false;
if (specific && targets.contains("entity." + EntityList.getEntityString(entity) + ".name"))
return true;
if (entity instanceof EntityAnimal) {
if (!attacksAnimals || entity instanceof EntityTameable && ((EntityTameable) entity).getOwner() != null)
return false;
return true;
} else if (entity instanceof EntityCreeper) {
return attackCreepers;
} else if (entity instanceof IMob || entity instanceof EntityDragon) {
return attackHostileMobs;
}
return false;
}
}