initial commit

This commit is contained in:
Sen 2025-03-11 00:23:54 +01:00 committed by Sen
parent 3c9ee26b06
commit 22186c33b9
1458 changed files with 282792 additions and 0 deletions

View file

@ -0,0 +1,428 @@
package game.renderer.particle;
import java.util.List;
import java.util.Map;
import game.ExtMath;
import game.block.Block;
import game.collect.Lists;
import game.collect.Maps;
import game.entity.Entity;
import game.material.Material;
import game.renderer.ActiveRenderInfo;
import game.renderer.DefaultVertexFormats;
import game.renderer.GlState;
import game.renderer.RenderBuffer;
import game.renderer.Tessellator;
import game.renderer.texture.TextureManager;
import game.renderer.texture.TextureMap;
import game.rng.Random;
import game.world.BlockPos;
import game.world.Facing;
import game.world.State;
import game.world.World;
public class EffectRenderer
{
public static final String particleTextures = "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 TextureManager renderer;
/** RNG. */
private Random rand = new Random();
private Map<Integer, IParticleFactory> particleTypes = Maps.<Integer, IParticleFactory>newHashMap();
public EffectRenderer(World worldIn, TextureManager rendererIn)
{
this.worldObj = worldIn;
this.renderer = rendererIn;
for (int i = 0; i < 4; ++i)
{
this.fxLayers[i] = new List[2];
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j] = Lists.newArrayList();
}
}
this.registerVanillaParticles();
}
private void registerVanillaParticles()
{
this.registerParticle(ParticleType.EXPLOSION_NORMAL.getParticleID(), new EntityExplodeFX.Factory());
this.registerParticle(ParticleType.WATER_BUBBLE.getParticleID(), new EntityBubbleFX.Factory());
this.registerParticle(ParticleType.WATER_SPLASH.getParticleID(), new EntitySplashFX.Factory());
this.registerParticle(ParticleType.WATER_WAKE.getParticleID(), new EntityFishWakeFX.Factory());
this.registerParticle(ParticleType.WATER_DROP.getParticleID(), new EntityDownfallFX.RainFactory());
this.registerParticle(ParticleType.SUSPENDED.getParticleID(), new EntitySuspendFX.Factory());
this.registerParticle(ParticleType.SUSPENDED_DEPTH.getParticleID(), new EntityAuraFX.SuspendFactory());
this.registerParticle(ParticleType.CRIT.getParticleID(), new EntityCrit2FX.Factory());
this.registerParticle(ParticleType.CRIT_MAGIC.getParticleID(), new EntityCrit2FX.MagicFactory());
this.registerParticle(ParticleType.SMOKE_NORMAL.getParticleID(), new EntitySmokeFX.Factory());
this.registerParticle(ParticleType.SMOKE_LARGE.getParticleID(), new EntityCritFX.Factory());
this.registerParticle(ParticleType.SPELL.getParticleID(), new EntitySpellParticleFX.Factory());
this.registerParticle(ParticleType.SPELL_INSTANT.getParticleID(), new EntitySpellParticleFX.InstantFactory());
this.registerParticle(ParticleType.SPELL_MOB.getParticleID(), new EntitySpellParticleFX.MobFactory());
this.registerParticle(ParticleType.SPELL_MOB_AMBIENT.getParticleID(), new EntitySpellParticleFX.AmbientMobFactory());
this.registerParticle(ParticleType.SPELL_WITCH.getParticleID(), new EntitySpellParticleFX.WitchFactory());
this.registerParticle(ParticleType.DRIP_WATER.getParticleID(), new EntityDropParticleFX.WaterFactory());
this.registerParticle(ParticleType.DRIP_LAVA.getParticleID(), new EntityDropParticleFX.LavaFactory());
// this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new EntityHeartFX.AngryVillagerFactory());
this.registerParticle(ParticleType.GROW.getParticleID(), new EntityAuraFX.GrowFactory());
this.registerParticle(ParticleType.TOWN_AURA.getParticleID(), new EntityAuraFX.Factory());
this.registerParticle(ParticleType.NOTE.getParticleID(), new EntityNoteFX.Factory());
this.registerParticle(ParticleType.PORTAL.getParticleID(), new EntityPortalFX.Factory());
this.registerParticle(ParticleType.ENCHANTMENT_TABLE.getParticleID(), new EntityEnchantmentTableParticleFX.EnchantmentTable());
this.registerParticle(ParticleType.FLAME.getParticleID(), new EntityFlameFX.Factory());
this.registerParticle(ParticleType.LAVA.getParticleID(), new EntityLavaFX.Factory());
this.registerParticle(ParticleType.FOOTSTEP.getParticleID(), new EntityFootStepFX.Factory());
this.registerParticle(ParticleType.CLOUD.getParticleID(), new EntityCloudFX.Factory());
this.registerParticle(ParticleType.REDSTONE.getParticleID(), new EntityReddustFX.Factory());
this.registerParticle(ParticleType.SNOWBALL.getParticleID(), new EntityBreakingFX.SnowballFactory());
this.registerParticle(ParticleType.SNOW_SHOVEL.getParticleID(), new EntitySnowShovelFX.Factory());
this.registerParticle(ParticleType.SLIME.getParticleID(), new EntityBreakingFX.SlimeFactory());
this.registerParticle(ParticleType.HEART.getParticleID(), new EntityHeartFX.Factory());
// this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory());
this.registerParticle(ParticleType.ITEM_CRACK.getParticleID(), new EntityBreakingFX.Factory());
this.registerParticle(ParticleType.BLOCK_CRACK.getParticleID(), new EntityDiggingFX.Factory());
this.registerParticle(ParticleType.BLOCK_DUST.getParticleID(), new EntityBlockDustFX.Factory());
this.registerParticle(ParticleType.EXPLOSION_HUGE.getParticleID(), new EntityHugeExplodeFX.Factory());
this.registerParticle(ParticleType.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory());
this.registerParticle(ParticleType.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory());
this.registerParticle(ParticleType.HAIL_CORN.getParticleID(), new EntityDownfallFX.HailFactory());
}
public void registerParticle(int id, IParticleFactory particleFactory)
{
this.particleTypes.put(Integer.valueOf(id), particleFactory);
}
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes)
{
this.particleEmitters.add(new EntityParticleEmitter(this.worldObj, entityIn, particleTypes));
}
/**
* Spawns the relevant particle according to the particle id.
*
* @param xCoord X position of the particle
* @param yCoord Y position of the particle
* @param zCoord Z position of the particle
* @param xSpeed X speed of the particle
* @param ySpeed Y speed of the particle
* @param zSpeed Z speed of the particle
* @param parameters Parameters for the particle (color for redstone, ...)
*/
public EntityFX spawnEffectParticle(int particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int[] parameters)
{
IParticleFactory iparticlefactory = (IParticleFactory)this.particleTypes.get(Integer.valueOf(particleId));
if (iparticlefactory != null)
{
EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
if (entityfx != null)
{
this.addEffect(entityfx);
return entityfx;
}
}
return null;
}
public 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);
}
public void updateEffects()
{
for (int i = 0; i < 4; ++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]);
}
}
private void updateEffectAlphaLayer(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)
{
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 = ActiveRenderInfo.getRotationX();
float f1 = ActiveRenderInfo.getRotationZ();
float f2 = ActiveRenderInfo.getRotationYZ();
float f3 = ActiveRenderInfo.getRotationXY();
float f4 = ActiveRenderInfo.getRotationXZ();
EntityFX.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
EntityFX.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
EntityFX.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
GlState.enableBlend();
GlState.blendFunc(770, 771);
GlState.alphaFunc(516, 0.003921569F);
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 2; ++j)
{
final int i_f = i;
if (!this.fxLayers[i][j].isEmpty())
{
switch (j)
{
case 0:
GlState.depthMask(false);
break;
case 1:
GlState.depthMask(true);
}
switch (i)
{
case 0:
default:
this.renderer.bindTexture(particleTextures);
break;
case 1:
this.renderer.bindTexture(TextureMap.locationBlocksTexture);
}
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(7, 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();
}
}
}
GlState.depthMask(true);
GlState.disableBlend();
GlState.alphaFunc(516, 0.1F);
}
public void renderLitParticles(Entity entityIn, float partialTick)
{
float f = 0.017453292F;
float f1 = ExtMath.cos(entityIn.rotYaw * 0.017453292F);
float f2 = ExtMath.sin(entityIn.rotYaw * 0.017453292F);
float f3 = -f2 * ExtMath.sin(entityIn.rotPitch * 0.017453292F);
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[3][i];
if (!list.isEmpty())
{
// 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);
}
}
}
}
public void clearEffects(World worldIn)
{
this.worldObj = worldIn;
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j].clear();
}
}
this.particleEmitters.clear();
}
public void addBlockDestroyEffects(BlockPos pos, State state)
{
if (state.getBlock().getMaterial() != Material.air)
{
state = state.getBlock().getActualState(state, this.worldObj, pos);
int i = 4;
for (int j = 0; j < i; ++j)
{
for (int k = 0; k < i; ++k)
{
for (int l = 0; l < i; ++l)
{
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));
}
}
}
}
}
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, Facing side)
{
State iblockstate = this.worldObj.getState(pos);
Block block = iblockstate.getBlock();
if (block.getRenderType() != -1)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
double d0 = (double)i + this.rand.doublev() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinX();
double d1 = (double)j + this.rand.doublev() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinY();
double d2 = (double)k + this.rand.doublev() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinZ();
if (side == Facing.DOWN)
{
d1 = (double)j + block.getBlockBoundsMinY() - (double)f;
}
if (side == Facing.UP)
{
d1 = (double)j + block.getBlockBoundsMaxY() + (double)f;
}
if (side == Facing.NORTH)
{
d2 = (double)k + block.getBlockBoundsMinZ() - (double)f;
}
if (side == Facing.SOUTH)
{
d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f;
}
if (side == Facing.WEST)
{
d0 = (double)i + block.getBlockBoundsMinX() - (double)f;
}
if (side == Facing.EAST)
{
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);
}
}
}
public String getStatistics()
{
int i = 0;
for (int j = 0; j < 4; ++j)
{
for (int k = 0; k < 2; ++k)
{
i += this.fxLayers[j][k].size();
}
}
return "" + i;
}
}

