Aubrey Buchanan
2 min readJan 19, 2020

--

Sorry for the delayed response! It looks to me like somethings are imported already so that’s good news! Basically, see that line near the top of your code that reads like this:

import net.minecraft.init.Blocks;

That’s an import statement, it basically “includes” the Blocks class so your code can use it. You’ll also need to include import statements for other classes from Minecraft that you’re using — this should fix the errors you’re seeing.

For example I can see you have errors showing up on the classes “Block”, “Material”, and “GameRegistry”. See those little light bulbs (with the red “X”) on the left of your code, by the line numbers? If you click on them, they should have an option to add these import statements automatically (when you click on it the menu might have an option like “Import Block” or “Import net.minecraft.block.Block”), which can be very helpful if you’re not sure what the class path is! (By the way, the class path is that bit of text that comes after the word “import” in the import statement like “net.minecraft.init.Blocks" for example).

But, if you click the light bulb and you don’t see an option to automatically import that class something might be wrong. You may need to include a certain library that contains the class you want, but in your case, by setting up your Forge project, you should have all the libraries you might need for Minecraft mod development already. So if you do have trouble might simply have to add the import statement yourself (that can be tricky though because you’ll need to figure out what that class’s class path is, if you’re really confused, you can google something like “minecraft forge class GameRegistry” to find documentation online that shows what the classpath is).

For the import statements I mentioned above (for “Block”, “Material”, and “GameRegistry”), They should look something like this, try adding them to your file to see if that works:

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

--

--

Responses (1)