Search in sources :

Example 1 with SoundEvent

use of net.minecraft.sound.SoundEvent in project bewitchment by MoriyaShiine.

the class BWSoundEvents method create.

private static SoundEvent create(String name) {
    Identifier id = new Identifier(Bewitchment.MODID, name);
    SoundEvent soundEvent = new SoundEvent(id);
    SOUND_EVENTS.put(soundEvent, id);
    return soundEvent;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier)

Example 2 with SoundEvent

use of net.minecraft.sound.SoundEvent in project WK by witches-kitchen.

the class WKSoundEvents method register.

private static SoundEvent register(String name) {
    Identifier id = new Identifier(WK.MODID, name);
    SoundEvent soundEvent = new SoundEvent(id);
    SOUND_EVENTS.put(id, soundEvent);
    return soundEvent;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier)

Example 3 with SoundEvent

use of net.minecraft.sound.SoundEvent in project WK by witches-kitchen.

the class PhasingStatusEffect method applyUpdateEffect.

@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
    World world = entity.getEntityWorld();
    if (!world.isClient) {
        double d = entity.getX();
        double e = entity.getY();
        double f = entity.getZ();
        for (int i = 0; i < 16; ++i) {
            double g = entity.getX() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
            double h = MathHelper.clamp(entity.getY() + (double) (entity.getRandom().nextInt(16) - 8), world.getBottomY(), world.getBottomY() + ((ServerWorld) world).getLogicalHeight() - 1);
            double j = entity.getZ() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
            if (entity.hasVehicle()) {
                entity.stopRiding();
            }
            if (entity.teleport(g, h, j, true)) {
                SoundEvent soundEvent = entity instanceof FoxEntity ? SoundEvents.ENTITY_FOX_TELEPORT : SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT;
                world.playSound(null, d, e, f, soundEvent, SoundCategory.PLAYERS, 1.0F, 1.0F);
                entity.playSound(soundEvent, 1.0F, 1.0F);
                break;
            }
        }
    }
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) FoxEntity(net.minecraft.entity.passive.FoxEntity) World(net.minecraft.world.World) ServerWorld(net.minecraft.server.world.ServerWorld)

Example 4 with SoundEvent

use of net.minecraft.sound.SoundEvent in project Liminal-Library by LudoCrypt.

the class LiminalSoundRegistry method getCurrent.

public static Optional<SoundEvent> getCurrent(ServerWorld from, ServerWorld to) {
    MutableObject<Optional<SoundEvent>> mutableSound = new MutableObject<Optional<SoundEvent>>(Optional.of(SoundEvents.BLOCK_PORTAL_TRAVEL));
    Optional<LiminalTravelSound> toTravelSound = ((DimensionTypeAccess) to.getDimension()).getLiminalEffects().getTravel();
    Optional<LiminalTravelSound> fromTravelSound = ((DimensionTypeAccess) from.getDimension()).getLiminalEffects().getTravel();
    if (fromTravelSound.isPresent()) {
        fromTravelSound.get().hookSound(from, to, mutableSound);
    }
    if (toTravelSound.isPresent()) {
        toTravelSound.get().hookSound(from, to, mutableSound);
    }
    List<LiminalTravelSound> list = Lists.newArrayList(OVERRIDE_TRAVEL_SOUND.iterator());
    Collections.sort(list, (a, b) -> Integer.compare(a == null ? 1000 : a.priority(), b == null ? 1000 : b.priority()));
    for (LiminalTravelSound sound : list) {
        sound.hookSound(from, to, mutableSound);
    }
    return mutableSound.getValue();
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) LiminalTravelSound(net.ludocrypt.limlib.api.sound.LiminalTravelSound) Optional(java.util.Optional) MutableObject(org.apache.commons.lang3.mutable.MutableObject)

Example 5 with SoundEvent

use of net.minecraft.sound.SoundEvent in project wildmod by Osmiooo.

the class MangroveBoatEntity method tick.

