diff --git a/src/main/java/noppes/npcs/client/gui/EventGuiScriptList.java b/src/main/java/noppes/npcs/client/gui/EventGuiScriptList.java index 5e06ea31b..4c3ffb308 100644 --- a/src/main/java/noppes/npcs/client/gui/EventGuiScriptList.java +++ b/src/main/java/noppes/npcs/client/gui/EventGuiScriptList.java @@ -65,7 +65,7 @@ public class EventGuiScriptList extends SubGuiInterface{ if(scroll1.hasSelected()){ container.scripts.add(scroll1.getSelected()); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } } @@ -82,13 +82,13 @@ public class EventGuiScriptList extends SubGuiInterface{ container.scripts.add(script); } scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 4){ container.scripts.clear(); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 66){ diff --git a/src/main/java/noppes/npcs/client/gui/GuiScriptList.java b/src/main/java/noppes/npcs/client/gui/GuiScriptList.java index a37f4f43e..c14c48139 100644 --- a/src/main/java/noppes/npcs/client/gui/GuiScriptList.java +++ b/src/main/java/noppes/npcs/client/gui/GuiScriptList.java @@ -15,7 +15,7 @@ public class GuiScriptList extends SubGuiInterface{ private GuiCustomScroll scroll2; private ScriptContainer container; private List scripts; - + public GuiScriptList(List scripts, ScriptContainer container){ this.container = container; setBackground("menubg.png"); @@ -36,7 +36,7 @@ public class GuiScriptList extends SubGuiInterface{ scroll1.guiTop = guiTop + 14; this.addScroll(scroll1); addLabel(new GuiNpcLabel(1, "script.availableScripts", guiLeft + 4, guiTop + 4)); - + if(scroll2 == null){ scroll2 = new GuiCustomScroll(this,1); scroll2.setSize(140, 180); @@ -55,7 +55,7 @@ public class GuiScriptList extends SubGuiInterface{ addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>")); addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<")); - + addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done")); } @@ -65,16 +65,16 @@ public class GuiScriptList extends SubGuiInterface{ if(scroll1.hasSelected()){ container.scripts.add(scroll1.getSelected()); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); - } + } } if(button.id == 2){ if(scroll2.hasSelected()){ container.scripts.remove(scroll2.getSelected()); scroll2.selected = -1; initGui(); - } + } } if(button.id == 3){ container.scripts.clear(); @@ -82,13 +82,13 @@ public class GuiScriptList extends SubGuiInterface{ container.scripts.add(script); } scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 4){ container.scripts.clear(); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 66){ @@ -97,7 +97,7 @@ public class GuiScriptList extends SubGuiInterface{ } @Override public void save() { - + } } diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java index 83eccfdb6..2ab4c1277 100644 --- a/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java @@ -16,7 +16,7 @@ public class SubGuiNpcBiomes extends SubGuiInterface private SpawnData data; private GuiCustomScroll scroll1; private GuiCustomScroll scroll2; - + public SubGuiNpcBiomes(SpawnData data){ this.data = data; setBackground("menubg.png"); @@ -35,7 +35,7 @@ public class SubGuiNpcBiomes extends SubGuiInterface scroll1.guiTop = guiTop + 14; this.addScroll(scroll1); addLabel(new GuiNpcLabel(1, "spawning.availableBiomes", guiLeft + 4, guiTop + 4)); - + if(scroll2 == null){ scroll2 = new GuiCustomScroll(this,1); scroll2.setSize(140, 180); @@ -44,7 +44,7 @@ public class SubGuiNpcBiomes extends SubGuiInterface scroll2.guiTop = guiTop + 14; this.addScroll(scroll2); addLabel(new GuiNpcLabel(2, "spawning.spawningBiomes", guiLeft + 200, guiTop + 4)); - + List biomes = new ArrayList(); for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) { if (base != null && base.biomeName != null && !data.biomes.contains(base.biomeName)) { @@ -59,8 +59,8 @@ public class SubGuiNpcBiomes extends SubGuiInterface addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>")); addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<")); - - + + addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done")); } @@ -72,14 +72,14 @@ public class SubGuiNpcBiomes extends SubGuiInterface scroll1.selected = -1; scroll1.selected = -1; initGui(); - } + } } if(button.id == 2){ if(scroll2.hasSelected()){ data.biomes.remove(scroll2.getSelected()); scroll2.selected = -1; initGui(); - } + } } if(button.id == 3){ data.biomes.clear(); @@ -89,13 +89,13 @@ public class SubGuiNpcBiomes extends SubGuiInterface } } scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 4){ data.biomes.clear(); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 66){ diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index 68aff497e..0fbf1e35f 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -349,7 +349,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol private void updateTexture(){ try{ EntityLivingBase entity = playerdata.getEntity(npc); - if (entity.equals(npc.modelData.entity)) { + if (entity != null && entity.equals(npc.modelData.entity)) { return; } diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java b/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java index 360d69c0c..e54ef412a 100644 --- a/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java +++ b/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java @@ -72,7 +72,7 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro } int minutes = (int) (selected.timePast / 60000); if(minutes == 1) - return minutes + " " + StatCollector.translateToLocal("mailbox.minutes"); + return minutes + " " + StatCollector.translateToLocal("mailbox.minute"); else return minutes + " " + StatCollector.translateToLocal("mailbox.minutes"); } @@ -118,10 +118,8 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro } } @Override - public void save() { - - - } + public void save() {} + @Override public void setGuiData(NBTTagCompound compound) { PlayerMailData data = new PlayerMailData(); diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java index 0fa18d455..5ff37fc03 100644 --- a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java @@ -122,13 +122,13 @@ public class GuiNpcGuard extends GuiNPCInterface2{ } role.targets = all; scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } if(button.id == 14){ role.targets.clear(); scroll1.selected = -1; - scroll1.selected = -1; + scroll2.selected = -1; initGui(); } } diff --git a/src/main/java/noppes/npcs/client/gui/script/EventGuiScriptList.java b/src/main/java/noppes/npcs/client/gui/script/EventGuiScriptList.java index 876f3c02e..b75c53976 100644 --- a/src/main/java/noppes/npcs/client/gui/script/EventGuiScriptList.java +++ b/src/main/java/noppes/npcs/client/gui/script/EventGuiScriptList.java @@ -65,7 +65,7 @@ public class EventGuiScriptList extends SubGuiInterface { if(button.id == 1 && this.scroll1.hasSelected()) { this.container.scripts.add(this.scroll1.getSelected()); this.scroll1.selected = -1; - this.scroll1.selected = -1; + this.scroll2.selected = -1; this.initGui(); } @@ -85,14 +85,14 @@ public class EventGuiScriptList extends SubGuiInterface { } this.scroll1.selected = -1; - this.scroll1.selected = -1; + this.scroll2.selected = -1; this.initGui(); } if(button.id == 4) { this.container.scripts.clear(); this.scroll1.selected = -1; - this.scroll1.selected = -1; + this.scroll2.selected = -1; this.initGui(); } diff --git a/src/main/java/noppes/npcs/client/gui/util/TextContainer.java b/src/main/java/noppes/npcs/client/gui/util/TextContainer.java index 5ee8c8e5e..5eee41b99 100644 --- a/src/main/java/noppes/npcs/client/gui/util/TextContainer.java +++ b/src/main/java/noppes/npcs/client/gui/util/TextContainer.java @@ -31,9 +31,7 @@ public class TextContainer { public TextContainer(String text){ - this.text = text; - text.replaceAll("\\r?\\n|\\r", "\n"); - double l = 1d; + this.text = text.replaceAll("\\r?\\n|\\r", "\n"); } public void init(int width, int height){ diff --git a/src/main/java/noppes/npcs/controllers/LinkedNpcController.java b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java index 35cc8ae9b..b16f54e5a 100644 --- a/src/main/java/noppes/npcs/controllers/LinkedNpcController.java +++ b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java @@ -120,7 +120,7 @@ public class LinkedNpcController { } else{ npc.linkedData = data; - if(npc.posX == 0 && npc.posY == 0 && npc.posX == 0) + if(npc.posX == 0 && npc.posY == 0 && npc.posZ == 0) return; npc.linkedLast = data.time; List points = npc.ais.getMovingPath(); @@ -137,7 +137,6 @@ public class LinkedNpcController { npc.ais.readToNBT(compound); npc.transform.readToNBT(compound); npc.ais.setMovingPath(points); - npc.updateClient = true; } } diff --git a/src/main/java/noppes/npcs/controllers/data/Availability.java b/src/main/java/noppes/npcs/controllers/data/Availability.java index 1704e5b97..fcb6d778b 100644 --- a/src/main/java/noppes/npcs/controllers/data/Availability.java +++ b/src/main/java/noppes/npcs/controllers/data/Availability.java @@ -359,7 +359,7 @@ public class Availability implements ICompatibilty, IAvailability { } public int getDialog(int i) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else if (i == 0) { return this.dialogId; @@ -371,7 +371,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void setDialog(int i, int id, int type) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else { EnumAvailabilityDialog e = EnumAvailabilityDialog.values()[MathHelper.clamp_int(type, 0, 2)]; @@ -393,7 +393,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void removeDialog(int i) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else { if (i == 0) { @@ -414,7 +414,7 @@ public class Availability implements ICompatibilty, IAvailability { } public int getQuest(int i) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else if (i == 0) { return this.questId; @@ -426,7 +426,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void setQuest(int i, int id, int type) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else { EnumAvailabilityQuest e = EnumAvailabilityQuest.values()[MathHelper.clamp_int(type, 0, 5)]; @@ -448,7 +448,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void removeQuest(int i) { - if (i < 0 && i > 3) { + if (i < 0 || i > 3) { throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]); } else { if (i == 0) { @@ -469,7 +469,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void setFaction(int i, int id, int type, int stance) { - if (i < 0 && i > 1) { + if (i < 0 || i > 1) { throw new CustomNPCsException(i + " isnt between 0 and 1", new Object[0]); } else { EnumAvailabilityFactionType e = EnumAvailabilityFactionType.values()[MathHelper.clamp_int(type, 0, 2)]; @@ -488,7 +488,7 @@ public class Availability implements ICompatibilty, IAvailability { } public void removeFaction(int i) { - if (i < 0 && i > 1) { + if (i < 0 || i > 1) { throw new CustomNPCsException(i + " isnt between 0 and 1", new Object[0]); } else { if (i == 0) { diff --git a/src/main/java/noppes/npcs/roles/JobHealer.java b/src/main/java/noppes/npcs/roles/JobHealer.java index 29d756bc2..f12036e1c 100644 --- a/src/main/java/noppes/npcs/roles/JobHealer.java +++ b/src/main/java/noppes/npcs/roles/JobHealer.java @@ -31,13 +31,13 @@ public class JobHealer extends JobInterface{ speed = nbttagcompound.getInteger("HealerSpeed"); } private List toHeal = new ArrayList(); - + public boolean aiShouldExecute() { healTicks++; if (healTicks < speed * 10) return false; - for(Object plObj: npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range/2, range))){ + for(Object plObj: npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range/2.0, range))){ EntityLivingBase entity = (EntityLivingBase) plObj; if(entity instanceof EntityPlayer){ diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java b/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java index 5d5f7a992..473e0bd00 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java @@ -272,21 +272,21 @@ public class ScriptDBCPlayer extends ScriptPlayer i break; case "set": { String noNBTText; - int startIndex = -1; + int num = -1; boolean number = false; boolean run = false; try { - startIndex = Integer.parseInt(bonusID); + num = Integer.parseInt(bonusID); number = true; } catch (Exception var34) { number = false; } - for (startIndex = 0; startIndex < bonuses.length; ++startIndex) { + for (int startIndex = 0; startIndex < bonuses.length; ++startIndex) { String[] bonusValue = bonuses[startIndex].split("\\;"); bonusValues[startIndex][0] = bonusValue[0]; - if (number && startIndex == startIndex || !number && bonusValues[startIndex][0].equals(bonusID)) { + if (number && startIndex == num || !number && bonusValues[startIndex][0].equals(bonusID)) { noNBTText = bonusValues[startIndex][0] + ";" + bonusValueString; bonuses[startIndex] = ""; run = true; @@ -795,4 +795,4 @@ public class ScriptDBCPlayer extends ScriptPlayer i } return ""; } -} \ No newline at end of file +} diff --git a/src/main/java/noppes/npcs/scripted/event/NpcEvent.java b/src/main/java/noppes/npcs/scripted/event/NpcEvent.java index 98c51e6ba..f93ec6b51 100644 --- a/src/main/java/noppes/npcs/scripted/event/NpcEvent.java +++ b/src/main/java/noppes/npcs/scripted/event/NpcEvent.java @@ -345,7 +345,6 @@ public class NpcEvent extends CustomNPCsEvent implements INpcEvent { public final IDialog dialogObj; public final int dialog; - public final int option; public DialogEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) { super(npc); @@ -355,7 +354,6 @@ public class NpcEvent extends CustomNPCsEvent implements INpcEvent { this.dialogObj = dialog; this.dialog = id; - this.option = optionId; } public String getHookName() { @@ -375,7 +373,7 @@ public class NpcEvent extends CustomNPCsEvent implements INpcEvent { } public int getOptionId() { - return option; + return optionId; } /**