本文整理汇总了Java中com.teamwizardry.librarianlib.features.particle.ParticleBuilder.setCollision方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleBuilder.setCollision方法的具体用法?Java ParticleBuilder.setCollision怎么用?Java ParticleBuilder.setCollision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.teamwizardry.librarianlib.features.particle.ParticleBuilder
的用法示例。
在下文中一共展示了ParticleBuilder.setCollision方法的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());
});
}
示例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) {
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)
));
});
}
示例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)));
});
}
示例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)));
});
}
示例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)));
});
}
示例7: SHAPE_BEAM
import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
public static void SHAPE_BEAM(World world, Vec3d target, Vec3d origin, Color color) {
ParticleBuilder beam = new ParticleBuilder(10);
beam.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
beam.setAlphaFunction(new InterpFadeInOut(0.3f, 1f));
//beam.disableRandom();
beam.setColor(ColorUtils.shiftColorHueRandomly(color, 10));
beam.setCollision(true);
Vec3d look = target.subtract(origin).normalize();
double dist = target.distanceTo(origin);
ParticleSpawner.spawn(beam, world, new StaticInterp<>(origin), 1, 0, (aFloat1, particleBuilder1) -> {
particleBuilder1.setPositionOffset(look.scale(RandUtil.nextDouble(0, dist)));
particleBuilder1.setScale(RandUtil.nextFloat(0.1f, 0.5f));
final int life = RandUtil.nextInt(50, 60);
particleBuilder1.setLifetime(life);
particleBuilder1.enableMotionCalculation();
particleBuilder1.setCollision(true);
particleBuilder1.setCanBounce(true);
particleBuilder1.setAcceleration(new Vec3d(0, -0.03, 0));
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);
Vec3d dest = new Vec3d(x, RandUtil.nextDouble(-1, 2), z);
particleBuilder1.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, dest, dest.scale(2), new Vec3d(dest.x, RandUtil.nextDouble(-2, 2), dest.z)));
particleBuilder1.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(beam, world, new StaticInterp<>(origin), 10, 0, (aFloat, particleBuilder) -> {
particleBuilder.setTick(particle -> particle.setAcceleration(Vec3d.ZERO));
particleBuilder.setScaleFunction(new InterpFadeInOut(0, 1f));
particleBuilder.setAlphaFunction(new InterpFadeInOut(0.3f, 0.2f));
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 1.5f));
particleBuilder.setLifetime(RandUtil.nextInt(10, 20));
particleBuilder.disableMotionCalculation();
particleBuilder.setMotion(Vec3d.ZERO);
particleBuilder.setCanBounce(false);
particleBuilder.setPositionOffset(Vec3d.ZERO);
particleBuilder.setPositionFunction(new InterpLine(Vec3d.ZERO, target.subtract(origin)));
});
}
示例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()
});
}
示例9: 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));
});
});
}
示例10: doRender
import com.teamwizardry.librarianlib.features.particle.ParticleBuilder; //导入方法依赖的package包/类
@Override
public void doRender(@Nonnull EntityPlasma 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);
ParticleBuilder glitter = new ParticleBuilder(5);
glitter.setRender(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
glitter.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
//glitter.enableMotionCalculation();
glitter.setCollision(true);
ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector()), 4, 0, (aFloat, particleBuilder) -> {
glitter.setColor(color);
glitter.setLifetime(ThreadLocalRandom.current().nextInt(30));
glitter.setScale((float) (ThreadLocalRandom.current().nextFloat() + ThreadLocalRandom.current().nextDouble(0.5f)));
});
if (entity.getDataManager().get(DATA_COLLIDED)) {
Vec3d look = new Vec3d(entity.getDataManager().get(DATA_X), entity.getDataManager().get(DATA_Y), entity.getDataManager().get(DATA_Z));
ParticleBuilder poof = new ParticleBuilder(5);
poof.setRender(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
poof.setAlphaFunction(new InterpFadeInOut(0.0f, 1f));
poof.setCollision(true);
ParticleSpawner.spawn(poof, entity.world, new StaticInterp<>(entity.getPositionVector()), 4, 0, (aFloat, particleBuilder) -> {
poof.setColor(color);
poof.setLifetime(ThreadLocalRandom.current().nextInt(30));
poof.setScale((float) (ThreadLocalRandom.current().nextFloat() + ThreadLocalRandom.current().nextDouble(0.5f)));
double radius = 0.5;
double theta = 2.0f * (float) Math.PI * ThreadLocalRandom.current().nextFloat();
double r = radius * ThreadLocalRandom.current().nextFloat();
double x2 = r * MathHelper.cos((float) theta);
double z2 = r * MathHelper.sin((float) theta);
glitter.setPositionOffset(new Vec3d(x2, ThreadLocalRandom.current().nextDouble(0.5), z2));
glitter.setColor(new Color(
Math.min(255, color.getRed() + ThreadLocalRandom.current().nextInt(20, 50)),
Math.min(255, color.getGreen() + ThreadLocalRandom.current().nextInt(20, 50)),
Math.min(255, color.getBlue() + ThreadLocalRandom.current().nextInt(20, 50)),
100));
glitter.setScale(1);
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) ThreadLocalRandom.current().nextDouble(0.3, 1)));
InterpCircle circle = new InterpCircle(look.scale(10), look, (float) color.getAlpha() / 200, 1, ThreadLocalRandom.current().nextFloat());
glitter.setPositionFunction(new InterpLine(Vec3d.ZERO, circle.get(0)));
});
}
}