effect cleanup

This commit is contained in:
Sen 2025-07-09 19:41:37 +02:00
parent 319e27870f
commit 936154e5ce
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
35 changed files with 1182 additions and 1741 deletions

View file

@ -59,6 +59,7 @@ import client.network.ClientPlayer;
import client.network.DummyConnection;
import client.renderer.BlockRenderer;
import client.renderer.Drawing;
import client.renderer.EffectRenderer;
import client.renderer.EntityRenderer;
import client.renderer.GlState;
import client.renderer.ItemRenderer;
@ -68,7 +69,6 @@ import client.renderer.blockmodel.ModelManager;
import client.renderer.chunk.RenderChunk;
import client.renderer.entity.RenderItem;
import client.renderer.entity.RenderManager;
import client.renderer.particle.EffectRenderer;
import client.renderer.texture.ColormapLoader;
import client.renderer.texture.EntityTexManager;
import client.renderer.texture.TextureManager;
@ -696,7 +696,7 @@ public class Client implements IThreadListener {
this.renderGlobal = new RenderGlobal(this);
this.renderGlobal.onReload();
EntityTexManager.loadNpcTextures();
this.effectRenderer = new EffectRenderer(this.world, this.textureManager);
this.effectRenderer = new EffectRenderer(this.textureManager);
}
public void start()
@ -898,7 +898,7 @@ public class Client implements IThreadListener {
{
this.world.displayTick(ExtMath.floord(this.player.posX), ExtMath.floord(this.player.posY), ExtMath.floord(this.player.posZ));
}
this.effectRenderer.updateEffects();
this.effectRenderer.update();
}
else if (this.connection != null)
{
@ -1378,7 +1378,7 @@ public class Client implements IThreadListener {
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
{
this.effectRenderer.addBlockHitEffects(blockpos, this.pointed.side);
this.effectRenderer.damageBlock(blockpos, this.pointed.side);
this.player.swingItem();
}
}
@ -1604,7 +1604,7 @@ public class Client implements IThreadListener {
if (this.effectRenderer != null)
{
this.effectRenderer.clearEffects(world);
this.effectRenderer.setWorld(world);
}
if (this.player == null)
@ -1898,7 +1898,7 @@ public class Client implements IThreadListener {
// this.connected != null ? this.connected : "[???]"))),
this.renderGlobal.getDebugInfoRenders() + "\n" +
this.renderGlobal.getDebugInfoEntities() + "\n" +
"Partikel: " + this.effectRenderer.getStatistics() + ". O: " + this.world.getDebugLoadedEntities() + "\n" +
"Partikel: " + this.effectRenderer.getParticleCount() + ". O: " + this.world.getDebugLoadedEntities() + "\n" +
this.world.getInfo() + "\n" +
// "",
String.format("XYZ: %.3f / %.3f / %.3f", this.viewEntity.posX,

View file

@ -47,7 +47,6 @@ import common.inventory.InventoryBasic;
import common.inventory.InventoryPlayer;
import common.item.ItemStack;
import common.log.Log;
import common.model.ParticleType;
import common.network.IClientPlayer;
import common.network.NetConnection;
import common.network.NetHandler;
@ -1855,8 +1854,7 @@ public class ClientPlayer implements IClientPlayer
try
{
ParticleType particle = packetIn.getParticleType();
this.world.spawnEntityFX(particle, particle.isUnlimited() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArg());
this.world.spawnParticle(packetIn.getParticleType(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArg());
}
catch (Throwable var17)
{
@ -1876,8 +1874,7 @@ public class ClientPlayer implements IClientPlayer
try
{
ParticleType particle = packetIn.getParticleType();
this.world.spawnEntityFX(particle, particle.isUnlimited() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArg());
this.world.spawnParticle(packetIn.getParticleType(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArg());
}
catch (Throwable var16)
{

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,6 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import client.Client;
import client.renderer.particle.EffectRenderer;
import client.renderer.texture.DynamicTexture;
import client.renderer.texture.TextureMap;
import client.world.WorldClient;
@ -1011,10 +1010,10 @@ public class EntityRenderer {
// if (!this.debugView)
// {
this.enableLightmap();
effectrenderer.renderLitParticles(entity, partialTicks);
effectrenderer.renderTextured(entity, partialTicks);
ItemRenderer.disableStandardItemLighting();
this.setupFog(0, partialTicks);
effectrenderer.renderParticles(entity, partialTicks);
effectrenderer.render(entity, partialTicks);
this.disableLightmap();
// }

View file

@ -1,309 +0,0 @@
package client.renderer.particle;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
import client.renderer.MatrixState;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.texture.TextureManager;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.collect.Lists;
import common.collect.Maps;
import common.entity.Entity;
import common.init.Blocks;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.State;
import common.world.World;
public class EffectRenderer
{
private static final String TEXTURE = "textures/world/particles.png";
protected World worldObj;
private List<EntityFX>[] fxLayers = new List[4];
private TextureManager renderer;
private Random rand = new Random();
private Map<ParticleType, IParticleFactory> particleTypes = Maps.<ParticleType, IParticleFactory>newEnumMap(ParticleType.class);
public EffectRenderer(World worldIn, TextureManager rendererIn)
{
this.worldObj = worldIn;
this.renderer = rendererIn;
for (int i = 0; i < this.fxLayers.length; ++i)
{
this.fxLayers[i] = Lists.newArrayList();
}
this.registerParticles();
}
private void registerParticles()
{
this.register(ParticleType.EXPLOSION_NORMAL, new EntityExplodeFX.Factory());
this.register(ParticleType.SPLASH, new EntitySplashFX.Factory());
this.register(ParticleType.WATER_DROP, new EntityDownfallFX.RainFactory());
this.register(ParticleType.DEPTH, new EntityAuraFX.SuspendFactory());
this.register(ParticleType.CRIT, new EntityCritFX.Factory());
this.register(ParticleType.SMOKE, new EntitySmokeFX.Factory());
this.register(ParticleType.POTION, new EntitySpellParticleFX.Factory());
this.register(ParticleType.GROW, new EntityAuraFX.GrowFactory());
this.register(ParticleType.SPORE, new EntityAuraFX.Factory());
this.register(ParticleType.TELEPORT, new EntityPortalFX.Factory());
this.register(ParticleType.FLAME, new EntityFlameFX.Factory());
this.register(ParticleType.LAVA, new EntityLavaFX.Factory());
this.register(ParticleType.DUST, new EntityReddustFX.Factory());
this.register(ParticleType.HEART, new EntityHeartFX.Factory());
this.register(ParticleType.ITEM_CRACK, new EntityBreakingFX.Factory());
this.register(ParticleType.BLOCK_CRACK, new EntityDiggingFX.Factory());
this.register(ParticleType.EXPLOSION_HUGE, new EntityHugeExplodeFX.Factory());
this.register(ParticleType.EXPLOSION_LARGE, new EntityTexturedFX.ExplodeFactory());
this.register(ParticleType.HAIL_CORN, new EntityDownfallFX.HailFactory());
}
public void register(ParticleType id, IParticleFactory factory)
{
this.particleTypes.put(id, factory);
}
public void spawnCritParticles(Entity entity)
{
this.addEffect(new EntityHitFX(entity));
}
/**
* 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(ParticleType particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int data)
{
IParticleFactory iparticlefactory = this.particleTypes.get(particleId);
if (iparticlefactory != null)
{
EntityFX entityfx = iparticlefactory.getEntityFX(this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, data);
if (entityfx != null)
{
this.addEffect(entityfx);
return entityfx;
}
}
return null;
}
private void addEffect(EntityFX effect)
{
int i = effect.getFXLayer();
if(this.fxLayers[i].size() >= 4000)
this.fxLayers[i].remove(0);
this.fxLayers[i].add(effect);
}
public void updateEffects()
{
for (int i = 0; i < this.fxLayers.length; ++i)
{
this.updateEffectLayer(this.fxLayers[i]);
}
}
private void updateEffectLayer(List<EntityFX> entitiesFX)
{
List<EntityFX> list = Lists.<EntityFX>newArrayList();
for (int i = 0; i < entitiesFX.size(); ++i)
{
EntityFX entityfx = entitiesFX.get(i);
if (entityfx.onUpdate())
list.add(entityfx);
}
entitiesFX.removeAll(list);
}
public void renderParticles(Entity entityIn, float partialTicks)
{
float f = MatrixState.getRotationX();
float f1 = MatrixState.getRotationZ();
float f2 = MatrixState.getRotationYZ();
float f3 = MatrixState.getRotationXY();
float f4 = MatrixState.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(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.alphaFunc(GL11.GL_GREATER, 0.003921569F);
for (int i = 0; i < 2; ++i)
{
if (!this.fxLayers[i].isEmpty())
{
GlState.depthMask(true);
switch (i)
{
case 0:
default:
this.renderer.bindTexture(TEXTURE);
break;
case 1:
this.renderer.bindTexture(TextureMap.BLOCKS);
}
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
for (int k = 0; k < this.fxLayers[i].size(); ++k)
{
final EntityFX entityfx = (EntityFX)this.fxLayers[i].get(k);
entityfx.render(worldrenderer, partialTicks, f, f4, f1, f2, f3);
}
Tessellator.draw();
}
}
GlState.depthMask(true);
GlState.disableBlend();
GlState.alphaFunc(GL11.GL_GREATER, 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);
List<EntityFX> list = this.fxLayers[2];
if (!list.isEmpty())
{
RenderBuffer worldrenderer = Tessellator.getBuffer();
for (int j = 0; j < list.size(); ++j)
{
EntityFX entityfx = list.get(j);
entityfx.render(worldrenderer, partialTick, f1, f5, f2, f3, f4);
}
}
}
public void clearEffects(World worldIn)
{
this.worldObj = worldIn;
for (int i = 0; i < this.fxLayers.length; ++i)
{
this.fxLayers[i].clear();
}
}
public void addBlockDestroyEffects(BlockPos pos, State state)
{
if (state.getBlock() != Blocks.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, pos, false));
}
}
}
}
}
/**
* 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, pos, true));
}
}
public String getStatistics()
{
int i = 0;
for (int j = 0; j < 3; ++j)
{
i += this.fxLayers[j].size();
}
return "" + i;
}
}

View file

@ -1,73 +0,0 @@
package client.renderer.particle;
import common.world.World;
public class EntityAuraFX extends EntityParticleFX
{
private final boolean fullBright;
protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn, boolean fullBright, int texture)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn);
float f = texture != 0 ? 1.0f : this.rand.floatv() * 0.1F + 0.2F;
this.red = f;
this.green = f;
this.blue = f;
this.setUV(texture != 0 ? 5 + texture : 0, texture != 0 ? 2 : 0);
this.scale *= this.rand.floatv() * 0.6F + 0.5F;
this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D;
this.motionZ *= 0.019999999552965164D;
this.lifetime = (int)(20.0D / (Math.random() * 0.8D + 0.2D));
this.fullBright = fullBright;
}
/**
* Called to update the entity's position/logic.
*/
public boolean 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.lifetime-- <= 0)
{
return true;
}
return false;
}
public int getBrightness(float partialTicks)
{
return this.fullBright ? 15728880 : super.getBrightness(partialTicks);
}
public static class SuspendFactory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true, 0);
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false, 0);
}
}
public static class GrowFactory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false, 1);
}
}
}

