Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

MCP Recompile error. Cannot find symbol.


  • Please log in to reply
19 replies to this topic

#1

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 24 March 2011 - 02:11 PM

I'm relatively new to java coding, but I've done some work in C++ and python. I know I'm using the latest version of MCP and Minecraft, and that the two are compatible. I've put the right files, (minecraft_server.jar, resources and bin folders) into the right places (MCP\jars). I've decompiled, made a new block type, and tried to recompile.
I'm not getting an error with the files I've changed, I'm getting a different "cannot find symbol" error with what seems like every class, in the src and client folders, even though I've never even opened the client folder. I've looked around and tried to fix it myself, but the site's search function is busted and I can't find anything online. Any thoughts?

I've also tried deleting MCP, the .minecraft folder, and my minecraft.exe, and starting from scratch. Didn't fix my problem.

Register or log in to remove.

#2

bcangussu

Posted 24 March 2011 - 03:29 PM

try running clean up.bat and decompiling again than do the block again if it's not working, i don't know
Posted Image

#3

Chronosmith
  • Location: Not Telling

Posted 24 March 2011 - 05:35 PM

I'm kinda new too, but errors like that could be caused by a lot of things, so I'll try to make a checklist of things I think could go wrong. I'm going to assume you've been following simo_415's tutorial on how to make a new block type.

1. Did you start with simo's code? This means it has to extend block, accept the right parameterts, etc.
2. Did you add the declarations to block.java? This means adding the basic declaration (public static final blockName;) as well as initializing it lower down.
3. When initializing, make sure that you've typed everything EXACTLY the same, or it won't identify it. As well, make sure the ID doesn't conflict with any of the other items.

Sorry if this is insulting since you've already got plenty of experience with C++, but most of the time we beginning programmers wind up spending hours trying to fix a problem and when we finally locate it, we kick ourselves for having not seen it earlier. Also, if you're willing to send me the java files you've already edited (I'm assuming it's only 2-3 files) I can take a look at the code for you.
Check out my advanced tutorials --> HERE

#4

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 24 March 2011 - 09:17 PM

Thanks for being so helpful. I retried everything, and yes, I did follow the tutorial and got those basics down at least. For some reason, I wasn't using the latest server file, like an idiot. I guess I thought it was up to date since I can play on it.

Regardless, same error, but it only applies to my CraftingManager file. It doesn't let me upload any files, so I'll post my files soon.

#5

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 24 March 2011 - 11:09 PM

Ok, here's my code for my three files.
BlockBrightStone.java
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode 

import java.util.Random;

public class BlockBrightStone extends Block
{

	public BlockBrightStone(int i, int j, Material material)
	{
		super(i, j, material);
	}

	public int idDropped(int i, Random random)
	{
		return Item.lightStoneDust.shiftedIndex;
	}
}
Block.java
// BrightStone
	public static final Block brightStone;
	// BrightStone end

		//BrightStone
		brightStone = (new BlockBrightStone (100, 36)).setHardness(0.5F).setStepSound(soundGlassFootstep).setBlockName("brightstone");
		//Brightstone end
CraftingManager.java  The problem as of now.
//BrightStone
		addRecipe (new ItemStack(Block.brightstone, 64), new Object[] {
			"#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
		});
		//BrightStone end
If you want all of Block.java and CraftingManager.java let me know, but those are the only lines I've added.

#6

BlackIce100
  • Location: -1°N, -1°E

Posted 25 March 2011 - 12:09 AM

You have the block "brightStone" in block.java but you are trying to reference it as "brightstone".

Change:
	//BrightStone
			addRecipe (new ItemStack(Block.brightstone, 64), new Object[] {
			   "#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
			});
			//BrightStone end

to:
	//BrightStone
			addRecipe (new ItemStack(Block.brightStone, 64), new Object[] {
			   "#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
			});
			//BrightStone end

Posted Image

#7

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 25 March 2011 - 12:27 AM

BlackIce100 said:

You have the block "brightStone" in block.java but you are trying to reference it as "brightstone".

Change:
	//BrightStone
			addRecipe (new ItemStack(Block.brightstone, 64), new Object[] {
			   "#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
			});
			//BrightStone end

to:
	//BrightStone
			addRecipe (new ItemStack(Block.brightStone, 64), new Object[] {
			   "#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
			});
			//BrightStone end
I became confused when setting the "BlockName," I thought you used the "BlockName" in "CraftingManager.java," but you don't. I also learned that "BlockName" can be the same as static final name, so I changed that too, but it didn't fix the problem.

#8

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 25 March 2011 - 12:33 AM

New changes, old problems:
Block.java
	 // BrightStone
	public static final Block brightStone;
	// BrightStone end

		//BrightStone
		brightStone = (new BlockBrightStone (100, 36)).setHardness(0.5F).setStepSound(soundGlassFootstep).setBlockName("brightStone");
		//Brightstone end
CraftingManager.java
		//BrightStone
		addRecipe (new ItemStack(Block.brightStone, 32), new Object[] {
			"#", "X", Character.valueOf('#'), Block.stone, Character.valueOf('X'), Block.torchWood
		});
		//BrightStone end
