Merge branch '1.9.4' into 1.10.2
ca2bbcaMerge branch '1.8' into 1.9.45b3284fUpdate jGui and ReplayStudio (fixes #33)61d6fd4Close replay file zip after recording (fixes #32)00bcc9eFix paths of files that are supposed to be in the mc data dir (fixes #40)e6a789dFix camera rotation when jumping in time (fixes #39)50b53fcAdd a way to register key bindings triggered every render tick (fixes #31)a817c73Prevent GUIs of other mods from opening during replayd64ef8bHide NPCs in the Player Overview GUI (fixes #29)1f2c05eFix spectating player entities past death and respawn (fixes #36)ad2893bFix vanilla bug caused by unremovable entities in the entityList of ClientWorld (fixes #29)75c0e7bFix particles being visible after world change when jumping in time (fixes #35)c934cb9Fix spawn player packet being sent twice6efbf91Handle F1 properly while mouse is visible in the replay overlay (fixes #30)9add2afDeselect keyframe when pressing "V" aka. sync timelines (fixes #27)
This commit is contained in:
@@ -3,6 +3,7 @@ package com.replaymod.recording.mixin;
|
||||
import com.replaymod.recording.handler.RecordingEventHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.network.play.server.SPacketPlayerListItem;
|
||||
import net.minecraft.network.play.server.SPacketRespawn;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -11,12 +12,18 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(NetHandlerPlayClient.class)
|
||||
public abstract class MixinNetHandlerPlayClient {
|
||||
|
||||
@Shadow
|
||||
private Minecraft gameController;
|
||||
|
||||
@Shadow
|
||||
private Map<UUID, NetworkPlayerInfo> playerInfoMap;
|
||||
|
||||
public RecordingEventHandler getRecordingEventHandler() {
|
||||
return ((RecordingEventHandler.RecordingEventSender) gameController.renderGlobal).getRecordingEventHandler();
|
||||
}
|
||||
@@ -28,12 +35,17 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
* @param packet The packet
|
||||
* @param ci Callback info
|
||||
*/
|
||||
@Inject(method = "handlePlayerListItem", at=@At("RETURN"))
|
||||
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
||||
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
||||
if (gameController.thePlayer == null) return;
|
||||
|
||||
RecordingEventHandler handler = getRecordingEventHandler();
|
||||
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
||||
for (SPacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
||||
if (data.getProfile().getId().equals(gameController.thePlayer.getGameProfile().getId())) {
|
||||
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
||||
// Only add spawn packet for our own player and only if he isn't known yet
|
||||
if (data.getProfile().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
||||
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
||||
handler.onPlayerJoin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
synchronized (replayFile) {
|
||||
try {
|
||||
replayFile.save();
|
||||
replayFile.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("Saving replay file:", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user