Search in sources :

Example 1 with PacketSpawnParticle

use of me.desht.pneumaticcraft.common.network.PacketSpawnParticle in project pnc-repressurized by TeamPneumatic.

the class EntityPathNavigateDrone method teleport.

public void teleport() {
    Random rand = pathfindingEntity.getRNG();
    double width = pathfindingEntity.width;
    double height = pathfindingEntity.height;
    short short1 = 128;
    for (int l = 0; l < short1; ++l) {
        double d6 = l / (short1 - 1.0D);
        float f = (rand.nextFloat() - 0.5F) * 0.2F;
        float f1 = (rand.nextFloat() - 0.5F) * 0.2F;
        float f2 = (rand.nextFloat() - 0.5F) * 0.2F;
        double d7 = pathfindingEntity.posX + (telPos.getX() + 0.5 - pathfindingEntity.posX) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
        double d8 = pathfindingEntity.posY + (telPos.getY() - pathfindingEntity.posY) * d6 + rand.nextDouble() * height;
        double d9 = pathfindingEntity.posZ + (telPos.getZ() + 0.5 - pathfindingEntity.posZ) * d6 + (rand.nextDouble() - 0.5D) * width * 2.0D;
        NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.PORTAL, d7, d8, d9, f, f1, f2), pathfindingEntity.world);
    }
    pathfindingEntity.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F);
    pathfindingEntity.setPosition(telPos.getX() + 0.5, telPos.getY() + 0.5, telPos.getZ() + 0.5);
}
Also used : PacketSpawnParticle(me.desht.pneumaticcraft.common.network.PacketSpawnParticle) Random(java.util.Random) PathPoint(net.minecraft.pathfinding.PathPoint)

Example 2 with PacketSpawnParticle

use of me.desht.pneumaticcraft.common.network.PacketSpawnParticle in project pnc-repressurized by TeamPneumatic.

the class AirHandler method airLeak.

@Override
public void airLeak(EnumFacing side) {
    if (getWorld().isRemote || Math.abs(getPressure()) < 0.01F)
        return;
    double motionX = side.getFrontOffsetX();
    double motionY = side.getFrontOffsetY();
    double motionZ = side.getFrontOffsetZ();
    if (soundCounter <= 0) {
        soundCounter = 20;
        NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.LEAKING_GAS_SOUND, SoundCategory.BLOCKS, getPos().getX(), getPos().getY(), getPos().getZ(), 0.1F, 1.0F, true), getWorld());
    }
    if (getPressure() < 0) {
        double speed = getPressure() * 0.1F - 0.1F;
        NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_NORMAL, getPos().getX() + 0.5D + motionX / 2D, getPos().getY() + 0.5D + motionY / 2D, getPos().getZ() + 0.5D + motionZ / 2D, motionX * speed, motionY * speed, motionZ * speed), getWorld());
        int dispersedAmount = -(int) (getPressure() * PneumaticValues.AIR_LEAK_FACTOR) + 20;
        if (getAir() > dispersedAmount)
            dispersedAmount = -getAir();
        onAirDispersion(side, dispersedAmount);
        addAir(dispersedAmount);
    } else {
        double speed = getPressure() * 0.1F + 0.1F;
        // if(DateEventHandler.isEvent()) {
        // DateEventHandler.spawnFirework(getWorld(), getPos().getX() + 0.5D + motionX / 2D, getPos().getY() + 0.5D + motionY / 2D, getPos().getZ() + 0.5D + motionZ / 2D);
        // } else {
        NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_NORMAL, getPos().getX() + 0.5D + motionX / 2D, getPos().getY() + 0.5D + motionY / 2D, getPos().getZ() + 0.5D + motionZ / 2D, motionX * speed, motionY * speed, motionZ * speed), getWorld());
        // }
        int dispersedAmount = (int) (getPressure() * PneumaticValues.AIR_LEAK_FACTOR) + 20;
        if (dispersedAmount > getAir())
            dispersedAmount = getAir();
        onAirDispersion(side, -dispersedAmount);
        addAir(-dispersedAmount);
    }
}
Also used : PacketSpawnParticle(me.desht.pneumaticcraft.common.network.PacketSpawnParticle) PacketPlaySound(me.desht.pneumaticcraft.common.network.PacketPlaySound)

Example 3 with PacketSpawnParticle

