smooth low tps

This commit is contained in:
gnembon committed 2019-07-09 09:28:54 -03:00
1 parent 21bfdd3424
commit da063aacb4
3 files changed
+27

No files matched your search

@@ -0,0 +1,23 @@
package carpet.mixins;
import carpet.helpers.TickSpeed;
import carpet.settings.CarpetSettings;
import net.minecraft.client.render.RenderTickCounter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RenderTickCounter.class)
public class RenderTickCounter_tickSpeedMixin {
@Redirect(method = "beginRenderTick", at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/render/RenderTickCounter;timeScale:F"
))
private float adjustTickSpeed(RenderTickCounter counter) {
if (CarpetSettings.smoothClientAnimations)
{
return Math.max(50.0f, TickSpeed.mspt);
}
return 50f;
}
}
@@ -223,6 +223,9 @@ public class CarpetSettings
@Rule(desc = "fill/clone/setblock and structure blocks cause block updates", category = CREATIVE)
public static boolean fillUpdates = true;
@Rule(desc = "smooth client animations with low tps settings", extra = "works only in SP, and will slow down players", category = CREATIVE)
public static boolean smoothClientAnimations;
private static class PushLimitLimits extends Validator<Integer> {
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
return (newValue>0 && newValue <= 1024) ? newValue : null;