The BrightStone.java stayed the same.
My error seems to be stemming from "ItemStack" which I know nothing about, and haven't touched.

#9

Rotten194
  • Location: Behind y- er, Virginia. Not behind you. Really.
  • Minecraft: Rotten194

Posted 25 March 2011 - 12:37 AM

Post the error itself?

Redstone Tutorials - f=35&t=25695 | f=1020&t=116924

Posted Image


#10

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 25 March 2011 - 12:46 AM

I decided I'd use the "cleanup.bat" and only edit "Block.java" and create "BlockBrightStone.java", just to use "recompile.bat" and make sure that worked at least. I received an error message:

*** Minecraft Coder Pack Version 2.9 ***
MCP 2.9 running in C:\Users\Scott\Desktop\MCP
Compiling Minecraft
sources\minecraft\net\minecraft\src\Block.java:741: cannot find symbol
symbol  : constructor BlockBrightStone(int,int)
location: class net.minecraft.src.BlockBrightStone
        brightStone = (new BlockBrightStone (100, 36)).setHardness(0.5F).setStep
Sound(soundGlassFootstep).setBlockName("brightStone");
                       ^
1 error
Compiling Minecraft Server
=== MCP 2.9 recompile script finished ===
Press any key to continue . . .

#11

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 25 March 2011 - 12:49 AM

Here's what I normally get:

*** Minecraft Coder Pack Version 2.9 ***
MCP 2.9 running in C:\Users\Scott\Desktop\MCP
Compiling Minecraft
sources\minecraft\net\minecraft\src\CraftingManager.java:190: cannot find symbol

symbol  : class ItemStack
location: class CraftingManager
    void addRecipe(ItemStack itemstack, Object aobj[])
                   ^
sources\minecraft\net\minecraft\src\CraftingManager.java:253: cannot find symbol

symbol  : class ItemStack
location: class CraftingManager
    void addShapelessRecipe(ItemStack itemstack, Object aobj[])
                            ^
sources\minecraft\net\minecraft\src\CraftingManager.java:281: cannot find symbol

symbol  : class InventoryCrafting
location: class CraftingManager
    public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting)
                                        ^
sources\minecraft\net\minecraft\src\CraftingManager.java:281: cannot find symbol

symbol  : class ItemStack
location: class CraftingManager
    public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting)
           ^
C:\Users\Scott\Desktop\MCP\sources\minecraft\net\minecraft\src\CraftingManager.j
ava:8: duplicate class: CraftingManager
public class CraftingManager
       ^
sources\minecraft\net\minecraft\src\RecipesArmor.java:27: cannot access net.mine
craft.src.CraftingManager
bad class file: C:\Users\Scott\Desktop\MCP\sources\minecraft\net\minecraft\src\C
raftingManager.java
file does not contain class net.minecraft.src.CraftingManager
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
    public void addRecipes(CraftingManager craftingmanager)
                           ^
Compiling Minecraft Server
=== MCP 2.9 recompile script finished ===
Press any key to continue . . .

#12

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 26 March 2011 - 07:34 AM

Thanks to Chronosmith, he's fixed my Block.java issues, but I'm still having CraftingMaterials.java issues.
Here's the new Block.java changes:
	// BrightStone
	public static final Block brightStone;
	// BrightStone end

		//BrightStone
		brightStone = (new BlockBrightStone (100, 36, Material.glass)).setHardness(0.5F).setStepSound(soundGlassFootstep).setBlockName("brightStone");
		//Brightstone end


#13

Ice138
    Ice138

    Tree Puncher

  • Members
  • 12 posts

Posted 27 March 2011 - 10:07 PM

All is well. Don't program while drunk.

#14

Jordan589

Posted 08 April 2011 - 12:02 AM

hahahahahahahahahhaha i was drinking and had the same problem but fixed it from this thread XD

#15

SJawa
    SJawa

    Out of the Water

  • Members
  • 7 posts

Posted 10 April 2011 - 10:23 AM

Would you mind stating what the problem ended up being as it was corrected off of forum?

Thx
Sjawa

#16

arkonick
    arkonick

    Zombie Killer

  • Members
  • 160 posts
  • Location: North Carolina

Posted 27 October 2011 - 09:17 AM

mabe you'll can help i started writing code for first time took 5 days of head banging but i got most of the basics down. My code was working so i refurb and tried on a client to make sure it would work and it did. So i decided to do more when i went to add more i came up with a error not on a new file i made but on a old one telling me this. below contains the error and my code. Like i said it ran fine but when i recompiled with a new item which has nothing to do with this one in any way this started poping up and i can't for life of me see any thing wrong in the code.

