9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

Merge pull request #138 from jhqwqmc/dev

fix(core): 修复字体
This commit is contained in:
XiaoMoMi
2025-04-25 23:56:48 +08:00
committed by GitHub
2 changed files with 27 additions and 0 deletions

View File

@@ -492,6 +492,10 @@ public abstract class AbstractFontManager implements FontManager {
return;
}
}
if (codepoints.length == 0) {
TranslationManager.instance().log("warning.config.image.lack_char", path.toString(), id.toString());
return;
}
codepointGrid[i] = codepoints;
if (size == -1) size = codepoints.length;
if (size != codepoints.length) {

View File

@@ -101,6 +101,29 @@ public class FriendlyByteBuf extends ByteBuf {
idList.forEach(this::writeVarInt);
}
public List<byte[]> readByteArrayList() {
int listSize = this.readVarInt();
List<byte[]> bytes = new ArrayList<>();
for (int i = 0; i < listSize; ++i) {
bytes.add(this.readByteArray());
}
return bytes;
}
public List<byte[]> readByteArrayList(int maxSize) {
int listSize = this.readVarInt();
List<byte[]> bytes = new ArrayList<>();
for (int i = 0; i < listSize; ++i) {
bytes.add(this.readByteArray(maxSize));
}
return bytes;
}
public void writeByteArrayList(List<byte[]> bytes) {
this.writeVarInt(bytes.size());
bytes.forEach(this::writeByteArray);
}
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> mapFactory, FriendlyByteBuf.Reader<K> keyReader, FriendlyByteBuf.Reader<V> valueReader) {
int mapSize = this.readVarInt();
M map = mapFactory.apply(mapSize);