Hotfix for leader chain spawning in the Nether.
This commit is contained in:
parent
ebace20b24
commit
1e77b8abeb
Binary file not shown.
@ -54,6 +54,7 @@ public class MonsterController {
|
|||||||
//Modify spawning algorithm.
|
//Modify spawning algorithm.
|
||||||
int ylv = ent.getLocation().getBlockY();
|
int ylv = ent.getLocation().getBlockY();
|
||||||
if (minion) {
|
if (minion) {
|
||||||
|
TwosideKeeper.log(" Minion modifier",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
ylv+=16;
|
ylv+=16;
|
||||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
|
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
|
||||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,Integer.MAX_VALUE,0));
|
ent.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,Integer.MAX_VALUE,0));
|
||||||
@ -68,10 +69,13 @@ public class MonsterController {
|
|||||||
reason!=SpawnReason.SPAWNER_EGG &&
|
reason!=SpawnReason.SPAWNER_EGG &&
|
||||||
reason!=SpawnReason.SPAWNER &&
|
reason!=SpawnReason.SPAWNER &&
|
||||||
reason!=SpawnReason.SLIME_SPLIT &&
|
reason!=SpawnReason.SLIME_SPLIT &&
|
||||||
reason!=SpawnReason.SILVERFISH_BLOCK) {
|
reason!=SpawnReason.SILVERFISH_BLOCK &&
|
||||||
|
reason!=SpawnReason.REINFORCEMENTS) {
|
||||||
|
TwosideKeeper.log(" Does not meet spawning requirements.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isZombieLeader(ent)) {
|
if (isZombieLeader(ent)) {
|
||||||
|
TwosideKeeper.log(" Is considered a leader!",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
//Zombie leaders have faster movement.
|
//Zombie leaders have faster movement.
|
||||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
|
ent.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));
|
||||||
//Monster m = (Monster)ent;
|
//Monster m = (Monster)ent;
|
||||||
@ -79,6 +83,7 @@ public class MonsterController {
|
|||||||
LivingEntityDifficulty led = getLivingEntityDifficulty(ent);
|
LivingEntityDifficulty led = getLivingEntityDifficulty(ent);
|
||||||
ms.SetLeader(true);
|
ms.SetLeader(true);
|
||||||
convertLivingEntity(ent,led);
|
convertLivingEntity(ent,led);
|
||||||
|
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Leader!",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
//Set the HP of the leader to a more proper amount.
|
//Set the HP of the leader to a more proper amount.
|
||||||
} else
|
} else
|
||||||
if (meetsConditionsToBeElite(ent) && !minion) {
|
if (meetsConditionsToBeElite(ent) && !minion) {
|
||||||
@ -157,27 +162,33 @@ public class MonsterController {
|
|||||||
} else
|
} else
|
||||||
if (ent.getWorld().getName().equalsIgnoreCase("world_nether")) {
|
if (ent.getWorld().getName().equalsIgnoreCase("world_nether")) {
|
||||||
//Difficulty is based on distance away from center.
|
//Difficulty is based on distance away from center.
|
||||||
|
TwosideKeeper.log(" "+GenericFunctions.GetEntityDisplayName(ent)+" in Nether World.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
modifyNetherMonsterHealth(ent);
|
modifyNetherMonsterHealth(ent);
|
||||||
final Location center = new Location(ent.getWorld(),0,64,0);
|
final Location center = new Location(ent.getWorld(),0,64,0);
|
||||||
double chancer = ent.getLocation().distanceSquared(center);
|
double chancer = ent.getLocation().distanceSquared(center);
|
||||||
if ((Math.random()*chancer)<1024) {
|
if ((Math.random()*chancer)<1024) {
|
||||||
if (isZombieLeader(ent)) {
|
if (isZombieLeader(ent)) {
|
||||||
|
TwosideKeeper.log(" Converting to leader!",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
convertLivingEntity(ent,LivingEntityDifficulty.NORMAL);
|
convertLivingEntity(ent,LivingEntityDifficulty.NORMAL);
|
||||||
|
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Leader!",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if ((Math.random()*chancer)<65536) {
|
if ((Math.random()*chancer)<65536) {
|
||||||
|
|
||||||
convertLivingEntity(ent,LivingEntityDifficulty.DANGEROUS);
|
convertLivingEntity(ent,LivingEntityDifficulty.DANGEROUS);
|
||||||
|
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Dangerous.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if ((Math.random()*chancer)<1048576) {
|
if ((Math.random()*chancer)<1048576) {
|
||||||
|
|
||||||
convertLivingEntity(ent,LivingEntityDifficulty.DEADLY);
|
convertLivingEntity(ent,LivingEntityDifficulty.DEADLY);
|
||||||
|
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Deadly.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//Change mobs in this range to 'Dangerous' versions. Zombies and skeletons also get armor.
|
//Change mobs in this range to 'Dangerous' versions. Zombies and skeletons also get armor.
|
||||||
LivingEntityDifficulty led = LivingEntityDifficulty.HELLFIRE;
|
LivingEntityDifficulty led = LivingEntityDifficulty.HELLFIRE;
|
||||||
|
TwosideKeeper.log(" Converted "+GenericFunctions.GetEntityDisplayName(ent)+" to Hellfire.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
|
|
||||||
convertLivingEntity(ent,led);
|
convertLivingEntity(ent,led);
|
||||||
return true;
|
return true;
|
||||||
@ -723,12 +734,12 @@ public class MonsterController {
|
|||||||
if ((ent instanceof Zombie)) {
|
if ((ent instanceof Zombie)) {
|
||||||
MonsterDifficulty md = getMonsterDifficulty((Monster)ent);
|
MonsterDifficulty md = getMonsterDifficulty((Monster)ent);
|
||||||
if
|
if
|
||||||
(
|
( ent.getWorld().getName().equalsIgnoreCase("world") &&
|
||||||
(md==MonsterDifficulty.NORMAL && ent.getMaxHealth()>20) ||
|
((md==MonsterDifficulty.NORMAL && ent.getMaxHealth()>20) ||
|
||||||
(md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) ||
|
(md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) ||
|
||||||
(md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*3) ||
|
(md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*3) ||
|
||||||
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4) ||
|
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4) ||
|
||||||
(md==MonsterDifficulty.END && ent.getMaxHealth()>20*80)
|
(md==MonsterDifficulty.END && ent.getMaxHealth()>20*80))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -880,6 +891,7 @@ public class MonsterController {
|
|||||||
SetupCustomName(ChatColor.DARK_AQUA+"Dangerous",m);
|
SetupCustomName(ChatColor.DARK_AQUA+"Dangerous",m);
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||||
//GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
//GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||||
m.setMaxHealth(800); //Target is 800 HP.
|
m.setMaxHealth(800); //Target is 800 HP.
|
||||||
@ -908,6 +920,7 @@ public class MonsterController {
|
|||||||
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",0);
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||||
m.setMaxHealth(1200); //Target is 1200 HP.
|
m.setMaxHealth(1200); //Target is 1200 HP.
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
@ -941,6 +954,7 @@ public class MonsterController {
|
|||||||
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",0);
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||||
ms.SetLeader(true);
|
ms.SetLeader(true);
|
||||||
|
@ -371,6 +371,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public static ItemStack DEAL_OF_THE_DAY_ITEM;
|
public static ItemStack DEAL_OF_THE_DAY_ITEM;
|
||||||
|
|
||||||
public static final int POTION_DEBUG_LEVEL=5;
|
public static final int POTION_DEBUG_LEVEL=5;
|
||||||
|
public static final int SPAWN_DEBUG_LEVEL=5;
|
||||||
public static final int LAVA_PLUME_COOLDOWN=60;
|
public static final int LAVA_PLUME_COOLDOWN=60;
|
||||||
|
|
||||||
public static long last_lava_plume_time = 0;
|
public static long last_lava_plume_time = 0;
|
||||||
@ -4429,8 +4430,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION) ||
|
ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION) ||
|
||||||
ev.getSpawnReason().equals(SpawnReason.CHUNK_GEN) ||
|
ev.getSpawnReason().equals(SpawnReason.CHUNK_GEN) ||
|
||||||
ev.getSpawnReason().equals(SpawnReason.SLIME_SPLIT))) {
|
ev.getSpawnReason().equals(SpawnReason.SLIME_SPLIT))) {
|
||||||
|
TwosideKeeper.log("Spawned a "+GenericFunctions.GetEntityDisplayName(ev.getEntity()),TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) {
|
if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) {
|
||||||
//Remove this one and spawn another one.
|
//Remove this one and spawn another one.
|
||||||
|
TwosideKeeper.log(" This is a reinforcement.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
Location loc = ev.getEntity().getLocation().clone();
|
Location loc = ev.getEntity().getLocation().clone();
|
||||||
Monster m = (Monster)loc.getWorld().spawnEntity(loc, ev.getEntityType());
|
Monster m = (Monster)loc.getWorld().spawnEntity(loc, ev.getEntityType());
|
||||||
m.setTarget(((Monster)ev.getEntity()).getTarget());
|
m.setTarget(((Monster)ev.getEntity()).getTarget());
|
||||||
@ -4443,6 +4446,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getEntity().remove();
|
ev.getEntity().remove();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
TwosideKeeper.log(" This is a normal mob.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
if (!ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) && !ev.getSpawnReason().equals(SpawnReason.SLIME_SPLIT)) {
|
if (!ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) && !ev.getSpawnReason().equals(SpawnReason.SLIME_SPLIT)) {
|
||||||
if (!habitat_data.addNewStartingLocation(ev.getEntity())) {
|
if (!habitat_data.addNewStartingLocation(ev.getEntity())) {
|
||||||
ev.getEntity().remove();
|
ev.getEntity().remove();
|
||||||
@ -4451,6 +4455,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!MonsterController.MobHeightControl(ev.getEntity(),false,ev.getSpawnReason())) {
|
if (!MonsterController.MobHeightControl(ev.getEntity(),false,ev.getSpawnReason())) {
|
||||||
|
TwosideKeeper.log(" Not allowed by Mob Height Controller",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
//This spawn was not allowed by the mob height controller.
|
//This spawn was not allowed by the mob height controller.
|
||||||
|
@ -205,7 +205,7 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
if (pd.lasthittarget+20*15<=serverTickTime && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
if (pd.lasthittarget+20*15<=serverTickTime && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
|
||||||
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
|
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
|
||||||
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
|
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
|
||||||
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 2);
|
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 4);
|
||||||
pd.storedbowxp=0;
|
pd.storedbowxp=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user