aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-16 01:23:43 +0200
committernea <nea@nea.moe>2023-05-16 01:23:43 +0200
commitead6762eb1c005914b05f9d3c29f334989c67513 (patch)
treecd1409756be2bc4a93195c31d432fef053afe002 /src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
parent96c546cc73880a7c502c17aadda6ca84c847692d (diff)
downloadfirmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.gz
firmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.bz2
firmament-ead6762eb1c005914b05f9d3c29f334989c67513.zip
Replace references to NEU with Firmament
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
new file mode 100644
index 0000000..01ef98e
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java
@@ -0,0 +1,23 @@
+package moe.nea.firmament.mixins;
+
+import moe.nea.firmament.events.ParticleSpawnEvent;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
+import net.minecraft.util.math.Vec3d;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(ClientPlayNetworkHandler.class)
+public class MixinClientPacketHandler {
+ @Inject(method = "onParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER))
+ public void onParticleSpawn(ParticleS2CPacket packet, CallbackInfo ci) {
+ ParticleSpawnEvent.Companion.publish(new ParticleSpawnEvent(
+ packet.getParameters(),
+ new Vec3d(packet.getX(), packet.getY(), packet.getZ()),
+ new Vec3d(packet.getOffsetX(), packet.getOffsetY(), packet.getOffsetZ()),
+ packet.isLongDistance()
+ ));
+ }
+}