【发布时间】:2021-10-27 03:05:24
【问题描述】:
出于某种原因,它说的是Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'java/lang/Boolean',但我很确定它不会在 BiPredicate 的任何地方返回一个对象,而不是无论如何都会调用代码。
我已经尝试过调试它,没有任何运气可以得到调试点,甚至构造函数上的调试点也没有被命中。
public static SlotType<SlotInput> IT_IN = new SlotType<>("item_in", (type, gui, inv, i, d) -> new SlotInput(type, gui, inv.getOrDefault(type, new EmptyHandler()), i, d.getX(), d.getY()), (t, i) -> {
if (t instanceof TileEntityMachine) {
return (((TileEntityMachine<?>) t).recipeHandler.map(rh -> rh.accepts(i)).orElse(true));
}
return true;
}, ContentEvent.ITEM_INPUT_CHANGED, true, false);
似乎一旦类加载它就会崩溃并出现错误
public SlotType(String id, ISlotSupplier<T> slotSupplier, BiPredicate<IGuiHandler, ItemStack> validator, ContentEvent ev, boolean input, boolean output) {
this.id = id;
this.slotSupplier = slotSupplier;
this.output = output;
this.tester = validator;
this.input = input;
this.ev = ev;
AntimatterAPI.register(SlotType.class, this);
}
这里是 GitHub 上课程的链接: https://github.com/GregTech-Intergalactical/AntimatterAPI/blob/dev/src/main/java/muramasa/antimatter/gui/SlotType.java 哦,这是完整的崩溃供参考:https://gist.github.com/Trinsdar/bba054869f1c565a32d61bb60cc31bda
更新:将 IT_IN 中的 lambda 更改为 BiPredicate 的自定义实现似乎已经导致它停止崩溃,尽管其他所有都很好,真的很奇怪。
【问题讨论】:
-
Minecraft 中的 VerifyErrors 通常是由 coremods 引起的。你有这些吗?仅此一个 mod 是否仍会发生崩溃?另外,如果您手动创建一个自己的类来实现 BiPredicate 并传递它而不是使用 lambda 来为您做这件事呢?至于断点,请记住,VerifyError 将在加载类时发生,而不是在调用问题方法时发生。
-
与 Minecraft 相关的问题应标记为
[minecraft]。它可以帮助不了解 Minecraft 平台(或对它不感兴趣)的人避开。 -
如果你解决了你的问题,你可以自己回答:)
标签: java runtime-error minecraft