mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
修复1.21.7资源包加载
This commit is contained in:
@@ -11,6 +11,8 @@ import net.momirealms.craftengine.core.world.BlockPos;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class Player extends AbstractEntity implements NetWorkUser {
|
||||
private static final Key TYPE = Key.of("minecraft:player");
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public interface NetWorkUser {
|
||||
boolean isOnline();
|
||||
@@ -61,7 +62,11 @@ public interface NetWorkUser {
|
||||
|
||||
void setProtocolVersion(int protocolVersion);
|
||||
|
||||
boolean sentResourcePack();
|
||||
void setServerSideRealPackUUID(UUID uuid);
|
||||
|
||||
void setSentResourcePack(boolean sentResourcePack);
|
||||
UUID getServerSideRealPackUUID();
|
||||
|
||||
boolean isResourcePackLoading(UUID uuid);
|
||||
|
||||
AtomicInteger remainingConfigurationStagePacks();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ public enum ProtocolVersion {
|
||||
V1_21_3(768, "1.21.3"),
|
||||
V1_21_4(769, "1.21.4"),
|
||||
V1_21_5(770, "1.21.5"),
|
||||
V1_21_6(771, "1.21.6");
|
||||
V1_21_6(771, "1.21.6"),
|
||||
V1_21_7(772, "1.21.7");
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
|
||||
@@ -20,6 +20,7 @@ public final class MinecraftVersion implements Comparable<MinecraftVersion> {
|
||||
PACK_FORMATS.put(1_21_04, 46);
|
||||
PACK_FORMATS.put(1_21_05, 55);
|
||||
PACK_FORMATS.put(1_21_06, 63);
|
||||
PACK_FORMATS.put(1_21_07, 64); // TODO 1.21.7-rc2
|
||||
PACK_FORMATS.put(1_99_99, 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,5 +17,6 @@ public final class MinecraftVersions {
|
||||
public static final MinecraftVersion V1_21_4 = new MinecraftVersion("1.21.4");
|
||||
public static final MinecraftVersion V1_21_5 = new MinecraftVersion("1.21.5");
|
||||
public static final MinecraftVersion V1_21_6 = new MinecraftVersion("1.21.6");
|
||||
public static final MinecraftVersion V1_21_7 = new MinecraftVersion("1.21.7");
|
||||
public static final MinecraftVersion FUTURE = new MinecraftVersion("1.99.99");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class VersionHelper {
|
||||
private static final boolean v1_21_4;
|
||||
private static final boolean v1_21_5;
|
||||
private static final boolean v1_21_6;
|
||||
private static final boolean v1_21_7;
|
||||
|
||||
static {
|
||||
try (InputStream inputStream = Class.forName("net.minecraft.obfuscate.DontObfuscate").getResourceAsStream("/version.json")) {
|
||||
@@ -36,7 +37,7 @@ public class VersionHelper {
|
||||
throw new IOException("Failed to load version.json");
|
||||
}
|
||||
JsonObject json = GsonHelper.parseJsonToJsonObject(new String(inputStream.readAllBytes(), StandardCharsets.UTF_8));
|
||||
String versionString = json.getAsJsonPrimitive("id").getAsString();
|
||||
String versionString = json.getAsJsonPrimitive("id").getAsString().split("-", 2)[0];
|
||||
|
||||
MINECRAFT_VERSION = new MinecraftVersion(versionString);
|
||||
|
||||
@@ -44,8 +45,8 @@ public class VersionHelper {
|
||||
int major = Integer.parseInt(split[1]);
|
||||
int minor = split.length == 3 ? Integer.parseInt(split[2].split("-", 2)[0]) : 0;
|
||||
|
||||
// 2001 = 1.20.1
|
||||
// 2104 = 1.21.4
|
||||
// 12001 = 1.20.1
|
||||
// 12104 = 1.21.4
|
||||
version = parseVersionToInteger(versionString);
|
||||
|
||||
v1_20 = version >= 12000;
|
||||
@@ -62,6 +63,7 @@ public class VersionHelper {
|
||||
v1_21_4 = version >= 12104;
|
||||
v1_21_5 = version >= 12105;
|
||||
v1_21_6 = version >= 12106;
|
||||
v1_21_7 = version >= 12107;
|
||||
|
||||
majorVersion = major;
|
||||
minorVersion = minor;
|
||||
@@ -209,4 +211,8 @@ public class VersionHelper {
|
||||
public static boolean isOrAbove1_21_6() {
|
||||
return v1_21_6;
|
||||
}
|
||||
|
||||
public static boolean isOrAbove1_21_7() {
|
||||
return v1_21_7;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user