View file

@ -1,27 +0,0 @@
package client.renderer.particle;
import client.Client;
import common.init.ItemRegistry;
import common.item.Item;
import common.world.World;
public class EntityBreakingFX extends EntityIconFX {
protected EntityBreakingFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, Item item) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D, 1.0f, Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(item));
this.red = this.green = this.blue = 1.0F;
this.gravity = 1.0F;
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeed;
this.motionY += ySpeed;
this.motionZ += zSpeed;
}
public static class Factory implements IParticleFactory {
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
Item item = ItemRegistry.byId(data);
return item == null ? null : new EntityBreakingFX(world, x, y, z, xSpeed, ySpeed, zSpeed, item);
}
}
}

View file

@ -1,77 +0,0 @@
package client.renderer.particle;
import common.util.ExtMath;
import common.world.World;
public class EntityCritFX extends EntityParticleFX
{
float field_174839_a;
protected EntityCritFX(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 EntityCritFX(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.blue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
this.red = this.blue * 0.3f;
this.green = this.blue * 0.8f;
this.scale *= 0.75F;
this.scale *= p_i46285_14_;
this.field_174839_a = this.scale;
this.lifetime = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
this.lifetime = (int)((float)this.lifetime * p_i46285_14_);
this.setUV(4, 2);
this.onUpdate();
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.scale = this.field_174839_a * f;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.green = (float)((double)this.green * 0.96D);
this.blue = (float)((double)this.blue * 0.9D);
this.motionX *= 0.699999988079071D;
this.motionY *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY -= 0.019999999552965164D;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityCritFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,46 +0,0 @@
package client.renderer.particle;
import client.Client;
import common.block.Block;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.util.BlockPos;
import common.world.State;
import common.world.World;
public class EntityDiggingFX extends EntityIconFX {
private final State state;
private final BlockPos position;
protected EntityDiggingFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, State state, BlockPos pos, boolean hit) {
super(world, x, y, z, xSpeed, ySpeed, zSpeed, hit ? 0.6f : 1.0f, Client.CLIENT.getBlockRendererDispatcher().getModelManager().getTexture(state));
this.state = state;
this.gravity = 1.0F;
this.red = this.green = this.blue = 0.6F;
if(hit) {
this.motionX *= 0.2;
this.motionY = (this.motionY - 0.1) * 0.2 + 0.1;
this.motionZ *= 0.2;
}
this.position = pos == null ? new BlockPos(this.posX, this.posY, this.posZ) : pos;
Block block = this.state.getBlock();
if(block == Blocks.grass)
return;
int color = pos == null ? block.getRenderColor(this.state) : block.colorMultiplier(this.world, pos);
this.red *= (float)(color >> 16 & 255) / 255.0F;
this.green *= (float)(color >> 8 & 255) / 255.0F;
this.blue *= (float)(color & 255) / 255.0F;
}
public int getBrightness(float partial) {
int light = super.getBrightness(partial);
return light == 0 ? (this.world.isBlockLoaded(this.position) ? this.world.getCombinedLight(this.position, 0) : 0) : light;
}
public static class Factory implements IParticleFactory {
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
State state = BlockRegistry.byId(data);
return state == null ? null : new EntityDiggingFX(world, x, y, z, xSpeed, ySpeed, zSpeed, state, null, false);
}
}
}

View file

@ -1,90 +0,0 @@
package client.renderer.particle;
import common.block.Block;
import common.block.Material;
import common.block.liquid.BlockLiquid;
import common.util.BlockPos;
import common.util.ExtMath;
import common.world.State;
import common.world.World;
public class EntityDownfallFX extends EntityParticleFX
{
protected EntityDownfallFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, int texture)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.30000001192092896D;
this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D;
this.motionZ *= 0.30000001192092896D;
this.red = 1.0F;
this.green = 1.0F;
this.blue = 1.0F;
this.setUV(this.rand.zrange(4), 1 + texture);
this.gravity = 0.06F;
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.motionY -= (double)this.gravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.lifetime-- <= 0)
{
return true;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
State iblockstate = this.world.getState(blockpos);
Block block = iblockstate.getBlock();
block.setBlockBoundsBasedOnState(this.world, 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)
{
return true;
}
}
return false;
}
public static class RainFactory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 0);
}
}
public static class HailFactory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 1);
}
}
}

