Fix classcast in autoeventsubscriber, also actually make progression
work properly. This whole thing is a bit of a gross hack. Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
2bee5f7ac6
commit
7c840dce35
2 changed files with 5 additions and 2 deletions
|
@ -61,10 +61,12 @@ public class AutomaticEventSubscriber
|
||||||
final EnumSet<Dist> sides = sidesValue.stream().map(eh -> Dist.valueOf(eh.getValue())).
|
final EnumSet<Dist> sides = sidesValue.stream().map(eh -> Dist.valueOf(eh.getValue())).
|
||||||
collect(Collectors.toCollection(() -> EnumSet.noneOf(Dist.class)));
|
collect(Collectors.toCollection(() -> EnumSet.noneOf(Dist.class)));
|
||||||
final String modId = (String)ad.getAnnotationData().getOrDefault("modid", mod.getModId());
|
final String modId = (String)ad.getAnnotationData().getOrDefault("modid", mod.getModId());
|
||||||
final Mod.EventBusSubscriber.Bus busTarget = (Mod.EventBusSubscriber.Bus)ad.getAnnotationData().getOrDefault("bus", Mod.EventBusSubscriber.Bus.FORGE);
|
final ModAnnotation.EnumHolder busTargetHolder = (ModAnnotation.EnumHolder)ad.getAnnotationData().getOrDefault("bus", new ModAnnotation.EnumHolder(null, "FORGE"));
|
||||||
|
final Mod.EventBusSubscriber.Bus busTarget = Mod.EventBusSubscriber.Bus.valueOf(busTargetHolder.getValue());
|
||||||
if (Objects.equals(mod.getModId(), modId) && sides.contains(FMLEnvironment.dist)) {
|
if (Objects.equals(mod.getModId(), modId) && sides.contains(FMLEnvironment.dist)) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
LOGGER.info(LOADING, "Auto-subscribing {} to {}", ad.getClassType().getClassName(), busTarget);
|
||||||
busTarget.bus().get().register(Class.forName(ad.getClassType().getClassName(), true, loader));
|
busTarget.bus().get().register(Class.forName(ad.getClassType().getClassName(), true, loader));
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
catch (ClassNotFoundException e)
|
||||||
|
|
|
@ -806,7 +806,8 @@ public class GameData
|
||||||
reg.unfreeze();
|
reg.unfreeze();
|
||||||
final RegistryEvent.Register<?> registerEvent = reg.getRegisterEvent(rl);
|
final RegistryEvent.Register<?> registerEvent = reg.getRegisterEvent(rl);
|
||||||
lifecycleEventProvider.setCustomEventSupplier(() -> registerEvent);
|
lifecycleEventProvider.setCustomEventSupplier(() -> registerEvent);
|
||||||
if (i== keysSize-1) lifecycleEventProvider.changeProgression(LifecycleEventProvider.LifecycleEvent.Progression.NEXT);
|
lifecycleEventProvider.changeProgression(LifecycleEventProvider.LifecycleEvent.Progression.STAY);
|
||||||
|
if (i==keysSize-1) lifecycleEventProvider.changeProgression(LifecycleEventProvider.LifecycleEvent.Progression.NEXT);
|
||||||
eventDispatcher.accept(lifecycleEventProvider);
|
eventDispatcher.accept(lifecycleEventProvider);
|
||||||
reg.freeze();
|
reg.freeze();
|
||||||
LOGGER.info("{} Applying holder lookups", rl.toString());
|
LOGGER.info("{} Applying holder lookups", rl.toString());
|
||||||
|
|
Loading…
Reference in a new issue