mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 14:38:50 +00:00
Improve World Border lerping and rendering
This commit is contained in:
1 parent
428acbb699
commit
33d821e294
9 files changed
+148
-19
No files matched your search
@@ -18,6 +18,7 @@ import com.moulberry.flashback.packet.FlashbackRemoteExperience;
|
||||
import com.moulberry.flashback.packet.FlashbackRemoteFoodData;
|
||||
import com.moulberry.flashback.packet.FlashbackRemoteSelectHotbarSlot;
|
||||
import com.moulberry.flashback.packet.FlashbackRemoteSetSlot;
|
||||
import com.moulberry.flashback.packet.FlashbackSetBorderLerpStartTime;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateManager;
|
||||
import com.moulberry.flashback.ext.MinecraftExt;
|
||||
@@ -309,6 +310,18 @@ public class ReplayServer extends IntegratedServer {
|
||||
super.sendAllPlayerInfo(serverPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcastAll(Packet<?> packet) {
|
||||
if (packet instanceof ClientboundSetBorderLerpSizePacket) {
|
||||
long time = ReplayServer.this.currentTick * 50L;
|
||||
for (ReplayPlayer replayViewer : replayViewers) {
|
||||
ServerPlayNetworking.send(replayViewer, new FlashbackSetBorderLerpStartTime(time));
|
||||
}
|
||||
}
|
||||
|
||||
super.broadcastAll(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast(@Nullable Player player, double x, double y, double z, double distance, ResourceKey<Level> resourceKey, Packet<?> packet) {
|
||||
UUID audioSourceEntity = null;
|
||||
@@ -451,18 +464,6 @@ public class ReplayServer extends IntegratedServer {
|
||||
}
|
||||
}
|
||||
|
||||
public float getPartialServerTick() {
|
||||
if (this.replayPaused || this.isPaused()) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
long currentNanos = Util.getNanos();
|
||||
long nanosPerTick = this.tickRateManager().nanosecondsPerTick();
|
||||
|
||||
double partial = (currentNanos - this.lastTickTimeNanos) / (double) nanosPerTick;
|
||||
return Math.max(0, Math.min(1, (float) partial));
|
||||
}
|
||||
}
|
||||
|
||||
public int getTotalReplayTicks() {
|
||||
return this.totalTicks;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user