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


Java ParticleBuilder.setScaleFunction方法代码示例

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


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

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

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

示例3: runClient

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

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

	double aoe = getModifier(spell, Attributes.AREA, 3, 10);

	ParticleBuilder glitter = new ParticleBuilder(10);
	glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
	glitter.setScaleFunction(new InterpScale(1, 0));
	glitter.setCollision(true);
	ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(target, new Vec3d(0, 1, 0), (float) aoe, 1, RandUtil.nextFloat()), (int) (aoe * 5), 0, (aFloat, particleBuilder) -> {
		glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
		glitter.setLifetime(RandUtil.nextInt(10, 20));
		if (RandUtil.nextBoolean()) {
			glitter.setColor(getPrimaryColor());
		} else {
			glitter.setColor(getSecondaryColor());
		}
		glitter.addMotion(new Vec3d(
				RandUtil.nextDouble(-0.001, 0.001),
				RandUtil.nextDouble(-0.1, 0.1),
				RandUtil.nextDouble(-0.001, 0.001)
		));
	});
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:30,代码来源:ModuleShapeZone.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(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

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

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

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

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


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