-
Notifications
You must be signed in to change notification settings - Fork 0
/
MixinServerLifecycleHooks.java
29 lines (25 loc) · 1.36 KB
/
MixinServerLifecycleHooks.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.auioc.mcmod.arnicalib.mixin.server;
import org.auioc.mcmod.arnicalib.server.event.AHServerEventFactory;
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.CallbackInfoReturnable;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
import net.minecraftforge.server.ServerLifecycleHooks;
@Mixin(value = ServerLifecycleHooks.class)
public abstract class MixinServerLifecycleHooks {
// @org.spongepowered.asm.mixin.Debug(export = true, print = true)
@Inject(
method = "Lnet/minecraftforge/server/ServerLifecycleHooks;handleServerLogin(Lnet/minecraft/network/protocol/handshake/ClientIntentionPacket;Lnet/minecraft/network/Connection;)Z",
at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/handshake/ClientIntentionPacket;getIntention()Lnet/minecraft/network/ConnectionProtocol;", ordinal = 0),
require = 1,
allow = 1,
cancellable = true
)
private static void onServerLogin(final ClientIntentionPacket packet, final Connection manager, CallbackInfoReturnable<Boolean> cir) {
if (AHServerEventFactory.onServerLogin(packet, manager)) {
cir.setReturnValue(false);
}
}
}