View file

@ -1,48 +0,0 @@
package client.renderer.particle;
import common.world.World;
public class EntityExplodeFX extends EntityParticleFX
{
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.red = this.green = this.blue = this.rand.floatv() * 0.3F + 0.7F;
this.scale = this.rand.floatv() * this.rand.floatv() * 6.0F + 1.0F;
this.lifetime = (int)(16.0D / ((double)this.rand.floatv() * 0.8D + 0.2D)) + 2;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8999999761581421D;
this.motionY *= 0.8999999761581421D;
this.motionZ *= 0.8999999761581421D;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,19 +0,0 @@
package client.renderer.particle;
import client.renderer.RenderBuffer;
import common.rng.Random;
public abstract class EntityFX {
static double interpPosX;
static double interpPosY;
static double interpPosZ;
protected final Random rand = new Random();
protected int age;
protected int lifetime;
public abstract boolean onUpdate();
public abstract void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ);
public abstract int getFXLayer();
}

View file

@ -1,80 +0,0 @@
package client.renderer.particle;
import common.util.ExtMath;
import common.world.World;
public class EntityFlameFX extends EntityParticleFX
{
/** 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.scale;
this.red = this.green = this.blue = 1.0F;
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
this.setUV(6, 1);
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
this.scale = this.flameScale * (1.0F - f * f * 0.5F);
}
public int getBrightness(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
f = ExtMath.clampf(f, 0.0F, 1.0F);
int i = super.getBrightness(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;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityFlameFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,85 +0,0 @@
package client.renderer.particle;
import common.util.ExtMath;
import common.world.World;
public class EntityHeartFX extends EntityParticleFX
{
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.scale *= 0.75F;
this.scale *= scale;
this.particleScaleOverTime = this.scale;
this.lifetime = 16;
this.setUV(5, 2);
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.scale = this.particleScaleOverTime * f;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
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;
return false;
}
// 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(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityHeartFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,25 +0,0 @@
package client.renderer.particle;
import common.entity.Entity;
import common.model.ParticleType;
public class EntityHitFX extends EntityTickedFX {
private final Entity entity;
public EntityHitFX(Entity entity) {
super(16, 3);
this.entity = entity;
this.onUpdate();
}
public void spawnParticle() {
double x = (double)(this.rand.floatv() * 2.0F - 1.0F);
double y = (double)(this.rand.floatv() * 2.0F - 1.0F);
double z = (double)(this.rand.floatv() * 2.0F - 1.0F);
if(x * x + y * y + z * z <= 1.0D) {
this.entity.worldObj.spawnParticle(ParticleType.CRIT, this.entity.posX + x * (double)this.entity.width / 4.0D,
this.entity.getEntityBoundingBox().minY + (double)(this.entity.height / 2.0F) + y * (double)this.entity.height / 4.0D,
this.entity.posZ + z * (double)this.entity.width / 4.0D, x, y + 0.2D, z);
}
}
}

View file

@ -1,32 +0,0 @@
package client.renderer.particle;
import common.model.ParticleType;
import common.world.World;
public class EntityHugeExplodeFX extends EntityTickedFX {
private final World world;
private final double posX;
private final double posY;
private final double posZ;
protected EntityHugeExplodeFX(World world, double x, double y, double z) {
super(6, 8);
this.world = world;
this.posX = x;
this.posY = y;
this.posZ = z;
}
public void spawnParticle() {
double x = this.posX + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
double y = this.posY + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
double z = this.posZ + (this.rand.doublev() - this.rand.doublev()) * 4.0D;
this.world.spawnParticle(ParticleType.EXPLOSION_LARGE, x, y, z, (double)((float)this.age / (float)this.lifetime), 0.0D, 0.0D);
}
public static class Factory implements IParticleFactory {
public EntityFX getEntityFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int data) {
return new EntityHugeExplodeFX(world, x, y, z);
}
}
}

View file

@ -1,65 +0,0 @@
package client.renderer.particle;
import client.renderer.RenderBuffer;
import client.renderer.texture.TextureAtlasSprite;
import common.world.World;
public class EntityIconFX extends EntityWorldFX {
private final TextureAtlasSprite icon;
private final float offsetX;
private final float offsetY;
private final float size;
protected float red;
protected float green;
protected float blue;
protected EntityIconFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, float size,
TextureAtlasSprite icon) {
super(world, x, y, z, xSpeed, ySpeed, zSpeed);
this.size = (this.rand.floatv() * 0.5F + 0.5F) * size * 0.1f;
this.icon = icon;
this.offsetX = this.rand.floatv() * 3.0F;
this.offsetY = this.rand.floatv() * 3.0F;
}
public final int getFXLayer() {
return 1;
}
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
float u1 = this.icon.getInterpolatedU((double)(this.offsetX * 4.0F));
float u2 = this.icon.getInterpolatedU((double)((this.offsetX + 1.0F) * 4.0F));
float v1 = this.icon.getInterpolatedV((double)(this.offsetY * 4.0F));
float v2 = this.icon.getInterpolatedV((double)((this.offsetY + 1.0F) * 4.0F));
float scale = this.size;
float x = (float)(this.prevX + (this.posX - this.prevX) * (double)partial - interpPosX);
float y = (float)(this.prevY + (this.posY - this.prevY) * (double)partial - interpPosY);
float z = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partial - interpPosZ);
int light = this.getBrightness(partial);
int sky = light >> 16 & 65535;
int block = light & 65535;
rb.pos((double)(x - rotX * scale - rotXY * scale), (double)(y - rotZ * scale), (double)(z - rotYZ * scale - rotXZ * scale))
.tex((double)u1, (double)v2).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
rb.pos((double)(x - rotX * scale + rotXY * scale), (double)(y + rotZ * scale), (double)(z - rotYZ * scale + rotXZ * scale))
.tex((double)u1, (double)v1).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
rb.pos((double)(x + rotX * scale + rotXY * scale), (double)(y + rotZ * scale), (double)(z + rotYZ * scale + rotXZ * scale))
.tex((double)u2, (double)v1).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
rb.pos((double)(x + rotX * scale - rotXY * scale), (double)(y - rotZ * scale), (double)(z + rotYZ * scale - rotXZ * scale))
.tex((double)u2, (double)v2).color(this.red, this.green, this.blue, 1.0F).lightmap(sky, block).endVertex();
}
public final boolean onUpdate() {
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if(this.age++ >= this.lifetime)
return true;
this.motionY -= 0.04D * (double)this.gravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
return false;
}
}

View file

@ -1,80 +0,0 @@
package client.renderer.particle;
import common.model.ParticleType;
import common.util.ExtMath;
import common.world.World;
public class EntityLavaFX extends EntityParticleFX
{
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.red = this.green = this.blue = 1.0F;
this.scale *= this.rand.floatv() * 2.0F + 0.2F;
this.lavaParticleScale = this.scale;
this.lifetime = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
this.setUV(7, 1);
}
public int getBrightness(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
f = ExtMath.clampf(f, 0.0F, 1.0F);
int i = super.getBrightness(partialTicks);
int j = 240;
int k = i >> 16 & 255;
return j | k << 16;
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
this.scale = this.lavaParticleScale * (1.0F - f * f);
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
float f = (float)this.age / (float)this.lifetime;
if (this.rand.floatv() > f)
{
this.world.spawnParticle(ParticleType.SMOKE, 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;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityLavaFX(worldIn, xCoordIn, yCoordIn, zCoordIn);
}
}
}

View file

@ -1,54 +0,0 @@
package client.renderer.particle;
import client.renderer.RenderBuffer;
import common.world.World;
public abstract class EntityParticleFX extends EntityWorldFX {
private int textureU;
private int textureV;
protected float scale;
protected float red;
protected float green;
protected float blue;
public EntityParticleFX(World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
super(world, x, y, z, xSpeed, ySpeed, zSpeed);
this.red = this.green = this.blue = 1.0F;
this.scale = (this.rand.floatv() * 0.5F + 0.5F) * 2.0F;
}
protected void setScale(float partial) {
}
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
this.setScale(partial);
float f = (float)this.textureU / 8.0F;
float f1 = f + 1.0f / 8.0f;
float f2 = (float)this.textureV / 4.0F;
float f3 = f2 + 1.0f / 4.0f;
float f4 = 0.1F * this.scale;
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partial - interpPosX);
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partial - interpPosY);
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partial - interpPosZ);
int i = this.getBrightness(partial);
int j = i >> 16 & 65535;
int k = i & 65535;
rb.pos((double)(f5 - rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 - rotYZ * f4 - rotXZ * f4)).tex((double)f1, (double)f3)
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
rb.pos((double)(f5 - rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 - rotYZ * f4 + rotXZ * f4)).tex((double)f1, (double)f2)
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
rb.pos((double)(f5 + rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 + rotYZ * f4 + rotXZ * f4)).tex((double)f, (double)f2)
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
rb.pos((double)(f5 + rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 + rotYZ * f4 - rotXZ * f4)).tex((double)f, (double)f3)
.color(this.red, this.green, this.blue, 1.0f).lightmap(j, k).endVertex();
}
public final int getFXLayer() {
return 0;
}
protected final void setUV(int x, int y) {
this.textureU = x;
this.textureV = y;
}
}

View file

@ -1,90 +0,0 @@
package client.renderer.particle;
import common.world.World;
public class EntityPortalFX extends EntityParticleFX
{
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.scale = this.rand.floatv() * 0.2F + 0.5F;
this.red = this.green = this.blue = 1.0F * f;
this.green *= 0.1F;
this.red *= 0.2F;
this.blue *= 0.25F;
this.lifetime = (int)(Math.random() * 10.0D) + 40;
this.setUV((int)(Math.random() * 8.0D), 0);
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime;
f = 1.0F - f;
f = f * f;
f = 1.0F - f;
this.scale = this.portalParticleScale * f;
}
public int getBrightness(float partialTicks)
{
int i = super.getBrightness(partialTicks);
float f = (float)this.age / (float)this.lifetime;
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;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
float f = (float)this.age / (float)this.lifetime;
f = -f + f * f * 2.0F;
f = 1.0F - f;
this.posX = this.portalPosX + this.motionX * (double)f;
this.posY = this.portalPosY + this.motionY * (double)f + (double)(1.0F - f);
this.posZ = this.portalPosZ + this.motionZ * (double)f;
if (this.age++ >= this.lifetime)
{
return true;
}
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityPortalFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,84 +0,0 @@
package client.renderer.particle;
import common.util.ExtMath;
import common.world.World;
public class EntityReddustFX extends EntityParticleFX
{
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.red = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_9_ * f;
this.green = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_10_ * f;
this.blue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_11_ * f;
this.scale *= 0.75F;
this.scale *= p_i46350_8_;
this.reddustParticleScale = this.scale;
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.lifetime = (int)((float)this.lifetime * p_i46350_8_);
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.scale = this.reddustParticleScale * f;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntityReddustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, (float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
}
}
}

View file

@ -1,79 +0,0 @@
package client.renderer.particle;
import common.util.ExtMath;
import common.world.World;
public class EntitySmokeFX extends EntityParticleFX
{
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.red = this.green = this.blue = (float)(Math.random() * 0.30000001192092896D);
this.scale *= 0.75F;
this.scale *= p_i46348_14_;
this.smokeParticleScale = this.scale;
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.lifetime = (int)((float)this.lifetime * p_i46348_14_);
}
/**
* Renders the particle
*/
protected void setScale(float partialTicks)
{
float f = ((float)this.age + partialTicks) / (float)this.lifetime * 32.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
this.scale = this.smokeParticleScale * f;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 0);
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;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntitySmokeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,73 +0,0 @@
package client.renderer.particle;
import common.rng.Random;
import common.world.World;
public class EntitySpellParticleFX extends EntityParticleFX
{
private static final Random RANDOM = new Random();
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.scale *= 0.75F;
this.lifetime = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
public void setParameter(float particleRedIn, float particleGreenIn, float particleBlueIn, float multiplier)
{
this.motionX *= (double)multiplier;
this.motionY = (this.motionY - 0.10000000149011612D) * (double)multiplier + 0.10000000149011612D;
this.motionZ *= (double)multiplier;
float f3 = 0.75F + this.rand.floatv() * 0.25F;
this.red = particleRedIn * f3;
this.green = particleGreenIn * f3;
this.blue = particleBlueIn * f3;
}
/**
* Called to update the entity's position/logic.
*/
public boolean onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
if (this.age++ >= this.lifetime)
{
return true;
}
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 3);
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;
return false;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,28 +0,0 @@
package client.renderer.particle;
import common.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);
this.gravity = 0.04F;
this.setUV(1 + this.rand.zrange(3), 1);
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(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data)
{
return new EntitySplashFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View file

@ -1,90 +0,0 @@
package client.renderer.particle;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.ItemRenderer;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.VertexFormat;
import client.renderer.texture.TextureManager;
import common.world.World;
public class EntityTexturedFX extends EntityFX {
private static final VertexFormat VERTEX_FORMAT = (new VertexFormat()).addElement(DefaultVertexFormats.POSITION_3F)
.addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.TEX_2S)
.addElement(DefaultVertexFormats.NORMAL_3B).addElement(DefaultVertexFormats.PADDING_1B);
private final String texture;
private final float scale;
private final float brightness;
private final double posX;
private final double posY;
private final double posZ;
private int age;
private int lifetime;
private TextureManager manager;
protected EntityTexturedFX(TextureManager manager, double x, double y, double z, double scale, String texture) {
this.manager = manager;
this.lifetime = 6 + this.rand.zrange(4);
this.brightness = this.rand.floatv() * 0.6F + 0.4F;
this.scale = (float)scale;
this.texture = texture;
this.posX = x;
this.posY = y;
this.posZ = z;
}
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
int i = (int)(((float)this.age + partial) * 15.0F / (float)this.lifetime);
if(i <= 15) {
this.manager.bindTexture(this.texture);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 4) / 4.0F;
float f3 = f2 + 0.24975F;
float f4 = 2.0F * (1.0F - this.scale * 0.5F);
float f5 = (float)(this.posX - interpPosX);
float f6 = (float)(this.posY - interpPosY);
float f7 = (float)(this.posZ - interpPosZ);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.disableLighting();
ItemRenderer.disableStandardItemLighting();
rb.begin(GL11.GL_QUADS, VERTEX_FORMAT);
rb.pos((double)(f5 - rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 - rotYZ * f4 - rotXZ * f4))
.tex((double)f1, (double)f3).color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240)
.normal(0.0F, 1.0F, 0.0F).endVertex();
rb.pos((double)(f5 - rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 - rotYZ * f4 + rotXZ * f4))
.tex((double)f1, (double)f2).color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240)
.normal(0.0F, 1.0F, 0.0F).endVertex();
rb.pos((double)(f5 + rotX * f4 + rotXY * f4), (double)(f6 + rotZ * f4), (double)(f7 + rotYZ * f4 + rotXZ * f4)).tex((double)f, (double)f2)
.color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
rb.pos((double)(f5 + rotX * f4 - rotXY * f4), (double)(f6 - rotZ * f4), (double)(f7 + rotYZ * f4 - rotXZ * f4)).tex((double)f, (double)f3)
.color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.draw();
GlState.enableLighting();
}
}
public final boolean onUpdate() {
if(++this.age >= this.lifetime)
return true;
return false;
}
public final int getFXLayer() {
return 2;
}
public static class ExplodeFactory implements IParticleFactory {
public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn,
double zSpeedIn, int data) {
return new EntityTexturedFX(Client.CLIENT.getTextureManager(), xCoordIn, yCoordIn, zCoordIn, xSpeedIn, "textures/entity/explosion.png");
}
}
}

