Spaces:
Build error
Build error
File size: 1,493 Bytes
d46f4a3 |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
package net.minecraft.world;
import java.util.function.IntFunction;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.util.ByIdMap;
import net.minecraft.util.StringRepresentable;
public enum Difficulty implements StringRepresentable {
PEACEFUL(0, "peaceful"),
EASY(1, "easy"),
NORMAL(2, "normal"),
HARD(3, "hard");
public static final StringRepresentable.EnumCodec<Difficulty> CODEC = StringRepresentable.fromEnum(Difficulty::values);
private static final IntFunction<Difficulty> BY_ID = ByIdMap.continuous(Difficulty::getId, values(), ByIdMap.OutOfBoundsStrategy.WRAP);
private final int id;
private final String key;
private Difficulty(final int p_19026_, final String p_19027_) {
this.id = p_19026_;
this.key = p_19027_;
}
public int getId() {
return this.id;
}
public Component getDisplayName() {
return Component.translatable("options.difficulty." + this.key);
}
public Component getInfo() {
return Component.translatable("options.difficulty." + this.key + ".info");
}
public static Difficulty byId(int p_19030_) {
return BY_ID.apply(p_19030_);
}
@Nullable
public static Difficulty byName(String p_19032_) {
return CODEC.byName(p_19032_);
}
public String getKey() {
return this.key;
}
@Override
public String getSerializedName() {
return this.key;
}
} |