View file

@ -0,0 +1,82 @@
package game.renderer.particle;
import game.world.World;
public class EntityAuraFX extends EntityFX
{
private final boolean fullBright;
protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn, boolean fullBright)
{
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;
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.fullBright = fullBright;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.99D;
this.motionY *= 0.99D;
this.motionZ *= 0.99D;
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public int getBrightnessForRender(float partialTicks)
{
return this.fullBright ? 15728880 : super.getBrightnessForRender(partialTicks);
}
public float getBrightness(float partialTicks)
{
return this.fullBright ? 1.0F : super.getBrightness(partialTicks);
}
public static class SuspendFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true);
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false);
}
}
public static class GrowFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
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;
}
}
}

View file

@ -0,0 +1,25 @@
package game.renderer.particle;
import game.init.BlockRegistry;
import game.world.State;
import game.world.World;
public class EntityBlockDustFX extends EntityDiggingFX
{
protected EntityBlockDustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, State state)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
State iblockstate = BlockRegistry.getStateById(p_178902_15_[0]);
return iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).calculateColor();
}
}
}

View file

@ -0,0 +1,98 @@
package game.renderer.particle;
import game.Game;
import game.entity.Entity;
import game.init.ItemRegistry;
import game.init.Items;
import game.item.Item;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityBreakingFX extends EntityFX
{
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_)
{
this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0);
}
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_)
{
this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeedIn;
this.motionY += ySpeedIn;
this.motionZ += zSpeedIn;
}
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_)
{
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
this.setParticleIcon(Game.getGame().getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_));
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(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0]), i);
}
}
public static class SlimeFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.slime_ball);
}
}
public static class SnowballFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.snowball);
}
}
}

View file

