简体   繁体   中英

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!

I do not have an api reference, however I have found that the ItemGroup class is not under net.minecraftforge.item . It is under the package net.minecraft.item .

Your IDE, usually Intellij Idea or Eclipse, should be able to tell you where these classes are located via a search functionality. In Eclipse, you can press Control/Command + Shift + T to bring up a search box with a list of all the classes in your workspace.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM