Search in sources :

Example 1 with CircleTintData

use of it.hurts.sskirillss.relics.client.particles.circle.CircleTintData in project relics by SSKirillSS.

the class StellarCatalystProjectileEntity method tick.

@Override
public void tick() {
    super.tick();
    StellarCatalystItem.Stats config = StellarCatalystItem.INSTANCE.getStats();
    Random random = this.getCommandSenderWorld().getRandom();
    for (int i = 0; i < 3; i++) level.addParticle(new CircleTintData(new Color(255 - random.nextInt(150), 0, 255 - random.nextInt(150)), 0.2F + random.nextFloat() * 0.15F, 20, 0.95F, false), this.xo, this.yo, this.zo, MathUtils.randomFloat(random) * 0.2F, random.nextFloat() * 0.75F, MathUtils.randomFloat(random) * 0.2F);
    if (this.tickCount > 100)
        this.remove();
    this.setDeltaMovement(0.0F, -config.projectileSpeed - this.tickCount * 0.01F, 0.0F);
}
Also used : Random(java.util.Random) StellarCatalystItem(it.hurts.sskirillss.relics.items.relics.talisman.StellarCatalystItem) CircleTintData(it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)

Example 2 with CircleTintData

use of it.hurts.sskirillss.relics.client.particles.circle.CircleTintData in project relics by SSKirillSS.

the class BloodyLecternTile method tick.

@Override
public void tick() {
    if (level == null)
        return;
    ticksExisted++;
    ItemStack stack = getStack();
    if (stack.isEmpty() || stack.getItem() != ItemRegistry.RELIC_CONTRACT.get())
        return;
    int blood = NBTUtils.getInt(stack, RelicContractItem.TAG_BLOOD, 0) + 1;
    if (blood == 0)
        return;
    Random random = level.getRandom();
    BlockPos pos = this.getBlockPos();
    for (int i = 0; i < blood; i++) if (level.getRandom().nextInt(3) == 0)
        level.addParticle(new CircleTintData(new Color(255, 0, 0), random.nextFloat() * 0.025F + 0.04F, 20, 0.94F, true), pos.getX() + 0.5F + MathUtils.randomFloat(random) * 0.3F, pos.getY() + 0.95F, pos.getZ() + 0.5F + MathUtils.randomFloat(random) * 0.3F, 0, random.nextFloat() * 0.05D, 0);
}
Also used : Random(java.util.Random) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) CircleTintData(it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)

Example 3 with CircleTintData

use of it.hurts.sskirillss.relics.client.particles.circle.CircleTintData in project relics by SSKirillSS.

the class PedestalTile method tick.

@Override
public void tick() {
    if (level == null)
        return;
    ticksExisted++;
    if (stack != null && !stack.isEmpty() && this.ticksExisted % 3 == 0) {
        Random random = level.getRandom();
        CircleTintData particle = new CircleTintData(stack.getRarity().color.getColor() != null ? new Color(stack.getRarity().color.getColor(), false) : new Color(255, 255, 255), random.nextFloat() * 0.025F + 0.04F, 20, 0.94F, true);
        BlockPos blockPos = this.getBlockPos();
        Vector3d pos = new Vector3d(blockPos.getX() + 0.5D, blockPos.getY() + 0.5D, blockPos.getZ() + 0.5D);
        Direction direction = this.getBlockState().getValue(PedestalBlock.DIRECTION);
        double motionX = 0.0D, motionY = 0.0D, motionZ = 0.0D;
        double x = pos.x(), y = pos.y(), z = pos.z();
        if (direction == Direction.UP) {
            x = pos.x() + MathUtils.randomFloat(random) * 0.175F;
            y = pos.y() - 0.25D;
            z = pos.z() + MathUtils.randomFloat(random) * 0.175F;
            motionY = random.nextFloat() * 0.05D;
        } else if (direction == Direction.DOWN) {
            x = pos.x() + MathUtils.randomFloat(random) * 0.175F;
            y = pos.y() + 0.25D;
            z = pos.z() + MathUtils.randomFloat(random) * 0.175F;
            motionY = -random.nextFloat() * 0.05D;
        } else if (direction == Direction.NORTH) {
            x = pos.x() + MathUtils.randomFloat(random) * 0.175F;
            y = pos.y() + MathUtils.randomFloat(random) * 0.175F;
            z = pos.z() + 0.25D;
            motionZ = -random.nextFloat() * 0.05D;
        } else if (direction == Direction.SOUTH) {
            x = pos.x() + MathUtils.randomFloat(random) * 0.175F;
            y = pos.y() + MathUtils.randomFloat(random) * 0.175F;
            z = pos.z() - 0.25D;
            motionZ = random.nextFloat() * 0.05D;
        } else if (direction == Direction.EAST) {
            x = pos.x() - 0.25D;
            y = pos.y() + MathUtils.randomFloat(random) * 0.175F;
            z = pos.z() + MathUtils.randomFloat(random) * 0.175F;
            motionX = random.nextFloat() * 0.05D;
        } else if (direction == Direction.WEST) {
            x = pos.x() + 0.25D;
            y = pos.y() + MathUtils.randomFloat(random) * 0.175F;
            z = pos.z() + MathUtils.randomFloat(random) * 0.175F;
            motionX = -random.nextFloat() * 0.05D;
        }
        level.addParticle(particle, x, y, z, motionX, motionY, motionZ);
    }
}
Also used : Random(java.util.Random) Vector3d(net.minecraft.util.math.vector.Vector3d) BlockPos(net.minecraft.util.math.BlockPos) Direction(net.minecraft.util.Direction) CircleTintData(it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)