View file

@ -1,30 +0,0 @@
package client.renderer.particle;
import client.renderer.RenderBuffer;
public abstract class EntityTickedFX extends EntityFX {
private final int amount;
protected EntityTickedFX(int amount, int lifetime) {
this.amount = amount;
this.lifetime = lifetime;
}
public final boolean onUpdate() {
for(int z = 0; z < this.amount; z++) {
this.spawnParticle();
}
if(++this.age >= this.lifetime)
return true;
return false;
}
public final int getFXLayer() {
return 3;
}
public final void render(RenderBuffer rb, float partial, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
}
protected abstract void spawnParticle();
}

View file

@ -1,58 +0,0 @@
package client.renderer.particle;
import common.util.BlockPos;
import common.util.ExtMath;
import common.world.World;
public abstract class EntityWorldFX extends EntityFX
{
protected final World world;
protected double prevX;
protected double prevY;
protected double prevZ;
protected double posX;
protected double posY;
protected double posZ;
protected double motionX;
protected double motionY;
protected double motionZ;
protected float gravity;
protected EntityWorldFX(World worldIn, double posXIn, double posYIn, double posZIn)
{
this.world = worldIn;
this.posX = this.prevX = posXIn;
this.posY = this.prevY = posYIn;
this.posZ = this.prevZ = posZIn;
this.lifetime = (int)(4.0F / (this.rand.floatv() * 0.9F + 0.1F));
this.age = 0;
}
public EntityWorldFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
this(worldIn, xCoordIn, yCoordIn, zCoordIn);
this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D;
float f = (float)(Math.random() + Math.random() + 1.0D) * 0.15F;
float f1 = ExtMath.sqrtd(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.motionX = this.motionX / (double)f1 * (double)f * 0.4000000059604645D;
this.motionY = this.motionY / (double)f1 * (double)f * 0.4000000059604645D + 0.10000000149011612D;
this.motionZ = this.motionZ / (double)f1 * (double)f * 0.4000000059604645D;
}
public final void moveEntity(double x, double y, double z)
{
this.posX += x;
this.posY += y;
this.posZ += z;
}
public int getBrightness(float partial)
{
BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ);
return this.world.isBlockLoaded(pos) ? this.world.getCombinedLight(pos, 0) : 0;
}
}

