Hide zombie particles properly
This commit is contained in:
@@ -38,7 +38,7 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
|
||||
damageMultiplier - 1, Operations.MULTIPLY_CUMULATIVE));
|
||||
zombie.setHealth(zombie.getMaxHealth()); // Need to set this because we may have just modified the value
|
||||
zombie.hurtResistantTime = 30; // Prevent fall damage
|
||||
zombie.showSpawnParticles = false; // Hide spawn particles or they pop out the top of the hidden box
|
||||
zombie.hideParticles(); // Hide spawn particles or they pop out the top of the hidden box
|
||||
|
||||
world.spawnEntity(zombie);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -24,7 +27,7 @@ import java.util.UUID;
|
||||
|
||||
public class EntityZombieMinion extends EntityZombie implements ISummonedCreature {
|
||||
|
||||
public boolean showSpawnParticles = true;
|
||||
private static final DataParameter<Boolean> SPAWN_PARTICLES = EntityDataManager.createKey(EntityZombieMinion.class, DataSerializers.BOOLEAN);
|
||||
|
||||
// Field implementations
|
||||
private int lifetime = -1;
|
||||
@@ -42,6 +45,12 @@ public class EntityZombieMinion extends EntityZombie implements ISummonedCreatur
|
||||
this.experienceValue = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
super.entityInit();
|
||||
this.dataManager.register(SPAWN_PARTICLES, true);
|
||||
}
|
||||
|
||||
// EntityZombie overrides (EntityZombie is a complex class so there are lots of these)
|
||||
|
||||
@Override
|
||||
@@ -74,7 +83,7 @@ public class EntityZombieMinion extends EntityZombie implements ISummonedCreatur
|
||||
|
||||
@Override
|
||||
public void onSpawn(){
|
||||
if(showSpawnParticles) this.spawnParticleEffect();
|
||||
if(this.dataManager.get(SPAWN_PARTICLES)) this.spawnParticleEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,6 +105,10 @@ public class EntityZombieMinion extends EntityZombie implements ISummonedCreatur
|
||||
return true;
|
||||
}
|
||||
|
||||
public void hideParticles(){
|
||||
this.dataManager.set(SPAWN_PARTICLES, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand){
|
||||
// In this case, the delegate method determines whether super is called.
|
||||
|
||||
Reference in New Issue
Block a user