Add Job Spawner to Spawn on Death Option

This commit is contained in:
Kam committed 2023-07-30 19:28:06 -04:00
1 parent 339874da52
commit 1a9b9645d5
2 files changed
+37 -10

No files matched your search

@@ -88,7 +88,17 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
y += 23;
addLabel(new GuiNpcLabel(10, "spawner.type", guiLeft + 4, y + 5));
addButton(new GuiNpcButton(10, guiLeft + 80, y, 100, 20, new String[]{"spawner.one", "spawner.all", "spawner.random"}, job.spawnType));
addButton(new GuiNpcButton(10, guiLeft + 80, y, 100, 20, new String[]{"spawner.one", "spawner.all", "spawner.random", "spawner.summoner"}, job.spawnType));
if(job.spawnType == 3){
job.doesntDie = true;
getButton(26).setEnabled(false);
getButton(26).setDisplay(1);
job.despawnOnTargetLost = false;
getButton(11).setEnabled(false);
getButton(11).setDisplay(0);
}
}
@Override
@@ -111,6 +121,19 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
}
if(button.id == 10){
job.spawnType = button.getValue();
if(job.spawnType == 3){
job.doesntDie = true;
getButton(26).setEnabled(false);
getButton(26).setDisplay(1);
job.despawnOnTargetLost = false;
getButton(11).setEnabled(false);
getButton(11).setDisplay(0);
}
else {
getButton(26).setEnabled(true);
getButton(11).setEnabled(true);
}
}
if(button.id == 11){
job.despawnOnTargetLost = button.getValue() == 1;
@@ -22,13 +22,6 @@ public class JobSpawner extends JobInterface{
public NBTTagCompound compound3;
public NBTTagCompound compound2;
public NBTTagCompound compound1;
public String title1;
public String title2;
public String title3;
public String title4;
public String title5;
public String title6;
private int number = 0;
@@ -38,7 +31,9 @@ public class JobSpawner extends JobInterface{
private String id = RandomStringUtils.random(8, true, true);
public boolean doesntDie = false;
public boolean spawnsDieSummonerDies = false;
// 0 - One By One, 1 - All at Once, 2 - Random, 3 - When Summoner Dies
public int spawnType = 0;
public int xOffset = 0;
@@ -287,7 +282,7 @@ public class JobSpawner extends JobInterface{
public boolean aiShouldExecute() {
if(isEmpty() || npc.isKilled())
return false;
target = getTarget();
if(npc.getRNG().nextInt(30) == 1){
if(spawned.isEmpty())
@@ -326,6 +321,15 @@ public class JobSpawner extends JobInterface{
}
@Override
public void killed() {
if(spawnType == 3){
spawnEntity(compound1);
spawnEntity(compound2);
spawnEntity(compound3);
spawnEntity(compound4);
spawnEntity(compound5);
spawnEntity(compound6);
number = 6;
}
reset();
}