Merge branch 'stable' into develop

This commit is contained in:
Jonas Herzig
2020-09-27 18:45:05 +02:00
18 changed files with 129 additions and 40 deletions

View File

@@ -729,10 +729,12 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
final PlayerPositionLookS2CPacket ppl = (PlayerPositionLookS2CPacket) p;
if(!hasWorldLoaded) hasWorldLoaded = true;
if (mc.currentScreen instanceof DownloadingTerrainScreen) {
// Close the world loading screen manually in case we swallow the packet
mc.openScreen(null);
}
ReplayMod.instance.runLater(() -> {
if (mc.currentScreen instanceof DownloadingTerrainScreen) {
// Close the world loading screen manually in case we swallow the packet
mc.openScreen(null);
}
});
if(replayHandler.shouldSuppressCameraMovements()) return null;

View File

@@ -519,10 +519,6 @@ public class ReplayHandler {
return spectating;
}
public void setTargetPosition(Location pos) {
targetCameraPosition = pos;
}
public void moveCameraToTargetPosition() {
CameraEntity cam = getCameraEntity();
if (cam != null && targetCameraPosition != null) {
@@ -592,7 +588,7 @@ public class ReplayHandler {
}
}
long diff = targetTime - replaySender.getDesiredTimestamp();
long diff = targetTime - (replaySender.isHurrying() ? replaySender.getDesiredTimestamp() : replaySender.currentTimeStamp());
if (diff != 0) {
if (diff > 0 && diff < 5000) { // Small difference and no time travel
replaySender.jumpToTime(targetTime);

View File

@@ -74,11 +74,13 @@ import net.minecraft.util.Hand;
//#if MC>=10800
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.entity.PlayerModelPart;
//#else
//$$ import net.minecraft.client.entity.EntityClientPlayerMP;
//$$ import net.minecraft.util.Session;
//#endif
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.UUID;
import java.util.function.Function;
@@ -98,6 +100,8 @@ public class CameraEntity
//$$ extends EntityClientPlayerMP
//#endif
{
private static final UUID CAMERA_UUID = UUID.nameUUIDFromBytes("ReplayModCamera".getBytes(StandardCharsets.UTF_8));
/**
* Roll of this camera in degrees.
*/
@@ -154,6 +158,11 @@ public class CameraEntity
, false
//#endif
);
//#if MC>=10900
setUuid(CAMERA_UUID);
//#else
//$$ entityUniqueID = CAMERA_UUID;
//#endif
eventHandler.register();
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {
cameraController = ReplayModReplay.instance.createCameraController(this);
@@ -423,6 +432,15 @@ public class CameraEntity
}
return super.getModel();
}
@Override
public boolean isPartVisible(PlayerModelPart modelPart) {
Entity view = getRenderViewEntity(this.client);
if (view != this && view instanceof PlayerEntity) {
return ((PlayerEntity) view).isPartVisible(modelPart);
}
return super.isPartVisible(modelPart);
}
//#endif
@Override

View File

@@ -4,6 +4,7 @@ import com.replaymod.core.ReplayMod;
import com.replaymod.core.versions.MCVer.Keyboard;
import com.replaymod.replay.ReplayHandler;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.camera.CameraEntity;
import com.replaymod.replaystudio.data.Marker;
import com.replaymod.replaystudio.util.Location;
import de.johni0702.minecraft.gui.GuiRenderer;
@@ -168,11 +169,14 @@ public class GuiMarkerTimeline extends AbstractGuiTimeline<GuiMarkerTimeline> im
} else if (button == 1) { // Right click
selectedMarker = null;
if (replayHandler != null) {
replayHandler.setTargetPosition(new Location(
marker.getX(), marker.getY(), marker.getZ(),
marker.getPitch(), marker.getYaw()
));
replayHandler.doJump(marker.getTime(), false);
CameraEntity cameraEntity = replayHandler.getCameraEntity();
if (cameraEntity != null) {
cameraEntity.setCameraPosRot(new Location(
marker.getX(), marker.getY(), marker.getZ(),
marker.getYaw(), marker.getPitch()
));
}
replayHandler.doJump(marker.getTime(), true);
} else {
setCursorPosition(marker.getTime());
}

View File

@@ -0,0 +1,20 @@
//#if MC>=11600
package com.replaymod.replay.mixin;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(TitleScreen.class)
public abstract class Mixin_MoveRealmsButton {
@ModifyArg(
method = "init",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;init(Lnet/minecraft/client/MinecraftClient;II)V"),
index = 2
)
private int adjustRealmsButton(int height) {
return height - 24 * 4;
}
}
//#endif