@ -0,0 +1,56 @@
package game.renderer.particle;
import game.material.Material;
import game.world.BlockPos;
import game.world.World;
public class EntityBubbleFX extends EntityFX
{
protected EntityBubbleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(32);
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.floatv() * 0.6F + 0.2F;
this.motionX = xSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionY = ySpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionZ = zSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.motionY += 0.002D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8500000238418579D;
this.motionY *= 0.8500000238418579D;
this.motionZ *= 0.8500000238418579D;
if (this.worldObj.getState(new BlockPos(this)).getBlock().getMaterial() != Material.water)
{
this.setDead();
}
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBubbleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,85 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.entity.npc.EntityNPC;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityCloudFX extends EntityFX
{
float field_70569_a;
protected EntityCloudFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1221_8_, double p_i1221_10_, double p_i1221_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
float f = 2.5F;
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i1221_8_;
this.motionY += p_i1221_10_;
this.motionZ += p_i1221_12_;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D);
this.particleScale *= 0.75F;
this.particleScale *= f;
this.field_70569_a = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D));
this.particleMaxAge = (int)((float)this.particleMaxAge * f);
this.noClip = false;
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.particleScale = this.field_70569_a * f;
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
/**
* 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
EntityNPC entityplayer = this.worldObj.getClosestPlayerToEntity(this, 2.0D);
if (entityplayer != null && this.posY > entityplayer.getEntityBoundingBox().minY)
{
this.posY += (entityplayer.getEntityBoundingBox().minY - this.posY) * 0.2D;
this.motionY += (entityplayer.motionY - this.motionY) * 0.2D;
this.setPosition(this.posX, this.posY, this.posZ);
}
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityCloudFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,95 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityCrit2FX extends EntityFX
{
float field_174839_a;
protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46284_8_, double p_i46284_10_, double p_i46284_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46284_8_, p_i46284_10_, p_i46284_12_, 1.0F);
}
protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46285_8_, double p_i46285_10_, double p_i46285_12_, float p_i46285_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i46285_8_ * 0.4D;
this.motionY += p_i46285_10_ * 0.4D;
this.motionZ += p_i46285_12_ * 0.4D;
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(65);
this.onUpdate();
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 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);
}
/**
* 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.moveEntity(this.motionX, this.motionY, this.motionZ);
this.particleGreen = (float)((double)this.particleGreen * 0.96D);
this.particleBlue = (float)((double)this.particleBlue * 0.9D);
this.motionX *= 0.699999988079071D;
this.motionY *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY -= 0.019999999552965164D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
public static class MagicFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
entityfx.setRBGColorF(entityfx.getRedColorF() * 0.3F, entityfx.getGreenColorF() * 0.8F, entityfx.getBlueColorF());
entityfx.nextTextureIndexX();
return entityfx;
}
}
}

View file

@ -0,0 +1,19 @@
package game.renderer.particle;
import game.world.World;
public class EntityCritFX extends EntitySmokeFX
{
protected EntityCritFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1201_8_, double p_i1201_10_, double p_i1201_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i1201_8_, p_i1201_10_, p_i1201_12_, 2.5F);
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityCritFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,124 @@
package game.renderer.particle;
import game.Game;
import game.block.Block;
import game.entity.Entity;
import game.init.BlockRegistry;
import game.init.Blocks;
import game.renderer.RenderBuffer;
import game.world.BlockPos;
import game.world.State;
import game.world.World;
public class EntityDiggingFX extends EntityFX
{
private State sourceState;
private BlockPos sourcePos;
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(Game.getGame().getBlockRendererDispatcher().getModelManager().getTexture(state));
this.particleGravity = 1.0F; // state.getBlock().particleGravity;
this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
this.particleScale /= 2.0F;
}
/**
* Sets the position of the block that this particle came from. Used for calculating texture and color multiplier.
*/
public EntityDiggingFX setBlockPos(BlockPos pos)
{
this.sourcePos = pos;
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(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, BlockRegistry.getStateById(p_178902_15_[0]))).calculateColor();
}
}
}

View file

@ -0,0 +1,101 @@
package game.renderer.particle;
import game.ExtMath;
import game.block.Block;
import game.block.BlockLiquid;
import game.material.Material;
import game.world.BlockPos;
import game.world.State;
import game.world.World;
public class EntityDownfallFX extends EntityFX
{
protected EntityDownfallFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, int texture, int numTex)
{
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));
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.motionY -= (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.particleMaxAge-- <= 0)
{
this.setDead();
}
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);
Block block = iblockstate.getBlock();
block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
}
else
{
d0 = block.getBlockBoundsMaxY();
}
double d1 = (double)ExtMath.floord(this.posY) + d0;
if (this.posY < d1)
{
this.setDead();
}
}
}
public static class RainFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 0, 4);
}
}
public static class HailFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 1, 4);
}
}
}

View file

