Memeware 7.3 Ambiance module 1 files, 30 lines

Memeware 7.3 Ambiance: Full Source Analysis

A cosmetic day-cycle freezer. Two lwjeb handlers: a PacketInEvent consumer cancels every incoming S03PacketTimeUpdate, and an UpdateEvent consumer force-writes the client world's time to 0 (Morning)…

me/memewaredevs/client/module/render/Ambiance.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-10-14

Packets This Module Uses

Analysis

Overview

A cosmetic day-cycle freezer. Two lwjeb handlers: a PacketInEvent consumer cancels every incoming S03PacketTimeUpdate, and an UpdateEvent consumer force-writes the client world's time to 0 (Morning) or 20000 (Night). No serverbound packet is touched, so the server's own world clock and day cycle are completely unaffected.

Architecture

The module registers itself under the display name 'Ambience' with two modes, Morning and Night. The packet handler cancels S03PacketTimeUpdate on the way in, which is the entire interception: the vanilla client applies the server's world time from that packet (in WorldClient.setWorldTime via the S03 handler), and cancelling it leaves the client-side day counter frozen at whatever value it had. The update handler then pins the world clock to 0 or 20000 every tick through WorldInfo.setWorldTime, so even client-side time sources (the day counter advancing) cannot drift the display.

Why it is invisible

Time-of-day is a one-way server-to-client broadcast; the client never reports its world clock, so a server cannot tell what time the client thinks it is. Cancelling S03 only changes the client's rendering and gameplay ambience (lighting, sky color, mob spawning is server-side). The anticheat-visible surface is exactly zero packets. The closest real detectors are the timer/tick family, which measure the client's cadence of movement packets against the server's clock: the same 'time perception' axis, policed from the only direction a server can observe.

source Ambiance.java

Ambiance.java30 lines · JavaOriginal ↗
1
package me.memewaredevs.client.module.render;
2
3
import me.hippo.api.lwjeb.annotation.Handler;
4
import me.memewaredevs.client.event.events.PacketInEvent;
5
import me.memewaredevs.client.event.events.UpdateEvent;
6
import me.memewaredevs.client.module.Module;
7
import net.minecraft.network.play.server.S03PacketTimeUpdate;
8
9
import java.util.function.Consumer;
10
11
public class Ambiance extends Module {
12
13
	public Ambiance() {
14
		super("Ambience", 0, Module.Category.RENDER);
15
		this.addModes("Morning", "Night");
16
	}
17
18
	@Handler
19
	public Consumer<PacketInEvent> eventConsumer0 = (event) -> {
20
		if (event.getPacket() instanceof S03PacketTimeUpdate) {
21
			event.cancel();
22
		}
23
	};
24
25
	@Handler
26
	public Consumer<UpdateEvent> eventConsumer1 = (event) -> {
27
		mc.theWorld.getWorldInfo().setWorldTime(this.isMode("Morning") ? 0 : 20000);
28
	};
29
30
}

What this file does

The whole module is two consumers. eventConsumer0 cancels S03PacketTimeUpdate; note the cancel happens before the packet is dispatched to the vanilla handler, so the client never applies the server's time of day; eventConsumer1 runs once per UpdateEvent and writes the pinned value into the WorldInfo, overriding any residual drift. The mode string comparison (isMode("Morning") ? 0 : 20000) means anything other than Morning is Night, and the module has no state beyond that. There is no onEnable/onDisable override, so the packet cancel is armed whenever the module is toggled on and disarmed on toggle-off by Memeware's base event registration.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat TimerBalancer (client-tick ledger)

