mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 06:24:43 +00:00
Update modlauncher, eventbus, accesstransformers and more to use a newer mechanism for generating ASM.
Introduced IModBusEvent as a marker interface for events on the ModBus. Expect exceptions if you use the modbus for events not listened there. Signed-off-by: cpw <[email protected]>
This commit is contained in:
12 files changed
+48
-25
No files matched your search
@@ -24,6 +24,7 @@ import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@@ -133,7 +134,7 @@ public class ModConfig
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModConfigEvent extends Event {
|
||||
public static class ModConfigEvent extends Event implements IModBusEvent {
|
||||
private final ModConfig config;
|
||||
|
||||
ModConfigEvent(final ModConfig config) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.minecraftforge.fml.event.lifecycle;
|
||||
|
||||
/**
|
||||
* Marker interface for events dispatched on the ModLifecycle event bus instead of the primary event bus
|
||||
*/
|
||||
public interface IModBusEvent {
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import java.util.stream.Stream;
|
||||
* Parent type to all ModLifecycle events. This is based on Forge EventBus. They fire through the
|
||||
* ModContainer's eventbus instance.
|
||||
*/
|
||||
public class ModLifecycleEvent extends Event
|
||||
public class ModLifecycleEvent extends Event implements IModBusEvent
|
||||
{
|
||||
private final ModContainer container;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ import net.minecraftforge.fml.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModLoadingException;
|
||||
import net.minecraftforge.fml.ModLoadingStage;
|
||||
import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.ModLifecycleEvent;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
|
||||
@@ -62,7 +64,7 @@ public class FMLModContainer extends ModContainer
|
||||
triggerMap.put(ModLoadingStage.PROCESS_IMC, dummy().andThen(this::beforeEvent).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.COMPLETE, dummy().andThen(this::beforeEvent).andThen(this::completeLoading).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.GATHERDATA, dummy().andThen(this::beforeEvent).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).build();
|
||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).build();
|
||||
this.configHandler = Optional.of(event -> this.eventBus.post(event));
|
||||
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
||||
this.contextExtension = () -> contextExtension;
|
||||
|
||||
Reference in new issue
Block a user