From afabcbde4981ec0a280fb5874131a0dfa75b3184 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 4 Jun 2020 23:02:29 +0100 Subject: [PATCH] Huskpocalypse! --- .../wizardry/entity/construct/EntityZombieSpawner.java | 7 ++++++- .../java/electroblob/wizardry/spell/ZombieApocalypse.java | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityZombieSpawner.java b/src/main/java/electroblob/wizardry/entity/construct/EntityZombieSpawner.java index 7f6171fd..0b8831e3 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityZombieSpawner.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityZombieSpawner.java @@ -1,5 +1,6 @@ package electroblob.wizardry.entity.construct; +import electroblob.wizardry.entity.living.EntityHuskMinion; import electroblob.wizardry.entity.living.EntityZombieMinion; import electroblob.wizardry.registry.Spells; import electroblob.wizardry.registry.WizardrySounds; @@ -16,6 +17,8 @@ import net.minecraft.world.World; public class EntityZombieSpawner extends EntityMagicConstruct { + public boolean spawnHusks; + private int spawnTimer = 10; public EntityZombieSpawner(World world){ @@ -34,7 +37,7 @@ public class EntityZombieSpawner extends EntityMagicConstruct { if(!world.isRemote){ - EntityZombieMinion zombie = new EntityZombieMinion(world); + EntityZombieMinion zombie = spawnHusks ? new EntityHuskMinion(world) : new EntityZombieMinion(world); zombie.setPosition(this.posX, this.posY, this.posZ); zombie.setCaster(this.getCaster()); @@ -76,12 +79,14 @@ public class EntityZombieSpawner extends EntityMagicConstruct { protected void writeEntityToNBT(NBTTagCompound nbt){ super.writeEntityToNBT(nbt); nbt.setInteger("spawnTimer", spawnTimer); + nbt.setBoolean("spawnHusks", spawnHusks); } @Override protected void readEntityFromNBT(NBTTagCompound nbt){ super.readEntityFromNBT(nbt); this.spawnTimer = nbt.getInteger("spawnTimer"); + this.spawnHusks = nbt.getBoolean("spawnHusks"); } } diff --git a/src/main/java/electroblob/wizardry/spell/ZombieApocalypse.java b/src/main/java/electroblob/wizardry/spell/ZombieApocalypse.java index a3d6acd4..86ba5b28 100644 --- a/src/main/java/electroblob/wizardry/spell/ZombieApocalypse.java +++ b/src/main/java/electroblob/wizardry/spell/ZombieApocalypse.java @@ -1,10 +1,12 @@ package electroblob.wizardry.spell; import electroblob.wizardry.entity.construct.EntityZombieSpawner; +import electroblob.wizardry.item.ItemArtefact; import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.registry.WizardryItems; import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; @@ -34,6 +36,11 @@ public class ZombieApocalypse extends SpellConstruct { return super.spawnConstruct(world, x, y, z, side, caster, modifiers); } + @Override + protected void addConstructExtras(EntityZombieSpawner construct, EnumFacing side, @Nullable EntityLivingBase caster, SpellModifiers modifiers){ + construct.spawnHusks = caster instanceof EntityPlayer && ItemArtefact.isArtefactActive((EntityPlayer)caster, WizardryItems.charm_minion_variants); + } + @Override protected void playSound(World world, double x, double y, double z, int ticksInUse, int duration, SpellModifiers modifiers, String... sounds){ this.playSoundLoop(world, x, y + SPAWNER_HEIGHT, z, 0, (int)(getProperty(DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)));