diff options
Diffstat (limited to 'src/main/java/moe')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java index dbf8c7f..220c76f 100644 --- a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java +++ b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java @@ -6,11 +6,8 @@ package moe.nea.firmament.mixins; -import moe.nea.firmament.events.OutgoingPacketEvent; import moe.nea.firmament.events.ParticleSpawnEvent; import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket; import net.minecraft.network.packet.s2c.play.ParticleS2CPacket; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; @@ -20,13 +17,17 @@ 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)) + @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), cancellable = true) public void onParticleSpawn(ParticleS2CPacket packet, CallbackInfo ci) { - ParticleSpawnEvent.Companion.publish(new ParticleSpawnEvent( + var event = new ParticleSpawnEvent( packet.getParameters(), new Vec3d(packet.getX(), packet.getY(), packet.getZ()), new Vec3d(packet.getOffsetX(), packet.getOffsetY(), packet.getOffsetZ()), - packet.isLongDistance() - )); + packet.isLongDistance(), + packet.getCount() + ); + ParticleSpawnEvent.Companion.publish(event); + if (event.getCancelled()) + ci.cancel(); } } |