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.
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.
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.
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.
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.
// 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.
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 . . .
*** 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 . . .
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
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.
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.
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?
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!
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 . . .
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.
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.
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.
BlockBrightStone.java
Block.java
CraftingManager.java The problem as of now.
If you want all of Block.java and CraftingManager.java let me know, but those are the only lines I've added.
Change:
to:
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.
Block.java
CraftingManager.java
The BrightStone.java stayed the same.
My error seems to be stemming from "ItemStack" which I know nothing about, and haven't touched.
*** 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 . . .
*** 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 . . .
Here's the new Block.java changes:
Thx
Sjawa
== 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.
I have a CLINENT BIN PROBLEM, SOMETHING ABOUT ADDING BLOCKS. Maybe repath your Java?
EDIT: tne mod_(modname) is a .java file srry
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 . . .