Jump to content

[1.7.2] Cannot find symbol : variable Items


Someone Else 37

Recommended Posts

I'm running a clean install of Forge 1.7.2-10.12.1.1061 and the associated ForgeGradle on Ubuntu 12.04, and am NOT using Eclipse or any other IDE, if that matters.

 

Anyway, I am unable to do anything with any vanilla items because the compiler doesn't recognize the identifier "Items" and crashes. Blocks are fine, as are things based on the ore dictionary, but I can't use any items in things like crafting recipes.

 

Here's the error spat out by the compiler shortly after Gradle prints out ":compileJava":

~/Games/Minecraft/MCP/mc172/forge1061/build/sources/java/se37/triangulum/Triangulum.java:65: cannot find symbol
symbol  : variable Items
location: class se37.triangulum.Triangulum
GameRegistry.addRecipe(ironTri, " s ", "   ", "s s", 's', new ItemStack(Items.iron_ingot));
                                                                        ^
1 error

 

And here's the entire base class for my mod:

 

package se37.triangulum;

import java.io.File;

import net.minecraft.init.Blocks;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid = Triangulum.MODID, version = Triangulum.VERSION)
public class Triangulum
{
    public static final String MODID = "triangulum";
    public static final String VERSION = "0.0.0";

    public static Item triangleWood;
    public static Item triangleIron;
    public static Item triangleGold;
    public static Item triangleDiamond;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent preInitEvent) {
triangleWood = new Triangle().setUnlocalizedName("triangleWood").setTextureName("triangulum:triangleWood");
GameRegistry.registerItem(triangleWood, triangleWood.getUnlocalizedName());
triangleIron = new Triangle().setUnlocalizedName("triangleIron").setTextureName("triangulum:triangleIron");
GameRegistry.registerItem(triangleIron, triangleIron.getUnlocalizedName());
triangleGold = new Triangle().setUnlocalizedName("triangleGold").setTextureName("triangulum:triangleGold");
GameRegistry.registerItem(triangleGold, triangleGold.getUnlocalizedName());
triangleDiamond = new Triangle().setUnlocalizedName("triangleDiamond").setTextureName("triangulum:triangleDiamond");
GameRegistry.registerItem(triangleDiamond, triangleDiamond.getUnlocalizedName());
    };

    @EventHandler
    public void init(FMLInitializationEvent event) {
ItemStack woodTri = new ItemStack(Triangulum.triangleWood);
ItemStack ironTri = new ItemStack(Triangulum.triangleIron);
ItemStack goldTri = new ItemStack(Triangulum.triangleGold);
ItemStack diamTri = new ItemStack(Triangulum.triangleDiamond);

GameRegistry.addRecipe(new ShapedOreRecipe(woodTri, " s ", "   ", "s s", 's', "stickWood"));
GameRegistry.addRecipe(ironTri, " s ", "   ", "s s", 's', new ItemStack(Items.iron_ingot));
    };
}

 

Yes, I realize that I don't need half those imports, I'm just too lazy to go back and remove the ones I don't need because I might need them later.

 

If I comment out that last line, everything works fine, except I can't craft the item.

 

Note that the compiler fails upon reaching the "Items" thing, NOT the "iron_ingot" part. I've tried "Items.ingotIron", "Item.iron_ingot", "Item.ingotIron", even trying an ore dictionary recipe with "ironIngot" or "ingotIron" (both of which compiled, but didn't let me craft the item) and importing net.minecraft.item.Items, no dice.

 

My question is this: Am I just doing something wrong, or is this actually a Forge bug? And if it is a bug, is there any other workaround?

 

Also, where can I find a list of the internal names of all the vanilla items and blocks and things, or do I just have to blindly guess things like "Blocks.blockIron", "Blocks.ironBlock", and "Blocks.iron_block" until something works?

If you stare hard enough at my avatar (the one that I apparently wasn't able to upload, for some reason), you'll notice that it consists of three triangular rings, interlocked in such a way that if any one were cut and removed, the other two would no longer be interlocked.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.