/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  net.minecraft.class_2487
 *  net.minecraft.class_2520
 *  net.minecraft.class_437
 */
package meteordevelopment.meteorclient.systems.modules.render.marker;

import meteordevelopment.meteorclient.events.render.Render3DEvent;
import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.screens.MarkerScreen;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.EnumSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.settings.Settings;
import meteordevelopment.meteorclient.settings.StringSetting;
import meteordevelopment.meteorclient.utils.misc.ISerializable;
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
import meteordevelopment.meteorclient.utils.world.Dimension;
import net.minecraft.class_2487;
import net.minecraft.class_2520;
import net.minecraft.class_437;

public abstract class BaseMarker
implements ISerializable<BaseMarker> {
    public final Settings settings = new Settings();
    protected final SettingGroup sgBase = this.settings.createGroup("Base");
    public final Setting<String> name = this.sgBase.add(((StringSetting.Builder)((StringSetting.Builder)new StringSetting.Builder().name("name")).description("Custom name for this marker.")).build());
    protected final Setting<String> description = this.sgBase.add(((StringSetting.Builder)((StringSetting.Builder)new StringSetting.Builder().name("description")).description("Custom description for this marker.")).build());
    private final Setting<Dimension> dimension = this.sgBase.add(((EnumSetting.Builder)((EnumSetting.Builder)((EnumSetting.Builder)new EnumSetting.Builder().name("dimension")).description("In which dimension this marker should be visible.")).defaultValue(Dimension.Overworld)).build());
    private final Setting<Boolean> active = this.sgBase.add(((BoolSetting.Builder)((BoolSetting.Builder)((BoolSetting.Builder)new BoolSetting.Builder().name("active")).description("Is this marker visible.")).defaultValue(false)).build());

    public BaseMarker(String name) {
        this.name.set(name);
        this.dimension.set(PlayerUtils.getDimension());
    }

    protected void render(Render3DEvent event) {
    }

    protected void tick() {
    }

    public class_437 getScreen(GuiTheme theme) {
        return new MarkerScreen(theme, this);
    }

    public WWidget getWidget(GuiTheme theme) {
        return null;
    }

    public String getName() {
        return this.name.get();
    }

    public String getTypeName() {
        return null;
    }

    public boolean isActive() {
        return this.active.get();
    }

    public boolean isVisible() {
        return this.isActive() && PlayerUtils.getDimension() == this.dimension.get();
    }

    public Dimension getDimension() {
        return this.dimension.get();
    }

    public void toggle() {
        this.active.set(this.active.get() == false);
    }

    @Override
    public class_2487 toTag() {
        class_2487 tag = new class_2487();
        tag.method_10566("settings", (class_2520)this.settings.toTag());
        return tag;
    }

    @Override
    public BaseMarker fromTag(class_2487 tag) {
        class_2487 settingsTag = (class_2487)tag.method_10580("settings");
        if (settingsTag != null) {
            this.settings.fromTag(settingsTag);
        }
        return this;
    }
}

