Search in sources :

Example 86 with Vec3d

use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.

the class ModuleShapeBeam method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    World world = spell.world;
    Vec3d target = spell.getTargetWithFallback();
    if (target == null)
        return;
    LibParticles.SHAPE_BEAM(world, target, spell.getOriginHand(), spellRing.getPrimaryColor());
}
Also used : World(net.minecraft.world.World) Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 87 with Vec3d

use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.

the class ModuleShapeBeam method run.

@Override
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) throws NullPointerException {
    World world = spell.world;
    Vec3d look = spell.getData(LOOK);
    Vec3d position = spell.getOrigin();
    Entity caster = spell.getCaster();
    if (look == null || position == null)
        return false;
    double range = spellRing.getAttributeValue(AttributeRegistry.RANGE, spell);
    double potency = 30 - spellRing.getAttributeValue(AttributeRegistry.POTENCY, spell);
    spellRing.multiplyMultiplierForAll((float) (potency / 25.0 * range / 75.0));
    RayTraceResult trace = new RayTrace(world, look, position, range).setSkipEntity(caster).setReturnLastUncollidableBlock(true).setIgnoreBlocksWithoutBoundingBoxes(true).trace();
    spell.processTrace(trace, look.scale(range));
    sendRenderPacket(spell, spellRing);
    if (spell.world.getTotalWorldTime() % potency == 0) {
        if (spellRing.getChildRing() != null) {
            spellRing.getChildRing().runSpellRing(spell);
        }
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) RayTrace(com.teamwizardry.wizardry.api.util.RayTrace) RayTraceResult(net.minecraft.util.math.RayTraceResult) World(net.minecraft.world.World) Vec3d(net.minecraft.util.math.Vec3d)

Example 88 with Vec3d

use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.

the class ModuleShapeCone method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Vec3d target = spell.getTarget();
    if (target == null)
        return;
    Vec3d origin = spell.getOriginHand();
    if (origin == null)
        return;
    ParticleBuilder lines = new ParticleBuilder(10);
    lines.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    lines.setScaleFunction(new InterpScale(0.5f, 0));
    lines.setColorFunction(new InterpColorHSV(spellRing.getPrimaryColor(), spellRing.getSecondaryColor()));
    ParticleSpawner.spawn(lines, spell.world, new InterpLine(origin, target), (int) target.distanceTo(origin) * 4, 0, (aFloat, particleBuilder) -> {
        lines.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
        lines.setLifetime(RandUtil.nextInt(10, 20));
    });
}
Also used : InterpColorHSV(com.teamwizardry.librarianlib.features.particle.functions.InterpColorHSV) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpLine(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpLine) 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)

Example 89 with Vec3d

use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.

the class ModuleShapeProjectile method run.

@Override
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    World world = spell.world;
    if (world.isRemote)
        return true;
    Vec3d origin = spell.getOriginWithFallback();
    if (origin == null)
        return false;
    double dist = spellRing.getAttributeValue(AttributeRegistry.RANGE, spell);
    double speed = spellRing.getAttributeValue(AttributeRegistry.SPEED, spell);
    EntitySpellProjectile proj = new EntitySpellProjectile(world, spellRing, spell, dist, speed, 0.1);
    proj.setPosition(origin.x, origin.y, origin.z);
    proj.velocityChanged = true;
    if (!spellRing.taxCaster(spell))
        return false;
    boolean success = world.spawnEntity(proj);
    if (success)
        world.playSound(null, new BlockPos(origin), ModSounds.PROJECTILE_LAUNCH, SoundCategory.PLAYERS, 1f, (float) RandUtil.nextDouble(1, 1.5));
    return success;
}
Also used : EntitySpellProjectile(com.teamwizardry.wizardry.common.entity.EntitySpellProjectile) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) Vec3d(net.minecraft.util.math.Vec3d)

Example 90 with Vec3d

use of net.minecraft.util.math.Vec3d in project Wizardry by TeamWizardry.

the class ModuleShapeSelf method render.

@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Entity caster = spell.getCaster();
    if (caster == null)
        return;
    ParticleBuilder glitter = new ParticleBuilder(1);
    glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
    ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(caster.getPositionVector().addVector(0, caster.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));
    });
}
Also used : Entity(net.minecraft.entity.Entity) 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

Vec3d (net.minecraft.util.math.Vec3d)789 BlockPos (net.minecraft.util.math.BlockPos)204 Entity (net.minecraft.entity.Entity)118 EnumFacing (net.minecraft.util.EnumFacing)108 ItemStack (net.minecraft.item.ItemStack)100 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)97 RayTraceResult (net.minecraft.util.math.RayTraceResult)90 World (net.minecraft.world.World)90 EntityPlayer (net.minecraft.entity.player.EntityPlayer)88 IBlockState (net.minecraft.block.state.IBlockState)76 EntityLivingBase (net.minecraft.entity.EntityLivingBase)74 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)72 ResourceLocation (net.minecraft.util.ResourceLocation)68 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)59 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)59 TileEntity (net.minecraft.tileentity.TileEntity)42 Block (net.minecraft.block.Block)41 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)30 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)27 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)27