base mod created

This commit is contained in:
Mohammad-Ali Minaie
2018-10-08 09:07:47 -04:00
parent 0a7700c356
commit b86dedad2f
7848 changed files with 584664 additions and 1 deletions

View File

@@ -0,0 +1,68 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class Barrier extends Particle
{
protected Barrier(World worldIn, double p_i46286_2_, double p_i46286_4_, double p_i46286_6_, Item p_i46286_8_)
{
super(worldIn, p_i46286_2_, p_i46286_4_, p_i46286_6_, 0.0D, 0.0D, 0.0D);
this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(p_i46286_8_));
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.particleGravity = 0.0F;
this.particleMaxAge = 80;
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 1;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = this.particleTexture.getMinU();
float f1 = this.particleTexture.getMaxU();
float f2 = this.particleTexture.getMinV();
float f3 = this.particleTexture.getMaxV();
float f4 = 0.5F;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
buffer.pos((double)(f5 - rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 - rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new Barrier(worldIn, xCoordIn, yCoordIn, zCoordIn, Item.getItemFromBlock(Blocks.BARRIER));
}
}
}

View File

@@ -0,0 +1,13 @@
package net.minecraft.client.particle;
import javax.annotation.Nullable;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IParticleFactory
{
@Nullable
Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_);
}

View File

@@ -0,0 +1,390 @@
package net.minecraft.client.particle;
import java.util.List;
import java.util.Random;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class Particle
{
private static final AxisAlignedBB EMPTY_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
protected World world;
protected double prevPosX;
protected double prevPosY;
protected double prevPosZ;
protected double posX;
protected double posY;
protected double posZ;
protected double motionX;
protected double motionY;
protected double motionZ;
private AxisAlignedBB boundingBox;
protected boolean onGround;
/** Determines if particle to block collision is to be used */
protected boolean canCollide;
protected boolean isExpired;
protected float width;
protected float height;
protected Random rand;
protected int particleTextureIndexX;
protected int particleTextureIndexY;
protected float particleTextureJitterX;
protected float particleTextureJitterY;
protected int particleAge;
protected int particleMaxAge;
protected float particleScale;
protected float particleGravity;
/** The red amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */
protected float particleRed;
/** The green amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */
protected float particleGreen;
/** The blue amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */
protected float particleBlue;
/** Particle alpha */
protected float particleAlpha;
protected TextureAtlasSprite particleTexture;
/** The amount the particle will be rotated in rendering. */
protected float particleAngle;
/** The particle angle from the last tick. Appears to be used for calculating the rendered angle with partial ticks. */
protected float prevParticleAngle;
public static double interpPosX;
public static double interpPosY;
public static double interpPosZ;
public static Vec3d cameraViewDir;
protected Particle(World worldIn, double posXIn, double posYIn, double posZIn)
{
this.boundingBox = EMPTY_AABB;
this.width = 0.6F;
this.height = 1.8F;
this.rand = new Random();
this.particleAlpha = 1.0F;
this.world = worldIn;
this.setSize(0.2F, 0.2F);
this.setPosition(posXIn, posYIn, posZIn);
this.prevPosX = posXIn;
this.prevPosY = posYIn;
this.prevPosZ = posZIn;
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleTextureJitterX = this.rand.nextFloat() * 3.0F;
this.particleTextureJitterY = this.rand.nextFloat() * 3.0F;
this.particleScale = (this.rand.nextFloat() * 0.5F + 0.5F) * 2.0F;
this.particleMaxAge = (int)(4.0F / (this.rand.nextFloat() * 0.9F + 0.1F));
this.particleAge = 0;
this.canCollide = true;
}
public Particle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn);
this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
float f = (float)(Math.random() + Math.random() + 1.0D) * 0.15F;
float f1 = MathHelper.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.motionX = this.motionX / (double)f1 * (double)f * 0.4000000059604645D;
this.motionY = this.motionY / (double)f1 * (double)f * 0.4000000059604645D + 0.10000000149011612D;
this.motionZ = this.motionZ / (double)f1 * (double)f * 0.4000000059604645D;
}
public Particle multiplyVelocity(float multiplier)
{
this.motionX *= (double)multiplier;
this.motionY = (this.motionY - 0.10000000149011612D) * (double)multiplier + 0.10000000149011612D;
this.motionZ *= (double)multiplier;
return this;
}
public Particle multipleParticleScaleBy(float scale)
{
this.setSize(0.2F * scale, 0.2F * scale);
this.particleScale *= scale;
return this;
}
public void setRBGColorF(float particleRedIn, float particleGreenIn, float particleBlueIn)
{
this.particleRed = particleRedIn;
this.particleGreen = particleGreenIn;
this.particleBlue = particleBlueIn;
}
/**
* Sets the particle alpha (float)
*/
public void setAlphaF(float alpha)
{
this.particleAlpha = alpha;
}
public boolean shouldDisableDepth()
{
return false;
}
public float getRedColorF()
{
return this.particleRed;
}
public float getGreenColorF()
{
return this.particleGreen;
}
public float getBlueColorF()
{
return this.particleBlue;
}
public void setMaxAge(int p_187114_1_)
{
this.particleMaxAge = p_187114_1_;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = (float)this.particleTextureIndexX / 16.0F;
float f1 = f + 0.0624375F;
float f2 = (float)this.particleTextureIndexY / 16.0F;
float f3 = f2 + 0.0624375F;
float f4 = 0.1F * this.particleScale;
if (this.particleTexture != null)
{
f = this.particleTexture.getMinU();
f1 = this.particleTexture.getMaxU();
f2 = this.particleTexture.getMinV();
f3 = this.particleTexture.getMaxV();
}
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
Vec3d[] avec3d = new Vec3d[] {new Vec3d((double)(-rotationX * f4 - rotationXY * f4), (double)(-rotationZ * f4), (double)(-rotationYZ * f4 - rotationXZ * f4)), new Vec3d((double)(-rotationX * f4 + rotationXY * f4), (double)(rotationZ * f4), (double)(-rotationYZ * f4 + rotationXZ * f4)), new Vec3d((double)(rotationX * f4 + rotationXY * f4), (double)(rotationZ * f4), (double)(rotationYZ * f4 + rotationXZ * f4)), new Vec3d((double)(rotationX * f4 - rotationXY * f4), (double)(-rotationZ * f4), (double)(rotationYZ * f4 - rotationXZ * f4))};
if (this.particleAngle != 0.0F)
{
float f8 = this.particleAngle + (this.particleAngle - this.prevParticleAngle) * partialTicks;
float f9 = MathHelper.cos(f8 * 0.5F);
float f10 = MathHelper.sin(f8 * 0.5F) * (float)cameraViewDir.x;
float f11 = MathHelper.sin(f8 * 0.5F) * (float)cameraViewDir.y;
float f12 = MathHelper.sin(f8 * 0.5F) * (float)cameraViewDir.z;
Vec3d vec3d = new Vec3d((double)f10, (double)f11, (double)f12);
for (int l = 0; l < 4; ++l)
{
avec3d[l] = vec3d.scale(2.0D * avec3d[l].dotProduct(vec3d)).add(avec3d[l].scale((double)(f9 * f9) - vec3d.dotProduct(vec3d))).add(vec3d.crossProduct(avec3d[l]).scale((double)(2.0F * f9)));
}
}
buffer.pos((double)f5 + avec3d[0].x, (double)f6 + avec3d[0].y, (double)f7 + avec3d[0].z).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)f5 + avec3d[1].x, (double)f6 + avec3d[1].y, (double)f7 + avec3d[1].z).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)f5 + avec3d[2].x, (double)f6 + avec3d[2].y, (double)f7 + avec3d[2].z).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)f5 + avec3d[3].x, (double)f6 + avec3d[3].y, (double)f7 + avec3d[3].z).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 0;
}
/**
* Sets the texture used by the particle.
*/
public void setParticleTexture(TextureAtlasSprite texture)
{
int i = this.getFXLayer();
if (i == 1)
{
this.particleTexture = texture;
}
else
{
throw new RuntimeException("Invalid call to Particle.setTex, use coordinate methods");
}
}
/**
* Public method to set private field particleTextureIndex.
*/
public void setParticleTextureIndex(int particleTextureIndex)
{
if (this.getFXLayer() != 0)
{
throw new RuntimeException("Invalid call to Particle.setMiscTex");
}
else
{
this.particleTextureIndexX = particleTextureIndex % 16;
this.particleTextureIndexY = particleTextureIndex / 16;
}
}
public void nextTextureIndexX()
{
++this.particleTextureIndexX;
}
public String toString()
{
return this.getClass().getSimpleName() + ", Pos (" + this.posX + "," + this.posY + "," + this.posZ + "), RGBA (" + this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha + "), Age " + this.particleAge;
}
/**
* Called to indicate that this particle effect has expired and should be discontinued.
*/
public void setExpired()
{
this.isExpired = true;
}
protected void setSize(float p_187115_1_, float p_187115_2_)
{
if (p_187115_1_ != this.width || p_187115_2_ != this.height)
{
this.width = p_187115_1_;
this.height = p_187115_2_;
// FORGE: Fix MC-12269 - Glitchy movement when setSize is called without setPosition
setPosition(posX, posY, posZ);
}
}
public void setPosition(double p_187109_1_, double p_187109_3_, double p_187109_5_)
{
this.posX = p_187109_1_;
this.posY = p_187109_3_;
this.posZ = p_187109_5_;
float f = this.width / 2.0F;
float f1 = this.height;
this.setBoundingBox(new AxisAlignedBB(p_187109_1_ - (double)f, p_187109_3_, p_187109_5_ - (double)f, p_187109_1_ + (double)f, p_187109_3_ + (double)f1, p_187109_5_ + (double)f));
}
public void move(double x, double y, double z)
{
double d0 = y;
double origX = x;
double origZ = z;
if (this.canCollide)
{
List<AxisAlignedBB> list = this.world.getCollisionBoxes((Entity)null, this.getBoundingBox().expand(x, y, z));
for (AxisAlignedBB axisalignedbb : list)
{
y = axisalignedbb.calculateYOffset(this.getBoundingBox(), y);
}
this.setBoundingBox(this.getBoundingBox().offset(0.0D, y, 0.0D));
for (AxisAlignedBB axisalignedbb1 : list)
{
x = axisalignedbb1.calculateXOffset(this.getBoundingBox(), x);
}
this.setBoundingBox(this.getBoundingBox().offset(x, 0.0D, 0.0D));
for (AxisAlignedBB axisalignedbb2 : list)
{
z = axisalignedbb2.calculateZOffset(this.getBoundingBox(), z);
}
this.setBoundingBox(this.getBoundingBox().offset(0.0D, 0.0D, z));
}
else
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
}
this.resetPositionToBB();
this.onGround = d0 != y && d0 < 0.0D;
if (origX != x)
{
this.motionX = 0.0D;
}
if (origZ != z)
{
this.motionZ = 0.0D;
}
}
protected void resetPositionToBB()
{
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.posX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
this.posY = axisalignedbb.minY;
this.posZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
}
public int getBrightnessForRender(float p_189214_1_)
{
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
return this.world.isBlockLoaded(blockpos) ? this.world.getCombinedLight(blockpos, 0) : 0;
}
/**
* Returns true if this effect has not yet expired. "I feel happy! I feel happy!"
*/
public boolean isAlive()
{
return !this.isExpired;
}
public AxisAlignedBB getBoundingBox()
{
return this.boundingBox;
}
public void setBoundingBox(AxisAlignedBB bb)
{
this.boundingBox = bb;
}
}

