generated from MrSphay/codex-agent-repository-kit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.vinlanx.explosionoverhaul;
|
||||
|
||||
import com.vinlanx.explosionoverhaul.client.ClientEffects;
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.DistExecutor;
|
||||
import net.neoforged.neoforge.network.NetworkEvent;
|
||||
|
||||
public class SpawnMistCloudPacket {
|
||||
private final Vec3 position;
|
||||
private final float power;
|
||||
|
||||
public SpawnMistCloudPacket(Vec3 position, float power) {
|
||||
this.position = position;
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public static void encode(SpawnMistCloudPacket msg, FriendlyByteBuf buf) {
|
||||
buf.writeDouble(msg.position.f_82479_);
|
||||
buf.writeDouble(msg.position.f_82480_);
|
||||
buf.writeDouble(msg.position.f_82481_);
|
||||
buf.writeFloat(msg.power);
|
||||
}
|
||||
|
||||
public static SpawnMistCloudPacket decode(FriendlyByteBuf buf) {
|
||||
return new SpawnMistCloudPacket(new Vec3(buf.readDouble(), buf.readDouble(), buf.readDouble()), buf.readFloat());
|
||||
}
|
||||
|
||||
public static void handle(SpawnMistCloudPacket msg, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> DistExecutor.unsafeRunWhenOn((Dist)Dist.CLIENT, () -> () -> ClientEffects.triggerMistCloud(msg.position, msg.power)));
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user