Dirty casting hacks to fix eclipse compiler inference issue. I'm sorry cpw.
This commit is contained in:
parent
7dbae7ea4a
commit
3820d1b66f
2 changed files with 4 additions and 3 deletions
|
@ -50,7 +50,8 @@ public enum ModLoadingStage
|
||||||
ERROR(),
|
ERROR(),
|
||||||
VALIDATE(),
|
VALIDATE(),
|
||||||
CONSTRUCT(FMLConstructModEvent.class),
|
CONSTRUCT(FMLConstructModEvent.class),
|
||||||
CREATE_REGISTRIES(()->Stream.of(RegistryEvent.NewRegistry::new), EventDispatcher.identity()),
|
@SuppressWarnings({ "unchecked", "rawtypes" }) //Eclipse compiler generics issue. Sorry cpw, your nested generics can't be inferred
|
||||||
|
CREATE_REGISTRIES((Supplier)()->Stream.of((Function<ModContainer, IModBusEvent>)RegistryEvent.NewRegistry::new), EventDispatcher.identity()),
|
||||||
LOAD_REGISTRIES(GameData::generateRegistryEvents, GameData.buildRegistryEventDispatch()),
|
LOAD_REGISTRIES(GameData::generateRegistryEvents, GameData.buildRegistryEventDispatch()),
|
||||||
COMMON_SETUP(FMLCommonSetupEvent.class),
|
COMMON_SETUP(FMLCommonSetupEvent.class),
|
||||||
SIDED_SETUP(DistExecutor.unsafeRunForDist(()->()->FMLClientSetupEvent.class, ()->()->FMLDedicatedServerSetupEvent.class)),
|
SIDED_SETUP(DistExecutor.unsafeRunForDist(()->()->FMLClientSetupEvent.class, ()->()->FMLDedicatedServerSetupEvent.class)),
|
||||||
|
@ -79,7 +80,6 @@ public enum ModLoadingStage
|
||||||
}, e);
|
}, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
<T extends Event & IModBusEvent> ModLoadingStage(Supplier<Stream<EventGenerator<?>>> eventStream, EventDispatcher<?> eventManager) {
|
<T extends Event & IModBusEvent> ModLoadingStage(Supplier<Stream<EventGenerator<?>>> eventStream, EventDispatcher<?> eventManager) {
|
||||||
this.eventFunctionStream = eventStream;
|
this.eventFunctionStream = eventStream;
|
||||||
this.parallelEventClass = Optional.empty();
|
this.parallelEventClass = Optional.empty();
|
||||||
|
|
|
@ -327,6 +327,7 @@ public class GameData
|
||||||
LOGGER.debug(REGISTRIES, "Reverting complete");
|
LOGGER.debug(REGISTRIES, "Reverting complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes") //Eclipse compiler generics issue.
|
||||||
public static Stream<ModLoadingStage.EventGenerator<?>> generateRegistryEvents() {
|
public static Stream<ModLoadingStage.EventGenerator<?>> generateRegistryEvents() {
|
||||||
List<ResourceLocation> keys = Lists.newArrayList(RegistryManager.ACTIVE.registries.keySet());
|
List<ResourceLocation> keys = Lists.newArrayList(RegistryManager.ACTIVE.registries.keySet());
|
||||||
keys.sort((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2)));
|
keys.sort((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2)));
|
||||||
|
@ -338,7 +339,7 @@ public class GameData
|
||||||
keys.add(0, BLOCKS.func_240901_a_());
|
keys.add(0, BLOCKS.func_240901_a_());
|
||||||
keys.add(1, ITEMS.func_240901_a_());
|
keys.add(1, ITEMS.func_240901_a_());
|
||||||
|
|
||||||
return keys.stream().map(rl -> mc -> RegistryManager.ACTIVE.getRegistry(rl).getRegisterEvent(rl));
|
return keys.stream().map(rl -> (ModLoadingStage.EventGenerator)(mc -> RegistryManager.ACTIVE.getRegistry(rl).getRegisterEvent(rl)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModLoadingStage.EventDispatcher<RegistryEvent.Register<?>> buildRegistryEventDispatch() {
|
public static ModLoadingStage.EventDispatcher<RegistryEvent.Register<?>> buildRegistryEventDispatch() {
|
||||||
|
|
Loading…
Reference in a new issue