gpt4 book ai didi

java - Minecraft Launcher 重新编译

转载 作者:行者123 更新时间:2023-11-30 11:14:52 25 4
gpt4 key购买 nike

我正在尝试为 Minecraft 制作自定义启动器。我只是想让它从我自己的服务器下载主 jar 文件,没有别的。我反编译了一个文件(Launcher.java)并将下载网址从“https://s3.amazonaws.com/Minecraft.Download/”更改为我自己的。问题是,当我尝试使用 javac -classpath launcher.jar launcher.java 重新编译它时,它会抛出 5 个错误:

launcher.java:313: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY);

launcher.java:317: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = directory.listFiles(FileFileFilter.FILE);

launcher.java:409: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = virtualsDir.listFiles(DirectoryFileFilter.DIRECTORY);

launcher.java:441: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] versions = root.listFiles(DirectoryFileFilter.DIRECTORY);

launcher.java:445: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = version.listFiles(FileFilterUtils.and(new IOFileFilter[] { new PrefixFileFilter(version.getName() + "-natives-"), ageFilter }));

有什么办法吗?不要介意我的写作风格,我整晚都在努力解决这个问题......

提前致谢。

最佳答案

我自己解决了!我需要这样做:

import java.io.FileFilter;

然后修改每一个错误行

File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY);

为此:

File[] directories = objectsDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);

现在一切正常。

关于java - Minecraft Launcher 重新编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25739328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com