mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
修复客户端protocol version
This commit is contained in:
@@ -47,7 +47,7 @@ public final class MBuiltInRegistries {
|
|||||||
registries$EntityType = field.get(null);
|
registries$EntityType = field.get(null);
|
||||||
} else if (rawType == CoreReflections.clazz$RecipeType) {
|
} else if (rawType == CoreReflections.clazz$RecipeType) {
|
||||||
registries$RecipeType = field.get(null);
|
registries$RecipeType = field.get(null);
|
||||||
} else if (rawType == CoreReflections.clazz$DataComponentType) {
|
} else if (rawType == CoreReflections.clazz$DataComponentType && registries$DataComponentType == null) {
|
||||||
registries$DataComponentType = field.get(null);
|
registries$DataComponentType = field.get(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -65,34 +65,6 @@ public class BlockStateUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Object> getAllBlockStates(String blockState) {
|
|
||||||
int index = blockState.indexOf('[');
|
|
||||||
if (index == -1) {
|
|
||||||
return getAllBlockStates(Key.of(blockState));
|
|
||||||
} else {
|
|
||||||
String blockTypeString = blockState.substring(0, index);
|
|
||||||
Key block = Key.of(blockTypeString);
|
|
||||||
Optional<CustomBlock> optionalCustomBlock = BukkitBlockManager.instance().blockById(block);
|
|
||||||
if (optionalCustomBlock.isPresent()) {
|
|
||||||
ImmutableBlockState state = BlockStateParser.deserialize(blockState);
|
|
||||||
if (state == null) {
|
|
||||||
return List.of();
|
|
||||||
} else {
|
|
||||||
return List.of(state.customBlockState().handle());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
BlockData blockData = Bukkit.createBlockData(blockState);
|
|
||||||
return List.of(blockDataToBlockState(blockData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Object> getAllBlockStates(Key block) {
|
|
||||||
Optional<CustomBlock> optionalCustomBlock = BukkitBlockManager.instance().blockById(block);
|
|
||||||
return optionalCustomBlock.map(customBlock -> customBlock.variantProvider().states().stream().map(it -> it.customBlockState().handle()).toList())
|
|
||||||
.orElseGet(() -> getAllVanillaBlockStates(block));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static List<Object> getAllVanillaBlockStates(Key block) {
|
public static List<Object> getAllVanillaBlockStates(Key block) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ public enum ProtocolVersion {
|
|||||||
V1_21_2(768, "1.21.2"),
|
V1_21_2(768, "1.21.2"),
|
||||||
V1_21_3(768, "1.21.3"),
|
V1_21_3(768, "1.21.3"),
|
||||||
V1_21_4(769, "1.21.4"),
|
V1_21_4(769, "1.21.4"),
|
||||||
V1_21_5(770, "1.21.5");
|
V1_21_5(770, "1.21.5"),
|
||||||
|
V1_21_6(771, "1.21.6");
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|||||||
Reference in New Issue
Block a user