@ -0,0 +1,157 @@
package game.renderer.particle;
import game.ExtMath;
import game.block.BlockLiquid;
import game.material.Material;
import game.world.BlockPos;
import game.world.State;
import game.world.World;
public class EntityDropParticleFX extends EntityFX
{
/** the material type for dropped items/blocks */
private Material materialType;
/** The height of the current bob */
private int bobTimer;
protected EntityDropParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, Material p_i1203_8_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX = this.motionY = this.motionZ = 0.0D;
if (p_i1203_8_ == Material.water)
{
this.particleRed = 0.0F;
this.particleGreen = 0.0F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 0.0F;
this.particleBlue = 0.0F;
}
this.setParticleTextureIndex(113);
this.setSize(0.01F, 0.01F);
this.particleGravity = 0.06F;
this.materialType = p_i1203_8_;
this.bobTimer = 40;
this.particleMaxAge = (int)(64.0D / (Math.random() * 0.8D + 0.2D));
this.motionX = this.motionY = this.motionZ = 0.0D;
}
public int getBrightnessForRender(float partialTicks)
{
return this.materialType == Material.water ? super.getBrightnessForRender(partialTicks) : 257;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float partialTicks)
{
return this.materialType == Material.water ? super.getBrightness(partialTicks) : 1.0F;
}
/**
* 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.materialType == Material.water)
{
this.particleRed = 0.2F;
this.particleGreen = 0.3F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8);
}
this.motionY -= (double)this.particleGravity;
if (this.bobTimer-- > 0)
{
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
this.setParticleTextureIndex(113);
}
else
{
this.setParticleTextureIndex(112);
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
if (this.onGround)
{
if (this.materialType == Material.water)
{
this.setDead();
this.worldObj.spawnParticle(ParticleType.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
else
{
this.setParticleTextureIndex(114);
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this);
State iblockstate = this.worldObj.getState(blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue());
}
double d1 = (double)(ExtMath.floord(this.posY) + 1) - d0;
if (this.posY < d1)
{
this.setDead();
}
}
}
public static class LavaFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.lava);
}
}
public static class WaterFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.water);
}
}
}

View file

@ -0,0 +1,94 @@
package game.renderer.particle;
import game.world.World;
public class EntityEnchantmentTableParticleFX extends EntityFX
{
private float field_70565_a;
private double coordX;
private double coordY;
private double coordZ;
protected EntityEnchantmentTableParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
this.coordX = xCoordIn;
this.coordY = yCoordIn;
this.coordZ = zCoordIn;
this.posX = this.prevX = xCoordIn + xSpeedIn;
this.posY = this.prevY = yCoordIn + ySpeedIn;
this.posZ = this.prevZ = zCoordIn + zSpeedIn;
float f = this.rand.floatv() * 0.6F + 0.4F;
this.field_70565_a = this.particleScale = this.rand.floatv() * 0.5F + 0.2F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f;
this.particleGreen *= 0.9F;
this.particleRed *= 0.9F;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 30;
this.noClip = true;
this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D));
}
public int getBrightnessForRender(float partialTicks)
{
int i = super.getBrightnessForRender(partialTicks);
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = f * f;
f = f * f;
int j = i & 255;
int k = i >> 16 & 255;
k = k + (int)(f * 15.0F * 16.0F);
if (k > 240)
{
k = 240;
}
return j | k << 16;
}
/**
* 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 * f1;
return f * (1.0F - f1) + f1;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = 1.0F - f;
float f1 = 1.0F - f;
f1 = f1 * f1;
f1 = f1 * f1;
this.posX = this.coordX + this.motionX * (double)f;
this.posY = this.coordY + this.motionY * (double)f - (double)(f1 * 1.2F);
this.posZ = this.coordZ + this.motionZ * (double)f;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
}
public static class EnchantmentTable implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityEnchantmentTableParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,53 @@
package game.renderer.particle;
import game.world.World;
public class EntityExplodeFX extends EntityFX
{
protected EntityExplodeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
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;
}
/**
* 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
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;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,285 @@
package game.renderer.particle;
import game.ExtMath;
import game.Game;
import game.entity.Entity;
import game.nbt.NBTTagCompound;
import game.renderer.RenderBuffer;
import game.renderer.texture.TextureAtlasSprite;
import game.world.World;
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;
/** The red amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */
protected float particleRed;
/**
* The green amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0.
*/
protected float particleGreen;
/**
* The blue amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0.
*/
protected float particleBlue;
/** Particle alpha */
protected float particleAlpha;
/** 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)
{
Game.getGame().effectRenderer.moveToAlphaLayer(this);
}
else if (this.particleAlpha < 1.0F && alpha == 1.0F)
{
Game.getGame().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 to NBT.
*/
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
}
/**
* 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;
}
}

View file

@ -0,0 +1,443 @@
package game.renderer.particle;
import game.ExtMath;
import game.Game;
import game.entity.Entity;
import game.init.SoundEvent;
import game.item.ItemDye;
import game.nbt.NBTTagCompound;
import game.nbt.NBTTagList;
import game.renderer.RenderBuffer;
import game.world.BoundingBox;
import game.world.World;
import game.world.WorldClient;
public class EntityFirework
{
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Game.getGame().effectRenderer);
entityfirework$sparkfx.setAlphaF(0.99F);
return entityfirework$sparkfx;
}
}
public static class OverlayFX extends EntityFX
{
protected OverlayFX(World p_i46466_1_, double p_i46466_2_, double p_i46466_4_, double p_i46466_6_)
{
super(p_i46466_1_, p_i46466_2_, p_i46466_4_, p_i46466_6_);
this.particleMaxAge = 4;
}
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = 0.25F;
float f1 = 0.5F;
float f2 = 0.125F;
float f3 = 0.375F;
float f4 = 7.1F * ExtMath.sin(((float)this.particleAge + partialTicks - 1.0F) * 0.25F * (float)Math.PI);
this.particleAlpha = 0.6F - ((float)this.particleAge + partialTicks - 1.0F) * 0.25F * 0.5F;
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(0.5D, 0.375D).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(0.5D, 0.125D).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(0.25D, 0.125D).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(0.25D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
}
}
public static class SparkFX extends EntityFX
{
private int baseTextureIndex = 160;
private boolean trail;
private boolean twinkle;
private final EffectRenderer field_92047_az;
private float fadeColourRed;
private float fadeColourGreen;
private float fadeColourBlue;
private boolean hasFadeColour;
public SparkFX(World p_i46465_1_, double p_i46465_2_, double p_i46465_4_, double p_i46465_6_, double p_i46465_8_, double p_i46465_10_, double p_i46465_12_, EffectRenderer p_i46465_14_)
{
super(p_i46465_1_, p_i46465_2_, p_i46465_4_, p_i46465_6_);
this.motionX = p_i46465_8_;
this.motionY = p_i46465_10_;
this.motionZ = p_i46465_12_;
this.field_92047_az = p_i46465_14_;
this.particleScale *= 0.75F;
this.particleMaxAge = 48 + this.rand.zrange(12);
this.noClip = false;
}
public void setTrail(boolean trailIn)
{
this.trail = trailIn;
}
public void setTwinkle(boolean twinkleIn)
{
this.twinkle = twinkleIn;
}
public void setColour(int colour)
{
float f = (float)((colour & 16711680) >> 16) / 255.0F;
float f1 = (float)((colour & 65280) >> 8) / 255.0F;
float f2 = (float)((colour & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * f3, f1 * f3, f2 * f3);
}
public void setFadeColour(int faceColour)
{
this.fadeColourRed = (float)((faceColour & 16711680) >> 16) / 255.0F;
this.fadeColourGreen = (float)((faceColour & 65280) >> 8) / 255.0F;
this.fadeColourBlue = (float)((faceColour & 255) >> 0) / 255.0F;
this.hasFadeColour = true;
}
public BoundingBox getCollisionBoundingBox()
{
return null;
}
public boolean canBePushed()
{
return false;
}
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
if (!this.twinkle || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
}
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
if (this.hasFadeColour)
{
this.particleRed += (this.fadeColourRed - this.particleRed) * 0.2F;
this.particleGreen += (this.fadeColourGreen - this.particleGreen) * 0.2F;
this.particleBlue += (this.fadeColourBlue - this.particleBlue) * 0.2F;
}
}
this.setParticleTextureIndex(this.baseTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
this.motionY -= 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
if (this.trail && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az);
entityfirework$sparkfx.setAlphaF(0.99F);
entityfirework$sparkfx.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
entityfirework$sparkfx.particleAge = entityfirework$sparkfx.particleMaxAge / 2;
if (this.hasFadeColour)
{
entityfirework$sparkfx.hasFadeColour = true;
entityfirework$sparkfx.fadeColourRed = this.fadeColourRed;
entityfirework$sparkfx.fadeColourGreen = this.fadeColourGreen;
entityfirework$sparkfx.fadeColourBlue = this.fadeColourBlue;
}
entityfirework$sparkfx.twinkle = this.twinkle;
this.field_92047_az.addEffect(entityfirework$sparkfx);
}
}
public int getBrightnessForRender(float partialTicks)
{
return 15728880;
}
public float getBrightness(float partialTicks)
{
return 1.0F;
}
}
public static class StarterFX extends EntityFX
{
private int fireworkAge;
private final EffectRenderer theEffectRenderer;
private NBTTagList fireworkExplosions;
boolean twinkle;
public StarterFX(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, EffectRenderer p_i46464_14_, NBTTagCompound p_i46464_15_)
{
super(p_i46464_1_, p_i46464_2_, p_i46464_4_, p_i46464_6_, 0.0D, 0.0D, 0.0D);
this.motionX = p_i46464_8_;
this.motionY = p_i46464_10_;
this.motionZ = p_i46464_12_;
this.theEffectRenderer = p_i46464_14_;
this.particleMaxAge = 8;
if (p_i46464_15_ != null)
{
this.fireworkExplosions = p_i46464_15_.getTagList("Explosions", 10);
if (this.fireworkExplosions.tagCount() == 0)
{
this.fireworkExplosions = null;
}
else
{
this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1;
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
if (nbttagcompound.getBoolean("Flicker"))
{
this.twinkle = true;
this.particleMaxAge += 15;
break;
}
}
}
}
}
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
}
public void onUpdate()
{
if (this.fireworkAge == 0 && this.fireworkExplosions != null)
{
boolean flag = this.isFarAway();
boolean flag1 = false;
if (this.fireworkExplosions.tagCount() >= 3)
{
flag1 = true;
}
else
{
for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i);
if (nbttagcompound.getByte("Type") == 1)
{
flag1 = true;
break;
}
}
}
SoundEvent s1 = flag1 ? (flag ? SoundEvent.BLAST_LARGE_FAR : SoundEvent.BLAST_LARGE) :
(flag ? SoundEvent.BLAST_SMALL_FAR : SoundEvent.BLAST_SMALL);
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s1, 20.0F, 0.95F + this.rand.floatv() * 0.1F);
}
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.tagCount())
{
int k = this.fireworkAge / 2;
NBTTagCompound nbttagcompound1 = this.fireworkExplosions.getCompoundTagAt(k);
int l = nbttagcompound1.getByte("Type");
boolean flag4 = nbttagcompound1.getBoolean("Trail");
boolean flag2 = nbttagcompound1.getBoolean("Flicker");
int[] aint = nbttagcompound1.getIntArray("Colors");
int[] aint1 = nbttagcompound1.getIntArray("FadeColors");
if (aint.length == 0)
{
aint = new int[] {ItemDye.dyeColors[0]};
}
if (l == 1)
{
this.createBall(0.5D, 4, aint, aint1, flag4, flag2);
}
else if (l == 2)
{
this.createShaped(0.5D, new double[][] {
{0.0D, 1.0D}, {0.3455D, 0.309D}, {0.9511D, 0.309D}, {0.3795918367346939D, -0.12653061224489795D},
{0.6122448979591837D, -0.8040816326530612D}, {0.0D, -0.35918367346938773D}
}, aint, aint1, flag4, flag2, false, 4);
}
else if (l == 3)
{
this.createShaped(0.5D, new double[][] {
{0.187 - 0.5, 1.0 - 0.016}, {1.0 - 0.5, 1.0 - 0.625}, {0.0 - 0.5, 1.0 - 0.625},
{0.812 - 0.5, 1.0 - 0.016}, {0.5 - 0.5, 1.0 - 1.0}, {0.187 - 0.5, 1.0 - 0.016}
}, aint, aint1, flag4, flag2, true, 8);
}
else if (l == 4)
{
this.createBurst(aint, aint1, flag4, flag2);
}
else
{
this.createBall(0.25D, 2, aint, aint1, flag4, flag2);
}
int j = aint[0];
float f = (float)((j & 16711680) >> 16) / 255.0F;
float f1 = (float)((j & 65280) >> 8) / 255.0F;
float f2 = (float)((j & 255) >> 0) / 255.0F;
EntityFirework.OverlayFX entityfirework$overlayfx = new EntityFirework.OverlayFX(this.worldObj, this.posX, this.posY, this.posZ);
entityfirework$overlayfx.setRBGColorF(f, f1, f2);
this.theEffectRenderer.addEffect(entityfirework$overlayfx);
}
++this.fireworkAge;
if (this.fireworkAge > this.particleMaxAge)
{
if (this.twinkle)
{
boolean flag3 = this.isFarAway();
SoundEvent s = flag3 ? SoundEvent.TWINKLE_FAR : SoundEvent.TWINKLE;
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s, 20.0F, 0.9F + this.rand.floatv() * 0.15F);
}
this.setDead();
}
}
private boolean isFarAway()
{
Game gm = Game.getGame();
return gm == null || gm.getRenderViewEntity() == null || gm.getRenderViewEntity().getDistanceSq(this.posX, this.posY, this.posZ) >= 256.0D;
}
private void createParticle(double p_92034_1_, double p_92034_3_, double p_92034_5_, double p_92034_7_, double p_92034_9_, double p_92034_11_, int[] p_92034_13_, int[] p_92034_14_, boolean p_92034_15_, boolean p_92034_16_)
{
EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(this.worldObj, p_92034_1_, p_92034_3_, p_92034_5_, p_92034_7_, p_92034_9_, p_92034_11_, this.theEffectRenderer);
entityfirework$sparkfx.setAlphaF(0.99F);
entityfirework$sparkfx.setTrail(p_92034_15_);
entityfirework$sparkfx.setTwinkle(p_92034_16_);
int i = this.rand.zrange(p_92034_13_.length);
entityfirework$sparkfx.setColour(p_92034_13_[i]);
if (p_92034_14_ != null && p_92034_14_.length > 0)
{
entityfirework$sparkfx.setFadeColour(p_92034_14_[this.rand.zrange(p_92034_14_.length)]);
}
this.theEffectRenderer.addEffect(entityfirework$sparkfx);
}
private void createBall(double speed, int size, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.posX;
double d1 = this.posY;
double d2 = this.posZ;
for (int i = -size; i <= size; ++i)
{
for (int j = -size; j <= size; ++j)
{
for (int k = -size; k <= size; ++k)
{
double d3 = (double)j + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d4 = (double)i + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d5 = (double)k + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d6 = (double)ExtMath.sqrtd(d3 * d3 + d4 * d4 + d5 * d5) / speed + this.rand.gaussian() * 0.05D;
this.createParticle(d0, d1, d2, d3 / d6, d4 / d6, d5 / d6, colours, fadeColours, trail, twinkleIn);
if (i != -size && i != size && j != -size && j != size)
{
k += size * 2 - 1;
}
}
}
}
}
private void createShaped(double speed, double[][] shape, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn,
boolean p_92038_8_, int div)
{
double d0 = shape[0][0];
double d1 = shape[0][1];
this.createParticle(this.posX, this.posY, this.posZ, d0 * speed, d1 * speed, 0.0D, colours, fadeColours, trail, twinkleIn);
float f = this.rand.floatv() * (float)Math.PI;
double d2 = p_92038_8_ ? 0.034D : 0.34D;
double shift = 1.0 / (double)div;
for (int i = 0; i < 3; ++i)
{
double d3 = (double)f + (double)((float)i * (float)Math.PI) * d2;
double d4 = d0;
double d5 = d1;
for (int j = 1; j < shape.length; ++j)
{
double d6 = shape[j][0];
double d7 = shape[j][1];
for (double d8 = shift; d8 <= 1.0D; d8 += shift)
{
double d9 = (d4 + (d6 - d4) * d8) * speed;
double d10 = (d5 + (d7 - d5) * d8) * speed;
double d11 = d9 * Math.sin(d3);
d9 = d9 * Math.cos(d3);
for (double d12 = -1.0D; d12 <= 1.0D; d12 += 2.0D)
{
this.createParticle(this.posX, this.posY, this.posZ, d9 * d12, d10, d11 * d12, colours, fadeColours, trail, twinkleIn);
}
}
d4 = d6;
d5 = d7;
}
}
}
private void createBurst(int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.rand.gaussian() * 0.05D;
double d1 = this.rand.gaussian() * 0.05D;
for (int i = 0; i < 70; ++i)
{
double d2 = this.motionX * 0.5D + this.rand.gaussian() * 0.15D + d0;
double d3 = this.motionZ * 0.5D + this.rand.gaussian() * 0.15D + d1;
double d4 = this.motionY * 0.5D + this.rand.doublev() * 0.5D;
this.createParticle(this.posX, this.posY, this.posZ, d2, d4, d3, colours, fadeColours, trail, twinkleIn);
}
}
public int getFXLayer()
{
return 0;
}
}
}

View file

@ -0,0 +1,56 @@
package game.renderer.particle;
import game.world.World;
public class EntityFishWakeFX extends EntityFX
{
protected EntityFishWakeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i45073_8_, double p_i45073_10_, double p_i45073_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.30000001192092896D;
this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D;
this.motionZ *= 0.30000001192092896D;
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(19);
this.setSize(0.01F, 0.01F);
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleGravity = 0.0F;
this.motionX = p_i45073_8_;
this.motionY = p_i45073_10_;
this.motionZ = p_i45073_12_;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.motionY -= (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
int i = 60 - this.particleMaxAge;
float f = (float)i * 0.001F;
this.setSize(f, f);
this.setParticleTextureIndex(19 + i % 4);
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityFishWakeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,100 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityFlameFX extends EntityFX
{
/** the scale of the flame FX */
private float flameScale;
protected EntityFlameFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = this.motionX * 0.009999999776482582D + xSpeedIn;
this.motionY = this.motionY * 0.009999999776482582D + ySpeedIn;
this.motionZ = this.motionZ * 0.009999999776482582D + zSpeedIn;
this.posX += (double)((this.rand.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);
}
/**
* 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.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);
}
public int getBrightnessForRender(float partialTicks)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
f = ExtMath.clampf(f, 0.0F, 1.0F);
int i = super.getBrightnessForRender(partialTicks);
int j = i & 255;
int k = i >> 16 & 255;
j = j + (int)(f * 15.0F * 16.0F);
if (j > 240)
{
j = 240;
}
return j | k << 16;
}
/**
* 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()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
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;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityFlameFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,92 @@
package game.renderer.particle;
import game.Game;
import game.entity.Entity;
import game.renderer.DefaultVertexFormats;
import game.renderer.GlState;
import game.renderer.RenderBuffer;
import game.renderer.Tessellator;
import game.renderer.texture.TextureManager;
import game.world.BlockPos;
import game.world.World;
public class EntityFootStepFX extends EntityFX
{
private int footstepAge;
private int footstepMaxAge;
private TextureManager currentFootSteps;
protected EntityFootStepFX(TextureManager currentFootStepsIn, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.currentFootSteps = currentFootStepsIn;
this.motionX = this.motionY = this.motionZ = 0.0D;
this.footstepMaxAge = 200;
}
/**
* Renders the particle
*/
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
double u = 2.0F / 16.0F;
double u1 = u + 0.0624375F;
double u2 = 6.0F / 16.0F;
double u3 = u2 + 0.0624375F;
float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
f = f * f;
float f1 = 2.0F - f * 2.0F;
if (f1 > 1.0F)
{
f1 = 1.0F;
}
f1 = f1 * 0.2F;
GlState.disableLighting();
float f2 = 0.125F;
float f3 = (float)(this.posX - interpPosX);
float f4 = (float)(this.posY - interpPosY);
float f5 = (float)(this.posZ - interpPosZ);
float f6 = this.worldObj.getLightBrightness(new BlockPos(this));
this.currentFootSteps.bindTexture(EffectRenderer.particleTextures);
GlState.enableBlend();
GlState.blendFunc(770, 771);
worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(u1, u3).color(f6, f6, f6, f1).endVertex();
worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(u1, u2).color(f6, f6, f6, f1).endVertex();
worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(u, u2).color(f6, f6, f6, f1).endVertex();
worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(u, u3).color(f6, f6, f6, f1).endVertex();
// Tessellator.getInstance();
Tessellator.draw();
GlState.disableBlend();
GlState.enableLighting();
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
++this.footstepAge;
if (this.footstepAge == this.footstepMaxAge)
{
this.setDead();
}
}
public int getFXLayer()
{
return 3;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityFootStepFX(Game.getGame().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View file

@ -0,0 +1,94 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityHeartFX extends EntityFX
{
float particleScaleOverTime;
protected EntityHeartFX(World worldIn, double p_i1211_2_, double p_i1211_4_, double p_i1211_6_, double p_i1211_8_, double p_i1211_10_, double p_i1211_12_)
{
this(worldIn, p_i1211_2_, p_i1211_4_, p_i1211_6_, p_i1211_8_, p_i1211_10_, p_i1211_12_, 2.0F);
}
protected EntityHeartFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46354_8_, double p_i46354_10_, double p_i46354_12_, float scale)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.009999999776482582D;
this.motionY *= 0.009999999776482582D;
this.motionZ *= 0.009999999776482582D;
this.motionY += 0.1D;
this.particleScale *= 0.75F;
this.particleScale *= scale;
this.particleScaleOverTime = this.particleScale;
this.particleMaxAge = 16;
this.noClip = false;
this.setParticleTextureIndex(80);
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 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);
}
/**
* 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.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.8600000143051147D;
this.motionY *= 0.8600000143051147D;
this.motionZ *= 0.8600000143051147D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
// public static class AngryVillagerFactory implements IParticleFactory
// {
// public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
// {
// EntityFX entityfx = new EntityHeartFX(worldIn, xCoordIn, yCoordIn + 0.5D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
// entityfx.setParticleTextureIndex(81);
// entityfx.setRBGColorF(1.0F, 1.0F, 1.0F);
// return entityfx;
// }
// }
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityHeartFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,59 @@
package game.renderer.particle;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityHugeExplodeFX extends EntityFX
{
private int timeSinceStart;
/** the maximum time for the explosion */
private int maximumTime = 8;
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(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityHugeExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,99 @@
package game.renderer.particle;
import game.Game;
import game.entity.Entity;
import game.renderer.DefaultVertexFormats;
import game.renderer.GlState;
import game.renderer.ItemRenderer;
import game.renderer.RenderBuffer;
import game.renderer.Tessellator;
import game.renderer.VertexFormat;
import game.renderer.texture.TextureManager;
import game.world.World;
public class EntityLargeExplodeFX extends EntityFX
{
private static final String EXPLOSION_TEXTURE = "textures/entity/explosion.png";
private static final VertexFormat field_181549_az = (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(7, field_181549_az);
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(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityLargeExplodeFX(Game.getGame().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,96 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityLavaFX extends EntityFX
{
private float lavaParticleScale;
protected EntityLavaFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.800000011920929D;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0.800000011920929D;
this.motionY = (double)(this.rand.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);
}
public int getBrightnessForRender(float partialTicks)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
f = ExtMath.clampf(f, 0.0F, 1.0F);
int i = super.getBrightnessForRender(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)
{
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);
}
/**
* 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();
}
float f = (float)this.particleAge / (float)this.particleMaxAge;
if (this.rand.floatv() > f)
{
this.worldObj.spawnParticle(ParticleType.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
}
this.motionY -= 0.03D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9990000128746033D;
this.motionY *= 0.9990000128746033D;
this.motionZ *= 0.9990000128746033D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityLavaFX(worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View file

@ -0,0 +1,86 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityNoteFX extends EntityFX
{
float noteParticleScale;
protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46353_8_, double p_i46353_10_, double p_i46353_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46353_8_, p_i46353_10_, p_i46353_12_, 2.0F);
}
protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1217_8_, double p_i1217_10_, double p_i1217_12_, float p_i1217_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.009999999776482582D;
this.motionY *= 0.009999999776482582D;
this.motionZ *= 0.009999999776482582D;
this.motionY += 0.2D;
this.particleRed = ExtMath.sin(((float)p_i1217_8_ + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
this.particleGreen = ExtMath.sin(((float)p_i1217_8_ + 0.33333334F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
this.particleBlue = ExtMath.sin(((float)p_i1217_8_ + 0.6666667F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
this.particleScale *= 0.75F;
this.particleScale *= p_i1217_14_;
this.noteParticleScale = this.particleScale;
this.particleMaxAge = 6;
this.noClip = false;
this.setParticleTextureIndex(64);
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.particleScale = this.noteParticleScale * f;
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
/**
* 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.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.6600000262260437D;
this.motionY *= 0.6600000262260437D;
this.motionZ *= 0.6600000262260437D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityNoteFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,66 @@
package game.renderer.particle;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
import game.world.WorldClient;
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.getShouldIgnoreRange(), xCoord, yCoord, zCoord, d0, d1 + 0.2D, d2, new int[0]);
}
}
++this.age;
if (this.age >= this.lifetime)
{
this.setDead();
}
}
public int getFXLayer()
{
return 3;
}
}

View file

@ -0,0 +1,73 @@
package game.renderer.particle;
import game.Game;
import game.WCF;
import game.entity.Entity;
import game.renderer.GlState;
import game.renderer.RenderBuffer;
import game.renderer.entity.RenderManager;
import game.world.World;
public class EntityPickupFX extends EntityFX
{
private Entity field_174840_a;
private Entity field_174843_ax;
private int age;
private int maxAge;
private float field_174841_aA;
private RenderManager field_174842_aB = Game.getGame().getRenderManager();
public EntityPickupFX(World worldIn, Entity p_i1233_2_, Entity p_i1233_3_, float p_i1233_4_)
{
super(worldIn, p_i1233_2_.posX, p_i1233_2_.posY, p_i1233_2_.posZ, p_i1233_2_.motionX, p_i1233_2_.motionY, p_i1233_2_.motionZ);
this.field_174840_a = p_i1233_2_;
this.field_174843_ax = p_i1233_3_;
this.maxAge = 3;
this.field_174841_aA = p_i1233_4_;
}
/**
* 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.age + partialTicks) / (float)this.maxAge;
f = f * f;
double d0 = this.field_174840_a.posX;
double d1 = this.field_174840_a.posY;
double d2 = this.field_174840_a.posZ;
double d3 = this.field_174843_ax.lastTickPosX + (this.field_174843_ax.posX - this.field_174843_ax.lastTickPosX) * (double)partialTicks;
double d4 = this.field_174843_ax.lastTickPosY + (this.field_174843_ax.posY - this.field_174843_ax.lastTickPosY) * (double)partialTicks + (double)this.field_174841_aA;
double d5 = this.field_174843_ax.lastTickPosZ + (this.field_174843_ax.posZ - this.field_174843_ax.lastTickPosZ) * (double)partialTicks;
double d6 = d0 + (d3 - d0) * (double)f;
double d7 = d1 + (d4 - d1) * (double)f;
double d8 = d2 + (d5 - d2) * (double)f;
int i = this.getBrightnessForRender(partialTicks);
int j = i % 65536;
int k = i / 65536;
WCF.glMultiTexCoord2f(WCF.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
d6 = d6 - interpPosX;
d7 = d7 - interpPosY;
d8 = d8 - interpPosZ;
this.field_174842_aB.renderEntity(this.field_174840_a, (double)((float)d6), (double)((float)d7), (double)((float)d8), partialTicks);
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
++this.age;
if (this.age == this.maxAge)
{
this.setDead();
}
}
public int getFXLayer()
{
return 3;
}
}

View file

@ -0,0 +1,104 @@
package game.renderer.particle;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityPortalFX extends EntityFX
{
private float portalParticleScale;
private double portalPosX;
private double portalPosY;
private double portalPosZ;
protected EntityPortalFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
this.portalPosX = this.posX = xCoordIn;
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));
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge;
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);
}
public int getBrightnessForRender(float partialTicks)
{
int i = super.getBrightnessForRender(partialTicks);
float f = (float)this.particleAge / (float)this.particleMaxAge;
f = f * f;
f = f * f;
int j = i & 255;
int k = i >> 16 & 255;
k = k + (int)(f * 15.0F * 16.0F);
if (k > 240)
{
k = 240;
}
return j | k << 16;
}
/**
* 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()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
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)
{
this.setDead();
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityPortalFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,93 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntityReddustFX extends EntityFX
{
float reddustParticleScale;
protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
}
protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46350_8_, float p_i46350_9_, float p_i46350_10_, float p_i46350_11_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
if (p_i46350_9_ == 0.0F)
{
p_i46350_9_ = 1.0F;
}
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;
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 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);
}
/**
* 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityReddustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, (float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
}
}
}

View file

@ -0,0 +1,88 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntitySmokeFX extends EntityFX
{
float smokeParticleScale;
private EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F);
}
protected EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += p_i46348_8_;
this.motionY += p_i46348_10_;
this.motionZ += p_i46348_12_;
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;
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 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);
}
/**
* 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntitySmokeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,81 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.world.World;
public class EntitySnowShovelFX extends EntityFX
{
float snowDigParticleScale;
protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, 1.0F);
}
protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, float p_i1228_14_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeedIn;
this.motionY += ySpeedIn;
this.motionZ += zSpeedIn;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D);
this.particleScale *= 0.75F;
this.particleScale *= p_i1228_14_;
this.snowDigParticleScale = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * p_i1228_14_);
this.noClip = false;
}
/**
* 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.particleScale = this.snowDigParticleScale * f;
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
/**
* 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.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY -= 0.03D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9900000095367432D;
this.motionY *= 0.9900000095367432D;
this.motionZ *= 0.9900000095367432D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntitySnowShovelFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,135 @@
package game.renderer.particle;
import game.ExtMath;
import game.entity.Entity;
import game.renderer.RenderBuffer;
import game.rng.Random;
import game.world.World;
public class EntitySpellParticleFX extends EntityFX
{
private static final Random RANDOM = new Random();
/** Base spell texture index */
private int baseSpellTextureIndex = 128;
protected EntitySpellParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.5D - RANDOM.doublev(), p_i1229_10_, 0.5D - RANDOM.doublev());
this.motionY *= 0.20000000298023224D;
if (p_i1229_8_ == 0.0D && p_i1229_12_ == 0.0D)
{
this.motionX *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
}
this.particleScale *= 0.75F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.noClip = false;
}
/**
* 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.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);
}
/**
* 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.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
/**
* Sets the base spell texture index
*/
public void setBaseSpellTextureIndex(int baseSpellTextureIndexIn)
{
this.baseSpellTextureIndex = baseSpellTextureIndexIn;
}
public static class AmbientMobFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
entityfx.setAlphaF(0.15F);
entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
return entityfx;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
public static class InstantFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144);
return entityfx;
}
}
public static class MobFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
return entityfx;
}
}
public static class WitchFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144);
float f = worldIn.rand.floatv() * 0.5F + 0.35F;
entityfx.setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
return entityfx;
}
}
}

