Типизированные параметры в эвентах

Версия Minecraft
1.7.10
1,159
38
544
Всем, кто переижил новогоднее попоище, - доброго времени суток. Меня откровенно задолбали instanceof проверки при отлавливании событий. Посему я желаю вот такой вот евент:

CustomTypedEvent.java:
public class CustomTypedEvent<T> extends Event {
    public T value;

    public CustomTypedEvent(T value) {
        this.value = value;
    }
}

Но при запуске вот такого теста мы получаем, что String-версия эвента тоже вызывается. А все потому что MinecraftForge#EVENT_BUS не учитывает дженерики:

ExampleMod.java:
@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod
{
    public static final String MODID = "examplemod";
    public static final String VERSION = "1.0";
    
    @EventHandler
    public void init(FMLInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(this);
    }

    @SubscribeEvent
    public void onJump(LivingEvent.LivingJumpEvent event) {
        if (event.entity instanceof EntityPlayer) MinecraftForge.EVENT_BUS.post(new CustomTypedEvent<Integer>(5));
    }

    @SubscribeEvent
    public void on1(CustomTypedEvent<Integer> event) {
        System.out.println(event.value); // Это вызовется как и должно
    }

    @SubscribeEvent
    public void on2(CustomTypedEvent<String> event) {
        System.out.println(event.value); // и это тоже, хотя и не должно. Приведет к крашу (см. крашлог)
    }
}

Вопрос: есть ли какая-нибудь возможности использовать дженерики в евентах? И с какой версии форджа это появляется официально?
 
Краш-лог
[20:12:54] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// You're mean.

Time: 03.01.20 20:12
Description: Ticking entity

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at com.example.examplemod.ExampleMod.on2(ExampleMod.java:34)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_8_ExampleMod_on2_CustomTypedEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at com.example.examplemod.ExampleMod.onJump(ExampleMod.java:24)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ExampleMod_onJump_LivingJumpEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at net.minecraftforge.common.ForgeHooks.onLivingJump(ForgeHooks.java:351)
at net.minecraft.entity.EntityLivingBase.jump(EntityLivingBase.java:1572)
at net.minecraft.entity.player.EntityPlayer.jump(EntityPlayer.java:1829)
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2004)
at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:612)
at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:299)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327)
at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
at net.minecraft.world.World.updateEntity(World.java:2258)
at net.minecraft.world.World.updateEntities(World.java:2108)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2097)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
Краш-лог:
[20:12:54] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// You're mean.

Time: 03.01.20 20:12
Description: Ticking entity

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at com.example.examplemod.ExampleMod.on2(ExampleMod.java:34)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler_8_ExampleMod_on2_CustomTypedEvent.invoke(.dynamic)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
	at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
	at com.example.examplemod.ExampleMod.onJump(ExampleMod.java:24)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ExampleMod_onJump_LivingJumpEvent.invoke(.dynamic)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
	at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
	at net.minecraftforge.common.ForgeHooks.onLivingJump(ForgeHooks.java:351)
	at net.minecraft.entity.EntityLivingBase.jump(EntityLivingBase.java:1572)
	at net.minecraft.entity.player.EntityPlayer.jump(EntityPlayer.java:1829)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2004)
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:612)
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:299)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327)
	at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
	at net.minecraft.world.World.updateEntity(World.java:2258)
	at net.minecraft.world.World.updateEntities(World.java:2108)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:2097)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
	at net.minecraft.client.Minecraft.run(Minecraft.java:962)
	at net.minecraft.client.main.Main.main(Main.java:164)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
	at GradleStart.main(Unknown Source)
1,159
38
544
3,005
192
592
Переходи на 1.14+, там есть поддержка generic'ов.
Ну либо возьми от туда обработку.
 
Сверху