mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 17:44:46 +00:00
Implemented scripted timers for players and NPCs.
This commit is contained in:
1 parent
a993c8feff
commit
4de969f6c9
15 files changed
+327
-16
No files matched your search
@@ -87,6 +87,7 @@ import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.controllers.TransformData;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
import noppes.npcs.roles.JobInterface;
|
||||
@@ -115,6 +116,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public DataInventory inventory;
|
||||
public DataScript script;
|
||||
public TransformData transform;
|
||||
public DataTimers timers;
|
||||
|
||||
public String linkedName = "";
|
||||
public long linkedLast = 0;
|
||||
@@ -190,7 +192,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
inventory = new DataInventory(this);
|
||||
transform = new TransformData(this);
|
||||
script = new DataScript(this);
|
||||
|
||||
timers = new DataTimers(this);
|
||||
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
|
||||
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth);
|
||||
@@ -226,6 +228,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
super.onUpdate();
|
||||
if(this.ticksExisted % 10 == 0)
|
||||
script.callScript(EnumScriptType.TICK);
|
||||
this.timers.update();
|
||||
}
|
||||
|
||||
public void setWorld(World world){
|
||||
@@ -920,7 +923,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
stats.readToNBT(compound);
|
||||
ai.readToNBT(compound);
|
||||
script.readFromNBT(compound);
|
||||
|
||||
timers.readFromNBT(compound);
|
||||
advanced.readToNBT(compound);
|
||||
if (advanced.role != EnumRoleType.None && roleInterface != null)
|
||||
roleInterface.readFromNBT(compound);
|
||||
@@ -951,7 +954,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
stats.writeToNBT(compound);
|
||||
ai.writeToNBT(compound);
|
||||
script.writeToNBT(compound);
|
||||
|
||||
timers.writeToNBT(compound);
|
||||
advanced.writeToNBT(compound);
|
||||
if (advanced.role != EnumRoleType.None && roleInterface != null)
|
||||
roleInterface.writeToNBT(compound);
|
||||
|
||||
Reference in new issue
Block a user