aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-25 21:40:26 +0200
committernea <nea@nea.moe>2023-09-25 21:40:26 +0200
commiteaf91279b8f65b30f05a7be9a8ae1b6b18859ae4 (patch)
treeb00348853d7322bfaaa1121831b5ceeec130b649 /src/main/java/moe/nea
parent139089d9beb134465737c4afff3b1303bf481aa1 (diff)
downloadFirmament-eaf91279b8f65b30f05a7be9a8ae1b6b18859ae4.tar.gz
Firmament-eaf91279b8f65b30f05a7be9a8ae1b6b18859ae4.tar.bz2
Firmament-eaf91279b8f65b30f05a7be9a8ae1b6b18859ae4.zip
Add enhanced explosions support
Diffstat (limited to 'src/main/java/moe/nea')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java15
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();
}
}