use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class RenderHaloEntity method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO).isEmpty())
return;
ItemStack halo = BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
// TODO: Remove these once we have a cosmetics system
if (halo.getItem() == ModItems.FAKE_HALO && !ConfigValues.renderCrudeHalo)
return;
if (halo.getItem() == ModItems.REAL_HALO && !ConfigValues.renderRealHalo)
return;
if (halo.getItem() == ModItems.CREATIVE_HALO && !ConfigValues.renderCreativeHalo)
return;
if (halo.getItem() == ModItems.FAKE_HALO) {
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
GlStateManager.translate(0.0f, 0.2f, 0.0f);
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager)) {
GlStateManager.translate(0.0f, 0.5f * scale, 0.0f);
GlStateManager.scale(0.7f, 0.7f, 0.7f);
GlStateManager.translate(0.0f, 16.0f * scale, 0.0f);
}
if (flag)
GlStateManager.translate(0.0f, 0.1875f, 0.0f);
this.modelRenderer.postRender(0.0625f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.translate(0.0f, -0.25f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.scale(0.625f, -0.625f, -0.625f);
Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, halo, ItemCameraTransforms.TransformType.HEAD);
GlStateManager.popMatrix();
} else {
ParticleBuilder glitter = new ParticleBuilder(3);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.disableMotionCalculation();
glitter.disableRandom();
ParticleSpawner.spawn(glitter, entitylivingbaseIn.world, new InterpCircle(entitylivingbaseIn.getPositionVector().addVector(0, entitylivingbaseIn.height + (entitylivingbaseIn.isSneaking() ? 0.2 : 0.4), 0), new Vec3d(0, 1, 0), 0.3f, RandUtil.nextFloat(), RandUtil.nextFloat()), 10, 0, (aFloat, particleBuilder) -> {
if (RandUtil.nextInt(10) != 0)
if (halo.getItem() == ModItems.CREATIVE_HALO)
glitter.setColor(ColorUtils.changeColorAlpha(new Color(0xd600d2), RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.YELLOW, RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.WHITE, RandUtil.nextInt(60, 100)));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.setLifetime(10);
glitter.setScaleFunction(new InterpFadeInOut(0.5f, 0.5f));
glitter.setMotion(new Vec3d(entitylivingbaseIn.motionX / 2.0, (entitylivingbaseIn.motionY + 0.0784) / 2.0, entitylivingbaseIn.motionZ / 2.0));
});
}
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class RenderHaloPlayer method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO).isEmpty())
return;
ItemStack halo = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
// TODO: Remove these once we have a cosmetics system
if (halo.getItem() == ModItems.FAKE_HALO && !ConfigValues.renderCrudeHalo)
return;
if (halo.getItem() == ModItems.REAL_HALO && !ConfigValues.renderRealHalo)
return;
if (halo.getItem() == ModItems.CREATIVE_HALO && !ConfigValues.renderCreativeHalo)
return;
if (halo.getItem() == ModItems.FAKE_HALO) {
GlStateManager.pushMatrix();
if (player.isSneaking())
GlStateManager.translate(0.0f, 0.2f, 0.0f);
this.modelRenderer.postRender(0.0625f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.translate(0.0f, -0.25f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.scale(0.625f, -0.625f, -0.625f);
Minecraft.getMinecraft().getItemRenderer().renderItem(player, halo, ItemCameraTransforms.TransformType.HEAD);
GlStateManager.popMatrix();
} else {
Vec3d playerOrigin = player.getPositionVector().addVector(0, player.height + (player.isSneaking() ? 0.2 : 0.4), 0);
InterpCircle circle = new InterpCircle(Vec3d.ZERO, new Vec3d(0, 1, 0), 0.3f, RandUtil.nextFloat(), RandUtil.nextFloat());
for (Vec3d origin : circle.list(10)) {
ParticleBuilder glitter = new ParticleBuilder(3);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.disableMotionCalculation();
glitter.disableRandom();
ParticleSpawner.spawn(glitter, player.world, new StaticInterp<>(playerOrigin.add(origin)), 1, 0, (aFloat, particleBuilder) -> {
if (RandUtil.nextInt(10) != 0)
if (halo.getItem() == ModItems.CREATIVE_HALO)
glitter.setColor(ColorUtils.changeColorAlpha(new Color(0xd600d2), RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.YELLOW, RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.WHITE, RandUtil.nextInt(60, 100)));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.setLifetime(10);
glitter.setScaleFunction(new InterpFadeInOut(0.5f, 0.5f));
// glitter.setMotion(new Vec3d(player.motionX / 2.0, (player.motionY + (player.capabilities.isFlying ? 0 : 0.0784)) / 2.0, player.motionZ / 2.0));
glitter.setTick(particle -> {
Vec3d newOrigin = player.getPositionVector().addVector(0, player.height + (player.isSneaking() ? 0.2 : 0.4), 0);
particle.setPos(newOrigin.add(origin));
});
});
}
}
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class RenderBomb method doRender.
@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()
});
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class EntityCorruptionArea method onUpdate.
public void onUpdate() {
super.onUpdate();
float radius = this.getRadius();
if (duration < 0)
setDead();
duration--;
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(30, 50));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.enableMotionCalculation();
glitter.setCollision(true);
glitter.setCanBounce(true);
glitter.setAcceleration(new Vec3d(0, -0.035, 0));
glitter.setColor(new Color(255, 0, 206));
glitter.setAlphaFunction(new InterpFadeInOut(0.5f, 0f));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector()), 1, 1, (i, build) -> {
double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat();
double r = getRadius() * RandUtil.nextFloat();
double x = r * MathHelper.cos((float) theta);
double z = r * MathHelper.sin((float) theta);
build.setPositionOffset(new Vec3d(x, 0, z));
build.addMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.15), 0));
});
}
});
radius += radiusPerTick;
setRadius(radius);
Iterator<Entry<Entity, Integer>> iter = this.reapplicationDelayMap.entrySet().iterator();
while (iter.hasNext()) {
Entry<Entity, Integer> entry = iter.next();
int timeLeft = entry.getValue();
if (timeLeft > 0)
entry.setValue(timeLeft - 1);
else
iter.remove();
}
List<EntityLivingBase> entityList = world.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox());
for (EntityLivingBase entity : entityList) {
if (entity instanceof EntityZachriel)
continue;
if (this.reapplicationDelayMap.containsKey(entity))
continue;
double xDiff = entity.posX - this.posX;
double zDiff = entity.posY - this.posY;
if (xDiff * xDiff + zDiff * zDiff <= radius * radius)
affectEntity(entity);
}
}
use of com.teamwizardry.librarianlib.features.particle.ParticleBuilder in project Wizardry by TeamWizardry.
the class EntityZachriel method onUpdate.
@Override
public void onUpdate() {
this.motionY = 0;
super.onUpdate();
// BATTLE
{
if (arena == null) {
HashSet<UUID> players = new HashSet<>();
arena = new Arena(getEntityWorld().provider.getDimension(), getPosition(), 50, 50, getEntityId(), players);
ArenaManager.INSTANCE.addArena(arena);
}
for (EntityLivingBase targeted : arena.getVictims()) nemezDrive.trackEntity(targeted);
if (burstTimer > 0) {
burstTimer--;
if (burstTimer == 0)
if (!world.isRemote)
for (EntityPlayer player : world.playerEntities) if (EntitySelectors.CAN_AI_TARGET.apply(player) && getDistanceSq(player) < 32 * 32) {
PotionEffect corruption = player.getActivePotionEffect(ModPotions.ZACH_CORRUPTION);
float bonusDamage = corruption == null ? 0 : burstDamage * (corruption.getAmplifier() + 1);
player.attackEntityFrom(DamageSource.causeMobDamage(this).setMagicDamage().setDamageBypassesArmor(), burstDamage + bonusDamage);
}
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(30, 50));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.enableMotionCalculation();
glitter.setCollision(burstTimer > 0);
glitter.setCanBounce(burstTimer > 0);
glitter.setAcceleration(new Vec3d(0, -0.035, 0));
glitter.setColor(new Color(255, 0, 206));
glitter.setAlphaFunction(new InterpFadeInOut(0.5F, 0F));
ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector()), 1, 1, (i, build) -> {
double theta = 2.0F * (float) Math.PI * RandUtil.nextFloat();
double r;
if (burstTimer > 0)
r = (getEntityBoundingBox().maxX - getEntityBoundingBox().minX) / 2 * RandUtil.nextFloat(0.01F, 1);
else
r = 32 * RandUtil.nextFloat();
double x = r * MathHelper.cos((float) theta);
double y = (getEntityBoundingBox().maxY - getEntityBoundingBox().minY) * RandUtil.nextFloat();
double z = r * MathHelper.sin((float) theta);
build.setPositionOffset(new Vec3d(x, y, z));
build.addMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.15), 0));
});
}
});
}
if (!world.isRemote) {
List<EntityCorruptionArea> corruptionList = world.getEntitiesWithinAABB(EntityCorruptionArea.class, new AxisAlignedBB(getPosition()).grow(2));
if (corruptionList.isEmpty()) {
EntityCorruptionArea corruption = new EntityCorruptionArea(world, posX, posY, posZ);
world.spawnEntity(corruption);
}
}
}
nemezDrive.endUpdate();
}
Aggregations