TimerBalancer.java64 lines · Java
1
package ai.idealistic.spartan.abstraction.data;
2
3
import ai.idealistic.spartan.abstraction.event.PlayerTickEvent;
4
import lombok.Getter;
5
import org.bukkit.GameMode;
6
7
@Getter
8
public class TimerBalancer {
9
10
    private long balancer, result;
11
    private int negative, forced, latency;
12
13
    public TimerBalancer() {
14
        balancer = 1000;
15
        result = 0;
16
        forced = 0;
17
        latency = 0;
18
    }
19
20
    public void pushDelay(PlayerTickEvent event) {
21
        GameMode gameMode = event.protocol.getGameMode();
22
23
        if (gameMode != GameMode.SURVIVAL
24
                && gameMode != GameMode.ADVENTURE) {
25
            balancer = 1000;
26
            result = 0;
27
            forced = 0;
28
            latency = 0;
29
            return;
30
        }
31
        long delay = event.getDelay();
32
        forced = ((delay > 15 && delay < 48) ? forced + 1 : 0);
33
        latency = ((delay > 40 && delay < 48) ? latency + 10 : latency / 2);
34
35
        if (delay > 50) {
36
            balancer += delay - 50;
37
            if (delay > 53) negative++;
38
        } else if (delay < 50) {
39
            final long deviance = 50 - delay;
40
41
            if (balancer - deviance >= 0) {
42
                balancer -= deviance;
43
            } else {
44
                final long totalDeviance = deviance - balancer;
45
                result += totalDeviance;
46
                balancer = 0;
47
            }
48
            negative = 0;
49
        } else if (result >= 0) {
50
            result /= 2L;
51
            balancer /= 2L;
52
            negative = 0;
53
        }
54
    }
55
56
    public boolean isNegativeTimer() {
57
        return this.negative > 15;
58
    }
59
60
    public void addBalance(long balance) {
61
        this.balancer += balance;
62
    }
63
64
}

How it counteracts this module

Spartan's per-player tick ledger. pushDelay is fed one PlayerTickEvent per server tick and balances each measured delay against the 50ms ideal: delays over 50 add their excess to the balance and count 'negative' ticks, delays under 50 draw from the balance, and when the balance cannot cover the deviance the shortfall accumulates into result. isNegativeTimer fires once more than 15 consecutive sub-50ms delays are seen, a client ticking faster than the server allows. Honest note: it measures the cadence of the player's ticks, which come from movement packets, never from the world clock; freezing the client's time-of-day changes none of that input, so this module cannot trip it. It is included as the closest real check on the time axis because it is the one check in the corpus that models the client's perception of time passing against a server-side ideal.

anticheat Timer (movement tick-rate, Type A)

Timer.java50 lines · Java
1
package us.skidrevenant.azure.check.checks.misc.timer;
2
3
import net.minecraft.server.v1_8_R3.Packet;
4
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
5
import net.minecraft.server.v1_8_R3.PacketPlayOutPosition;
6
import us.skidrevenant.azure.check.Check;
7
import us.skidrevenant.azure.stats.PlayerStats;
8
9
/**
10
 * @author SkidRevenant
11
 * at 28/05/2018
12
 */
13
public class Timer extends Check {
14
15
    private long lastFlying;
16
    private int threshold;
17
18
    public Timer(PlayerStats player) {
19
        super(player);
20
    }
21
22
    @Override
23
    public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {
24
        if (packet instanceof PacketPlayInFlying) {
25
            long now = System.currentTimeMillis();
26
27
            if (lastFlying + 47L > now) {
28
                double timerSpeed = 50.0 / (now - lastFlying);
29
30
                if (++threshold > 7) {
31
                    onViolation(String.format("Timer Type A (%d%s, %dL)", Math.min(Math.round(timerSpeed * 100), 5000), "%", (now - lastFlying)), 60000L, 3);
32
                }
33
34
            } else if (lastFlying + 70L < now) {
35
                threshold -= 3;
36
            } else if (threshold > 0) {
37
                threshold--;
38
            }
39
40
            lastFlying = now;
41
        }
42
    }
43
44
    @Override
45
    public void onPacketSend(Class<? extends Packet> type, Packet packet) {
46
        if (type == PacketPlayOutPosition.class) {
47
            threshold = -10;
48
        }
49
    }
50
}

How it counteracts this module

Azure's Type A timer: on every PacketPlayInFlying it measures the millisecond gap from the previous one. A gap under 47ms counts a fast tick; seven consecutive fast ticks raise the violation 'Timer Type A (X%, Nms)' with a 60-second cooldown. A gap over 70ms decays the threshold by 3, and a server teleport (PacketPlayOutPosition) slams the threshold to -10 to forgive teleport artifacts. Honest note: the check watches movement-packet cadence (the speed-hack axis), and the Ambiance module sends no packets at all, so the gap sequence it observes is untouched. It is the canonical real detector for clients that compress their perceived time (timer speed), the adjacent manipulation to freezing the world clock.

