diff options
author | nea <nea@nea.moe> | 2023-05-07 12:22:36 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-08 00:17:34 +0200 |
commit | 942dd629efbf12183b1c5f5a966c36d4b0647a6b (patch) | |
tree | 407e8d2cdcfefa77673c768e5126857a86ddb89a /src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java | |
parent | 229f724ef4a0a4cbc426f31e27f9a57e9b1307c9 (diff) | |
download | firmament-942dd629efbf12183b1c5f5a966c36d4b0647a6b.tar.gz firmament-942dd629efbf12183b1c5f5a966c36d4b0647a6b.tar.bz2 firmament-942dd629efbf12183b1c5f5a966c36d4b0647a6b.zip |
Add fishing particle highlighter
Currently does not work when sneaking or when the bobber moves too much, since the position desyncs with the server
Diffstat (limited to 'src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java')
-rw-r--r-- | src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java new file mode 100644 index 0000000..dc57113 --- /dev/null +++ b/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java @@ -0,0 +1,23 @@ +package moe.nea.notenoughupdates.mixins; + +import moe.nea.notenoughupdates.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() + )); + } +} |