| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import com.google.common.collect.Maps;
|
| 5 | import java.util.List;
|
| 6 | import java.util.Map;
|
| 7 | import java.util.Random;
|
| 8 | import java.util.concurrent.Callable;
|
| 9 | import net.minecraft.block.Block;
|
| 10 | import net.minecraft.block.material.Material;
|
| 11 | import net.minecraft.block.state.IBlockState;
|
| 12 | import net.minecraft.client.renderer.ActiveRenderInfo;
|
| 13 | import net.minecraft.client.renderer.GlStateManager;
|
| 14 | import net.minecraft.client.renderer.Tessellator;
|
| 15 | import net.minecraft.client.renderer.WorldRenderer;
|
| 16 | import net.minecraft.client.renderer.texture.TextureManager;
|
| 17 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 18 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
| 19 | import net.minecraft.crash.CrashReport;
|
| 20 | import net.minecraft.crash.CrashReportCategory;
|
| 21 | import net.minecraft.entity.Entity;
|
| 22 | import net.minecraft.util.BlockPos;
|
| 23 | import net.minecraft.util.EnumFacing;
|
| 24 | import net.minecraft.util.EnumParticleTypes;
|
| 25 | import net.minecraft.util.MathHelper;
|
| 26 | import net.minecraft.util.ReportedException;
|
| 27 | import net.minecraft.util.ResourceLocation;
|
| 28 | import net.minecraft.world.World;
|
| 29 |
|
| 30 | public class EffectRenderer
|
| 31 | {
|
| 32 | private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
|
| 33 |
|
| 34 | /** Reference to the World object. */
|
| 35 | protected World worldObj;
|
| 36 | private List<EntityFX>[][] fxLayers = new List[4][];
|
| 37 | private List<EntityParticleEmitter> particleEmitters = Lists.<EntityParticleEmitter>newArrayList();
|
| 38 | private TextureManager renderer;
|
| 39 |
|
| 40 | /** RNG. */
|
| 41 | private Random rand = new Random();
|
| 42 | private Map<Integer, IParticleFactory> particleTypes = Maps.<Integer, IParticleFactory>newHashMap();
|
| 43 |
|
| 44 | public EffectRenderer(World worldIn, TextureManager rendererIn)
|
| 45 | {
|
| 46 | this.worldObj = worldIn;
|
| 47 | this.renderer = rendererIn;
|
| 48 |
|
| 49 | for (int i = 0; i < 4; ++i)
|
| 50 | {
|
| 51 | this.fxLayers[i] = new List[2];
|
| 52 |
|
| 53 | for (int j = 0; j < 2; ++j)
|
| 54 | {
|
| 55 | this.fxLayers[i][j] = Lists.newArrayList();
|
| 56 | }
|
| 57 | }
|
| 58 |
|
| 59 | this.registerVanillaParticles();
|
| 60 | }
|
| 61 |
|
| 62 | private void registerVanillaParticles()
|
| 63 | {
|
| 64 | this.registerParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), new EntityExplodeFX.Factory());
|
| 65 | this.registerParticle(EnumParticleTypes.WATER_BUBBLE.getParticleID(), new EntityBubbleFX.Factory());
|
| 66 | this.registerParticle(EnumParticleTypes.WATER_SPLASH.getParticleID(), new EntitySplashFX.Factory());
|
| 67 | this.registerParticle(EnumParticleTypes.WATER_WAKE.getParticleID(), new EntityFishWakeFX.Factory());
|
| 68 | this.registerParticle(EnumParticleTypes.WATER_DROP.getParticleID(), new EntityRainFX.Factory());
|
| 69 | this.registerParticle(EnumParticleTypes.SUSPENDED.getParticleID(), new EntitySuspendFX.Factory());
|
| 70 | this.registerParticle(EnumParticleTypes.SUSPENDED_DEPTH.getParticleID(), new EntityAuraFX.Factory());
|
| 71 | this.registerParticle(EnumParticleTypes.CRIT.getParticleID(), new EntityCrit2FX.Factory());
|
| 72 | this.registerParticle(EnumParticleTypes.CRIT_MAGIC.getParticleID(), new EntityCrit2FX.MagicFactory());
|
| 73 | this.registerParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), new EntitySmokeFX.Factory());
|
| 74 | this.registerParticle(EnumParticleTypes.SMOKE_LARGE.getParticleID(), new EntityCritFX.Factory());
|
| 75 | this.registerParticle(EnumParticleTypes.SPELL.getParticleID(), new EntitySpellParticleFX.Factory());
|
| 76 | this.registerParticle(EnumParticleTypes.SPELL_INSTANT.getParticleID(), new EntitySpellParticleFX.InstantFactory());
|
| 77 | this.registerParticle(EnumParticleTypes.SPELL_MOB.getParticleID(), new EntitySpellParticleFX.MobFactory());
|
| 78 | this.registerParticle(EnumParticleTypes.SPELL_MOB_AMBIENT.getParticleID(), new EntitySpellParticleFX.AmbientMobFactory());
|
| 79 | this.registerParticle(EnumParticleTypes.SPELL_WITCH.getParticleID(), new EntitySpellParticleFX.WitchFactory());
|
| 80 | this.registerParticle(EnumParticleTypes.DRIP_WATER.getParticleID(), new EntityDropParticleFX.WaterFactory());
|
| 81 | this.registerParticle(EnumParticleTypes.DRIP_LAVA.getParticleID(), new EntityDropParticleFX.LavaFactory());
|
| 82 | this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new EntityHeartFX.AngryVillagerFactory());
|
| 83 | this.registerParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), new EntityAuraFX.HappyVillagerFactory());
|
| 84 | this.registerParticle(EnumParticleTypes.TOWN_AURA.getParticleID(), new EntityAuraFX.Factory());
|
| 85 | this.registerParticle(EnumParticleTypes.NOTE.getParticleID(), new EntityNoteFX.Factory());
|
| 86 | this.registerParticle(EnumParticleTypes.PORTAL.getParticleID(), new EntityPortalFX.Factory());
|
| 87 | this.registerParticle(EnumParticleTypes.ENCHANTMENT_TABLE.getParticleID(), new EntityEnchantmentTableParticleFX.EnchantmentTable());
|
| 88 | this.registerParticle(EnumParticleTypes.FLAME.getParticleID(), new EntityFlameFX.Factory());
|
| 89 | this.registerParticle(EnumParticleTypes.LAVA.getParticleID(), new EntityLavaFX.Factory());
|
| 90 | this.registerParticle(EnumParticleTypes.FOOTSTEP.getParticleID(), new EntityFootStepFX.Factory());
|
| 91 | this.registerParticle(EnumParticleTypes.CLOUD.getParticleID(), new EntityCloudFX.Factory());
|
| 92 | this.registerParticle(EnumParticleTypes.REDSTONE.getParticleID(), new EntityReddustFX.Factory());
|
| 93 | this.registerParticle(EnumParticleTypes.SNOWBALL.getParticleID(), new EntityBreakingFX.SnowballFactory());
|
| 94 | this.registerParticle(EnumParticleTypes.SNOW_SHOVEL.getParticleID(), new EntitySnowShovelFX.Factory());
|
| 95 | this.registerParticle(EnumParticleTypes.SLIME.getParticleID(), new EntityBreakingFX.SlimeFactory());
|
| 96 | this.registerParticle(EnumParticleTypes.HEART.getParticleID(), new EntityHeartFX.Factory());
|
| 97 | this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory());
|
| 98 | this.registerParticle(EnumParticleTypes.ITEM_CRACK.getParticleID(), new EntityBreakingFX.Factory());
|
| 99 | this.registerParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), new EntityDiggingFX.Factory());
|
| 100 | this.registerParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), new EntityBlockDustFX.Factory());
|
| 101 | this.registerParticle(EnumParticleTypes.EXPLOSION_HUGE.getParticleID(), new EntityHugeExplodeFX.Factory());
|
| 102 | this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory());
|
| 103 | this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory());
|
| 104 | this.registerParticle(EnumParticleTypes.MOB_APPEARANCE.getParticleID(), new MobAppearance.Factory());
|
| 105 | }
|
| 106 |
|
| 107 | public void registerParticle(int id, IParticleFactory particleFactory)
|
| 108 | {
|
| 109 | this.particleTypes.put(Integer.valueOf(id), particleFactory);
|
| 110 | }
|
| 111 |
|
| 112 | public void emitParticleAtEntity(Entity entityIn, EnumParticleTypes particleTypes)
|
| 113 | {
|
| 114 | this.particleEmitters.add(new EntityParticleEmitter(this.worldObj, entityIn, particleTypes));
|
| 115 | }
|
| 116 |
|
| 117 | /**
|
| 118 | * Spawns the relevant particle according to the particle id.
|
| 119 | *
|
| 120 | * @param xCoord X position of the particle
|
| 121 | * @param yCoord Y position of the particle
|
| 122 | * @param zCoord Z position of the particle
|
| 123 | * @param xSpeed X speed of the particle
|
| 124 | * @param ySpeed Y speed of the particle
|
| 125 | * @param zSpeed Z speed of the particle
|
| 126 | * @param parameters Parameters for the particle (color for redstone, ...)
|
| 127 | */
|
| 128 | public EntityFX spawnEffectParticle(int particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters)
|
| 129 | {
|
| 130 | IParticleFactory iparticlefactory = (IParticleFactory)this.particleTypes.get(Integer.valueOf(particleId));
|
| 131 |
|
| 132 | if (iparticlefactory != null)
|
| 133 | {
|
| 134 | EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
|
| 135 |
|
| 136 | if (entityfx != null)
|
| 137 | {
|
| 138 | this.addEffect(entityfx);
|
| 139 | return entityfx;
|
| 140 | }
|
| 141 | }
|
| 142 |
|
| 143 | return null;
|
| 144 | }
|
| 145 |
|
| 146 | public void addEffect(EntityFX effect)
|
| 147 | {
|
| 148 | int i = effect.getFXLayer();
|
| 149 | int j = effect.getAlpha() != 1.0F ? 0 : 1;
|
| 150 |
|
| 151 | if (this.fxLayers[i][j].size() >= 4000)
|
| 152 | {
|
| 153 | this.fxLayers[i][j].remove(0);
|
| 154 | }
|
| 155 |
|
| 156 | this.fxLayers[i][j].add(effect);
|
| 157 | }
|
| 158 |
|
| 159 | public void updateEffects()
|
| 160 | {
|
| 161 | for (int i = 0; i < 4; ++i)
|
| 162 | {
|
| 163 | this.updateEffectLayer(i);
|
| 164 | }
|
| 165 |
|
| 166 | List<EntityParticleEmitter> list = Lists.<EntityParticleEmitter>newArrayList();
|
| 167 |
|
| 168 | for (EntityParticleEmitter entityparticleemitter : this.particleEmitters)
|
| 169 | {
|
| 170 | entityparticleemitter.onUpdate();
|
| 171 |
|
| 172 | if (entityparticleemitter.isDead)
|
| 173 | {
|
| 174 | list.add(entityparticleemitter);
|
| 175 | }
|
| 176 | }
|
| 177 |
|
| 178 | this.particleEmitters.removeAll(list);
|
| 179 | }
|
| 180 |
|
| 181 | private void updateEffectLayer(int layer)
|
| 182 | {
|
| 183 | for (int i = 0; i < 2; ++i)
|
| 184 | {
|
| 185 | this.updateEffectAlphaLayer(this.fxLayers[layer][i]);
|
| 186 | }
|
| 187 | }
|
| 188 |
|
| 189 | private void updateEffectAlphaLayer(List<EntityFX> entitiesFX)
|
| 190 | {
|
| 191 | List<EntityFX> list = Lists.<EntityFX>newArrayList();
|
| 192 |
|
| 193 | for (int i = 0; i < entitiesFX.size(); ++i)
|
| 194 | {
|
| 195 | EntityFX entityfx = (EntityFX)entitiesFX.get(i);
|
| 196 | this.tickParticle(entityfx);
|
| 197 |
|
| 198 | if (entityfx.isDead)
|
| 199 | {
|
| 200 | list.add(entityfx);
|
| 201 | }
|
| 202 | }
|
| 203 |
|
| 204 | entitiesFX.removeAll(list);
|
| 205 | }
|
| 206 |
|
| 207 | private void tickParticle(final EntityFX particle)
|
| 208 | {
|
| 209 | try
|
| 210 | {
|
| 211 | particle.onUpdate();
|
| 212 | }
|
| 213 | catch (Throwable throwable)
|
| 214 | {
|
| 215 | CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking Particle");
|
| 216 | CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being ticked");
|
| 217 | final int i = particle.getFXLayer();
|
| 218 | crashreportcategory.addCrashSectionCallable("Particle", new Callable<String>()
|
| 219 | {
|
| 220 | public String call() throws Exception
|
| 221 | {
|
| 222 | return particle.toString();
|
| 223 | }
|
| 224 | });
|
| 225 | crashreportcategory.addCrashSectionCallable("Particle Type", new Callable<String>()
|
| 226 | {
|
| 227 | public String call() throws Exception
|
| 228 | {
|
| 229 | return i == 0 ? "MISC_TEXTURE" : (i == 1 ? "TERRAIN_TEXTURE" : (i == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i));
|
| 230 | }
|
| 231 | });
|
| 232 | throw new ReportedException(crashreport);
|
| 233 | }
|
| 234 | }
|
| 235 |
|
| 236 | /**
|
| 237 | * Renders all current particles. Args player, partialTickTime
|
| 238 | */
|
| 239 | public void renderParticles(Entity entityIn, float partialTicks)
|
| 240 | {
|
| 241 | float f = ActiveRenderInfo.getRotationX();
|
| 242 | float f1 = ActiveRenderInfo.getRotationZ();
|
| 243 | float f2 = ActiveRenderInfo.getRotationYZ();
|
| 244 | float f3 = ActiveRenderInfo.getRotationXY();
|
| 245 | float f4 = ActiveRenderInfo.getRotationXZ();
|
| 246 | EntityFX.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
|
| 247 | EntityFX.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
|
| 248 | EntityFX.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
|
| 249 | GlStateManager.enableBlend();
|
| 250 | GlStateManager.blendFunc(770, 771);
|
| 251 | GlStateManager.alphaFunc(516, 0.003921569F);
|
| 252 |
|
| 253 | for (int i = 0; i < 3; ++i)
|
| 254 | {
|
| 255 | for (int j = 0; j < 2; ++j)
|
| 256 | {
|
| 257 | final int i_f = i;
|
| 258 |
|
| 259 | if (!this.fxLayers[i][j].isEmpty())
|
| 260 | {
|
| 261 | switch (j)
|
| 262 | {
|
| 263 | case 0:
|
| 264 | GlStateManager.depthMask(false);
|
| 265 | break;
|
| 266 |
|
| 267 | case 1:
|
| 268 | GlStateManager.depthMask(true);
|
| 269 | }
|
| 270 |
|
| 271 | switch (i)
|
| 272 | {
|
| 273 | case 0:
|
| 274 | default:
|
| 275 | this.renderer.bindTexture(particleTextures);
|
| 276 | break;
|
| 277 |
|
| 278 | case 1:
|
| 279 | this.renderer.bindTexture(TextureMap.locationBlocksTexture);
|
| 280 | }
|
| 281 |
|
| 282 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 283 | Tessellator tessellator = Tessellator.getInstance();
|
| 284 | WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
| 285 | worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
| 286 |
|
| 287 | for (int k = 0; k < this.fxLayers[i][j].size(); ++k)
|
| 288 | {
|
| 289 | final EntityFX entityfx = (EntityFX)this.fxLayers[i][j].get(k);
|
| 290 |
|
| 291 | try
|
| 292 | {
|
| 293 | entityfx.renderParticle(worldrenderer, entityIn, partialTicks, f, f4, f1, f2, f3);
|
| 294 | }
|
| 295 | catch (Throwable throwable)
|
| 296 | {
|
| 297 | CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
|
| 298 | CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being rendered");
|
| 299 | crashreportcategory.addCrashSectionCallable("Particle", new Callable<String>()
|
| 300 | {
|
| 301 | public String call() throws Exception
|
| 302 | {
|
| 303 | return entityfx.toString();
|
| 304 | }
|
| 305 | });
|
| 306 | crashreportcategory.addCrashSectionCallable("Particle Type", new Callable<String>()
|
| 307 | {
|
| 308 | public String call() throws Exception
|
| 309 | {
|
| 310 | return i_f == 0 ? "MISC_TEXTURE" : (i_f == 1 ? "TERRAIN_TEXTURE" : (i_f == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i_f));
|
| 311 | }
|
| 312 | });
|
| 313 | throw new ReportedException(crashreport);
|
| 314 | }
|
| 315 | }
|
| 316 |
|
| 317 | tessellator.draw();
|
| 318 | }
|
| 319 | }
|
| 320 | }
|
| 321 |
|
| 322 | GlStateManager.depthMask(true);
|
| 323 | GlStateManager.disableBlend();
|
| 324 | GlStateManager.alphaFunc(516, 0.1F);
|
| 325 | }
|
| 326 |
|
| 327 | public void renderLitParticles(Entity entityIn, float partialTick)
|
| 328 | {
|
| 329 | float f = 0.017453292F;
|
| 330 | float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
|
| 331 | float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
|
| 332 | float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
|
| 333 | float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
|
| 334 | float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);
|
| 335 |
|
| 336 | for (int i = 0; i < 2; ++i)
|
| 337 | {
|
| 338 | List<EntityFX> list = this.fxLayers[3][i];
|
| 339 |
|
| 340 | if (!list.isEmpty())
|
| 341 | {
|
| 342 | Tessellator tessellator = Tessellator.getInstance();
|
| 343 | WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
| 344 |
|
| 345 | for (int j = 0; j < list.size(); ++j)
|
| 346 | {
|
| 347 | EntityFX entityfx = (EntityFX)list.get(j);
|
| 348 | entityfx.renderParticle(worldrenderer, entityIn, partialTick, f1, f5, f2, f3, f4);
|
| 349 | }
|
| 350 | }
|
| 351 | }
|
| 352 | }
|
| 353 |
|
| 354 | public void clearEffects(World worldIn)
|
| 355 | {
|
| 356 | this.worldObj = worldIn;
|
| 357 |
|
| 358 | for (int i = 0; i < 4; ++i)
|
| 359 | {
|
| 360 | for (int j = 0; j < 2; ++j)
|
| 361 | {
|
| 362 | this.fxLayers[i][j].clear();
|
| 363 | }
|
| 364 | }
|
| 365 |
|
| 366 | this.particleEmitters.clear();
|
| 367 | }
|
| 368 |
|
| 369 | public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
|
| 370 | {
|
| 371 | if (state.getBlock().getMaterial() != Material.air)
|
| 372 | {
|
| 373 | state = state.getBlock().getActualState(state, this.worldObj, pos);
|
| 374 | int i = 4;
|
| 375 |
|
| 376 | for (int j = 0; j < i; ++j)
|
| 377 | {
|
| 378 | for (int k = 0; k < i; ++k)
|
| 379 | {
|
| 380 | for (int l = 0; l < i; ++l)
|
| 381 | {
|
| 382 | double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
| 383 | double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
| 384 | double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
| 385 | 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));
|
| 386 | }
|
| 387 | }
|
| 388 | }
|
| 389 | }
|
| 390 | }
|
| 391 |
|
| 392 | /**
|
| 393 | * Adds block hit particles for the specified block
|
| 394 | */
|
| 395 | public void addBlockHitEffects(BlockPos pos, EnumFacing side)
|
| 396 | {
|
| 397 | IBlockState iblockstate = this.worldObj.getBlockState(pos);
|
| 398 | Block block = iblockstate.getBlock();
|
| 399 |
|
| 400 | if (block.getRenderType() != -1)
|
| 401 | {
|
| 402 | int i = pos.getX();
|
| 403 | int j = pos.getY();
|
| 404 | int k = pos.getZ();
|
| 405 | float f = 0.1F;
|
| 406 | double d0 = (double)i + this.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinX();
|
| 407 | double d1 = (double)j + this.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinY();
|
| 408 | double d2 = (double)k + this.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinZ();
|
| 409 |
|
| 410 | if (side == EnumFacing.DOWN)
|
| 411 | {
|
| 412 | d1 = (double)j + block.getBlockBoundsMinY() - (double)f;
|
| 413 | }
|
| 414 |
|
| 415 | if (side == EnumFacing.UP)
|
| 416 | {
|
| 417 | d1 = (double)j + block.getBlockBoundsMaxY() + (double)f;
|
| 418 | }
|
| 419 |
|
| 420 | if (side == EnumFacing.NORTH)
|
| 421 | {
|
| 422 | d2 = (double)k + block.getBlockBoundsMinZ() - (double)f;
|
| 423 | }
|
| 424 |
|
| 425 | if (side == EnumFacing.SOUTH)
|
| 426 | {
|
| 427 | d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f;
|
| 428 | }
|
| 429 |
|
| 430 | if (side == EnumFacing.WEST)
|
| 431 | {
|
| 432 | d0 = (double)i + block.getBlockBoundsMinX() - (double)f;
|
| 433 | }
|
| 434 |
|
| 435 | if (side == EnumFacing.EAST)
|
| 436 | {
|
| 437 | d0 = (double)i + block.getBlockBoundsMaxX() + (double)f;
|
| 438 | }
|
| 439 |
|
| 440 | this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
| 441 | }
|
| 442 | }
|
| 443 |
|
| 444 | public void moveToAlphaLayer(EntityFX effect)
|
| 445 | {
|
| 446 | this.moveToLayer(effect, 1, 0);
|
| 447 | }
|
| 448 |
|
| 449 | public void moveToNoAlphaLayer(EntityFX effect)
|
| 450 | {
|
| 451 | this.moveToLayer(effect, 0, 1);
|
| 452 | }
|
| 453 |
|
| 454 | private void moveToLayer(EntityFX effect, int layerFrom, int layerTo)
|
| 455 | {
|
| 456 | for (int i = 0; i < 4; ++i)
|
| 457 | {
|
| 458 | if (this.fxLayers[i][layerFrom].contains(effect))
|
| 459 | {
|
| 460 | this.fxLayers[i][layerFrom].remove(effect);
|
| 461 | this.fxLayers[i][layerTo].add(effect);
|
| 462 | }
|
| 463 | }
|
| 464 | }
|
| 465 |
|
| 466 | public String getStatistics()
|
| 467 | {
|
| 468 | int i = 0;
|
| 469 |
|
| 470 | for (int j = 0; j < 4; ++j)
|
| 471 | {
|
| 472 | for (int k = 0; k < 2; ++k)
|
| 473 | {
|
| 474 | i += this.fxLayers[j][k].size();
|
| 475 | }
|
| 476 | }
|
| 477 |
|
| 478 | return "" + i;
|
| 479 | }
|
| 480 | }
|
| 481 |
|