use of me.desht.pneumaticcraft.common.network.PacketSpawnParticle in project pnc-repressurized by TeamPneumatic.

the class SemiBlockCropSupport method update.

@Override
public void update() {
    super.update();
    if (!world.isRemote && world.rand.nextDouble() < UPDATE_CHANCE) {
        IBlockState state = getBlockState();
        state.getBlock().updateTick(world, getPos(), state, world.rand);
        NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.VILLAGER_HAPPY, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, 0, 0, 0), world);
    }
}
Also used : PacketSpawnParticle(me.desht.pneumaticcraft.common.network.PacketSpawnParticle) IBlockState(net.minecraft.block.state.IBlockState)

Example 4 with PacketSpawnParticle

use of me.desht.pneumaticcraft.common.network.PacketSpawnParticle in project pnc-repressurized by TeamPneumatic.

the class HeatBehaviourTransition method onTransition.

protected void onTransition(BlockPos pos) {
    NetworkHandler.sendToAllAround(new PacketPlaySound(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.AMBIENT, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0.5F, 2.6F + (getWorld().rand.nextFloat() - getWorld().rand.nextFloat()) * 0.8F, true), getWorld());
    for (int i = 0; i < 8; i++) {
        double randX = pos.getX() + getWorld().rand.nextDouble();
        double randZ = pos.getZ() + getWorld().rand.nextDouble();
        NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, randX, pos.getY() + 1, randZ, 0, 0, 0), getWorld());
    }
}
Also used : PacketSpawnParticle(me.desht.pneumaticcraft.common.network.PacketSpawnParticle) PacketPlaySound(me.desht.pneumaticcraft.common.network.PacketPlaySound)

Example 5 with PacketSpawnParticle

use of me.desht.pneumaticcraft.common.network.PacketSpawnParticle in project pnc-repressurized by TeamPneumatic.

the class EntityPathNavigateDrone method onUpdateNavigation.

@Override
public void onUpdateNavigation() {
    if (isGoingToTeleport()) {
        if (teleportCounter == 0 || teleportCounter == 60) {
            NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.HUD_INIT, SoundCategory.PLAYERS, pathfindingEntity.posX, pathfindingEntity.posY, pathfindingEntity.posZ, 0.1F, teleportCounter == 0 ? 0.7F : 1F, true), pathfindingEntity.world);
        }
        if (teleportCounter < TELEPORT_TICKS - 40) {
            Random rand = pathfindingEntity.getRNG();
            float f = (rand.nextFloat() - 0.5F) * 0.02F * teleportCounter;
            float f1 = (rand.nextFloat() - 0.5F) * 0.02F * teleportCounter;
            float f2 = (rand.nextFloat() - 0.5F) * 0.02F * teleportCounter;
            NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.PORTAL, pathfindingEntity.posX, pathfindingEntity.posY, pathfindingEntity.posZ, f, f1, f2), pathfindingEntity.world);
        }
        if (++teleportCounter > TELEPORT_TICKS) {
            if (pathfindingEntity.isBlockValidPathfindBlock(telPos)) {
                teleport();
            }
            teleportCounter = -1;
            setPath(null, 0);
            pathfindingEntity.getMoveHelper().setMoveTo(telPos.getX(), telPos.getY(), telPos.getZ(), pathfindingEntity.getSpeed());
            pathfindingEntity.addAir(null, -10000);
        }
    } else {
        // super.onUpdateNavigation();
        if (!noPath()) {
            pathFollow();
            if (!noPath()) {
                Vec3d vec32 = currentPath.getPosition(entity);
                if (vec32 != null) {
                    entity.getMoveHelper().setMoveTo(vec32.x, vec32.y, vec32.z, speed);
                }
            }
        }
    }
}
Also used : PacketSpawnParticle(me.desht.pneumaticcraft.common.network.PacketSpawnParticle) Random(java.util.Random) PacketPlaySound(me.desht.pneumaticcraft.common.network.PacketPlaySound) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

PacketSpawnParticle (me.desht.pneumaticcraft.common.network.PacketSpawnParticle)5 PacketPlaySound (me.desht.pneumaticcraft.common.network.PacketPlaySound)3 Random (java.util.Random)2 IBlockState (net.minecraft.block.state.IBlockState)1 PathPoint (net.minecraft.pathfinding.PathPoint)1 Vec3d (net.minecraft.util.math.Vec3d)1