FabricMC / fabric-docs

[WIP] Official curated documentation for Fabric, a modding toolchain for Minecraft.
https://docs.fabricmc.net
Other
64 stars 96 forks source link

Creating item from tutorial fails #179

Open anhilde opened 2 months ago

anhilde commented 2 months ago

Hello, I have set up a seemingly working development environment using IntelliJ and can start and debug a client/server. I manage to log output to the console and set breakpoints. I now try to create my first own item based on this description: https://docs.fabricmc.net/develop/items/first-item

I changed the Id, build the project and start the server. A log message I output in onInitialize in the main.mypackage.Test class is output in the server console. The Item that is created however, does not appear in the items list in the game. There is also no visible error in the server log. How would I best investigate where the problem lies?

anhilde commented 2 months ago

Problem partially soved. The item appears if I run the minecraft client. From the description this is not clear. I assumed I change the server and then connected to the modified server from an unmodified client. Perhaps this is clear to seasoned minecraft folks, to me as beginner it is absolutely not. Could a suitable hint be added to the tutorial?

LordEnder-Kitty commented 1 month ago

Running the client and making a singleplayer world is all you need to do. You should never have to run the server unless you're making a specifically server only mod or you need to debug something in your mod. Running the client in IntelliJ is pretty much just like running the regular game. Running the server from IntelliJ is like hosting a whole, proper server on your machine.

Does that help clear things up?

winderine commented 1 month ago

anhilde, you got a lot farther than I did. From having to import all of the minecraft things, which at least IntelliJ recognized, to not knowing what to do with "FabricDocsReference.MOD_ID" (I assume I'm supposed to change MOD_ID to my mod id? But FabricDocsReference remains an undeclared symbol...)

And for that matter it would be super useful to change "You can put this method in a class called ModItems (or whatever you want to name the class)." to something like "You can create a new class file to hold this method, and call it ModItems (or whatever you want to name the class)." just to remind those of us who haven't read the beginning chapter of a programming book in 5 years how to add classes to a multi-class project, because apparently it was such an obvious thing to find that two people had to quote a textbook at me when I asked for help in the discord.

No, you know what would be more helpful, is having a copy of the working source code of the tutorial to cross-reference. This tutorial might be helpful to reference for people who already know how to do everything, but I've been at it for over two hours now and I still can't get the first run to run, and I'm not even a complete newbie to programming, just a little inexperienced in java.

LordEnder-Kitty commented 2 weeks ago

If you go to reference/latest in this repository, you can see all the working code for pretty much everything shown in the tutorials.

its-miroma commented 1 week ago

To summarize, the two changes that this issue asks for are:

Is this correct?