View File

@@ -0,0 +1,32 @@
package net.minecraft.client.particle;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleBlockDust extends ParticleDigging
{
protected ParticleBlockDust(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
@Nullable
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
return iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE ? null : (new ParticleBlockDust(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).init();
}
}
}

View File

@@ -0,0 +1,110 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleBreaking extends Particle
{
protected ParticleBreaking(World worldIn, double posXIn, double posYIn, double posZIn, Item itemIn)
{
this(worldIn, posXIn, posYIn, posZIn, itemIn, 0);
}
protected ParticleBreaking(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item itemIn, int meta)
{
this(worldIn, posXIn, posYIn, posZIn, itemIn, meta);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeedIn;
this.motionY += ySpeedIn;
this.motionZ += zSpeedIn;
}
protected ParticleBreaking(World worldIn, double posXIn, double posYIn, double posZIn, Item itemIn, int meta)
{
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
this.setParticleTexture(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(itemIn, meta));
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleGravity = Blocks.SNOW.blockParticleGravity;
this.particleScale /= 2.0F;
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 1;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
float f1 = f + 0.015609375F;
float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
float f3 = f2 + 0.015609375F;
float f4 = 0.1F * this.particleScale;
if (this.particleTexture != null)
{
f = this.particleTexture.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
f1 = this.particleTexture.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
f2 = this.particleTexture.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
f3 = this.particleTexture.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
}
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
buffer.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
return new ParticleBreaking(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
}
}
@SideOnly(Side.CLIENT)
public static class SlimeFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleBreaking(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.SLIME_BALL);
}
}
@SideOnly(Side.CLIENT)
public static class SnowballFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleBreaking(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.SNOWBALL);
}
}
}

View File

@@ -0,0 +1,57 @@
package net.minecraft.client.particle;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleBubble extends Particle
{
protected ParticleBubble(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(32);
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
this.motionX = xSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionY = ySpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionZ = zSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY += 0.002D;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8500000238418579D;
this.motionY *= 0.8500000238418579D;
this.motionZ *= 0.8500000238418579D;
if (this.world.getBlockState(new BlockPos(this.posX, this.posY, this.posZ)).getMaterial() != Material.WATER)
{
this.setExpired();
}
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleBubble(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,94 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleCloud extends Particle
{
float oSize;
protected ParticleCloud(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1221_8_, double p_i1221_10_, double p_i1221_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
float f = 2.5F;
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i1221_8_;
this.motionY += p_i1221_10_;
this.motionZ += p_i1221_12_;
float f1 = 1.0F - (float)(Math.random() * 0.30000001192092896D);
this.particleRed = f1;
this.particleGreen = f1;
this.particleBlue = f1;
this.particleScale *= 0.75F;
this.particleScale *= 2.5F;
this.oSize = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D));
this.particleMaxAge = (int)((float)this.particleMaxAge * 2.5F);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.oSize * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
EntityPlayer entityplayer = this.world.getClosestPlayer(this.posX, this.posY, this.posZ, 2.0D, false);
if (entityplayer != null)
{
AxisAlignedBB axisalignedbb = entityplayer.getEntityBoundingBox();
if (this.posY > axisalignedbb.minY)
{
this.posY += (axisalignedbb.minY - this.posY) * 0.2D;
this.motionY += (entityplayer.motionY - this.motionY) * 0.2D;
this.setPosition(this.posX, this.posY, this.posZ);
}
}
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleCloud(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,111 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleCrit extends Particle
{
float oSize;
protected ParticleCrit(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46284_8_, double p_i46284_10_, double p_i46284_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46284_8_, p_i46284_10_, p_i46284_12_, 1.0F);
}
protected ParticleCrit(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46285_8_, double p_i46285_10_, double p_i46285_12_, float p_i46285_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i46285_8_ * 0.4D;
this.motionY += p_i46285_10_ * 0.4D;
this.motionZ += p_i46285_12_ * 0.4D;
float f = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.particleScale *= 0.75F;
this.particleScale *= p_i46285_14_;
this.oSize = this.particleScale;
this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46285_14_);
this.setParticleTextureIndex(65);
this.onUpdate();
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.oSize * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.move(this.motionX, this.motionY, this.motionZ);
this.particleGreen = (float)((double)this.particleGreen * 0.96D);
this.particleBlue = (float)((double)this.particleBlue * 0.9D);
this.motionX *= 0.699999988079071D;
this.motionY *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY -= 0.019999999552965164D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class DamageIndicatorFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleCrit(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn + 1.0D, zSpeedIn, 1.0F);
particle.setMaxAge(20);
particle.setParticleTextureIndex(67);
return particle;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleCrit(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
@SideOnly(Side.CLIENT)
public static class MagicFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleCrit(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
particle.setRBGColorF(particle.getRedColorF() * 0.3F, particle.getGreenColorF() * 0.8F, particle.getBlueColorF());
particle.nextTextureIndexX();
return particle;
}
}
}

View File

@@ -0,0 +1,136 @@
package net.minecraft.client.particle;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleDigging extends Particle
{
private final IBlockState sourceState;
private BlockPos sourcePos;
protected ParticleDigging(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.sourceState = state;
this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state));
this.particleGravity = state.getBlock().blockParticleGravity;
this.particleRed = 0.6F;
this.particleGreen = 0.6F;
this.particleBlue = 0.6F;
this.particleScale /= 2.0F;
}
/**
* Sets the position of the block that this particle came from. Used for calculating texture and color multiplier.
*/
public ParticleDigging setBlockPos(BlockPos pos)
{
this.sourcePos = pos;
if (this.sourceState.getBlock() == Blocks.GRASS)
{
return this;
}
else
{
this.multiplyColor(pos);
return this;
}
}
public ParticleDigging init()
{
this.sourcePos = new BlockPos(this.posX, this.posY, this.posZ);
Block block = this.sourceState.getBlock();
if (block == Blocks.GRASS)
{
return this;
}
else
{
this.multiplyColor(this.sourcePos);
return this;
}
}
protected void multiplyColor(@Nullable BlockPos p_187154_1_)
{
int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(this.sourceState, this.world, p_187154_1_, 0);
this.particleRed *= (float)(i >> 16 & 255) / 255.0F;
this.particleGreen *= (float)(i >> 8 & 255) / 255.0F;
this.particleBlue *= (float)(i & 255) / 255.0F;
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 1;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
float f1 = f + 0.015609375F;
float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
float f3 = f2 + 0.015609375F;
float f4 = 0.1F * this.particleScale;
if (this.particleTexture != null)
{
f = this.particleTexture.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
f1 = this.particleTexture.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
f2 = this.particleTexture.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
f3 = this.particleTexture.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
}
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
buffer.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
public int getBrightnessForRender(float p_189214_1_)
{
int i = super.getBrightnessForRender(p_189214_1_);
int j = 0;
if (this.world.isBlockLoaded(this.sourcePos))
{
j = this.world.getCombinedLight(this.sourcePos, 0);
}
return i == 0 ? j : i;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return (new ParticleDigging(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Block.getStateById(p_178902_15_[0]))).init();
}
}
}

View File

@@ -0,0 +1,91 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleDragonBreath extends Particle
{
private final float oSize;
private boolean hasHitGround;
protected ParticleDragonBreath(World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed)
{
super(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
this.motionX = xSpeed;
this.motionY = ySpeed;
this.motionZ = zSpeed;
this.particleRed = MathHelper.nextFloat(this.rand, 0.7176471F, 0.8745098F);
this.particleGreen = MathHelper.nextFloat(this.rand, 0.0F, 0.0F);
this.particleBlue = MathHelper.nextFloat(this.rand, 0.8235294F, 0.9764706F);
this.particleScale *= 0.75F;
this.oSize = this.particleScale;
this.particleMaxAge = (int)(20.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D));
this.hasHitGround = false;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
else
{
this.setParticleTextureIndex(3 * this.particleAge / this.particleMaxAge + 5);
if (this.onGround)
{
this.motionY = 0.0D;
this.hasHitGround = true;
}
if (this.hasHitGround)
{
this.motionY += 0.002D;
}
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.hasHitGround)
{
this.motionY *= 0.9599999785423279D;
}
}
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
this.particleScale = this.oSize * MathHelper.clamp(((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F, 0.0F, 1.0F);
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleDragonBreath(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,155 @@
package net.minecraft.client.particle;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleDrip extends Particle
{
/** the material type for dropped items/blocks */
private final Material materialType;
/** The height of the current bob */
private int bobTimer;
protected ParticleDrip(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, Material p_i1203_8_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
if (p_i1203_8_ == Material.WATER)
{
this.particleRed = 0.0F;
this.particleGreen = 0.0F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 0.0F;
this.particleBlue = 0.0F;
}
this.setParticleTextureIndex(113);
this.setSize(0.01F, 0.01F);
this.particleGravity = 0.06F;
this.materialType = p_i1203_8_;
this.bobTimer = 40;
this.particleMaxAge = (int)(64.0D / (Math.random() * 0.8D + 0.2D));
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
}
public int getBrightnessForRender(float p_189214_1_)
{
return this.materialType == Material.WATER ? super.getBrightnessForRender(p_189214_1_) : 257;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.materialType == Material.WATER)
{
this.particleRed = 0.2F;
this.particleGreen = 0.3F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8);
}
this.motionY -= (double)this.particleGravity;
if (this.bobTimer-- > 0)
{
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
this.setParticleTextureIndex(113);
}
else
{
this.setParticleTextureIndex(112);
}
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
if (this.onGround)
{
if (this.materialType == Material.WATER)
{
this.setExpired();
this.world.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
else
{
this.setParticleTextureIndex(114);
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Material material = iblockstate.getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue());
}
double d1 = (double)(MathHelper.floor(this.posY) + 1) - d0;
if (this.posY < d1)
{
this.setExpired();
}
}
}
@SideOnly(Side.CLIENT)
public static class LavaFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleDrip(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.LAVA);
}
}
@SideOnly(Side.CLIENT)
public static class WaterFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleDrip(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.WATER);
}
}
}

