Search in sources :

Example 21 with SoundEvent

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

the class ChestBoatEntity method tick.

public void tick() {
    this.lastLocation = this.location;
    this.location = this.checkLocation();
    if (this.location != ChestBoatEntity.Location.UNDER_WATER && this.location != ChestBoatEntity.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;
        }
    }
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) PlayerEntity(net.minecraft.entity.player.PlayerEntity) BoatPaddleStateC2SPacket(net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket)

Example 22 with SoundEvent

use of net.minecraft.sound.SoundEvent in project meteor-client by MeteorDevelopment.

the class SoundEventListSetting method load.

@Override
public List<SoundEvent> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        SoundEvent soundEvent = Registry.SOUND_EVENT.get(new Identifier(tagI.asString()));
        if (soundEvent != null)
            get().add(soundEvent);
    }
    return get();
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 23 with SoundEvent

use of net.minecraft.sound.SoundEvent in project meteor-client by MeteorDevelopment.

the class SoundEventListSetting method parseImpl.

@Override
protected List<SoundEvent> parseImpl(String str) {
    String[] values = str.split(",");
    List<SoundEvent> sounds = new ArrayList<>(values.length);
    try {
        for (String value : values) {
            SoundEvent sound = parseId(Registry.SOUND_EVENT, value);
            if (sound != null)
                sounds.add(sound);
        }
    } catch (Exception ignored) {
    }
    return sounds;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) ArrayList(java.util.ArrayList) NbtString(net.minecraft.nbt.NbtString)

Example 24 with SoundEvent

use of net.minecraft.sound.SoundEvent in project MiniMap by pl3xgaming.

the class Sound method initialize.

public static void initialize() {
    REGISTERED_SOUNDS.forEach(sound -> {
        sound.soundEvent = new SoundEvent(sound.identifier);
        MiniMap.LOG.info("Loaded sound " + sound.identifier);
    });
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 25 with SoundEvent

use of net.minecraft.sound.SoundEvent in project MCDoom by AzureDoom.

the class ModSoundEvents method of.

static SoundEvent of(String id) {
    SoundEvent sound = new SoundEvent(new Identifier(DoomMod.MODID, id));
    Registry.register(Registry.SOUND_EVENT, new Identifier(DoomMod.MODID, id), sound);
    return sound;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier)

Aggregations

SoundEvent (net.minecraft.sound.SoundEvent)37 Identifier (net.minecraft.util.Identifier)14 NbtList (net.minecraft.nbt.NbtList)4 PlayerEntity (net.minecraft.entity.player.PlayerEntity)3 ArrayList (java.util.ArrayList)2 Random (java.util.Random)2 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 BoatPaddleStateC2SPacket (net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket)2 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)2 LiteralText (net.minecraft.text.LiteralText)2 BlockPos (net.minecraft.util.math.BlockPos)2 AshBlock (com.ordana.immersive_weathering.registry.blocks.AshBlock)1 ModBlocks (com.ordana.immersive_weathering.registry.blocks.ModBlocks)1 SootBlock (com.ordana.immersive_weathering.registry.blocks.SootBlock)1 Weatherable (com.ordana.immersive_weathering.registry.blocks.Weatherable)1 ModItems (com.ordana.immersive_weathering.registry.items.ModItems)1 CommandManager (com.tangykiwi.kiwiclient.command.CommandManager)1 ModuleManager (com.tangykiwi.kiwiclient.modules.ModuleManager)1 EChestMemory (com.tangykiwi.kiwiclient.util.tooltip.EChestMemory)1