npc.isSoulStoneinit

This commit is contained in:
1whohears committed 2022-06-07 12:31:49 -05:00
1 parent 5edb08945e
commit 825c42fc52
5 files changed
+13 -1

No files matched your search

+2 -1
View File
@@ -53,8 +53,9 @@ public class DataAdvanced {
public boolean defendFaction = false;
public boolean disablePitch = false;
public boolean refuseSoulStone = false;
public String soulStonePlayerName = "";
public boolean refuseSoulStone = false;
public boolean soulStoneInit = false;
public DataAdvanced(EntityNPCInterface npc) {
this.npc = npc;
@@ -218,6 +218,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
public void onUpdate(){
super.onUpdate();
if(this.ticksExisted % 10 == 0) {
advanced.soulStoneInit = false;
EventHooks.onNPCUpdate(this);
}
this.timers.update();
@@ -79,6 +79,7 @@ public class ItemSoulstoneFilled extends Item {
npc.setHealth(npc.getMaxHealth());
npc.setPosition((float)x + 0.5F, npc.getStartYPos(), (float)z + 0.5F);
npc.advanced.soulStonePlayerName = player.getDisplayName();
npc.advanced.soulStoneInit = true;
if(npc.advanced.role == EnumRoleType.Companion && player != null){
PlayerData data = PlayerDataController.instance.getPlayerData(player);
if(data.hasCompanion())
@@ -882,6 +882,10 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
public void setRefuseSoulStone(boolean refuse) {
npc.advanced.refuseSoulStone = refuse;
}
public boolean isSoulStoneInit() {
return npc.advanced.soulStoneInit;
}
public void giveItem(IPlayer player, IItemStack item){
npc.givePlayerItem((EntityPlayer) player.getMCEntity(), item.getMCItemStack());
@@ -634,6 +634,11 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
*/
String getSoulStonePlayerName();
/**
* @return true if npc was spawned by soul stone. becomes false after the init function is called.
*/
boolean isSoulStoneInit();
/**
* @return does this npc refuse to be taken by soul stone
*/