Search in sources :

Example 6 with InterpCircle

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle 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));
                });
            });
        }
    }
}
Also used : InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 7 with InterpCircle

use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.

the class ModuleShapeZone method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Vec3d target = spell.getTarget();
    if (target == null)
        return;
    if (RandUtil.nextInt(10) != 0)
        return;
    double aoe = spellRing.getAttributeValue(AttributeRegistry.AREA, spell);
    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)));
    });
}
Also used : InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

InterpCircle (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle)7 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)7 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)7 ResourceLocation (net.minecraft.util.ResourceLocation)7 Vec3d (net.minecraft.util.math.Vec3d)7 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 Entity (net.minecraft.entity.Entity)2 ItemStack (net.minecraft.item.ItemStack)2 ClientRunnable (com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)1 IStructure (com.teamwizardry.wizardry.api.block.IStructure)1 CapManager (com.teamwizardry.wizardry.api.capability.CapManager)1 Minecraft (net.minecraft.client.Minecraft)1 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 TextureManager (net.minecraft.client.renderer.texture.TextureManager)1 EntityZombieVillager (net.minecraft.entity.monster.EntityZombieVillager)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 BlockRenderLayer (net.minecraft.util.BlockRenderLayer)1 BlockPos (net.minecraft.util.math.BlockPos)1