== MCP v4.4 ==
> Recompiling client...
javac.exe -g -source 1.6 -target 1.6 -classpath "lib/;lib/*;jars/bin/minecraft.j
ar;jars/bin/jinput.jar;jars/bin/lwjgl.jar;jars/bin/lwjgl_util.jar" -sourcepath s
rc/minecraft -d bin/minecraft src/minecraft\net\minecraft\client\*.java src/mine
craft\net\minecraft\isom\*.java src/minecraft\net\minecraft\src\*.java  conf/pat
ches/*.java failed.
Return code : 1

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\mod_PumpkinPieSlice.java:6: cannot find symbol
symbol  : class PumpkinPieSlice
location: class net.minecraft.src.mod_PumpkinPieSlice
public static final Item pumpkinPieSlice = new PumpkinPieSlice(216).setItemName(
"asaa");
^

1 error
==================

> Done in 5.14 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
----------------------------------My Code-----------------------------------------------------------------
package net.minecraft.src;
import java.util.Random;

public class mod_PumpkinPieSlice extends BaseMod
{
public static final Item pumpkinPieSlice = new PumpkinPieSlice(216).setItemName("asaa");

public mod_PumpkinPieSlice()
{
pumpkinPieSlice.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mieng/Items/pumpkinpieslice.png");
ModLoader.AddName(pumpkinPieSlice, "PumpkinPieSlice");
ModLoader.AddRecipe(new ItemStack(pumpkinPieSlice,8), new Object[]{
"x", Character.valueOf('x'), mod_PumpkinPie.pumpkinPie, Character.valueOf('s'), Item.sugar
});
}

public String Version()
{
return "3.14159265";
}
}

--------------------------------------------------------------------------------------------------------------------
Any help explaining why it compiled  refurbed worked on a client then when going back to mcp and compiling the next it fails would be helpful. And yes the png file is where it is supose to be spelled correct and every thing.

Edited by arkonick, 27 October 2011 - 09:19 AM.


#17

Aft
    Aft

    Redstone Miner

  • Members
  • 526 posts
  • Location: The Earth
  • Minecraft: AftExploision
  • Xbox:AftExploision

Posted 18 December 2011 - 07:26 PM

You have to add a java file for the block itself, and a class file that is mod_Blocknamehere   check for any missed semi-colins, exrectra. and always put the end }. well, that is what your supposed to do. Make mod loader overide and reconize the block in the class file. Make sure you have the correct PNG location ex. "mod/terrain.png/dirt.png"
I have a CLINENT BIN PROBLEM, SOMETHING ABOUT ADDING BLOCKS. Maybe repath your Java?

EDIT: tne mod_(modname) is a .java file srry

#18

Metriximor
  • Location: Youtube
  • Minecraft: Metriximor
  • Xbox:Metriximor

Posted 13 January 2012 - 11:46 PM

I have that problem too,search the place of error and review on youtube videos the block configuration.
Posted Image

#19

101super101

Posted 23 April 2012 - 01:53 PM

View PostIce138, on 26 March 2011 - 07:34 AM, said:

Thanks to Chronosmith, he's fixed my Block.java issues, but I'm still having CraftingMaterials.java issues.
Here's the new Block.java changes:
	// BrightStone
	public static final Block brightStone;
	// BrightStone end

		//BrightStone
		brightStone = (new BlockBrightStone (100, 36, Material.glass)).setHardness(0.5F).setStepSound(soundGlassFootstep).setBlockName("brightStone");
		//Brightstone end
Try making all the "Brightstone" into "BrightStone" with a capital S.

I've got a problem, it's says i don't have a minecraft.jar in the jars folder, but it's in there!

#20

GuiSSoK564
  • Minecraft: GuiSSoK

Posted 28 April 2012 - 11:27 PM

I've got the same problem. Tried fixing for DAYS, but no luck.

Here's my error:


== MCP 6.2 (data: 6.2, client: 1.2.5, server: 1.2.5) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0\bin\javac" -Xlint:-options -deprecation -g -sou
rce 1.6 -target 1.6 -...' failed : 1

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\PhisheOreBlock.java:4: error: class BlockPhisheO
re is public, should be declared in a file named BlockPhisheOre.java
public class BlockPhisheOre extends Block
       ^

src\minecraft\net\minecraft\src\mod_PhisheCraft.java:4: error: mod_PhisheCraft i
s not abstract and does not override abstract method load() in BaseMod
public class mod_PhisheCraft extends BaseMod
       ^

src\minecraft\net\minecraft\src\mod_PhisheCraft.java:17: error: cannot find symb
ol
                ModLoader.RegisterBlock(phisheoreBlock);
                         ^

  symbol:   method RegisterBlock(Block)
  location: class ModLoader
src\minecraft\net\minecraft\src\mod_PhisheCraft.java:19: error: cannot find symb
ol
                ModLoader.AddName(phisheoreBlock, "Phishe Ore");
                         ^

  symbol:   method AddName(Block,String)
  location: class ModLoader
src\minecraft\net\minecraft\src\mod_PhisheCraft.java:21: error: cannot find symb
ol
                ModLoader.AddRecipe(new ItemStack(phisheoreBlock, 10), new Objec
t[] {
                         ^

  symbol:   method AddRecipe(ItemStack,Object[])
  location: class ModLoader
src\minecraft\net\minecraft\src\PhisheOreBlock.java:16: error: package item does
not exist
                return item.Redstone.shiftedIndex;
                           ^

6 errors
==================

!! Can not find server sources, try decompiling !!
Press any key to continue . . .