anticheat TimerB (averaged tick sample)

TimerB.java64 lines · Java
1
package us.skidrevenant.azure.check.checks.misc.timer;
2
3
import net.minecraft.server.v1_8_R3.Packet;
4
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
5
import net.minecraft.server.v1_8_R3.PacketPlayOutPosition;
6
import us.skidrevenant.azure.check.Check;
7
import us.skidrevenant.azure.stats.PlayerStats;
8
9
import java.util.Deque;
10
import java.util.LinkedList;
11
12
/**
13
 * @author SkidRevenant
14
 * at 04/06/2018
15
 */
16
public class TimerB extends Check {
17
18
    private long lastFlying;
19
    private final Deque<Double> timerSpeedDeque = new LinkedList<>();
20
21
    public TimerB(PlayerStats player) {
22
        super(player);
23
    }
24
25
    @Override
26
    public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {
27
        if (packet instanceof PacketPlayInFlying) {
28
            long now = System.currentTimeMillis();
29
30
            if (lastFlying + 50L > System.currentTimeMillis()) {
31
                return;
32
            }
33
34
            double timerSpeed = 50.0 / (now - lastFlying);
35
36
            timerSpeedDeque.addLast(timerSpeed);
37
38
            if (timerSpeedDeque.size() == 20) {
39
40
                double averageTimerSpeed = timerSpeedDeque.stream()
41
                        .mapToDouble(Double::doubleValue)
42
                        .average()
43
                        .orElse(0);
44
45
                if (averageTimerSpeed < 0.6) {
46
                    onViolation(String.format("Timer Type B (%s)", averageTimerSpeed), 60000L, 1);
47
                }
48
49
                timerSpeedDeque.clear();
50
            }
51
52
            lastFlying = now;
53
        }
54
    }
55
56
    @Override
57
    public void onPacketSend(Class<? extends Packet> type, Packet packet) {
58
        if (type == PacketPlayOutPosition.class) {
59
            if (timerSpeedDeque.size() > 0) {
60
                timerSpeedDeque.removeLast();
61
            }
62
        }
63
    }
64
}

How it counteracts this module

Azure's Type B timer is the averaging variant: it ignores gaps under 50ms, computes timerSpeed = 50/delta per movement packet, and accumulates a 20-sample deque. When the deque fills, the average is compared against 0.6: an average below 0.6 means the client's movement cadence is meaningfully faster than real time over the sample window, and the violation 'Timer Type B (average)' fires with the same 60s cooldown. Teleports remove the last sample instead of poisoning the average. Honest note: same framing as Type A: the input is purely serverbound movement timing, so a module that only cancels an inbound S03 and rewrites a client-side long has no observable effect on it; it is the closest real check class to the module's 'time' feature, not a detector for it.

anticheat Timer (transaction-anchored clock)

