Search in sources :

Example 6 with ClientRunnable

use of com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable in project Wizardry by TeamWizardry.

the class EntityJumpPad method collideWithEntity.

@Override
public void collideWithEntity(Entity entity) {
    if (!(entity instanceof EntityLivingBase))
        return;
    ((EntityLivingBase) entity).motionY += 0.2;
    entity.fallDistance = 0;
    Color color1 = new Color(RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255));
    Color color2 = new Color(RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255), RandUtil.nextInt(100, 255));
    Vec3d normal = new Vec3d(entity.motionX, entity.motionY, entity.motionZ).normalize().scale(1 / 2.0);
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            LibParticles.AIR_THROTTLE(world, entity.getPositionVector(), normal, color1, color2, 0.5);
        }
    });
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) Vec3d(net.minecraft.util.math.Vec3d)

Example 7 with ClientRunnable

use of com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable in project Wizardry by TeamWizardry.

the class EntitySpiritBlight method onDeath.

@Override
public void onDeath(DamageSource cause) {
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(100, 150));
            glitter.setColor(Color.WHITE);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
            glitter.setAcceleration(Vec3d.ZERO);
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector().addVector(0, height, 0)), 1000, 0, (i, build) -> {
                double radius = 0.2;
                build.setDeceleration(new Vec3d(RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95)));
                build.addMotion(new Vec3d(RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius)));
                build.setLifetime(RandUtil.nextInt(200, 250));
                build.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.6f, 1.5f), 0));
                if (RandUtil.nextBoolean())
                    build.setColor(Color.WHITE);
                else
                    build.setColor(new Color(0xf404d4));
            });
        }
    });
    playSound(ModSounds.BASS_BOOM, 3, 0.5f);
    playSound(ModSounds.BASS_BOOM, 1, RandUtil.nextFloat(1, 1.5f));
    super.onDeath(cause);
}
Also used : Matrix4(com.teamwizardry.librarianlib.features.math.Matrix4) EntityDataManager(net.minecraft.network.datasync.EntityDataManager) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) RandUtilSeed(com.teamwizardry.wizardry.api.util.RandUtilSeed) ModSounds(com.teamwizardry.wizardry.init.ModSounds) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Entity(net.minecraft.entity.Entity) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) DataParameter(net.minecraft.network.datasync.DataParameter) DamageSource(net.minecraft.util.DamageSource) SharedMonsterAttributes(net.minecraft.entity.SharedMonsterAttributes) java.awt(java.awt) DataSerializers(net.minecraft.network.datasync.DataSerializers) EntityMob(net.minecraft.entity.monster.EntityMob) LibParticles(com.teamwizardry.wizardry.client.fx.LibParticles) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) Constants(com.teamwizardry.wizardry.api.Constants) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 8 with ClientRunnable

use of com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable in project Wizardry by TeamWizardry.

the class EntitySpiritBlight method attackEntityFrom.

@Override
public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) {
    if (source.isMagicDamage()) {
        super.attackEntityFrom(source, amount);
        ClientRunnable.run(new ClientRunnable() {

            @Override
            @SideOnly(Side.CLIENT)
            public void runIfClient() {
                LibParticles.SPIRIT_WIGHT_HURT(world, getPositionVector());
            }
        });
        return true;
    } else
        return false;
}
Also used : SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)

Example 9 with ClientRunnable

use of com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable in project Wizardry by TeamWizardry.

the class EntitySpiritWight method onDeath.

