mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 20:49:05 +00:00
Went down huge rabbit hole to attempt adding scripted events for players. Chock full of errors, trying to backport classes from the 1.12 version.
This commit is contained in:
1 parent
71e13a177f
commit
5a1c4757cf
72 files changed
+4014
-20
No files matched your search
@@ -0,0 +1,143 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListenableFutureTask;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptEvent;
|
||||
import noppes.npcs.scripted.ScriptNpc;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class EventDataScript implements IScriptHandler {
|
||||
private List<EventScriptContainer> scripts = new ArrayList();
|
||||
private String scriptLanguage = "ECMAScript";
|
||||
public long lastInited = -1L;
|
||||
public boolean hadInteract = true;
|
||||
private boolean enabled = false;
|
||||
|
||||
public EventDataScript() {
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.scripts = new ArrayList();
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.scripts = NBTTags.GetScript(compound.getTagList("Scripts", 10), this);
|
||||
this.scriptLanguage = compound.getString("ScriptLanguage");
|
||||
this.enabled = compound.getBoolean("ScriptEnabled");
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("Scripts", NBTTags.NBTScript(this.scripts));
|
||||
compound.setString("ScriptLanguage", this.scriptLanguage);
|
||||
compound.setBoolean("ScriptEnabled", this.enabled);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void runScript(EnumScriptType type, Event event) {
|
||||
}
|
||||
|
||||
public void runScript(String type, Event event) {
|
||||
if(this.isEnabled()) {
|
||||
Minecraft.getMinecraft().func_152344_a(() -> {
|
||||
if (ScriptController.Instance.lastLoaded > this.lastInited) {
|
||||
this.lastInited = ScriptController.Instance.lastLoaded;
|
||||
if (!type.equals("init")) {
|
||||
EventHooks.onForgeInit(this);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator var3 = this.scripts.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer) var3.next();
|
||||
script.run(type, event);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled && ScriptController.HasStart && this.scripts.size() > 0;
|
||||
}
|
||||
|
||||
public boolean isClient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean bo) {
|
||||
this.enabled = bo;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.scriptLanguage;
|
||||
}
|
||||
|
||||
public void setLanguage(String lang) {
|
||||
this.scriptLanguage = lang;
|
||||
}
|
||||
|
||||
public List<EventScriptContainer> getScripts() {
|
||||
return this.scripts;
|
||||
}
|
||||
|
||||
public String noticeString() {
|
||||
return "ForgeScript";
|
||||
}
|
||||
|
||||
public Map<Long, String> getConsoleText() {
|
||||
TreeMap map = new TreeMap();
|
||||
int tab = 0;
|
||||
Iterator var3 = this.getScripts().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer)var3.next();
|
||||
++tab;
|
||||
Iterator var5 = script.console.entrySet().iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry)var5.next();
|
||||
map.put(entry.getKey(), " tab " + tab + ":\n" + (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public void clearConsole() {
|
||||
Iterator var1 = this.getScripts().iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer)var1.next();
|
||||
script.console.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.entity.IEntityItem;
|
||||
import noppes.npcs.scripted.entity.IProjectile;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.AttackEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerClosed;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.FactionUpdateEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.KeyPressedEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LevelUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.TossEvent;
|
||||
import noppes.npcs.scripted.wrapper.PlayerWrapper;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
|
||||
public class EventHooks {
|
||||
public EventHooks() {
|
||||
}
|
||||
|
||||
public static void onForgeInit(EventDataScript handler) {
|
||||
noppes.npcs.scripted.event.ForgeEvent.InitEvent event = new noppes.npcs.scripted.event.ForgeEvent.InitEvent();
|
||||
handler.runScript(EnumScriptType.INIT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerInit(PlayerScriptData handler) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.InitEvent event = new noppes.npcs.scripted.event.PlayerEvent.InitEvent(handler.getPlayer());
|
||||
handler.runScript(EnumScriptType.INIT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerTick(PlayerScriptData handler) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.UpdateEvent event = new noppes.npcs.scripted.event.PlayerEvent.UpdateEvent(handler.getPlayer());
|
||||
handler.runScript(EnumScriptType.TICK, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerInteract(PlayerScriptData handler, noppes.npcs.scripted.event.PlayerEvent.InteractEvent event) {
|
||||
handler.runScript(EnumScriptType.INTERACT, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerAttack(PlayerScriptData handler, AttackEvent event) {
|
||||
handler.runScript(EnumScriptType.ATTACK, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerBreak(PlayerScriptData handler, noppes.npcs.scripted.event.PlayerEvent.BreakEvent event) {
|
||||
handler.runScript(EnumScriptType.BROKEN, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerToss(PlayerScriptData handler, EntityItem entityItem) {
|
||||
TossEvent event = new TossEvent(handler.getPlayer(), NpcAPI.Instance().getIItemStack(entityItem.func_92059_d()));
|
||||
handler.runScript(EnumScriptType.TOSS, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerLevelUp(PlayerScriptData handler, int change) {
|
||||
LevelUpEvent event = new LevelUpEvent(handler.getPlayer(), change);
|
||||
handler.runScript(EnumScriptType.LEVEL_UP, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerPickUp(PlayerScriptData handler, EntityItem entityItem) {
|
||||
PickUpEvent event = new PickUpEvent(handler.getPlayer(), NpcAPI.Instance().getIItemStack(entityItem.func_92059_d()));
|
||||
handler.runScript(EnumScriptType.PICKUP, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerContainerOpen(PlayerScriptData handler, Container container) {
|
||||
ContainerOpen event = new ContainerOpen(handler.getPlayer(), NpcAPI.Instance().getIContainer(container));
|
||||
handler.runScript(EnumScriptType.CONTAINER_OPEN, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerContainerClose(PlayerScriptData handler, Container container) {
|
||||
ContainerClosed event = new ContainerClosed(handler.getPlayer(), NpcAPI.Instance().getIContainer(container));
|
||||
handler.runScript(EnumScriptType.CONTAINER_CLOSED, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerDeath(PlayerScriptData handler, DamageSource source, Entity entity) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.DiedEvent event = new noppes.npcs.scripted.event.PlayerEvent.DiedEvent(handler.getPlayer(), source, entity);
|
||||
handler.runScript(EnumScriptType.KILLED, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerKills(PlayerScriptData handler, EntityLivingBase entityLiving) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent event = new noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent(handler.getPlayer(), entityLiving);
|
||||
handler.runScript(EnumScriptType.KILLS, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerDamaged(PlayerScriptData handler, noppes.npcs.scripted.event.PlayerEvent.DamagedEvent event) {
|
||||
handler.runScript(EnumScriptType.DAMAGED, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerLogin(PlayerScriptData handler) {
|
||||
LoginEvent event = new LoginEvent(handler.getPlayer());
|
||||
handler.runScript(EnumScriptType.LOGIN, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerLogout(PlayerScriptData handler) {
|
||||
LogoutEvent event = new LogoutEvent(handler.getPlayer());
|
||||
handler.runScript(EnumScriptType.LOGOUT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerChat(PlayerScriptData handler, ChatEvent event) {
|
||||
handler.runScript(EnumScriptType.CHAT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerRanged(PlayerScriptData handler, noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent event) {
|
||||
handler.runScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerDamagedEntity(PlayerScriptData handler, DamagedEntityEvent event) {
|
||||
handler.runScript(EnumScriptType.DAMAGED_ENTITY, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void OnPlayerFactionChange(PlayerScriptData handler, FactionUpdateEvent event) {
|
||||
if(!handler.isClient()) {
|
||||
handler.runScript(EnumScriptType.FACTION_UPDATE, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed) {
|
||||
PlayerScriptData handler = PlayerData.get(player).scriptData;
|
||||
KeyPressedEvent event = new KeyPressedEvent(handler.getPlayer(), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed);
|
||||
handler.runScript(EnumScriptType.KEY_PRESSED, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Map.Entry;
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.constants.*;
|
||||
|
||||
public class EventScriptContainer {
|
||||
private static final String lock = "lock";
|
||||
public static EventScriptContainer Current;
|
||||
private static String CurrentType;
|
||||
private static final HashMap<String, Object> Data = new HashMap();
|
||||
public String fullscript = "";
|
||||
public String script = "";
|
||||
public TreeMap<Long, String> console = new TreeMap();
|
||||
public boolean errored = false;
|
||||
public List<String> scripts = new ArrayList();
|
||||
private HashSet<String> unknownFunctions = new HashSet();
|
||||
public long lastCreated = 0L;
|
||||
private String currentScriptLanguage = null;
|
||||
private ScriptEngine engine = null;
|
||||
private IScriptHandler handler = null;
|
||||
private boolean init = false;
|
||||
private static Method luaCoerce;
|
||||
private static Method luaCall;
|
||||
|
||||
private static void FillMap(Class c) {
|
||||
try {
|
||||
Data.put(c.getSimpleName(), c.newInstance());
|
||||
} catch (Exception var8) {
|
||||
;
|
||||
}
|
||||
|
||||
Field[] declaredFields = c.getDeclaredFields();
|
||||
Field[] var2 = declaredFields;
|
||||
int var3 = declaredFields.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
Field field = var2[var4];
|
||||
|
||||
try {
|
||||
if(Modifier.isStatic(field.getModifiers()) && field.getType() == Integer.TYPE) {
|
||||
Data.put(c.getSimpleName() + "_" + field.getName(), Integer.valueOf(field.getInt((Object)null)));
|
||||
}
|
||||
} catch (Exception var7) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public EventScriptContainer(IScriptHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.script = compound.getString("Script");
|
||||
this.console = NBTTags.GetLongStringMap(compound.getTagList("Console", 10));
|
||||
this.scripts = NBTTags.getStringList(compound.getTagList("ScriptList", 10));
|
||||
this.lastCreated = 0L;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setString("Script", this.script);
|
||||
compound.setTag("Console", NBTTags.NBTLongStringMap(this.console));
|
||||
compound.setTag("ScriptList", NBTTags.nbtStringList(this.scripts));
|
||||
return compound;
|
||||
}
|
||||
|
||||
private String getFullCode() {
|
||||
if(!this.init) {
|
||||
this.fullscript = this.script;
|
||||
if(!this.fullscript.isEmpty()) {
|
||||
this.fullscript = this.fullscript + "\n";
|
||||
}
|
||||
|
||||
Iterator var1 = this.scripts.iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
String loc = (String)var1.next();
|
||||
String code = (String)ScriptController.Instance.scripts.get(loc);
|
||||
if(code != null && !code.isEmpty()) {
|
||||
this.fullscript = this.fullscript + code + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
this.unknownFunctions = new HashSet();
|
||||
}
|
||||
|
||||
return this.fullscript;
|
||||
}
|
||||
|
||||
public void run(EnumScriptType type, Event event) {
|
||||
this.run((String)type.function, (Object)event);
|
||||
}
|
||||
|
||||
public void run(String type, Object event) {
|
||||
if(!this.errored && this.hasCode() && !this.unknownFunctions.contains(type) /*&& CustomNpcs.EnableScripting*/) {
|
||||
this.setEngine(currentScriptLanguage.toLowerCase());
|
||||
if(this.engine != null) {
|
||||
if(ScriptController.Instance.lastLoaded > this.lastCreated) {
|
||||
this.lastCreated = ScriptController.Instance.lastLoaded;
|
||||
this.init = false;
|
||||
}
|
||||
|
||||
String var3 = "lock";
|
||||
synchronized("lock") {
|
||||
Current = this;
|
||||
CurrentType = type;
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
this.engine.getContext().setWriter(pw);
|
||||
this.engine.getContext().setErrorWriter(pw);
|
||||
|
||||
try {
|
||||
if(!this.init) {
|
||||
this.engine.eval(this.getFullCode());
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
if(this.engine.getFactory().getLanguageName().equals("lua")) {
|
||||
Object e = this.engine.get(type);
|
||||
if(e != null) {
|
||||
if(luaCoerce == null) {
|
||||
luaCoerce = Class.forName("org.luaj.vm2.lib.jse.CoerceJavaToLua").getMethod("coerce", new Class[]{Object.class});
|
||||
luaCall = e.getClass().getMethod("call", new Class[]{Class.forName("org.luaj.vm2.LuaValue")});
|
||||
}
|
||||
|
||||
luaCall.invoke(e, new Object[]{luaCoerce.invoke((Object)null, new Object[]{event})});
|
||||
} else {
|
||||
this.unknownFunctions.add(type);
|
||||
}
|
||||
} else {
|
||||
((Invocable)this.engine).invokeFunction(type, new Object[]{event});
|
||||
}
|
||||
} catch (NoSuchMethodException var13) {
|
||||
this.unknownFunctions.add(type);
|
||||
} catch (Throwable var14) {
|
||||
this.errored = true;
|
||||
var14.printStackTrace(pw);
|
||||
//NoppesUtilServer.NotifyOPs(this.handler.noticeString() + " script errored", new Object[0]);
|
||||
} finally {
|
||||
this.appandConsole(sw.getBuffer().toString().trim());
|
||||
pw.close();
|
||||
Current = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void appandConsole(String message) {
|
||||
if(message != null && !message.isEmpty()) {
|
||||
long time = System.currentTimeMillis();
|
||||
if(this.console.containsKey(Long.valueOf(time))) {
|
||||
message = (String)this.console.get(Long.valueOf(time)) + "\n" + message;
|
||||
}
|
||||
|
||||
this.console.put(Long.valueOf(time), message);
|
||||
|
||||
while(this.console.size() > 40) {
|
||||
this.console.remove(this.console.firstKey());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return !this.getFullCode().isEmpty();
|
||||
}
|
||||
|
||||
public void setEngine(String scriptLanguage) {
|
||||
if(this.currentScriptLanguage == null || !this.currentScriptLanguage.equals(scriptLanguage)) {
|
||||
this.engine = ScriptController.Instance.getEngineByName(scriptLanguage);
|
||||
if(this.engine == null) {
|
||||
this.errored = true;
|
||||
} else {
|
||||
Iterator var2 = Data.entrySet().iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
Entry entry = (Entry)var2.next();
|
||||
this.engine.put((String)entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
//this.engine.put("dump", new Dump(this, (1)null));
|
||||
//this.engine.put("log", new Log(this, (1)null));
|
||||
this.currentScriptLanguage = scriptLanguage;
|
||||
this.init = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return this.init && !this.errored;
|
||||
}
|
||||
|
||||
static {
|
||||
FillMap(AnimationType.class);
|
||||
FillMap(EntityType.class);
|
||||
FillMap(RoleType.class);
|
||||
FillMap(JobType.class);
|
||||
//FillMap(SideType.class);
|
||||
//FillMap(TacticalType.class);
|
||||
//FillMap(PotionType.class);
|
||||
//FillMap(ParticleType.class);
|
||||
Data.put("PosZero", new BlockPos(BlockPos.ORIGIN));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
|
||||
public interface IScriptHandler {
|
||||
void runScript(EnumScriptType var1, Event var2);
|
||||
|
||||
boolean isClient();
|
||||
|
||||
boolean getEnabled();
|
||||
|
||||
void setEnabled(boolean var1);
|
||||
|
||||
String getLanguage();
|
||||
|
||||
void setLanguage(String var1);
|
||||
|
||||
List<EventScriptContainer> getScripts();
|
||||
|
||||
String noticeString();
|
||||
|
||||
Map<Long, String> getConsoleText();
|
||||
|
||||
void clearConsole();
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
@@ -13,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
|
||||
public class NBTTags {
|
||||
|
||||
@@ -383,4 +379,60 @@ public class NBTTags {
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static TreeMap<Long, String> GetLongStringMap(NBTTagList tagList) {
|
||||
TreeMap list = new TreeMap();
|
||||
|
||||
for(int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i);
|
||||
list.put(Long.valueOf(nbttagcompound.getLong("Long")), nbttagcompound.getString("String"));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static NBTTagList NBTLongStringMap(Map<Long, String> map) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if(map == null) {
|
||||
return nbttaglist;
|
||||
} else {
|
||||
Iterator var2 = map.keySet().iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
long slot = ((Long)var2.next()).longValue();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.setLong("Long", slot);
|
||||
nbttagcompound.setString("String", (String) map.get(Long.valueOf(slot)));
|
||||
nbttaglist.appendTag(nbttagcompound);
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<EventScriptContainer> GetScript(NBTTagList list, IScriptHandler handler) {
|
||||
ArrayList scripts = new ArrayList();
|
||||
|
||||
for(int i = 0; i < list.tagCount(); ++i) {
|
||||
NBTTagCompound compoundd = list.getCompoundTagAt(i);
|
||||
EventScriptContainer script = new EventScriptContainer(handler);
|
||||
script.readFromNBT(compoundd);
|
||||
scripts.add(script);
|
||||
}
|
||||
|
||||
return scripts;
|
||||
}
|
||||
|
||||
public static NBTTagList NBTScript(List<EventScriptContainer> scripts) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
Iterator var2 = scripts.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer)var2.next();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
script.writeToNBT(compound);
|
||||
list.appendTag(compound);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -62,16 +62,7 @@ import noppes.npcs.client.controllers.PresetController;
|
||||
import noppes.npcs.client.fx.EntityElementalStaffFX;
|
||||
import noppes.npcs.client.fx.EntityEnderFX;
|
||||
import noppes.npcs.client.fx.EntityRainbowFX;
|
||||
import noppes.npcs.client.gui.GuiBorderBlock;
|
||||
import noppes.npcs.client.gui.GuiMerchantAdd;
|
||||
import noppes.npcs.client.gui.GuiNpcDimension;
|
||||
import noppes.npcs.client.gui.GuiNpcMobSpawner;
|
||||
import noppes.npcs.client.gui.GuiNpcMobSpawnerMounter;
|
||||
import noppes.npcs.client.gui.GuiNpcPather;
|
||||
import noppes.npcs.client.gui.GuiNpcRedstoneBlock;
|
||||
import noppes.npcs.client.gui.GuiNpcRemoteEditor;
|
||||
import noppes.npcs.client.gui.GuiNpcWaypoint;
|
||||
import noppes.npcs.client.gui.GuiScript;
|
||||
import noppes.npcs.client.gui.*;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageBanks;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageFactions;
|
||||
@@ -377,6 +368,9 @@ public class ClientProxy extends CommonProxy {
|
||||
else if(gui == EnumGuiType.NpcRemote && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiNpcRemoteEditor();
|
||||
|
||||
else if(gui == EnumGuiType.ScriptEvent && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiScriptEvent();
|
||||
|
||||
else if(gui == EnumGuiType.PlayerMailman)
|
||||
return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1);
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.EventDataScript;
|
||||
import noppes.npcs.EventScriptContainer;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GuiScriptEvent extends GuiNPCInterface {
|
||||
public boolean showScript = false;
|
||||
private int activeTab = 0;
|
||||
private String activeScriptTab = "init";
|
||||
public EventDataScript script;
|
||||
public Map<String,List<String>> languages = new HashMap<String,List<String>>();
|
||||
|
||||
private static int activeConsole = 0;
|
||||
|
||||
public GuiScriptEvent(){
|
||||
super();
|
||||
drawDefaultBackground = true;
|
||||
closeOnEsc = true;
|
||||
xSize = 420;
|
||||
setBackground("menubg.png");
|
||||
|
||||
//Client.sendData(EnumPacketServer.RemoteNpcsGet); TODO: Get Player & Forge event scripts
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
GuiMenuTopButton top;
|
||||
addTopButton(top = new GuiMenuTopButton(13, guiLeft + 4, guiTop - 17, "eventscript.playerevent"));
|
||||
top.active = showScript;
|
||||
addTopButton(top = new GuiMenuTopButton(14, top, "gui.settings"));
|
||||
top.active = !showScript;
|
||||
addTopButton(new GuiMenuTopButton(15, top, "gui.website"));
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add("playerscript.attack");
|
||||
list.add("playerscript.break");
|
||||
list.add("playerscript.chat");
|
||||
list.add("playerscript.containerclosed");
|
||||
list.add("playerscript.containeropen");
|
||||
list.add("playerscript.damagedentity");
|
||||
list.add("playerscript.damaged");
|
||||
list.add("playerscript.killed");
|
||||
list.add("playerscript.factionupdate");
|
||||
list.add("playerscript.init");
|
||||
list.add("playerscript.interact");
|
||||
list.add("playerscript.keypressed");
|
||||
list.add("playerscript.kills");
|
||||
list.add("playerscript.levelup");
|
||||
list.add("playerscript.login");
|
||||
list.add("playerscript.logout");
|
||||
list.add("playerscript.pickup");
|
||||
list.add("playerscript.rangedlaunched");
|
||||
list.add("playerscript.toss");
|
||||
list.add("playerscript.update");
|
||||
|
||||
if(showScript) {
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.setSize(68, 198);
|
||||
hooks.guiLeft = guiLeft + 4;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
hooks.setUnsortedList(list);
|
||||
hooks.selected = script.getScripts().indexOf(activeScriptTab);
|
||||
addScroll(hooks);
|
||||
|
||||
EventScriptContainer container = script.getScripts().get(script.getScripts().indexOf(activeScriptTab));
|
||||
|
||||
addTextField(new GuiNpcTextArea(2, this, guiLeft + 74, guiTop + 4, 239, 208, container == null?"":container.script));
|
||||
|
||||
addButton(new GuiNpcButton(102, guiLeft + 315, guiTop + 4, 50, 20, "gui.clear"));
|
||||
addButton(new GuiNpcButton(101, guiLeft + 366, guiTop + 4, 50, 20, "gui.paste"));
|
||||
addButton(new GuiNpcButton(100, guiLeft + 315, guiTop + 25, 50, 20, "gui.copy"));
|
||||
|
||||
addButton(new GuiNpcButton(108, guiLeft + 315, guiTop + 47, 80, 20, "gui.editor"));
|
||||
|
||||
addButton(new GuiNpcButton(107, guiLeft + 315, guiTop + 70, 80, 20, "script.loadscript"));
|
||||
|
||||
GuiCustomScroll scroll = new GuiCustomScroll(this, 0).setUnselectable();
|
||||
scroll.setSize(100, 120);
|
||||
scroll.guiLeft = guiLeft + 315;
|
||||
scroll.guiTop = guiTop + 92;
|
||||
if(container != null)
|
||||
scroll.setList(container.scripts);
|
||||
addScroll(scroll);
|
||||
}
|
||||
else{
|
||||
addLabel(new GuiNpcLabel(0, "script.console", guiLeft + 4, guiTop + 16));
|
||||
getTopButton(14).active = true;
|
||||
addTextField(new GuiNpcTextArea(2, this, guiLeft + 4, guiTop + 26, 226, 186, getConsoleText()));
|
||||
getTextField(2).canEdit = false;
|
||||
addButton(new GuiNpcButton(100, guiLeft + 232, guiTop + 170, 56, 20, "gui.copy"));
|
||||
addButton(new GuiNpcButton(102, guiLeft + 232, guiTop + 192, 56, 20, "gui.clear"));
|
||||
|
||||
List<String> l = new ArrayList<String>();
|
||||
l.add("All");
|
||||
l.addAll(list);
|
||||
addButton(new GuiNpcButton(105, guiLeft + 60, guiTop + 4, 80, 20, l.toArray(new String[l.size()]), activeConsole));
|
||||
|
||||
addLabel(new GuiNpcLabel(1, "script.language", guiLeft + 232, guiTop + 30));
|
||||
addButton(new GuiNpcButton(103, guiLeft + 294, guiTop + 25, 80, 20, languages.keySet().toArray(new String[languages.keySet().size()]), getScriptIndex()));
|
||||
getButton(103).enabled = languages.size() > 0;
|
||||
|
||||
addLabel(new GuiNpcLabel(2, "gui.enabled", guiLeft + 232, guiTop + 53));
|
||||
//addButton(new GuiNpcButton(104, guiLeft + 294, guiTop + 48, 50, 20, new String[]{"gui.no","gui.yes"}, script.enabled?1:0));
|
||||
|
||||
if(MinecraftServer.getServer() != null)
|
||||
addButton(new GuiNpcButton(106, guiLeft + 232, guiTop + 71, 150, 20, "script.openfolder"));
|
||||
}
|
||||
}
|
||||
|
||||
private int getScriptIndex() {
|
||||
/*
|
||||
int i = 0;
|
||||
for(String language : languages.keySet()){
|
||||
if(language.equalsIgnoreCase(script.scriptLanguage))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String getConsoleText() {
|
||||
String console = "";
|
||||
/*
|
||||
if(activeConsole == 0){
|
||||
for(ScriptContainer container : script.scripts.values()){
|
||||
if(!container.console.isEmpty())
|
||||
console += container.console + '\n';
|
||||
}
|
||||
}
|
||||
else{
|
||||
ScriptContainer container = script.scripts.get(activeConsole - 1);
|
||||
if(container != null)
|
||||
console = container.console;
|
||||
}
|
||||
*/
|
||||
return console;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
public enum EnumGuiType {
|
||||
MainMenuDisplay, MainMenuInv, MainMenuStats, ManageFactions, MainMenuAdvanced, MainMenuGlobal, PlayerBankSmall, PlayerFollowerHire, PlayerFollower, SetupItemGiver, SetupTrader, SetupFollower, PlayerTrader, PlayerTransporter, RedstoneBlock, SetupTransporter, ManageTransport, ManageBanks, MobSpawner, SetupBank, ManageDialogs, ManageQuests, PlayerAnvil, QuestReward, ManageRecipes, QuestItem, NpcRemote, MoneyBag, MainMenuAI, MovingPath, PlayerBankUnlock, PlayerBankUprade, PlayerBankLarge, MobSpawnerAdd, PlayerMailbox, PlayerMailman, Waypoint, MerchantAdd, MobSpawnerMounter, Crate, NpcDimensions, Border, BigSign, Script, Companion, CompanionInv, CompanionTalent, CompanionTrader, ManageLinked
|
||||
MainMenuDisplay, MainMenuInv, MainMenuStats, ManageFactions, MainMenuAdvanced, MainMenuGlobal, PlayerBankSmall, PlayerFollowerHire, PlayerFollower, SetupItemGiver, SetupTrader, SetupFollower, PlayerTrader, PlayerTransporter, RedstoneBlock, SetupTransporter, ManageTransport, ManageBanks, MobSpawner, SetupBank, ManageDialogs, ManageQuests, PlayerAnvil, QuestReward, ManageRecipes, QuestItem, NpcRemote, ScriptEvent, MoneyBag, MainMenuAI, MovingPath, PlayerBankUnlock, PlayerBankUprade, PlayerBankLarge, MobSpawnerAdd, PlayerMailbox, PlayerMailman, Waypoint, MerchantAdd, MobSpawnerMounter, Crate, NpcDimensions, Border, BigSign, Script, Companion, CompanionInv, CompanionTalent, CompanionTrader, ManageLinked
|
||||
}
|
||||
@@ -1,5 +1,62 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
public enum EnumScriptType {
|
||||
INIT, TICK, INTERACT, DIALOG, DAMAGED, KILLED, ATTACK, TARGET, COLLIDE, KILLS, DIALOG_OPTION
|
||||
INIT("init"),
|
||||
TICK("tick"),
|
||||
INTERACT("interact"),
|
||||
DIALOG("dialog"),
|
||||
DAMAGED("damaged"),
|
||||
KILLED("killed"),
|
||||
ATTACK_MELEE("meleeAttack"),
|
||||
TARGET("target"),
|
||||
COLLIDE("collide"),
|
||||
KILLS("kills"),
|
||||
DIALOG_OPTION("dialogOption"),
|
||||
TARGET_LOST("targetLost"),
|
||||
ROLE("role"),
|
||||
RANGED_LAUNCHED("rangedLaunched"),
|
||||
CLICKED("clicked"),
|
||||
FALLEN_UPON("fallenUpon"),
|
||||
RAIN_FILLED("rainFilled"),
|
||||
BROKEN("broken"),
|
||||
HARVESTED("harvested"),
|
||||
EXPLODED("exploded"),
|
||||
NEIGHBOR_CHANGED("neighborChanged"),
|
||||
REDSTONE("redstone"),
|
||||
DOOR_TOGGLE("doorToggle"),
|
||||
TIMER("timer"),
|
||||
TOSS("toss"),
|
||||
CONTAINER_OPEN("containerOpen"),
|
||||
CONTAINER_CLOSED("containerClosed"),
|
||||
LOGIN("login"),
|
||||
LOGOUT("logout"),
|
||||
CHAT("chat"),
|
||||
DAMAGED_ENTITY("damagedEntity"),
|
||||
DIALOG_CLOSE("dialogClose"),
|
||||
SPAWN("spawn"),
|
||||
TOSSED("tossed"),
|
||||
PICKEDUP("pickedUp"),
|
||||
PICKUP("pickUp"),
|
||||
ATTACK("attack"),
|
||||
PROJECTILE_TICK("projectileTick"),
|
||||
PROJECTILE_IMPACT("projectileImpact"),
|
||||
FACTION_UPDATE("factionUpdate"),
|
||||
LEVEL_UP("levelUp"),
|
||||
QUEST_START("questStart"),
|
||||
QUEST_COMPLETED("questCompleted"),
|
||||
QUEST_TURNIN("questTurnIn"),
|
||||
KEY_PRESSED("keyPressed"),
|
||||
CUSTOM_CHEST_CLOSED("customChestClosed"),
|
||||
CUSTOM_CHEST_CLICKED("customChestClicked"),
|
||||
SCRIPT_COMMAND("scriptCommand"),
|
||||
CUSTOM_GUI_CLOSED("customGuiClosed"),
|
||||
CUSTOM_GUI_BUTTON("customGuiButton"),
|
||||
CUSTOM_GUI_SLOT("customGuiSlot"),
|
||||
CUSTOM_GUI_SCROLL("customGuiScroll");
|
||||
|
||||
public String function;
|
||||
|
||||
private EnumScriptType(String function) {
|
||||
this.function = function;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.controllers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
|
||||
public interface IScriptHandler {
|
||||
void runScript(EnumScriptType var1, Event var2);
|
||||
|
||||
boolean isClient();
|
||||
|
||||
boolean getEnabled();
|
||||
|
||||
void setEnabled(boolean var1);
|
||||
|
||||
String getLanguage();
|
||||
|
||||
void setLanguage(String var1);
|
||||
|
||||
List<ScriptContainer> getScripts();
|
||||
|
||||
String noticeString();
|
||||
|
||||
Map<Long, String> getConsoleText();
|
||||
|
||||
void clearConsole();
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.data.PlayerBankData;
|
||||
import noppes.npcs.controllers.data.PlayerDialogData;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
import noppes.npcs.controllers.data.PlayerItemGiverData;
|
||||
import noppes.npcs.controllers.data.PlayerMailData;
|
||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.PlayerScriptData;
|
||||
import noppes.npcs.controllers.data.PlayerTransportData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
public class PlayerData implements ICapabilityProvider {
|
||||
@CapabilityInject(PlayerData.class)
|
||||
public static Capability<PlayerData> PLAYERDATA_CAPABILITY = null;
|
||||
public PlayerDialogData dialogData = new PlayerDialogData();
|
||||
public PlayerBankData bankData = new PlayerBankData();
|
||||
public PlayerQuestData questData = new PlayerQuestData();
|
||||
public PlayerTransportData transportData = new PlayerTransportData();
|
||||
public PlayerFactionData factionData = new PlayerFactionData();
|
||||
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData();
|
||||
public PlayerMailData mailData = new PlayerMailData();
|
||||
public PlayerScriptData scriptData;
|
||||
public DataTimers timers = new DataTimers(this);
|
||||
public EntityNPCInterface editingNpc;
|
||||
public NBTTagCompound cloned;
|
||||
public NBTTagCompound scriptStoreddata = new NBTTagCompound();
|
||||
public EntityPlayer player;
|
||||
public String playername = "";
|
||||
public String uuid = "";
|
||||
private EntityNPCInterface activeCompanion = null;
|
||||
public int companionID = 0;
|
||||
public int playerLevel = 0;
|
||||
public boolean updateClient = false;
|
||||
public int dialogId = -1;
|
||||
private static final ResourceLocation key = new ResourceLocation("customnpcs", "playerdata");
|
||||
|
||||
public PlayerData() {
|
||||
}
|
||||
|
||||
public void setNBT(NBTTagCompound data) {
|
||||
this.dialogData.loadNBTData(data);
|
||||
this.bankData.loadNBTData(data);
|
||||
this.questData.loadNBTData(data);
|
||||
this.transportData.loadNBTData(data);
|
||||
this.factionData.loadNBTData(data);
|
||||
this.itemgiverData.loadNBTData(data);
|
||||
this.mailData.loadNBTData(data);
|
||||
this.timers.readFromNBT(data);
|
||||
if(this.player != null) {
|
||||
this.playername = this.player.func_70005_c_();
|
||||
this.uuid = this.player.getPersistentID().toString();
|
||||
} else {
|
||||
this.playername = data.func_74779_i("PlayerName");
|
||||
this.uuid = data.func_74779_i("UUID");
|
||||
}
|
||||
|
||||
this.companionID = data.func_74762_e("PlayerCompanionId");
|
||||
if(data.func_74764_b("PlayerCompanion") && !this.hasCompanion()) {
|
||||
EntityCustomNpc npc = new EntityCustomNpc(this.player.field_70170_p);
|
||||
npc.func_70037_a(data.func_74775_l("PlayerCompanion"));
|
||||
npc.func_70107_b(this.player.field_70165_t, this.player.field_70163_u, this.player.field_70161_v);
|
||||
if(npc.advanced.role == 6) {
|
||||
this.setCompanion(npc);
|
||||
((RoleCompanion)npc.roleInterface).setSitting(false);
|
||||
this.player.field_70170_p.func_72838_d(npc);
|
||||
}
|
||||
}
|
||||
|
||||
this.scriptStoreddata = data.func_74775_l("ScriptStoreddata");
|
||||
}
|
||||
|
||||
public NBTTagCompound getSyncNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.dialogData.saveNBTData(compound);
|
||||
this.questData.saveNBTData(compound);
|
||||
this.factionData.saveNBTData(compound);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBT() {
|
||||
if(this.player != null) {
|
||||
this.playername = this.player.func_70005_c_();
|
||||
this.uuid = this.player.getPersistentID().toString();
|
||||
}
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.dialogData.saveNBTData(compound);
|
||||
this.bankData.saveNBTData(compound);
|
||||
this.questData.saveNBTData(compound);
|
||||
this.transportData.saveNBTData(compound);
|
||||
this.factionData.saveNBTData(compound);
|
||||
this.itemgiverData.saveNBTData(compound);
|
||||
this.mailData.saveNBTData(compound);
|
||||
this.timers.writeToNBT(compound);
|
||||
compound.func_74778_a("PlayerName", this.playername);
|
||||
compound.func_74778_a("UUID", this.uuid);
|
||||
compound.func_74768_a("PlayerCompanionId", this.companionID);
|
||||
compound.func_74782_a("ScriptStoreddata", this.scriptStoreddata);
|
||||
if(this.hasCompanion()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if(this.activeCompanion.func_184198_c(nbt)) {
|
||||
compound.func_74782_a("PlayerCompanion", nbt);
|
||||
}
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public boolean hasCompanion() {
|
||||
return this.activeCompanion != null && !this.activeCompanion.field_70128_L;
|
||||
}
|
||||
|
||||
public void setCompanion(EntityNPCInterface npc) {
|
||||
if(npc == null || npc.advanced.role == 6) {
|
||||
++this.companionID;
|
||||
this.activeCompanion = npc;
|
||||
if(npc != null) {
|
||||
((RoleCompanion)npc.roleInterface).companionID = this.companionID;
|
||||
}
|
||||
|
||||
this.save(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateCompanion(World world) {
|
||||
if(this.hasCompanion() && world != this.activeCompanion.field_70170_p) {
|
||||
RoleCompanion role = (RoleCompanion)this.activeCompanion.roleInterface;
|
||||
role.owner = this.player;
|
||||
if(role.isFollowing()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.activeCompanion.func_184198_c(nbt);
|
||||
this.activeCompanion.field_70128_L = true;
|
||||
EntityCustomNpc npc = new EntityCustomNpc(world);
|
||||
npc.func_70037_a(nbt);
|
||||
npc.func_70107_b(this.player.field_70165_t, this.player.field_70163_u, this.player.field_70161_v);
|
||||
this.setCompanion(npc);
|
||||
((RoleCompanion)npc.roleInterface).setSitting(false);
|
||||
world.func_72838_d(npc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
return capability == PLAYERDATA_CAPABILITY;
|
||||
}
|
||||
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
return this.hasCapability(capability, facing)?this:null;
|
||||
}
|
||||
|
||||
public static void register(AttachCapabilitiesEvent<Entity> event) {
|
||||
if(event.getObject() instanceof EntityPlayer) {
|
||||
event.addCapability(key, new PlayerData());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized void save(boolean update) {
|
||||
NBTTagCompound compound = this.getNBT();
|
||||
String filename = this.uuid + ".json";
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
try {
|
||||
File e = CustomNpcs.getWorldSaveDirectory("playerdata");
|
||||
File file = new File(e, filename + "_new");
|
||||
File file1 = new File(e, filename);
|
||||
NBTJsonUtil.SaveFile(file, compound);
|
||||
if(file1.exists()) {
|
||||
file1.delete();
|
||||
}
|
||||
|
||||
file.renameTo(file1);
|
||||
} catch (Exception var5) {
|
||||
LogWriter.except(var5);
|
||||
}
|
||||
|
||||
});
|
||||
if(update) {
|
||||
this.updateClient = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static NBTTagCompound loadPlayerDataOld(String player) {
|
||||
File saveDir = CustomNpcs.getWorldSaveDirectory("playerdata");
|
||||
String filename = player;
|
||||
if(player.isEmpty()) {
|
||||
filename = "noplayername";
|
||||
}
|
||||
|
||||
filename = filename + ".dat";
|
||||
|
||||
File e;
|
||||
try {
|
||||
e = new File(saveDir, filename);
|
||||
if(e.exists()) {
|
||||
NBTTagCompound comp = CompressedStreamTools.func_74796_a(new FileInputStream(e));
|
||||
e.delete();
|
||||
e = new File(saveDir, filename + "_old");
|
||||
if(e.exists()) {
|
||||
e.delete();
|
||||
}
|
||||
|
||||
return comp;
|
||||
}
|
||||
} catch (Exception var6) {
|
||||
LogWriter.except(var6);
|
||||
}
|
||||
|
||||
try {
|
||||
e = new File(saveDir, filename + "_old");
|
||||
if(e.exists()) {
|
||||
return CompressedStreamTools.func_74796_a(new FileInputStream(e));
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
LogWriter.except(var5);
|
||||
}
|
||||
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
public static NBTTagCompound loadPlayerData(String player) {
|
||||
File saveDir = CustomNpcs.getWorldSaveDirectory("playerdata");
|
||||
String filename = player;
|
||||
if(player.isEmpty()) {
|
||||
filename = "noplayername";
|
||||
}
|
||||
|
||||
filename = filename + ".json";
|
||||
File file = null;
|
||||
|
||||
try {
|
||||
file = new File(saveDir, filename);
|
||||
if(file.exists()) {
|
||||
return NBTJsonUtil.LoadFile(file);
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
LogWriter.error("Error loading: " + file.getAbsolutePath(), var5);
|
||||
}
|
||||
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
public static PlayerData get(EntityPlayer player) {
|
||||
if(player.field_70170_p.field_72995_K) {
|
||||
return CustomNpcs.proxy.getPlayerData(player);
|
||||
} else {
|
||||
PlayerData data = (PlayerData)player.getCapability(PLAYERDATA_CAPABILITY, (EnumFacing)null);
|
||||
if(data.player == null) {
|
||||
data.player = player;
|
||||
data.playerLevel = player.field_71068_ca;
|
||||
data.scriptData = new PlayerScriptData(player);
|
||||
NBTTagCompound compound = loadPlayerData(player.getPersistentID().toString());
|
||||
if(compound.func_82582_d()) {
|
||||
compound = loadPlayerDataOld(player.func_70005_c_());
|
||||
}
|
||||
|
||||
data.setNBT(compound);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
|
||||
public class PlayerScriptData implements IScriptHandler {
|
||||
private List<ScriptContainer> scripts = new ArrayList();
|
||||
private String scriptLanguage = "ECMAScript";
|
||||
private EntityPlayer player;
|
||||
private IPlayer playerAPI;
|
||||
private long lastPlayerUpdate = 0L;
|
||||
public long lastInited = -1L;
|
||||
public boolean hadInteract = true;
|
||||
private boolean enabled = false;
|
||||
private static Map<Long, String> console = new TreeMap();
|
||||
private static List<Integer> errored = new ArrayList();
|
||||
|
||||
public PlayerScriptData(EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
console = new TreeMap();
|
||||
errored = new ArrayList();
|
||||
this.scripts = new ArrayList();
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.scripts = NBTTags.GetScript(compound.func_150295_c("Scripts", 10), this);
|
||||
this.scriptLanguage = compound.func_74779_i("ScriptLanguage");
|
||||
this.enabled = compound.func_74767_n("ScriptEnabled");
|
||||
console = NBTTags.GetLongStringMap(compound.func_150295_c("ScriptConsole", 10));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.func_74782_a("Scripts", NBTTags.NBTScript(this.scripts));
|
||||
compound.func_74778_a("ScriptLanguage", this.scriptLanguage);
|
||||
compound.func_74757_a("ScriptEnabled", this.enabled);
|
||||
compound.func_74782_a("ScriptConsole", NBTTags.NBTLongStringMap(console));
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void runScript(EnumScriptType type, Event event) {
|
||||
if(this.isEnabled()) {
|
||||
ScriptContainer script;
|
||||
if(ScriptController.Instance.lastLoaded > this.lastInited || ScriptController.Instance.lastPlayerUpdate > this.lastPlayerUpdate) {
|
||||
this.lastInited = ScriptController.Instance.lastLoaded;
|
||||
errored.clear();
|
||||
if(this.player != null) {
|
||||
this.scripts.clear();
|
||||
Iterator i = ScriptController.Instance.playerScripts.scripts.iterator();
|
||||
|
||||
while(i.hasNext()) {
|
||||
script = (ScriptContainer)i.next();
|
||||
ScriptContainer s = new ScriptContainer(this);
|
||||
s.readFromNBT(script.writeToNBT(new NBTTagCompound()));
|
||||
this.scripts.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastPlayerUpdate = ScriptController.Instance.lastPlayerUpdate;
|
||||
if(type != EnumScriptType.INIT) {
|
||||
EventHooks.onPlayerInit(this);
|
||||
}
|
||||
}
|
||||
|
||||
for(int var7 = 0; var7 < this.scripts.size(); ++var7) {
|
||||
script = (ScriptContainer)this.scripts.get(var7);
|
||||
if(!errored.contains(Integer.valueOf(var7))) {
|
||||
script.run(type, event);
|
||||
if(script.errored) {
|
||||
errored.add(Integer.valueOf(var7));
|
||||
}
|
||||
|
||||
Iterator var8 = script.console.entrySet().iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
Entry entry = (Entry)var8.next();
|
||||
if(!console.containsKey(entry.getKey())) {
|
||||
console.put(entry.getKey(), " tab " + (var7 + 1) + ":\n" + (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
script.console.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.field_70170_p.field_72995_K);
|
||||
}
|
||||
|
||||
public boolean isClient() {
|
||||
return !this.player.func_70613_aW();
|
||||
}
|
||||
|
||||
public boolean getEnabled() {
|
||||
return ScriptController.Instance.playerScripts.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean bo) {
|
||||
this.enabled = bo;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return ScriptController.Instance.playerScripts.scriptLanguage;
|
||||
}
|
||||
|
||||
public void setLanguage(String lang) {
|
||||
this.scriptLanguage = lang;
|
||||
}
|
||||
|
||||
public List<ScriptContainer> getScripts() {
|
||||
return this.scripts;
|
||||
}
|
||||
|
||||
public String noticeString() {
|
||||
if(this.player == null) {
|
||||
return "Global script";
|
||||
} else {
|
||||
BlockPos pos = this.player.func_180425_c();
|
||||
return MoreObjects.toStringHelper(this.player).add("x", pos.func_177958_n()).add("y", pos.func_177956_o()).add("z", pos.func_177952_p()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
public IPlayer getPlayer() {
|
||||
if(this.playerAPI == null) {
|
||||
this.playerAPI = (IPlayer)NpcAPI.Instance().getIEntity(this.player);
|
||||
}
|
||||
|
||||
return this.playerAPI;
|
||||
}
|
||||
|
||||
public Map<Long, String> getConsoleText() {
|
||||
return console;
|
||||
}
|
||||
|
||||
public void clearConsole() {
|
||||
console.clear();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
package noppes.npcs.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
public class ItemNpcScripter extends Item{
|
||||
|
||||
|
||||
public ItemNpcScripter(){
|
||||
maxStackSize = 1;
|
||||
setCreativeTab(CustomItems.tab);
|
||||
@@ -25,7 +29,15 @@ public class ItemNpcScripter extends Item{
|
||||
public boolean requiresMultipleRenderPasses(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
|
||||
if(!par2World.isRemote)
|
||||
return par1ItemStack;
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptEvent, par3EntityPlayer);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister){
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
//import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
||||
public abstract class CommandNoppesBase extends CommandBase {
|
||||
public Map<String, Method> subcommands = new HashMap();
|
||||
|
||||
public CommandNoppesBase() {
|
||||
Method[] var1 = this.getClass().getDeclaredMethods();
|
||||
int var2 = var1.length;
|
||||
|
||||
for(int var3 = 0; var3 < var2; ++var3) {
|
||||
Method m = var1[var3];
|
||||
CommandNoppesBase.SubCommand sc = (CommandNoppesBase.SubCommand)m.getAnnotation(CommandNoppesBase.SubCommand.class);
|
||||
if(sc != null) {
|
||||
String name = sc.name();
|
||||
if(name.equals("")) {
|
||||
name = m.getName();
|
||||
}
|
||||
|
||||
this.subcommands.put(name.toLowerCase(), m);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_184881_a(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||
}
|
||||
|
||||
public String func_71518_a(ICommandSender sender) {
|
||||
return this.getDescription();
|
||||
}
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
public String getUsage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean runSubCommands() {
|
||||
return !this.subcommands.isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
protected void sendMessage(ICommandSender sender, String message, Object... obs) {
|
||||
sender.func_145747_a(new TextComponentTranslation(message, obs));
|
||||
}
|
||||
*/
|
||||
|
||||
public void executeSub(MinecraftServer server, ICommandSender sender, String command, String[] args) throws CommandException {
|
||||
Method m = (Method)this.subcommands.get(command.toLowerCase());
|
||||
if(m == null) {
|
||||
throw new CommandException("Unknown subcommand " + command, new Object[0]);
|
||||
} else {
|
||||
CommandNoppesBase.SubCommand sc = (CommandNoppesBase.SubCommand)m.getAnnotation(CommandNoppesBase.SubCommand.class);
|
||||
if(!sender.canCommandSenderUseCommand(sc.permission(), "commands.noppes." + this.getCommandName().toLowerCase() + "." + command.toLowerCase())) {
|
||||
throw new CommandException("You are not allowed to use this command", new Object[0]);
|
||||
} else {
|
||||
this.canRun(server, sender, sc.usage(), args);
|
||||
|
||||
try {
|
||||
m.invoke(this, new Object[]{server, sender, args});
|
||||
} catch (Exception var8) {
|
||||
if(var8.getCause() instanceof CommandException) {
|
||||
throw (CommandException)var8.getCause();
|
||||
}
|
||||
|
||||
var8.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void canRun(MinecraftServer server, ICommandSender sender, String usage, String[] args) throws CommandException {
|
||||
String[] np = usage.split(" ");
|
||||
ArrayList required = new ArrayList();
|
||||
|
||||
for(int i = 0; i < np.length; ++i) {
|
||||
String command = np[i];
|
||||
if(command.startsWith("<")) {
|
||||
required.add(command);
|
||||
}
|
||||
|
||||
if(command.equals("<player>") && args.length > i) {
|
||||
CommandBase.getPlayer(sender, args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(args.length < required.size()) {
|
||||
throw new CommandException("Missing parameter: " + (String)required.get(args.length), new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public int func_82362_a() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface SubCommand {
|
||||
String name() default "";
|
||||
|
||||
String usage() default "";
|
||||
|
||||
String desc();
|
||||
|
||||
int permission() default 4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
public class CustomNPCsException extends RuntimeException {
|
||||
public CustomNPCsException(String message, Object... obs) {
|
||||
super(String.format(message, obs));
|
||||
}
|
||||
|
||||
public CustomNPCsException(Exception ex, String message, Object... obs) {
|
||||
super(String.format(message, obs), ex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IContainer {
|
||||
int getSize();
|
||||
|
||||
IItemStack getSlot(int var1);
|
||||
|
||||
void setSlot(int var1, IItemStack var2);
|
||||
|
||||
IInventory getMCInventory();
|
||||
|
||||
Container getMCContainer();
|
||||
|
||||
int count(IItemStack var1, boolean var2, boolean var3);
|
||||
|
||||
IItemStack[] getItems();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
|
||||
public interface IDamageSource {
|
||||
String getType();
|
||||
|
||||
boolean isUnblockable();
|
||||
|
||||
boolean isProjectile();
|
||||
|
||||
IEntity getTrueSource();
|
||||
|
||||
IEntity getImmediateSource();
|
||||
|
||||
DamageSource getMCDamageSource();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
public interface IDimension {
|
||||
int getId();
|
||||
|
||||
String getName();
|
||||
|
||||
String getSuffix();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface INbt {
|
||||
void remove(String var1);
|
||||
|
||||
boolean has(String var1);
|
||||
|
||||
boolean getBoolean(String var1);
|
||||
|
||||
void setBoolean(String var1, boolean var2);
|
||||
|
||||
short getShort(String var1);
|
||||
|
||||
void setShort(String var1, short var2);
|
||||
|
||||
int getInteger(String var1);
|
||||
|
||||
void setInteger(String var1, int var2);
|
||||
|
||||
byte getByte(String var1);
|
||||
|
||||
void setByte(String var1, byte var2);
|
||||
|
||||
long getLong(String var1);
|
||||
|
||||
void setLong(String var1, long var2);
|
||||
|
||||
double getDouble(String var1);
|
||||
|
||||
void setDouble(String var1, double var2);
|
||||
|
||||
float getFloat(String var1);
|
||||
|
||||
void setFloat(String var1, float var2);
|
||||
|
||||
String getString(String var1);
|
||||
|
||||
void setString(String var1, String var2);
|
||||
|
||||
byte[] getByteArray(String var1);
|
||||
|
||||
void setByteArray(String var1, byte[] var2);
|
||||
|
||||
int[] getIntegerArray(String var1);
|
||||
|
||||
void setIntegerArray(String var1, int[] var2);
|
||||
|
||||
Object[] getList(String var1, int var2);
|
||||
|
||||
int getListType(String var1);
|
||||
|
||||
void setList(String var1, Object[] var2);
|
||||
|
||||
INbt getCompound(String var1);
|
||||
|
||||
void setCompound(String var1, INbt var2);
|
||||
|
||||
String[] getKeys();
|
||||
|
||||
int getType(String var1);
|
||||
|
||||
NBTTagCompound getMCNBT();
|
||||
|
||||
String toJsonString();
|
||||
|
||||
boolean isEqual(INbt var1);
|
||||
|
||||
void clear();
|
||||
|
||||
void merge(INbt var1);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import noppes.npcs.scripted.IScoreboardObjective;
|
||||
import noppes.npcs.scripted.IScoreboardTeam;
|
||||
|
||||
public interface IScoreboard {
|
||||
IScoreboardObjective[] getObjectives();
|
||||
|
||||
IScoreboardObjective getObjective(String var1);
|
||||
|
||||
boolean hasObjective(String var1);
|
||||
|
||||
void removeObjective(String var1);
|
||||
|
||||
IScoreboardObjective addObjective(String var1, String var2);
|
||||
|
||||
void setPlayerScore(String var1, String var2, int var3, String var4);
|
||||
|
||||
int getPlayerScore(String var1, String var2, String var3);
|
||||
|
||||
boolean hasPlayerObjective(String var1, String var2, String var3);
|
||||
|
||||
void deletePlayerScore(String var1, String var2, String var3);
|
||||
|
||||
IScoreboardTeam[] getTeams();
|
||||
|
||||
boolean hasTeam(String var1);
|
||||
|
||||
IScoreboardTeam addTeam(String var1);
|
||||
|
||||
IScoreboardTeam getTeam(String var1);
|
||||
|
||||
void removeTeam(String var1);
|
||||
|
||||
IScoreboardTeam getPlayerTeam(String var1);
|
||||
|
||||
void removePlayerTeam(String var1);
|
||||
|
||||
String[] getPlayerList();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import noppes.npcs.scripted.IScoreboardScore;
|
||||
|
||||
public interface IScoreboardObjective {
|
||||
String getName();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
void setDisplayName(String var1);
|
||||
|
||||
String getCriteria();
|
||||
|
||||
boolean isReadyOnly();
|
||||
|
||||
IScoreboardScore[] getScores();
|
||||
|
||||
IScoreboardScore getScore(String var1);
|
||||
|
||||
boolean hasScore(String var1);
|
||||
|
||||
IScoreboardScore createScore(String var1);
|
||||
|
||||
void removeScore(String var1);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
public interface IScoreboardScore {
|
||||
int getValue();
|
||||
|
||||
void setValue(int var1);
|
||||
|
||||
String getPlayerName();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
public interface IScoreboardTeam {
|
||||
String getName();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
void setDisplayName(String var1);
|
||||
|
||||
void addPlayer(String var1);
|
||||
|
||||
boolean hasPlayer(String var1);
|
||||
|
||||
void removePlayer(String var1);
|
||||
|
||||
String[] getPlayers();
|
||||
|
||||
void clearPlayers();
|
||||
|
||||
boolean getFriendlyFire();
|
||||
|
||||
void setFriendlyFire(boolean var1);
|
||||
|
||||
void setColor(String var1);
|
||||
|
||||
String getColor();
|
||||
|
||||
void setSeeInvisibleTeamPlayers(boolean var1);
|
||||
|
||||
boolean getSeeInvisibleTeamPlayers();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
public interface ITimers {
|
||||
void start(int var1, int var2, boolean var3);
|
||||
|
||||
void forceStart(int var1, int var2, boolean var3);
|
||||
|
||||
boolean has(int var1);
|
||||
|
||||
boolean stop(int var1);
|
||||
|
||||
void reset(int var1);
|
||||
|
||||
void clear();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.scripted.IDimension;
|
||||
import noppes.npcs.scripted.INbt;
|
||||
import noppes.npcs.scripted.IScoreboard;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
import noppes.npcs.scripted.entity.data.IData;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IWorld {
|
||||
/** @deprecated */
|
||||
IEntity[] getNearbyEntities(int var1, int var2, int var3, int var4, int var5);
|
||||
|
||||
/** @deprecated */
|
||||
IEntity getClosestEntity(int var1, int var2, int var3, int var4, int var5);
|
||||
|
||||
IEntity[] getAllEntities(int var1);
|
||||
|
||||
long getTime();
|
||||
|
||||
void setTime(long var1);
|
||||
|
||||
long getTotalTime();
|
||||
|
||||
void setBlock(int var1, int var2, int var3, String var4, int var5);
|
||||
|
||||
void removeBlock(int var1, int var2, int var3);
|
||||
|
||||
float getLightValue(int var1, int var2, int var3);
|
||||
|
||||
IPlayer getPlayer(String var1);
|
||||
|
||||
boolean isDay();
|
||||
|
||||
boolean isRaining();
|
||||
|
||||
IDimension getDimension();
|
||||
|
||||
void setRaining(boolean var1);
|
||||
|
||||
void thunderStrike(double var1, double var3, double var5);
|
||||
|
||||
void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12, double var14, int var16);
|
||||
|
||||
void broadcast(String var1);
|
||||
|
||||
IScoreboard getScoreboard();
|
||||
|
||||
IData getTempdata();
|
||||
|
||||
IData getStoreddata();
|
||||
|
||||
IItemStack createItem(String var1, int var2, int var3);
|
||||
|
||||
IItemStack createItemFromNbt(INbt var1);
|
||||
|
||||
void explode(double var1, double var3, double var5, float var7, boolean var8, boolean var9);
|
||||
|
||||
IPlayer[] getAllPlayers();
|
||||
|
||||
String getBiomeName(int var1, int var2);
|
||||
|
||||
void spawnEntity(IEntity var1);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
IEntity spawnClone(double var1, double var3, double var5, int var7, String var8);
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
IEntity getClone(int var1, String var2);
|
||||
|
||||
int getRedstonePower(int var1, int var2, int var3);
|
||||
|
||||
WorldServer getMCWorld();
|
||||
|
||||
BlockPos getMCBlockPos(int var1, int var2, int var3);
|
||||
|
||||
IEntity getEntity(String var1);
|
||||
|
||||
IEntity createEntityFromNBT(INbt var1);
|
||||
|
||||
IEntity createEntity(String var1);
|
||||
|
||||
String getName();
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import noppes.npcs.scripted.CommandNoppesBase;
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.IDamageSource;
|
||||
import noppes.npcs.scripted.INbt;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.entity.data.IPlayerMail;
|
||||
import noppes.npcs.scripted.gui.ICustomGui;
|
||||
import noppes.npcs.scripted.handler.ICloneHandler;
|
||||
import noppes.npcs.scripted.handler.IDialogHandler;
|
||||
import noppes.npcs.scripted.handler.IFactionHandler;
|
||||
import noppes.npcs.scripted.handler.IQuestHandler;
|
||||
import noppes.npcs.scripted.handler.IRecipeHandler;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public abstract class NpcAPI {
|
||||
private static NpcAPI instance = null;
|
||||
|
||||
public NpcAPI() {
|
||||
}
|
||||
|
||||
public abstract ICustomNpc createNPC(World var1);
|
||||
|
||||
public abstract ICustomNpc spawnNPC(World var1, int var2, int var3, int var4);
|
||||
|
||||
public abstract IEntity getIEntity(Entity var1);
|
||||
|
||||
public abstract IContainer getIContainer(IInventory var1);
|
||||
|
||||
public abstract IContainer getIContainer(Container var1);
|
||||
|
||||
public abstract IItemStack getIItemStack(ItemStack var1);
|
||||
|
||||
public abstract IWorld getIWorld(WorldServer var1);
|
||||
|
||||
public abstract IWorld getIWorld(int var1);
|
||||
|
||||
public abstract IWorld[] getIWorlds();
|
||||
|
||||
public abstract INbt getINbt(NBTTagCompound var1);
|
||||
|
||||
public abstract IFactionHandler getFactions();
|
||||
|
||||
public abstract IRecipeHandler getRecipes();
|
||||
|
||||
public abstract IQuestHandler getQuests();
|
||||
|
||||
public abstract IDialogHandler getDialogs();
|
||||
|
||||
public abstract ICloneHandler getClones();
|
||||
|
||||
public abstract IDamageSource getIDamageSource(DamageSource var1);
|
||||
|
||||
public abstract INbt stringToNbt(String var1);
|
||||
|
||||
public abstract IPlayerMail createMail(String var1, String var2);
|
||||
|
||||
public abstract ICustomGui createCustomGui(int var1, int var2, int var3, boolean var4);
|
||||
|
||||
public abstract INbt getRawPlayerData(String var1);
|
||||
|
||||
public abstract EventBus events();
|
||||
|
||||
public abstract void registerCommand(CommandNoppesBase var1);
|
||||
|
||||
public abstract File getGlobalDir();
|
||||
|
||||
public abstract File getWorldDir();
|
||||
|
||||
public static boolean IsAvailable() {
|
||||
return Loader.isModLoaded("customnpcs");
|
||||
}
|
||||
|
||||
public static NpcAPI Instance() {
|
||||
if(instance != null) {
|
||||
return instance;
|
||||
} else if(!IsAvailable()) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Class e = Class.forName("noppes.npcs.api.wrapper.WrapperNpcAPI");
|
||||
instance = (NpcAPI)e.getMethod("Instance", new Class[0]).invoke((Object)null, new Object[0]);
|
||||
} catch (Exception var1) {
|
||||
var1.printStackTrace();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void registerPermissionNode(String var1, int var2);
|
||||
|
||||
public abstract boolean hasPermissionNode(String var1);
|
||||
|
||||
public abstract String executeCommand(IWorld var1, String var2);
|
||||
|
||||
public abstract String getRandomName(int var1, int var2);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import noppes.npcs.scripted.ITimers;
|
||||
import noppes.npcs.scripted.entity.IEntityLiving;
|
||||
import noppes.npcs.scripted.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
import noppes.npcs.scripted.entity.IProjectile;
|
||||
import noppes.npcs.scripted.entity.data.INPCAdvanced;
|
||||
import noppes.npcs.scripted.entity.data.INPCAi;
|
||||
import noppes.npcs.scripted.entity.data.INPCDisplay;
|
||||
import noppes.npcs.scripted.entity.data.INPCInventory;
|
||||
import noppes.npcs.scripted.entity.data.INPCJob;
|
||||
import noppes.npcs.scripted.entity.data.INPCRole;
|
||||
import noppes.npcs.scripted.entity.data.INPCStats;
|
||||
import noppes.npcs.scripted.handler.data.IDialog;
|
||||
import noppes.npcs.scripted.handler.data.IFaction;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
INPCDisplay getDisplay();
|
||||
|
||||
INPCInventory getInventory();
|
||||
|
||||
INPCStats getStats();
|
||||
|
||||
INPCAi getAi();
|
||||
|
||||
INPCAdvanced getAdvanced();
|
||||
|
||||
IFaction getFaction();
|
||||
|
||||
void setFaction(int var1);
|
||||
|
||||
INPCRole getRole();
|
||||
|
||||
INPCJob getJob();
|
||||
|
||||
ITimers getTimers();
|
||||
|
||||
int getHomeX();
|
||||
|
||||
int getHomeY();
|
||||
|
||||
int getHomeZ();
|
||||
|
||||
IEntityLivingBase getOwner();
|
||||
|
||||
void setHome(int var1, int var2, int var3);
|
||||
|
||||
void reset();
|
||||
|
||||
void say(String var1);
|
||||
|
||||
void sayTo(IPlayer var1, String var2);
|
||||
|
||||
IProjectile shootItem(IEntityLivingBase var1, IItemStack var2, int var3);
|
||||
|
||||
IProjectile shootItem(double var1, double var3, double var5, IItemStack var7, int var8);
|
||||
|
||||
void giveItem(IPlayer var1, IItemStack var2);
|
||||
|
||||
void setDialog(int var1, IDialog var2);
|
||||
|
||||
IDialog getDialog(int var1);
|
||||
|
||||
void updateClient();
|
||||
|
||||
String executeCommand(String var1);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.scripted.INbt;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.entity.data.IData;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IEntity<T extends Entity> {
|
||||
double getX();
|
||||
|
||||
void setX(double var1);
|
||||
|
||||
double getY();
|
||||
|
||||
void setY(double var1);
|
||||
|
||||
double getZ();
|
||||
|
||||
void setZ(double var1);
|
||||
|
||||
int getBlockX();
|
||||
|
||||
int getBlockY();
|
||||
|
||||
int getBlockZ();
|
||||
|
||||
void setPosition(double var1, double var3, double var5);
|
||||
|
||||
void setRotation(float var1);
|
||||
|
||||
float getRotation();
|
||||
|
||||
float getHeight();
|
||||
|
||||
float getEyeHeight();
|
||||
|
||||
float getWidth();
|
||||
|
||||
void setPitch(float var1);
|
||||
|
||||
float getPitch();
|
||||
|
||||
IEntity getMount();
|
||||
|
||||
void setMount(IEntity var1);
|
||||
|
||||
IEntity[] getRiders();
|
||||
|
||||
IEntity[] getAllRiders();
|
||||
|
||||
void addRider(IEntity var1);
|
||||
|
||||
void clearRiders();
|
||||
|
||||
void knockback(int var1, float var2);
|
||||
|
||||
boolean isSneaking();
|
||||
|
||||
boolean isSprinting();
|
||||
|
||||
IEntityItem dropItem(IItemStack var1);
|
||||
|
||||
boolean inWater();
|
||||
|
||||
boolean inFire();
|
||||
|
||||
boolean inLava();
|
||||
|
||||
IData getTempdata();
|
||||
|
||||
IData getStoreddata();
|
||||
|
||||
INbt getNbt();
|
||||
|
||||
boolean isAlive();
|
||||
|
||||
long getAge();
|
||||
|
||||
void despawn();
|
||||
|
||||
void spawn();
|
||||
|
||||
void kill();
|
||||
|
||||
boolean isBurning();
|
||||
|
||||
void setBurning(int var1);
|
||||
|
||||
void extinguish();
|
||||
|
||||
IWorld getWorld();
|
||||
|
||||
String getTypeName();
|
||||
|
||||
int getType();
|
||||
|
||||
boolean typeOf(int var1);
|
||||
|
||||
T getMCEntity();
|
||||
|
||||
String getUUID();
|
||||
|
||||
String generateNewUUID();
|
||||
|
||||
void storeAsClone(int var1, String var2);
|
||||
|
||||
INbt getEntityNbt();
|
||||
|
||||
void setEntityNbt(INbt var1);
|
||||
|
||||
IEntity[] rayTraceEntities(double var1, boolean var3, boolean var4);
|
||||
|
||||
String[] getTags();
|
||||
|
||||
void addTag(String var1);
|
||||
|
||||
boolean hasTag(String var1);
|
||||
|
||||
void removeTag(String var1);
|
||||
|
||||
void playAnimation(int var1);
|
||||
|
||||
void damage(float var1);
|
||||
|
||||
double getMotionX();
|
||||
|
||||
double getMotionY();
|
||||
|
||||
double getMotionZ();
|
||||
|
||||
void setMotionX(double var1);
|
||||
|
||||
void setMotionY(double var1);
|
||||
|
||||
void setMotionZ(double var1);
|
||||
|
||||
String getName();
|
||||
|
||||
void setName(String var1);
|
||||
|
||||
boolean hasCustomName();
|
||||
|
||||
String getEntityName();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IEntityItem<T extends EntityItem> extends IEntity<T> {
|
||||
String getOwner();
|
||||
|
||||
void setOwner(String var1);
|
||||
|
||||
int getPickupDelay();
|
||||
|
||||
void setPickupDelay(int var1);
|
||||
|
||||
long getAge();
|
||||
|
||||
void setAge(long var1);
|
||||
|
||||
int getLifeSpawn();
|
||||
|
||||
void setLifeSpawn(int var1);
|
||||
|
||||
IItemStack getItem();
|
||||
|
||||
void setItem(IItemStack var1);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import noppes.npcs.scripted.entity.IEntityLivingBase;
|
||||
|
||||
public interface IEntityLiving<T extends EntityLiving> extends IEntityLivingBase<T> {
|
||||
boolean isNavigating();
|
||||
|
||||
void clearNavigation();
|
||||
|
||||
void navigateTo(double var1, double var3, double var5, double var7);
|
||||
|
||||
void jump();
|
||||
|
||||
T getMCEntity();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
|
||||
float getHealth();
|
||||
|
||||
void setHealth(float var1);
|
||||
|
||||
float getMaxHealth();
|
||||
|
||||
void setMaxHealth(float var1);
|
||||
|
||||
boolean isAttacking();
|
||||
|
||||
void setAttackTarget(IEntityLivingBase var1);
|
||||
|
||||
IEntityLivingBase getAttackTarget();
|
||||
|
||||
IEntityLivingBase getLastAttacked();
|
||||
|
||||
int getLastAttackedTime();
|
||||
|
||||
boolean canSeeEntity(IEntity var1);
|
||||
|
||||
void swingMainhand();
|
||||
|
||||
void swingOffhand();
|
||||
|
||||
IItemStack getMainhandItem();
|
||||
|
||||
void setMainhandItem(IItemStack var1);
|
||||
|
||||
IItemStack getOffhandItem();
|
||||
|
||||
void setOffhandItem(IItemStack var1);
|
||||
|
||||
IItemStack getArmor(int var1);
|
||||
|
||||
void setArmor(int var1, IItemStack var2);
|
||||
|
||||
void addPotionEffect(int var1, int var2, int var3, boolean var4);
|
||||
|
||||
void clearPotionEffects();
|
||||
|
||||
int getPotionEffect(int var1);
|
||||
|
||||
boolean isChild();
|
||||
|
||||
T getMCEntity();
|
||||
|
||||
float getMoveForward();
|
||||
|
||||
void setMoveForward(float var1);
|
||||
|
||||
float getMoveStrafing();
|
||||
|
||||
void setMoveStrafing(float var1);
|
||||
|
||||
float getMoveVertical();
|
||||
|
||||
void setMoveVertical(float var1);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.ITimers;
|
||||
import noppes.npcs.scripted.entity.data.IPlayerMail;
|
||||
import noppes.npcs.scripted.gui.ICustomGui;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
|
||||
String getDisplayName();
|
||||
|
||||
boolean hasFinishedQuest(int var1);
|
||||
|
||||
boolean hasActiveQuest(int var1);
|
||||
|
||||
void startQuest(int var1);
|
||||
|
||||
int factionStatus(int var1);
|
||||
|
||||
void finishQuest(int var1);
|
||||
|
||||
void stopQuest(int var1);
|
||||
|
||||
void removeQuest(int var1);
|
||||
|
||||
boolean hasReadDialog(int var1);
|
||||
|
||||
void showDialog(int var1, String var2);
|
||||
|
||||
void removeDialog(int var1);
|
||||
|
||||
void addDialog(int var1);
|
||||
|
||||
void addFactionPoints(int var1, int var2);
|
||||
|
||||
int getFactionPoints(int var1);
|
||||
|
||||
void message(String var1);
|
||||
|
||||
int getGamemode();
|
||||
|
||||
void setGamemode(int var1);
|
||||
|
||||
/** @deprecated */
|
||||
int inventoryItemCount(IItemStack var1);
|
||||
|
||||
/** @deprecated */
|
||||
int inventoryItemCount(String var1, int var2);
|
||||
|
||||
IContainer getInventory();
|
||||
|
||||
boolean removeItem(IItemStack var1, int var2);
|
||||
|
||||
boolean removeItem(String var1, int var2, int var3);
|
||||
|
||||
void removeAllItems(IItemStack var1);
|
||||
|
||||
boolean giveItem(IItemStack var1);
|
||||
|
||||
boolean giveItem(String var1, int var2, int var3);
|
||||
|
||||
void setSpawnpoint(int var1, int var2, int var3);
|
||||
|
||||
void resetSpawnpoint();
|
||||
|
||||
boolean hasAchievement(String var1);
|
||||
|
||||
int getExpLevel();
|
||||
|
||||
void setExpLevel(int var1);
|
||||
|
||||
boolean hasPermission(String var1);
|
||||
|
||||
Object getPixelmonData();
|
||||
|
||||
ITimers getTimers();
|
||||
|
||||
void closeGui();
|
||||
|
||||
T getMCEntity();
|
||||
|
||||
int getHunger();
|
||||
|
||||
void setHunger(int var1);
|
||||
|
||||
void kick(String var1);
|
||||
|
||||
void sendNotification(String var1, String var2, int var3);
|
||||
|
||||
void sendMail(IPlayerMail var1);
|
||||
|
||||
void clearData();
|
||||
|
||||
IQuest[] getActiveQuests();
|
||||
|
||||
IQuest[] getFinishedQuests();
|
||||
|
||||
void updatePlayerInventory();
|
||||
|
||||
void playSound(String var1, float var2, float var3);
|
||||
|
||||
/** @deprecated */
|
||||
IContainer showChestGui(int var1);
|
||||
|
||||
IContainer getOpenContainer();
|
||||
|
||||
boolean canQuestBeAccepted(int var1);
|
||||
|
||||
void showCustomGui(ICustomGui var1);
|
||||
|
||||
ICustomGui getCustomGui();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.entity.IThrowable;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IProjectile<T extends EntityThrowable> extends IThrowable<T> {
|
||||
IItemStack getItem();
|
||||
|
||||
void setItem(IItemStack var1);
|
||||
|
||||
boolean getHasGravity();
|
||||
|
||||
void setHasGravity(boolean var1);
|
||||
|
||||
int getAccuracy();
|
||||
|
||||
void setAccuracy(int var1);
|
||||
|
||||
void setHeading(IEntity var1);
|
||||
|
||||
void setHeading(double var1, double var3, double var5);
|
||||
|
||||
void setHeading(float var1, float var2);
|
||||
|
||||
void enableEvents();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
|
||||
public interface IThrowable<T extends EntityThrowable> extends IEntity<T> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface IData {
|
||||
void put(String var1, Object var2);
|
||||
|
||||
Object get(String var1);
|
||||
|
||||
void remove(String var1);
|
||||
|
||||
boolean has(String var1);
|
||||
|
||||
String[] getKeys();
|
||||
|
||||
void clear();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCAdvanced {
|
||||
void setLine(int var1, int var2, String var3, String var4);
|
||||
|
||||
String getLine(int var1, int var2);
|
||||
|
||||
int getLineCount(int var1);
|
||||
|
||||
String getSound(int var1);
|
||||
|
||||
void setSound(int var1, String var2);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCAi {
|
||||
int getAnimation();
|
||||
|
||||
void setAnimation(int var1);
|
||||
|
||||
int getCurrentAnimation();
|
||||
|
||||
void setReturnsHome(boolean var1);
|
||||
|
||||
boolean getReturnsHome();
|
||||
|
||||
int getRetaliateType();
|
||||
|
||||
void setRetaliateType(int var1);
|
||||
|
||||
int getMovingType();
|
||||
|
||||
void setMovingType(int var1);
|
||||
|
||||
int getNavigationType();
|
||||
|
||||
void setNavigationType(int var1);
|
||||
|
||||
int getStandingType();
|
||||
|
||||
void setStandingType(int var1);
|
||||
|
||||
boolean getAttackInvisible();
|
||||
|
||||
void setAttackInvisible(boolean var1);
|
||||
|
||||
int getWanderingRange();
|
||||
|
||||
void setWanderingRange(int var1);
|
||||
|
||||
boolean getInteractWithNPCs();
|
||||
|
||||
void setInteractWithNPCs(boolean var1);
|
||||
|
||||
boolean getStopOnInteract();
|
||||
|
||||
void setStopOnInteract(boolean var1);
|
||||
|
||||
int getWalkingSpeed();
|
||||
|
||||
void setWalkingSpeed(int var1);
|
||||
|
||||
int getMovingPathType();
|
||||
|
||||
boolean getMovingPathPauses();
|
||||
|
||||
void setMovingPathType(int var1, boolean var2);
|
||||
|
||||
int getDoorInteract();
|
||||
|
||||
void setDoorInteract(int var1);
|
||||
|
||||
boolean getCanSwim();
|
||||
|
||||
void setCanSwim(boolean var1);
|
||||
|
||||
int getSheltersFrom();
|
||||
|
||||
void setSheltersFrom(int var1);
|
||||
|
||||
boolean getAttackLOS();
|
||||
|
||||
void setAttackLOS(boolean var1);
|
||||
|
||||
boolean getAvoidsWater();
|
||||
|
||||
void setAvoidsWater(boolean var1);
|
||||
|
||||
boolean getLeapAtTarget();
|
||||
|
||||
void setLeapAtTarget(boolean var1);
|
||||
|
||||
int getTacticalType();
|
||||
|
||||
void setTacticalType(int var1);
|
||||
|
||||
int getTacticalRange();
|
||||
|
||||
void setTacticalRange(int var1);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCDisplay {
|
||||
String getName();
|
||||
|
||||
void setName(String var1);
|
||||
|
||||
String getTitle();
|
||||
|
||||
void setTitle(String var1);
|
||||
|
||||
String getSkinUrl();
|
||||
|
||||
void setSkinUrl(String var1);
|
||||
|
||||
String getSkinPlayer();
|
||||
|
||||
void setSkinPlayer(String var1);
|
||||
|
||||
String getSkinTexture();
|
||||
|
||||
void setSkinTexture(String var1);
|
||||
|
||||
boolean getHasLivingAnimation();
|
||||
|
||||
void setHasLivingAnimation(boolean var1);
|
||||
|
||||
int getVisible();
|
||||
|
||||
void setVisible(int var1);
|
||||
|
||||
int getBossbar();
|
||||
|
||||
void setBossbar(int var1);
|
||||
|
||||
int getSize();
|
||||
|
||||
void setSize(int var1);
|
||||
|
||||
int getTint();
|
||||
|
||||
void setTint(int var1);
|
||||
|
||||
int getShowName();
|
||||
|
||||
void setShowName(int var1);
|
||||
|
||||
void setCapeTexture(String var1);
|
||||
|
||||
String getCapeTexture();
|
||||
|
||||
void setOverlayTexture(String var1);
|
||||
|
||||
String getOverlayTexture();
|
||||
|
||||
void setModelScale(int var1, float var2, float var3, float var4);
|
||||
|
||||
float[] getModelScale(int var1);
|
||||
|
||||
int getBossColor();
|
||||
|
||||
void setBossColor(int var1);
|
||||
|
||||
void setModel(String var1);
|
||||
|
||||
String getModel();
|
||||
|
||||
void setHasHitbox(boolean var1);
|
||||
|
||||
boolean getHasHitbox();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface INPCInventory {
|
||||
IItemStack getRightHand();
|
||||
|
||||
void setRightHand(IItemStack var1);
|
||||
|
||||
IItemStack getLeftHand();
|
||||
|
||||
void setLeftHand(IItemStack var1);
|
||||
|
||||
IItemStack getProjectile();
|
||||
|
||||
void setProjectile(IItemStack var1);
|
||||
|
||||
IItemStack getArmor(int var1);
|
||||
|
||||
void setArmor(int var1, IItemStack var2);
|
||||
|
||||
void setDropItem(int var1, IItemStack var2, int var3);
|
||||
|
||||
IItemStack getDropItem(int var1);
|
||||
|
||||
int getExpMin();
|
||||
|
||||
int getExpMax();
|
||||
|
||||
int getExpRNG();
|
||||
|
||||
void setExp(int var1, int var2);
|
||||
|
||||
IItemStack[] getItemsRNG();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCJob {
|
||||
int getType();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCMelee {
|
||||
int getStrength();
|
||||
|
||||
void setStrength(int var1);
|
||||
|
||||
int getDelay();
|
||||
|
||||
void setDelay(int var1);
|
||||
|
||||
int getRange();
|
||||
|
||||
void setRange(int var1);
|
||||
|
||||
int getKnockback();
|
||||
|
||||
void setKnockback(int var1);
|
||||
|
||||
int getEffectType();
|
||||
|
||||
int getEffectTime();
|
||||
|
||||
int getEffectStrength();
|
||||
|
||||
void setEffect(int var1, int var2, int var3);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCRanged {
|
||||
int getStrength();
|
||||
|
||||
void setStrength(int var1);
|
||||
|
||||
int getSpeed();
|
||||
|
||||
void setSpeed(int var1);
|
||||
|
||||
int getBurst();
|
||||
|
||||
void setBurst(int var1);
|
||||
|
||||
int getBurstDelay();
|
||||
|
||||
void setBurstDelay(int var1);
|
||||
|
||||
int getKnockback();
|
||||
|
||||
void setKnockback(int var1);
|
||||
|
||||
int getSize();
|
||||
|
||||
void setSize(int var1);
|
||||
|
||||
boolean getRender3D();
|
||||
|
||||
void setRender3D(boolean var1);
|
||||
|
||||
boolean getSpins();
|
||||
|
||||
void setSpins(boolean var1);
|
||||
|
||||
boolean getSticks();
|
||||
|
||||
void setSticks(boolean var1);
|
||||
|
||||
boolean getHasGravity();
|
||||
|
||||
void setHasGravity(boolean var1);
|
||||
|
||||
boolean getAccelerate();
|
||||
|
||||
void setAccelerate(boolean var1);
|
||||
|
||||
int getExplodeSize();
|
||||
|
||||
void setExplodeSize(int var1);
|
||||
|
||||
int getEffectType();
|
||||
|
||||
int getEffectTime();
|
||||
|
||||
int getEffectStrength();
|
||||
|
||||
void setEffect(int var1, int var2, int var3);
|
||||
|
||||
boolean getGlows();
|
||||
|
||||
void setGlows(boolean var1);
|
||||
|
||||
int getParticle();
|
||||
|
||||
void setParticle(int var1);
|
||||
|
||||
String getSound(int var1);
|
||||
|
||||
void setSound(int var1, String var2);
|
||||
|
||||
int getShotCount();
|
||||
|
||||
void setShotCount(int var1);
|
||||
|
||||
boolean getHasAimAnimation();
|
||||
|
||||
void setHasAimAnimation(boolean var1);
|
||||
|
||||
int getAccuracy();
|
||||
|
||||
void setAccuracy(int var1);
|
||||
|
||||
int getRange();
|
||||
|
||||
void setRange(int var1);
|
||||
|
||||
int getDelayMin();
|
||||
|
||||
int getDelayMax();
|
||||
|
||||
int getDelayRNG();
|
||||
|
||||
void setDelay(int var1, int var2);
|
||||
|
||||
int getFireType();
|
||||
|
||||
void setFireType(int var1);
|
||||
|
||||
int getMeleeRange();
|
||||
|
||||
void setMeleeRange(int var1);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
public interface INPCRole {
|
||||
int getType();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
import noppes.npcs.scripted.entity.data.INPCMelee;
|
||||
import noppes.npcs.scripted.entity.data.INPCRanged;
|
||||
|
||||
public interface INPCStats {
|
||||
int getMaxHealth();
|
||||
|
||||
void setMaxHealth(int var1);
|
||||
|
||||
float getResistance(int var1);
|
||||
|
||||
void setResistance(int var1, float var2);
|
||||
|
||||
int getCombatRegen();
|
||||
|
||||
void setCombatRegen(int var1);
|
||||
|
||||
int getHealthRegen();
|
||||
|
||||
void setHealthRegen(int var1);
|
||||
|
||||
INPCMelee getMelee();
|
||||
|
||||
INPCRanged getRanged();
|
||||
|
||||
boolean getImmune(int var1);
|
||||
|
||||
void setImmune(int var1, boolean var2);
|
||||
|
||||
void setCreatureType(int var1);
|
||||
|
||||
int getCreatureType();
|
||||
|
||||
int getRespawnType();
|
||||
|
||||
void setRespawnType(int var1);
|
||||
|
||||
int getRespawnTime();
|
||||
|
||||
void setRespawnTime(int var1);
|
||||
|
||||
boolean getHideDeadBody();
|
||||
|
||||
void setHideDeadBody(boolean var1);
|
||||
|
||||
int getAggroRange();
|
||||
|
||||
void setAggroRange(int var1);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.entity.data;
|
||||
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
|
||||
public interface IPlayerMail {
|
||||
String getSender();
|
||||
|
||||
void setSender(String var1);
|
||||
|
||||
String getSubject();
|
||||
|
||||
void setSubject(String var1);
|
||||
|
||||
String[] getText();
|
||||
|
||||
void setText(String[] var1);
|
||||
|
||||
IQuest getQuest();
|
||||
|
||||
void setQuest(int var1);
|
||||
|
||||
IContainer getContainer();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
|
||||
public interface IButton extends ICustomGuiComponent {
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
IButton setSize(int var1, int var2);
|
||||
|
||||
String getLabel();
|
||||
|
||||
IButton setLabel(String var1);
|
||||
|
||||
String getTexture();
|
||||
|
||||
boolean hasTexture();
|
||||
|
||||
IButton setTexture(String var1);
|
||||
|
||||
int getTextureX();
|
||||
|
||||
int getTextureY();
|
||||
|
||||
IButton setTextureOffset(int var1, int var2);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
import noppes.npcs.scripted.gui.IButton;
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
import noppes.npcs.scripted.gui.IItemSlot;
|
||||
import noppes.npcs.scripted.gui.ILabel;
|
||||
import noppes.npcs.scripted.gui.IScroll;
|
||||
import noppes.npcs.scripted.gui.ITextField;
|
||||
import noppes.npcs.scripted.gui.ITexturedRect;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface ICustomGui {
|
||||
int getID();
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
List<ICustomGuiComponent> getComponents();
|
||||
|
||||
List<IItemSlot> getSlots();
|
||||
|
||||
void setSize(int var1, int var2);
|
||||
|
||||
void setDoesPauseGame(boolean var1);
|
||||
|
||||
void setBackgroundTexture(String var1);
|
||||
|
||||
IButton addButton(int var1, String var2, int var3, int var4);
|
||||
|
||||
IButton addButton(int var1, String var2, int var3, int var4, int var5, int var6);
|
||||
|
||||
IButton addTexturedButton(int var1, String var2, int var3, int var4, int var5, int var6, String var7);
|
||||
|
||||
IButton addTexturedButton(int var1, String var2, int var3, int var4, int var5, int var6, String var7, int var8, int var9);
|
||||
|
||||
ILabel addLabel(int var1, String var2, int var3, int var4, int var5, int var6);
|
||||
|
||||
ILabel addLabel(int var1, String var2, int var3, int var4, int var5, int var6, int var7);
|
||||
|
||||
ITextField addTextField(int var1, int var2, int var3, int var4, int var5);
|
||||
|
||||
ITexturedRect addTexturedRect(int var1, String var2, int var3, int var4, int var5, int var6);
|
||||
|
||||
ITexturedRect addTexturedRect(int var1, String var2, int var3, int var4, int var5, int var6, int var7, int var8);
|
||||
|
||||
IScroll addScroll(int var1, int var2, int var3, int var4, int var5, String[] var6);
|
||||
|
||||
IItemSlot addItemSlot(int var1, int var2);
|
||||
|
||||
IItemSlot addItemSlot(int var1, int var2, IItemStack var3);
|
||||
|
||||
void showPlayerInventory(int var1, int var2);
|
||||
|
||||
ICustomGuiComponent getComponent(int var1);
|
||||
|
||||
void removeComponent(int var1);
|
||||
|
||||
void updateComponent(ICustomGuiComponent var1);
|
||||
|
||||
void update(IPlayer var1);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
public interface ICustomGuiComponent {
|
||||
int getID();
|
||||
|
||||
ICustomGuiComponent setID(int var1);
|
||||
|
||||
int getPosX();
|
||||
|
||||
int getPosY();
|
||||
|
||||
ICustomGuiComponent setPos(int var1, int var2);
|
||||
|
||||
boolean hasHoverText();
|
||||
|
||||
String[] getHoverText();
|
||||
|
||||
ICustomGuiComponent setHoverText(String var1);
|
||||
|
||||
ICustomGuiComponent setHoverText(String[] var1);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
|
||||
public interface IItemSlot extends ICustomGuiComponent {
|
||||
boolean hasStack();
|
||||
|
||||
IItemStack getStack();
|
||||
|
||||
IItemSlot setStack(IItemStack var1);
|
||||
|
||||
Slot getMCSlot();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
|
||||
public interface ILabel extends ICustomGuiComponent {
|
||||
String getText();
|
||||
|
||||
ILabel setText(String var1);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ILabel setSize(int var1, int var2);
|
||||
|
||||
int getColor();
|
||||
|
||||
ILabel setColor(int var1);
|
||||
|
||||
float getScale();
|
||||
|
||||
ILabel setScale(float var1);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
|
||||
public interface IScroll extends ICustomGuiComponent {
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
IScroll setSize(int var1, int var2);
|
||||
|
||||
String[] getList();
|
||||
|
||||
IScroll setList(String[] var1);
|
||||
|
||||
int getDefaultSelection();
|
||||
|
||||
IScroll setDefaultSelection(int var1);
|
||||
|
||||
boolean isMultiSelect();
|
||||
|
||||
IScroll setMultiSelect(boolean var1);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
|
||||
public interface ITextField extends ICustomGuiComponent {
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ITextField setSize(int var1, int var2);
|
||||
|
||||
String getText();
|
||||
|
||||
ITextField setText(String var1);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import noppes.npcs.scripted.gui.ICustomGuiComponent;
|
||||
|
||||
public interface ITexturedRect extends ICustomGuiComponent {
|
||||
String getTexture();
|
||||
|
||||
ITexturedRect setTexture(String var1);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ITexturedRect setSize(int var1, int var2);
|
||||
|
||||
float getScale();
|
||||
|
||||
ITexturedRect setScale(float var1);
|
||||
|
||||
int getTextureX();
|
||||
|
||||
int getTextureY();
|
||||
|
||||
ITexturedRect setTextureOffset(int var1, int var2);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler;
|
||||
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
|
||||
public interface ICloneHandler {
|
||||
IEntity spawn(double var1, double var3, double var5, int var7, String var8, IWorld var9);
|
||||
|
||||
IEntity get(int var1, String var2, IWorld var3);
|
||||
|
||||
void set(int var1, String var2, IEntity var3);
|
||||
|
||||
void remove(int var1, String var2);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IFaction;
|
||||
|
||||
public interface IFactionHandler {
|
||||
List<IFaction> list();
|
||||
|
||||
IFaction delete(int var1);
|
||||
|
||||
IFaction create(String var1, int var2);
|
||||
|
||||
IFaction get(int var1);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
import noppes.npcs.scripted.handler.data.IQuestCategory;
|
||||
|
||||
public interface IQuestHandler {
|
||||
List<IQuestCategory> categories();
|
||||
|
||||
IQuest get(int var1);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.scripted.handler.data.IRecipe;
|
||||
|
||||
public interface IRecipeHandler {
|
||||
List<IRecipe> getGlobalList();
|
||||
|
||||
List<IRecipe> getCarpentryList();
|
||||
|
||||
IRecipe addRecipe(String var1, boolean var2, ItemStack var3, Object... var4);
|
||||
|
||||
IRecipe addRecipe(String var1, boolean var2, ItemStack var3, int var4, int var5, ItemStack... var6);
|
||||
|
||||
IRecipe delete(int var1);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
|
||||
public interface IAvailability {
|
||||
boolean isAvailable(IPlayer var1);
|
||||
|
||||
int getDaytime();
|
||||
|
||||
void setDaytime(int var1);
|
||||
|
||||
int getMinPlayerLevel();
|
||||
|
||||
void setMinPlayerLevel(int var1);
|
||||
|
||||
int getDialog(int var1);
|
||||
|
||||
void setDialog(int var1, int var2, int var3);
|
||||
|
||||
void removeDialog(int var1);
|
||||
|
||||
int getQuest(int var1);
|
||||
|
||||
void setQuest(int var1, int var2, int var3);
|
||||
|
||||
void removeQuest(int var1);
|
||||
|
||||
void setFaction(int var1, int var2, int var3, int var4);
|
||||
|
||||
void removeFaction(int var1);
|
||||
|
||||
void setScoreboard(int var1, String var2, int var3, int var4);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IAvailability;
|
||||
import noppes.npcs.scripted.handler.data.IDialogCategory;
|
||||
import noppes.npcs.scripted.handler.data.IDialogOption;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
|
||||
public interface IDialog {
|
||||
int getId();
|
||||
|
||||
String getName();
|
||||
|
||||
void setName(String var1);
|
||||
|
||||
String getText();
|
||||
|
||||
void setText(String var1);
|
||||
|
||||
IQuest getQuest();
|
||||
|
||||
void setQuest(IQuest var1);
|
||||
|
||||
String getCommand();
|
||||
|
||||
void setCommand(String var1);
|
||||
|
||||
List<IDialogOption> getOptions();
|
||||
|
||||
IDialogOption getOption(int var1);
|
||||
|
||||
IAvailability getAvailability();
|
||||
|
||||
IDialogCategory getCategory();
|
||||
|
||||
void save();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IDialog;
|
||||
|
||||
public interface IDialogCategory {
|
||||
List<IDialog> dialogs();
|
||||
|
||||
String getName();
|
||||
|
||||
IDialog create();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IDialog;
|
||||
import noppes.npcs.scripted.handler.data.IDialogCategory;
|
||||
|
||||
public interface IDialogHandler {
|
||||
List<IDialogCategory> categories();
|
||||
|
||||
IDialog get(int var1);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
public interface IDialogOption {
|
||||
int getSlot();
|
||||
|
||||
String getName();
|
||||
|
||||
int getType();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import noppes.npcs.scripted.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
|
||||
public interface IFaction {
|
||||
int getId();
|
||||
|
||||
String getName();
|
||||
|
||||
int getDefaultPoints();
|
||||
|
||||
void setDefaultPoints(int var1);
|
||||
|
||||
int getColor();
|
||||
|
||||
int playerStatus(IPlayer var1);
|
||||
|
||||
boolean hostileToNpc(ICustomNpc var1);
|
||||
|
||||
boolean hostileToFaction(int var1);
|
||||
|
||||
int[] getHostileList();
|
||||
|
||||
void addHostile(int var1);
|
||||
|
||||
void removeHostile(int var1);
|
||||
|
||||
boolean hasHostile(int var1);
|
||||
|
||||
boolean getIsHidden();
|
||||
|
||||
void setIsHidden(boolean var1);
|
||||
|
||||
boolean getAttackedByMobs();
|
||||
|
||||
void setAttackedByMobs(boolean var1);
|
||||
|
||||
void save();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.entity.IPlayer;
|
||||
|
||||
public interface IQuest {
|
||||
int getId();
|
||||
|
||||
String getName();
|
||||
|
||||
void setName(String var1);
|
||||
|
||||
int getType();
|
||||
|
||||
void setType(int var1);
|
||||
|
||||
String getLogText();
|
||||
|
||||
void setLogText(String var1);
|
||||
|
||||
String getCompleteText();
|
||||
|
||||
void setCompleteText(String var1);
|
||||
|
||||
IQuest getNextQuest();
|
||||
|
||||
void setNextQuest(IQuest var1);
|
||||
|
||||
IQuestObjective[] getObjectives(IPlayer var1);
|
||||
|
||||
IQuestCategory getCategory();
|
||||
|
||||
IContainer getRewards();
|
||||
|
||||
String getNpcName();
|
||||
|
||||
void setNpcName(String var1);
|
||||
|
||||
void save();
|
||||
|
||||
boolean getIsRepeatable();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import java.util.List;
|
||||
import noppes.npcs.scripted.handler.data.IQuest;
|
||||
|
||||
public interface IQuestCategory {
|
||||
List<IQuest> quests();
|
||||
|
||||
String getName();
|
||||
|
||||
IQuest create();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IQuestHandler {
|
||||
List<IQuestCategory> categories();
|
||||
|
||||
IQuest get(int var1);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
public interface IQuestObjective {
|
||||
int getProgress();
|
||||
|
||||
void setProgress(int var1);
|
||||
|
||||
int getMaxProgress();
|
||||
|
||||
boolean isCompleted();
|
||||
|
||||
String getText();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.handler.data;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRecipe {
|
||||
String getName();
|
||||
|
||||
boolean isGlobal();
|
||||
|
||||
void setIsGlobal(boolean var1);
|
||||
|
||||
boolean getIgnoreNBT();
|
||||
|
||||
void setIgnoreNBT(boolean var1);
|
||||
|
||||
boolean getIgnoreDamage();
|
||||
|
||||
void setIgnoreDamage(boolean var1);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ItemStack getResult();
|
||||
|
||||
ItemStack[] getRecipe();
|
||||
|
||||
void saves(boolean var1);
|
||||
|
||||
boolean saves();
|
||||
|
||||
void save();
|
||||
|
||||
void delete();
|
||||
|
||||
int getId();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.scripted.INbt;
|
||||
import noppes.npcs.scripted.entity.IEntityLiving;
|
||||
import noppes.npcs.scripted.entity.data.IData;
|
||||
|
||||
public interface IItemStack {
|
||||
int getStackSize();
|
||||
|
||||
void setStackSize(int var1);
|
||||
|
||||
int getMaxStackSize();
|
||||
|
||||
int getItemDamage();
|
||||
|
||||
void setItemDamage(int var1);
|
||||
|
||||
int getMaxItemDamage();
|
||||
|
||||
double getAttackDamage();
|
||||
|
||||
void damageItem(int var1, IEntityLiving var2);
|
||||
|
||||
void addEnchantment(String var1, int var2);
|
||||
|
||||
boolean isEnchanted();
|
||||
|
||||
boolean hasEnchant(String var1);
|
||||
|
||||
boolean removeEnchant(String var1);
|
||||
|
||||
/** @deprecated */
|
||||
boolean isBlock();
|
||||
|
||||
boolean isWearable();
|
||||
|
||||
boolean hasCustomName();
|
||||
|
||||
void setCustomName(String var1);
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
String getItemName();
|
||||
|
||||
String getName();
|
||||
|
||||
/** @deprecated */
|
||||
boolean isBook();
|
||||
|
||||
IItemStack copy();
|
||||
|
||||
ItemStack getMCItemStack();
|
||||
|
||||
INbt getNbt();
|
||||
|
||||
boolean hasNbt();
|
||||
|
||||
void removeNbt();
|
||||
|
||||
INbt getItemNbt();
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
int getType();
|
||||
|
||||
String[] getLore();
|
||||
|
||||
void setLore(String[] var1);
|
||||
|
||||
/** @deprecated */
|
||||
void setAttribute(String var1, double var2);
|
||||
|
||||
void setAttribute(String var1, double var2, int var4);
|
||||
|
||||
double getAttribute(String var1);
|
||||
|
||||
boolean hasAttribute(String var1);
|
||||
|
||||
IData getTempdata();
|
||||
|
||||
IData getStoreddata();
|
||||
|
||||
int getFoodLevel();
|
||||
|
||||
boolean compare(IItemStack var1, boolean var2);
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted.wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.scripted.CommandNoppesBase;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.IDamageSource;
|
||||
import noppes.npcs.scripted.INbt;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.entity.IEntity;
|
||||
import noppes.npcs.scripted.entity.data.IPlayerMail;
|
||||
import noppes.npcs.scripted.gui.ICustomGui;
|
||||
import noppes.npcs.scripted.handler.ICloneHandler;
|
||||
import noppes.npcs.scripted.handler.IDialogHandler;
|
||||
import noppes.npcs.scripted.handler.IFactionHandler;
|
||||
import noppes.npcs.scripted.handler.IQuestHandler;
|
||||
import noppes.npcs.scripted.handler.IRecipeHandler;
|
||||
import noppes.npcs.scripted.item.IItemStack;
|
||||
import noppes.npcs.scripted.wrapper.ContainerWrapper;
|
||||
import noppes.npcs.scripted.wrapper.DamageSourceWrapper;
|
||||
import noppes.npcs.scripted.wrapper.ItemStackWrapper;
|
||||
import noppes.npcs.scripted.wrapper.NBTWrapper;
|
||||
import noppes.npcs.scripted.wrapper.WorldWrapper;
|
||||
import noppes.npcs.scripted.wrapper.WrapperEntityData;
|
||||
import noppes.npcs.scripted.wrapper.gui.CustomGuiWrapper;
|
||||
import noppes.npcs.containers.ContainerNpcInterface;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.LRUHashMap;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
import noppes.npcs.util.JsonException;
|
||||
|
||||
public class WrapperNpcAPI extends NpcAPI {
|
||||
private static final Map<Integer, WorldWrapper> worldCache = new LRUHashMap(10);
|
||||
public static final EventBus EVENT_BUS = new EventBus();
|
||||
private static NpcAPI instance = null;
|
||||
|
||||
public WrapperNpcAPI() {
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
worldCache.clear();
|
||||
}
|
||||
|
||||
public IEntity getIEntity(Entity entity) {
|
||||
return (IEntity)(entity != null && !entity.field_70170_p.field_72995_K?(entity instanceof EntityNPCInterface?((EntityNPCInterface)entity).wrappedNPC:WrapperEntityData.get(entity)):null);
|
||||
}
|
||||
|
||||
public ICustomNpc createNPC(World world) {
|
||||
if(world.field_72995_K) {
|
||||
return null;
|
||||
} else {
|
||||
EntityCustomNpc npc = new EntityCustomNpc(world);
|
||||
return npc.wrappedNPC;
|
||||
}
|
||||
}
|
||||
|
||||
public ICustomNpc spawnNPC(World world, int x, int y, int z) {
|
||||
if(world.field_72995_K) {
|
||||
return null;
|
||||
} else {
|
||||
EntityCustomNpc npc = new EntityCustomNpc(world);
|
||||
npc.func_70080_a((double)x + 0.5D, (double)y, (double)z + 0.5D, 0.0F, 0.0F);
|
||||
npc.ais.setStartPos((double)x, (double)y, (double)z);
|
||||
npc.func_70606_j(npc.func_110138_aP());
|
||||
world.func_72838_d(npc);
|
||||
return npc.wrappedNPC;
|
||||
}
|
||||
}
|
||||
|
||||
public static NpcAPI Instance() {
|
||||
if(instance == null) {
|
||||
instance = new WrapperNpcAPI();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public EventBus events() {
|
||||
return EVENT_BUS;
|
||||
}
|
||||
|
||||
public IItemStack getIItemStack(ItemStack itemstack) {
|
||||
return (IItemStack)(itemstack != null && !itemstack.func_190926_b()?(IItemStack)itemstack.getCapability(ItemStackWrapper.ITEMSCRIPTEDDATA_CAPABILITY, (EnumFacing)null):ItemStackWrapper.AIR);
|
||||
}
|
||||
|
||||
public IWorld getIWorld(WorldServer world) {
|
||||
WorldWrapper w = (WorldWrapper)worldCache.get(Integer.valueOf(world.field_73011_w.getDimension()));
|
||||
if(w != null) {
|
||||
w.world = world;
|
||||
return w;
|
||||
} else {
|
||||
worldCache.put(Integer.valueOf(world.field_73011_w.getDimension()), w = WorldWrapper.createNew(world));
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
public IWorld getIWorld(int dimensionId) {
|
||||
WorldServer[] var2 = CustomNpcs.Server.field_71305_c;
|
||||
int var3 = var2.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
WorldServer world = var2[var4];
|
||||
if(world.field_73011_w.getDimension() == dimensionId) {
|
||||
return this.getIWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
throw new CustomNPCsException("Unknown dimension id: " + dimensionId, new Object[0]);
|
||||
}
|
||||
|
||||
public IContainer getIContainer(IInventory inventory) {
|
||||
return new ContainerWrapper(inventory);
|
||||
}
|
||||
|
||||
public IContainer getIContainer(Container container) {
|
||||
return (IContainer)(container instanceof ContainerNpcInterface?ContainerNpcInterface.getOrCreateIContainer((ContainerNpcInterface)container):new ContainerWrapper(container));
|
||||
}
|
||||
|
||||
public IFactionHandler getFactions() {
|
||||
this.checkWorld();
|
||||
return FactionController.instance;
|
||||
}
|
||||
|
||||
private void checkWorld() {
|
||||
if(CustomNpcs.Server == null || CustomNpcs.Server.func_71241_aa()) {
|
||||
throw new CustomNPCsException("No world is loaded right now", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public IRecipeHandler getRecipes() {
|
||||
this.checkWorld();
|
||||
return RecipeController.instance;
|
||||
}
|
||||
|
||||
public IQuestHandler getQuests() {
|
||||
this.checkWorld();
|
||||
return QuestController.instance;
|
||||
}
|
||||
|
||||
public IWorld[] getIWorlds() {
|
||||
this.checkWorld();
|
||||
IWorld[] worlds = new IWorld[CustomNpcs.Server.field_71305_c.length];
|
||||
|
||||
for(int i = 0; i < CustomNpcs.Server.field_71305_c.length; ++i) {
|
||||
worlds[i] = this.getIWorld(CustomNpcs.Server.field_71305_c[i]);
|
||||
}
|
||||
|
||||
return worlds;
|
||||
}
|
||||
|
||||
public File getGlobalDir() {
|
||||
return CustomNpcs.Dir;
|
||||
}
|
||||
|
||||
public File getWorldDir() {
|
||||
return CustomNpcs.getWorldSaveDirectory();
|
||||
}
|
||||
|
||||
public void registerCommand(CommandNoppesBase command) {
|
||||
CustomNpcs.NoppesCommand.registerCommand(command);
|
||||
}
|
||||
|
||||
public INbt getINbt(NBTTagCompound compound) {
|
||||
return compound == null?new NBTWrapper(new NBTTagCompound()):new NBTWrapper(compound);
|
||||
}
|
||||
|
||||
public INbt stringToNbt(String str) {
|
||||
if(str != null && !str.isEmpty()) {
|
||||
try {
|
||||
return this.getINbt(NBTJsonUtil.Convert(str));
|
||||
} catch (JsonException var3) {
|
||||
throw new CustomNPCsException(var3, "Failed converting " + str, new Object[0]);
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Cant cast empty string to nbt", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public IDamageSource getIDamageSource(DamageSource damagesource) {
|
||||
return new DamageSourceWrapper(damagesource);
|
||||
}
|
||||
|
||||
public IDialogHandler getDialogs() {
|
||||
return DialogController.instance;
|
||||
}
|
||||
|
||||
public ICloneHandler getClones() {
|
||||
return ServerCloneController.Instance;
|
||||
}
|
||||
|
||||
public String executeCommand(IWorld world, String command) {
|
||||
FakePlayer player = EntityNPCInterface.CommandPlayer;
|
||||
player.func_70029_a(world.getMCWorld());
|
||||
player.func_70107_b(0.0D, 0.0D, 0.0D);
|
||||
return NoppesUtilServer.runCommand(world.getMCWorld(), BlockPos.field_177992_a, "API", command, (EntityPlayer)null, player);
|
||||
}
|
||||
|
||||
public INbt getRawPlayerData(String uuid) {
|
||||
return this.getINbt(PlayerData.loadPlayerData(uuid));
|
||||
}
|
||||
|
||||
public IPlayerMail createMail(String sender, String subject) {
|
||||
PlayerMail mail = new PlayerMail();
|
||||
mail.sender = sender;
|
||||
mail.subject = subject;
|
||||
return mail;
|
||||
}
|
||||
|
||||
public ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame) {
|
||||
return new CustomGuiWrapper(id, width, height, pauseGame);
|
||||
}
|
||||
|
||||
public String getRandomName(int dictionary, int gender) {
|
||||
return CustomNpcs.MARKOV_GENERATOR[dictionary].fetch(gender);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.util;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class LRUHashMap<K, V> extends LinkedHashMap<K, V> {
|
||||
private final int maxSize;
|
||||
|
||||
public LRUHashMap(int size) {
|
||||
super(size, 0.75F, true);
|
||||
this.maxSize = size;
|
||||
}
|
||||
|
||||
protected boolean removeEldestEntry(Entry<K, V> eldest) {
|
||||
return this.size() > this.maxSize;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user