I'm struggling to try and figure out why I'm receiving this error when doing a gradlew build
D:\Projects\ModAlpha6.0\src\main\java\com\dwyvern\modalpha\init\ModScreens.java:22: error: incompatible types: cannot infer type-variable(s) M,U
MenuScreens.register(ModContainers.ELEPHANT_INVENTORY_CONTAINER.get(), ElephantInventoryScreen::new);
^
(argument mismatch; cannot infer functional interface descriptor for ScreenConstructor<ElephantInventoryContainer,U>)
where M,U are type-variables:
M extends AbstractContainerMenu declared in method <M,U>register(MenuType<? extends M>,ScreenConstructor<M,U>)
U extends Screen,MenuAccess<M> declared in method <M,U>register(MenuType<? extends M>,ScreenConstructor<M,U>)
When I execute runClient from within Eclipse (2021-12 4.22.0), it compiles, runs, and functions correctly without any issue. but when I run gradlew build from the command prompt to generate the jar file for the mod, I receive the above error. Does anyone know why this is happening and how I should fix it?
Here are some of the class Contents:
public class ModContainers
{
public static final DeferredRegister<MenuType<?>> CONTAINER = DeferredRegister.create(ForgeRegistries.CONTAINERS, Reference.MOD_ID);
public static final RegistryObject<MenuType<ElephantInventoryContainer>> ELEPHANT_INVENTORY_CONTAINER = CONTAINER.register("elephant_inventory_container", () -> new MenuType<>(ElephantInventoryContainer::new));
}
public class ModScreens
{
public static void registerScreens(FMLClientSetupEvent event)
{
event.enqueueWork(() -> {
MenuScreens.register(ModContainers.ELEPHANT_INVENTORY_CONTAINER.get(), ElephantInventoryScreen::new);
});
}
public class ElephantInventoryScreen extends AbstractContainerScreen<ElephantInventoryContainer>
{
private static final ResourceLocation TEXTURE_BG = new ResourceLocation(Reference.MOD_ID + ":textures/gui/container3x9.png");
public ElephantInventoryScreen(ElephantInventoryContainer container, Inventory playerInventory, Component title)
{
super(container, playerInventory, title);
}
...
}
public class ElephantInventoryContainer extends AbstractContainerMenu
{
public ElephantInventoryContainer(int id, Inventory playerInv)
{
super(ModContainers.ELEPHANT_INVENTORY_CONTAINER.get(), id);
}
...
}
Any guidance or suggestions is much appreciated.
Thank you.