Fix The One Probe integration crash when not present

This commit is contained in:
yueh
2020-06-25 21:54:44 +02:00
parent d8928070fd
commit fe8bebe1c3
3 changed files with 34 additions and 10 deletions
@@ -0,0 +1,31 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2020, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.theoneprobe;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
public class TOP {
public static void enqueueIMC(final InterModEnqueueEvent event) {
if (ModList.get().isLoaded("theoneprobe")) {
InterModComms.sendTo("theoneprobe", "getTheOneProbe", TheOneProbeModule::new);
}
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
* Copyright (c) 2020, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -20,9 +20,6 @@ package appeng.integration.modules.theoneprobe;
import java.util.function.Function;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import mcjty.theoneprobe.api.ITheOneProbe;
import appeng.integration.IIntegrationModule;
@@ -30,10 +27,6 @@ import appeng.integration.modules.theoneprobe.config.AEConfigProvider;
public class TheOneProbeModule implements IIntegrationModule, Function<ITheOneProbe, Void> {
public static void enqueueIMC(final InterModEnqueueEvent event) {
InterModComms.sendTo("theoneprobe", "getTheOneProbe", TheOneProbeModule::new);
}
@Override
public Void apply(ITheOneProbe input) {
input.registerProbeConfigProvider(new AEConfigProvider());