Skip to content

Commit c906f55

Browse files
committed
Fix client physics being sluggish when opening first world
1 parent aeab54f commit c906f55

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/main/java/org/embeddedt/archaicfix/asm/Mixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public enum Mixin implements IMixins {
6464
"core.MixinGuiIngameForge",
6565
"core.MixinFMLClientHandler",
6666
"core.MixinSplashProgress",
67-
"core.AccessorSplashProgress")),
67+
"core.AccessorSplashProgress",
68+
"core.MixinTimer")),
6869
RECIPE_CACHING(new ArchaicBuilder()
6970
.setPhase(Phase.EARLY)
7071
.setApplyIf(() -> ArchaicConfig.cacheRecipes)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.embeddedt.archaicfix.mixins.client.core;
2+
3+
import net.minecraft.util.Timer;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.Shadow;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
9+
10+
@Mixin(Timer.class)
11+
public class MixinTimer {
12+
@Shadow
13+
private double timeSyncAdjustment;
14+
15+
@Shadow
16+
private long field_74285_i;
17+
18+
/**
19+
* @author embeddedt
20+
* @reason Disable vanilla's broken mechanism for trying to coordinate two clocks and just use the result of
21+
* System.nanoTime() as is. This fixes the client sometimes feeling very sluggish when opening a world.
22+
*/
23+
@Inject(method = "updateTimer", at = @At("HEAD"))
24+
private void disableTimeSyncAdjustment(CallbackInfo ci) {
25+
this.timeSyncAdjustment = 1.0D;
26+
this.field_74285_i = 0L;
27+
}
28+
}

0 commit comments

Comments
 (0)