The fake player now has the same entity id as the recording player as assigned by the server

This fixes arrows bumping into recording player in replay
ReplaySender converts old replays on the fly
Do not insert PlayerListEntry as it's already contained in the replay
This commit is contained in:
johni0702
2015-08-18 10:39:42 +02:00
parent d687748629
commit d1e55266e2
5 changed files with 129 additions and 73 deletions

View File

@@ -0,0 +1,28 @@
package eu.crushedpixel.replaymod.mixin;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.network.play.server.S01PacketJoinGame;
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(NetHandlerPlayClient.class)
public abstract class MixinNetHandlerPlayClient {
/**
* Record the own player entity joining the world.
* We cannot use the {@link net.minecraftforge.event.entity.EntityJoinWorldEvent} because the entity id
* of the player is set afterwards.
* @param packet The packet
* @param ci Callback info
*/
@Inject(method = "handleJoinGame", at=@At("RETURN"))
public void recordJoinGame(S01PacketJoinGame packet, CallbackInfo ci) {
if (ConnectionEventHandler.isRecording()) {
ReplayMod.recordingHandler.onPlayerJoin();
}
}
}