9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 02:49:15 +00:00

修复客户端protocol version

This commit is contained in:
XiaoMoMi
2025-06-28 00:45:48 +08:00
parent 01eb7f5e21
commit bd0244ceb8
3 changed files with 3 additions and 30 deletions

View File

@@ -47,7 +47,7 @@ public final class MBuiltInRegistries {
registries$EntityType = field.get(null);
} else if (rawType == CoreReflections.clazz$RecipeType) {
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);
}
} else {

View File

@@ -65,34 +65,6 @@ public class BlockStateUtils {
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")
public static List<Object> getAllVanillaBlockStates(Key block) {
try {