mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 14:38:50 +00:00
0.4.0
This commit is contained in:
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)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user