This commit is contained in:
Moulberry committed 2024-09-01 18:08:55 +08:00
1 parent fcf1b4168f
commit 2fbe1f5480
46 files changed
+1846 -132

No files matched your search

@@ -0,0 +1,25 @@
package com.moulberry.flashback.action;
import com.moulberry.flashback.Flashback;
import com.moulberry.flashback.playback.ReplayServer;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
public class ActionAccuratePlayerPosition implements Action {
private static final ResourceLocation NAME = Flashback.createResourceLocation("action/accurate_player_position_optional");
public static final ActionAccuratePlayerPosition INSTANCE = new ActionAccuratePlayerPosition();
private ActionAccuratePlayerPosition() {
}
@Override
public ResourceLocation name() {
return NAME;
}
@Override
public void handle(ReplayServer replayServer, RegistryFriendlyByteBuf friendlyByteBuf) {
replayServer.handleAccuratePlayerPosition(friendlyByteBuf);
}
}
@@ -0,0 +1,16 @@
package com.moulberry.flashback.action;
import com.moulberry.flashback.record.Recorder;
import net.minecraft.util.Mth;
public record PositionAndAngle(double x, double y, double z, float yaw, float pitch) {
public PositionAndAngle lerp(PositionAndAngle other, double amount) {
return new PositionAndAngle(
this.x + (other.x - this.x) * amount,
this.y + (other.y - this.y) * amount,
this.z + (other.z - this.z) * amount,
(float) (this.yaw + Mth.wrapDegrees(other.yaw - this.yaw) * amount),
(float) (this.pitch + Mth.wrapDegrees(other.pitch - this.pitch) * amount)
);
}
}