View File

@@ -0,0 +1,72 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleEmitter extends Particle
{
private final Entity attachedEntity;
private int age;
private final int lifetime;
private final EnumParticleTypes particleTypes;
public ParticleEmitter(World worldIn, Entity p_i46279_2_, EnumParticleTypes particleTypesIn)
{
this(worldIn, p_i46279_2_, particleTypesIn, 3);
}
public ParticleEmitter(World p_i47219_1_, Entity p_i47219_2_, EnumParticleTypes p_i47219_3_, int p_i47219_4_)
{
super(p_i47219_1_, p_i47219_2_.posX, p_i47219_2_.getEntityBoundingBox().minY + (double)(p_i47219_2_.height / 2.0F), p_i47219_2_.posZ, p_i47219_2_.motionX, p_i47219_2_.motionY, p_i47219_2_.motionZ);
this.attachedEntity = p_i47219_2_;
this.lifetime = p_i47219_4_;
this.particleTypes = p_i47219_3_;
this.onUpdate();
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
}
public void onUpdate()
{
for (int i = 0; i < 16; ++i)
{
double d0 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
double d1 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
double d2 = (double)(this.rand.nextFloat() * 2.0F - 1.0F);
if (d0 * d0 + d1 * d1 + d2 * d2 <= 1.0D)
{
double d3 = this.attachedEntity.posX + d0 * (double)this.attachedEntity.width / 4.0D;
double d4 = this.attachedEntity.getEntityBoundingBox().minY + (double)(this.attachedEntity.height / 2.0F) + d1 * (double)this.attachedEntity.height / 4.0D;
double d5 = this.attachedEntity.posZ + d2 * (double)this.attachedEntity.width / 4.0D;
this.world.spawnParticle(this.particleTypes, false, d3, d4, d5, d0, d1 + 0.2D, d2);
}
}
++this.age;
if (this.age >= this.lifetime)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
}

View File

@@ -0,0 +1,92 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleEnchantmentTable extends Particle
{
private final float oSize;
private final double coordX;
private final double coordY;
private final double coordZ;
protected ParticleEnchantmentTable(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
this.coordX = xCoordIn;
this.coordY = yCoordIn;
this.coordZ = zCoordIn;
this.prevPosX = xCoordIn + xSpeedIn;
this.prevPosY = yCoordIn + ySpeedIn;
this.prevPosZ = zCoordIn + zSpeedIn;
this.posX = this.prevPosX;
this.posY = this.prevPosY;
this.posZ = this.prevPosZ;
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F;
this.oSize = this.particleScale;
this.particleRed = 0.9F * f;
this.particleGreen = 0.9F * f;
this.particleBlue = f;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 30;
this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D));
}
public void move(double x, double y, double z)
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
public int getBrightnessForRender(float p_189214_1_)
{
int i = super.getBrightnessForRender(p_189214_1_);
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = f * f;
f = f * f;
int j = i & 255;
int k = i >> 16 & 255;
k = k + (int)(f * 15.0F * 16.0F);
if (k > 240)
{
k = 240;
}
return j | k << 16;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = 1.0F - f;
float f1 = 1.0F - f;
f1 = f1 * f1;
f1 = f1 * f1;
this.posX = this.coordX + this.motionX * (double)f;
this.posY = this.coordY + this.motionY * (double)f - (double)(f1 * 1.2F);
this.posZ = this.coordZ + this.motionZ * (double)f;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class EnchantmentTable implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleEnchantmentTable(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,35 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleEndRod extends ParticleSimpleAnimated
{
public ParticleEndRod(World p_i46580_1_, double p_i46580_2_, double p_i46580_4_, double p_i46580_6_, double p_i46580_8_, double p_i46580_10_, double p_i46580_12_)
{
super(p_i46580_1_, p_i46580_2_, p_i46580_4_, p_i46580_6_, 176, 8, -5.0E-4F);
this.motionX = p_i46580_8_;
this.motionY = p_i46580_10_;
this.motionZ = p_i46580_12_;
this.particleScale *= 0.75F;
this.particleMaxAge = 60 + this.rand.nextInt(12);
this.setColorFade(15916745);
}
public void move(double x, double y, double z)
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleEndRod(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,57 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleExplosion extends Particle
{
protected ParticleExplosion(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
float f = this.rand.nextFloat() * 0.3F + 0.7F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY += 0.004D;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8999999761581421D;
this.motionY *= 0.8999999761581421D;
this.motionZ *= 0.8999999761581421D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleExplosion(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,64 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleExplosionHuge extends Particle
{
private int timeSinceStart;
/** the maximum time for the explosion */
private final int maximumTime = 8;
protected ParticleExplosionHuge(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1214_8_, double p_i1214_10_, double p_i1214_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
}
public void onUpdate()
{
for (int i = 0; i < 6; ++i)
{
double d0 = this.posX + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D;
double d1 = this.posY + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D;
double d2 = this.posZ + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D;
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, (double)((float)this.timeSinceStart / (float)this.maximumTime), 0.0D, 0.0D);
}
++this.timeSinceStart;
if (this.timeSinceStart == this.maximumTime)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 1;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleExplosionHuge(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,106 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleExplosionLarge extends Particle
{
private static final ResourceLocation EXPLOSION_TEXTURE = new ResourceLocation("textures/entity/explosion.png");
private static final VertexFormat VERTEX_FORMAT = (new VertexFormat()).addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.TEX_2S).addElement(DefaultVertexFormats.NORMAL_3B).addElement(DefaultVertexFormats.PADDING_1B);
private int life;
private final int lifeTime;
/** The Rendering Engine. */
private final TextureManager textureManager;
private final float size;
protected ParticleExplosionLarge(TextureManager textureManagerIn, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1213_9_, double p_i1213_11_, double p_i1213_13_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.textureManager = textureManagerIn;
this.lifeTime = 6 + this.rand.nextInt(4);
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.size = 1.0F - (float)p_i1213_9_ * 0.5F;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
int i = (int)(((float)this.life + partialTicks) * 15.0F / (float)this.lifeTime);
if (i <= 15)
{
this.textureManager.bindTexture(EXPLOSION_TEXTURE);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 4) / 4.0F;
float f3 = f2 + 0.24975F;
float f4 = 2.0F * this.size;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
buffer.begin(7, VERTEX_FORMAT);
buffer.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableLighting();
}
}
public int getBrightnessForRender(float p_189214_1_)
{
return 61680;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.life;
if (this.life == this.lifeTime)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleExplosionLarge(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,107 @@
package net.minecraft.client.particle;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleFallingDust extends Particle
{
float oSize;
final float rotSpeed;
protected ParticleFallingDust(World p_i47135_1_, double p_i47135_2_, double p_i47135_4_, double p_i47135_6_, float p_i47135_8_, float p_i47135_9_, float p_i47135_10_)
{
super(p_i47135_1_, p_i47135_2_, p_i47135_4_, p_i47135_6_, 0.0D, 0.0D, 0.0D);
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.particleRed = p_i47135_8_;
this.particleGreen = p_i47135_9_;
this.particleBlue = p_i47135_10_;
float f = 0.9F;
this.particleScale *= 0.75F;
this.particleScale *= 0.9F;
this.oSize = this.particleScale;
this.particleMaxAge = (int)(32.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * 0.9F);
this.rotSpeed = ((float)Math.random() - 0.5F) * 0.1F;
this.particleAngle = (float)Math.random() * ((float)Math.PI * 2F);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.oSize * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.prevParticleAngle = this.particleAngle;
this.particleAngle += (float)Math.PI * this.rotSpeed * 2.0F;
if (this.onGround)
{
this.prevParticleAngle = this.particleAngle = 0.0F;
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.move(this.motionX, this.motionY, this.motionZ);
this.motionY -= 0.003000000026077032D;
this.motionY = Math.max(this.motionY, -0.14000000059604645D);
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
@Nullable
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE)
{
return null;
}
else
{
int i = Minecraft.getMinecraft().getBlockColors().getColor(iblockstate, worldIn, new BlockPos(xCoordIn, yCoordIn, zCoordIn));
if (iblockstate.getBlock() instanceof BlockFalling)
{
i = ((BlockFalling)iblockstate.getBlock()).getDustColor(iblockstate);
}
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2);
}
}
}
}

View File

@@ -0,0 +1,411 @@
package net.minecraft.client.particle;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemDye;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleFirework
{
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
ParticleFirework.Spark particlefirework$spark = new ParticleFirework.Spark(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Minecraft.getMinecraft().effectRenderer);
particlefirework$spark.setAlphaF(0.99F);
return particlefirework$spark;
}
}
@SideOnly(Side.CLIENT)
public static class Overlay extends Particle
{
protected Overlay(World p_i46466_1_, double p_i46466_2_, double p_i46466_4_, double p_i46466_6_)
{
super(p_i46466_1_, p_i46466_2_, p_i46466_4_, p_i46466_6_);
this.particleMaxAge = 4;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = 0.25F;
float f1 = 0.5F;
float f2 = 0.125F;
float f3 = 0.375F;
float f4 = 7.1F * MathHelper.sin(((float)this.particleAge + partialTicks - 1.0F) * 0.25F * (float)Math.PI);
this.setAlphaF(0.6F - ((float)this.particleAge + partialTicks - 1.0F) * 0.25F * 0.5F);
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
buffer.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex(0.5D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex(0.5D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex(0.25D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
buffer.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex(0.25D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
}
}
@SideOnly(Side.CLIENT)
public static class Spark extends ParticleSimpleAnimated
{
private boolean trail;
private boolean twinkle;
private final ParticleManager effectRenderer;
private float fadeColourRed;
private float fadeColourGreen;
private float fadeColourBlue;
private boolean hasFadeColour;
public Spark(World p_i46465_1_, double p_i46465_2_, double p_i46465_4_, double p_i46465_6_, double p_i46465_8_, double p_i46465_10_, double p_i46465_12_, ParticleManager p_i46465_14_)
{
super(p_i46465_1_, p_i46465_2_, p_i46465_4_, p_i46465_6_, 160, 8, -0.004F);
this.motionX = p_i46465_8_;
this.motionY = p_i46465_10_;
this.motionZ = p_i46465_12_;
this.effectRenderer = p_i46465_14_;
this.particleScale *= 0.75F;
this.particleMaxAge = 48 + this.rand.nextInt(12);
}
public void setTrail(boolean trailIn)
{
this.trail = trailIn;
}
public void setTwinkle(boolean twinkleIn)
{
this.twinkle = twinkleIn;
}
public boolean shouldDisableDepth()
{
return true;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
if (!this.twinkle || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
}
public void onUpdate()
{
super.onUpdate();
if (this.trail && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
ParticleFirework.Spark particlefirework$spark = new ParticleFirework.Spark(this.world, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.effectRenderer);
particlefirework$spark.setAlphaF(0.99F);
particlefirework$spark.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
particlefirework$spark.particleAge = particlefirework$spark.particleMaxAge / 2;
if (this.hasFadeColour)
{
particlefirework$spark.hasFadeColour = true;
particlefirework$spark.fadeColourRed = this.fadeColourRed;
particlefirework$spark.fadeColourGreen = this.fadeColourGreen;
particlefirework$spark.fadeColourBlue = this.fadeColourBlue;
}
particlefirework$spark.twinkle = this.twinkle;
this.effectRenderer.addEffect(particlefirework$spark);
}
}
}
@SideOnly(Side.CLIENT)
public static class Starter extends Particle
{
private int fireworkAge;
private final ParticleManager manager;
private NBTTagList fireworkExplosions;
boolean twinkle;
public Starter(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, ParticleManager p_i46464_14_, @Nullable NBTTagCompound p_i46464_15_)
{
super(p_i46464_1_, p_i46464_2_, p_i46464_4_, p_i46464_6_, 0.0D, 0.0D, 0.0D);
this.motionX = p_i46464_8_;
this.motionY = p_i46464_10_;
this.motionZ = p_i46464_12_;
this.manager = p_i46464_14_;
this.particleMaxAge = 8;
if (p_i46464_15_ != null)
{
this.fireworkExplosions = p_i46464_15_.getTagList("Explosions", 10);
if (this.fireworkExplosions.hasNoTags())
{
this.fireworkExplosions = null;
}
else
{
this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1;
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
if (nbttagcompound.getBoolean("Flicker"))
{
this.twinkle = true;
this.particleMaxAge += 15;
break;
}
}
}
}
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
}
public void onUpdate()
{
if (this.fireworkAge == 0 && this.fireworkExplosions != null)
{
boolean flag = this.isFarFromCamera();
boolean flag1 = false;
if (this.fireworkExplosions.tagCount() >= 3)
{
flag1 = true;
}
else
{
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
if (nbttagcompound.getByte("Type") == 1)
{
flag1 = true;
break;
}
}
}
SoundEvent soundevent1;
if (flag1)
{
soundevent1 = flag ? SoundEvents.ENTITY_FIREWORK_LARGE_BLAST_FAR : SoundEvents.ENTITY_FIREWORK_LARGE_BLAST;
}
else
{
soundevent1 = flag ? SoundEvents.ENTITY_FIREWORK_BLAST_FAR : SoundEvents.ENTITY_FIREWORK_BLAST;
}
this.world.playSound(this.posX, this.posY, this.posZ, soundevent1, SoundCategory.AMBIENT, 20.0F, 0.95F + this.rand.nextFloat() * 0.1F, true);
}
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.tagCount())
{
int k = this.fireworkAge / 2;
NBTTagCompound nbttagcompound1 = this.fireworkExplosions.getCompoundTagAt(k);
int l = nbttagcompound1.getByte("Type");
boolean flag4 = nbttagcompound1.getBoolean("Trail");
boolean flag2 = nbttagcompound1.getBoolean("Flicker");
int[] aint = nbttagcompound1.getIntArray("Colors");
int[] aint1 = nbttagcompound1.getIntArray("FadeColors");
if (aint.length == 0)
{
aint = new int[] {ItemDye.DYE_COLORS[0]};
}
if (l == 1)
{
this.createBall(0.5D, 4, aint, aint1, flag4, flag2);
}
else if (l == 2)
{
this.createShaped(0.5D, new double[][] {{0.0D, 1.0D}, {0.3455D, 0.309D}, {0.9511D, 0.309D}, {0.3795918367346939D, -0.12653061224489795D}, {0.6122448979591837D, -0.8040816326530612D}, {0.0D, -0.35918367346938773D}}, aint, aint1, flag4, flag2, false);
}
else if (l == 3)
{
this.createShaped(0.5D, new double[][] {{0.0D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.6D}, {0.6D, 0.6D}, {0.6D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.0D}, {0.4D, 0.0D}, {0.4D, -0.6D}, {0.2D, -0.6D}, {0.2D, -0.4D}, {0.0D, -0.4D}}, aint, aint1, flag4, flag2, true);
}
else if (l == 4)
{
this.createBurst(aint, aint1, flag4, flag2);
}
else
{
this.createBall(0.25D, 2, aint, aint1, flag4, flag2);
}
int j = aint[0];
float f = (float)((j & 16711680) >> 16) / 255.0F;
float f1 = (float)((j & 65280) >> 8) / 255.0F;
float f2 = (float)((j & 255) >> 0) / 255.0F;
ParticleFirework.Overlay particlefirework$overlay = new ParticleFirework.Overlay(this.world, this.posX, this.posY, this.posZ);
particlefirework$overlay.setRBGColorF(f, f1, f2);
this.manager.addEffect(particlefirework$overlay);
}
++this.fireworkAge;
if (this.fireworkAge > this.particleMaxAge)
{
if (this.twinkle)
{
boolean flag3 = this.isFarFromCamera();
SoundEvent soundevent = flag3 ? SoundEvents.ENTITY_FIREWORK_TWINKLE_FAR : SoundEvents.ENTITY_FIREWORK_TWINKLE;
this.world.playSound(this.posX, this.posY, this.posZ, soundevent, SoundCategory.AMBIENT, 20.0F, 0.9F + this.rand.nextFloat() * 0.15F, true);
}
this.setExpired();
}
}
private boolean isFarFromCamera()
{
Minecraft minecraft = Minecraft.getMinecraft();
return minecraft == null || minecraft.getRenderViewEntity() == null || minecraft.getRenderViewEntity().getDistanceSq(this.posX, this.posY, this.posZ) >= 256.0D;
}
/**
* Creates a single particle.
*/
private void createParticle(double p_92034_1_, double p_92034_3_, double p_92034_5_, double p_92034_7_, double p_92034_9_, double p_92034_11_, int[] p_92034_13_, int[] p_92034_14_, boolean p_92034_15_, boolean p_92034_16_)
{
ParticleFirework.Spark particlefirework$spark = new ParticleFirework.Spark(this.world, p_92034_1_, p_92034_3_, p_92034_5_, p_92034_7_, p_92034_9_, p_92034_11_, this.manager);
particlefirework$spark.setAlphaF(0.99F);
particlefirework$spark.setTrail(p_92034_15_);
particlefirework$spark.setTwinkle(p_92034_16_);
int i = this.rand.nextInt(p_92034_13_.length);
particlefirework$spark.setColor(p_92034_13_[i]);
if (p_92034_14_ != null && p_92034_14_.length > 0)
{
particlefirework$spark.setColorFade(p_92034_14_[this.rand.nextInt(p_92034_14_.length)]);
}
this.manager.addEffect(particlefirework$spark);
}
/**
* Creates a small ball or large ball type explosion effect.
*/
private void createBall(double speed, int size, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.posX;
double d1 = this.posY;
double d2 = this.posZ;
for (int i = -size; i <= size; ++i)
{
for (int j = -size; j <= size; ++j)
{
for (int k = -size; k <= size; ++k)
{
double d3 = (double)j + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D;
double d4 = (double)i + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D;
double d5 = (double)k + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D;
double d6 = (double)MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5) / speed + this.rand.nextGaussian() * 0.05D;
this.createParticle(d0, d1, d2, d3 / d6, d4 / d6, d5 / d6, colours, fadeColours, trail, twinkleIn);
if (i != -size && i != size && j != -size && j != size)
{
k += size * 2 - 1;
}
}
}
}
}
/**
* Creates a creeper-shaped or star-shaped explosion.
*/
private void createShaped(double speed, double[][] shape, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn, boolean p_92038_8_)
{
double d0 = shape[0][0];
double d1 = shape[0][1];
this.createParticle(this.posX, this.posY, this.posZ, d0 * speed, d1 * speed, 0.0D, colours, fadeColours, trail, twinkleIn);
float f = this.rand.nextFloat() * (float)Math.PI;
double d2 = p_92038_8_ ? 0.034D : 0.34D;
for (int i = 0; i < 3; ++i)
{
double d3 = (double)f + (double)((float)i * (float)Math.PI) * d2;
double d4 = d0;
double d5 = d1;
for (int j = 1; j < shape.length; ++j)
{
double d6 = shape[j][0];
double d7 = shape[j][1];
for (double d8 = 0.25D; d8 <= 1.0D; d8 += 0.25D)
{
double d9 = (d4 + (d6 - d4) * d8) * speed;
double d10 = (d5 + (d7 - d5) * d8) * speed;
double d11 = d9 * Math.sin(d3);
d9 = d9 * Math.cos(d3);
for (double d12 = -1.0D; d12 <= 1.0D; d12 += 2.0D)
{
this.createParticle(this.posX, this.posY, this.posZ, d9 * d12, d10, d11 * d12, colours, fadeColours, trail, twinkleIn);
}
}
d4 = d6;
d5 = d7;
}
}
}
/**
* Creates a burst type explosion effect.
*/
private void createBurst(int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.rand.nextGaussian() * 0.05D;
double d1 = this.rand.nextGaussian() * 0.05D;
for (int i = 0; i < 70; ++i)
{
double d2 = this.motionX * 0.5D + this.rand.nextGaussian() * 0.15D + d0;
double d3 = this.motionZ * 0.5D + this.rand.nextGaussian() * 0.15D + d1;
double d4 = this.motionY * 0.5D + this.rand.nextDouble() * 0.5D;
this.createParticle(this.posX, this.posY, this.posZ, d2, d4, d3, colours, fadeColours, trail, twinkleIn);
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite
* sheet, 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 0;
}
}
}

View File

@@ -0,0 +1,97 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleFlame extends Particle
{
/** the scale of the flame FX */
private final float flameScale;
protected ParticleFlame(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = this.motionX * 0.009999999776482582D + xSpeedIn;
this.motionY = this.motionY * 0.009999999776482582D + ySpeedIn;
this.motionZ = this.motionZ * 0.009999999776482582D + zSpeedIn;
this.posX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
this.posY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
this.posZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
this.flameScale = this.particleScale;
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
this.setParticleTextureIndex(48);
}
public void move(double x, double y, double z)
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
this.particleScale = this.flameScale * (1.0F - f * f * 0.5F);
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public int getBrightnessForRender(float p_189214_1_)
{
float f = ((float)this.particleAge + p_189214_1_) / (float)this.particleMaxAge;
f = MathHelper.clamp(f, 0.0F, 1.0F);
int i = super.getBrightnessForRender(p_189214_1_);
int j = i & 255;
int k = i >> 16 & 255;
j = j + (int)(f * 15.0F * 16.0F);
if (j > 240)
{
j = 240;
}
return j | k << 16;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleFlame(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,95 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleFootStep extends Particle
{
private static final ResourceLocation FOOTPRINT_TEXTURE = new ResourceLocation("textures/particle/footprint.png");
private int footstepAge;
private final int footstepMaxAge;
private final TextureManager currentFootSteps;
protected ParticleFootStep(TextureManager currentFootStepsIn, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.currentFootSteps = currentFootStepsIn;
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.footstepMaxAge = 200;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
f = f * f;
float f1 = 2.0F - f * 2.0F;
if (f1 > 1.0F)
{
f1 = 1.0F;
}
f1 = f1 * 0.2F;
GlStateManager.disableLighting();
float f2 = 0.125F;
float f3 = (float)(this.posX - interpPosX);
float f4 = (float)(this.posY - interpPosY);
float f5 = (float)(this.posZ - interpPosZ);
float f6 = this.world.getLightBrightness(new BlockPos(this.posX, this.posY, this.posZ));
this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
buffer.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
buffer.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
buffer.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
buffer.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
Tessellator.getInstance().draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
public void onUpdate()
{
++this.footstepAge;
if (this.footstepAge == this.footstepMaxAge)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleFootStep(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View File

@@ -0,0 +1,95 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleHeart extends Particle
{
float particleScaleOverTime;
protected ParticleHeart(World worldIn, double p_i1211_2_, double p_i1211_4_, double p_i1211_6_, double p_i1211_8_, double p_i1211_10_, double p_i1211_12_)
{
this(worldIn, p_i1211_2_, p_i1211_4_, p_i1211_6_, p_i1211_8_, p_i1211_10_, p_i1211_12_, 2.0F);
}
protected ParticleHeart(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46354_8_, double p_i46354_10_, double p_i46354_12_, float scale)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.009999999776482582D;
this.motionY *= 0.009999999776482582D;
this.motionZ *= 0.009999999776482582D;
this.motionY += 0.1D;
this.particleScale *= 0.75F;
this.particleScale *= scale;
this.particleScaleOverTime = this.particleScale;
this.particleMaxAge = 16;
this.setParticleTextureIndex(80);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.particleScaleOverTime * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.8600000143051147D;
this.motionY *= 0.8600000143051147D;
this.motionZ *= 0.8600000143051147D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class AngryVillagerFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleHeart(worldIn, xCoordIn, yCoordIn + 0.5D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
particle.setParticleTextureIndex(81);
particle.setRBGColorF(1.0F, 1.0F, 1.0F);
return particle;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleHeart(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,78 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleItemPickup extends Particle
{
private final Entity item;
private final Entity target;
private int age;
private final int maxAge;
private final float yOffset;
private final RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
public ParticleItemPickup(World worldIn, Entity p_i1233_2_, Entity p_i1233_3_, float p_i1233_4_)
{
super(worldIn, p_i1233_2_.posX, p_i1233_2_.posY, p_i1233_2_.posZ, p_i1233_2_.motionX, p_i1233_2_.motionY, p_i1233_2_.motionZ);
this.item = p_i1233_2_;
this.target = p_i1233_3_;
this.maxAge = 3;
this.yOffset = p_i1233_4_;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.age + partialTicks) / (float)this.maxAge;
f = f * f;
double d0 = this.item.posX;
double d1 = this.item.posY;
double d2 = this.item.posZ;
double d3 = this.target.lastTickPosX + (this.target.posX - this.target.lastTickPosX) * (double)partialTicks;
double d4 = this.target.lastTickPosY + (this.target.posY - this.target.lastTickPosY) * (double)partialTicks + (double)this.yOffset;
double d5 = this.target.lastTickPosZ + (this.target.posZ - this.target.lastTickPosZ) * (double)partialTicks;
double d6 = d0 + (d3 - d0) * (double)f;
double d7 = d1 + (d4 - d1) * (double)f;
double d8 = d2 + (d5 - d2) * (double)f;
int i = this.getBrightnessForRender(partialTicks);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
d6 = d6 - interpPosX;
d7 = d7 - interpPosY;
d8 = d8 - interpPosZ;
GlStateManager.enableLighting();
this.renderManager.renderEntity(this.item, d6, d7, d8, this.item.rotationYaw, partialTicks, false);
}
public void onUpdate()
{
++this.age;
if (this.age == this.maxAge)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
}

View File

@@ -0,0 +1,88 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleLava extends Particle
{
private final float lavaParticleScale;
protected ParticleLava(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.800000011920929D;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0.800000011920929D;
this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F;
this.lavaParticleScale = this.particleScale;
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
this.setParticleTextureIndex(49);
}
public int getBrightnessForRender(float p_189214_1_)
{
int i = super.getBrightnessForRender(p_189214_1_);
int j = 240;
int k = i >> 16 & 255;
return 240 | k << 16;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
this.particleScale = this.lavaParticleScale * (1.0F - f * f);
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
float f = (float)this.particleAge / (float)this.particleMaxAge;
if (this.rand.nextFloat() > f)
{
this.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
}
this.motionY -= 0.03D;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9990000128746033D;
this.motionY *= 0.9990000128746033D;
this.motionZ *= 0.9990000128746033D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleLava(worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View File

@@ -0,0 +1,517 @@
package net.minecraft.client.particle;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleManager
{
private static final ResourceLocation PARTICLE_TEXTURES = new ResourceLocation("textures/particle/particles.png");
/** Reference to the World object. */
protected World world;
private final ArrayDeque<Particle>[][] fxLayers = new ArrayDeque[4][];
private final Queue<ParticleEmitter> particleEmitters = Queues.<ParticleEmitter>newArrayDeque();
private final TextureManager renderer;
/** RNG. */
private final Random rand = new Random();
private final Map<Integer, IParticleFactory> particleTypes = Maps.<Integer, IParticleFactory>newHashMap();
private final Queue<Particle> queue = Queues.<Particle>newArrayDeque();
public ParticleManager(World worldIn, TextureManager rendererIn)
{
this.world = worldIn;
this.renderer = rendererIn;
for (int i = 0; i < 4; ++i)
{
this.fxLayers[i] = new ArrayDeque[2];
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j] = Queues.newArrayDeque();
}
}
this.registerVanillaParticles();
}
private void registerVanillaParticles()
{
this.registerParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), new ParticleExplosion.Factory());
this.registerParticle(EnumParticleTypes.SPIT.getParticleID(), new ParticleSpit.Factory());
this.registerParticle(EnumParticleTypes.WATER_BUBBLE.getParticleID(), new ParticleBubble.Factory());
this.registerParticle(EnumParticleTypes.WATER_SPLASH.getParticleID(), new ParticleSplash.Factory());
this.registerParticle(EnumParticleTypes.WATER_WAKE.getParticleID(), new ParticleWaterWake.Factory());
this.registerParticle(EnumParticleTypes.WATER_DROP.getParticleID(), new ParticleRain.Factory());
this.registerParticle(EnumParticleTypes.SUSPENDED.getParticleID(), new ParticleSuspend.Factory());
this.registerParticle(EnumParticleTypes.SUSPENDED_DEPTH.getParticleID(), new ParticleSuspendedTown.Factory());
this.registerParticle(EnumParticleTypes.CRIT.getParticleID(), new ParticleCrit.Factory());
this.registerParticle(EnumParticleTypes.CRIT_MAGIC.getParticleID(), new ParticleCrit.MagicFactory());
this.registerParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), new ParticleSmokeNormal.Factory());
this.registerParticle(EnumParticleTypes.SMOKE_LARGE.getParticleID(), new ParticleSmokeLarge.Factory());
this.registerParticle(EnumParticleTypes.SPELL.getParticleID(), new ParticleSpell.Factory());
this.registerParticle(EnumParticleTypes.SPELL_INSTANT.getParticleID(), new ParticleSpell.InstantFactory());
this.registerParticle(EnumParticleTypes.SPELL_MOB.getParticleID(), new ParticleSpell.MobFactory());
this.registerParticle(EnumParticleTypes.SPELL_MOB_AMBIENT.getParticleID(), new ParticleSpell.AmbientMobFactory());
this.registerParticle(EnumParticleTypes.SPELL_WITCH.getParticleID(), new ParticleSpell.WitchFactory());
this.registerParticle(EnumParticleTypes.DRIP_WATER.getParticleID(), new ParticleDrip.WaterFactory());
this.registerParticle(EnumParticleTypes.DRIP_LAVA.getParticleID(), new ParticleDrip.LavaFactory());
this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new ParticleHeart.AngryVillagerFactory());
this.registerParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), new ParticleSuspendedTown.HappyVillagerFactory());
this.registerParticle(EnumParticleTypes.TOWN_AURA.getParticleID(), new ParticleSuspendedTown.Factory());
this.registerParticle(EnumParticleTypes.NOTE.getParticleID(), new ParticleNote.Factory());
this.registerParticle(EnumParticleTypes.PORTAL.getParticleID(), new ParticlePortal.Factory());
this.registerParticle(EnumParticleTypes.ENCHANTMENT_TABLE.getParticleID(), new ParticleEnchantmentTable.EnchantmentTable());
this.registerParticle(EnumParticleTypes.FLAME.getParticleID(), new ParticleFlame.Factory());
this.registerParticle(EnumParticleTypes.LAVA.getParticleID(), new ParticleLava.Factory());
this.registerParticle(EnumParticleTypes.FOOTSTEP.getParticleID(), new ParticleFootStep.Factory());
this.registerParticle(EnumParticleTypes.CLOUD.getParticleID(), new ParticleCloud.Factory());
this.registerParticle(EnumParticleTypes.REDSTONE.getParticleID(), new ParticleRedstone.Factory());
this.registerParticle(EnumParticleTypes.FALLING_DUST.getParticleID(), new ParticleFallingDust.Factory());
this.registerParticle(EnumParticleTypes.SNOWBALL.getParticleID(), new ParticleBreaking.SnowballFactory());
this.registerParticle(EnumParticleTypes.SNOW_SHOVEL.getParticleID(), new ParticleSnowShovel.Factory());
this.registerParticle(EnumParticleTypes.SLIME.getParticleID(), new ParticleBreaking.SlimeFactory());
this.registerParticle(EnumParticleTypes.HEART.getParticleID(), new ParticleHeart.Factory());
this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory());
this.registerParticle(EnumParticleTypes.ITEM_CRACK.getParticleID(), new ParticleBreaking.Factory());
this.registerParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), new ParticleDigging.Factory());
this.registerParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), new ParticleBlockDust.Factory());
this.registerParticle(EnumParticleTypes.EXPLOSION_HUGE.getParticleID(), new ParticleExplosionHuge.Factory());
this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new ParticleExplosionLarge.Factory());
this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new ParticleFirework.Factory());
this.registerParticle(EnumParticleTypes.MOB_APPEARANCE.getParticleID(), new ParticleMobAppearance.Factory());
this.registerParticle(EnumParticleTypes.DRAGON_BREATH.getParticleID(), new ParticleDragonBreath.Factory());
this.registerParticle(EnumParticleTypes.END_ROD.getParticleID(), new ParticleEndRod.Factory());
this.registerParticle(EnumParticleTypes.DAMAGE_INDICATOR.getParticleID(), new ParticleCrit.DamageIndicatorFactory());
this.registerParticle(EnumParticleTypes.SWEEP_ATTACK.getParticleID(), new ParticleSweepAttack.Factory());
this.registerParticle(EnumParticleTypes.TOTEM.getParticleID(), new ParticleTotem.Factory());
}
public void registerParticle(int id, IParticleFactory particleFactory)
{
this.particleTypes.put(Integer.valueOf(id), particleFactory);
}
public void emitParticleAtEntity(Entity entityIn, EnumParticleTypes particleTypes)
{
this.particleEmitters.add(new ParticleEmitter(this.world, entityIn, particleTypes));
}
public void emitParticleAtEntity(Entity p_191271_1_, EnumParticleTypes p_191271_2_, int p_191271_3_)
{
this.particleEmitters.add(new ParticleEmitter(this.world, p_191271_1_, p_191271_2_, p_191271_3_));
}
/**
* Spawns the relevant particle according to the particle id.
*/
@Nullable
public Particle spawnEffectParticle(int particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
{
IParticleFactory iparticlefactory = this.particleTypes.get(Integer.valueOf(particleId));
if (iparticlefactory != null)
{
Particle particle = iparticlefactory.createParticle(particleId, this.world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
if (particle != null)
{
this.addEffect(particle);
return particle;
}
}
return null;
}
public void addEffect(Particle effect)
{
if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
this.queue.add(effect);
}
public void updateEffects()
{
for (int i = 0; i < 4; ++i)
{
this.updateEffectLayer(i);
}
if (!this.particleEmitters.isEmpty())
{
List<ParticleEmitter> list = Lists.<ParticleEmitter>newArrayList();
for (ParticleEmitter particleemitter : this.particleEmitters)
{
particleemitter.onUpdate();
if (!particleemitter.isAlive())
{
list.add(particleemitter);
}
}
this.particleEmitters.removeAll(list);
}
if (!this.queue.isEmpty())
{
for (Particle particle = this.queue.poll(); particle != null; particle = this.queue.poll())
{
int j = particle.getFXLayer();
int k = particle.shouldDisableDepth() ? 0 : 1;
if (this.fxLayers[j][k].size() >= 16384)
{
this.fxLayers[j][k].removeFirst();
}
this.fxLayers[j][k].add(particle);
}
}
}
private void updateEffectLayer(int layer)
{
this.world.profiler.startSection(String.valueOf(layer));
for (int i = 0; i < 2; ++i)
{
this.world.profiler.startSection(String.valueOf(i));
this.tickParticleList(this.fxLayers[layer][i]);
this.world.profiler.endSection();
}
this.world.profiler.endSection();
}
private void tickParticleList(Queue<Particle> p_187240_1_)
{
if (!p_187240_1_.isEmpty())
{
Iterator<Particle> iterator = p_187240_1_.iterator();
while (iterator.hasNext())
{
Particle particle = iterator.next();
this.tickParticle(particle);
if (!particle.isAlive())
{
iterator.remove();
}
}
}
}
private void tickParticle(final Particle particle)
{
try
{
particle.onUpdate();
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking Particle");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being ticked");
final int i = particle.getFXLayer();
crashreportcategory.addDetail("Particle", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return particle.toString();
}
});
crashreportcategory.addDetail("Particle Type", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
if (i == 0)
{
return "MISC_TEXTURE";
}
else if (i == 1)
{
return "TERRAIN_TEXTURE";
}
else
{
return i == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i;
}
}
});
throw new ReportedException(crashreport);
}
}
/**
* Renders all current particles. Args player, partialTickTime
*/
public void renderParticles(Entity entityIn, float partialTicks)
{
float f = ActiveRenderInfo.getRotationX();
float f1 = ActiveRenderInfo.getRotationZ();
float f2 = ActiveRenderInfo.getRotationYZ();
float f3 = ActiveRenderInfo.getRotationXY();
float f4 = ActiveRenderInfo.getRotationXZ();
Particle.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
Particle.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
Particle.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
Particle.cameraViewDir = entityIn.getLook(partialTicks);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.alphaFunc(516, 0.003921569F);
for (int i_nf = 0; i_nf < 3; ++i_nf)
{
final int i = i_nf;
for (int j = 0; j < 2; ++j)
{
if (!this.fxLayers[i][j].isEmpty())
{
switch (j)
{
case 0:
GlStateManager.depthMask(false);
break;
case 1:
GlStateManager.depthMask(true);
}
switch (i)
{
case 0:
default:
this.renderer.bindTexture(PARTICLE_TEXTURES);
break;
case 1:
this.renderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
for (final Particle particle : this.fxLayers[i][j])
{
try
{
particle.renderParticle(bufferbuilder, entityIn, partialTicks, f, f4, f1, f2, f3);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being rendered");
crashreportcategory.addDetail("Particle", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return particle.toString();
}
});
crashreportcategory.addDetail("Particle Type", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
if (i == 0)
{
return "MISC_TEXTURE";
}
else if (i == 1)
{
return "TERRAIN_TEXTURE";
}
else
{
return i == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i;
}
}
});
throw new ReportedException(crashreport);
}
}
tessellator.draw();
}
}
}
GlStateManager.depthMask(true);
GlStateManager.disableBlend();
GlStateManager.alphaFunc(516, 0.1F);
}
public void renderLitParticles(Entity entityIn, float partialTick)
{
float f = 0.017453292F;
float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);
for (int i = 0; i < 2; ++i)
{
Queue<Particle> queue = this.fxLayers[3][i];
if (!queue.isEmpty())
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
for (Particle particle : queue)
{
particle.renderParticle(bufferbuilder, entityIn, partialTick, f1, f5, f2, f3, f4);
}
}
}
}
public void clearEffects(@Nullable World worldIn)
{
this.world = worldIn;
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j].clear();
}
}
this.particleEmitters.clear();
}
public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
{
if (!state.getBlock().isAir(state, this.world, pos) && !state.getBlock().addDestroyEffects(world, pos, this))
{
state = state.getActualState(this.world, pos);
int i = 4;
for (int j = 0; j < 4; ++j)
{
for (int k = 0; k < 4; ++k)
{
for (int l = 0; l < 4; ++l)
{
double d0 = ((double)j + 0.5D) / 4.0D;
double d1 = ((double)k + 0.5D) / 4.0D;
double d2 = ((double)l + 0.5D) / 4.0D;
this.addEffect((new ParticleDigging(this.world, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, state)).setBlockPos(pos));
}
}
}
}
}
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, EnumFacing side)
{
IBlockState iblockstate = this.world.getBlockState(pos);
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(this.world, pos);
double d0 = (double)i + this.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minX;
double d1 = (double)j + this.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minY;
double d2 = (double)k + this.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minZ;
if (side == EnumFacing.DOWN)
{
d1 = (double)j + axisalignedbb.minY - 0.10000000149011612D;
}
if (side == EnumFacing.UP)
{
d1 = (double)j + axisalignedbb.maxY + 0.10000000149011612D;
}
if (side == EnumFacing.NORTH)
{
d2 = (double)k + axisalignedbb.minZ - 0.10000000149011612D;
}
if (side == EnumFacing.SOUTH)
{
d2 = (double)k + axisalignedbb.maxZ + 0.10000000149011612D;
}
if (side == EnumFacing.WEST)
{
d0 = (double)i + axisalignedbb.minX - 0.10000000149011612D;
}
if (side == EnumFacing.EAST)
{
d0 = (double)i + axisalignedbb.maxX + 0.10000000149011612D;
}
this.addEffect((new ParticleDigging(this.world, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
}
public String getStatistics()
{
int i = 0;
for (int j = 0; j < 4; ++j)
{
for (int k = 0; k < 2; ++k)
{
i += this.fxLayers[j][k].size();
}
}
return "" + i;
}
public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target)
{
IBlockState state = world.getBlockState(pos);
if (state != null && !state.getBlock().addHitEffects(state, world, target, this))
{
addBlockHitEffects(pos, target.sideHit);
}
}
}

View File

@@ -0,0 +1,98 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityElderGuardian;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleMobAppearance extends Particle
{
private EntityLivingBase entity;
protected ParticleMobAppearance(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.particleGravity = 0.0F;
this.particleMaxAge = 30;
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
public void onUpdate()
{
super.onUpdate();
if (this.entity == null)
{
EntityElderGuardian entityelderguardian = new EntityElderGuardian(this.world);
entityelderguardian.setGhost();
this.entity = entityelderguardian;
}
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
if (this.entity != null)
{
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
rendermanager.setRenderPosition(Particle.interpPosX, Particle.interpPosY, Particle.interpPosZ);
float f = 0.42553192F;
float f1 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
GlStateManager.depthMask(true);
GlStateManager.enableBlend();
GlStateManager.enableDepth();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
float f2 = 240.0F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
GlStateManager.pushMatrix();
float f3 = 0.05F + 0.5F * MathHelper.sin(f1 * (float)Math.PI);
GlStateManager.color(1.0F, 1.0F, 1.0F, f3);
GlStateManager.translate(0.0F, 1.8F, 0.0F);
GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(60.0F - 150.0F * f1 - entityIn.rotationPitch, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.4F, -1.5F);
GlStateManager.scale(0.42553192F, 0.42553192F, 0.42553192F);
this.entity.rotationYaw = 0.0F;
this.entity.rotationYawHead = 0.0F;
this.entity.prevRotationYaw = 0.0F;
this.entity.prevRotationYawHead = 0.0F;
rendermanager.renderEntity(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
GlStateManager.popMatrix();
GlStateManager.enableDepth();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleMobAppearance(worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View File

@@ -0,0 +1,86 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleNote extends Particle
{
float noteParticleScale;
protected ParticleNote(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46353_8_, double p_i46353_10_, double p_i46353_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46353_8_, p_i46353_10_, p_i46353_12_, 2.0F);
}
protected ParticleNote(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1217_8_, double p_i1217_10_, double p_i1217_12_, float p_i1217_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.009999999776482582D;
this.motionY *= 0.009999999776482582D;
this.motionZ *= 0.009999999776482582D;
this.motionY += 0.2D;
this.particleRed = MathHelper.sin(((float)p_i1217_8_ + 0.0F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F;
this.particleGreen = MathHelper.sin(((float)p_i1217_8_ + 0.33333334F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F;
this.particleBlue = MathHelper.sin(((float)p_i1217_8_ + 0.6666667F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F;
this.particleScale *= 0.75F;
this.particleScale *= p_i1217_14_;
this.noteParticleScale = this.particleScale;
this.particleMaxAge = 6;
this.setParticleTextureIndex(64);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.noteParticleScale * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.6600000262260437D;
this.motionY *= 0.6600000262260437D;
this.motionZ *= 0.6600000262260437D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleNote(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,102 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticlePortal extends Particle
{
private final float portalParticleScale;
private final double portalPosX;
private final double portalPosY;
private final double portalPosZ;
protected ParticlePortal(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
this.posX = xCoordIn;
this.posY = yCoordIn;
this.posZ = zCoordIn;
this.portalPosX = this.posX;
this.portalPosY = this.posY;
this.portalPosZ = this.posZ;
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;
this.portalParticleScale = this.particleScale;
this.particleRed = f * 0.9F;
this.particleGreen = f * 0.3F;
this.particleBlue = f;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 40;
this.setParticleTextureIndex((int)(Math.random() * 8.0D));
}
public void move(double x, double y, double z)
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
f = 1.0F - f;
f = f * f;
f = 1.0F - f;
this.particleScale = this.portalParticleScale * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public int getBrightnessForRender(float p_189214_1_)
{
int i = super.getBrightnessForRender(p_189214_1_);
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = f * f;
f = f * f;
int j = i & 255;
int k = i >> 16 & 255;
k = k + (int)(f * 15.0F * 16.0F);
if (k > 240)
{
k = 240;
}
return j | k << 16;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
float f1 = -f + f * f * 2.0F;
float f2 = 1.0F - f1;
this.posX = this.portalPosX + this.motionX * (double)f2;
this.posY = this.portalPosY + this.motionY * (double)f2 + (double)(1.0F - f);
this.posZ = this.portalPosZ + this.motionZ * (double)f2;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticlePortal(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,91 @@
package net.minecraft.client.particle;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleRain extends Particle
{
protected ParticleRain(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.30000001192092896D;
this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D;
this.motionZ *= 0.30000001192092896D;
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(19 + this.rand.nextInt(4));
this.setSize(0.01F, 0.01F);
this.particleGravity = 0.06F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double)this.particleGravity;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
if (this.onGround)
{
if (Math.random() < 0.5D)
{
this.setExpired();
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Material material = iblockstate.getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
}
else
{
d0 = iblockstate.getBoundingBox(this.world, blockpos).maxY;
}
double d1 = (double)MathHelper.floor(this.posY) + d0;
if (this.posY < d1)
{
this.setExpired();
}
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleRain(worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View File

@@ -0,0 +1,93 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleRedstone extends Particle
{
float reddustParticleScale;
protected ParticleRedstone(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
}
protected ParticleRedstone(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float scale, float red, float green, float blue)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
if (red == 0.0F)
{
red = 1.0F;
}
float f = (float)Math.random() * 0.4F + 0.6F;
this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * red * f;
this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * green * f;
this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * blue * f;
this.particleScale *= 0.75F;
this.particleScale *= scale;
this.reddustParticleScale = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * scale);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.reddustParticleScale * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleRedstone(worldIn, xCoordIn, yCoordIn, zCoordIn, (float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
}
}
}

View File

@@ -0,0 +1,108 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSimpleAnimated extends Particle
{
/**
* The base texture index. The texture index starts at this + (numAgingFrames - 1), and works its way down to this
* number as the particle decays.
*/
private final int textureIdx;
/** How many different textures there are to progress through as the particle decays */
private final int numAgingFrames;
/** Added to the ySpeed every tick. Usually a small (thousandths), negative value. */
private final float yAccel;
private float baseAirFriction = 0.91F;
/** The red value to drift toward */
private float fadeTargetRed;
/** The green value to drift toward */
private float fadeTargetGreen;
/** The blue value to drift toward */
private float fadeTargetBlue;
/** True if setColorFade has been called */
private boolean fadingColor;
public ParticleSimpleAnimated(World worldIn, double x, double y, double z, int textureIdxIn, int numFrames, float yAccelIn)
{
super(worldIn, x, y, z);
this.textureIdx = textureIdxIn;
this.numAgingFrames = numFrames;
this.yAccel = yAccelIn;
}
public void setColor(int p_187146_1_)
{
float f = (float)((p_187146_1_ & 16711680) >> 16) / 255.0F;
float f1 = (float)((p_187146_1_ & 65280) >> 8) / 255.0F;
float f2 = (float)((p_187146_1_ & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * 1.0F, f1 * 1.0F, f2 * 1.0F);
}
/**
* sets a color for the particle to drift toward (20% closer each tick, never actually getting very close)
*/
public void setColorFade(int rgb)
{
this.fadeTargetRed = (float)((rgb & 16711680) >> 16) / 255.0F;
this.fadeTargetGreen = (float)((rgb & 65280) >> 8) / 255.0F;
this.fadeTargetBlue = (float)((rgb & 255) >> 0) / 255.0F;
this.fadingColor = true;
}
public boolean shouldDisableDepth()
{
return true;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
if (this.fadingColor)
{
this.particleRed += (this.fadeTargetRed - this.particleRed) * 0.2F;
this.particleGreen += (this.fadeTargetGreen - this.particleGreen) * 0.2F;
this.particleBlue += (this.fadeTargetBlue - this.particleBlue) * 0.2F;
}
}
this.setParticleTextureIndex(this.textureIdx + (this.numAgingFrames - 1 - this.particleAge * this.numAgingFrames / this.particleMaxAge));
this.motionY += (double)this.yAccel;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= (double)this.baseAirFriction;
this.motionY *= (double)this.baseAirFriction;
this.motionZ *= (double)this.baseAirFriction;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public int getBrightnessForRender(float p_189214_1_)
{
return 15728880;
}
protected void setBaseAirFriction(float p_191238_1_)
{
this.baseAirFriction = p_191238_1_;
}
}

View File

@@ -0,0 +1,23 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSmokeLarge extends ParticleSmokeNormal
{
protected ParticleSmokeLarge(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1201_8_, double p_i1201_10_, double p_i1201_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i1201_8_, p_i1201_10_, p_i1201_12_, 2.5F);
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSmokeLarge(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,91 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSmokeNormal extends Particle
{
float smokeParticleScale;
private ParticleSmokeNormal(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F);
}
protected ParticleSmokeNormal(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i46348_8_;
this.motionY += p_i46348_10_;
this.motionZ += p_i46348_12_;
float f = (float)(Math.random() * 0.30000001192092896D);
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.particleScale *= 0.75F;
this.particleScale *= p_i46348_14_;
this.smokeParticleScale = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.smokeParticleScale * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY += 0.004D;
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSmokeNormal(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,84 @@
package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSnowShovel extends Particle
{
float snowDigParticleScale;
protected ParticleSnowShovel(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, 1.0F);
}
protected ParticleSnowShovel(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, float p_i1228_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeedIn;
this.motionY += ySpeedIn;
this.motionZ += zSpeedIn;
float f = 1.0F - (float)(Math.random() * 0.30000001192092896D);
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.particleScale *= 0.75F;
this.particleScale *= p_i1228_14_;
this.snowDigParticleScale = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i1228_14_);
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
this.particleScale = this.snowDigParticleScale * f;
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY -= 0.03D;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9900000095367432D;
this.motionY *= 0.9900000095367432D;
this.motionZ *= 0.9900000095367432D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSnowShovel(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,130 @@
package net.minecraft.client.particle;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSpell extends Particle
{
private static final Random RANDOM = new Random();
/** Base spell texture index */
private int baseSpellTextureIndex = 128;
protected ParticleSpell(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double ySpeed, double p_i1229_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.5D - RANDOM.nextDouble(), ySpeed, 0.5D - RANDOM.nextDouble());
this.motionY *= 0.20000000298023224D;
if (p_i1229_8_ == 0.0D && p_i1229_12_ == 0.0D)
{
this.motionX *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
}
this.particleScale *= 0.75F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
public boolean shouldDisableDepth()
{
return true;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
this.motionY += 0.004D;
this.move(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
/**
* Sets the base spell texture index
*/
public void setBaseSpellTextureIndex(int baseSpellTextureIndexIn)
{
this.baseSpellTextureIndex = baseSpellTextureIndexIn;
}
@SideOnly(Side.CLIENT)
public static class AmbientMobFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleSpell(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
particle.setAlphaF(0.15F);
particle.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
return particle;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSpell(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
@SideOnly(Side.CLIENT)
public static class InstantFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleSpell(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
((ParticleSpell)particle).setBaseSpellTextureIndex(144);
return particle;
}
}
@SideOnly(Side.CLIENT)
public static class MobFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleSpell(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
particle.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
return particle;
}
}
@SideOnly(Side.CLIENT)
public static class WitchFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleSpell(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
((ParticleSpell)particle).setBaseSpellTextureIndex(144);
float f = worldIn.rand.nextFloat() * 0.5F + 0.35F;
particle.setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
return particle;
}
}
}

View File

@@ -0,0 +1,30 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSpit extends ParticleExplosion
{
protected ParticleSpit(World p_i47221_1_, double p_i47221_2_, double p_i47221_4_, double p_i47221_6_, double p_i47221_8_, double p_i47221_10_, double p_i47221_12_)
{
super(p_i47221_1_, p_i47221_2_, p_i47221_4_, p_i47221_6_, p_i47221_8_, p_i47221_10_, p_i47221_12_);
this.particleGravity = 0.5F;
}
public void onUpdate()
{
super.onUpdate();
this.motionY -= 0.004D + 0.04D * (double)this.particleGravity;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSpit(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,32 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSplash extends ParticleRain
{
protected ParticleSplash(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn);
this.particleGravity = 0.04F;
this.nextTextureIndexX();
if (ySpeedIn == 0.0D && (xSpeedIn != 0.0D || zSpeedIn != 0.0D))
{
this.motionX = xSpeedIn;
this.motionY = ySpeedIn + 0.1D;
this.motionZ = zSpeedIn;
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSplash(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,53 @@
package net.minecraft.client.particle;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSuspend extends Particle
{
protected ParticleSuspend(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn - 0.125D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.particleRed = 0.4F;
this.particleGreen = 0.4F;
this.particleBlue = 0.7F;
this.setParticleTextureIndex(0);
this.setSize(0.01F, 0.01F);
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
this.motionX = xSpeedIn * 0.0D;
this.motionY = ySpeedIn * 0.0D;
this.motionZ = zSpeedIn * 0.0D;
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.move(this.motionX, this.motionY, this.motionZ);
if (this.world.getBlockState(new BlockPos(this.posX, this.posY, this.posZ)).getMaterial() != Material.WATER)
{
this.setExpired();
}
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSuspend(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,68 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSuspendedTown extends Particle
{
protected ParticleSuspendedTown(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn);
float f = this.rand.nextFloat() * 0.1F + 0.2F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.setParticleTextureIndex(0);
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.5F;
this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D;
this.motionZ *= 0.019999999552965164D;
this.particleMaxAge = (int)(20.0D / (Math.random() * 0.8D + 0.2D));
}
public void move(double x, double y, double z)
{
this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.99D;
this.motionY *= 0.99D;
this.motionZ *= 0.99D;
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSuspendedTown(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
@SideOnly(Side.CLIENT)
public static class HappyVillagerFactory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
Particle particle = new ParticleSuspendedTown(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
particle.setParticleTextureIndex(82);
particle.setRBGColorF(1.0F, 1.0F, 1.0F);
return particle;
}
}
}

View File

@@ -0,0 +1,105 @@
package net.minecraft.client.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSweepAttack extends Particle
{
private static final ResourceLocation SWEEP_TEXTURE = new ResourceLocation("textures/entity/sweep.png");
private static final VertexFormat VERTEX_FORMAT = (new VertexFormat()).addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.TEX_2S).addElement(DefaultVertexFormats.NORMAL_3B).addElement(DefaultVertexFormats.PADDING_1B);
private int life;
private final int lifeTime;
private final TextureManager textureManager;
private final float size;
protected ParticleSweepAttack(TextureManager textureManagerIn, World worldIn, double x, double y, double z, double p_i46582_9_, double p_i46582_11_, double p_i46582_13_)
{
super(worldIn, x, y, z, 0.0D, 0.0D, 0.0D);
this.textureManager = textureManagerIn;
this.lifeTime = 4;
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.size = 1.0F - (float)p_i46582_9_ * 0.5F;
}
/**
* Renders the particle
*/
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
int i = (int)(((float)this.life + partialTicks) * 3.0F / (float)this.lifeTime);
if (i <= 7)
{
this.textureManager.bindTexture(SWEEP_TEXTURE);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 2) / 2.0F;
float f3 = f2 + 0.4995F;
float f4 = 1.0F * this.size;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
buffer.begin(7, VERTEX_FORMAT);
buffer.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
buffer.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableLighting();
}
}
public int getBrightnessForRender(float p_189214_1_)
{
return 61680;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.life;
if (this.life == this.lifeTime)
{
this.setExpired();
}
}
/**
* Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet,
* 1 for the main Texture atlas, and 3 for a custom texture
*/
public int getFXLayer()
{
return 3;
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSweepAttack(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,39 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleTotem extends ParticleSimpleAnimated
{
public ParticleTotem(World p_i47220_1_, double p_i47220_2_, double p_i47220_4_, double p_i47220_6_, double p_i47220_8_, double p_i47220_10_, double p_i47220_12_)
{
super(p_i47220_1_, p_i47220_2_, p_i47220_4_, p_i47220_6_, 176, 8, -0.05F);
this.motionX = p_i47220_8_;
this.motionY = p_i47220_10_;
this.motionZ = p_i47220_12_;
this.particleScale *= 0.75F;
this.particleMaxAge = 60 + this.rand.nextInt(12);
if (this.rand.nextInt(4) == 0)
{
this.setRBGColorF(0.6F + this.rand.nextFloat() * 0.2F, 0.6F + this.rand.nextFloat() * 0.3F, this.rand.nextFloat() * 0.2F);
}
else
{
this.setRBGColorF(0.1F + this.rand.nextFloat() * 0.2F, 0.4F + this.rand.nextFloat() * 0.3F, this.rand.nextFloat() * 0.2F);
}
this.setBaseAirFriction(0.6F);
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleTotem(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,57 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleWaterWake extends Particle
{
protected ParticleWaterWake(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i45073_8_, double p_i45073_10_, double p_i45073_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.30000001192092896D;
this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D;
this.motionZ *= 0.30000001192092896D;
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(19);
this.setSize(0.01F, 0.01F);
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleGravity = 0.0F;
this.motionX = p_i45073_8_;
this.motionY = p_i45073_10_;
this.motionZ = p_i45073_12_;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double)this.particleGravity;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
int i = 60 - this.particleMaxAge;
float f = (float)i * 0.001F;
this.setSize(f, f);
this.setParticleTextureIndex(19 + i % 4);
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
}
@SideOnly(Side.CLIENT)
public static class Factory implements IParticleFactory
{
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleWaterWake(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@@ -0,0 +1,7 @@
// Auto generated package-info by MCP
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraft.client.particle;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;