mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 11:44:25 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -22,16 +22,16 @@ public class EventGuiScriptList extends SubGuiInterface {
|
||||
this.setBackground("menubg.png");
|
||||
this.xSize = 346;
|
||||
this.ySize = 216;
|
||||
if(scripts == null) {
|
||||
if (scripts == null) {
|
||||
scripts = new ArrayList();
|
||||
}
|
||||
|
||||
this.scripts = (List)scripts;
|
||||
this.scripts = (List) scripts;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(this.scroll1 == null) {
|
||||
if (this.scroll1 == null) {
|
||||
this.scroll1 = new GuiCustomScroll(this, 0);
|
||||
this.scroll1.setSize(140, 180);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class EventGuiScriptList extends SubGuiInterface {
|
||||
this.scroll1.guiTop = this.guiTop + 14;
|
||||
this.addScroll(this.scroll1);
|
||||
this.addLabel(new GuiNpcLabel(1, "script.availableScripts", this.guiLeft + 4, this.guiTop + 4));
|
||||
if(this.scroll2 == null) {
|
||||
if (this.scroll2 == null) {
|
||||
this.scroll2 = new GuiCustomScroll(this, 1);
|
||||
this.scroll2.setSize(140, 180);
|
||||
}
|
||||
@@ -61,26 +61,26 @@ public class EventGuiScriptList extends SubGuiInterface {
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton)guibutton;
|
||||
if(button.id == 1 && this.scroll1.hasSelected()) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 1 && this.scroll1.hasSelected()) {
|
||||
this.container.scripts.add(this.scroll1.getSelected());
|
||||
this.scroll1.selected = -1;
|
||||
this.scroll2.selected = -1;
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(button.id == 2 && this.scroll2.hasSelected()) {
|
||||
if (button.id == 2 && this.scroll2.hasSelected()) {
|
||||
this.container.scripts.remove(this.scroll2.getSelected());
|
||||
this.scroll2.selected = -1;
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(button.id == 3) {
|
||||
if (button.id == 3) {
|
||||
this.container.scripts.clear();
|
||||
Iterator var3 = this.scripts.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
String script = (String)var3.next();
|
||||
while (var3.hasNext()) {
|
||||
String script = (String) var3.next();
|
||||
this.container.scripts.add(script);
|
||||
}
|
||||
|
||||
@@ -89,14 +89,14 @@ public class EventGuiScriptList extends SubGuiInterface {
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(button.id == 4) {
|
||||
if (button.id == 4) {
|
||||
this.container.scripts.clear();
|
||||
this.scroll1.selected = -1;
|
||||
this.scroll2.selected = -1;
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(button.id == 66) {
|
||||
if (button.id == 66) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GuiNPCEventScripts extends GuiScriptInterface {
|
||||
script.getScripts().add(new ScriptContainer(script));
|
||||
}
|
||||
}
|
||||
script.getScripts().set(tab,container);
|
||||
script.getScripts().set(tab, container);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class GuiScriptAllNPCs extends GuiScriptInterface {
|
||||
script.getScripts().add(new ScriptContainer(script));
|
||||
}
|
||||
}
|
||||
script.getScripts().set(tab,container);
|
||||
script.getScripts().set(tab, container);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileScripted;
|
||||
|
||||
|
||||
|
||||
public class GuiScriptBlock extends GuiScriptInterface {
|
||||
private TileScripted tileScripted;
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageEffects;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.CustomEffect;
|
||||
import noppes.npcs.controllers.data.EffectScript;
|
||||
|
||||
@@ -51,16 +49,16 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.ySize = (int)((double)this.xSize * 0.56);
|
||||
if ((double)this.ySize > (double)this.height * 0.95) {
|
||||
this.ySize = (int)((double)this.height * 0.95);
|
||||
this.xSize = (int)((double)this.ySize / 0.56);
|
||||
this.ySize = (int) ((double) this.xSize * 0.56);
|
||||
if ((double) this.ySize > (double) this.height * 0.95) {
|
||||
this.ySize = (int) ((double) this.height * 0.95);
|
||||
this.xSize = (int) ((double) this.ySize / 0.56);
|
||||
}
|
||||
|
||||
this.bgScale = (float)this.xSize / 400.0F;
|
||||
this.bgScale = (float) this.xSize / 400.0F;
|
||||
super.initGui();
|
||||
this.guiTop += 10;
|
||||
int yoffset = (int)((double)this.ySize * 0.02);
|
||||
int yoffset = (int) ((double) this.ySize * 0.02);
|
||||
GuiMenuTopButton top;
|
||||
this.addTopButton(top = new GuiMenuTopButton(0, this.guiLeft + 4, this.guiTop - 17, "gui.settings"));
|
||||
int topXoffset = 0;
|
||||
@@ -94,7 +92,7 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
hookLabel.color = 11184810;
|
||||
this.addLabel(hookLabel);
|
||||
ScriptContainer container = this.scriptHandler.container;
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int)((double)this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
this.addTextField(ta);
|
||||
@@ -108,7 +106,7 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
this.getButton(107).enabled = false;
|
||||
|
||||
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
|
||||
scroll.setSize(100, (int)((double)this.ySize * 0.54) - yoffset * 2);
|
||||
scroll.setSize(100, (int) ((double) this.ySize * 0.54) - yoffset * 2);
|
||||
scroll.guiLeft = left1;
|
||||
scroll.guiTop = this.guiTop + 88 + yoffset;
|
||||
if (container != null) {
|
||||
@@ -117,7 +115,7 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
|
||||
this.addScroll(scroll);
|
||||
} else {
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int)((float)this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int) ((float) this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
var8.enabled = false;
|
||||
this.addTextField(var8);
|
||||
int var9 = this.guiLeft + this.xSize - 150;
|
||||
@@ -164,9 +162,9 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry)var3.next();
|
||||
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
|
||||
while (var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry) var3.next();
|
||||
builder.insert(0, new Date((Long) entry.getKey()) + (String) entry.getValue() + "\n");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
@@ -175,8 +173,8 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
private int getScriptIndex() {
|
||||
int i = 0;
|
||||
|
||||
for(Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String)var2.next();
|
||||
for (Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String) var2.next();
|
||||
if (language.equalsIgnoreCase(this.scriptHandler.getLanguage())) {
|
||||
return i;
|
||||
}
|
||||
@@ -280,11 +278,11 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
}
|
||||
|
||||
if (guibutton.id == 104) {
|
||||
this.scriptHandler.setEnabled(((GuiNpcButton)guibutton).getValue() == 1);
|
||||
this.scriptHandler.setEnabled(((GuiNpcButton) guibutton).getValue() == 1);
|
||||
}
|
||||
|
||||
if (guibutton.id == 105) {
|
||||
container1 = new GuiYesNo(this, "", ((GuiNpcButton)guibutton).displayString, 10);
|
||||
container1 = new GuiYesNo(this, "", ((GuiNpcButton) guibutton).displayString, 10);
|
||||
this.displayGuiScreen(container1);
|
||||
}
|
||||
|
||||
@@ -335,12 +333,12 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
NBTTagList data = compound.getTagList("Languages", 10);
|
||||
HashMap languages = new HashMap();
|
||||
|
||||
for(int i = 0; i < data.tagCount(); ++i) {
|
||||
for (int i = 0; i < data.tagCount(); ++i) {
|
||||
NBTTagCompound comp = data.getCompoundTagAt(i);
|
||||
ArrayList scripts = new ArrayList();
|
||||
NBTTagList list = comp.getTagList("Scripts", 8);
|
||||
|
||||
for(int j = 0; j < list.tagCount(); ++j) {
|
||||
for (int j = 0; j < list.tagCount(); ++j) {
|
||||
scripts.add(list.getStringTagAt(j));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,17 +39,17 @@ public class GuiScriptForge extends GuiScriptInterface {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for(ClassPath.ClassInfo e1 : list){
|
||||
for (ClassPath.ClassInfo e1 : list) {
|
||||
ClassPath.ClassInfo classLoader = e1;
|
||||
Class infoClass = classLoader.load();
|
||||
ArrayList c = new ArrayList(Arrays.asList(infoClass.getDeclaredClasses()));
|
||||
if(c.isEmpty()) {
|
||||
if (c.isEmpty()) {
|
||||
c.add(infoClass);
|
||||
}
|
||||
Iterator var10 = c.iterator();
|
||||
while(var10.hasNext()) {
|
||||
while (var10.hasNext()) {
|
||||
Class c1 = (Class) var10.next();
|
||||
if(!EntityEvent.EntityConstructing.class.isAssignableFrom(c1) && !WorldEvent.PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers()) && !ChunkEvent.class.isAssignableFrom(c1) && !ChunkWatchEvent.class.isAssignableFrom(c1) && !ChunkDataEvent.class.isAssignableFrom(c1)) {
|
||||
if (!EntityEvent.EntityConstructing.class.isAssignableFrom(c1) && !WorldEvent.PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers()) && !ChunkEvent.class.isAssignableFrom(c1) && !ChunkWatchEvent.class.isAssignableFrom(c1) && !ChunkDataEvent.class.isAssignableFrom(c1)) {
|
||||
String eventName = c1.getName();
|
||||
int i = eventName.lastIndexOf(".");
|
||||
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
|
||||
@@ -78,7 +78,7 @@ public class GuiScriptForge extends GuiScriptInterface {
|
||||
script.getScripts().add(new ScriptContainer(script));
|
||||
}
|
||||
}
|
||||
script.getScripts().set(tab,container);
|
||||
script.getScripts().set(tab, container);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.HashMap;
|
||||
|
||||
public class GuiScriptGlobal extends GuiNPCInterface implements IGuiData {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/smallbg.png");
|
||||
private HashMap<Integer,Class<?>> scriptGuiClasses = new HashMap<>();
|
||||
private HashMap<Integer, Class<?>> scriptGuiClasses = new HashMap<>();
|
||||
|
||||
public GuiScriptGlobal() {
|
||||
this.xSize = 176;
|
||||
@@ -48,7 +48,7 @@ public class GuiScriptGlobal extends GuiNPCInterface implements IGuiData {
|
||||
//For examples of what kind of GUI class to create, look at GuiScriptForge.
|
||||
public void addScriptGui(Class<?> guiClass, String buttonText, boolean enabled) {
|
||||
int buttonId = this.buttons.size();
|
||||
this.scriptGuiClasses.put(buttonId,guiClass);
|
||||
this.scriptGuiClasses.put(buttonId, guiClass);
|
||||
|
||||
GuiNpcButton npcButton = new GuiNpcButton(buttonId, this.guiLeft + 38, this.guiTop + 80 + (buttonId - 2) * 30, 100, 20, buttonText);
|
||||
npcButton.setEnabled(enabled);
|
||||
@@ -77,7 +77,8 @@ public class GuiScriptGlobal extends GuiNPCInterface implements IGuiData {
|
||||
try {
|
||||
Class<?> guiClass = this.scriptGuiClasses.get(guibutton.id);
|
||||
this.displayGuiScreen((GuiScreen) guiClass.newInstance());
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,50 +35,50 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
|
||||
public void initGui() {
|
||||
//this.xSize = (int)((double)this.width * 0.88D);
|
||||
this.ySize = (int)((double)this.xSize * 0.56D);
|
||||
if((double)this.ySize > (double)this.height * 0.95D) {
|
||||
this.ySize = (int)((double)this.height * 0.95D);
|
||||
this.xSize = (int)((double)this.ySize / 0.56D);
|
||||
this.ySize = (int) ((double) this.xSize * 0.56D);
|
||||
if ((double) this.ySize > (double) this.height * 0.95D) {
|
||||
this.ySize = (int) ((double) this.height * 0.95D);
|
||||
this.xSize = (int) ((double) this.ySize / 0.56D);
|
||||
}
|
||||
|
||||
this.bgScale = (float)this.xSize / 400.0F;
|
||||
this.bgScale = (float) this.xSize / 400.0F;
|
||||
super.initGui();
|
||||
this.guiTop += 10;
|
||||
int yoffset = (int)((double)this.ySize * 0.02D);
|
||||
int yoffset = (int) ((double) this.ySize * 0.02D);
|
||||
GuiMenuTopButton top;
|
||||
this.addTopButton(top = new GuiMenuTopButton(0, this.guiLeft + 4, this.guiTop - 17, "gui.settings"));
|
||||
|
||||
int topXoffset = 0;
|
||||
int topYoffset = 0;
|
||||
for(int ta = 0; ta < this.handler.getScripts().size(); ++ta) {
|
||||
if(ta%20 == 0 && ta > 0) {
|
||||
for (int ta = 0; ta < this.handler.getScripts().size(); ++ta) {
|
||||
if (ta % 20 == 0 && ta > 0) {
|
||||
topYoffset -= 20;
|
||||
topXoffset -= top.width+20*22;
|
||||
topXoffset -= top.width + 20 * 22;
|
||||
}
|
||||
this.addTopButton(top = new GuiMenuTopButton(ta + 1, top.xPosition+top.width + topXoffset, top.yPosition + topYoffset, ta + 1 + ""));
|
||||
this.addTopButton(top = new GuiMenuTopButton(ta + 1, top.xPosition + top.width + topXoffset, top.yPosition + topYoffset, ta + 1 + ""));
|
||||
topXoffset = 0;
|
||||
topYoffset = 0;
|
||||
scriptLimit = ta + 2;
|
||||
}
|
||||
|
||||
if(this.handler.getScripts().size() < 100)
|
||||
this.addTopButton(new GuiMenuTopButton(scriptLimit, top.xPosition+top.width, top.yPosition, "+"));
|
||||
if (this.handler.getScripts().size() < 100)
|
||||
this.addTopButton(new GuiMenuTopButton(scriptLimit, top.xPosition + top.width, top.yPosition, "+"));
|
||||
|
||||
top = this.getTopButton(this.activeTab);
|
||||
if(top == null) {
|
||||
if (top == null) {
|
||||
this.activeTab = 0;
|
||||
top = this.getTopButton(0);
|
||||
}
|
||||
|
||||
top.active = true;
|
||||
if(this.activeTab > 0) {
|
||||
if (this.activeTab > 0) {
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.allowUserInput = false;
|
||||
hooks.setSize(108, 198);
|
||||
hooks.guiLeft = guiLeft - 110;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
|
||||
if(handler instanceof ForgeDataScript) {
|
||||
if (handler instanceof ForgeDataScript) {
|
||||
hooks.setSize(238, 198);
|
||||
hooks.guiLeft = guiLeft - 240;
|
||||
}
|
||||
@@ -89,8 +89,8 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
hookLabel.color = 0xaaaaaa;
|
||||
addLabel(hookLabel);
|
||||
|
||||
ScriptContainer container = (ScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this,2, guiLeft + 1 + yoffset, guiTop + yoffset, xSize - 108 - yoffset, (int) (ySize * 0.96) - yoffset * 2, container == null?"":container.script);
|
||||
ScriptContainer container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, guiLeft + 1 + yoffset, guiTop + yoffset, xSize - 108 - yoffset, (int) (ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
|
||||
@@ -103,16 +103,16 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
this.addButton(new GuiNpcButton(105, left1 + 61, this.guiTop + 21 + yoffset, 60, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(107, left1, this.guiTop + 66 + yoffset, 80, 20, "script.loadscript"));
|
||||
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
|
||||
scroll.setSize(100, (int)((double)this.ySize * 0.54D) - yoffset * 2);
|
||||
scroll.setSize(100, (int) ((double) this.ySize * 0.54D) - yoffset * 2);
|
||||
scroll.guiLeft = left1;
|
||||
scroll.guiTop = this.guiTop + 88 + yoffset;
|
||||
if(container != null) {
|
||||
if (container != null) {
|
||||
scroll.setList(container.scripts);
|
||||
}
|
||||
|
||||
this.addScroll(scroll);
|
||||
} else {
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int)((float)this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int) ((float) this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
var8.canEdit = false;
|
||||
var8.setFocused(true);
|
||||
this.addTextField(var8);
|
||||
@@ -120,11 +120,11 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
this.addButton(new GuiNpcButton(100, var9, this.guiTop + 125, 60, 20, "gui.copy"));
|
||||
this.addButton(new GuiNpcButton(102, var9, this.guiTop + 146, 60, 20, "gui.clear"));
|
||||
this.addLabel(new GuiNpcLabel(1, "script.language", var9, this.guiTop + 15));
|
||||
this.addButton(new GuiNpcButton(103, var9 + 60, this.guiTop + 10, 80, 20, (String[])this.languages.keySet().toArray(new String[this.languages.keySet().size()]), this.getScriptIndex()));
|
||||
this.addButton(new GuiNpcButton(103, var9 + 60, this.guiTop + 10, 80, 20, (String[]) this.languages.keySet().toArray(new String[this.languages.keySet().size()]), this.getScriptIndex()));
|
||||
this.getButton(103).enabled = this.languages.size() > 0;
|
||||
this.addLabel(new GuiNpcLabel(2, "gui.enabled", var9, this.guiTop + 36));
|
||||
this.addButton(new GuiNpcButton(104, var9 + 60, this.guiTop + 31, 50, 20, new String[]{"gui.no", "gui.yes"}, this.handler.getEnabled()?1:0));
|
||||
if(this.player.worldObj.isRemote) {
|
||||
this.addButton(new GuiNpcButton(104, var9 + 60, this.guiTop + 31, 50, 20, new String[]{"gui.no", "gui.yes"}, this.handler.getEnabled() ? 1 : 0));
|
||||
if (this.player.worldObj.isRemote) {
|
||||
this.addButton(new GuiNpcButton(106, var9, this.guiTop + 55, 150, 20, "script.openfolder"));
|
||||
}
|
||||
|
||||
@@ -139,16 +139,17 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
}
|
||||
|
||||
public String previousHookClicked = "";
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
String hook = scroll.getSelected();
|
||||
if(previousHookClicked.equals(hook)){
|
||||
if (previousHookClicked.equals(hook)) {
|
||||
String addString = "";
|
||||
if(!this.getTextField(2).getText().isEmpty())
|
||||
if (!this.getTextField(2).getText().isEmpty())
|
||||
addString += "\n";
|
||||
addString += "function "+hook+"(event) {\n \n}\n";
|
||||
addString += "function " + hook + "(event) {\n \n}\n";
|
||||
|
||||
this.getTextField(2).setText(this.getTextField(2).getText()+addString);
|
||||
this.getTextField(2).setText(this.getTextField(2).getText() + addString);
|
||||
previousHookClicked = "";
|
||||
} else {
|
||||
previousHookClicked = hook;
|
||||
@@ -165,9 +166,9 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Entry<Long, String> entry = (Entry)var3.next();
|
||||
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
|
||||
while (var3.hasNext()) {
|
||||
Entry<Long, String> entry = (Entry) var3.next();
|
||||
builder.insert(0, new Date((Long) entry.getKey()) + (String) entry.getValue() + "\n");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
@@ -176,9 +177,9 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
private int getScriptIndex() {
|
||||
int i = 0;
|
||||
|
||||
for(Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String)var2.next();
|
||||
if(language.equalsIgnoreCase(this.handler.getLanguage())) {
|
||||
for (Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String) var2.next();
|
||||
if (language.equalsIgnoreCase(this.handler.getLanguage())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -187,34 +188,34 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
}
|
||||
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
if(flag) {
|
||||
if(i == 0) {
|
||||
if (flag) {
|
||||
if (i == 0) {
|
||||
this.openLink("https://www.curseforge.com/minecraft/mc-mods/customnpc-plus");
|
||||
}
|
||||
|
||||
if(i == 1) {
|
||||
if (i == 1) {
|
||||
this.openLink("https://kamkeel.github.io/CustomNPC-Plus/");
|
||||
}
|
||||
|
||||
if(i == 2) {
|
||||
if (i == 2) {
|
||||
this.openLink("https://kamkeel.github.io/CustomNPC-Plus/");
|
||||
}
|
||||
|
||||
if(i == 3) {
|
||||
if (i == 3) {
|
||||
this.openLink("http://www.minecraftforge.net/forum/index.php/board,122.0.html");
|
||||
}
|
||||
if(i == 10) {
|
||||
if (i == 10) {
|
||||
this.handler.getScripts().remove(this.activeTab - 1);
|
||||
this.activeTab = 0;
|
||||
}
|
||||
if(i == 101) {
|
||||
if (i == 101) {
|
||||
(this.getTextField(2)).setText(NoppesStringUtils.getClipboardContents());
|
||||
this.setScript();
|
||||
}
|
||||
if(i == 102) {
|
||||
if (i == 102) {
|
||||
ScriptContainer container;
|
||||
if(this.activeTab > 0) {
|
||||
container = (ScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
if (this.activeTab > 0) {
|
||||
container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
|
||||
container.script = "";
|
||||
} else {
|
||||
this.handler.clearConsole();
|
||||
@@ -231,80 +232,80 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if(guibutton.id >= 0 && guibutton.id < scriptLimit) {
|
||||
if (guibutton.id >= 0 && guibutton.id < scriptLimit) {
|
||||
this.setScript();
|
||||
this.activeTab = guibutton.id;
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(guibutton.id == scriptLimit) {
|
||||
if (guibutton.id == scriptLimit) {
|
||||
this.handler.getScripts().add(new ScriptContainer(this.handler));
|
||||
this.activeTab = this.handler.getScripts().size();
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
if(guibutton.id == 109) {
|
||||
if (guibutton.id == 109) {
|
||||
this.displayGuiScreen(new GuiConfirmOpenLink(this, "https://kamkeel.github.io/CustomNPC-Plus/", 0, true));
|
||||
}
|
||||
|
||||
if(guibutton.id == 110) {
|
||||
if (guibutton.id == 110) {
|
||||
this.displayGuiScreen(new GuiConfirmOpenLink(this, "https://github.com/KAMKEEL/CustomNPC-Plus-API", 1, true));
|
||||
}
|
||||
|
||||
if(guibutton.id == 111) {
|
||||
if (guibutton.id == 111) {
|
||||
this.displayGuiScreen(new GuiConfirmOpenLink(this, "https://github.com/Noppes/CustomNPCsAPI", 2, true));
|
||||
}
|
||||
|
||||
if(guibutton.id == 112) {
|
||||
if (guibutton.id == 112) {
|
||||
this.displayGuiScreen(new GuiConfirmOpenLink(this, "http://www.minecraftforge.net/forum/index.php/board,122.0.html", 3, true));
|
||||
}
|
||||
|
||||
if(guibutton.id == 100) {
|
||||
if (guibutton.id == 100) {
|
||||
NoppesStringUtils.setClipboardContents((this.getTextField(2)).getText());
|
||||
}
|
||||
|
||||
if(guibutton.id == 101) {
|
||||
if (guibutton.id == 101) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, StatCollector.translateToLocal("gui.paste"), StatCollector.translateToLocal("gui.sure"), 101);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
|
||||
ScriptContainer container;
|
||||
if(guibutton.id == 102) {
|
||||
if (guibutton.id == 102) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, StatCollector.translateToLocal("gui.clear"), StatCollector.translateToLocal("gui.sure"), 102);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
|
||||
if(guibutton.id == 103) {
|
||||
this.handler.setLanguage(((GuiNpcButton)guibutton).displayString);
|
||||
if (guibutton.id == 103) {
|
||||
this.handler.setLanguage(((GuiNpcButton) guibutton).displayString);
|
||||
}
|
||||
|
||||
if(guibutton.id == 104) {
|
||||
this.handler.setEnabled((((GuiNpcButton)guibutton).getValue() == 1));
|
||||
if (guibutton.id == 104) {
|
||||
this.handler.setEnabled((((GuiNpcButton) guibutton).getValue() == 1));
|
||||
}
|
||||
|
||||
if(guibutton.id == 105) {
|
||||
GuiYesNo container1 = new GuiYesNo(this, "", ((GuiNpcButton)guibutton).displayString, 10);
|
||||
if (guibutton.id == 105) {
|
||||
GuiYesNo container1 = new GuiYesNo(this, "", ((GuiNpcButton) guibutton).displayString, 10);
|
||||
this.displayGuiScreen(container1);
|
||||
}
|
||||
|
||||
if(guibutton.id == 106) {
|
||||
if (guibutton.id == 106) {
|
||||
NoppesUtil.openFolder(ScriptController.Instance.dir);
|
||||
}
|
||||
|
||||
if(guibutton.id == 107) {
|
||||
container = (ScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
if(container == null) {
|
||||
if (guibutton.id == 107) {
|
||||
container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
|
||||
if (container == null) {
|
||||
this.handler.getScripts().add(container = new ScriptContainer(this.handler));
|
||||
}
|
||||
|
||||
this.setSubGui(new EventGuiScriptList((List)this.languages.get(this.handler.getLanguage()), container));
|
||||
this.setSubGui(new EventGuiScriptList((List) this.languages.get(this.handler.getLanguage()), container));
|
||||
}
|
||||
}
|
||||
|
||||
private void setScript() {
|
||||
if(this.activeTab > 0) {
|
||||
ScriptContainer container = (ScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
if(container == null) {
|
||||
if (this.activeTab > 0) {
|
||||
ScriptContainer container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
|
||||
if (container == null) {
|
||||
this.handler.getScripts().add(container = new ScriptContainer(this.handler));
|
||||
}
|
||||
|
||||
@@ -320,12 +321,12 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
NBTTagList data = compound.getTagList("Languages", 10);
|
||||
HashMap languages = new HashMap();
|
||||
|
||||
for(int i = 0; i < data.tagCount(); ++i) {
|
||||
for (int i = 0; i < data.tagCount(); ++i) {
|
||||
NBTTagCompound comp = data.getCompoundTagAt(i);
|
||||
ArrayList scripts = new ArrayList();
|
||||
NBTTagList list = comp.getTagList("Scripts", 8);
|
||||
|
||||
for(int j = 0; j < list.tagCount(); ++j) {
|
||||
for (int j = 0; j < list.tagCount(); ++j) {
|
||||
scripts.add(list.getStringTagAt(j));
|
||||
}
|
||||
|
||||
@@ -341,8 +342,8 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
}
|
||||
|
||||
public void textUpdate(String text) {
|
||||
ScriptContainer container = (ScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
if(container != null) {
|
||||
ScriptContainer container = (ScriptContainer) this.handler.getScripts().get(this.activeTab - 1);
|
||||
if (container != null) {
|
||||
container.script = text;
|
||||
}
|
||||
|
||||
@@ -351,7 +352,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
@Override
|
||||
public void saveText(String text) {
|
||||
ScriptContainer container = handler.getScripts().get(activeTab);
|
||||
if(container != null)
|
||||
if (container != null)
|
||||
container.script = text;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -37,11 +37,10 @@ public class GuiScriptItem extends GuiScriptInterface {
|
||||
}
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("ItemScriptConsole")){
|
||||
if (compound.hasKey("ItemScriptConsole")) {
|
||||
consoleText = NBTTags.GetLongStringMap(compound.getTagList("ItemScriptConsole", 10));
|
||||
initGui();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.item.setMCNbt(compound);
|
||||
this.item.loadScriptData();
|
||||
super.setGuiData(compound);
|
||||
@@ -58,17 +57,17 @@ public class GuiScriptItem extends GuiScriptInterface {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry)var3.next();
|
||||
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
|
||||
while (var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry) var3.next();
|
||||
builder.insert(0, new Date((Long) entry.getKey()) + (String) entry.getValue() + "\n");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
if(i == 102) {
|
||||
if (activeTab <= 0){
|
||||
if (i == 102) {
|
||||
if (activeTab <= 0) {
|
||||
consoleText = new HashMap<>();
|
||||
ItemScriptErrorPacket.Clear();
|
||||
}
|
||||
|
||||
@@ -62,16 +62,16 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.ySize = (int)((double)this.xSize * 0.56);
|
||||
if ((double)this.ySize > (double)this.height * 0.95) {
|
||||
this.ySize = (int)((double)this.height * 0.95);
|
||||
this.xSize = (int)((double)this.ySize / 0.56);
|
||||
this.ySize = (int) ((double) this.xSize * 0.56);
|
||||
if ((double) this.ySize > (double) this.height * 0.95) {
|
||||
this.ySize = (int) ((double) this.height * 0.95);
|
||||
this.xSize = (int) ((double) this.ySize / 0.56);
|
||||
}
|
||||
|
||||
this.bgScale = (float)this.xSize / 400.0F;
|
||||
this.bgScale = (float) this.xSize / 400.0F;
|
||||
super.initGui();
|
||||
this.guiTop += 10;
|
||||
int yoffset = (int)((double)this.ySize * 0.02);
|
||||
int yoffset = (int) ((double) this.ySize * 0.02);
|
||||
GuiMenuTopButton top;
|
||||
this.addTopButton(top = new GuiMenuTopButton(0, this.guiLeft + 4, this.guiTop - 17, "gui.settings"));
|
||||
int topXoffset = 0;
|
||||
@@ -105,7 +105,7 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
hookLabel.color = 11184810;
|
||||
this.addLabel(hookLabel);
|
||||
ScriptContainer container = this.scriptHandler.container;
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int)((double)this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
this.addTextField(ta);
|
||||
@@ -119,7 +119,7 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
this.getButton(107).enabled = false;
|
||||
|
||||
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
|
||||
scroll.setSize(100, (int)((double)this.ySize * 0.54) - yoffset * 2);
|
||||
scroll.setSize(100, (int) ((double) this.ySize * 0.54) - yoffset * 2);
|
||||
scroll.guiLeft = left1;
|
||||
scroll.guiTop = this.guiTop + 88 + yoffset;
|
||||
if (container != null) {
|
||||
@@ -128,7 +128,7 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
|
||||
this.addScroll(scroll);
|
||||
} else {
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int)((float)this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int) ((float) this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
|
||||
var8.enabled = false;
|
||||
this.addTextField(var8);
|
||||
int var9 = this.guiLeft + this.xSize - 150;
|
||||
@@ -175,9 +175,9 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry)var3.next();
|
||||
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
|
||||
while (var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry) var3.next();
|
||||
builder.insert(0, new Date((Long) entry.getKey()) + (String) entry.getValue() + "\n");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
@@ -186,8 +186,8 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
private int getScriptIndex() {
|
||||
int i = 0;
|
||||
|
||||
for(Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String)var2.next();
|
||||
for (Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
|
||||
String language = (String) var2.next();
|
||||
if (language.equalsIgnoreCase(this.scriptHandler.getLanguage())) {
|
||||
return i;
|
||||
}
|
||||
@@ -291,11 +291,11 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
}
|
||||
|
||||
if (guibutton.id == 104) {
|
||||
this.scriptHandler.setEnabled(((GuiNpcButton)guibutton).getValue() == 1);
|
||||
this.scriptHandler.setEnabled(((GuiNpcButton) guibutton).getValue() == 1);
|
||||
}
|
||||
|
||||
if (guibutton.id == 105) {
|
||||
container1 = new GuiYesNo(this, "", ((GuiNpcButton)guibutton).displayString, 10);
|
||||
container1 = new GuiYesNo(this, "", ((GuiNpcButton) guibutton).displayString, 10);
|
||||
this.displayGuiScreen(container1);
|
||||
}
|
||||
|
||||
@@ -346,12 +346,12 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
NBTTagList data = compound.getTagList("Languages", 10);
|
||||
HashMap languages = new HashMap();
|
||||
|
||||
for(int i = 0; i < data.tagCount(); ++i) {
|
||||
for (int i = 0; i < data.tagCount(); ++i) {
|
||||
NBTTagCompound comp = data.getCompoundTagAt(i);
|
||||
ArrayList scripts = new ArrayList();
|
||||
NBTTagList list = comp.getTagList("Scripts", 8);
|
||||
|
||||
for(int j = 0; j < list.tagCount(); ++j) {
|
||||
for (int j = 0; j < list.tagCount(); ++j) {
|
||||
scripts.add(list.getStringTagAt(j));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
private PlayerDataScript script = new PlayerDataScript((EntityPlayer)null);
|
||||
private PlayerDataScript script = new PlayerDataScript((EntityPlayer) null);
|
||||
|
||||
public GuiScriptPlayers() {
|
||||
hookList.add(EnumScriptType.INIT.function);
|
||||
@@ -99,7 +99,7 @@ public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
script.getScripts().add(new ScriptContainer(script));
|
||||
}
|
||||
}
|
||||
script.getScripts().set(tab,container);
|
||||
script.getScripts().set(tab, container);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user