summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableEntityTrackerEntrySpamming.java
blob: bf1f0b1dbf13dc63e22220563602bdd523b9cafd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.keuin.ohmyvanillamc.mixin;

import com.keuin.ohmyvanillamc.DummyLogger;
import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft;
import net.minecraft.server.network.EntityTrackerEntry;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(EntityTrackerEntry.class)
public class DisableEntityTrackerEntrySpamming {

    private static final Logger DUMMY_LOGGER = new DummyLogger();

    @Shadow
    @Final
    private static Logger LOGGER;

    @Accessor("LOGGER")
    private static Logger LOGGER() {
        return OhMyVanillaMinecraft.getConfiguration().isFixEntityTrackerEntrySpamming() ? DUMMY_LOGGER : LOGGER;
    }

}