From 1a9b9645d5c93199ea6deb5c79999905feeffdce Mon Sep 17 00:00:00 2001 From: Kam Date: Sun, 30 Jul 2023 19:28:06 -0400 Subject: [PATCH] Add Job Spawner to Spawn on Death Option --- .../npcs/client/gui/roles/GuiNpcSpawner.java | 25 ++++++++++++++++++- .../java/noppes/npcs/roles/JobSpawner.java | 22 +++++++++------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java index 0c488dcb8..bac58151e 100644 --- a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java @@ -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; diff --git a/src/main/java/noppes/npcs/roles/JobSpawner.java b/src/main/java/noppes/npcs/roles/JobSpawner.java index 4555e0bd1..dcb0f8ec4 100644 --- a/src/main/java/noppes/npcs/roles/JobSpawner.java +++ b/src/main/java/noppes/npcs/roles/JobSpawner.java @@ -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(); }