public static void updateReddustFX(Particle p_updateReddustFX_0_, IBlockAccess p_updateReddustFX_1_, double p_updateReddustFX_2_, double p_updateReddustFX_4_, double p_updateReddustFX_6_) { if (redstoneColors != null) { IBlockState iblockstate = p_updateReddustFX_1_.getBlockState(new BlockPos(p_updateReddustFX_2_, p_updateReddustFX_4_, p_updateReddustFX_6_)); int i = getRedstoneLevel(iblockstate, 15); int j = redstoneColors.getColor(i); int k = j >> 16 & 255; int l = j >> 8 & 255; int i1 = j & 255; float f = (float)k / 255.0F; float f1 = (float)l / 255.0F; float f2 = (float)i1 / 255.0F; p_updateReddustFX_0_.setRBGColorF(f, f1, f2); } }
@Nullable private Particle spawnEntityFX(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters) { Entity entity = this.mc.getRenderViewEntity(); if (this.mc != null && entity != null && this.mc.effectRenderer != null) { int i = this.mc.gameSettings.particleSetting; if (i == 1 && this.theWorld.rand.nextInt(3) == 0) { i = 2; } double d0 = entity.posX - xCoord; double d1 = entity.posY - yCoord; double d2 = entity.posZ - zCoord; return ignoreRange ? this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters) : (d0 * d0 + d1 * d1 + d2 * d2 > 1024.0D ? null : (i > 1 ? null : this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters))); } else { return null; } }
@SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx) { final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer; final IForgeRegistry<ICustomParticleFactory> registry = GameRegistry.findRegistry(ICustomParticleFactory.class); final ICustomParticleFactory factory = registry.getValue(message.getParticleResourceLocation()); final Particle particle = factory.getParticleFactory().createParticle(-1, Minecraft.getMinecraft().thePlayer.worldObj, message.getXCoordinate(), message.getYCoordinate(), message.getZCoordinate(), message.getParticleSpeed(), message.getParticleSpeed(), message.getParticleSpeed(), message.getParticleArgs() ); effectRenderer.addEffect(particle); return null; }
@Override public void doRender(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks) { super.doRender(entity, x, y, z, entityYaw, partialTicks); if (ticks > 40) { Particle chestFlame = new EntityBigFlameFX(entity.getEntityWorld(), entity.posX, entity.posY + 2.1, entity.posZ, 3, 0.1F, 0.85F, 0.1F); Minecraft.getMinecraft().effectRenderer.addEffect(chestFlame); double dz = 0.3 * Math.cos(Math.toRadians(45) + model.getSkull().rotateAngleZ); double dy = Math.sin(model.getSkull().rotateAngleY); double dx = 0.65 * Math.cos(Math.toRadians(45) + model.getSkull().rotateAngleX) * dy; Particle leftEyeFlame = new EntityBigFlameFX(entity.getEntityWorld(), entity.posX - dx, entity.posY + 2.82 - dy, entity.posZ + dz, 0.9F, 0.1F, 0.85F, 0.1F); Minecraft.getMinecraft().effectRenderer.addEffect(leftEyeFlame); Particle rightEyeFlame = new EntityBigFlameFX(entity.getEntityWorld(), entity.posX + dx, entity.posY + 2.82 - dy, entity.posZ + dz, 0.9F, 0.1F, 0.85F, 0.1F); Minecraft.getMinecraft().effectRenderer.addEffect(rightEyeFlame); ticks = 0; } else { ticks++; } }
/** * A randomly called display update to be able to add particles or other * items for display */ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) { if (EnumSpawner.SPIDER_SPAWNER.ordinal() != getMetaFromState(state)) { double xPos = pos.getX() + 0.5F; double yPos = pos.getY() + 0.85; double zPos = pos.getZ() + 0.5F; double dRotation = Math.toRadians(72); double rotation = Math.toRadians(-36); double d = 1.07; double dx; double dz; for (int i = 0; i < 5; i++) { dx = -Math.sin(rotation) * d; dz = Math.cos(rotation) * d; world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, xPos + dx, yPos, zPos + dz, 0, 0, 0); Particle entityfx = new EntityGreenFlameFX(world, xPos + dx, yPos, zPos + dz, 0, 0, 0); Minecraft.getMinecraft().effectRenderer.addEffect(entityfx); rotation += dRotation; } } }
/** * A randomly called display update to be able to add particles or other * items for display */ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) { TileEntitySkullCandle tileEntity = (TileEntitySkullCandle) world.getTileEntity(pos); if (tileEntity != null) { double xPos = pos.getX() + 0.5F; double yPos = pos.getY() + 0.85; double zPos = pos.getZ() + 0.5F; double rotation = Math.toRadians(tileEntity.getRotation() * 360 / 8F); double d = 0.07; double dx = -Math.sin(rotation) * d; double dz = Math.cos(rotation) * d; long dayTime = TimeHelper.getDayTime(world); if (dayTime < TimeHelper.SUN_SET || dayTime > TimeHelper.SUN_RISING) { world.spawnParticle(EnumParticleTypes.FLAME, xPos + dx, yPos, zPos + dz, 0, 0, 0); } else { Particle entityfx = new EntityGreenFlameFX(world, xPos + dx, yPos, zPos + dz, 0, 0, 0); Minecraft.getMinecraft().effectRenderer.addEffect(entityfx); } world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, xPos + dx, yPos, zPos + dz, 0, 0, 0); } }
/** * A randomly called display update to be able to add particles or other * items for display */ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) { double xPos = pos.getX() + 0.5; double yPos = pos.getY() + 0.5; double zPos = pos.getZ() + 0.5; long dayTime = TimeHelper.getDayTime(world); if (dayTime < TimeHelper.SUN_SET || dayTime > TimeHelper.SUN_RISING) { world.spawnParticle(EnumParticleTypes.FLAME, xPos, yPos, zPos, 0, 0, 0); } else { Particle entityfx = new EntityGreenFlameFX(world, xPos, yPos, zPos, 0, 0, 0); Minecraft.getMinecraft().effectRenderer.addEffect(entityfx); } world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, xPos, yPos, zPos, 0, 0, 0); }
public static void render(double x, double y, double z, Colour colour, double s, double u1, double v1, double u2, double v2) { x -= Particle.interpPosX; y -= Particle.interpPosY; z -= Particle.interpPosZ; float par3 = ActiveRenderInfo.getRotationX(); float par4 = ActiveRenderInfo.getRotationXZ(); float par5 = ActiveRenderInfo.getRotationZ(); float par6 = ActiveRenderInfo.getRotationYZ(); float par7 = ActiveRenderInfo.getRotationXY(); VertexBuffer b = Tessellator.getInstance().getBuffer(); b.pos((x - par3 * s - par6 * s), (y - par4 * s), (z - par5 * s - par7 * s)).tex(u2, v2).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex(); b.pos((x - par3 * s + par6 * s), (y + par4 * s), (z - par5 * s + par7 * s)).tex(u2, v1).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex(); b.pos((x + par3 * s + par6 * s), (y + par4 * s), (z + par5 * s + par7 * s)).tex(u1, v1).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex(); b.pos((x + par3 * s - par6 * s), (y - par4 * s), (z + par5 * s - par7 * s)).tex(u1, v2).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex(); }
@Override public IMessage onMessage(MessageSpawnGoreParticles message, MessageContext ctx) { if(ctx.side != Side.CLIENT) throw new IllegalStateException("Cannot send MessageSpawnGoreParticles to a server!"); double count = message.count * MCDoom.instance.getGoreProperty().getDouble(); for (int i = 0; i < count; i++) { float dx = (float) rand.nextGaussian() * 0.5f; float dy = (float) rand.nextGaussian() * 0.5f; float dz = (float) rand.nextGaussian() * 0.5f; float mx = (float) rand.nextGaussian() * 0.1f; float my = (float) (rand.nextGaussian()/2f + 0.5f) * 0.75f; float mz = (float) rand.nextGaussian() * 0.1f; Particle particle = new EntityGoreFX(Minecraft.getMinecraft().theWorld, message.x+dx, message.y+dy, message.z+dz, mx, my, mz); MCDoom.proxy.spawnParticle(particle); } return null; }
@SideOnly(Side.CLIENT) private void spawnParticles() { IParticleFactory particleFactory = new ModParticles.Factory(); long worldTime = getEntityWorld().getTotalWorldTime(); if (worldTime % 8 == 0) { double initialYSpeed = 0.05D; Vec3d forwardVec = getForward(); Vec3d speedVec = new Vec3d(0, -forwardVec.y * 0.10 + initialYSpeed, 0); float yPos = (float) this.getEntityBoundingBox().minY; for (int j = 0; j < 2; ++j) { float xPos = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; float zPos = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; Particle particle = particleFactory.createParticle(ModParticles.WOLF_IDLE_SMOKE, getEntityWorld(), this.posX + (double) xPos, (double) (yPos + 0.1F), this.posZ + (double) zPos, speedVec.x, speedVec.y, speedVec.z); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } } }
@Nullable public Particle createParticle(int particleID, @Nonnull World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { Particle ret = null; switch (particleID) { case WOLF_IDLE_SMOKE: { ret = new WolfIdleParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); break; } default: { FMLLog.log(Level.ERROR, "Unknown particleId: " + particleID); break; } } return ret; }
private void spawnParticles() { double startX = posX; double startY = posY; double startZ = posZ; double offsetScale = 0.8 * getScale(); for (int i = 0; i < 2; i++) { double xOffset = offsetScale - rand.nextFloat() * offsetScale * 2; double yOffset = offsetScale / 3 + rand.nextFloat() * offsetScale / 3 * 2F; double zOffset = offsetScale - rand.nextFloat() * offsetScale * 2; Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D); if (fx != null) { fx.setRBGColorF(0.8f, 0.2f, 0.2f); } } }
@Override public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) { if (isActive(world, pos) && shouldDoWorkThisTick(world, pos, 5)) { float startX = pos.getX() + 1.0F; float startY = pos.getY() + 0.85F; float startZ = pos.getZ() + 1.0F; for (int i = 0; i < 1; i++) { float xOffset = -0.2F - rand.nextFloat() * 0.6F; float yOffset = -0.1F + rand.nextFloat() * 0.2F; float zOffset = -0.2F - rand.nextFloat() * 0.6F; Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D); if (fx != null) { fx.setRBGColorF(0.2f, 0.2f, 0.8f); ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5); } } } }
@Override public IMessage onMessage(PacketXpTransferEffects message, MessageContext ctx) { EntityPlayer player = EnderIO.proxy.getClientPlayer(); if (player != null) { int particleCount = 1; if (message.swing) { player.swingArm(EnumHand.MAIN_HAND); particleCount = 5; } for (int i = 0; i < particleCount; i++) { float xOffset = 0.1F - player.world.rand.nextFloat() * 0.2F; float yOffset = 0.1F - player.world.rand.nextFloat() * 0.2F; float zOffset = 0.1F - player.world.rand.nextFloat() * 0.2F; Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), message.x + xOffset, message.y + yOffset, message.z + zOffset, 0.0D, 0.0D, 0.0D); if (fx != null) { fx.setRBGColorF(0.2f, 0.8f, 0.2f); ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5); } } } return null; }
@SideOnly(Side.CLIENT) @Override public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); // If active, randomly throw some smoke around if (isActive(world, pos)) { float startX = x + 1.0F; float startY = y + 1.0F; float startZ = z + 1.0F; for (int i = 0; i < 2; i++) { float xOffset = -0.2F - rand.nextFloat() * 0.6F; float yOffset = -0.1F + rand.nextFloat() * 0.2F; float zOffset = -0.2F - rand.nextFloat() * 0.6F; Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D, 0); if (fx != null) { fx.setRBGColorF(0.2f, 0.2f, 0.8f); ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5); } } } }
@Override public Particle spawnParticle(EnumHarshenParticle type, Vec3d position, Vec3d directionSpeed, float scale, boolean disableMoving, Object...info) { Minecraft minecraft = Minecraft.getMinecraft(); Particle entityFx = null; if(minecraft.world != null) switch (type) { case BLOOD: entityFx = new ParticleBlood(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale, disableMoving); break; case CAULDRON: if(info.length > 0 ) if(info[0] instanceof ResourceLocation) entityFx = new ParticleCauldron(minecraft.world, (ResourceLocation) info[0], position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving); if(info[0] instanceof IBlockState) entityFx = new ParticleCauldron(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving, ((IBlockState)info[0])); break; case ITEM: if(info.length > 0 && info[0] instanceof ItemStack) entityFx = new ParticleItem(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving, (ItemStack) info[0]); break; case PORTAL: entityFx = new ParticlePortal.Factory().createParticle(EnumParticleTypes.PORTAL.getParticleID(), minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z); entityFx.setMaxAge((int)(Math.random() * 20.0D) + 100); case CAULDRON_LIQUID: if(info.length > 0) if(info[0] instanceof ResourceLocation) entityFx = new ParticleCauldronTop(minecraft.world, position.x, position.y, position.z, scale, (ResourceLocation) info[0]).setDirectScale(scale); else if(info[0] instanceof IBlockState) entityFx = new ParticleCauldronTop(minecraft.world, position.x, position.y, position.z, scale, ((IBlockState) info[0])).setDirectScale(scale); break; default: break; } if (entityFx != null) {minecraft.effectRenderer.addEffect(entityFx);} return entityFx; }
public void update() { for(int i = 0; i < particles.size(); i++) { Particle particle = particles.get(i); if(!particle.isAlive()) { particles.remove(i); } else { particle.onUpdate(); } } }
@SideOnly(Side.CLIENT) @Override public Particle createLinkParticle(double xpos, double ypos, double zpos, double velocityX, double velocityY, double velocityZ, NodeLink link) { Color col = getColourForSide(link.getOutputSide()); float red = (float)col.getRed() / 255F; float green = (float)col.getGreen() / 255F; float blue = (float)col.getBlue() / 255F; return new ParticleLinkColoured(world, xpos, ypos, zpos, velocityX, velocityY, velocityZ, link.getLinkPos(), red, green, blue); }
public void renderParticles(EntityPlayer dumbplayer, float partialTicks) { float f = ActiveRenderInfo.getRotationX(); float f1 = ActiveRenderInfo.getRotationZ(); float f2 = ActiveRenderInfo.getRotationYZ(); float f3 = ActiveRenderInfo.getRotationXY(); float f4 = ActiveRenderInfo.getRotationXZ(); EntityPlayer player = EasyMappings.player(); if (player != null) { Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; Particle.cameraViewDir = player.getLook(partialTicks); //GlStateManager.glTexParameterf(3553, 10242, 10497.0F); //GlStateManager.glTexParameterf(3553, 10243, 10497.0F); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); //GlStateManager.alphaFunc(GL11.GL_GREATER, 0F); GlStateManager.disableCull(); GlStateManager.depthMask(false); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for (int i = 0; i < particles.size(); i++) { particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3); } tess.draw(); GlStateManager.enableCull(); GlStateManager.depthMask(true); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); //GlStateManager.alphaFunc(516, 0.1F); } }
public static void spawn(EnumParticles particleType, World world, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) { if (world == null || FMLCommonHandler.instance().getSide().isServer()) { return; } Particle particle = null; switch (particleType) { case LOVE: particle = new ParticleLove(world, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); break; case PORTAL_GREEN: particle = new ParticlePortal2(world, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); break; case PORTAL: particle = new ParticleVanillaPortal(world, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); break; default: break; } switch (particleType.getRenderer()) { case "custom": ParticleRenderer.getInstance().addParticle(particle); break; case "vanilla": Minecraft.getMinecraft().effectRenderer.addEffect(particle); break; } }
@Override public void update(World world) { if (ticks%3==0) { locationBuffer.clear(); pickRing(0.5f, SEGMENTS); for(Vec2f vec : locationBuffer) { Particle particle = new ParticleVelocity(world, x+vec.x, y+0.5f, z+vec.y, 0f, -0.3f, 0f ); particle.setParticleTextureIndex(5); //Midway through redstone particle.setRBGColorF(0.7f, 0.2f, 0.7f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } } float sx = (rnd.nextFloat()*2) - 1; float sz = (rnd.nextFloat()*2) - 1; if (rnd.nextBoolean()) { Particle star = new ParticleVelocity(world, x+sx, y-0.5f, z+sz, 0f, 0.35f, 0f ); star.setParticleTextureIndex(65); //Crit stars Minecraft.getMinecraft().effectRenderer.addEffect(star); } //star.setRBGColorF(0.7f, 0.2f, 0.7f); if (ticks>9) die(); }
public static void updatePortalFX(Particle p_updatePortalFX_0_) { if (particlePortalColor >= 0) { int i = particlePortalColor; int j = i >> 16 & 255; int k = i >> 8 & 255; int l = i & 255; float f = (float)j / 255.0F; float f1 = (float)k / 255.0F; float f2 = (float)l / 255.0F; p_updatePortalFX_0_.setRBGColorF(f, f1, f2); } }
public static void updateMyceliumFX(Particle p_updateMyceliumFX_0_) { if (myceliumParticleColors != null) { int i = myceliumParticleColors.getColorRandom(); int j = i >> 16 & 255; int k = i >> 8 & 255; int l = i & 255; float f = (float)j / 255.0F; float f1 = (float)k / 255.0F; float f2 = (float)l / 255.0F; p_updateMyceliumFX_0_.setRBGColorF(f, f1, f2); } }
public static void updateWaterFX(Particle p_updateWaterFX_0_, IBlockAccess p_updateWaterFX_1_, double p_updateWaterFX_2_, double p_updateWaterFX_4_, double p_updateWaterFX_6_, RenderEnv p_updateWaterFX_8_) { if (waterColors != null || blockColormaps != null) { BlockPos blockpos = new BlockPos(p_updateWaterFX_2_, p_updateWaterFX_4_, p_updateWaterFX_6_); p_updateWaterFX_8_.reset(p_updateWaterFX_1_, BLOCK_STATE_WATER, blockpos); int i = getFluidColor(p_updateWaterFX_1_, BLOCK_STATE_WATER, blockpos, p_updateWaterFX_8_); int j = i >> 16 & 255; int k = i >> 8 & 255; int l = i & 255; float f = (float)j / 255.0F; float f1 = (float)k / 255.0F; float f2 = (float)l / 255.0F; if (particleWaterColor >= 0) { int i1 = particleWaterColor >> 16 & 255; int j1 = particleWaterColor >> 8 & 255; int k1 = particleWaterColor & 255; f *= (float)i1 / 255.0F; f1 *= (float)j1 / 255.0F; f2 *= (float)k1 / 255.0F; } p_updateWaterFX_0_.setRBGColorF(f, f1, f2); } }
public static void spawnParticle(World world, Particle entity) { if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().getRenderViewEntity() != null && Minecraft.getMinecraft().effectRenderer != null) { int i = Minecraft.getMinecraft().gameSettings.particleSetting; if (i == 1 && world.rand.nextInt(3) == 0) i = 2; if (i > 1) { entity.setExpired(); return; } Minecraft.getMinecraft().effectRenderer.addEffect(entity); } }
/** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { if (this.entity != null) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setRenderPosition(Particle.interpPosX, Particle.interpPosY, Particle.interpPosZ); float particleAge = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; GlStateManager.depthMask(true); GlStateManager.enableBlend(); GlStateManager.enableDepth(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); float lightLevel = 240.0F; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightLevel, lightLevel); GlStateManager.pushMatrix(); float alpha = 0.05F + 0.5F * MathHelper.sin(particleAge * (float)Math.PI); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); GlStateManager.translate(0.0F, 1.8F, 0.0F); GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F); float speed = 150.0F; GlStateManager.rotate(260 - (60.0F - speed * particleAge - entityIn.rotationPitch), 1.0F, 0.0F, 0.0F); float scale = 1.2F; GlStateManager.translate(0.0F, -0.4F, -2.2); GlStateManager.rotate(30.0f, 1.0F, 0.0F, 0.0F); GlStateManager.scale(scale, scale, scale); this.entity.rotationYaw = 0.0F; this.entity.rotationYawHead = 0.0F; this.entity.prevRotationYaw = 0.0F; this.entity.prevRotationYawHead = 0.0F; rendermanager.doRenderEntity(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false); GlStateManager.popMatrix(); GlStateManager.enableDepth(); } }
/** Spawns a particle only if it is in the allowed set. */ @Override public Particle spawnEffectParticle(int particleID, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters) { if (allowed.contains(particleID)) { return super.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters); } return null; }
@Override protected void spawnJetParticle() { final double motionX = RANDOM.nextGaussian() * 0.03D; final double motionZ = RANDOM.nextGaussian() * 0.03D; final double x = this.posX + RANDOM.nextGaussian() * 0.2D; final double z = this.posZ + RANDOM.nextGaussian() * 0.2D; final Particle particle = new ParticleFountain(this.world, x, this.posY, z, motionX, 0.5D, motionZ, this.block) .init(); addParticle(particle); }
@Override protected void spawnJetParticle() { final double speedY = this.isLava ? 0 : this.jetStrength / 10.0D; final Particle particle = this.factory.createParticle(this.particleId, this.world, this.posX, this.posY, this.posZ, 0D, speedY, 0D); if (!this.isLava) { final ParticleFlame flame = (ParticleFlame) particle; flame.flameScale *= this.jetStrength; } addParticle(particle); }
@Override protected void spawnJetParticle() { final double x = this.posX + RANDOM.nextGaussian() * 0.2D; final double z = this.posZ + RANDOM.nextGaussian() * 0.2D; final Particle particle = new ParticleDust(this.world, x, this.posY, z, this.blockState).init(); addParticle(particle); }
private void displayParticle(Entity entity, int damage) { if (damage == 0) { return; } World world = entity.world; double motionX = world.rand.nextGaussian() * 0.02; double motionY = 0.5f; double motionZ = world.rand.nextGaussian() * 0.02; Particle damageIndicator = new DamageParticle(damage, world, entity.posX, entity.posY + entity.height, entity.posZ, motionX, motionY, motionZ); Minecraft.getMinecraft().effectRenderer.addEffect(damageIndicator); }
private Particle spawnEffectParticle(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int... parameters) { Entity entity = this.mc.getRenderViewEntity(); if (this.mc != null && entity != null && this.mc.effectRenderer != null) { int particleSetting = this.mc.gameSettings.particleSetting; if (particleSetting == 1 && this.mc.world.rand.nextInt(3) == 0) { particleSetting = 2; } double deltaX = entity.posX - xCoord; double deltaY = entity.posY - yCoord; double deltaZ = entity.posZ - zCoord; if (ignoreRange) { return this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters); } else { if (deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 1024.0D) { return null; } else { if (particleSetting > 1) { return null; } else { return this.mc.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters); } } } } else { return null; } }
public static void transformEffect(Particle particle) { BlockSystem transforming = BlockSystem.transforming; if (transforming != null) { Point3d transformed = transforming.getTransformedPosition(new Point3d(particle.posX, particle.posY, particle.posZ)); particle.setPosition(transformed.getX(), transformed.getY(), transformed.getZ()); particle.prevPosX = transformed.getX(); particle.prevPosY = transformed.getY(); particle.prevPosZ = transformed.getZ(); Vec3d transformedVelocity = transforming.getTransformedVector(new Vec3d(particle.motionX, particle.motionY, particle.motionZ)); particle.motionX = transformedVelocity.xCoord; particle.motionY = transformedVelocity.yCoord; particle.motionZ = transformedVelocity.zCoord; } }
@Override public boolean transform(ClassNode classNode, String transformedName) { MethodNode addEffect = this.getMethod(classNode, "addEffect", Particle.class, void.class); if (addEffect != null) { Instruction instructions = this.instruction() .var(ALOAD, 1) .method(INVOKESTATIC, BlockSystemHooks.class, "transformEffect", Particle.class, void.class); this.insertAfter(addEffect, node -> node.getOpcode() == POP, instructions.build(), false); return true; } return false; }
public static Particle generatePopcornParticles(World parWorld,double parX, double parY, double parZ,double parMotionX, double parMotionY, double parMotionZ,NBTTagCompound nbt,int age) { Particle particle = new EntityParticlePopcornFX(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); ((EntityParticlePopcornFX)particle).fireworkExplosions = nbt.getTagList("Explosions", 10); ((EntityParticlePopcornFX)particle).fireworkAge = 0; Minecraft.getMinecraft().effectRenderer.addEffect(particle); return particle; }
public static void updateParticleList() { for(int i = 0; i < PARTICLES.size(); i++) //For-each results in a ConcurrentModificationException { Particle particle = PARTICLES.get(i); particle.onUpdate(); } }
public ParticleSpawnInfo(Particle particle) { try { x = particlePosX.getDouble(particle); y = particlePosY.getDouble(particle); z = particlePosZ.getDouble(particle); xSpeed = particleMotionX.getDouble(particle); ySpeed = particleMotionY.getDouble(particle); zSpeed = particleMotionZ.getDouble(particle); } catch (Exception e) { throw Throwables.propagate(e); } red = particle.getRedColorF(); green = particle.getGreenColorF(); blue = particle.getBlueColorF(); }
@Override public void addEffectBypassingLimit(Particle entityFX) { if (Config.overrideMaxParticleLimit) { Minecraft.getMinecraft().effectRenderer.fxLayers[entityFX.getFXLayer()][entityFX.particleAlpha != 1 ? 0 : 1].add(entityFX); } else { //TODO Fix the alternative to the config. //Minecraft.getMinecraft().theWorld.spawnEntityInWorld(entityFX); } }
public void spawnParticleLegacy(String particleName, double posX, double posY, double posZ, double velX, double velY, double velZ){ Minecraft mc = Minecraft.getMinecraft(); World theWorld = mc.world; if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null) { int var14 = mc.gameSettings.particleSetting; if (var14 == 1 && theWorld.rand.nextInt(3) == 0) var14 = 2; double var15 = mc.getRenderViewEntity().posX - posX; double var17 = mc.getRenderViewEntity().posY - posY; double var19 = mc.getRenderViewEntity().posZ - posZ; Particle var21 = null; double var22 = 16.0D; if (var15 * var15 + var17 * var17 + var19 * var19 > var22 * var22) return; else if (var14 > 1) return; else { if (particleName.equals("CorBlood")) { var21 = new ACParticleFX(theWorld, posX, posY, posZ, (float)velX, (float)velY, (float)velZ); var21.setRBGColorF(0, 1, 1); } mc.effectRenderer.addEffect(var21); return; } } }