public void tick() {
    this.lastLocation = this.location;
    this.location = this.checkLocation();
    if (this.location != MangroveBoatEntity.Location.UNDER_WATER && this.location != MangroveBoatEntity.Location.UNDER_FLOWING_WATER) {
        this.ticksUnderwater = 0.0F;
    } else {
        ++this.ticksUnderwater;
    }
    if (!this.world.isClient && this.ticksUnderwater >= 60.0F) {
        this.removeAllPassengers();
    }
    if (this.getDamageWobbleTicks() > 0) {
        this.setDamageWobbleTicks(this.getDamageWobbleTicks() - 1);
    }
    if (this.getDamageWobbleStrength() > 0.0F) {
        this.setDamageWobbleStrength(this.getDamageWobbleStrength() - 1.0F);
    }
    super.tick();
    this.method_7555();
    if (this.isLogicalSideForUpdatingMovement()) {
        if (!(this.getFirstPassenger() instanceof PlayerEntity)) {
            this.setPaddleMovings(false, false);
        }
        this.updateVelocity();
        if (this.world.isClient) {
            this.updatePaddles();
            this.world.sendPacket(new BoatPaddleStateC2SPacket(this.isPaddleMoving(0), this.isPaddleMoving(1)));
        }
        this.move(MovementType.SELF, this.getVelocity());
    } else {
        this.setVelocity(Vec3d.ZERO);
    }
    this.handleBubbleColumn();
    for (int i = 0; i <= 1; ++i) {
        if (this.isPaddleMoving(i)) {
            if (!this.isSilent() && (double) (this.paddlePhases[i] % 6.2831855F) <= 0.7853981852531433D && ((double) this.paddlePhases[i] + 0.39269909262657166D) % 6.2831854820251465D >= 0.7853981852531433D) {
                SoundEvent soundEvent = this.getPaddleSoundEvent();
                if (soundEvent != null) {
                    Vec3d vec3d = this.getRotationVec(1.0F);
                    double d = i == 1 ? -vec3d.z : vec3d.z;
                    double e = i == 1 ? vec3d.x : -vec3d.x;
                    this.world.playSound((PlayerEntity) null, this.getX() + d, this.getY(), this.getZ() + e, soundEvent, this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.random.nextFloat());
                    this.world.emitGameEvent(this.getPrimaryPassenger(), GameEvent.SPLASH, new BlockPos(this.getX() + d, this.getY(), this.getZ() + e));
                }
            }
            float[] var10000 = this.paddlePhases;
            var10000[i] = (float) ((double) var10000[i] + 0.39269909262657166D);
        } else {
            this.paddlePhases[i] = 0.0F;
        }
    }
    this.checkBlockCollision();
    List<Entity> list = this.world.getOtherEntities(this, this.getBoundingBox().expand(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntityPredicates.canBePushedBy(this));
    if (!list.isEmpty()) {
        boolean bl = !this.world.isClient && !(this.getPrimaryPassenger() instanceof PlayerEntity);
        for (int j = 0; j < list.size(); ++j) {
            Entity entity = (Entity) list.get(j);
            if (!entity.hasPassenger(this)) {
                if (bl && this.getPassengerList().size() < 2 && !entity.hasVehicle() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterCreatureEntity) && !(entity instanceof PlayerEntity)) {
                    entity.startRiding(this);
                } else {
                    this.pushAwayFrom(entity);
                }
            }
        }
    }
}
Also used : BoatEntity(net.minecraft.entity.vehicle.BoatEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) SoundEvent(net.minecraft.sound.SoundEvent) BoatPaddleStateC2SPacket(net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket)

Aggregations

SoundEvent (net.minecraft.sound.SoundEvent)31 Identifier (net.minecraft.util.Identifier)11 NbtList (net.minecraft.nbt.NbtList)4 ArrayList (java.util.ArrayList)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 BoatPaddleStateC2SPacket (net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket)2 LiteralText (net.minecraft.text.LiteralText)2 CommandManager (com.tangykiwi.kiwiclient.command.CommandManager)1 ModuleManager (com.tangykiwi.kiwiclient.modules.ModuleManager)1 EChestMemory (com.tangykiwi.kiwiclient.util.tooltip.EChestMemory)1 Optional (java.util.Optional)1 Random (java.util.Random)1 SoundEventAccessor (me.basiqueevangelist.pingspam.mixin.SoundEventAccessor)1 Environment (net.fabricmc.api.Environment)1 LiminalTravelSound (net.ludocrypt.limlib.api.sound.LiminalTravelSound)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 ClientPlayerInteractionManager (net.minecraft.client.network.ClientPlayerInteractionManager)1 PositionedSoundInstance (net.minecraft.client.sound.PositionedSoundInstance)1