mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 14:14:46 +00:00
Removed many unnecessary/redundant backported files. Focused only on classes that make events work.
This commit is contained in:
1 parent
5a1c4757cf
commit
8b6e84a8d4
66 files changed
+317
-2714
No files matched your search
@@ -19,6 +19,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.data.PlayerScriptData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptAnimal;
|
||||
import noppes.npcs.scripted.ScriptEntity;
|
||||
@@ -36,6 +38,7 @@ import noppes.npcs.scripted.ScriptMonster;
|
||||
import noppes.npcs.scripted.ScriptPixelmon;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.util.JsonException;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@@ -49,10 +52,13 @@ public class ScriptController {
|
||||
public long lastLoaded = 0;
|
||||
public File dir;
|
||||
public NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
|
||||
private boolean loaded = false;
|
||||
public boolean shouldSave = false;
|
||||
|
||||
|
||||
public PlayerScriptData playerScripts = new PlayerScriptData((EntityPlayer)null);
|
||||
public long lastPlayerUpdate = 0L;
|
||||
|
||||
public ScriptController(){
|
||||
loaded = false;
|
||||
Instance = this;
|
||||
@@ -68,6 +74,42 @@ public class ScriptController {
|
||||
}
|
||||
}
|
||||
|
||||
private File playerScriptsFile() {
|
||||
return new File(this.dir, "player_scripts.json");
|
||||
}
|
||||
|
||||
public boolean loadPlayerScripts() {
|
||||
this.playerScripts.clear();
|
||||
File file = this.playerScriptsFile();
|
||||
|
||||
try {
|
||||
if(!file.exists()) {
|
||||
return false;
|
||||
} else {
|
||||
this.playerScripts.readFromNBT(NBTJsonUtil.LoadFile(file));
|
||||
return true;
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
LogWriter.error("Error loading: " + file.getAbsolutePath(), var3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerScripts(NBTTagCompound compound) {
|
||||
this.playerScripts.readFromNBT(compound);
|
||||
File file = this.playerScriptsFile();
|
||||
|
||||
try {
|
||||
NBTJsonUtil.SaveFile(file, compound);
|
||||
this.lastPlayerUpdate = System.currentTimeMillis();
|
||||
} catch (IOException var4) {
|
||||
var4.printStackTrace();
|
||||
} catch (JsonException var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadCategories(){
|
||||
dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts");
|
||||
if(!dir.exists())
|
||||
|
||||
Reference in new issue
Block a user