forked from ReplayMod/ReplayMod
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89057d3
commit 4855f37
Showing
9 changed files
with
149 additions
and
107 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
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
27 changes: 27 additions & 0 deletions
27
versions/1.16.4-forge/src/main/java/com/replaymod/mixin/MixinFMLHandshakeHandler.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 |
---|---|---|
@@ -1,14 +1,41 @@ | ||
package com.replaymod.mixin; | ||
|
||
import io.netty.channel.ChannelPipeline; | ||
import net.minecraft.network.NetworkManager; | ||
import net.minecraft.util.text.ITextComponent; | ||
import net.minecraftforge.fml.network.FMLHandshakeHandler; | ||
import net.minecraftforge.fml.network.NetworkDirection; | ||
import net.minecraftforge.fml.network.NetworkRegistry; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.MixinEnvironment; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(FMLHandshakeHandler.class) | ||
public abstract class MixinFMLHandshakeHandler { | ||
@Shadow | ||
private List<NetworkRegistry.LoginPayload> messageList; | ||
|
||
@Shadow @Final | ||
private NetworkDirection direction; | ||
|
||
@Inject(method = "<init>(Lnet/minecraft/network/NetworkManager;Lnet/minecraftforge/fml/network/NetworkDirection;)V", at = @At("TAIL")) | ||
public void replayModRecording_setupForLocalRecording(NetworkManager networkManager, NetworkDirection side, CallbackInfo ci) { | ||
if (!networkManager.isLocalChannel()) { | ||
return; | ||
} | ||
|
||
System.out.println("Force FML handshaking and set LoginPayloads"); | ||
this.messageList = NetworkRegistryAccessor.invokeGatherLoginPayloads(this.direction, false); | ||
} | ||
|
||
@Redirect(method = "handleRegistryLoading", at=@At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;closeChannel(Lnet/minecraft/util/text/ITextComponent;)V")) | ||
public void replayMod_ignoreHandshakeConnectionClose(NetworkManager networkManager, ITextComponent message) {} | ||
} |
37 changes: 0 additions & 37 deletions
37
versions/1.16.4-forge/src/main/java/com/replaymod/mixin/MixinFMLPlayMessages.java
This file was deleted.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
versions/1.16.4-forge/src/main/java/com/replaymod/mixin/NetworkRegistryAccessor.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,16 @@ | ||
package com.replaymod.mixin; | ||
|
||
import net.minecraftforge.fml.network.NetworkDirection; | ||
import net.minecraftforge.fml.network.NetworkRegistry; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(NetworkRegistry.class) | ||
public interface NetworkRegistryAccessor { | ||
@Invoker("gatherLoginPayloads") | ||
static List<NetworkRegistry.LoginPayload> invokeGatherLoginPayloads(NetworkDirection direction, boolean isLocal) { | ||
throw new AssertionError(); | ||
} | ||
} |