View file

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

View file

@ -4,8 +4,6 @@ import java.util.List;
import java.util.Set;
import client.Client;
import client.renderer.particle.EntityFX;
import client.renderer.particle.EntitySpellParticleFX;
import common.biome.Biome;
import common.collect.Lists;
import common.collect.Sets;
@ -19,7 +17,6 @@ import common.init.ItemRegistry;
import common.init.Items;
import common.init.SoundEvent;
import common.item.material.ItemDye;
import common.item.tool.ItemPotion;
import common.log.Log;
import common.model.ParticleType;
import common.rng.Random;
@ -417,39 +414,16 @@ public class WorldClient extends AWorldClient
// zOffset, data);
// }
public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset,
public void spawnParticle(ParticleType particle, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset,
double zOffset, int data) {
this.spawnEntityFX(particleType, particleType.isUnlimited(), xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data);
}
public EntityFX spawnEntityFX(ParticleType particle, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int data)
{
if (this.gm.getRenderViewEntity() != null)
{
// int i = this.gm.particleSetting;
//
// if (i == 1 && this.rand.zrange(3) == 0)
// {
// i = 2;
// }
double d0 = this.gm.getRenderViewEntity().posX - xCoord;
double d1 = this.gm.getRenderViewEntity().posY - yCoord;
double d2 = this.gm.getRenderViewEntity().posZ - zCoord;
if (ignoreRange)
{
return this.gm.effectRenderer.spawnEffectParticle(particle, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data);
}
else
{
double d3 = 16.0D;
if(d0 * d0 + d1 * d1 + d2 * d2 > 256.0D)
return null;
return this.gm.effectRenderer.spawnEffectParticle(particle, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data);
}
if(particle.isUnlimited() || d0 * d0 + d1 * d1 + d2 * d2 <= 256.0D)
this.gm.effectRenderer.spawnParticle(particle, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data);
}
return null;
}
// public void broadcastSound(int soundID, BlockPos pos, int data)
@ -636,7 +610,7 @@ public class WorldClient extends AWorldClient
this.gm.getSoundManager().playSound(new PositionedSound(state.getBlock().sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F));
}
if(state != null)
this.gm.effectRenderer.addBlockDestroyEffects(blockPosIn, state);
this.gm.effectRenderer.destroyBlock(blockPosIn, state);
break;
case 2002:
@ -649,30 +623,9 @@ public class WorldClient extends AWorldClient
this.spawnParticle(ParticleType.ITEM_CRACK, d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.potion));
}
float f = 1.0F;
float f1 = 1.0F;
float f2 = 1.0F;
if((data & 16383) != 0) {
ItemPotion potion = ItemPotion.getPotionItem(data);
int j1 = potion.getColorFromDamage();
f = (float)(j1 >> 16 & 255) / 255.0F;
f1 = (float)(j1 >> 8 & 255) / 255.0F;
f2 = (float)(j1 >> 0 & 255) / 255.0F;
}
for (int l1 = 0; l1 < 100; ++l1)
{
double d22 = this.rand.doublev() * 4.0D;
double d23 = this.rand.doublev() * Math.PI * 2.0D;
double d24 = Math.cos(d23) * d22;
double d9 = 0.01D + this.rand.doublev() * 0.5D;
double d11 = Math.sin(d23) * d22;
EntityFX entityfx = this.spawnEntityFX(ParticleType.POTION, ParticleType.POTION.isUnlimited(), d13 + d24 * 0.1D, d14 + 0.3D, d16 + d11 * 0.1D, d24, d9, d11, 0);
if (entityfx instanceof EntitySpellParticleFX spell)
{
spell.setParameter(f, f1, f2, (float)d22);
}
this.spawnParticle(ParticleType.POTION, d13, d14, d16, 0.0, 0.0, 0.0, data);
}
this.playSoundAtPos(blockPosIn, SoundEvent.GLASS, 1.0F);