Example 4 with CircleTintData

use of it.hurts.sskirillss.relics.client.particles.circle.CircleTintData in project relics by SSKirillSS.

the class RunicAltarTile method spawnParticles.

protected void spawnParticles(World world, Random random) {
    if (!world.isClientSide())
        return;
    BlockPos pos = getBlockPos();
    world.addParticle(new CircleTintData(relicStack.getRarity().color.getColor() != null ? new Color(relicStack.getRarity().color.getColor(), false) : new Color(255, 255, 255), random.nextFloat() * 0.025F + 0.04F, 20, 0.94F, true), pos.getX() + 0.5D + MathUtils.randomFloat(random) * 0.2F, pos.getY() + 0.85F, pos.getZ() + 0.5D + MathUtils.randomFloat(random) * 0.2F, 0, random.nextFloat() * 0.05D, 0);
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) CircleTintData(it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)

Example 5 with CircleTintData

use of it.hurts.sskirillss.relics.client.particles.circle.CircleTintData in project relics by SSKirillSS.

the class ElytraBoosterItem method collectBreath.

private void collectBreath(PlayerEntity player, ItemStack stack) {
    World world = player.getCommandSenderWorld();
    int breath = NBTUtils.getInt(stack, TAG_BREATH_AMOUNT, 0);
    if (breath >= stats.breathCapacity)
        return;
    if (world.dimension() == World.END && player.tickCount % (stats.breathRegenerationCooldown * 20) == 0)
        NBTUtils.setInt(stack, TAG_BREATH_AMOUNT, breath + 1);
    for (AreaEffectCloudEntity cloud : world.getEntitiesOfClass(AreaEffectCloudEntity.class, player.getBoundingBox().inflate(stats.breathConsumptionRadius))) {
        if (cloud.getParticle() != ParticleTypes.DRAGON_BREATH)
            continue;
        if (player.tickCount % 5 == 0)
            NBTUtils.setInt(stack, TAG_BREATH_AMOUNT, breath + 1);
        if (cloud.getRadius() <= 0)
            cloud.remove();
        cloud.setRadius(cloud.getRadius() - stats.breathConsumptionSpeed);
        Vector3d direction = player.position().add(0, 1, 0).subtract(cloud.position()).normalize();
        double distance = player.position().add(0, 1, 0).distanceTo(cloud.position());
        world.addParticle(new CircleTintData(new Color(160, 0, 255), (float) (distance * 0.075F), (int) distance * 5, 0.95F, false), cloud.getX(), cloud.getY(), cloud.getZ(), direction.x * 0.2F, direction.y * 0.2F, direction.z * 0.2F);
    }
}
Also used : Vector3d(net.minecraft.util.math.vector.Vector3d) AreaEffectCloudEntity(net.minecraft.entity.AreaEffectCloudEntity) World(net.minecraft.world.World) CircleTintData(it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)

Aggregations

CircleTintData (it.hurts.sskirillss.relics.client.particles.circle.CircleTintData)9 Vector3d (net.minecraft.util.math.vector.Vector3d)6 BlockPos (net.minecraft.util.math.BlockPos)5 Random (java.util.Random)4 World (net.minecraft.world.World)3 StellarCatalystItem (it.hurts.sskirillss.relics.items.relics.talisman.StellarCatalystItem)2 LivingEntity (net.minecraft.entity.LivingEntity)2 ItemStack (net.minecraft.item.ItemStack)2 AbilityTooltip (it.hurts.sskirillss.relics.client.tooltip.base.AbilityTooltip)1 RelicTooltip (it.hurts.sskirillss.relics.client.tooltip.base.RelicTooltip)1 RelicConfigData (it.hurts.sskirillss.relics.configs.data.relics.RelicConfigData)1 ItemRegistry (it.hurts.sskirillss.relics.init.ItemRegistry)1 RelicItem (it.hurts.sskirillss.relics.items.relics.base.RelicItem)1 RelicData (it.hurts.sskirillss.relics.items.relics.base.data.RelicData)1 RelicStats (it.hurts.sskirillss.relics.items.relics.base.data.RelicStats)1 PacketPlayerMotion (it.hurts.sskirillss.relics.network.PacketPlayerMotion)1 it.hurts.sskirillss.relics.utils (it.hurts.sskirillss.relics.utils)1 java.awt (java.awt)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1