More tweaks

This commit is contained in:
Electroblob77
2020-05-31 19:03:24 +01:00
parent 4ef54cf8cb
commit 0cd61b758e
2 changed files with 22 additions and 5 deletions
@@ -11,10 +11,13 @@ import electroblob.wizardry.util.WizardryUtilities.Operations;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
public class EntityZombieSpawner extends EntityMagicConstruct { public class EntityZombieSpawner extends EntityMagicConstruct {
private int spawnTimer = 10;
public EntityZombieSpawner(World world){ public EntityZombieSpawner(World world){
super(world); super(world);
this.setSize(4, 2); this.setSize(4, 2);
@@ -25,12 +28,11 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
super.onUpdate(); super.onUpdate();
if(lifetime - ticksExisted > 10 && rand.nextInt(Spells.zombie_apocalypse.getProperty(ZombieApocalypse.MINION_SPAWN_INTERVAL).intValue()) == 0){ if(lifetime - ticksExisted > 10 && spawnTimer-- == 0){
if(world.isRemote){ this.playSound(WizardrySounds.ENTITY_ZOMBIE_SPAWNER_SPAWN, 1, 1);
this.playSound(WizardrySounds.ENTITY_ZOMBIE_SPAWNER_SPAWN, 1, 1);
}else{ if(!world.isRemote){
EntityZombieMinion zombie = new EntityZombieMinion(world); EntityZombieMinion zombie = new EntityZombieMinion(world);
@@ -48,6 +50,8 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
world.spawnEntity(zombie); world.spawnEntity(zombie);
} }
spawnTimer += Spells.zombie_apocalypse.getProperty(ZombieApocalypse.MINION_SPAWN_INTERVAL).intValue() + rand.nextInt(20);
} }
if(world.isRemote){ if(world.isRemote){
@@ -67,4 +71,17 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
public boolean shouldRenderInPass(int pass){ public boolean shouldRenderInPass(int pass){
return super.shouldRenderInPass(pass); return super.shouldRenderInPass(pass);
} }
@Override
protected void writeEntityToNBT(NBTTagCompound nbt){
super.writeEntityToNBT(nbt);
nbt.setInteger("spawnTimer", spawnTimer);
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbt){
super.readEntityFromNBT(nbt);
this.spawnTimer = nbt.getInteger("spawnTimer");
}
} }
@@ -19,6 +19,6 @@
"base_properties": { "base_properties": {
"duration": 500, "duration": 500,
"minion_lifetime": 600, "minion_lifetime": 600,
"minion_spawn_interval": 30 "minion_spawn_interval": 20
} }
} }