clean up particles
This commit is contained in:
parent
874e118d9d
commit
baa3f501b6
22 changed files with 75 additions and 154 deletions
|
@ -1006,7 +1006,7 @@ public abstract class Entity
|
|||
{
|
||||
float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width;
|
||||
float f3 = (this.rand.floatv() * 2.0F - 1.0F) * this.width;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_BUBBLE, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3, this.motionX, this.motionY - (double)(this.rand.floatv() * 0.2F), this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3, this.motionX, this.motionY - (double)(this.rand.floatv() * 0.2F), this.motionZ);
|
||||
}
|
||||
|
||||
if(this.worldObj.getState(new BlockPos(this.posX, this.posY, this.posZ)).getBlock().getMaterial() == Material.WATER) {
|
||||
|
@ -1014,7 +1014,7 @@ public abstract class Entity
|
|||
{
|
||||
float f4 = (this.rand.floatv() * 2.0F - 1.0F) * this.width;
|
||||
float f5 = (this.rand.floatv() * 2.0F - 1.0F) * this.width;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class EntityWolf extends EntityTameable
|
|||
{
|
||||
float f1 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F;
|
||||
float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,13 +279,13 @@ public class EntityBoat extends Entity
|
|||
{
|
||||
double d7 = this.posX - d2 * d5 * 0.8D + d4 * d6;
|
||||
double d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
double d24 = this.posX + d2 + d4 * d5 * 0.7D;
|
||||
double d25 = this.posZ + d4 - d2 * d5 * 0.7D;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, d24, this.posY - 0.125D, d25, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, d24, this.posY - 0.125D, d25, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4596,11 +4596,11 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.setHealth(this.getMaxHealth());
|
||||
this.setManaPoints(this.getMaxMana());
|
||||
this.clearEffects(false);
|
||||
this.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255, false, false));
|
||||
this.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255, false, false));
|
||||
this.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false));
|
||||
this.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1, false, false));
|
||||
this.addEffect(new PotionEffect(Potion.MANA_GENERATION, Integer.MAX_VALUE, 255, false, false));
|
||||
this.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
|
||||
this.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1));
|
||||
this.addEffect(new PotionEffect(Potion.MANA_GENERATION, Integer.MAX_VALUE, 255));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
|||
for (int i1 = 0; i1 < 4; ++i1)
|
||||
{
|
||||
float f8 = 0.25F;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_BUBBLE, this.posX - this.motionX * (double)f8, this.posY - this.motionY * (double)f8, this.posZ - this.motionZ * (double)f8, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f8, this.posY - this.motionY * (double)f8, this.posZ - this.motionZ * (double)f8, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f4 = 0.6F;
|
||||
|
|
|
@ -417,7 +417,7 @@ public class EntityHook extends Entity implements IObjectData
|
|||
this.motionY -= 0.20000000298023224D;
|
||||
this.playSound(SoundEvent.SPLASH, 0.25F);
|
||||
float f8 = (float)ExtMath.floord(this.getEntityBoundingBox().minY);
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0);
|
||||
worldserver.spawnParticle(ParticleType.SPLASH, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0);
|
||||
worldserver.spawnParticle(ParticleType.WATER_DROP, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0);
|
||||
this.ticksCatchable = this.rand.range(10, 30);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ public class EntityHook extends Entity implements IObjectData
|
|||
{
|
||||
if (this.rand.floatv() < 0.15F)
|
||||
{
|
||||
worldserver.spawnParticle(ParticleType.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D, 0);
|
||||
worldserver.spawnParticle(ParticleType.SPLASH, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D, 0);
|
||||
}
|
||||
|
||||
float f3 = f10 * 0.04F;
|
||||
|
@ -475,7 +475,7 @@ public class EntityHook extends Entity implements IObjectData
|
|||
|
||||
if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
{
|
||||
worldserver.spawnParticle(ParticleType.WATER_SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, 0);
|
||||
worldserver.spawnParticle(ParticleType.SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public abstract class EntityProjectile extends Entity
|
|||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
float f3 = 0.25F;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_BUBBLE, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
|
|
|
@ -274,7 +274,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
float f4 = 0.25F;
|
||||
this.worldObj.spawnParticle(ParticleType.WATER_BUBBLE, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
|
||||
this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
|
|
|
@ -6,8 +6,7 @@ public enum ParticleType implements Identifyable {
|
|||
EXPLOSION_NORMAL("explode", true),
|
||||
EXPLOSION_LARGE("explode_large", true),
|
||||
EXPLOSION_HUGE("explode_huge", true),
|
||||
WATER_BUBBLE("bubble"),
|
||||
WATER_SPLASH("splash"),
|
||||
SPLASH("splash"),
|
||||
DEPTH("depth"),
|
||||
CRIT("crit"),
|
||||
SMOKE("smoke"),
|
||||
|
@ -21,7 +20,7 @@ public enum ParticleType implements Identifyable {
|
|||
HEART("heart"),
|
||||
ITEM_CRACK("item_crack"),
|
||||
BLOCK_CRACK("block_crack"),
|
||||
WATER_DROP("droplet"),
|
||||
WATER_DROP("rain"),
|
||||
HAIL_CORN("hail");
|
||||
|
||||
private final String name;
|
||||
|
|
|
@ -15,7 +15,6 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
|
|||
private int amplifier;
|
||||
private int duration;
|
||||
private int remaining;
|
||||
private boolean particles;
|
||||
|
||||
public SPacketEntityEffect()
|
||||
{
|
||||
|
@ -36,8 +35,6 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
|
|||
this.duration = effect.getDuration();
|
||||
this.remaining = effect.getRemaining();
|
||||
// }
|
||||
|
||||
this.particles = effect.getIsShowParticles();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +47,6 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
|
|||
this.amplifier = buf.readVarInt();
|
||||
this.duration = buf.readVarInt();
|
||||
this.remaining = buf.readVarInt();
|
||||
this.particles = buf.readBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +59,6 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
|
|||
buf.writeVarInt(this.amplifier);
|
||||
buf.writeVarInt(this.duration);
|
||||
buf.writeVarInt(this.remaining);
|
||||
buf.writeBoolean(this.particles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,9 +93,4 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
|
|||
{
|
||||
return this.remaining;
|
||||
}
|
||||
|
||||
public boolean hasParticles()
|
||||
{
|
||||
return this.particles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,30 +8,20 @@ public class PotionEffect {
|
|||
private final Potion potion;
|
||||
private final int duration;
|
||||
private final int amplifier;
|
||||
private final boolean ambient;
|
||||
private final boolean particles;
|
||||
|
||||
private int remaining;
|
||||
private boolean thrown;
|
||||
|
||||
public PotionEffect(Potion id, int duration, int amplifier) {
|
||||
this(id, duration, amplifier, false, true);
|
||||
}
|
||||
|
||||
public PotionEffect(Potion id, int duration, int amplifier, boolean ambient, boolean showParticles) {
|
||||
public PotionEffect(Potion id, int duration, int amplifier) {
|
||||
this.potion = id;
|
||||
this.duration = this.remaining = duration;
|
||||
this.amplifier = amplifier;
|
||||
this.ambient = ambient;
|
||||
this.particles = showParticles;
|
||||
}
|
||||
|
||||
public PotionEffect(PotionEffect other) {
|
||||
this.potion = other.potion;
|
||||
this.duration = this.remaining = other.duration;
|
||||
this.amplifier = other.amplifier;
|
||||
this.ambient = other.ambient;
|
||||
this.particles = other.particles;
|
||||
}
|
||||
|
||||
public PotionEffect combine(PotionEffect other) {
|
||||
|
@ -40,7 +30,6 @@ public class PotionEffect {
|
|||
int duration = this.duration;
|
||||
int amplifier = this.amplifier;
|
||||
int remaining = this.remaining;
|
||||
boolean ambient = this.ambient;
|
||||
if(other.amplifier > this.amplifier) {
|
||||
amplifier = other.amplifier;
|
||||
duration = other.duration;
|
||||
|
@ -50,10 +39,7 @@ public class PotionEffect {
|
|||
duration = other.duration;
|
||||
remaining = other.remaining;
|
||||
}
|
||||
else if(!other.ambient && this.ambient) {
|
||||
ambient = other.ambient;
|
||||
}
|
||||
return new PotionEffect(this.potion, duration, amplifier, ambient, other.particles).setRemaining(remaining);
|
||||
return new PotionEffect(this.potion, duration, amplifier).setRemaining(remaining);
|
||||
}
|
||||
|
||||
public Potion getPotion() {
|
||||
|
@ -86,14 +72,6 @@ public class PotionEffect {
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isAmbient() {
|
||||
return this.ambient;
|
||||
}
|
||||
|
||||
public boolean getIsShowParticles() {
|
||||
return this.particles;
|
||||
}
|
||||
|
||||
public boolean onUpdate(EntityLiving entityIn) {
|
||||
if(this.isInfinite() && this.remaining < 20 * 60)
|
||||
this.remaining = Integer.MAX_VALUE;
|
||||
|
@ -132,7 +110,7 @@ public class PotionEffect {
|
|||
return false;
|
||||
PotionEffect other = (PotionEffect)obj;
|
||||
return this.potion == other.potion && this.amplifier == other.amplifier && this.duration == other.duration
|
||||
&& this.thrown == other.thrown && this.remaining == other.remaining && this.ambient == other.ambient;
|
||||
&& this.thrown == other.thrown && this.remaining == other.remaining;
|
||||
}
|
||||
|
||||
public TagObject toTags() {
|
||||
|
@ -141,14 +119,12 @@ public class PotionEffect {
|
|||
tag.setByte("Amplifier", (byte)this.amplifier);
|
||||
tag.setInt("Duration", this.duration);
|
||||
tag.setInt("Remaining", this.remaining);
|
||||
tag.setBool("Ambient", this.ambient);
|
||||
tag.setBool("Particles", this.particles);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static PotionEffect fromTags(TagObject tag) {
|
||||
Potion potion = Potion.getByName(tag.getString("Type"));
|
||||
return potion == null ? null : new PotionEffect(potion, tag.getInt("Duration"), (int)(tag.getByte("Amplifier") & 255), tag.getBool("Ambient"), tag.getBool("Particles"))
|
||||
return potion == null ? null : new PotionEffect(potion, tag.getInt("Duration"), (int)(tag.getByte("Amplifier") & 255))
|
||||
.setRemaining(tag.getInt("Remaining"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,30 +81,27 @@ public class PotionHelper
|
|||
/**
|
||||
* Given a {@link Collection}<{@link PotionEffect}> will return an Integer color.
|
||||
*/
|
||||
public static int calcPotionLiquidColor(Collection<PotionEffect> p_77911_0_)
|
||||
public static int calcPotionLiquidColor(Collection<PotionEffect> effects)
|
||||
{
|
||||
int i = 3694022;
|
||||
|
||||
if (p_77911_0_ != null && !p_77911_0_.isEmpty())
|
||||
if (effects != null && !effects.isEmpty())
|
||||
{
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
float f2 = 0.0F;
|
||||
float f3 = 0.0F;
|
||||
|
||||
for (PotionEffect potioneffect : p_77911_0_)
|
||||
for (PotionEffect potioneffect : effects)
|
||||
{
|
||||
if (potioneffect.getIsShowParticles())
|
||||
{
|
||||
int j = potioneffect.getPotion().getColor();
|
||||
int j = potioneffect.getPotion().getColor();
|
||||
|
||||
for (int k = 0; k <= potioneffect.getAmplifier(); ++k)
|
||||
{
|
||||
f += (float)(j >> 16 & 255) / 255.0F;
|
||||
f1 += (float)(j >> 8 & 255) / 255.0F;
|
||||
f2 += (float)(j >> 0 & 255) / 255.0F;
|
||||
++f3;
|
||||
}
|
||||
for (int k = 0; k <= potioneffect.getAmplifier(); ++k)
|
||||
{
|
||||
f += (float)(j >> 16 & 255) / 255.0F;
|
||||
f1 += (float)(j >> 8 & 255) / 255.0F;
|
||||
f2 += (float)(j >> 0 & 255) / 255.0F;
|
||||
++f3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,22 +122,6 @@ public class PotionHelper
|
|||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a {@link Collection}<{@link PotionEffect}> are all ambient.
|
||||
*/
|
||||
public static boolean getAreAmbient(Collection<PotionEffect> potionEffects)
|
||||
{
|
||||
for (PotionEffect potioneffect : potionEffects)
|
||||
{
|
||||
if (!potioneffect.isAmbient())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getLiquidColor(int meta)
|
||||
{
|
||||
|
|
|
@ -68,14 +68,14 @@ public class TileEntityBeacon extends TileEntity implements ITickable
|
|||
|
||||
for (EntityLiving entityplayer : list)
|
||||
{
|
||||
entityplayer.addEffect(new PotionEffect(this.primaryEffect, 180, i, true, true));
|
||||
entityplayer.addEffect(new PotionEffect(this.primaryEffect, 180, i));
|
||||
}
|
||||
|
||||
if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect != null)
|
||||
{
|
||||
for (EntityLiving entityplayer1 : list)
|
||||
{
|
||||
entityplayer1.addEffect(new PotionEffect(this.secondaryEffect, 180, 0, true, true));
|
||||
entityplayer1.addEffect(new PotionEffect(this.secondaryEffect, 180, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue