I was following this tutorial and ended up not being able to build the mod after the end of it...
So as any normal person would do i ended up trying to fix it myself and ended up bringing it down to 3 errors and unable to fix those.
Not too sure if what i did before was actually correct
This is all the code i used and the three that are still claiming to be a failure is the in the function ModItem.
which should be the last code block if i did it correctly.
After the code blocks should also be the error message i got each time i tried to build
Any help would be really appreciated. thank you for your time. I would like to learn how to figure this out to make mods in the future
package com.example.examplemod;
import net.minecraft.block.Block;
import net.minecraft.block.material.MaterialLogic;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod
{
public static final String MODID = "examplemod";
public static final String VERSION = "1.0";
public static Item amethyst;
public static Block amethystOre;
//Defining the blocks and items
@EventHandler
public void init(FMLInitializationEvent event)
{
amethyst = new Item();
GameRegistry.registerItem(amethyst, "amethyst");
amethystOre = new ModBlock(MaterialLogic.rock,
"amethystOre", amethyst);
GameRegistry.registerBlock(amethystOre, "amethystOre");
GameRegistry.registerWorldGenerator(new ModWorldGenerator(amethystOre, 6), 0);
}
}
package com.example.examplemod;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class ModBlock extends Block
{
//Makes it able for items to drop
private Item toDrop;
private Block amethyst;
//This Makes a new block & adds a tab for it in creative
public ModBlock(Material rock, String blockName, Item amethyst)
{
super(rock);
this.setBlockName(blockName);
this.setBlockTextureName(ExampleMod.MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
//Length to break block, iron is 3.0F and obby is
//50.0F
this.setHardness(4.0F);
/* takes name of tool that will break it and
* the number is what level the item is needed
wood is 0 with gold and diamond is 3*/
this.setHarvestLevel("pickaxe", 1);
//Helps the item actuall drop
this.toDrop = amethyst;
}
// this makes it possible for the item to drop
@Override
public Item getItemDropped(int i, Random random, int j)
{
if(toDrop != null)
{
return toDrop;
}
else return Item.getItemFromBlock(amethyst);
}
}
package com.example.examplemod;
import java.util.Random;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
public class ModWorldGenerator implements IWorldGenerator
{
private Block block;
private int veinSize;
ModWorldGenerator(Block block, int veinSize)
{
this.block = block;
this.veinSize = veinSize;
}
private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight)
{
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
{
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
}
int heightDiff = maxHeight - minHeight + 1;
for (int i = 0; i < chancesToSpawn; i ++)
{
int x = chunk_X * 16 + rand.nextInt(16);
int y = minHeight + rand.nextInt(heightDiff);
int z = chunk_Z * 16 + rand.nextInt(16);
generator.generate(world, rand, x, y, z);
}
}
public void generate1(Random random, int chunkX, int chunkZ,
World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider)
{
// TODO Auto-Generated Method Stub
if(world.provider.dimensionId == 0)
{
this.runGenerator(new WorldGenMinable(block, veinSize),
world, random, chunkX, chunkZ, 20, 0, 0);
}
}
//i got tired
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
// TODO Auto-generated method stub
}
}
package com.example.examplemod;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockOre;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLogic;
import net.minecraft.item.Item;
// This makes an item
public class ModItem extends Items
{
public ModItem(String itemName)
{
this.setUnlocalizedName(itemName);
this.setTextureName(ExampleMod.MODID + ":" + itemName);
this.setCreativeTab(CreativeTabs.tabMisc);
}
}
.Error with builds
PS C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src> ./gradlew build
#################################################
ForgeGradle 1.2-SNAPSHOT-fb514d3 https://github.com/MinecraftForge/ForgeGradle
#################################################
Powered by MCP unknown http://modcoderpack.com
by: Searge, ProfMobius, Fesh0r,
R4wk, ZeuX, IngisKahn, bspkrs
#################################################
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava UP-TO-DATE
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:17: error: cannot find symbol
this.setUnlocalizedName(itemName);
^
symbol: method setUnlocalizedName(String)
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:18: error: cannot find symbol
this.setTextureName(ExampleMod.MODID + ":" + itemName);
^
symbol: method setTextureName(String)
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:19: error: cannot find symbol
this.setCreativeTab(CreativeTabs.tabMisc);
^
symbol: method setCreativeTab(CreativeTabs)
3 errors
1 warning
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I was following this tutorial and ended up not being able to build the mod after the end of it...
So as any normal person would do i ended up trying to fix it myself and ended up bringing it down to 3 errors and unable to fix those.
Not too sure if what i did before was actually correct
This is all the code i used and the three that are still claiming to be a failure is the in the function ModItem.
which should be the last code block if i did it correctly.
After the code blocks should also be the error message i got each time i tried to build
Any help would be really appreciated. thank you for your time. I would like to learn how to figure this out to make mods in the future
.Error with builds
PS C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src> ./gradlew build
#################################################
ForgeGradle 1.2-SNAPSHOT-fb514d3
https://github.com/MinecraftForge/ForgeGradle
#################################################
Powered by MCP unknown
http://modcoderpack.com
by: Searge, ProfMobius, Fesh0r,
R4wk, ZeuX, IngisKahn, bspkrs
#################################################
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava UP-TO-DATE
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:17: error: cannot find symbol
this.setUnlocalizedName(itemName);
^
symbol: method setUnlocalizedName(String)
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:18: error: cannot find symbol
this.setTextureName(ExampleMod.MODID + ":" + itemName);
^
symbol: method setTextureName(String)
C:\Users\T3CH WORX\MinecraftMods\forge-1.7.10-10.13.4.1614-1.7.10-src\build\sources\java\com\example\examplemod\ModItem.java:19: error: cannot find symbol
this.setCreativeTab(CreativeTabs.tabMisc);
^
symbol: method setCreativeTab(CreativeTabs)
3 errors
1 warning
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.