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


Java ParticleBuilder.enableMotionCalculation方法代码示例

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


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

示例1: 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

示例2: MAGIC_DOT

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
public static void MAGIC_DOT(World world, Vec3d pos, float scale) {
	ParticleBuilder glitter = new ParticleBuilder(3);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
	glitter.enableMotionCalculation();
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
		glitter.setColor(new Color(RandUtil.nextInt(0, 100), RandUtil.nextInt(0, 100), RandUtil.nextInt(50, 255)));
		if (scale == -1) glitter.setScale(RandUtil.nextFloat());
		else {
			glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
			glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.3), 0));
			glitter.setLifetime(RandUtil.nextInt(30));
			glitter.setScale(scale);
		}
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:17,代码来源:LibParticles.java

示例3: CLUSTER_DRAPE

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
public static void CLUSTER_DRAPE(World world, Vec3d pos) {
	ParticleBuilder glitter = new ParticleBuilder(200);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
	glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
	glitter.enableMotionCalculation();

	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
		glitter.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
		glitter.setScale(RandUtil.nextFloat());
		glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01),
				RandUtil.nextDouble(-0.01, 0.01),
				RandUtil.nextDouble(-0.01, 0.01)));
		glitter.setLifetime(RandUtil.nextInt(30, 60));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:16,代码来源:LibParticles.java

示例4: 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

示例5: 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

示例6: 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.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.enableMotionCalculation();
	glitter.setScaleFunction(new InterpScale(1, 0));
	glitter.setAcceleration(new Vec3d(0, -0.02, 0));
	glitter.setCollision(true);
	glitter.setCanBounce(true);
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(5, 15), 0, (aFloat, particleBuilder) -> {
		double radius = 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.setScale(RandUtil.nextFloat());
		glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-2, 2), z));
		glitter.setLifetime(RandUtil.nextInt(50, 100));
		Vec3d direction = position.add(glitter.getPositionOffset()).subtract(position).normalize().scale(1 / 5);
		glitter.addMotion(direction.scale(RandUtil.nextDouble(0.5, 1)));
	});

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

示例7: 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

示例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(1);
	glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.1f));
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.enableMotionCalculation();
	glitter.setScaleFunction(new InterpScale(1, 0));
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(5, 15), 0, (aFloat, particleBuilder) -> {
		double radius = 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.setScale(RandUtil.nextFloat());
		glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-2, 2), z));
		glitter.setLifetime(RandUtil.nextInt(30, 40));
		Vec3d direction = position.add(glitter.getPositionOffset()).subtract(position).normalize();
		glitter.setMotion(direction.scale(RandUtil.nextDouble(0.5, 1.3)));
	});

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

示例9: doRender

import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
public void doRender(@Nonnull EntityBomb entity, double x, double y, double z, float entityYaw, float partialTicks) {
	super.doRender(entity, x, y, z, entityYaw, partialTicks);
	int type = entity.getDataManager().get(DATA_BOMB_TYPE);

	Color color, color2;
	if (type == 1) {
		color = Color.CYAN;
		color2 = Color.BLUE;
	} else {
		color = Color.RED;
		color2 = Color.ORANGE;
	}

	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.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)
		));
		if (RandUtil.nextBoolean()) {
			particleBuilder.setColor(color);
		} else {
			particleBuilder.setColor(color2);
		}
	});

	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,代码行数:48,代码来源:RenderBomb.java

示例10: runClient

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

	Entity entity = spell.getData(ENTITY_HIT);
	if (entity == null) return;

	Vec3d origin = spell.getData(ORIGINAL_LOC);
	if (origin == null) return;

	Vec3d to = entity.getPositionVector();

	ParticleBuilder glitter = new ParticleBuilder(10);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.3f));

	glitter.enableMotionCalculation();
	glitter.disableRandom();
	glitter.setCollision(true);
	glitter.setTick(particle -> {
		if (particle.getAge() >= particle.getLifetime() / RandUtil.nextDouble(2, 5)) {
			if (particle.getAcceleration().y == 0)
				particle.setAcceleration(new Vec3d(0, RandUtil.nextDouble(-0.05, -0.01), 0));
		} else if (particle.getAcceleration().x != 0 || particle.getAcceleration().y != 0 || particle.getAcceleration().z != 0) {
			particle.setAcceleration(Vec3d.ZERO);
		}
	});
	ParticleSpawner.spawn(glitter, world, new StaticInterp<>(origin.addVector(0, entity.height / 2.0, 0)), 10, 0, (aFloat, particleBuilder) -> {
		glitter.setPositionOffset(new Vec3d(
				RandUtil.nextDouble(-0.5, 0.5),
				RandUtil.nextDouble(-0.5, 0.5),
				RandUtil.nextDouble(-0.5, 0.5)
		));
		ParticleSpawner.spawn(glitter, world, new InterpLine(origin.add(particleBuilder.getPositionOffset()), to.add(particleBuilder.getPositionOffset()).addVector(0, entity.height / 2.0, 0)), (int) origin.distanceTo(to) * 5, 0, (aFloat2, particleBuilder2) -> {
			glitter.setAlpha(RandUtil.nextFloat(0.5f, 0.8f));
			glitter.setScale(RandUtil.nextFloat(0.3f, 0.6f));
			glitter.setLifetime(RandUtil.nextInt(30, 50));
			glitter.setColorFunction(new InterpColorHSV(getPrimaryColor(), getSecondaryColor()));
			glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
		});
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:44,代码来源:ModuleEffectZoom.java


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