generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/one/oktw/mixin/hack/ServerLoginNetworkHandler_EarlySendPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package one.oktw.mixin.hack; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; | ||
import net.fabricmc.fabric.impl.networking.server.ServerLoginNetworkHandlerExtensions; | ||
import net.minecraft.network.ClientConnection; | ||
import net.minecraft.network.packet.c2s.login.LoginHelloC2SPacket; | ||
import net.minecraft.server.network.ServerLoginNetworkHandler; | ||
import one.oktw.VelocityLib; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ServerLoginNetworkHandler.class) | ||
public class ServerLoginNetworkHandler_EarlySendPacket { | ||
@Shadow | ||
@Final | ||
public ClientConnection connection; | ||
|
||
@Inject(method = "onHello", at = @At(value = "HEAD"), cancellable = true) | ||
private void skipKeyPacket(LoginHelloC2SPacket packet, CallbackInfo ci) { | ||
if (packet.getProfile().isComplete()) return; // Already receive profile form velocity. | ||
|
||
((ServerLoginNetworkHandlerExtensions) this).getAddon().sendPacket(VelocityLib.PLAYER_INFO_CHANNEL, PacketByteBufs.empty()); | ||
ci.cancel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters