本文整理汇总了Java中com.teamwizardry.librarianlib.features.particle.ParticleSpawner.spawn方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleSpawner.spawn方法的具体用法?Java ParticleSpawner.spawn怎么用?Java ParticleSpawner.spawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.teamwizardry.librarianlib.features.particle.ParticleSpawner
的用法示例。
在下文中一共展示了ParticleSpawner.spawn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的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));
});
}
示例2: BLOCK_HIGHLIGHT
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void BLOCK_HIGHLIGHT(World world, BlockPos pos, Color color) {
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
glitter.setColor(color);
glitter.disableRandom();
glitter.disableMotionCalculation();
glitter.setScale(2f);
glitter.setLifetime(200);
double indent = 0.75;
Vec3d bottom = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5 - indent, pos.getZ() + 0.5);
Vec3d top = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5 + indent, pos.getZ() + 0.5);
Vec3d front = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 + indent);
Vec3d back = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 - indent);
Vec3d left = new Vec3d(pos.getX() + 0.5 + indent, pos.getY() + 0.5, pos.getZ() + 0.5);
Vec3d right = new Vec3d(pos.getX() + 0.5 - indent, pos.getY() + 0.5, pos.getZ() + 0.5);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(bottom), 1);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(top), 1);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(left), 1);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(right), 1);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(front), 1);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(back), 1);
}
示例3: SPIRIT_WIGHT_FLAME_FAR
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void SPIRIT_WIGHT_FLAME_FAR(World world, Vec3d pos) {
ParticleBuilder glitter = new ParticleBuilder(30);
glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 5, 0, (i, build) -> {
double radius = 0.15;
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.setColorFunction(new InterpColorHSV(Color.RED, 50, 20.0F));
glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(0, 0.5), z));
glitter.addMotion(new Vec3d(0, RandUtil.nextDouble(0, 0.02), 0));
});
}
示例4: CRAFTING_ALTAR_IDLE
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void CRAFTING_ALTAR_IDLE(World world, Vec3d pos) {
ParticleBuilder glitter = new ParticleBuilder(30);
glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01),
RandUtil.nextDouble(0, 0.05),
RandUtil.nextDouble(-0.01, 0.01)));
glitter.setColor(new Color(0x0022FF));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1, 0, (i, build) -> {
double radius = 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);
glitter.setScale((float) RandUtil.nextDouble(1, 2));
glitter.setLifetime(RandUtil.nextInt(5, 30));
glitter.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(1, 1.5), 0));
glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(0, 0.3), z));
});
}
示例5: SPIRIT_WIGHT_HURT
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的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));
});
}
示例6: EXPLODE
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的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());
});
}
示例7: FIZZING_EXPLOSION
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void FIZZING_EXPLOSION(World world, Vec3d pos) {
ParticleBuilder glitter = new ParticleBuilder(50);
glitter.setScale(0.3f);
glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.3f));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 300, 0, (aFloat, particleBuilder) -> {
glitter.setLifetime(RandUtil.nextInt(20, 30));
glitter.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5), RandUtil.nextDouble(-0.5, 0.5)));
});
}
示例8: render
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
@Override
public void render(TileJar te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
//InterpBezier3D bezier = new InterpBezier3D(new Vec3d(te.getPos().add(-5, 5, 0)), new Vec3d(te.getPos().add(5, 5, 0)), new Vec3d(0, 3, 0), new Vec3d(0, -3, 0));
////InterpLine bezier = new InterpLine(new Vec3d(te.getPos().add(-5, 5, 0)), new Vec3d(te.getPos().add(5, 5, 0)));
//LightEffectUtil.renderBilinearGradient(bezier.list(50), Color.WHITE, 0.2, new Vec3d(0, 1, 0));
//LightEffectUtil.renderBilinearGradient(bezier.list(50), Color.BLUE, 0.3, new Vec3d(0, 1, 0));
//LightEffectUtil.renderBilinearGradient(bezier.list(50), Color.CYAN, 0.5, new Vec3d(0, 1, 0));
//LightEffectUtil.renderBilinearGradient(bezier.list(50), Color.CYAN, 1.5, new Vec3d(0, 1, 0));
if (!te.hasFairy) return;
double timeDifference = (ClientTickHandler.getTicks() + partialTicks) / 20.0;
Vec3d pos = new Vec3d(te.getPos()).addVector(0.5, 0.35 + 0.2 * MathHelper.sin((float) timeDifference), 0.5);
Color color = te.color;
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setColor(color);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
glitter.setScale(0.3f);
ParticleSpawner.spawn(glitter, te.getWorld(), new StaticInterp<>(pos), 1);
if (RandUtil.nextInt(10) == 0) {
ParticleBuilder trail = new ParticleBuilder(20);
trail.setColor(te.color);
trail.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
trail.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
trail.setScale(0.2f);
//trail.enableMotionCalculation();
ParticleSpawner.spawn(trail, te.getWorld(), new StaticInterp<>(pos), 1, 0, (aFloat, particleBuilder) -> {
trail.setMotion(new Vec3d(
RandUtil.nextDouble(-0.005, 0.005),
RandUtil.nextDouble(-0.005, 0.005),
RandUtil.nextDouble(-0.005, 0.005)
));
});
}
}
示例9: BOOK_BEAM_NORMAL
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void BOOK_BEAM_NORMAL(World world, Vec3d pos) {
ParticleBuilder glitter = new ParticleBuilder(50);
glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.0f, 0.3f));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 10, 0, (aFloat, particleBuilder) -> {
glitter.setMotion(new Vec3d(RandUtil.nextDouble(-0.02, 0.02), RandUtil.nextDouble(0, 1.0), RandUtil.nextDouble(-0.02, 0.02)));
glitter.setColor(new Color(255, 255, 255, RandUtil.nextInt(0, 255)));
glitter.setScale(RandUtil.nextFloat());
glitter.setLifetime(RandUtil.nextInt(0, 50));
});
}
示例10: BOOK_BEAM_HELIX
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void BOOK_BEAM_HELIX(World world, Vec3d pos) {
ParticleBuilder helix = new ParticleBuilder(200);
helix.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
helix.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
ParticleSpawner.spawn(helix, world, new StaticInterp<>(pos), 30, 0, (aFloat, particleBuilder) -> {
helix.setColor(new Color(255, 255, 255, RandUtil.nextInt(0, 255)));
helix.setScale(RandUtil.nextFloat());
helix.setPositionFunction(new InterpHelix(Vec3d.ZERO, new Vec3d(0, RandUtil.nextDouble(1.0, 255.0), 0), 0, RandUtil.nextInt(1, 5), RandUtil.nextInt(1, 5), 0));
helix.setLifetime(RandUtil.nextInt(0, 200));
});
}
示例11: COLORFUL_BATTERY_BEZIER
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void COLORFUL_BATTERY_BEZIER(World world, BlockPos pedestal, BlockPos center) {
ParticleBuilder glitter = new ParticleBuilder(200);
glitter.setRender(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.5f, 0.3f));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(new Vec3d(pedestal).addVector(0.5, 1, 0.5)), 1, 0, (aFloat, particleBuilder) -> {
glitter.setColorFunction(new InterpColorHSV(ColorUtils.changeColorAlpha(Color.BLUE, RandUtil.nextInt(100, 150)), ColorUtils.changeColorAlpha(Color.CYAN, RandUtil.nextInt(100, 150))));
glitter.setScale(RandUtil.nextFloat());
glitter.setPositionFunction(new InterpBezier3D(Vec3d.ZERO, new Vec3d(center.subtract(pedestal)), new Vec3d(0, 3, 0), new Vec3d(0, 5, 0)));
glitter.setScaleFunction(new InterpScale(1, 0.4f));
glitter.setLifetime(RandUtil.nextInt(10, 30));
});
}
示例12: FAIRY_HEAD
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void FAIRY_HEAD(World world, Vec3d pos, Color color) {
ParticleBuilder glitter = new ParticleBuilder(3);
glitter.setColor(color);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
glitter.setScale(3.5f);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 2);
ParticleBuilder glitter2 = new ParticleBuilder(5);
glitter2.setColor(color);
glitter2.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter2.setAlphaFunction(new InterpFadeInOut(0.2f, 1f));
glitter2.setScale(1);
ParticleSpawner.spawn(glitter2, world, new StaticInterp<>(pos), 3);
}
示例13: STRUCTURE_FLAIR
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
public static void STRUCTURE_FLAIR(World world, Vec3d pos, Color color) {
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRenderNormalLayer(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0F, 0.9F));
glitter.setColor(color);
glitter.setLifetime(40);
glitter.setScale(2);
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 1, 0, (i, build) -> {
build.setScale(5);
});
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(pos), 10, 0, (i, build) -> {
build.setScale(2);
int x = RandUtil.nextInt(4);
switch (x) {
case 0:
glitter.setMotion(new Vec3d(0, 0, 0.2));
break;
case 1:
glitter.setMotion(new Vec3d(0, 0, -0.2));
break;
case 2:
glitter.setMotion(new Vec3d(0.2, 0, 0));
break;
case 3:
glitter.setMotion(new Vec3d(-0.2, 0, 0));
break;
}
});
}
示例14: runClient
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的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)));
});
}
示例15: runClient
import com.teamwizardry.librarianlib.features.particle.ParticleSpawner; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void runClient(@Nonnull SpellData spell) {
Entity caster = spell.getData(CASTER);
Entity target = spell.getData(DefaultKeys.ENTITY_HIT);
Entity finalEntity = isHead() ? caster == null ? target : caster : target;
if (finalEntity == null) return;
ParticleBuilder glitter = new ParticleBuilder(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(finalEntity.getPositionVector().addVector(0, finalEntity.height / 2.0, 0), new Vec3d(0, 1, 0), 1, 10), 50, RandUtil.nextInt(10, 15), (aFloat, particleBuilder) -> {
if (RandUtil.nextBoolean()) {
glitter.setColor(getPrimaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.1), 0));
} else {
glitter.setColor(getSecondaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(-0.1, -0.01), 0));
}
glitter.setLifetime(RandUtil.nextInt(20, 30));
glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
glitter.setLifetime(RandUtil.nextInt(10, 20));
glitter.setScaleFunction(new InterpScale(1, 0));
});
}