Prevent JEI crash - needs to run on main thread.

This commit is contained in:
raoulvdberge
2018-07-23 12:21:41 +02:00
parent aed41abd91
commit b3f4109ffa

View File

@@ -92,7 +92,10 @@ public abstract class ContainerBase extends Container {
} else if (slot.getHasStack()) { } else if (slot.getHasStack()) {
if (slot instanceof SlotFilterType && ((SlotFilterType) slot).getType().getType() == IType.FLUIDS) { if (slot instanceof SlotFilterType && ((SlotFilterType) slot).getType().getType() == IType.FLUIDS) {
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
Minecraft.getMinecraft().addScheduledTask(() -> {
// Prevent JEI crash - this needs to run on the main thread and not on the packet handler thread
FMLClientHandler.instance().showGuiScreen(new GuiGridPatternFluidAmount((GuiBase) Minecraft.getMinecraft().currentScreen, player, slot.getSlotIndex(), ((SlotFilterType) slot).getActualStack())); FMLClientHandler.instance().showGuiScreen(new GuiGridPatternFluidAmount((GuiBase) Minecraft.getMinecraft().currentScreen, player, slot.getSlotIndex(), ((SlotFilterType) slot).getActualStack()));
});
} }
} else { } else {
slot.getStack().setCount(((SlotFilter) slot).getAmountModified(dragType)); slot.getStack().setCount(((SlotFilter) slot).getAmountModified(dragType));