'Minecraft Forge 1.16.5 changes since 1.16.4 - compiling error

I am trying to learn Minecraft modding, and while following a tutorial for version 1.16.4, I found that their code did not work, and I presume this is a change to the API, since I am using 1.16.5.

I have looked at both official and unofficial API docs, but these did not provide me any insight. Could anyone point me to a better API reference, or better yet, to a VSCode extension that autocompletes for the most recent Forge API.

Here is the compile error when I ran ./gradlew.bat build with my minimal reproducible example (sorry about the code highlighting, I don't know how to fix it):

C:\Users\eric\Desktop\Programming\Java\Minecraft Mod 1\src\main\java\com\ericl5445\testmod1\core\init\ItemInit.java:1: error: package net.minecraftforge.item does not exist
import net.minecraftforge.item.Item;
                              ^
C:\Users\eric\Desktop\Programming\Java\Minecraft Mod 1\src\main\java\com\ericl5445\testmod1\core\init\ItemInit.java:2: error: package net.minecraftforge.item does not exist
import net.minecraftforge.item.ItemGroup;
                              ^

Here is my full code: TestMod1.java ItemInit.java

Any help would really be appreciated!



Solution 1:[1]

The Package You Need To import is net.minecraft.item.Item and net.minecraft.itemGroup, Not net.minecraftforge.item.Item and net.minecraftforge.itemGroup

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LakshyaK2011