当前位置: 首页>>代码示例>>Java>>正文


Java ParticleBuilder.setColorFunction方法代码示例

本文整理汇总了Java中com.teamwizardry.librarianlib.features.particle.ParticleBuilder.setColorFunction方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleBuilder.setColorFunction方法的具体用法?Java ParticleBuilder.setColorFunction怎么用?Java ParticleBuilder.setColorFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.teamwizardry.librarianlib.features.particle.ParticleBuilder的用法示例。


在下文中一共展示了ParticleBuilder.setColorFunction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SPIRIT_WIGHT_HURT

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
public static void SPIRIT_WIGHT_HURT(World world, Vec3d pos) {
	ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(100, 150));
	glitter.setColorFunction(new InterpColorHSV(Color.BLUE, 50, 20.0F));
	glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
	glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));

	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), RandUtil.nextInt(40, 100), 0, (i, build) -> {
		double radius = 0.2;
		double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
		double r = radius * RandUtil.nextFloat();
		double x = r * MathHelper.cos((float) theta);
		double z = r * MathHelper.sin((float) theta);

		glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(0, 0.4), z));
		glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0, 0.02), 0));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:18,代码来源:LibParticles.java

示例2: EXPLODE

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
public static void EXPLODE(World world, Vec3d pos, Color color1, Color color2, double strengthUpwards, double strengthSideways, int amount, int lifeTime, int lifeTimeRange, boolean bounce) {
	ParticleBuilder glitter = new ParticleBuilder(10);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
	glitter.setCollision(true);
	glitter.enableMotionCalculation();
	glitter.setColorFunction(new InterpColorHSV(ColorUtils.changeColorAlpha(color1, RandUtil.nextInt(50, 150)), ColorUtils.changeColorAlpha(color2, RandUtil.nextInt(50, 150))));
	glitter.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.03, -0.04), 0));
	glitter.setCanBounce(true);
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), amount, 0, (i, build) -> {
		double radius = RandUtil.nextDouble(1, 2);
		double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
		double r = radius * RandUtil.nextFloat();
		double x = r * MathHelper.cos((float) theta);
		double z = r * MathHelper.sin((float) theta);
		Vec3d normalize = new Vec3d(x, 0, z).normalize();
		glitter.setMotion(new Vec3d(
				normalize.x * RandUtil.nextDouble(-strengthSideways, strengthSideways),
				RandUtil.nextDouble(-strengthUpwards, strengthUpwards),
				normalize.z * RandUtil.nextDouble(-strengthSideways, strengthSideways)
		));
		glitter.setAlphaFunction(new InterpFadeInOut(0.0f, RandUtil.nextFloat()));
		glitter.setLifetime(RandUtil.nextInt(lifeTime - lifeTimeRange, lifeTime + lifeTimeRange));
		glitter.setScale(RandUtil.nextFloat());
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:26,代码来源:LibParticles.java

示例3: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	float yaw = spell.getData(YAW, 0F);
	Entity caster = spell.getData(CASTER);
	Vec3d position = spell.getData(ORIGIN);
	Vec3d target = spell.getData(TARGET_HIT);

	if (position == null || target == null) return;

	float offX = 0.5f * (float) Math.sin(Math.toRadians(-90.0f - yaw));
	float offZ = 0.5f * (float) Math.cos(Math.toRadians(-90.0f - yaw));
	Vec3d origin = new Vec3d(offX, 0, offZ).add(position);

	ParticleBuilder lines = new ParticleBuilder(10);
	lines.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	lines.setScaleFunction(new InterpScale(0.5f, 0));
	lines.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	ParticleSpawner.spawn(lines, spell.world, new InterpLine(origin, target), (int) target.distanceTo(origin) * 4, 0, (aFloat, particleBuilder) -> {
		lines.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
		lines.setLifetime(RandUtil.nextInt(10, 20));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:25,代码来源:ModuleShapeCone.java

示例4: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	World world = spell.world;
	Vec3d position = spell.getData(TARGET_HIT);

	if (position == null) return;

	ParticleBuilder glitter = new ParticleBuilder(50);
	glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	glitter.setScale(1);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));

	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
		glitter.setLifetime(RandUtil.nextInt(10, 20));
		glitter.setScale(RandUtil.nextFloat());
		glitter.setScaleFunction(new InterpScale(1, 0));
		glitter.setAlphaFunction(new InterpFadeInOut(0.3f, RandUtil.nextFloat()));
		glitter.setMotion(new Vec3d(
				RandUtil.nextDouble(-0.1, 0.1),
				RandUtil.nextDouble(-0.1, 0.1),
				RandUtil.nextDouble(-0.1, 0.1)
		));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:26,代码来源:ModuleEffectTelekinesis.java

示例5: handle

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
public void handle(MessageContext messageContext) {
	if (messageContext.side.isServer()) return;

	World world = Minecraft.getMinecraft().player.world;

	ParticleBuilder builder = new ParticleBuilder(5);
	builder.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
	builder.setColorFunction(new InterpColorFade(Color.RED, 1, 255, 1));
	builder.setRender(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
	ParticleSpawner.spawn(builder, world, new StaticInterp<>(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5)), ThreadLocalRandom.current().nextInt(20, 40), 0, (aFloat, particleBuilder) -> {
		double radius = 0.3;
		double t = 2 * Math.PI * ThreadLocalRandom.current().nextDouble(-radius, radius);
		double u = ThreadLocalRandom.current().nextDouble(-radius, radius) + ThreadLocalRandom.current().nextDouble(-radius, radius);
		double r = (u > 1) ? 2 - u : u;
		double x1 = r * Math.cos(t), z1 = r * Math.sin(t);
		builder.setPositionOffset(new Vec3d(x1, ThreadLocalRandom.current().nextDouble(-0.3, 0.3), z1));
		builder.setScale(ThreadLocalRandom.current().nextFloat());
		builder.setMotion(new Vec3d(ThreadLocalRandom.current().nextDouble(-0.01, 0.01) / 10,
				ThreadLocalRandom.current().nextDouble(0.001, 0.01) / 10,
				ThreadLocalRandom.current().nextDouble(-0.01, 0.01) / 10));
		builder.setLifetime(ThreadLocalRandom.current().nextInt(30, 50));
	});
}
 
开发者ID:TeamWizardry,项目名称:TMT-Refraction,代码行数:25,代码来源:PacketAssemblyProgressParticles.java

示例6: handle

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
public void handle(MessageContext messageContext) {
	if (messageContext.side.isServer()) return;

	World world = Minecraft.getMinecraft().player.world;

	ParticleBuilder builder = new ParticleBuilder(1);
	builder.setAlphaFunction(new InterpFadeInOut(0.1f, 0.3f));
	builder.setColorFunction(new InterpColorFade(Color.GREEN, 1, 255, 1));
	builder.setRender(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
	ParticleSpawner.spawn(builder, world, new StaticInterp<>(new Vec3d(pos.getX() + 0.5, pos.getY() + 1.25, pos.getZ() + 0.5)), ThreadLocalRandom.current().nextInt(200, 300), 0, (aFloat, particleBuilder) -> {
		double radius = 0.1;
		double t = 2 * Math.PI * ThreadLocalRandom.current().nextDouble(-radius, radius);
		double u = ThreadLocalRandom.current().nextDouble(-radius, radius) + ThreadLocalRandom.current().nextDouble(-radius, radius);
		double r = (u > 1) ? 2 - u : u;
		double x1 = r * Math.cos(t), z1 = r * Math.sin(t);
		builder.setPositionOffset(new Vec3d(x1, ThreadLocalRandom.current().nextDouble(-0.1, 0.1), z1));
		builder.setScale(ThreadLocalRandom.current().nextFloat());
		builder.setMotion(new Vec3d(ThreadLocalRandom.current().nextDouble(-0.01, 0.01),
				ThreadLocalRandom.current().nextDouble(-0.01, 0.01),
				ThreadLocalRandom.current().nextDouble(-0.01, 0.01)));
		builder.setLifetime(ThreadLocalRandom.current().nextInt(20, 80));
	});
}
 
开发者ID:TeamWizardry,项目名称:TMT-Refraction,代码行数:25,代码来源:PacketAssemblyDoneParticles.java

示例7: doRender

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
public void doRender(@Nonnull EntitySpellProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) {
	super.doRender(entity, x, y, z, entityYaw, partialTicks);
	Color color = new Color(entity.getDataManager().get(DATA_COLOR), true);
	Color color2 = new Color(entity.getDataManager().get(DATA_COLOR2), true);

	ParticleBuilder glitter = new ParticleBuilder(10);
	glitter.setAlphaFunction(new InterpFadeInOut(0f, 0.3f));
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.enableMotionCalculation();
	glitter.setCollision(true);
	glitter.setCanBounce(true);
	glitter.setColorFunction(new InterpColorHSV(color, color2));
	glitter.setAcceleration(new Vec3d(0, -0.015, 0));
	ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector().add(new Vec3d(entity.motionX, entity.motionY, entity.motionZ))), 5, 0, (aFloat, particleBuilder) -> {
		particleBuilder.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(0.3, 0.8), 0));
		particleBuilder.setLifetime(RandUtil.nextInt(40, 60));
		particleBuilder.addMotion(new Vec3d(
				RandUtil.nextDouble(-0.03, 0.03),
				RandUtil.nextDouble(-0.01, 0.05),
				RandUtil.nextDouble(-0.03, 0.03)
		));
	});

	glitter.disableMotionCalculation();
	glitter.setMotion(Vec3d.ZERO);
	glitter.setLifetime(20);
	glitter.setScaleFunction(new InterpFadeInOut(0f, 1f));
	glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
	ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector()), 5, 0, (aFloat, particleBuilder) -> {
		particleBuilder.setScale(RandUtil.nextFloat(0.5f, 2));
		particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
		//particleBuilder.addMotion()
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:36,代码来源:RenderSpellProjectile.java

示例8: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	World world = spell.world;
	Vec3d position = spell.getData(TARGET_HIT);

	if (position == null) return;

	ParticleBuilder glitter = new ParticleBuilder(30);
	glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.disableRandom();
	glitter.setScaleFunction(new InterpScale(1, 0));
	glitter.setCollision(true);
	glitter.enableMotionCalculation();
	glitter.setAcceleration(new Vec3d(0, -0.001, 0));

	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position.addVector(0, 1, 0)), 3, 0, (aFloat, particleBuilder) -> {
		glitter.setLifetime(RandUtil.nextInt(30, 40));
		glitter.setScale(RandUtil.nextFloat());
		glitter.setAlphaFunction(new InterpFadeInOut(0.5f, RandUtil.nextFloat()));

		double radius = RandUtil.nextDouble(0, 1);
		double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
		double r = radius * RandUtil.nextFloat();
		double x = r * MathHelper.cos((float) theta);
		double z = r * MathHelper.sin((float) theta);
		Vec3d dest = new Vec3d(x, RandUtil.nextDouble(-radius, radius), z);
		glitter.setPositionOffset(dest);

		//glitter.setPositionFunction(new InterpSlowDown(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(-1, 1), 0)));
		//glitter.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, position.subtract(dest), dest.scale(2), new Vec3d(position.x, radius, position.z)));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:35,代码来源:ModuleEffectTimeSlow.java

示例9: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	Vec3d position = spell.getData(ORIGIN);

	if (position == null) return;
	if (RandUtil.nextInt(10) != 0) return;

	ParticleBuilder glitter = new ParticleBuilder(0);
	glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
		glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
		glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
		glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
		glitter.setLifetime(RandUtil.nextInt(20, 40));
		glitter.setScaleFunction(new InterpScale(1, 0));
		if (RandUtil.nextBoolean())
			glitter.setPositionFunction(new InterpHelix(
					new Vec3d(0, 0, 0),
					new Vec3d(0, 2, 0),
					0.5f, 0, 1, RandUtil.nextFloat()
			));
		else glitter.setPositionFunction(new InterpHelix(
				new Vec3d(0, 0, 0),
				new Vec3d(0, -2, 0),
				0.5f, 0, 1, RandUtil.nextFloat()
		));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:30,代码来源:ModuleEffectAntiGravityWell.java

示例10: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	Vec3d position = spell.getData(TARGET_HIT);

	if (position == null) return;
	if (RandUtil.nextInt(10) != 0) return;

	ParticleBuilder glitter = new ParticleBuilder(0);
	glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	ParticleSpawner.spawn(glitter, spell.world, new StaticInterp<>(position), 5, 0, (aFloat, particleBuilder) -> {
		glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
		glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
		glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
		glitter.setLifetime(RandUtil.nextInt(20, 40));
		glitter.setScaleFunction(new InterpScale(1, 0));
		if (RandUtil.nextBoolean())
			glitter.setPositionFunction(new InterpHelix(
					new Vec3d(0, 0, 0),
					new Vec3d(0, 2, 0),
					0.5f, 0, 1, RandUtil.nextFloat()
			));
		else glitter.setPositionFunction(new InterpHelix(
				new Vec3d(0, 0, 0),
				new Vec3d(0, -2, 0),
				0.5f, 0, 1, RandUtil.nextFloat()
		));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:30,代码来源:ModuleEffectGravityWell.java

示例11: runClient

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
	World world = spell.world;
	Vec3d position = spell.getData(TARGET_HIT);

	if (position == null) return;

	ParticleBuilder glitter = new ParticleBuilder(1);
	glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.1f));
	glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
	glitter.enableMotionCalculation();
	glitter.setScaleFunction(new InterpScale(1, 0));
	glitter.setAcceleration(new Vec3d(0, -0.05, 0));
	glitter.setCollision(true);
	glitter.setCanBounce(true);
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(20, 30), 0, (aFloat, particleBuilder) -> {
		if (RandUtil.nextInt(5) == 0) {
			glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
		} else {
			glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
		}

		glitter.setScale(RandUtil.nextFloat());
		glitter.setLifetime(RandUtil.nextInt(50, 100));
		glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.05, 0.05), RandUtil.nextDouble(0.01, 0.05), RandUtil.nextDouble(-0.05, 0.05)));
	});

}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:30,代码来源:ModuleEffectBackup.java


注:本文中的com.teamwizardry.librarianlib.features.particle.ParticleBuilder.setColorFunction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。