39 lines
1.0 KiB
Java
39 lines
1.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.serialization.Codec
|
|
*/
|
|
package net.minecraft.client;
|
|
|
|
import com.mojang.serialization.Codec;
|
|
import java.util.function.IntFunction;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.util.ByIdMap;
|
|
|
|
public enum AttackIndicatorStatus {
|
|
OFF(0, "options.off"),
|
|
CROSSHAIR(1, "options.attack.crosshair"),
|
|
HOTBAR(2, "options.attack.hotbar");
|
|
|
|
private static final IntFunction<AttackIndicatorStatus> BY_ID;
|
|
public static final Codec<AttackIndicatorStatus> LEGACY_CODEC;
|
|
private final int id;
|
|
private final Component caption;
|
|
|
|
private AttackIndicatorStatus(int id, String key) {
|
|
this.id = id;
|
|
this.caption = Component.translatable(key);
|
|
}
|
|
|
|
public Component caption() {
|
|
return this.caption;
|
|
}
|
|
|
|
static {
|
|
BY_ID = ByIdMap.continuous(s -> s.id, AttackIndicatorStatus.values(), ByIdMap.OutOfBoundsStrategy.WRAP);
|
|
LEGACY_CODEC = Codec.INT.xmap(BY_ID::apply, s -> s.id);
|
|
}
|
|
}
|
|
|