diff --git a/src/main/java/net/neoforged/neoforge/capabilities/BlockCapability.java b/src/main/java/net/neoforged/neoforge/capabilities/BlockCapability.java index 0d8cbcc418b..cde4fa0235c 100644 --- a/src/main/java/net/neoforged/neoforge/capabilities/BlockCapability.java +++ b/src/main/java/net/neoforged/neoforge/capabilities/BlockCapability.java @@ -126,6 +126,8 @@ public static BlockCapability createVoid(ResourceLocation name, Cla } // INTERNAL + + // Requires explicitly-typed constructor due to ECJ inference failure. private static final CapabilityRegistry> registry = new CapabilityRegistry>(BlockCapability::new); private BlockCapability(ResourceLocation name, Class typeClass, Class contextClass) { diff --git a/src/main/java/net/neoforged/neoforge/capabilities/EntityCapability.java b/src/main/java/net/neoforged/neoforge/capabilities/EntityCapability.java index 762b825a69f..1a4f858dcdf 100644 --- a/src/main/java/net/neoforged/neoforge/capabilities/EntityCapability.java +++ b/src/main/java/net/neoforged/neoforge/capabilities/EntityCapability.java @@ -84,6 +84,8 @@ public static EntityCapability createVoid(ResourceLocation name, Cl } // INTERNAL + + // Requires explicitly-typed constructor due to ECJ inference failure. private static final CapabilityRegistry> registry = new CapabilityRegistry>(EntityCapability::new); private EntityCapability(ResourceLocation name, Class typeClass, Class contextClass) { diff --git a/src/main/java/net/neoforged/neoforge/capabilities/ItemCapability.java b/src/main/java/net/neoforged/neoforge/capabilities/ItemCapability.java index 1c383384d71..1088d8a099f 100644 --- a/src/main/java/net/neoforged/neoforge/capabilities/ItemCapability.java +++ b/src/main/java/net/neoforged/neoforge/capabilities/ItemCapability.java @@ -75,6 +75,8 @@ public static ItemCapability createVoid(ResourceLocation name, Clas } // INTERNAL + + // Requires explicitly-typed constructor due to ECJ inference failure. private static final CapabilityRegistry> registry = new CapabilityRegistry>(ItemCapability::new); private ItemCapability(ResourceLocation name, Class typeClass, Class contextClass) { diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java index 3834fac8daa..4dcc1c33605 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java @@ -166,8 +166,8 @@ public class NeoForgeMod { private static final DeferredRegister> STRUCTURE_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, "neoforge"); private static final DeferredRegister HOLDER_SET_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.HOLDER_SET_TYPES, "neoforge"); - @SuppressWarnings({ "unchecked", "rawtypes" }) - private static final DeferredHolder, EnumArgument.Info> ENUM_COMMAND_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES.register("enum", () -> ArgumentTypeInfos.registerByClass(EnumArgument.class, new EnumArgument.Info())); + @SuppressWarnings({ "unchecked", "rawtypes" }) // Uses Holder instead of DeferredHolder as the type due to weirdness between ECJ and javac. + private static final Holder> ENUM_COMMAND_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES.register("enum", () -> ArgumentTypeInfos.registerByClass(EnumArgument.class, new EnumArgument.Info())); private static final DeferredHolder, SingletonArgumentInfo> MODID_COMMAND_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES.register("modid", () -> ArgumentTypeInfos.registerByClass(ModIdArgument.class, SingletonArgumentInfo.contextFree(ModIdArgument::modIdArgument)));