API Surface (4) boolean isCompatible()
PackCompatibility forVersion(final InclusiveRange<PackFormat> packDeclaredVersions, final PackFormat gameSupportedVersion)
Component getDescription()
Component getConfirmation()
Fields & Constants (3) UNKNOWN_VERSION
description
confirmation
String literals (4) "unknown"
"compatible"
"pack.incompatible."
"pack.incompatible.confirm."
Code Graph: Dependencies (4) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
PackCompatibility.java 45 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.server.packs.repository;
2
3 import net.minecraft.ChatFormatting;
4 import net.minecraft.network.chat.Component;
5 import net.minecraft.server.packs.metadata.pack.PackFormat;
6 import net.minecraft.util.InclusiveRange;
7
8 public enum PackCompatibility {
9 TOO_OLD("old"),
10 TOO_NEW("new"),
11 UNKNOWN("unknown"),
12 COMPATIBLE("compatible");
13
14 public static final int UNKNOWN_VERSION = Integer.MAX_VALUE;
15 private final Component description;
16 private final Component confirmation;
17
18 PackCompatibility(final String key) {
19 this.description = Component.translatable("pack.incompatible." + key).withStyle(ChatFormatting.GRAY);
20 this.confirmation = Component.translatable("pack.incompatible.confirm." + key);
21 }
22
23 public boolean isCompatible() {
24 return this == COMPATIBLE;
25 }
26
27 public static PackCompatibility forVersion(final InclusiveRange<PackFormat> packDeclaredVersions, final PackFormat gameSupportedVersion) {
28 if (packDeclaredVersions.minInclusive().major() == Integer.MAX_VALUE) {
29 return UNKNOWN;
30 } else if (packDeclaredVersions.maxInclusive().compareTo(gameSupportedVersion) < 0) {
31 return TOO_OLD;
32 } else {
33 return gameSupportedVersion.compareTo(packDeclaredVersions.minInclusive()) < 0 ? TOO_NEW : COMPATIBLE;
34 }
35 }
36
37 public Component getDescription() {
38 return this.description;
39 }
40
41 public Component getConfirmation() {
42 return this.confirmation;
43 }
44 }
45
Decompiled Minecraft 26.3 source of PackCompatibility (net/minecraft/server/packs/repository/PackCompatibility.java) with Mojang official mappings, stored verbatim on the site.