mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 19:59:56 +00:00
Merge pull request #143 from TheLivan/dev
Correct odd places and fix potential errors
This commit is contained in:
13 files changed
+48
-55
No files matched your search
@@ -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){
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GuiScriptList extends SubGuiInterface{
|
||||
private GuiCustomScroll scroll2;
|
||||
private ScriptContainer container;
|
||||
private List<String> scripts;
|
||||
|
||||
|
||||
public GuiScriptList(List<String> 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() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String> biomes = new ArrayList<String>();
|
||||
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){
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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<int[]> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -31,13 +31,13 @@ public class JobHealer extends JobInterface{
|
||||
speed = nbttagcompound.getInteger("HealerSpeed");
|
||||
}
|
||||
private List<EntityLivingBase> toHeal = new ArrayList<EntityLivingBase>();
|
||||
|
||||
|
||||
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){
|
||||
|
||||
@@ -272,21 +272,21 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> 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<T extends EntityPlayerMP> extends ScriptPlayer<T> i
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user