Fix some fatal errors when config validation fails in coremods

This commit is contained in:
FalsePattern committed 2023-08-12 14:39:28 +02:00
1 parent ba11e5c0a8
commit 8fdaab9214
7 files changed
+73 -44

No files matched your search

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2022-2023 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice
* shall be included in all copies or substantial portions of the Software.
*
* This program 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.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.lib.internal;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
public class EventUtil {
public static boolean postOnCommonBus(Event event) {
if (!Share.EARLY_INIT_DONE) {
return false;
}
return FMLCommonHandler.instance()
.bus()
.post(event);
}
}
@@ -57,6 +57,7 @@ public class FalsePatternLib {
@Mod.EventHandler
public void construct(FMLConstructionEvent e) {
proxy.construct(e);
Share.EARLY_INIT_DONE = true;
}
@Mod.EventHandler
@@ -46,6 +46,8 @@ public final class Share {
}
}
public static boolean EARLY_INIT_DONE = false;
public static void deprecatedWarning(Throwable stacktrace) {
LOG.warn("DEPRECATED API CALLED!", stacktrace);
}