mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 07:59:08 +00:00
Renamed NPCs button on GUI, added configs for enabling player, forge, NPC, and all scripts.
This commit is contained in:
1 parent
33378fba59
commit
9a244ca2fe
6 files changed
+25
-4
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. True by default")
|
||||
public static boolean ScriptingEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables global player event scripts to be used in the scripter. True by default")
|
||||
public static boolean GlobalPlayerScripts = true;
|
||||
|
||||
@ConfigProp(info = "Enables global forge event scripts to be used in the scripter. True by default")
|
||||
public static boolean GlobalForgeScripts = true;
|
||||
|
||||
@ConfigProp(info = "Enables global NPC scripts to be used in the scripter. 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;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
||||
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"));
|
||||
this.addButton(new GuiNpcButton(2, this.guiLeft + 38, this.guiTop + 80, 100, 20, "NPCs"));
|
||||
this.addButton(new GuiNpcButton(2, this.guiLeft + 38, this.guiTop + 80, 100, 20, "All NPCs"));
|
||||
}
|
||||
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.EventHooks;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
@@ -90,7 +91,7 @@ public class NPCDataScript implements IScriptHandler {
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return ScriptController.Instance.npcScripts.enabled && ScriptController.HasStart && (this.npc == null || !this.npc.worldObj.isRemote);
|
||||
return CustomNpcs.GlobalNPCScripts && ScriptController.Instance.npcScripts.enabled && ScriptController.HasStart && (this.npc == null || !this.npc.worldObj.isRemote);
|
||||
}
|
||||
public boolean isClient() {
|
||||
return this.npc.isClientWorld();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user