View file

@ -0,0 +1,28 @@
package game.renderer.particle;
import game.world.World;
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();
if (ySpeedIn == 0.0D && (xSpeedIn != 0.0D || zSpeedIn != 0.0D))
{
this.motionX = xSpeedIn;
this.motionY = ySpeedIn + 0.1D;
this.motionZ = zSpeedIn;
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntitySplashFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,52 @@
package game.renderer.particle;
import game.material.Material;
import game.world.BlockPos;
import game.world.World;
public class EntitySuspendFX extends EntityFX
{
protected EntitySuspendFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn - 0.125D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.particleRed = 0.4F;
this.particleGreen = 0.4F;
this.particleBlue = 0.7F;
this.setParticleTextureIndex(0);
this.setSize(0.01F, 0.01F);
this.particleScale *= this.rand.floatv() * 0.6F + 0.2F;
this.motionX = xSpeedIn * 0.0D;
this.motionY = ySpeedIn * 0.0D;
this.motionZ = zSpeedIn * 0.0D;
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.worldObj.getState(new BlockPos(this)).getBlock().getMaterial() != Material.water)
{
this.setDead();
}
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntitySuspendFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -0,0 +1,8 @@
package game.renderer.particle;
import game.world.World;
public interface IParticleFactory
{
EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_);
}

