-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call Mojang's code instead of copying it
- Loading branch information
Showing
4 changed files
with
37 additions
and
28 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
20 changes: 20 additions & 0 deletions
20
src/main/java/io/github/gaming32/worldhost/mixin/MixinServerConnectionListener_1.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,20 @@ | ||
package io.github.gaming32.worldhost.mixin; | ||
|
||
import io.github.gaming32.worldhost.WorldHost; | ||
import io.netty.channel.Channel; | ||
import io.netty.channel.ChannelInitializer; | ||
import net.minecraft.server.network.ServerConnectionListener; | ||
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(targets = "net.minecraft.server.network.ServerConnectionListener$1") | ||
public abstract class MixinServerConnectionListener_1 extends ChannelInitializer<Channel> { | ||
@Inject(method = "<init>", at = @At("TAIL")) | ||
private void storeClass(ServerConnectionListener this$0, CallbackInfo ci) throws NoSuchMethodException { | ||
if (WorldHost.channelInitializerConstructor == null) { | ||
WorldHost.channelInitializerConstructor = getClass().getDeclaredConstructor(ServerConnectionListener.class); | ||
} | ||
} | ||
} |
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