fix particles
This commit is contained in:
parent
2e7a3dd09a
commit
ebf31c2078
31 changed files with 658 additions and 1156 deletions
|
@ -189,8 +189,8 @@ public class ClientPlayer implements IClientPlayer
|
|||
this.gm.getSoundManager().playSound(sound);
|
||||
}
|
||||
|
||||
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes) {
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entityIn, particleTypes);
|
||||
public void spawnCritParticles(Entity entityIn) {
|
||||
this.gm.effectRenderer.spawnCritParticles(entityIn);
|
||||
}
|
||||
|
||||
public void onDisconnect(String reason)
|
||||
|
@ -892,12 +892,12 @@ public class ClientPlayer implements IClientPlayer
|
|||
// }
|
||||
else if (packetIn.getAnimationType() == 4)
|
||||
{
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entity, ParticleType.CRIT);
|
||||
this.gm.effectRenderer.spawnCritParticles(entity);
|
||||
}
|
||||
else if (packetIn.getAnimationType() == 5)
|
||||
{
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entity, ParticleType.CRIT);
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entity, ParticleType.CRIT);
|
||||
this.gm.effectRenderer.spawnCritParticles(entity);
|
||||
this.gm.effectRenderer.spawnCritParticles(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,13 +29,9 @@ public class EffectRenderer
|
|||
{
|
||||
private static final String TEXTURE = "textures/world/particles.png";
|
||||
|
||||
/** Reference to the World object. */
|
||||
protected World worldObj;
|
||||
private List<EntityFX>[][] fxLayers = new List[4][];
|
||||
private List<EntityParticleEmitter> particleEmitters = Lists.<EntityParticleEmitter>newArrayList();
|
||||
private List<EntityFX>[] fxLayers = new List[4];
|
||||
private TextureManager renderer;
|
||||
|
||||
/** RNG. */
|
||||
private Random rand = new Random();
|
||||
private Map<ParticleType, IParticleFactory> particleTypes = Maps.<ParticleType, IParticleFactory>newEnumMap(ParticleType.class);
|
||||
|
||||
|
@ -43,21 +39,14 @@ public class EffectRenderer
|
|||
{
|
||||
this.worldObj = worldIn;
|
||||
this.renderer = rendererIn;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < this.fxLayers.length; ++i)
|
||||
{
|
||||
this.fxLayers[i] = new List[2];
|
||||
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
this.fxLayers[i][j] = Lists.newArrayList();
|
||||
}
|
||||
this.fxLayers[i] = Lists.newArrayList();
|
||||
}
|
||||
|
||||
this.registerVanillaParticles();
|
||||
this.registerParticles();
|
||||
}
|
||||
|
||||
private void registerVanillaParticles()
|
||||
private void registerParticles()
|
||||
{
|
||||
this.register(ParticleType.EXPLOSION_NORMAL, new EntityExplodeFX.Factory());
|
||||
this.register(ParticleType.SPLASH, new EntitySplashFX.Factory());
|
||||
|
@ -76,7 +65,7 @@ public class EffectRenderer
|
|||
this.register(ParticleType.ITEM_CRACK, new EntityBreakingFX.Factory());
|
||||
this.register(ParticleType.BLOCK_CRACK, new EntityDiggingFX.Factory());
|
||||
this.register(ParticleType.EXPLOSION_HUGE, new EntityHugeExplodeFX.Factory());
|
||||
this.register(ParticleType.EXPLOSION_LARGE, new EntityLargeExplodeFX.Factory());
|
||||
this.register(ParticleType.EXPLOSION_LARGE, new EntityTexturedFX.ExplodeFactory());
|
||||
this.register(ParticleType.HAIL_CORN, new EntityDownfallFX.HailFactory());
|
||||
}
|
||||
|
||||
|
@ -85,9 +74,9 @@ public class EffectRenderer
|
|||
this.particleTypes.put(id, factory);
|
||||
}
|
||||
|
||||
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes)
|
||||
public void spawnCritParticles(Entity entity)
|
||||
{
|
||||
this.particleEmitters.add(new EntityParticleEmitter(this.worldObj, entityIn, particleTypes));
|
||||
this.addEffect(new EntityHitFX(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,75 +108,36 @@ public class EffectRenderer
|
|||
return null;
|
||||
}
|
||||
|
||||
public void addEffect(EntityFX effect)
|
||||
private void addEffect(EntityFX effect)
|
||||
{
|
||||
int i = effect.getFXLayer();
|
||||
int j = effect.getAlpha() != 1.0F ? 0 : 1;
|
||||
|
||||
if (this.fxLayers[i][j].size() >= 4000)
|
||||
{
|
||||
this.fxLayers[i][j].remove(0);
|
||||
}
|
||||
|
||||
this.fxLayers[i][j].add(effect);
|
||||
if(this.fxLayers[i].size() >= 4000)
|
||||
this.fxLayers[i].remove(0);
|
||||
this.fxLayers[i].add(effect);
|
||||
}
|
||||
|
||||
public void updateEffects()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < this.fxLayers.length; ++i)
|
||||
{
|
||||
this.updateEffectLayer(i);
|
||||
}
|
||||
|
||||
List<EntityParticleEmitter> list = Lists.<EntityParticleEmitter>newArrayList();
|
||||
|
||||
for (EntityParticleEmitter entityparticleemitter : this.particleEmitters)
|
||||
{
|
||||
entityparticleemitter.onUpdate();
|
||||
|
||||
if (entityparticleemitter.dead)
|
||||
{
|
||||
list.add(entityparticleemitter);
|
||||
}
|
||||
}
|
||||
|
||||
this.particleEmitters.removeAll(list);
|
||||
}
|
||||
|
||||
private void updateEffectLayer(int layer)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
this.updateEffectAlphaLayer(this.fxLayers[layer][i]);
|
||||
this.updateEffectLayer(this.fxLayers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEffectAlphaLayer(List<EntityFX> entitiesFX)
|
||||
private void updateEffectLayer(List<EntityFX> entitiesFX)
|
||||
{
|
||||
List<EntityFX> list = Lists.<EntityFX>newArrayList();
|
||||
|
||||
for (int i = 0; i < entitiesFX.size(); ++i)
|
||||
{
|
||||
EntityFX entityfx = (EntityFX)entitiesFX.get(i);
|
||||
this.tickParticle(entityfx);
|
||||
|
||||
if (entityfx.dead)
|
||||
{
|
||||
EntityFX entityfx = entitiesFX.get(i);
|
||||
if (entityfx.onUpdate())
|
||||
list.add(entityfx);
|
||||
}
|
||||
}
|
||||
|
||||
entitiesFX.removeAll(list);
|
||||
}
|
||||
|
||||
private void tickParticle(final EntityFX particle)
|
||||
{
|
||||
particle.onUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all current particles. Args player, partialTickTime
|
||||
*/
|
||||
public void renderParticles(Entity entityIn, float partialTicks)
|
||||
{
|
||||
float f = MatrixState.getRotationX();
|
||||
|
@ -202,49 +152,36 @@ public class EffectRenderer
|
|||
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlState.alphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (!this.fxLayers[i].isEmpty())
|
||||
{
|
||||
final int i_f = i;
|
||||
GlState.depthMask(true);
|
||||
|
||||
if (!this.fxLayers[i][j].isEmpty())
|
||||
switch (i)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 0:
|
||||
GlState.depthMask(false);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
this.renderer.bindTexture(TEXTURE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
GlState.depthMask(true);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
this.renderer.bindTexture(TEXTURE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.renderer.bindTexture(TextureMap.BLOCKS);
|
||||
}
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
|
||||
for (int k = 0; k < this.fxLayers[i][j].size(); ++k)
|
||||
{
|
||||
final EntityFX entityfx = (EntityFX)this.fxLayers[i][j].get(k);
|
||||
|
||||
entityfx.renderParticle(worldrenderer, entityIn, partialTicks, f, f4, f1, f2, f3);
|
||||
}
|
||||
|
||||
Tessellator.draw();
|
||||
case 1:
|
||||
this.renderer.bindTexture(TextureMap.BLOCKS);
|
||||
}
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
|
||||
for (int k = 0; k < this.fxLayers[i].size(); ++k)
|
||||
{
|
||||
final EntityFX entityfx = (EntityFX)this.fxLayers[i].get(k);
|
||||
|
||||
entityfx.render(worldrenderer, partialTicks, f, f4, f1, f2, f3);
|
||||
}
|
||||
|
||||
Tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +199,16 @@ public class EffectRenderer
|
|||
float f4 = f1 * ExtMath.sin(entityIn.rotPitch * 0.017453292F);
|
||||
float f5 = ExtMath.cos(entityIn.rotPitch * 0.017453292F);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
List<EntityFX> list = this.fxLayers[2];
|
||||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
List<EntityFX> list = this.fxLayers[3][i];
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
|
||||
if (!list.isEmpty())
|
||||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
|
||||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
EntityFX entityfx = (EntityFX)list.get(j);
|
||||
entityfx.renderParticle(worldrenderer, entityIn, partialTick, f1, f5, f2, f3, f4);
|
||||
}
|
||||
EntityFX entityfx = list.get(j);
|
||||
entityfx.render(worldrenderer, partialTick, f1, f5, f2, f3, f4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,16 +216,10 @@ public class EffectRenderer
|
|||
public void clearEffects(World worldIn)
|
||||
{
|
||||
this.worldObj = worldIn;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < this.fxLayers.length; ++i)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
this.fxLayers[i][j].clear();
|
||||
}
|
||||
this.fxLayers[i].clear();
|
||||
}
|
||||
|
||||
this.particleEmitters.clear();
|
||||
}
|
||||
|
||||
public void addBlockDestroyEffects(BlockPos pos, State state)
|
||||
|
@ -311,7 +238,7 @@ public class EffectRenderer
|
|||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, state)).setBlockPos(pos));
|
||||
this.addEffect(new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, state, pos, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,44 +293,17 @@ public class EffectRenderer
|
|||
d0 = (double)i + block.getBlockBoundsMaxX() + (double)f;
|
||||
}
|
||||
|
||||
this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
||||
}
|
||||
}
|
||||
|
||||
public void moveToAlphaLayer(EntityFX effect)
|
||||
{
|
||||
this.moveToLayer(effect, 1, 0);
|
||||
}
|
||||
|
||||
public void moveToNoAlphaLayer(EntityFX effect)
|
||||
{
|
||||
this.moveToLayer(effect, 0, 1);
|
||||
}
|
||||
|
||||
private void moveToLayer(EntityFX effect, int layerFrom, int layerTo)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (this.fxLayers[i][layerFrom].contains(effect))
|
||||
{
|
||||
this.fxLayers[i][layerFrom].remove(effect);
|
||||
this.fxLayers[i][layerTo].add(effect);
|
||||
}
|
||||
this.addEffect(new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate, pos, true));
|
||||
}
|
||||
}
|
||||
|
||||
public String getStatistics()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
i += this.fxLayers[j][k].size();
|
||||
}
|
||||
i += this.fxLayers[j].size();
|
||||
}
|
||||
|
||||
return "" + i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,32 +2,30 @@ package client.renderer.particle;
|
|||
|
||||
import common.world.World;
|
||||
|
||||
public class EntityAuraFX extends EntityFX
|
||||
public class EntityAuraFX extends EntityParticleFX
|
||||
{
|
||||
private final boolean fullBright;
|
||||
|
||||
protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn, boolean fullBright)
|
||||
protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn, boolean fullBright, int texture)
|
||||
{
|
||||
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn);
|
||||
float f = this.rand.floatv() * 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.floatv() * 0.6F + 0.5F;
|
||||
float f = texture != 0 ? 1.0f : this.rand.floatv() * 0.1F + 0.2F;
|
||||
this.red = f;
|
||||
this.green = f;
|
||||
this.blue = f;
|
||||
this.setUV(texture != 0 ? 5 + texture : 0, texture != 0 ? 2 : 0);
|
||||
this.scale *= this.rand.floatv() * 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));
|
||||
this.noClip = true;
|
||||
this.lifetime = (int)(20.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.fullBright = fullBright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
|
@ -37,27 +35,23 @@ public class EntityAuraFX extends EntityFX
|
|||
this.motionY *= 0.99D;
|
||||
this.motionZ *= 0.99D;
|
||||
|
||||
if (this.particleMaxAge-- <= 0)
|
||||
if (this.lifetime-- <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
public int getBrightness(float partialTicks)
|
||||
{
|
||||
return this.fullBright ? 15728880 : super.getBrightnessForRender(partialTicks);
|
||||
}
|
||||
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
return this.fullBright ? 1.0F : super.getBrightness(partialTicks);
|
||||
return this.fullBright ? 15728880 : super.getBrightness(partialTicks);
|
||||
}
|
||||
|
||||
public static class SuspendFactory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true);
|
||||
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +59,7 @@ public class EntityAuraFX extends EntityFX
|
|||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false);
|
||||
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,10 +67,7 @@ public class EntityAuraFX extends EntityFX
|
|||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
EntityFX entityfx = new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false);
|
||||
entityfx.setParticleTextureIndex(82);
|
||||
entityfx.setRBGColorF(1.0F, 1.0F, 1.0F);
|
||||
return entityfx;
|
||||
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,76 +1,27 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityBreakingFX extends EntityFX
|
||||
{
|
||||
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_)
|
||||
{
|
||||
this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_);
|
||||
this.motionX *= 0.10000000149011612D;
|
||||
this.motionY *= 0.10000000149011612D;
|
||||
this.motionZ *= 0.10000000149011612D;
|
||||
this.motionX += xSpeedIn;
|
||||
this.motionY += ySpeedIn;
|
||||
this.motionZ += zSpeedIn;
|
||||
}
|
||||
public class EntityBreakingFX extends EntityIconFX {
|
||||
protected EntityBreakingFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, Item item) {
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D, 1.0f, Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(item));
|
||||
this.red = this.green = this.blue = 1.0F;
|
||||
this.gravity = 1.0F;
|
||||
this.motionX *= 0.10000000149011612D;
|
||||
this.motionY *= 0.10000000149011612D;
|
||||
this.motionZ *= 0.10000000149011612D;
|
||||
this.motionX += xSpeed;
|
||||
this.motionY += ySpeed;
|
||||
this.motionZ += zSpeed;
|
||||
}
|
||||
|
||||
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_)
|
||||
{
|
||||
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
|
||||
this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_));
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
this.particleGravity = 1.0F; // Blocks.snow.particleGravity;
|
||||
this.particleScale /= 2.0F;
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, 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.particleIcon != null)
|
||||
{
|
||||
f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
|
||||
f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
|
||||
f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
|
||||
f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
|
||||
}
|
||||
|
||||
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partialTicks - interpPosX);
|
||||
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partialTicks - interpPosY);
|
||||
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partialTicks - interpPosZ);
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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 static class Factory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
Item item = ItemRegistry.byId(data);
|
||||
return item == null ? null : new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, item);
|
||||
}
|
||||
}
|
||||
public static class Factory implements IParticleFactory {
|
||||
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
|
||||
Item item = ItemRegistry.byId(data);
|
||||
return item == null ? null : new EntityBreakingFX(world, x, y, z, xSpeed, ySpeed, zSpeed, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityCritFX extends EntityFX
|
||||
public class EntityCritFX extends EntityParticleFX
|
||||
{
|
||||
float field_174839_a;
|
||||
|
||||
|
@ -23,56 +21,50 @@ public class EntityCritFX extends EntityFX
|
|||
this.motionX += p_i46285_8_ * 0.4D;
|
||||
this.motionY += p_i46285_10_ * 0.4D;
|
||||
this.motionZ += p_i46285_12_ * 0.4D;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
|
||||
this.particleScale *= 0.75F;
|
||||
this.particleScale *= p_i46285_14_;
|
||||
this.field_174839_a = this.particleScale;
|
||||
this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
|
||||
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46285_14_);
|
||||
this.noClip = false;
|
||||
this.setParticleTextureIndex(66);
|
||||
this.blue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
|
||||
this.red = this.blue * 0.3f;
|
||||
this.green = this.blue * 0.8f;
|
||||
this.scale *= 0.75F;
|
||||
this.scale *= p_i46285_14_;
|
||||
this.field_174839_a = this.scale;
|
||||
this.lifetime = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
|
||||
this.lifetime = (int)((float)this.lifetime * p_i46285_14_);
|
||||
this.setUV(4, 2);
|
||||
this.onUpdate();
|
||||
this.setRBGColorF(this.getRedColorF() * 0.3F, this.getGreenColorF() * 0.8F, this.getBlueColorF());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
this.particleScale = this.field_174839_a * f;
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.scale = this.field_174839_a * f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.particleGreen = (float)((double)this.particleGreen * 0.96D);
|
||||
this.particleBlue = (float)((double)this.particleBlue * 0.9D);
|
||||
this.green = (float)((double)this.green * 0.96D);
|
||||
this.blue = (float)((double)this.blue * 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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,125 +1,46 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityDiggingFX extends EntityFX
|
||||
{
|
||||
private State sourceState;
|
||||
private BlockPos sourcePos;
|
||||
public class EntityDiggingFX extends EntityIconFX {
|
||||
private final State state;
|
||||
private final BlockPos position;
|
||||
|
||||
protected EntityDiggingFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, State state)
|
||||
{
|
||||
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
||||
this.sourceState = state;
|
||||
this.setParticleIcon(Client.CLIENT.getBlockRendererDispatcher().getModelManager().getTexture(state));
|
||||
this.particleGravity = 1.0F; // state.getBlock().particleGravity;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
|
||||
this.particleScale /= 2.0F;
|
||||
}
|
||||
protected EntityDiggingFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, State state, BlockPos pos, boolean hit) {
|
||||
super(world, x, y, z, xSpeed, ySpeed, zSpeed, hit ? 0.6f : 1.0f, Client.CLIENT.getBlockRendererDispatcher().getModelManager().getTexture(state));
|
||||
this.state = state;
|
||||
this.gravity = 1.0F;
|
||||
this.red = this.green = this.blue = 0.6F;
|
||||
if(hit) {
|
||||
this.motionX *= 0.2;
|
||||
this.motionY = (this.motionY - 0.1) * 0.2 + 0.1;
|
||||
this.motionZ *= 0.2;
|
||||
}
|
||||
this.position = pos == null ? new BlockPos(this.posX, this.posY, this.posZ) : pos;
|
||||
Block block = this.state.getBlock();
|
||||
if(block == Blocks.grass)
|
||||
return;
|
||||
int color = pos == null ? block.getRenderColor(this.state) : block.colorMultiplier(this.world, pos);
|
||||
this.red *= (float)(color >> 16 & 255) / 255.0F;
|
||||
this.green *= (float)(color >> 8 & 255) / 255.0F;
|
||||
this.blue *= (float)(color & 255) / 255.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position of the block that this particle came from. Used for calculating texture and color multiplier.
|
||||
*/
|
||||
public EntityDiggingFX setBlockPos(BlockPos pos)
|
||||
{
|
||||
this.sourcePos = pos;
|
||||
public int getBrightness(float partial) {
|
||||
int light = super.getBrightness(partial);
|
||||
return light == 0 ? (this.world.isBlockLoaded(this.position) ? this.world.getCombinedLight(this.position, 0) : 0) : light;
|
||||
}
|
||||
|
||||
if (this.sourceState.getBlock() == Blocks.grass)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = this.sourceState.getBlock().colorMultiplier(this.worldObj, pos);
|
||||
this.particleRed *= (float)(i >> 16 & 255) / 255.0F;
|
||||
this.particleGreen *= (float)(i >> 8 & 255) / 255.0F;
|
||||
this.particleBlue *= (float)(i & 255) / 255.0F;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public EntityDiggingFX calculateColor()
|
||||
{
|
||||
this.sourcePos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
Block block = this.sourceState.getBlock();
|
||||
|
||||
if (block == Blocks.grass)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = block.getRenderColor(this.sourceState);
|
||||
this.particleRed *= (float)(i >> 16 & 255) / 255.0F;
|
||||
this.particleGreen *= (float)(i >> 8 & 255) / 255.0F;
|
||||
this.particleBlue *= (float)(i & 255) / 255.0F;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, 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.particleIcon != null)
|
||||
{
|
||||
f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
|
||||
f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
|
||||
f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
|
||||
f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
|
||||
}
|
||||
|
||||
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partialTicks - interpPosX);
|
||||
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partialTicks - interpPosY);
|
||||
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partialTicks - interpPosZ);
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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 partialTicks)
|
||||
{
|
||||
int i = super.getBrightnessForRender(partialTicks);
|
||||
int j = 0;
|
||||
|
||||
if (this.worldObj.isBlockLoaded(this.sourcePos))
|
||||
{
|
||||
j = this.worldObj.getCombinedLight(this.sourcePos, 0);
|
||||
}
|
||||
|
||||
return i == 0 ? j : i;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
State state = BlockRegistry.byId(data);
|
||||
return state == null ? null : (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state)).calculateColor();
|
||||
}
|
||||
}
|
||||
public static class Factory implements IParticleFactory {
|
||||
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
|
||||
State state = BlockRegistry.byId(data);
|
||||
return state == null ? null : new EntityDiggingFX(world, x, y, z, xSpeed, ySpeed, zSpeed, state, null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,57 +8,45 @@ import common.util.ExtMath;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityDownfallFX extends EntityFX
|
||||
public class EntityDownfallFX extends EntityParticleFX
|
||||
{
|
||||
protected EntityDownfallFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, int texture, int numTex)
|
||||
protected EntityDownfallFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, int texture)
|
||||
{
|
||||
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 + texture * 4 + this.rand.zrange(numTex));
|
||||
this.setSize(0.01F, 0.01F);
|
||||
this.particleGravity = 0.06F;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.red = 1.0F;
|
||||
this.green = 1.0F;
|
||||
this.blue = 1.0F;
|
||||
this.setUV(this.rand.zrange(4), 1 + texture);
|
||||
this.gravity = 0.06F;
|
||||
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
this.motionY -= (double)this.particleGravity;
|
||||
this.motionY -= (double)this.gravity;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
if (this.particleMaxAge-- <= 0)
|
||||
if (this.lifetime-- <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
if (Math.random() < 0.5D)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
|
||||
BlockPos blockpos = new BlockPos(this);
|
||||
State iblockstate = this.worldObj.getState(blockpos);
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
State iblockstate = this.world.getState(blockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
|
||||
block.setBlockBoundsBasedOnState(this.world, blockpos);
|
||||
Material material = iblockstate.getBlock().getMaterial();
|
||||
|
||||
if (material.isLiquid() || material.isSolid())
|
||||
|
@ -78,16 +66,17 @@ public class EntityDownfallFX extends EntityFX
|
|||
|
||||
if (this.posY < d1)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class RainFactory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 0, 4);
|
||||
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +84,7 @@ public class EntityDownfallFX extends EntityFX
|
|||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 1, 4);
|
||||
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package client.renderer.particle;
|
|||
|
||||
import common.world.World;
|
||||
|
||||
public class EntityExplodeFX extends EntityFX
|
||||
public class EntityExplodeFX extends EntityParticleFX
|
||||
{
|
||||
protected EntityExplodeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
|
||||
{
|
||||
|
@ -10,37 +10,32 @@ public class EntityExplodeFX extends EntityFX
|
|||
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;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = this.rand.floatv() * 0.3F + 0.7F;
|
||||
this.particleScale = this.rand.floatv() * this.rand.floatv() * 6.0F + 1.0F;
|
||||
this.particleMaxAge = (int)(16.0D / ((double)this.rand.floatv() * 0.8D + 0.2D)) + 2;
|
||||
this.red = this.green = this.blue = this.rand.floatv() * 0.3F + 0.7F;
|
||||
this.scale = this.rand.floatv() * this.rand.floatv() * 6.0F + 1.0F;
|
||||
this.lifetime = (int)(16.0D / ((double)this.rand.floatv() * 0.8D + 0.2D)) + 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
|
||||
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
|
||||
this.motionY += 0.004D;
|
||||
this.moveEntity(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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,290 +1,19 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import common.entity.Entity;
|
||||
import common.entity.EntityType;
|
||||
import common.tags.TagObject;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
import common.rng.Random;
|
||||
|
||||
public class EntityFX extends Entity
|
||||
{
|
||||
protected int particleTextureIndexX;
|
||||
protected int particleTextureIndexY;
|
||||
protected float particleTextureJitterX;
|
||||
protected float particleTextureJitterY;
|
||||
protected int particleAge;
|
||||
protected int particleMaxAge;
|
||||
protected float particleScale;
|
||||
protected float particleGravity;
|
||||
public abstract class EntityFX {
|
||||
static double interpPosX;
|
||||
static double interpPosY;
|
||||
static double interpPosZ;
|
||||
|
||||
/** The red amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */
|
||||
protected float particleRed;
|
||||
protected final Random rand = new Random();
|
||||
|
||||
/**
|
||||
* The green amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0.
|
||||
*/
|
||||
protected float particleGreen;
|
||||
protected int age;
|
||||
protected int lifetime;
|
||||
|
||||
/**
|
||||
* The blue amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0.
|
||||
*/
|
||||
protected float particleBlue;
|
||||
|
||||
/** Particle alpha */
|
||||
protected float particleAlpha;
|
||||
|
||||
/** The icon field from which the given particle pulls its texture. */
|
||||
protected TextureAtlasSprite particleIcon;
|
||||
public static double interpPosX;
|
||||
public static double interpPosY;
|
||||
public static double interpPosZ;
|
||||
|
||||
protected EntityFX(World worldIn, double posXIn, double posYIn, double posZIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.particleAlpha = 1.0F;
|
||||
this.setSize(0.2F, 0.2F);
|
||||
this.setPosition(posXIn, posYIn, posZIn);
|
||||
this.lastTickPosX = this.prevX = posXIn;
|
||||
this.lastTickPosY = this.prevY = posYIn;
|
||||
this.lastTickPosZ = this.prevZ = posZIn;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
this.particleTextureJitterX = this.rand.floatv() * 3.0F;
|
||||
this.particleTextureJitterY = this.rand.floatv() * 3.0F;
|
||||
this.particleScale = (this.rand.floatv() * 0.5F + 0.5F) * 2.0F;
|
||||
this.particleMaxAge = (int)(4.0F / (this.rand.floatv() * 0.9F + 0.1F));
|
||||
this.particleAge = 0;
|
||||
}
|
||||
|
||||
public EntityFX(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 = ExtMath.sqrtd(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 EntityFX multiplyVelocity(float multiplier)
|
||||
{
|
||||
this.motionX *= (double)multiplier;
|
||||
this.motionY = (this.motionY - 0.10000000149011612D) * (double)multiplier + 0.10000000149011612D;
|
||||
this.motionZ *= (double)multiplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityFX 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)
|
||||
{
|
||||
if (this.particleAlpha == 1.0F && alpha < 1.0F)
|
||||
{
|
||||
Client.CLIENT.effectRenderer.moveToAlphaLayer(this);
|
||||
}
|
||||
else if (this.particleAlpha < 1.0F && alpha == 1.0F)
|
||||
{
|
||||
Client.CLIENT.effectRenderer.moveToNoAlphaLayer(this);
|
||||
}
|
||||
|
||||
this.particleAlpha = alpha;
|
||||
}
|
||||
|
||||
public float getRedColorF()
|
||||
{
|
||||
return this.particleRed;
|
||||
}
|
||||
|
||||
public float getGreenColorF()
|
||||
{
|
||||
return this.particleGreen;
|
||||
}
|
||||
|
||||
public float getBlueColorF()
|
||||
{
|
||||
return this.particleBlue;
|
||||
}
|
||||
|
||||
public float getAlpha()
|
||||
{
|
||||
return this.particleAlpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
this.motionY -= 0.04D * (double)this.particleGravity;
|
||||
this.moveEntity(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(RenderBuffer worldRendererIn, 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.particleIcon != null)
|
||||
{
|
||||
f = this.particleIcon.getMinU();
|
||||
f1 = this.particleIcon.getMaxU();
|
||||
f2 = this.particleIcon.getMinV();
|
||||
f3 = this.particleIcon.getMaxV();
|
||||
}
|
||||
|
||||
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partialTicks - interpPosX);
|
||||
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partialTicks - interpPosY);
|
||||
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partialTicks - interpPosZ);
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.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, this.particleAlpha).lightmap(j, k).endVertex();
|
||||
worldRendererIn.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, this.particleAlpha).lightmap(j, k).endVertex();
|
||||
worldRendererIn.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, this.particleAlpha).lightmap(j, k).endVertex();
|
||||
worldRendererIn.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, this.particleAlpha).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data.
|
||||
*/
|
||||
public void writeEntity(TagObject tag)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data.
|
||||
*/
|
||||
public void readEntity(TagObject tag)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the particle's icon.
|
||||
*/
|
||||
public void setParticleIcon(TextureAtlasSprite icon)
|
||||
{
|
||||
int i = this.getFXLayer();
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
this.particleIcon = icon;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
public boolean canAttackWithItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
// }
|
||||
|
||||
public int getTrackingRange() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getUpdateFrequency() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isSendingVeloUpdates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.OBJECT;
|
||||
}
|
||||
public abstract boolean onUpdate();
|
||||
public abstract void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ);
|
||||
public abstract int getFXLayer();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityFlameFX extends EntityFX
|
||||
public class EntityFlameFX extends EntityParticleFX
|
||||
{
|
||||
/** the scale of the flame FX */
|
||||
private float flameScale;
|
||||
|
@ -19,28 +17,26 @@ public class EntityFlameFX extends EntityFX
|
|||
this.posX += (double)((this.rand.floatv() - this.rand.floatv()) * 0.05F);
|
||||
this.posY += (double)((this.rand.floatv() - this.rand.floatv()) * 0.05F);
|
||||
this.posZ += (double)((this.rand.floatv() - this.rand.floatv()) * 0.05F);
|
||||
this.flameScale = this.particleScale;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
|
||||
this.noClip = true;
|
||||
this.setParticleTextureIndex(48);
|
||||
this.flameScale = this.scale;
|
||||
this.red = this.green = this.blue = 1.0F;
|
||||
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
|
||||
this.setUV(6, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
this.particleScale = this.flameScale * (1.0F - f * f * 0.5F);
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
|
||||
this.scale = this.flameScale * (1.0F - f * f * 0.5F);
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
public int getBrightness(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
int i = super.getBrightnessForRender(partialTicks);
|
||||
int i = super.getBrightness(partialTicks);
|
||||
int j = i & 255;
|
||||
int k = i >> 16 & 255;
|
||||
j = j + (int)(f * 15.0F * 16.0F);
|
||||
|
@ -53,41 +49,25 @@ public class EntityFlameFX extends EntityFX
|
|||
return j | k << 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
float f1 = super.getBrightness(partialTicks);
|
||||
return f1 * f + (1.0F - f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.moveEntity(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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityHeartFX extends EntityFX
|
||||
public class EntityHeartFX extends EntityParticleFX
|
||||
{
|
||||
float particleScaleOverTime;
|
||||
|
||||
|
@ -21,37 +19,35 @@ public class EntityHeartFX extends EntityFX
|
|||
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.noClip = false;
|
||||
this.setParticleTextureIndex(80);
|
||||
this.scale *= 0.75F;
|
||||
this.scale *= scale;
|
||||
this.particleScaleOverTime = this.scale;
|
||||
this.lifetime = 16;
|
||||
this.setUV(5, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
this.particleScale = this.particleScaleOverTime * f;
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.scale = this.particleScaleOverTime * f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
@ -65,12 +61,7 @@ public class EntityHeartFX extends EntityFX
|
|||
this.motionX *= 0.8600000143051147D;
|
||||
this.motionY *= 0.8600000143051147D;
|
||||
this.motionZ *= 0.8600000143051147D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// public static class AngryVillagerFactory implements IParticleFactory
|
||||
|
|
25
client/src/main/java/client/renderer/particle/EntityHitFX.java
Executable file
25
client/src/main/java/client/renderer/particle/EntityHitFX.java
Executable file
|
@ -0,0 +1,25 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.entity.Entity;
|
||||
import common.model.ParticleType;
|
||||
|
||||
public class EntityHitFX extends EntityTickedFX {
|
||||
private final Entity entity;
|
||||
|
||||
public EntityHitFX(Entity entity) {
|
||||
super(16, 3);
|
||||
this.entity = entity;
|
||||
this.onUpdate();
|
||||
}
|
||||
|
||||
public void spawnParticle() {
|
||||
double x = (double)(this.rand.floatv() * 2.0F - 1.0F);
|
||||
double y = (double)(this.rand.floatv() * 2.0F - 1.0F);
|
||||
double z = (double)(this.rand.floatv() * 2.0F - 1.0F);
|
||||
if(x * x + y * y + z * z <= 1.0D) {
|
||||
this.entity.worldObj.spawnParticle(ParticleType.CRIT, this.entity.posX + x * (double)this.entity.width / 4.0D,
|
||||
this.entity.getEntityBoundingBox().minY + (double)(this.entity.height / 2.0F) + y * (double)this.entity.height / 4.0D,
|
||||
this.entity.posZ + z * (double)this.entity.width / 4.0D, x, y + 0.2D, z);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,60 +1,32 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.model.ParticleType;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityHugeExplodeFX extends EntityFX
|
||||
{
|
||||
private int timeSinceStart;
|
||||
public class EntityHugeExplodeFX extends EntityTickedFX {
|
||||
private final World world;
|
||||
private final double posX;
|
||||
private final double posY;
|
||||
private final double posZ;
|
||||
|
||||
protected EntityHugeExplodeFX(World world, double x, double y, double z) {
|
||||
super(6, 8);
|
||||
this.world = world;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
}
|
||||
|
||||
/** the maximum time for the explosion */
|
||||
private int maximumTime = 8;
|
||||
public void spawnParticle() {
|
||||
double x = this.posX + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
double y = this.posY + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
double z = this.posZ + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
this.world.spawnParticle(ParticleType.EXPLOSION_LARGE, x, y, z, (double)((float)this.age / (float)this.lifetime), 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
protected EntityHugeExplodeFX(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(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
double d0 = this.posX + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
double d1 = this.posY + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
double d2 = this.posZ + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
|
||||
this.worldObj.spawnParticle(ParticleType.EXPLOSION_LARGE, d0, d1, d2, (double)((float)this.timeSinceStart / (float)this.maximumTime), 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
++this.timeSinceStart;
|
||||
|
||||
if (this.timeSinceStart == this.maximumTime)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityHugeExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
||||
}
|
||||
}
|
||||
public static class Factory implements IParticleFactory {
|
||||
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
|
||||
return new EntityHugeExplodeFX(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityIconFX extends EntityWorldFX {
|
||||
private final TextureAtlasSprite icon;
|
||||
private final float offsetX;
|
||||
private final float offsetY;
|
||||
private final float size;
|
||||
|
||||
protected float red;
|
||||
protected float green;
|
||||
protected float blue;
|
||||
|
||||
protected EntityIconFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, float size,
|
||||
TextureAtlasSprite icon) {
|
||||
super(world, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.size = (this.rand.floatv() * 0.5F + 0.5F) * size * 0.1f;
|
||||
this.icon = icon;
|
||||
this.offsetX = this.rand.floatv() * 3.0F;
|
||||
this.offsetY = this.rand.floatv() * 3.0F;
|
||||
}
|
||||
|
||||
public final int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
float u1 = this.icon.getInterpolatedU((double)(this.offsetX * 4.0F));
|
||||
float u2 = this.icon.getInterpolatedU((double)((this.offsetX + 1.0F) * 4.0F));
|
||||
float v1 = this.icon.getInterpolatedV((double)(this.offsetY * 4.0F));
|
||||
float v2 = this.icon.getInterpolatedV((double)((this.offsetY + 1.0F) * 4.0F));
|
||||
float scale = this.size;
|
||||
float x = (float)(this.prevX + (this.posX - this.prevX) * (double)partial - interpPosX);
|
||||
float y = (float)(this.prevY + (this.posY - this.prevY) * (double)partial - interpPosY);
|
||||
float z = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partial - interpPosZ);
|
||||
int light = this.getBrightness(partial);
|
||||
int sky = light >> 16 & 65535;
|
||||
int block = light & 65535;
|
||||
rb.pos((double)(x - rotX * scale - rotXY * scale), (double)(y - rotZ * scale), (double)(z - rotYZ * scale - rotXZ * scale))
|
||||
.tex((double)u1, (double)v2).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
|
||||
rb.pos((double)(x - rotX * scale + rotXY * scale), (double)(y + rotZ * scale), (double)(z - rotYZ * scale + rotXZ * scale))
|
||||
.tex((double)u1, (double)v1).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
|
||||
rb.pos((double)(x + rotX * scale + rotXY * scale), (double)(y + rotZ * scale), (double)(z + rotYZ * scale + rotXZ * scale))
|
||||
.tex((double)u2, (double)v1).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
|
||||
rb.pos((double)(x + rotX * scale - rotXY * scale), (double)(y - rotZ * scale), (double)(z + rotYZ * scale - rotXZ * scale))
|
||||
.tex((double)u2, (double)v2).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
|
||||
}
|
||||
|
||||
public final boolean onUpdate() {
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
if(this.age++ >= this.lifetime)
|
||||
return true;
|
||||
this.motionY -= 0.04D * (double)this.gravity;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.DefaultVertexFormats;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.ItemRenderer;
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.renderer.Tessellator;
|
||||
import client.renderer.VertexFormat;
|
||||
import client.renderer.texture.TextureManager;
|
||||
import common.entity.Entity;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityLargeExplodeFX extends EntityFX
|
||||
{
|
||||
private static final String EXPLOSION_TEXTURE = "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 field_70581_a;
|
||||
private int field_70584_aq;
|
||||
|
||||
/** The Rendering Engine. */
|
||||
private TextureManager theRenderEngine;
|
||||
private float field_70582_as;
|
||||
|
||||
protected EntityLargeExplodeFX(TextureManager renderEngine, 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.theRenderEngine = renderEngine;
|
||||
this.field_70584_aq = 6 + this.rand.zrange(4);
|
||||
this.particleRed = this.particleGreen = this.particleBlue = this.rand.floatv() * 0.6F + 0.4F;
|
||||
this.field_70582_as = 1.0F - (float)p_i1213_9_ * 0.5F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
{
|
||||
int i = (int)(((float)this.field_70581_a + partialTicks) * 15.0F / (float)this.field_70584_aq);
|
||||
|
||||
if (i <= 15)
|
||||
{
|
||||
this.theRenderEngine.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.field_70582_as;
|
||||
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partialTicks - interpPosX);
|
||||
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partialTicks - interpPosY);
|
||||
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partialTicks - interpPosZ);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlState.disableLighting();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
worldRendererIn.begin(GL11.GL_QUADS, VERTEX_FORMAT);
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
worldRendererIn.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();
|
||||
Tessellator.draw();
|
||||
GlState.enableLighting();
|
||||
}
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
{
|
||||
return 61680;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
++this.field_70581_a;
|
||||
|
||||
if (this.field_70581_a == this.field_70584_aq)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
{
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
|
||||
{
|
||||
return new EntityLargeExplodeFX(Client.CLIENT.getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.model.ParticleType;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityLavaFX extends EntityFX
|
||||
public class EntityLavaFX extends EntityParticleFX
|
||||
{
|
||||
private float lavaParticleScale;
|
||||
|
||||
|
@ -17,61 +15,51 @@ public class EntityLavaFX extends EntityFX
|
|||
this.motionY *= 0.800000011920929D;
|
||||
this.motionZ *= 0.800000011920929D;
|
||||
this.motionY = (double)(this.rand.floatv() * 0.4F + 0.05F);
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
this.particleScale *= this.rand.floatv() * 2.0F + 0.2F;
|
||||
this.lavaParticleScale = this.particleScale;
|
||||
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.noClip = false;
|
||||
this.setParticleTextureIndex(49);
|
||||
this.red = this.green = this.blue = 1.0F;
|
||||
this.scale *= this.rand.floatv() * 2.0F + 0.2F;
|
||||
this.lavaParticleScale = this.scale;
|
||||
this.lifetime = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.setUV(7, 1);
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
public int getBrightness(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
int i = super.getBrightnessForRender(partialTicks);
|
||||
int i = super.getBrightness(partialTicks);
|
||||
int j = 240;
|
||||
int k = i >> 16 & 255;
|
||||
return j | k << 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
this.particleScale = this.lavaParticleScale * (1.0F - f * f);
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
|
||||
this.scale = this.lavaParticleScale * (1.0F - f * f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
float f = (float)this.particleAge / (float)this.particleMaxAge;
|
||||
float f = (float)this.age / (float)this.lifetime;
|
||||
|
||||
if (this.rand.floatv() > f)
|
||||
{
|
||||
this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
|
||||
this.world.spawnParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
this.motionY -= 0.03D;
|
||||
|
@ -79,12 +67,7 @@ public class EntityLavaFX extends EntityFX
|
|||
this.motionX *= 0.9990000128746033D;
|
||||
this.motionY *= 0.9990000128746033D;
|
||||
this.motionZ *= 0.9990000128746033D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.world.WorldClient;
|
||||
import common.entity.Entity;
|
||||
import common.model.ParticleType;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityParticleEmitter extends EntityFX
|
||||
{
|
||||
private Entity attachedEntity;
|
||||
private int age;
|
||||
private int lifetime;
|
||||
private ParticleType particleTypes;
|
||||
|
||||
public EntityParticleEmitter(World worldIn, Entity p_i46279_2_, ParticleType particleTypesIn)
|
||||
{
|
||||
super(worldIn, p_i46279_2_.posX, p_i46279_2_.getEntityBoundingBox().minY + (double)(p_i46279_2_.height / 2.0F), p_i46279_2_.posZ, p_i46279_2_.motionX, p_i46279_2_.motionY, p_i46279_2_.motionZ);
|
||||
this.attachedEntity = p_i46279_2_;
|
||||
this.lifetime = 3;
|
||||
this.particleTypes = particleTypesIn;
|
||||
this.onUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
double d0 = (double)(this.rand.floatv() * 2.0F - 1.0F);
|
||||
double d1 = (double)(this.rand.floatv() * 2.0F - 1.0F);
|
||||
double d2 = (double)(this.rand.floatv() * 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;
|
||||
final double xCoord = d3;
|
||||
final double yCoord = d4;
|
||||
final double zCoord = d5;
|
||||
((WorldClient)this.worldObj).spawnEntityFX(this.particleTypes, this.particleTypes.isUnlimited(), xCoord, yCoord, zCoord, d0, d1 + 0.2D, d2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
++this.age;
|
||||
|
||||
if (this.age >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityParticleFX extends EntityWorldFX {
|
||||
private int textureU;
|
||||
private int textureV;
|
||||
protected float scale;
|
||||
protected float red;
|
||||
protected float green;
|
||||
protected float blue;
|
||||
|
||||
public EntityParticleFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
super(world, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.red = this.green = this.blue = 1.0F;
|
||||
this.scale = (this.rand.floatv() * 0.5F + 0.5F) * 2.0F;
|
||||
}
|
||||
|
||||
protected void setScale(float partial) {
|
||||
}
|
||||
|
||||
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
this.setScale(partial);
|
||||
float f = (float)this.textureU / 8.0F;
|
||||
float f1 = f + 1.0f / 8.0f;
|
||||
float f2 = (float)this.textureV / 4.0F;
|
||||
float f3 = f2 + 1.0f / 4.0f;
|
||||
float f4 = 0.1F * this.scale;
|
||||
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partial - interpPosX);
|
||||
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partial - interpPosY);
|
||||
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partial - interpPosZ);
|
||||
int i = this.getBrightness(partial);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
rb.pos((double)(f5 - rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 - rotYZ * f4 - rotXZ * f4)).tex((double)f1, (double)f3)
|
||||
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
|
||||
rb.pos((double)(f5 - rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 - rotYZ * f4 + rotXZ * f4)).tex((double)f1, (double)f2)
|
||||
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
|
||||
rb.pos((double)(f5 + rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 + rotYZ * f4 + rotXZ * f4)).tex((double)f, (double)f2)
|
||||
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
|
||||
rb.pos((double)(f5 + rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 + rotYZ * f4 - rotXZ * f4)).tex((double)f, (double)f3)
|
||||
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
public final int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected final void setUV(int x, int y) {
|
||||
this.textureU = x;
|
||||
this.textureV = y;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityPortalFX extends EntityFX
|
||||
public class EntityPortalFX extends EntityParticleFX
|
||||
{
|
||||
private float portalParticleScale;
|
||||
private double portalPosX;
|
||||
|
@ -21,33 +19,31 @@ public class EntityPortalFX extends EntityFX
|
|||
this.portalPosY = this.posY = yCoordIn;
|
||||
this.portalPosZ = this.posZ = zCoordIn;
|
||||
float f = this.rand.floatv() * 0.6F + 0.4F;
|
||||
this.portalParticleScale = this.particleScale = this.rand.floatv() * 0.2F + 0.5F;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f;
|
||||
this.particleGreen *= 0.1F;
|
||||
this.particleRed *= 0.2F;
|
||||
this.particleBlue *= 0.25F;
|
||||
this.particleMaxAge = (int)(Math.random() * 10.0D) + 40;
|
||||
this.noClip = true;
|
||||
this.setParticleTextureIndex((int)(Math.random() * 8.0D));
|
||||
this.portalParticleScale = this.scale = this.rand.floatv() * 0.2F + 0.5F;
|
||||
this.red = this.green = this.blue = 1.0F * f;
|
||||
this.green *= 0.1F;
|
||||
this.red *= 0.2F;
|
||||
this.blue *= 0.25F;
|
||||
this.lifetime = (int)(Math.random() * 10.0D) + 40;
|
||||
this.setUV((int)(Math.random() * 8.0D), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
|
||||
f = 1.0F - f;
|
||||
f = f * f;
|
||||
f = 1.0F - f;
|
||||
this.particleScale = this.portalParticleScale * f;
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.scale = this.portalParticleScale * f;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float partialTicks)
|
||||
public int getBrightness(float partialTicks)
|
||||
{
|
||||
int i = super.getBrightnessForRender(partialTicks);
|
||||
float f = (float)this.particleAge / (float)this.particleMaxAge;
|
||||
int i = super.getBrightness(partialTicks);
|
||||
float f = (float)this.age / (float)this.lifetime;
|
||||
f = f * f;
|
||||
f = f * f;
|
||||
int j = i & 255;
|
||||
|
@ -62,36 +58,26 @@ public class EntityPortalFX extends EntityFX
|
|||
return j | k << 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how bright this entity is.
|
||||
*/
|
||||
public float getBrightness(float partialTicks)
|
||||
{
|
||||
float f = super.getBrightness(partialTicks);
|
||||
float f1 = (float)this.particleAge / (float)this.particleMaxAge;
|
||||
f1 = f1 * f1 * f1 * f1;
|
||||
return f * (1.0F - f1) + f1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
float f = (float)this.particleAge / (float)this.particleMaxAge;
|
||||
float f = (float)this.age / (float)this.lifetime;
|
||||
f = -f + f * f * 2.0F;
|
||||
f = 1.0F - f;
|
||||
this.posX = this.portalPosX + this.motionX * (double)f;
|
||||
this.posY = this.portalPosY + this.motionY * (double)f + (double)(1.0F - f);
|
||||
this.posZ = this.portalPosZ + this.motionZ * (double)f;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityReddustFX extends EntityFX
|
||||
public class EntityReddustFX extends EntityParticleFX
|
||||
{
|
||||
float reddustParticleScale;
|
||||
|
||||
|
@ -27,43 +25,41 @@ public class EntityReddustFX extends EntityFX
|
|||
}
|
||||
|
||||
float f = (float)Math.random() * 0.4F + 0.6F;
|
||||
this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_9_ * f;
|
||||
this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_10_ * f;
|
||||
this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_11_ * f;
|
||||
this.particleScale *= 0.75F;
|
||||
this.particleScale *= p_i46350_8_;
|
||||
this.reddustParticleScale = this.particleScale;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46350_8_);
|
||||
this.noClip = false;
|
||||
this.red = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_9_ * f;
|
||||
this.green = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_10_ * f;
|
||||
this.blue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_11_ * f;
|
||||
this.scale *= 0.75F;
|
||||
this.scale *= p_i46350_8_;
|
||||
this.reddustParticleScale = this.scale;
|
||||
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.lifetime = (int)((float)this.lifetime * p_i46350_8_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
this.particleScale = this.reddustParticleScale * f;
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.scale = this.reddustParticleScale * f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
|
||||
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.posY == this.prevY)
|
||||
|
@ -75,12 +71,7 @@ public class EntityReddustFX extends EntityFX
|
|||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntitySmokeFX extends EntityFX
|
||||
public class EntitySmokeFX extends EntityParticleFX
|
||||
{
|
||||
float smokeParticleScale;
|
||||
|
||||
|
@ -23,41 +21,39 @@ public class EntitySmokeFX extends EntityFX
|
|||
this.motionX += p_i46348_8_;
|
||||
this.motionY += p_i46348_10_;
|
||||
this.motionZ += p_i46348_12_;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
|
||||
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_);
|
||||
this.noClip = false;
|
||||
this.red = this.green = this.blue = (float)(Math.random() * 0.30000001192092896D);
|
||||
this.scale *= 0.75F;
|
||||
this.scale *= p_i46348_14_;
|
||||
this.smokeParticleScale = this.scale;
|
||||
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.lifetime = (int)((float)this.lifetime * p_i46348_14_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
protected void setScale(float partialTicks)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
this.particleScale = this.smokeParticleScale * f;
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.scale = this.smokeParticleScale * f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
|
||||
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
|
||||
this.motionY += 0.004D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
|
@ -70,12 +66,7 @@ public class EntitySmokeFX extends EntityFX
|
|||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
import common.entity.Entity;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntitySpellParticleFX extends EntityFX
|
||||
public class EntitySpellParticleFX extends EntityParticleFX
|
||||
{
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
|
@ -21,36 +18,36 @@ public class EntitySpellParticleFX extends EntityFX
|
|||
this.motionZ *= 0.10000000149011612D;
|
||||
}
|
||||
|
||||
this.particleScale *= 0.75F;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.noClip = false;
|
||||
this.scale *= 0.75F;
|
||||
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the particle
|
||||
*/
|
||||
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
||||
|
||||
public void setParameter(float particleRedIn, float particleGreenIn, float particleBlueIn, float multiplier)
|
||||
{
|
||||
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
f = ExtMath.clampf(f, 0.0F, 1.0F);
|
||||
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
this.motionX *= (double)multiplier;
|
||||
this.motionY = (this.motionY - 0.10000000149011612D) * (double)multiplier + 0.10000000149011612D;
|
||||
this.motionZ *= (double)multiplier;
|
||||
float f3 = 0.75F + this.rand.floatv() * 0.25F;
|
||||
this.red = particleRedIn * f3;
|
||||
this.green = particleGreenIn * f3;
|
||||
this.blue = particleBlueIn * f3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
if (this.age++ >= this.lifetime)
|
||||
{
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
this.setParticleTextureIndex(144 + (7 - this.particleAge * 8 / this.particleMaxAge));
|
||||
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 3);
|
||||
this.motionY += 0.004D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
|
@ -63,12 +60,7 @@ public class EntitySpellParticleFX extends EntityFX
|
|||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements IParticleFactory
|
||||
|
|
|
@ -6,9 +6,9 @@ public class EntitySplashFX extends EntityDownfallFX
|
|||
{
|
||||
protected EntitySplashFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
|
||||
{
|
||||
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0, 3);
|
||||
this.particleGravity = 0.04F;
|
||||
this.nextTextureIndexX();
|
||||
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0);
|
||||
this.gravity = 0.04F;
|
||||
this.setUV(1 + this.rand.zrange(3), 1);
|
||||
|
||||
if (ySpeedIn == 0.0D && (xSpeedIn != 0.0D || zSpeedIn != 0.0D))
|
||||
{
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.DefaultVertexFormats;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.ItemRenderer;
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.renderer.Tessellator;
|
||||
import client.renderer.VertexFormat;
|
||||
import client.renderer.texture.TextureManager;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityTexturedFX extends EntityFX {
|
||||
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 final String texture;
|
||||
private final float scale;
|
||||
private final float brightness;
|
||||
private final double posX;
|
||||
private final double posY;
|
||||
private final double posZ;
|
||||
|
||||
private int age;
|
||||
private int lifetime;
|
||||
private TextureManager manager;
|
||||
|
||||
protected EntityTexturedFX(TextureManager manager, double x, double y, double z, double scale, String texture) {
|
||||
this.manager = manager;
|
||||
this.lifetime = 6 + this.rand.zrange(4);
|
||||
this.brightness = this.rand.floatv() * 0.6F + 0.4F;
|
||||
this.scale = (float)scale;
|
||||
this.texture = texture;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
}
|
||||
|
||||
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
int i = (int)(((float)this.age + partial) * 15.0F / (float)this.lifetime);
|
||||
|
||||
if(i <= 15) {
|
||||
this.manager.bindTexture(this.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 * (1.0F - this.scale * 0.5F);
|
||||
float f5 = (float)(this.posX - interpPosX);
|
||||
float f6 = (float)(this.posY - interpPosY);
|
||||
float f7 = (float)(this.posZ - interpPosZ);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlState.disableLighting();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
rb.begin(GL11.GL_QUADS, VERTEX_FORMAT);
|
||||
rb.pos((double)(f5 - rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 - rotYZ * f4 - rotXZ * f4))
|
||||
.tex((double)f1, (double)f3).color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240)
|
||||
.normal(0.0F, 1.0F, 0.0F).endVertex();
|
||||
rb.pos((double)(f5 - rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 - rotYZ * f4 + rotXZ * f4))
|
||||
.tex((double)f1, (double)f2).color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240)
|
||||
.normal(0.0F, 1.0F, 0.0F).endVertex();
|
||||
rb.pos((double)(f5 + rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 + rotYZ * f4 + rotXZ * f4)).tex((double)f, (double)f2)
|
||||
.color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
|
||||
rb.pos((double)(f5 + rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 + rotYZ * f4 - rotXZ * f4)).tex((double)f, (double)f3)
|
||||
.color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
|
||||
Tessellator.draw();
|
||||
GlState.enableLighting();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean onUpdate() {
|
||||
if(++this.age >= this.lifetime)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public final int getFXLayer() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static class ExplodeFactory implements IParticleFactory {
|
||||
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn,
|
||||
double zSpeedIn, int data) {
|
||||
return new EntityTexturedFX(Client.CLIENT.getTextureManager(), xCoordIn, yCoordIn, zCoordIn, xSpeedIn, "textures/entity/explosion.png");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import client.renderer.RenderBuffer;
|
||||
|
||||
public abstract class EntityTickedFX extends EntityFX {
|
||||
private final int amount;
|
||||
|
||||
protected EntityTickedFX(int amount, int lifetime) {
|
||||
this.amount = amount;
|
||||
this.lifetime = lifetime;
|
||||
}
|
||||
|
||||
public final boolean onUpdate() {
|
||||
for(int z = 0; z < this.amount; z++) {
|
||||
this.spawnParticle();
|
||||
}
|
||||
if(++this.age >= this.lifetime)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public final int getFXLayer() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
}
|
||||
|
||||
protected abstract void spawnParticle();
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityWorldFX extends EntityFX
|
||||
{
|
||||
protected final World world;
|
||||
|
||||
protected double prevX;
|
||||
protected double prevY;
|
||||
protected double prevZ;
|
||||
protected double posX;
|
||||
protected double posY;
|
||||
protected double posZ;
|
||||
protected double motionX;
|
||||
protected double motionY;
|
||||
protected double motionZ;
|
||||
|
||||
protected float gravity;
|
||||
|
||||
protected EntityWorldFX(World worldIn, double posXIn, double posYIn, double posZIn)
|
||||
{
|
||||
this.world = worldIn;
|
||||
this.posX = this.prevX = posXIn;
|
||||
this.posY = this.prevY = posYIn;
|
||||
this.posZ = this.prevZ = posZIn;
|
||||
this.lifetime = (int)(4.0F / (this.rand.floatv() * 0.9F + 0.1F));
|
||||
this.age = 0;
|
||||
}
|
||||
|
||||
public EntityWorldFX(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 = ExtMath.sqrtd(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 final void moveEntity(double x, double y, double z)
|
||||
{
|
||||
this.posX += x;
|
||||
this.posY += y;
|
||||
this.posZ += z;
|
||||
}
|
||||
|
||||
public int getBrightness(float partial)
|
||||
{
|
||||
BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
return this.world.isBlockLoaded(pos) ? this.world.getCombinedLight(pos, 0) : 0;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.util.Set;
|
|||
|
||||
import client.Client;
|
||||
import client.renderer.particle.EntityFX;
|
||||
import client.renderer.particle.EntitySpellParticleFX;
|
||||
import common.biome.Biome;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
|
@ -622,7 +623,7 @@ public class WorldClient extends AWorldClient
|
|||
double d8 = (double)l * d20 + this.rand.gaussian() * 0.01D;
|
||||
double d10 = -0.03D + this.rand.gaussian() * 0.01D;
|
||||
double d12 = (double)i * d20 + this.rand.gaussian() * 0.01D;
|
||||
this.spawnEntityFX(ParticleType.SMOKE, ParticleType.SMOKE.isUnlimited(), d21, d4, d6, d8, d10, d12, 0);
|
||||
this.spawnParticle(ParticleType.SMOKE, d21, d4, d6, d8, d10, d12);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -645,10 +646,9 @@ public class WorldClient extends AWorldClient
|
|||
|
||||
for (int i1 = 0; i1 < 8; ++i1)
|
||||
{
|
||||
this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.isUnlimited(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.potion));
|
||||
this.spawnParticle(ParticleType.ITEM_CRACK, d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.potion));
|
||||
}
|
||||
|
||||
ParticleType enumparticletypes = ParticleType.SPLASH;
|
||||
float f = 1.0F;
|
||||
float f1 = 1.0F;
|
||||
float f2 = 1.0F;
|
||||
|
@ -658,7 +658,6 @@ public class WorldClient extends AWorldClient
|
|||
f = (float)(j1 >> 16 & 255) / 255.0F;
|
||||
f1 = (float)(j1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float)(j1 >> 0 & 255) / 255.0F;
|
||||
enumparticletypes = ParticleType.POTION;
|
||||
}
|
||||
|
||||
for (int l1 = 0; l1 < 100; ++l1)
|
||||
|
@ -668,15 +667,11 @@ public class WorldClient extends AWorldClient
|
|||
double d24 = Math.cos(d23) * d22;
|
||||
double d9 = 0.01D + this.rand.doublev() * 0.5D;
|
||||
double d11 = Math.sin(d23) * d22;
|
||||
EntityFX entityfx = this.spawnEntityFX(enumparticletypes, enumparticletypes.isUnlimited(), d13 + d24 * 0.1D, d14 + 0.3D, d16 + d11 * 0.1D, d24, d9, d11, 0);
|
||||
EntityFX entityfx = this.spawnEntityFX(ParticleType.POTION, ParticleType.POTION.isUnlimited(), d13 + d24 * 0.1D, d14 + 0.3D, d16 + d11 * 0.1D, d24, d9, d11, 0);
|
||||
|
||||
if (entityfx != null)
|
||||
if (entityfx instanceof EntitySpellParticleFX spell)
|
||||
{
|
||||
if(enumparticletypes != ParticleType.SPLASH) {
|
||||
float f3 = 0.75F + this.rand.floatv() * 0.25F;
|
||||
entityfx.setRBGColorF(f * f3, f1 * f3, f2 * f3);
|
||||
}
|
||||
entityfx.multiplyVelocity((float)d22);
|
||||
spell.setParameter(f, f1, f2, (float)d22);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Add table
Add a link
Reference in a new issue