本文整理汇总了Java中com.teamwizardry.librarianlib.features.particle.ParticleBuilder.setAcceleration方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleBuilder.setAcceleration方法的具体用法?Java ParticleBuilder.setAcceleration怎么用?Java ParticleBuilder.setAcceleration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.teamwizardry.librarianlib.features.particle.ParticleBuilder
的用法示例。
在下文中一共展示了ParticleBuilder.setAcceleration方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
});
}
示例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()
});
}
示例3: 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)));
});
}
示例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(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)));
});
}
示例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.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)));
});
}
示例6: 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()
});
}