View file

@ -0,0 +1,124 @@
package game.renderer.particle;
import java.util.List;
import java.util.Map;
import game.collect.Lists;
import game.collect.Maps;
public enum ParticleType
{
EXPLOSION_NORMAL("explode", 0, true),
EXPLOSION_LARGE("largeexplode", 1, true),
EXPLOSION_HUGE("hugeexplosion", 2, true),
FIREWORKS_SPARK("fireworksSpark", 3, false),
WATER_BUBBLE("bubble", 4, false),
WATER_SPLASH("splash", 5, false),
WATER_WAKE("wake", 6, false),
SUSPENDED("suspended", 7, false),
SUSPENDED_DEPTH("depthsuspend", 8, false),
CRIT("crit", 9, false),
CRIT_MAGIC("magicCrit", 10, false),
SMOKE_NORMAL("smoke", 11, false),
SMOKE_LARGE("largesmoke", 12, false),
SPELL("spell", 13, false),
SPELL_INSTANT("instantSpell", 14, false),
SPELL_MOB("mobSpell", 15, false),
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, false),
SPELL_WITCH("witchMagic", 17, false),
DRIP_WATER("dripWater", 18, false),
DRIP_LAVA("dripLava", 19, false),
// VILLAGER_ANGRY("angryVillager", 20, false),
GROW("grow", 21, false),
TOWN_AURA("townaura", 22, false),
NOTE("note", 23, false),
PORTAL("portal", 24, false),
ENCHANTMENT_TABLE("enchantmenttable", 25, false),
FLAME("flame", 26, false),
LAVA("lava", 27, false),
FOOTSTEP("footstep", 28, false),
CLOUD("cloud", 29, false),
REDSTONE("reddust", 30, false),
SNOWBALL("snowballpoof", 31, false),
SNOW_SHOVEL("snowshovel", 32, false),
SLIME("slime", 33, false),
HEART("heart", 34, false),
// BARRIER("barrier", 35, false),
ITEM_CRACK("iconcrack_", 36, false, 2),
BLOCK_CRACK("blockcrack_", 37, false, 1),
BLOCK_DUST("blockdust_", 38, false, 1),
WATER_DROP("droplet", 39, false),
ITEM_TAKE("take", 40, false),
HAIL_CORN("hail", 41, false);
private final String particleName;
private final int particleID;
private final boolean shouldIgnoreRange;
private final int argumentCount;
private static final Map<Integer, ParticleType> PARTICLES = Maps.<Integer, ParticleType>newHashMap();
private static final String[] PARTICLE_NAMES;
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited, int argumentCountIn)
{
this.particleName = particleNameIn;
this.particleID = particleIDIn;
this.shouldIgnoreRange = unlimited;
this.argumentCount = argumentCountIn;
}
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited)
{
this(particleNameIn, particleIDIn, unlimited, 0);
}
public static String[] getParticleNames()
{
return PARTICLE_NAMES;
}
public String getParticleName()
{
return this.particleName;
}
public int getParticleID()
{
return this.particleID;
}
public int getArgumentCount()
{
return this.argumentCount;
}
public boolean getShouldIgnoreRange()
{
return this.shouldIgnoreRange;
}
public boolean hasArguments()
{
return this.argumentCount > 0;
}
public static ParticleType getParticleFromId(int particleId)
{
return PARTICLES.get(particleId);
}
static {
List<String> list = Lists.<String>newArrayList();
for (ParticleType enumparticletypes : values())
{
PARTICLES.put(enumparticletypes.getParticleID(), enumparticletypes);
if (!enumparticletypes.getParticleName().endsWith("_"))
{
list.add(enumparticletypes.getParticleName());
}
}
PARTICLE_NAMES = list.toArray(new String[list.size()]);
}
}