diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java | 23 | ||||
-rw-r--r-- | src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java | 16 |
2 files changed, 39 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() + )); + } +} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java b/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java new file mode 100644 index 0000000..306b900 --- /dev/null +++ b/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java @@ -0,0 +1,16 @@ +package moe.nea.notenoughupdates.mixins.devenv; + +import net.minecraft.scoreboard.Scoreboard; +import org.slf4j.Logger; +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.Redirect; + +@Mixin(Scoreboard.class) +public class MixinScoreboard { + @Redirect(method = "addTeam", at=@At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) + public void onExistingteam(Logger instance, String s, Object o) { + // Ignore creations of existing teams + } +} |