@Override
public void onDeath(DamageSource cause) {
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            ParticleBuilder glitter = new ParticleBuilder(RandUtil.nextInt(100, 150));
            glitter.setColor(Color.WHITE);
            glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
            glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 0.1f));
            glitter.setAcceleration(Vec3d.ZERO);
            ParticleSpawner.spawn(glitter, world, new StaticInterp<>(getPositionVector().addVector(0, height, 0)), 1000, 0, (i, build) -> {
                double radius = 0.2;
                build.setDeceleration(new Vec3d(RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95), RandUtil.nextDouble(0.8, 0.95)));
                build.addMotion(new Vec3d(RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius), RandUtil.nextDouble(-radius, radius)));
                build.setLifetime(RandUtil.nextInt(200, 250));
                build.setScaleFunction(new InterpScale(RandUtil.nextFloat(0.6f, 1.5f), 0));
                if (RandUtil.nextBoolean())
                    build.setColor(Color.WHITE);
                else
                    build.setColor(Color.YELLOW);
            });
        }
    });
    playSound(ModSounds.BASS_BOOM, 3, 0.5f);
    playSound(ModSounds.BASS_BOOM, 1, RandUtil.nextFloat(1, 1.5f));
    super.onDeath(cause);
}
Also used : InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) EntityAIWatchClosest(net.minecraft.entity.ai.EntityAIWatchClosest) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) ParticleSpawner(com.teamwizardry.librarianlib.features.particle.ParticleSpawner) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) ModSounds(com.teamwizardry.wizardry.init.ModSounds) EntityAINearestAttackableTarget(net.minecraft.entity.ai.EntityAINearestAttackableTarget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Entity(net.minecraft.entity.Entity) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) World(net.minecraft.world.World) Wizardry(com.teamwizardry.wizardry.Wizardry) DamageSource(net.minecraft.util.DamageSource) SharedMonsterAttributes(net.minecraft.entity.SharedMonsterAttributes) java.awt(java.awt) EntityMob(net.minecraft.entity.monster.EntityMob) EntityLivingBase(net.minecraft.entity.EntityLivingBase) LibParticles(com.teamwizardry.wizardry.client.fx.LibParticles) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) RandUtil(com.teamwizardry.wizardry.api.util.RandUtil) Constants(com.teamwizardry.wizardry.api.Constants) InterpScale(com.teamwizardry.wizardry.api.util.interp.InterpScale) ResourceLocation(net.minecraft.util.ResourceLocation) StaticInterp(com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Example 10 with ClientRunnable

use of com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable in project Wizardry by TeamWizardry.

the class EntitySpiritWight method collideWithEntity.

@Override
public void collideWithEntity(Entity entity) {
    if (getHealth() > 0) {
        if (entity.getName().equals(getName()))
            return;
        ((EntityLivingBase) entity).motionY += 0.4;
        ((EntityLivingBase) entity).attackEntityAsMob(this);
        ((EntityLivingBase) entity).setRevengeTarget(this);
    }
    entity.fallDistance = 0;
    Vec3d normal = new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(0.1, 0.4), RandUtil.nextDouble(-0.01, 0.01));
    ClientRunnable.run(new ClientRunnable() {

        @Override
        @SideOnly(Side.CLIENT)
        public void runIfClient() {
            LibParticles.AIR_THROTTLE(world, getPositionVector().addVector(0, getEyeHeight(), 0), normal, Color.WHITE, Color.YELLOW, RandUtil.nextDouble(0.2, 1.0));
        }
    });
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ClientRunnable(com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

ClientRunnable (com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)20 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)17 Vec3d (net.minecraft.util.math.Vec3d)15 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)11 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)11 ResourceLocation (net.minecraft.util.ResourceLocation)11 StaticInterp (com.teamwizardry.librarianlib.features.math.interpolate.StaticInterp)8 ParticleSpawner (com.teamwizardry.librarianlib.features.particle.ParticleSpawner)8 Wizardry (com.teamwizardry.wizardry.Wizardry)8 Constants (com.teamwizardry.wizardry.api.Constants)8 RandUtil (com.teamwizardry.wizardry.api.util.RandUtil)8 java.awt (java.awt)8 EntityLivingBase (net.minecraft.entity.EntityLivingBase)8 World (net.minecraft.world.World)8 Side (net.minecraftforge.fml.relauncher.Side)8 MathHelper (net.minecraft.util.math.MathHelper)7 Entity (net.minecraft.entity.Entity)6 InterpScale (com.teamwizardry.wizardry.api.util.interp.InterpScale)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 LibParticles (com.teamwizardry.wizardry.client.fx.LibParticles)4