Timer.java113 lines · Java
1
package ac.grim.grimac.checks.impl.timer;
2
3
import ac.grim.grimac.api.config.ConfigManager;
4
import ac.grim.grimac.checks.Check;
5
import ac.grim.grimac.checks.CheckData;
6
import ac.grim.grimac.checks.type.PrePredictionPacketReceiveListener;
7
import ac.grim.grimac.player.GrimPlayer;
8
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
9
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
10
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
11
import org.jetbrains.annotations.NotNull;
12
13
@CheckData(name = "Timer", stableKey = "grim.timer.timer", configName = "TimerA", description = "The players game is running faster than normal", setback = 10)
14
public class Timer extends Check implements PrePredictionPacketReceiveListener {
15
    protected long timerBalanceRealTime = 0;
16
17
    // Default value is real time minus max keep-alive time
18
    protected long knownPlayerClockTime = (long) (System.nanoTime() - 6e10);
19
    protected long lastMovementPlayerClock = (long) (System.nanoTime() - 6e10);
20
21
    // How long should the player be able to fall back behind their ping? (nanos)
22
    // Default: 120 milliseconds
23
    protected long clockDrift;
24
25
    protected boolean hasGottenMovementAfterTransaction = false;
26
27
    // Proof for this timer check
28
    // https://i.imgur.com/Hk2Wb6c.png
29
    //
30
    // The largest gap will always be the transaction ping (server -> client -> server)
31
    // Proof lies that client -> server ping will always be lower
32
    //
33
    // The largest gap is the floor for movements
34
    // If the smaller gap surpasses the larger gap, the player is cheating
35
    //
36
    // This usually flags 1.01 on low ping extremely quickly
37
    // Higher ping/low fps scales proportionately, and will flag less quickly but will still always flag 1.01
38
    // Players standing still will reset this amount of time
39
    //
40
    // This is better than traditional timer checks because ping fluctuations will never affect this check
41
    // As we are tying this check to the player's ping, rather than real time.
42
    //
43
    // Tested 10/20/30 fps and f3 + t spamming for lag spikes at 0 ping localhost/200 ping clumsy, no falses
44
    // Also didn't false when going from 0 -> 2000 ms ping, and 2000 ms -> 0 ms ping
45
    // it's a very nice check, in my opinion.  I guess I will find out if netty lag can false it
46
47
    // You might notice that we deviate a bit from this to handle lag
48
    // We take the FIRST transaction after each movement, to avoid issues with this packet order at low FPS:
49
    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT
50
    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT
51
    //
52
    // We then take the last transaction before this to increase stability with these lag spikes and
53
    // to guarantee that we are at least 50 ms back before adding the time
54
    public Timer(GrimPlayer player) {
55
        super(player);
56
    }
57
58
    @Override
59
    public void onPrePredictionPacketReceive(final PacketReceiveEvent event) {
60
        if (hasGottenMovementAfterTransaction && checkForTransaction(event.getPacketType())) {
61
            knownPlayerClockTime = lastMovementPlayerClock;
62
            lastMovementPlayerClock = player.getPlayerClockAtLeast();
63
            hasGottenMovementAfterTransaction = false;
64
        }
65
66
        if (!shouldCountPacketForTimer(event.getPacketType())) return;
67
68
        hasGottenMovementAfterTransaction = true;
69
        timerBalanceRealTime += 50e6;
70
71
        doCheck(event);
72
    }
73
74
    public void doCheck(final PacketReceiveEvent event) {
75
        if (timerBalanceRealTime > System.nanoTime()) {
76
            if (flag()) {
77
                // Cancel the packet
78
                if (shouldModifyPackets()) {
79
                    event.setCancelled(true);
80
                    player.onPacketCancel();
81
                }
82
83
                if (shouldSetback()) {
84
                    player.getSetbackTeleportUtil().executeNonSimulatingSetback();
85
                }
86
            }
87
88
            // Reset the violation by 1 movement
89
            timerBalanceRealTime -= 50e6;
90
        }
91
92
        limitFallBehind();
93
    }
94
95
    protected void limitFallBehind() {
96
        timerBalanceRealTime = Math.max(timerBalanceRealTime, lastMovementPlayerClock - clockDrift);
97
    }
98
99
    public boolean checkForTransaction(PacketTypeCommon packetType) {
100
        return packetType == PacketType.Play.Client.PONG ||
101
                packetType == PacketType.Play.Client.WINDOW_CONFIRMATION;
102
    }
103
104
    public boolean shouldCountPacketForTimer(PacketTypeCommon packetType) {
105
        // If not flying, or this was a teleport, or this was a duplicate 1.17 mojang stupidity packet
106
        return isTickPacket(packetType);
107
    }
108
109
    @Override
110
    public void onReload(@NotNull ConfigManager config) {
111
        clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 120.0) * 1e6);
112
    }
113
}

How it counteracts this module

Grim's timer is anchored to the player's own ping instead of wall time: the check records the client's movement clock (via transaction/PONG round trips) and compares it against the server's real-time balance. timerBalanceRealTime accrues 50ms per counted movement packet, and whenever that balance overtakes System.nanoTime() the player is moving faster than the server's clock allows, flagging, cancelling the packet, and setbackting. Because the reference is the transaction-measured ping floor rather than wall time, ping fluctuation cannot false it. Honest note: it never inspects the S03 stream; its only inputs are movement and transaction packets. The Ambiance module produces neither, so it is invisible to Grim's timer. It is included here as the most precise real-world check of the 'does the client's time match the server's' question, which is the only server-observable side of the time axis this module touches cosmetically.

← Back to Analysis Hub