generated from MrSphay/codex-agent-repository-kit
38 lines
1.2 KiB
Java
38 lines
1.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.vinlanx.explosionoverhaul;
|
|
|
|
import com.vinlanx.explosionoverhaul.ClientSoundHandler;
|
|
import java.util.function.Supplier;
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.fml.DistExecutor;
|
|
import net.minecraftforge.network.NetworkEvent;
|
|
|
|
public class SuppressExplosionSoundPacket {
|
|
private final float power;
|
|
|
|
public SuppressExplosionSoundPacket(float power) {
|
|
this.power = power;
|
|
}
|
|
|
|
public static void encode(SuppressExplosionSoundPacket msg, FriendlyByteBuf buf) {
|
|
buf.writeFloat(msg.power);
|
|
}
|
|
|
|
public static SuppressExplosionSoundPacket decode(FriendlyByteBuf buf) {
|
|
return new SuppressExplosionSoundPacket(buf.readFloat());
|
|
}
|
|
|
|
public static void handle(SuppressExplosionSoundPacket msg, Supplier<NetworkEvent.Context> ctx) {
|
|
ctx.get().enqueueWork(() -> DistExecutor.unsafeRunWhenOn((Dist)Dist.CLIENT, () -> () -> ClientSoundHandler.setSuppressVanillaExplosionSound(true, 10)));
|
|
ctx.get().setPacketHandled(true);
|
|
}
|
|
|
|
public float getPower() {
|
|
return this.power;
|
|
}
|
|
}
|
|
|