mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 16:59:43 +00:00
Merge pull request #41 from c0508383/master
Alex Solid Armor Fix & GLOBAL NPC SCRIPTS
This commit is contained in:
26 files changed
+858
-60
No files matched your search
@@ -47,6 +47,18 @@ public class CustomNpcs {
|
||||
@ConfigProp(info = "The size of IO executors used for compression and decompression. This is the number of threads used for compression and decompression. If you are experiencing issues with the server lagging/crashing, try changing this to a higher number.")
|
||||
public static int CompressorThreads = 2;
|
||||
|
||||
@ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default")
|
||||
public static boolean ScriptingEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
|
||||
public static boolean GlobalPlayerScripts = true;
|
||||
|
||||
@ConfigProp(info = "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
|
||||
public static boolean GlobalForgeScripts = true;
|
||||
|
||||
@ConfigProp(info = "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!")
|
||||
public static boolean GlobalNPCScripts = false;
|
||||
|
||||
@ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.")
|
||||
public static int NpcNavRange = 32;
|
||||
|
||||
@@ -253,6 +265,7 @@ public class CustomNpcs {
|
||||
new LinkedNpcController();
|
||||
ScriptController.Instance.loadStoredData();
|
||||
ScriptController.Instance.loadForgeScripts();
|
||||
ScriptController.Instance.loadNPCScripts();
|
||||
ScriptController.Instance.loadPlayerScripts();
|
||||
ScriptController.HasStart = false;
|
||||
WrapperNpcAPI.clearCache();
|
||||
|
||||
@@ -109,6 +109,7 @@ public class DataScript implements IScriptHandler {
|
||||
return false;
|
||||
if(!hasInited){
|
||||
hasInited = true;
|
||||
EventHooks.onNPCInit(this.npc);
|
||||
callScript(EnumScriptType.INIT);
|
||||
}
|
||||
ScriptContainer script = scripts.get(type.ordinal());
|
||||
|
||||
@@ -19,13 +19,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.controllers.CustomGuiController;
|
||||
import noppes.npcs.controllers.Quest;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||
@@ -42,7 +42,6 @@ import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -51,12 +50,139 @@ public class EventHooks {
|
||||
public EventHooks() {
|
||||
}
|
||||
|
||||
|
||||
public static void onNPCInit(EntityNPCInterface npc) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INIT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCUpdate(EntityNPCInterface npc) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TICK, event);
|
||||
npc.script.callScript(EnumScriptType.TICK);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCDialog(EntityNPCInterface npc, EntityPlayer player, int id, Dialog dialog) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, id, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCDialogClosed(EntityNPCInterface npc, EntityPlayer player, int dialogId, int optionId, Dialog dialog) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, "player", player, "dialog", dialogId, "option", optionId + 1);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onNPCInteract(EntityNPCInterface npc, EntityPlayer player) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.INTERACT, "player", player);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean onNPCMeleeAttack(EntityNPCInterface npc, float damage, EntityLivingBase target){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.MeleeAttackEvent event = new NpcEvent.MeleeAttackEvent(npc.wrappedNPC,damage,target);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.ATTACK, "event", event, "target", target);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean onNPCRangedAttack(EntityNPCInterface npc, float damage, EntityLivingBase target){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.RangedLaunchedEvent event = new NpcEvent.RangedLaunchedEvent(npc.wrappedNPC,damage,target);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.ATTACK, "event", event, "target", target);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void onNPCKilledEntity(EntityNPCInterface npc, EntityLivingBase entity){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLS, event);
|
||||
npc.script.callScript(EnumScriptType.KILLS, "target", entity);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onNPCTarget(EntityNPCInterface npc, EntityLivingBase target){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.TargetEvent event = new NpcEvent.TargetEvent(npc.wrappedNPC,target);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TARGET, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.TARGET, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.COLLIDE, event);
|
||||
npc.script.callScript(EnumScriptType.COLLIDE, "entity", entity);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onNPCDamaged(EntityNPCInterface npc, Entity source, float damage, DamageSource damagesource, ScriptEventDamaged damagedEvent){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.DamagedEvent event = new NpcEvent.DamagedEvent(npc.wrappedNPC,source,damage,damagesource);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.DAMAGED, "event", damagedEvent);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean onNPCKilled(EntityNPCInterface npc, DamageSource damagesource, Entity entity, ScriptEventKilled killedEvent){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
NpcEvent.DiedEvent event = new NpcEvent.DiedEvent(npc.wrappedNPC,damagesource,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLED, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.KILLED, "event", killedEvent);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void onNPCTimer(EntityNPCInterface npc, int id) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
|
||||
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ public class NoppesUtilPlayer {
|
||||
return;
|
||||
|
||||
EventHooks.onDialogOption(new DialogEvent.DialogOption(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, "player", player, "dialog", dialogId, "option", optionId + 1);
|
||||
EventHooks.onNPCDialogClosed(npc,player,dialogId,optionId+1,dialog);
|
||||
|
||||
if(!dialog.hasDialogs(player) && !dialog.hasOtherOptions()) {
|
||||
EventHooks.onDialogClosed(new DialogEvent.DialogClosed(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||
|
||||
@@ -203,7 +203,7 @@ public class NoppesUtilServer {
|
||||
if(!data.dialogsRead.contains(dialog.id))
|
||||
data.dialogsRead.add(dialog.id);
|
||||
setEditingNpc(player, npc);
|
||||
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id);
|
||||
EventHooks.onNPCDialog(npc, player, dialog.id, dialog);
|
||||
}
|
||||
public static void runCommand(EntityPlayer player, String name, String command){
|
||||
runCommand(player, name, command, player);
|
||||
|
||||
@@ -41,6 +41,7 @@ import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -102,7 +103,7 @@ public class PacketHandlerServer{
|
||||
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
|
||||
//player doesnt have permission to do this
|
||||
}
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
|
||||
else {
|
||||
if (item != null) {
|
||||
@@ -118,6 +119,8 @@ public class PacketHandlerServer{
|
||||
featherPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||
playerScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
|
||||
npcScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
||||
forgeScriptPackets(type, buffer, player);
|
||||
else if (item.getItem() == CustomItems.scripter)
|
||||
@@ -172,6 +175,18 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void npcScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
NBTTagCompound compound;
|
||||
if(type == EnumPacketServer.ScriptNPCGet) {
|
||||
NPCDataScript data = ScriptController.Instance.npcScripts;
|
||||
compound = data.writeToNBT(new NBTTagCompound());
|
||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
} else if(type == EnumPacketServer.ScriptNPCSave) {
|
||||
ScriptController.Instance.setNPCScripts(Server.readNBT(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
if(type == EnumPacketServer.DimensionsGet){
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
|
||||
@@ -257,7 +257,7 @@ public class ServerEventsHandler {
|
||||
if(line != null)
|
||||
npc.saySurrounding(line.formatTarget(event.entityLiving));
|
||||
|
||||
npc.script.callScript(EnumScriptType.KILLS, "target", event.entityLiving);
|
||||
EventHooks.onNPCKilledEntity(npc,event.entityLiving);
|
||||
}
|
||||
|
||||
EntityPlayer player = null;
|
||||
|
||||
@@ -355,7 +355,7 @@ public class ClientProxy extends CommonProxy {
|
||||
else if(gui == EnumGuiType.PlayerTransporter)
|
||||
return new GuiTransportSelection(npc);
|
||||
|
||||
else if(gui == EnumGuiType.Script)
|
||||
else if(gui == EnumGuiType.Script && CustomNpcs.ScriptingEnabled)
|
||||
return new GuiScript(npc);
|
||||
|
||||
else if(gui == EnumGuiType.PlayerAnvil)
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.DataScript;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
@@ -80,10 +80,9 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
|
||||
GL11.glTranslatef(GuiCustom.guiLeft,GuiCustom.guiTop,0.0F);
|
||||
GL11.glRotatef(this.rotation,0.0F,0.0F,1.0F);
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
|
||||
int p_73729_1_ = (int) (this.x/this.scale);
|
||||
int p_73729_2_ = (int) (this.y/this.scale);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
|
||||
public class GuiScriptAllNPCs extends GuiScriptInterface {
|
||||
private NPCDataScript script = new NPCDataScript(null);
|
||||
|
||||
public GuiScriptAllNPCs() {
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.ScriptNPCGet, new Object[0]);
|
||||
}
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
this.script.readFromNBT(compound);
|
||||
super.setGuiData(compound);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
super.save();
|
||||
Client.sendData(EnumPacketServer.ScriptNPCSave, new Object[]{this.script.writeToNBT(new NBTTagCompound())});
|
||||
}
|
||||
|
||||
public void close() {
|
||||
super.close();
|
||||
ScriptController.Instance.npcScripts.errored.clear();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ package noppes.npcs.client.gui.script;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -23,8 +24,17 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.addButton(new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players"));
|
||||
this.addButton(new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge"));
|
||||
GuiNpcButton playerButton = new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players");
|
||||
playerButton.setEnabled(CustomNpcs.GlobalPlayerScripts && CustomNpcs.ScriptingEnabled);
|
||||
this.addButton(playerButton);
|
||||
|
||||
GuiNpcButton forgeButton = new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge");
|
||||
forgeButton.setEnabled(CustomNpcs.GlobalForgeScripts && CustomNpcs.ScriptingEnabled);
|
||||
this.addButton(forgeButton);
|
||||
|
||||
GuiNpcButton npcButton = new GuiNpcButton(2, this.guiLeft + 38, this.guiTop + 80, 100, 20, "All NPCs");
|
||||
npcButton.setEnabled(CustomNpcs.GlobalNPCScripts && CustomNpcs.ScriptingEnabled);
|
||||
this.addButton(npcButton);
|
||||
}
|
||||
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
@@ -42,6 +52,9 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
||||
if (guibutton.id == 1) {
|
||||
this.displayGuiScreen(new GuiScriptForge());
|
||||
}
|
||||
if (guibutton.id == 2) {
|
||||
this.displayGuiScreen(new GuiScriptAllNPCs());
|
||||
}
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -147,6 +148,22 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
hookList.add("customGuiSlot");
|
||||
hookList.add("customGuiScroll");
|
||||
hookList.add("customGuiTextfield");
|
||||
|
||||
}
|
||||
else if(handler instanceof NPCDataScript) {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("dialog");
|
||||
hookList.add("damaged");
|
||||
hookList.add("killed");
|
||||
hookList.add("meleeAttack");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("target");
|
||||
hookList.add("collide");
|
||||
hookList.add("kills");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("timer");
|
||||
}
|
||||
else if(handler instanceof ForgeDataScript) {
|
||||
hooks.setSize(238, 198);
|
||||
|
||||
@@ -114,13 +114,13 @@ public class ModelMPM extends ModelNPCMale{
|
||||
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
|
||||
this.bipedRightArmWear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
||||
this.bipedRightArm.addChild(this.bipedRightArmWear);
|
||||
this.solidRightArmWear = new ModelLimbWear(this,"arm","right");
|
||||
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Alex");
|
||||
this.bipedRightArm.addChild(this.solidRightArmWear);
|
||||
|
||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
||||
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left");
|
||||
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Alex");
|
||||
this.bipedLeftArm.addChild(this.solidLeftArmWear);
|
||||
}
|
||||
else{
|
||||
@@ -136,13 +136,13 @@ public class ModelMPM extends ModelNPCMale{
|
||||
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
|
||||
this.bipedRightArmWear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedRightArm.addChild(this.bipedRightArmWear);
|
||||
this.solidRightArmWear = new ModelLimbWear(this,"arm","right");
|
||||
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Steve");
|
||||
this.bipedRightArm.addChild(this.solidRightArmWear);
|
||||
|
||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
||||
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left");
|
||||
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Steve");
|
||||
this.bipedLeftArm.addChild(this.solidLeftArmWear);
|
||||
}
|
||||
|
||||
@@ -157,13 +157,13 @@ public class ModelMPM extends ModelNPCMale{
|
||||
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 32));
|
||||
this.bipedRightLegWear.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
||||
this.solidRightLegWear = new ModelLimbWear(this,"leg","right");
|
||||
this.solidRightLegWear = new ModelLimbWear(this,"leg","right","Steve");
|
||||
this.bipedRightLeg.addChild(this.solidRightLegWear);
|
||||
|
||||
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 48);
|
||||
this.bipedLeftLegWear.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
||||
this.solidLeftLegWear = new ModelLimbWear(this,"leg","left");
|
||||
this.solidLeftLegWear = new ModelLimbWear(this,"leg","left","Steve");
|
||||
this.bipedLeftLeg.addChild(this.solidLeftLegWear);
|
||||
|
||||
|
||||
|
||||
@@ -6,18 +6,32 @@ import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
|
||||
public class ModelLimbWear extends ModelScaleRenderer {
|
||||
public ModelLimbWear(ModelBase base, String limb, String side) {
|
||||
public ModelLimbWear(ModelBase base, String limb, String side, String type) {
|
||||
super(base);
|
||||
|
||||
float thick = 0.55f;
|
||||
switch (limb){
|
||||
case "arm":
|
||||
switch (side){
|
||||
case "right":
|
||||
rightArm(base,thick);
|
||||
switch(type) {
|
||||
case "Steve":
|
||||
switch (side) {
|
||||
case "right":
|
||||
rightArm(base, thick);
|
||||
break;
|
||||
case "left":
|
||||
leftArm(base, thick);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "left":
|
||||
leftArm(base,thick);
|
||||
case "Alex":
|
||||
switch (side) {
|
||||
case "right":
|
||||
rightArmAlex(base, thick);
|
||||
break;
|
||||
case "left":
|
||||
leftArmAlex(base, thick);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -36,6 +50,100 @@ public class ModelLimbWear extends ModelScaleRenderer {
|
||||
|
||||
}
|
||||
|
||||
public void rightArmAlex(ModelBase base, float thick){
|
||||
float x = 0.95f;
|
||||
float y = -2.0f;
|
||||
|
||||
Model2DRenderer front = new Model2DRenderer(base, 44, 36, 3, 12, 64, 64);
|
||||
front.setRotationPoint(-3.39375f+x, 12.535f+y, -2.58f);
|
||||
front.setScale(0.96f,0.8175f);
|
||||
front.setThickness(thick);
|
||||
setRotation(front, 0, 0, 0);
|
||||
this.addChild(front);
|
||||
|
||||
Model2DRenderer back = new Model2DRenderer(base, 51, 36, 3, 12, 64, 64);
|
||||
back.setRotationPoint(0.44f+x, 12.535f+y, 2.58f);
|
||||
back.setScale(0.96f,0.8175f);
|
||||
back.setThickness(thick);
|
||||
setRotation(back, 0, (float)(Math.PI), 0);
|
||||
this.addChild(back);
|
||||
|
||||
Model2DRenderer right = new Model2DRenderer(base, 47, 36, 4, 12, 64, 64);
|
||||
right.setRotationPoint(0.45f+x, 12.55f+y, -2.55f);
|
||||
right.setScale(0.96f,0.82f);
|
||||
right.setThickness(thick);
|
||||
setRotation(right, 0, (float)(Math.PI/-2f), 0);
|
||||
this.addChild(right);
|
||||
|
||||
Model2DRenderer left = new Model2DRenderer(base, 40, 36, 4, 12, 64, 64);
|
||||
left.setRotationPoint(-3.405f+x, 12.55f+y, 2.55f);
|
||||
left.setScale(0.96f,0.82f);
|
||||
left.setThickness(thick);
|
||||
setRotation(left, 0, (float)(Math.PI/2f), 0);
|
||||
this.addChild(left);
|
||||
|
||||
Model2DRenderer top = new Model2DRenderer(base, 44, 32, 3, 4, 64, 64);
|
||||
top.setRotationPoint(-3.39375f+x, -0.6f+y, -2.55f);
|
||||
top.setScale(0.32f);
|
||||
top.setThickness(thick);
|
||||
setRotation(top, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(top);
|
||||
|
||||
Model2DRenderer bottom = new Model2DRenderer(base, 47, 32, 3, 4, 64, 64);
|
||||
bottom.setRotationPoint(-3.39375f+x, 12.0f+y, -2.545f);
|
||||
bottom.setScale(0.32f);
|
||||
bottom.setThickness(thick);
|
||||
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(bottom);
|
||||
}
|
||||
|
||||
public void leftArmAlex(ModelBase base,float thick){
|
||||
float x = 1.95f;
|
||||
float y = -2.0f;
|
||||
|
||||
Model2DRenderer front = new Model2DRenderer(base, 44+8, 36+16, 3, 12, 64, 64);
|
||||
front.setRotationPoint(-3.39375f+x, 12.535f+y, -2.58f);
|
||||
front.setScale(0.96f,0.8175f);
|
||||
front.setThickness(thick);
|
||||
setRotation(front, 0, 0, 0);
|
||||
this.addChild(front);
|
||||
|
||||
Model2DRenderer back = new Model2DRenderer(base, 51+8, 36+16, 3, 12, 64, 64);
|
||||
back.setRotationPoint(0.44f+x, 12.535f+y, 2.58f);
|
||||
back.setScale(0.96f,0.8175f);
|
||||
back.setThickness(thick);
|
||||
setRotation(back, 0, (float)(Math.PI), 0);
|
||||
this.addChild(back);
|
||||
|
||||
Model2DRenderer right = new Model2DRenderer(base, 47+8, 36+16, 4, 12, 64, 64);
|
||||
right.setRotationPoint(0.45f+x, 12.55f+y, -2.55f);
|
||||
right.setScale(0.96f,0.82f);
|
||||
right.setThickness(thick);
|
||||
setRotation(right, 0, (float)(Math.PI/-2f), 0);
|
||||
this.addChild(right);
|
||||
|
||||
Model2DRenderer left = new Model2DRenderer(base, 40+8, 36+16, 4, 12, 64, 64);
|
||||
left.setRotationPoint(-3.405f+x, 12.55f+y, 2.55f);
|
||||
left.setScale(0.96f,0.82f);
|
||||
left.setThickness(thick);
|
||||
setRotation(left, 0, (float)(Math.PI/2f), 0);
|
||||
this.addChild(left);
|
||||
|
||||
Model2DRenderer top = new Model2DRenderer(base, 44+8, 32+16, 3, 4, 64, 64);
|
||||
top.setRotationPoint(-3.39375f+x, -0.6f+y, -2.55f);
|
||||
top.setScale(0.32f);
|
||||
top.setThickness(thick);
|
||||
setRotation(top, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(top);
|
||||
|
||||
Model2DRenderer bottom = new Model2DRenderer(base, 47+8, 32+16, 3, 4, 64, 64);
|
||||
bottom.setRotationPoint(-3.39375f+x, 12.0f+y, -2.545f);
|
||||
bottom.setScale(0.32f);
|
||||
bottom.setThickness(thick);
|
||||
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||
this.addChild(bottom);
|
||||
}
|
||||
|
||||
public void rightArm(ModelBase base, float thick){
|
||||
float x = 0.95f;
|
||||
float y = -2.0f;
|
||||
@@ -76,7 +184,7 @@ public class ModelLimbWear extends ModelScaleRenderer {
|
||||
this.addChild(top);
|
||||
|
||||
Model2DRenderer bottom = new Model2DRenderer(base, 48, 32, 4, 4, 64, 64);
|
||||
bottom.setRotationPoint(-4.5f+x, 12.0f+y, -2.525f);
|
||||
bottom.setRotationPoint(-4.5f+x, 12.0f+y, -2.545f);
|
||||
bottom.setScale(0.32f);
|
||||
bottom.setThickness(thick);
|
||||
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||
|
||||
@@ -40,6 +40,9 @@ public enum EnumPacketServer {
|
||||
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptForgeGet(false),
|
||||
|
||||
ScriptNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptNPCGet(false),
|
||||
|
||||
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||
|
||||
@@ -110,10 +110,16 @@ public class ScriptContainer {
|
||||
}
|
||||
|
||||
public void run(EnumScriptType type, Event event) {
|
||||
if(!CustomNpcs.ScriptingEnabled)
|
||||
return;
|
||||
|
||||
this.run((String)type.function, (Object)event);
|
||||
}
|
||||
|
||||
public void run(String type, Object event) {
|
||||
if(!CustomNpcs.ScriptingEnabled)
|
||||
return;
|
||||
|
||||
if (!this.errored && this.hasCode() && !this.unknownFunctions.contains(type)) {
|
||||
this.setEngine(this.handler.getLanguage());
|
||||
if (this.engine != null) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.entity.*;
|
||||
@@ -56,6 +57,8 @@ public class ScriptController {
|
||||
|
||||
public ForgeDataScript forgeScripts = new ForgeDataScript();
|
||||
|
||||
public NPCDataScript npcScripts = new NPCDataScript((EntityNPCInterface) null);
|
||||
|
||||
public ScriptController(){
|
||||
loaded = false;
|
||||
Instance = this;
|
||||
@@ -111,6 +114,10 @@ public class ScriptController {
|
||||
return new File(dir, "player_scripts.json");
|
||||
}
|
||||
|
||||
private File npcScriptsFile() {
|
||||
return new File(dir, "npc_scripts.json");
|
||||
}
|
||||
|
||||
public boolean loadPlayerScripts() {
|
||||
this.playerScripts.clear();
|
||||
File file = this.playerScriptsFile();
|
||||
@@ -143,6 +150,37 @@ public class ScriptController {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean loadNPCScripts() {
|
||||
this.npcScripts.clear();
|
||||
File file = this.npcScriptsFile();
|
||||
|
||||
try {
|
||||
if(!file.exists()) {
|
||||
return false;
|
||||
} else {
|
||||
this.npcScripts.readFromNBT(NBTJsonUtil.LoadFile(file));
|
||||
shouldSave = false;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
LogWriter.error("Error loading: " + file.getAbsolutePath(), var3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setNPCScripts(NBTTagCompound compound) {
|
||||
this.npcScripts.readFromNBT(compound);
|
||||
File file = this.npcScriptsFile();
|
||||
|
||||
try {
|
||||
NBTJsonUtil.SaveFile(file, compound);
|
||||
} catch (IOException var4) {
|
||||
var4.printStackTrace();
|
||||
} catch (JsonException var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadCategories(){
|
||||
dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts");
|
||||
if(!dir.exists())
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.NBTTags;
|
||||
@@ -84,7 +85,7 @@ public class ForgeDataScript implements IScriptHandler {
|
||||
}
|
||||
|
||||
public boolean getEnabled() {
|
||||
return this.enabled;
|
||||
return CustomNpcs.GlobalForgeScripts && this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean bo) {
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
|
||||
public class NPCDataScript implements IScriptHandler {
|
||||
public List<ScriptContainer> scripts = new ArrayList();
|
||||
public String scriptLanguage = "ECMAScript";
|
||||
private EntityNPCInterface npc;
|
||||
private ICustomNpc npcAPI;
|
||||
public long lastInited = -1L;
|
||||
public boolean enabled = false;
|
||||
private Map<Long, String> console = new TreeMap();
|
||||
public List<Integer> errored = new ArrayList();
|
||||
|
||||
public NPCDataScript(EntityNPCInterface npc) {
|
||||
if(npc != null) {
|
||||
this.npc = npc;
|
||||
}
|
||||
}
|
||||
public void clear() {
|
||||
this.console = new TreeMap();
|
||||
this.errored = new ArrayList();
|
||||
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");
|
||||
this.console = NBTTags.GetLongStringMap(compound.getTagList("ScriptConsole", 10));
|
||||
}
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("Scripts", NBTTags.NBTScript(this.scripts));
|
||||
compound.setString("ScriptLanguage", this.scriptLanguage);
|
||||
compound.setBoolean("ScriptEnabled", this.enabled);
|
||||
compound.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.console));
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void callScript(EnumScriptType type, Event event) {
|
||||
if (this.isEnabled()) {
|
||||
ScriptContainer script;
|
||||
if (ScriptController.Instance.lastLoaded > this.lastInited) {
|
||||
this.lastInited = ScriptController.Instance.lastLoaded;
|
||||
errored.clear();
|
||||
}
|
||||
|
||||
for(int i = 0; i < ScriptController.Instance.npcScripts.scripts.size(); ++i) {
|
||||
script = (ScriptContainer)ScriptController.Instance.npcScripts.scripts.get(i);
|
||||
if (!errored.contains(i)) {
|
||||
if(script == null || script.errored || !script.hasCode() || ScriptController.Instance.npcScripts.errored.contains(i))
|
||||
return;
|
||||
|
||||
script.run(type, event);
|
||||
|
||||
if (script.errored) {
|
||||
ScriptController.Instance.npcScripts.errored.add(i);
|
||||
}
|
||||
|
||||
Iterator var8 = script.console.entrySet().iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry)var8.next();
|
||||
if (!ScriptController.Instance.npcScripts.console.containsKey(entry.getKey())) {
|
||||
ScriptController.Instance.npcScripts.console.put(entry.getKey(), " tab " + (i + 1) + ":\n" + (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
script.console.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return CustomNpcs.GlobalNPCScripts && ScriptController.Instance.npcScripts.enabled && ScriptController.HasStart && (this.npc == null || !this.npc.worldObj.isRemote);
|
||||
}
|
||||
public boolean isClient() {
|
||||
return this.npc.isClientWorld();
|
||||
}
|
||||
public boolean getEnabled() {
|
||||
return ScriptController.Instance.npcScripts.enabled;
|
||||
}
|
||||
public void setEnabled(boolean bo) {
|
||||
ScriptController.Instance.npcScripts.enabled = bo;
|
||||
this.enabled = bo;
|
||||
}
|
||||
public String getLanguage() {
|
||||
return ScriptController.Instance.npcScripts.scriptLanguage;
|
||||
}
|
||||
public void setLanguage(String lang) {
|
||||
this.scriptLanguage = lang;
|
||||
}
|
||||
public List<ScriptContainer> getScripts() {
|
||||
return this.scripts;
|
||||
}
|
||||
public String noticeString() {
|
||||
if(this.npc == null) {
|
||||
return "Global script";
|
||||
} else {
|
||||
BlockPos pos = new BlockPos(this.npc);
|
||||
return NPCDataScript.toStringHelper(this.npc).add("x", pos.getX()).add("y", pos.getY()).add("z", pos.getZ()).toString();
|
||||
}
|
||||
}
|
||||
public ICustomNpc getNpc() {
|
||||
if (this.npcAPI == null) {
|
||||
this.npcAPI = (ICustomNpc) NpcAPI.Instance().getIEntity(this.npc);
|
||||
}
|
||||
return this.npcAPI;
|
||||
}
|
||||
public Map<Long, String> getConsoleText() {
|
||||
return this.console;
|
||||
}
|
||||
public void clearConsole() {
|
||||
this.console.clear();
|
||||
}
|
||||
public static final class ToStringHelper {
|
||||
private final String className;
|
||||
private final NPCDataScript.ToStringHelper.ValueHolder holderHead;
|
||||
private NPCDataScript.ToStringHelper.ValueHolder holderTail;
|
||||
private boolean omitNullValues;
|
||||
private boolean omitEmptyValues;
|
||||
private ToStringHelper(String className) {
|
||||
this.holderHead = new NPCDataScript.ToStringHelper.ValueHolder();
|
||||
this.holderTail = this.holderHead;
|
||||
this.omitNullValues = false;
|
||||
this.omitEmptyValues = false;
|
||||
this.className = (String) Preconditions.checkNotNull(className);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper omitNullValues() {
|
||||
this.omitNullValues = true;
|
||||
return this;
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, @CheckForNull Object value) {
|
||||
return this.addHolder(name, value);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, boolean value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, char value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, double value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, float value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, int value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, long value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(@CheckForNull Object value) {
|
||||
return this.addHolder(value);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(boolean value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(char value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(double value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(float value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(int value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(long value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
private static boolean isEmpty(Object value) {
|
||||
if (value instanceof CharSequence) {
|
||||
return ((CharSequence)value).length() == 0;
|
||||
} else if (value instanceof Collection) {
|
||||
return ((Collection)value).isEmpty();
|
||||
} else if (value instanceof Map) {
|
||||
return ((Map)value).isEmpty();
|
||||
} else if (value instanceof Optional) {
|
||||
return !((Optional)value).isPresent();
|
||||
} else if (value instanceof OptionalInt) {
|
||||
return !((OptionalInt)value).isPresent();
|
||||
} else if (value instanceof OptionalLong) {
|
||||
return !((OptionalLong)value).isPresent();
|
||||
} else if (value instanceof OptionalDouble) {
|
||||
return !((OptionalDouble)value).isPresent();
|
||||
} else if (value instanceof com.google.common.base.Optional) {
|
||||
return !((com.google.common.base.Optional)value).isPresent();
|
||||
} else if (value.getClass().isArray()) {
|
||||
return Array.getLength(value) == 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public String toString() {
|
||||
boolean omitNullValuesSnapshot = this.omitNullValues;
|
||||
boolean omitEmptyValuesSnapshot = this.omitEmptyValues;
|
||||
String nextSeparator = "";
|
||||
StringBuilder builder = (new StringBuilder(32)).append(this.className).append('{');
|
||||
for(NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.holderHead.next; valueHolder != null; valueHolder = valueHolder.next) {
|
||||
Object value = valueHolder.value;
|
||||
if (!(valueHolder instanceof NPCDataScript.ToStringHelper.UnconditionalValueHolder)) {
|
||||
if (value == null) {
|
||||
if (omitNullValuesSnapshot) {
|
||||
continue;
|
||||
}
|
||||
} else if (omitEmptyValuesSnapshot && isEmpty(value)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
builder.append(nextSeparator);
|
||||
nextSeparator = ", ";
|
||||
if (valueHolder.name != null) {
|
||||
builder.append(valueHolder.name).append('=');
|
||||
}
|
||||
if (value != null && value.getClass().isArray()) {
|
||||
Object[] objectArray = new Object[]{value};
|
||||
String arrayString = Arrays.deepToString(objectArray);
|
||||
builder.append(arrayString, 1, arrayString.length() - 1);
|
||||
} else {
|
||||
builder.append(value);
|
||||
}
|
||||
}
|
||||
return builder.append('}').toString();
|
||||
}
|
||||
private NPCDataScript.ToStringHelper.ValueHolder addHolder() {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = new NPCDataScript.ToStringHelper.ValueHolder();
|
||||
this.holderTail = this.holderTail.next = valueHolder;
|
||||
return valueHolder;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addHolder(@CheckForNull Object value) {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
valueHolder.value = value;
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addHolder(String name, @CheckForNull Object value) {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
valueHolder.value = value;
|
||||
valueHolder.name = (String)Preconditions.checkNotNull(name);
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper.UnconditionalValueHolder addUnconditionalHolder() {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = new NPCDataScript.ToStringHelper.UnconditionalValueHolder();
|
||||
this.holderTail = this.holderTail.next = valueHolder;
|
||||
return valueHolder;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addUnconditionalHolder(Object value) {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
valueHolder.value = value;
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addUnconditionalHolder(String name, Object value) {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
valueHolder.value = value;
|
||||
valueHolder.name = (String)Preconditions.checkNotNull(name);
|
||||
return this;
|
||||
}
|
||||
private static final class UnconditionalValueHolder extends NPCDataScript.ToStringHelper.ValueHolder {
|
||||
private UnconditionalValueHolder() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
private static class ValueHolder {
|
||||
@CheckForNull
|
||||
String name;
|
||||
@CheckForNull
|
||||
Object value;
|
||||
@CheckForNull
|
||||
NPCDataScript.ToStringHelper.ValueHolder next;
|
||||
private ValueHolder() {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static NPCDataScript.ToStringHelper toStringHelper(Object self) {
|
||||
return new NPCDataScript.ToStringHelper(self.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.NBTTags;
|
||||
@@ -106,7 +107,7 @@ public class PlayerDataScript implements IScriptHandler {
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote);
|
||||
return CustomNpcs.GlobalPlayerScripts && ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote);
|
||||
}
|
||||
public boolean isClient() {
|
||||
return this.player.isClientWorld();
|
||||
|
||||
@@ -40,20 +40,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.DataAI;
|
||||
import noppes.npcs.DataAdvanced;
|
||||
import noppes.npcs.DataDisplay;
|
||||
import noppes.npcs.DataInventory;
|
||||
import noppes.npcs.DataScript;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.IChatMessages;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.NpcDamageSource;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.VersionCompatibility;
|
||||
import noppes.npcs.*;
|
||||
import noppes.npcs.ai.*;
|
||||
import noppes.npcs.ai.EntityAIMoveIndoors;
|
||||
import noppes.npcs.ai.EntityAIPanic;
|
||||
@@ -233,8 +220,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
super.onUpdate();
|
||||
if(this.ticksExisted % 10 == 0)
|
||||
script.callScript(EnumScriptType.TICK);
|
||||
if(this.ticksExisted % 10 == 0) {
|
||||
EventHooks.onNPCUpdate(this);
|
||||
}
|
||||
this.timers.update();
|
||||
}
|
||||
|
||||
@@ -257,7 +245,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
if(par1Entity instanceof EntityLivingBase){
|
||||
ScriptEventAttack event = new ScriptEventAttack(f, (EntityLivingBase)par1Entity, false);
|
||||
if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", par1Entity))
|
||||
if(EventHooks.onNPCMeleeAttack(this, f, (EntityLivingBase)par1Entity))
|
||||
return false;
|
||||
f = event.getDamage();
|
||||
}
|
||||
@@ -398,8 +386,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(script.callScript(EnumScriptType.INTERACT, "player", player) || isAttacking() || isKilled() || faction.isAggressiveToPlayer(player))
|
||||
|
||||
if(EventHooks.onNPCInteract(this, player) || isAttacking() || isKilled() || faction.isAggressiveToPlayer(player))
|
||||
return false;
|
||||
|
||||
addInteract(player);
|
||||
@@ -515,7 +503,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
else if (attackingEntity instanceof EntityPlayer && faction.isFriendlyToPlayer((EntityPlayer) attackingEntity))
|
||||
return false;
|
||||
ScriptEventDamaged result = new ScriptEventDamaged(i, attackingEntity, damagesource);
|
||||
if(script.callScript(EnumScriptType.DAMAGED, "event", result) || isKilled())
|
||||
if(EventHooks.onNPCDamaged(this, attackingEntity, i, damagesource, result) || isKilled())
|
||||
return false;
|
||||
i = result.getDamage();
|
||||
|
||||
@@ -565,7 +553,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
return;
|
||||
if(getAttackTarget() != entity && entity != null){
|
||||
ScriptEventTarget event = new ScriptEventTarget(entity);
|
||||
if(script.callScript(EnumScriptType.TARGET, "event", event))
|
||||
if(EventHooks.onNPCTarget(this,entity))
|
||||
return;
|
||||
|
||||
if(event.getTarget() == null)
|
||||
@@ -590,7 +578,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
return;
|
||||
}
|
||||
ScriptEventAttack event = new ScriptEventAttack(stats.pDamage, entity, true);
|
||||
if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", entity))
|
||||
if(EventHooks.onNPCRangedAttack(this, f, (EntityLivingBase)entity))
|
||||
return;
|
||||
for(int i = 0; i < this.stats.shotCount; i++)
|
||||
{
|
||||
@@ -919,7 +907,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
|
||||
public void saySurrounding(Line line) {
|
||||
if (line == null || line.text == null)
|
||||
if (line == null || line.text == null || getFakePlayer() == null)
|
||||
return;
|
||||
ServerChatEvent event = new ServerChatEvent(getFakePlayer(), line.text, new ChatComponentTranslation(line.text.replace("%", "%%")));
|
||||
if (MinecraftForge.EVENT_BUS.post(event) || event.component == null){
|
||||
@@ -1072,7 +1060,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
if(jobInterface != null)
|
||||
jobInterface.reset();
|
||||
|
||||
|
||||
EventHooks.onNPCInit(this);
|
||||
script.callScript(EnumScriptType.INIT);
|
||||
}
|
||||
|
||||
@@ -1095,8 +1084,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
for (int i = 0; i < list.size(); ++i){
|
||||
Entity entity = (Entity)list.get(i);
|
||||
if (entity.isEntityAlive())
|
||||
script.callScript(EnumScriptType.COLLIDE, "entity", entity);
|
||||
if (entity.isEntityAlive()) {
|
||||
EventHooks.onNPCCollide(this,entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1223,7 +1213,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
attackingEntity = ((EntityThrowable) entity).getThrower();
|
||||
|
||||
ScriptEventKilled result = new ScriptEventKilled(attackingEntity, damagesource);
|
||||
if(script.callScript(EnumScriptType.KILLED, "event", result))
|
||||
if(EventHooks.onNPCKilled(this,damagesource,attackingEntity,result))
|
||||
return;
|
||||
if(!isRemote()){
|
||||
if(this.recentlyHit > 0)
|
||||
|
||||
@@ -51,7 +51,20 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
QuestData data = playerdata.activeQuests.get(questId);
|
||||
if(data == null)
|
||||
return false;
|
||||
|
||||
HashMap<String,Integer> killed = getKilled(data);
|
||||
int completed = 0;
|
||||
for(String entityName : targets.keySet()){
|
||||
int amount = 0;
|
||||
if(killed.containsKey(entityName))
|
||||
amount = killed.get(entityName);
|
||||
if(amount >= targets.get(entityName)){
|
||||
completed++;
|
||||
}
|
||||
}
|
||||
if(completed >= targets.keySet().size())
|
||||
return true;
|
||||
|
||||
if(killed.size() != targets.size())
|
||||
return false;
|
||||
for(String entity : killed.keySet()){
|
||||
|
||||
@@ -85,6 +85,86 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
public void spawnParticle(ScriptEntityParticle entityParticle) { entityParticle.spawnOnEntity(this); }
|
||||
|
||||
public double getYOffset() { return entity.getYOffset(); }
|
||||
|
||||
@@ -74,7 +74,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void setHunger(int hunger){
|
||||
player.getFoodStats().setFoodLevel(hunger);
|
||||
int prevHunger = this.getHunger();
|
||||
if(hunger < 0)
|
||||
hunger = 0;
|
||||
|
||||
player.getFoodStats().addStats(hunger-prevHunger,0);
|
||||
}
|
||||
|
||||
public float getSaturation(){
|
||||
@@ -82,7 +86,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void setSaturation(float saturation){
|
||||
player.getFoodStats().setFoodSaturationLevel(saturation);
|
||||
float prevSaturation = this.getHunger();
|
||||
if(saturation < 0)
|
||||
saturation = 0;
|
||||
|
||||
player.getFoodStats().addStats(0,saturation-prevSaturation);
|
||||
}
|
||||
|
||||
public int getDimension(){
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.Dialog;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
|
||||
@@ -51,6 +52,10 @@ public class NpcEvent extends CustomNPCsEvent {
|
||||
this.damage = damage;
|
||||
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return damageSource.getMCDamageSource().damageType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RangedLaunchedEvent extends NpcEvent {
|
||||
@@ -58,7 +63,7 @@ public class NpcEvent extends CustomNPCsEvent {
|
||||
public float damage;
|
||||
//public List<IProjectile> projectiles = new ArrayList();
|
||||
|
||||
public RangedLaunchedEvent(ICustomNpc npc, EntityLivingBase target, float damage) {
|
||||
public RangedLaunchedEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
|
||||
super(npc);
|
||||
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
|
||||
this.damage = damage;
|
||||
@@ -70,7 +75,7 @@ public class NpcEvent extends CustomNPCsEvent {
|
||||
public final IEntityLivingBase target;
|
||||
public float damage;
|
||||
|
||||
public MeleeAttackEvent(ICustomNpc npc, EntityLivingBase target, float damage) {
|
||||
public MeleeAttackEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
|
||||
super(npc);
|
||||
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
|
||||
this.damage = damage;
|
||||
@@ -99,6 +104,10 @@ public class NpcEvent extends CustomNPCsEvent {
|
||||
this.type = damagesource.damageType;
|
||||
this.source = NpcAPI.Instance().getIEntity(entity);
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return damageSource.getMCDamageSource().damageType;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
@@ -111,6 +120,34 @@ public class NpcEvent extends CustomNPCsEvent {
|
||||
}
|
||||
}
|
||||
|
||||
public static class DialogEvent extends NpcEvent {
|
||||
public final IPlayer player;
|
||||
public final int id;
|
||||
public final Dialog dialog;
|
||||
|
||||
public DialogEvent(ICustomNpc npc, EntityPlayer player, int id, Dialog dialog) {
|
||||
super(npc);
|
||||
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
|
||||
this.id = id;
|
||||
this.dialog = dialog;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DialogClosedEvent extends NpcEvent {
|
||||
public final IPlayer player;
|
||||
public final int id;
|
||||
public final int optionId;
|
||||
public final Dialog dialog;
|
||||
|
||||
public DialogClosedEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
|
||||
super(npc);
|
||||
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
|
||||
this.id = id;
|
||||
this.optionId = optionId;
|
||||
this.dialog = dialog;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class TargetLostEvent extends NpcEvent {
|
||||
public final IEntityLivingBase entity;
|
||||
|
||||
Reference in new issue
Block a user