Implemented scripted timers for players and NPCs.

This commit is contained in:
luisc committed 2021-10-20 23:04:52 -05:00
1 parent a993c8feff
commit 4de969f6c9
15 files changed
+327 -16

No files matched your search

@@ -1,5 +1,6 @@
package noppes.npcs.scripted.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -26,10 +27,12 @@ import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.ITimers;
import noppes.npcs.util.ValueUtil;
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
public T player;
private PlayerData data;
public ScriptPlayer(T player){
super(player);
this.player = player;
@@ -350,4 +353,16 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return null;
return new ScriptPixelmonPlayerData(player);
}
private PlayerData getData() {
if (this.data == null) {
this.data = PlayerData.get(player);
}
return this.data;
}
public ITimers getTimers() {
return this.getData().timers;
}
}