View file

@ -171,7 +171,7 @@ public class BlockRedstoneOre extends Block
if (d1 < (double)pos.getX() || d1 > (double)(pos.getX() + 1) || d2 < 0.0D || d2 > (double)(pos.getY() + 1) || d3 < (double)pos.getZ() || d3 > (double)(pos.getZ() + 1))
{
worldIn.spawnParticle(ParticleType.DUST, d1, d2, d3, 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(ParticleType.DUST, d1, d2, d3, 1.0D, 0.0D, 0.0D);
}
}
}

View file

@ -126,7 +126,7 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode
f = f / 16.0F;
double d3 = (double)(f * (float)enumfacing.getFrontOffsetX());
double d4 = (double)(f * (float)enumfacing.getFrontOffsetZ());
worldIn.spawnParticle(ParticleType.DUST, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(ParticleType.DUST, d0 + d3, d1, d2 + d4, 1.0D, 0.0D, 0.0D);
}
}

View file

@ -206,7 +206,7 @@ public class BlockRedstoneTorch extends BlockTorch
d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ();
}
worldIn.spawnParticle(ParticleType.DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D);
worldIn.spawnParticle(ParticleType.DUST, d0, d1, d2, 1.0D, 0.0D, 0.0D);
}
}

View file

@ -18,17 +18,15 @@ public class SPacketParticles implements Packet<IClientPlayer>
private float zOffset;
private float particleSpeed;
private int particleCount;
private boolean longDistance;
private int particleArgument;
public SPacketParticles()
{
}
public SPacketParticles(ParticleType particleTypeIn, boolean longDistanceIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int particleArgumentIn)
public SPacketParticles(ParticleType particleTypeIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int particleArgumentIn)
{
this.particleType = particleTypeIn;
this.longDistance = longDistanceIn;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
@ -46,7 +44,6 @@ public class SPacketParticles implements Packet<IClientPlayer>
public void readPacketData(PacketBuffer buf) throws IOException
{
this.particleType = buf.readEnumValue(ParticleType.class);
this.longDistance = buf.readBoolean();
this.xCoord = buf.readFloat();
this.yCoord = buf.readFloat();
this.zCoord = buf.readFloat();
@ -64,7 +61,6 @@ public class SPacketParticles implements Packet<IClientPlayer>
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeEnumValue(this.particleType);
buf.writeBoolean(this.longDistance);
buf.writeFloat(this.xCoord);
buf.writeFloat(this.yCoord);
buf.writeFloat(this.zCoord);
@ -81,11 +77,6 @@ public class SPacketParticles implements Packet<IClientPlayer>
return this.particleType;
}
public boolean isLongDistance()
{
return this.longDistance;
}
/**
* Gets the x coordinate to spawn the particle.
*/

View file

@ -27,7 +27,7 @@ public class CommandEffect extends Command {
public void exec(CommandEnvironment env, Executor exec, List<Player> players, ParticleType type, Vec3 pos, Vec3 offset, double speed, int count) {
offset = offset == null ? new Vec3(0.0, 0.0, 0.0) : offset;
for(Player player : players) {
player.sendPacket(new SPacketParticles(type, true, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, (float)offset.xCoord, (float)offset.yCoord, (float)offset.zCoord, (float)speed, count, 0));
player.sendPacket(new SPacketParticles(type, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, (float)offset.xCoord, (float)offset.yCoord, (float)offset.zCoord, (float)speed, count, 0));
}
}
}

View file

@ -1287,15 +1287,9 @@ public final class WorldServer extends AWorldServer {
// this.resetWeather = false;
}
public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset,
double yOffset, double zOffset, double particleSpeed, int data) {
this.spawnParticle(particleType, false, xCoord, yCoord, zCoord, numberOfParticles, xOffset, yOffset, zOffset, particleSpeed,
data);
}
public void spawnParticle(ParticleType particleType, boolean longDistance, double xCoord, double yCoord, double zCoord,
public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord,
int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int data) {
Packet packet = new SPacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset,
Packet packet = new SPacketParticles(particleType, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset,
(float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, data);
for(int i = 0; i < this.players.size(); ++i) {
@ -1303,7 +1297,7 @@ public final class WorldServer extends AWorldServer {
BlockPos blockpos = entityplayermp.getPosition();
double d0 = blockpos.distanceSq(xCoord, yCoord, zCoord);
if(d0 <= 256.0D || longDistance && d0 <= 65536.0D) {
if(d0 <= 256.0D || particleType.isUnlimited() && d0 <= 65536.0D) {
entityplayermp.connection.sendPacket(packet);
}
}
@ -1695,11 +1689,11 @@ public final class WorldServer extends AWorldServer {
}
for(EntityNPC player : this.players) {
player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000);
Packet packet = new SPacketParticles(ParticleType.EXPLOSION_HUGE, true,
Packet packet = new SPacketParticles(ParticleType.EXPLOSION_HUGE,
(float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0,
(float)2.0, (float)128.0, (float)0.15, 1000, 0);
player.connection.sendPacket(packet);
packet = new SPacketParticles(ParticleType.EXPLOSION_NORMAL, true,
packet = new SPacketParticles(ParticleType.EXPLOSION_NORMAL,
(float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0,
(float)2.0, (float)128.0, (float)0.15, 1000, 0);
player.connection.sendPacket(packet);