EDIT:EDIT:Fixed the error..some how don't remember but I am now having block naming issues in game there both the same name.
I am trying to make multiple blocks using one id from your tutorial "Tutorial III"
The Error I am getting.
Edit:Fyi I have tried it with only ML/MLp/Forge witch is required.
Mods loaded: 40
ModLoader 1.1
mod_IDResolver 1.1 - Update 0
mod_InvTweaks 1.36 (1.1)
mod_ModLoaderMp 1.0.0
mod_NotEnoughItems 1.1.0
mod_ReiMinimap v3.0_01 [1.1]
mod_Somnia v18 [1.0.0]
mod_BuildCraftCore 3.1.3
mod_BuildCraftBuilders 3.1.3
mod_BuildCraftEnergy 3.1.3
mod_BuildCraftFactory 3.1.3
mod_BuildCraftTransport 3.1.3
mod_LogisticsPipes 0.1.8 (built with Minecraft 1.1.0, Buildcraft 3.1.2, Forge 1.3.1)
mod_BuildCraftSilicon 3.1.3
mod_zAdditionalPipes Rev34.0
mod_EnderChest 1.0.1
mod_EE Equivalent Exchange 6.0.0
mod_Forestry 1.3.0.3
mod_BuildCraftZFP (Forestry Package)
mod_IC2 v1.64
mod_BCIC2Crossover IBv0.05 for MC 1.1, BC 3.1.2, IC2 1.62
mod_IC2_ChargingBench 1.64-1
mod_IronChest 2.1
mod_RailcraftAutomation 3.2.1
mod_RailcraftBuildcraft 3.2.1
mod_RailcraftCore 3.2.1
mod_RailcraftExtras 3.2.1
mod_RailcraftFactory 3.2.1
mod_RailcraftInfrastructure 3.2.1
mod_RailcraftRails 3.2.1
mod_RedPowerArray 2.0pr4d
mod_RedPowerCore 2.0pr4d
mod_RedPowerLighting 2.0pr4d
mod_RedPowerLogic 2.0pr4d
mod_RedPowerMachine 2.0pr4d
mod_RedPowerWiring 2.0pr4d
mod_RedPowerWorld 2.0pr4d
mod_SneakyPipes 0.0.2 (Minecraft 1.1.0, Buildcraft 3.1.3, Forge 1.3.0)
mod_sT_Blocks 1.0.0
mod_WorldEditCUI 1.1a for Minecraft version 1.1
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT f4ffc60c --------
Generated 2/3/12 7:10 AM
Minecraft: Minecraft 1.1
OS: Windows 7 (amd64) version 6.1
Java: 1.6.0_26, Sun Microsystems Inc.
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: AMD Radeon HD 6800 Series version 4.2.11318 Compatibility Profile Context, ATI Technologies Inc.
java.lang.NullPointerException
at ModLoader.AddName(ModLoader.java:300)
at mod_sT_Blocks.load(mod_sT_Blocks.java:17)
at ModLoader.init(ModLoader.java:824)
at ModLoader.AddAllRenderers(ModLoader.java:189)
at afq.<init>(afq.java:80)
at afq.<clinit>(afq.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:265)
at net.minecraft.client.Minecraft.run(SourceFile:648)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT a587381b ----------
And If needed the source.
mod_sT_Blocks
package net.minecraft.src;
import java.io.File;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.src.forge.MinecraftForgeClient;
public class mod_sT_Blocks extends BaseModMp
{
public static final Block stBlocks;
public mod_sT_Blocks(){}
@Override
public void load()
{
//Adding Names:
ModLoader.AddName(new ItemStack(stBlocks,1,0),"RedStone Block");
ModLoader.AddName(new ItemStack(stBlocks,1,1),"Coal Block");
//BlockRegistering:
ModLoader.RegisterBlock(stBlocks);
//Texturing:
MinecraftForgeClient.preloadTexture("/st/sT_Blocks.png");
//Crafting Recipes:
ModLoader.AddRecipe(new ItemStack(stBlocks,1,0),new Object[]{"XXX","XXX","XXX",Character.valueOf('X'),Item.redstone});
ModLoader.AddRecipe(new ItemStack(stBlocks,1,1),new Object[]{"XXX","XXX","XXX",Character.valueOf('X'),Item.coal});
//Fuel
}
@Override
public String getVersion()
{
return ("1.0.0");
}
public static void prepareProps()
{
props.getInt("Blocks",213);
}
private static sT_Prop props;
static
{
props = new sT_Prop((new File((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/Config/sT_Blocks.cfg").toString())).getPath());
prepareProps();
stBlocks = new sT_Blocks(props.getInt("Blocks")).setHardness(1.0F).setResistance(25F).setBlockName("sT_Blocks");
}
}
sT_Blocks
package net.minecraft.src;
import java.util.Random;
import net.minecraft.src.forge.*;
public class sT_Blocks extends Block implements ITextureProvider
{
public sT_Blocks(int i)
{
super(i,0,Material.rock);
}
public int idDropped(int i,Random random,int j)
{
switch(i)
{
case 0: return mod_sT_Blocks.stBlocks.blockID;
case 1: return mod_sT_Blocks.stBlocks.blockID;
default: return Block.stone.blockID;
}
}
public int quantityDropped(int meta,int fortune,Random random)
{
switch(meta)
{
case 0: return 1;
case 1: return 1;
default: return 1;
}
}
protected int damageDropped(int i)
{
switch(i)
{
case 0: return 0;
case 1: return 1;
default: return 0;
}
}
public int getBlockTextureFromSideAndMetadata(int side,int meta)
{
switch(meta)
{
case 0: return 2;
case 1: return 1;
default: return 1;
}
}
public String getTextureFile()
{
return "/st/sT_Blocks.png";
}
}
The tutorials look great. I stopped reading about halfway through because I was just overwhelmed. I was really only checking it out for the possibility of implementing forge in the future but right now I think my mod will be fine. But like I said, it looks great. Very in depth and actually teaches people like you're trying to do. Bookmarking for later use +1.
EDIT- scratch that. figured it out. but now I have an entirely NEW problem. When placing blocks of any metadata the only block that ever gets placed is the first one. I can place the metadata blocks just fine with MCEdit and harvesting them works fine too. But when I place them down manually they simply revert to the default block. very annoying
Heres my code:
mod_atndblocks
package net.minecraft.src;
import net.minecraft.src.forge.*;
public class mod_atndblocks extends BaseMod
{
public static final Block ATNDBlock = new BlockATND(139).setHardness(1.0F).setBlockName("Attendee Deco Blocks");
//Declaration lines here
public void load()
{
ModLoader.RegisterBlock(ATNDBlock, net.minecraft.src.ItemATND.class);
ModLoader.AddName(new ItemStack(ATNDBlock , 1), "Polished Iron");
ModLoader.AddName(new ItemStack(ATNDBlock , 1, 1), "Small Wood Planks");
ModLoader.AddName(new ItemStack(ATNDBlock , 1, 2), "Bolted Iron");
ModLoader.AddName(new ItemStack(ATNDBlock , 1, 3), "Lapis Brick");
ModLoader.AddName(new ItemStack(ATNDBlock , 1, 4), "Block 5");
MinecraftForgeClient.preloadTexture("/ATND/cblocks.png");
ModLoader.AddRecipe(new ItemStack(ATNDBlock, 1, 0), new Object[]
{
"%", "#", Character.valueOf('%'), Item.paper, Character.valueOf('#'), Block.blockSteel
});
ModLoader.AddRecipe(new ItemStack(ATNDBlock, 1, 3), new Object[]
{
"@@", "@@", Character.valueOf('@'), Block.blockLapis
});
ModLoader.AddRecipe(new ItemStack(ATNDBlock, 1, 1), new Object[]
{
"$$", "$$", Character.valueOf('$'), Block.stairSingle
});
ModLoader.AddRecipe(new ItemStack(ATNDBlock, 1, 2), new Object[]
{
" ! ", "!#!", " ! ", Character.valueOf('!'), Item.ingotIron, Character.valueOf('#'), Block.blockSteel
});
ModLoader.AddShapelessRecipe(new ItemStack(ATNDBlock, 1, 2), new Object[]
{
new ItemStack(ATNDBlock, 1, 1)
});
FurnaceRecipes.smelting().addSmelting(ATNDBlock.blockID, 3, new ItemStack(mod_atndblocks.ATNDBlock, 1, 2));
}
public String getVersion()
{
return "1.0";
}
//Or here
}
BlockATND
package net.minecraft.src;
import net.minecraft.src.forge.*;
import java.util.Random;
public class BlockATND extends Block implements ITextureProvider
{
protected BlockATND(int i)
{
super(i, Material.rock);
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
{
switch(meta)
{
case 0: return 0;
case 1: return 1;
case 2: return 2;
case 3: return 3;
case 4: return 4;
case 5: return 5;
default: return 4;
}
}
public int idDropped(int meta, Random random, int j)
{
return blockID;
}
protected int damageDropped(int meta)
{
return meta;
}
public String getTextureFile()
{
return "/ATND/cblocks.png";
}
}
ItemATND
package net.minecraft.src;
public class ItemATND extends ItemBlock
{
public ItemATND(int i)
{
super(i);
setMaxDamage(0);
setHasSubtypes(true);
}
public String[] blockNames =
{
"Polished Iron", "Small Wooden Planks", "Bolted Iron", "Lapis Brick", "Block 5"
};
public String getItemNameIS(ItemStack itemstack)
{
return(new StringBuilder()).append(super.getItemName()).append(".").append(blockNames[itemstack.getItemDamage()]).toString();
}
public int getPlacedBlockMetadata(int i)
{
return i;
}
}
Hope you can lend me some insight!
Double edit:
never mind all squared out!
Suppose I wanted to make a new regular block, a new transparent block, and a new custom rendered block. Could I use metadata to group those together, or would I only be able to group like objects together? (Stairs with stairs, slabs with slabs, furnaces with furnaces, etc.)
Thanks to you, I was able to find a tutorial on making items with damage values. However, I have 9 item files that all have damage values. For some reason, only the names for the last sixteen are used, but the textures are the right ones, it's just the names. Any solutions?
EDIT: Never mind, worked out what to do. You just have to change the names in the item files, so if in one file you have "item1, item2, item3" you would have to change these to "item1a, item2a, item3a" in the second item file
EDIT:EDIT:Fixed the error..some how don't remember but I am now having block naming issues in game there both the same name.
I am trying to make multiple blocks using one id from your tutorial "Tutorial III"
The Error I am getting.
Edit:Fyi I have tried it with only ML/MLp/Forge witch is required.
Mods loaded: 40
ModLoader 1.1
mod_IDResolver 1.1 - Update 0
mod_InvTweaks 1.36 (1.1)
mod_ModLoaderMp 1.0.0
mod_NotEnoughItems 1.1.0
mod_ReiMinimap v3.0_01 [1.1]
mod_Somnia v18 [1.0.0]
mod_BuildCraftCore 3.1.3
mod_BuildCraftBuilders 3.1.3
mod_BuildCraftEnergy 3.1.3
mod_BuildCraftFactory 3.1.3
mod_BuildCraftTransport 3.1.3
mod_LogisticsPipes 0.1.8 (built with Minecraft 1.1.0, Buildcraft 3.1.2, Forge 1.3.1)
mod_BuildCraftSilicon 3.1.3
mod_zAdditionalPipes Rev34.0
mod_EnderChest 1.0.1
mod_EE Equivalent Exchange 6.0.0
mod_Forestry 1.3.0.3
mod_BuildCraftZFP (Forestry Package)
mod_IC2 v1.64
mod_BCIC2Crossover IBv0.05 for MC 1.1, BC 3.1.2, IC2 1.62
mod_IC2_ChargingBench 1.64-1
mod_IronChest 2.1
mod_RailcraftAutomation 3.2.1
mod_RailcraftBuildcraft 3.2.1
mod_RailcraftCore 3.2.1
mod_RailcraftExtras 3.2.1
mod_RailcraftFactory 3.2.1
mod_RailcraftInfrastructure 3.2.1
mod_RailcraftRails 3.2.1
mod_RedPowerArray 2.0pr4d
mod_RedPowerCore 2.0pr4d
mod_RedPowerLighting 2.0pr4d
mod_RedPowerLogic 2.0pr4d
mod_RedPowerMachine 2.0pr4d
mod_RedPowerWiring 2.0pr4d
mod_RedPowerWorld 2.0pr4d
mod_SneakyPipes 0.0.2 (Minecraft 1.1.0, Buildcraft 3.1.3, Forge 1.3.0)
mod_sT_Blocks 1.0.0
mod_WorldEditCUI 1.1a for Minecraft version 1.1
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
--- BEGIN ERROR REPORT f4ffc60c --------
Generated 2/3/12 7:10 AM
Minecraft: Minecraft 1.1
OS: Windows 7 (amd64) version 6.1
Java: 1.6.0_26, Sun Microsystems Inc.
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: AMD Radeon HD 6800 Series version 4.2.11318 Compatibility Profile Context, ATI Technologies Inc.
java.lang.NullPointerException
at ModLoader.AddName(ModLoader.java:300)
at mod_sT_Blocks.load(mod_sT_Blocks.java:17)
at ModLoader.init(ModLoader.java:824)
at ModLoader.AddAllRenderers(ModLoader.java:189)
at afq.<init>(afq.java:80)
at afq.<clinit>(afq.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:265)
at net.minecraft.client.Minecraft.run(SourceFile:648)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT a587381b ----------
And If needed the source.
mod_sT_Blocks
package net.minecraft.src;
import java.io.File;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.src.forge.MinecraftForgeClient;
public class mod_sT_Blocks extends BaseModMp
{
public static final Block stBlocks;
public mod_sT_Blocks(){}
@Override
public void load()
{
//Adding Names:
ModLoader.AddName(new ItemStack(stBlocks,1,0),"RedStone Block");
ModLoader.AddName(new ItemStack(stBlocks,1,1),"Coal Block");
//BlockRegistering:
ModLoader.RegisterBlock(stBlocks);
//Texturing:
MinecraftForgeClient.preloadTexture("/st/sT_Blocks.png");
//Crafting Recipes:
ModLoader.AddRecipe(new ItemStack(stBlocks,1,0),new Object[]{"XXX","XXX","XXX",Character.valueOf('X'),Item.redstone});
ModLoader.AddRecipe(new ItemStack(stBlocks,1,1),new Object[]{"XXX","XXX","XXX",Character.valueOf('X'),Item.coal});
//Fuel
}
@Override
public String getVersion()
{
return ("1.0.0");
}
public static void prepareProps()
{
props.getInt("Blocks",213);
}
private static sT_Prop props;
static
{
props = new sT_Prop((new File((new StringBuilder()).append(Minecraft.getMinecraftDir()).append("/Config/sT_Blocks.cfg").toString())).getPath());
prepareProps();
stBlocks = new sT_Blocks(props.getInt("Blocks")).setHardness(1.0F).setResistance(25F).setBlockName("sT_Blocks");
}
}
sT_Blocks
package net.minecraft.src;
import java.util.Random;
import net.minecraft.src.forge.*;
public class sT_Blocks extends Block implements ITextureProvider
{
public sT_Blocks(int i)
{
super(i,0,Material.rock);
}
public int idDropped(int i,Random random,int j)
{
switch(i)
{
case 0: return mod_sT_Blocks.stBlocks.blockID;
case 1: return mod_sT_Blocks.stBlocks.blockID;
default: return Block.stone.blockID;
}
}
public int quantityDropped(int meta,int fortune,Random random)
{
switch(meta)
{
case 0: return 1;
case 1: return 1;
default: return 1;
}
}
protected int damageDropped(int i)
{
switch(i)
{
case 0: return 0;
case 1: return 1;
default: return 0;
}
}
public int getBlockTextureFromSideAndMetadata(int side,int meta)
{
switch(meta)
{
case 0: return 2;
case 1: return 1;
default: return 1;
}
}
public String getTextureFile()
{
return "/st/sT_Blocks.png";
}
}
You need stBlocks = new BlockSt();
Or something like it your getting the error because stBlocks is equal to null
Edit:
Make your static{} a void and call it in the load method
The Block Meta Data with the forge Texturing the crafting always crafts only MultiBlock IV
I'm having this same problem. No matter what I do, all my recipes create "Multi Block IV". I can't get a recipe to create multi block i or ii or iii. I see some other folks had this issue and said they solved it. How did they do it?
Okay so I have made four multi-blocks. I have added all of the code and it all gives off no errors and everything works fine. Except, when I try to craft the block, the game crashes and throws off this error:
2012-07-31 01:43:53 [SEVERE] A critical error has occurred.
java.lang.NullPointerException
at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:106)
at net.minecraft.src.RenderItem.renderItemIntoGUI(RenderItem.java:292)
at net.minecraft.src.GuiContainer.drawSlotInventory(GuiContainer.java:223)
at net.minecraft.src.GuiContainer.drawScreen(GuiContainer.java:72)
at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:972)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:873)
at net.minecraft.client.Minecraft.run(Minecraft.java:750)
at java.lang.Thread.run(Unknown Source)
Here's my BlockMultiBlock.java:
package net.minecraft.src;
import java.util.Random;
import net.minecraft.src.forge.*;
public class BlockMultiBlock extends Block implements ITextureProvider
{
public BlockMultiBlock(int i)
{
super(i, 0, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_CarpentryCraft.blockMultiBlock.blockID;
}
public int quantityDropped(int meta, int fortune, Random random)
{
switch(meta)
{
case 0: return 0;
case 1: return 1;
case 2: return 2;
default: return 3;
}
}
public int damageDropped(int i)
{
switch(i)
{
case 0: return 0;
case 1: return 1;
default: return 0;
}
}
public int getTextureFromSideAndMetadata(int side, int meta)
{
return 0;
}
public String getTextureFile()
{
return "/carpentrycraft/terrain/terrain1.png";
}
}
and finally here is my mod_CarpentryCraft.java:
package net.minecraft.src;
import net.minecraft.src.forge.*;
public class mod_CarpentryCraft extends BaseMod
{
public mod_CarpentryCraft()
{
}
public static void methods()
{
blockRegisters();
addNames();
}
public static final Block blockMultiBlock = (new BlockMultiBlock(214)).setBlockName("blockMultiBlock");
public static void blockRegisters()
{
ModLoader.registerBlock(blockMultiBlock);
}
public static void addNames()
{
ModLoader.addName(new ItemStack(blockMultiBlock, 1, 0), "Block I");
ModLoader.addName(new ItemStack(blockMultiBlock, 1, 1), "Block II");
ModLoader.addName(new ItemStack(blockMultiBlock, 1, 2), "Block III");
ModLoader.addName(new ItemStack(blockMultiBlock, 1, 3), "Block IV");
}
public void load()
{
MinecraftForgeClient.preloadTexture("/carpentrycraft/terrain/terrain1.png");
ModLoader.addRecipe(new ItemStack(blockMultiBlock, 1, 1), new Object[] {
"#", Character.valueOf('#'), Block.dirt
});
}
public String getVersion()
{
return "1.2.5";
}
}
So, what's the issue? I remember my friend having this exact same problem and solving it but i am not sure how he did it and he is asleep right now.
Also, just as a side question, why Can't I put the recipe within its own "public static void addRecipes()" method like I did with everything else? Why do I have to put it in the "public void load()" method? I don't have to when I am using just modloader, and that is how I like to organize my code. I'm just wondering. Thanks.
Rollback Post to RevisionRollBack
"If you wish make an apple pie from scratch, you must first invent the universe." -- Carl Sagan
I made a metadata item, but it doesn't show up in creative as it should. The first item (with the ,0-id) shows up, but not the others. Why is the error?
I am having the same issue. Bear in mind, I'm using MCP7.0a, with 1.3.1, and all it takes to display something in the creative inventory is to say:
xxx.setTabToDisplayOn(CreativeTabs.tabTools);
for example, to make it display on the Tools tab. However, only the item with the 0 id shows up.
Rollback Post to RevisionRollBack
Learn some Java before you mod, and skip over the chapter on ModLoader, straight to MinecraftForge. It's better. Trust me.
I am trying to make multiple blocks using one id from your tutorial "Tutorial III"
The Error I am getting.
Edit:Fyi I have tried it with only ML/MLp/Forge witch is required.
And If needed the source.
sT_Blocks
EDIT- scratch that. figured it out. but now I have an entirely NEW problem. When placing blocks of any metadata the only block that ever gets placed is the first one. I can place the metadata blocks just fine with MCEdit and harvesting them works fine too. But when I place them down manually they simply revert to the default block. very annoying
Heres my code:
mod_atndblocks
BlockATND
ItemATND
Hope you can lend me some insight!
Double edit:
never mind all squared out!
Thanks to you, I was able to find a tutorial on making items with damage values. However, I have 9 item files that all have damage values. For some reason, only the names for the last sixteen are used, but the textures are the right ones, it's just the names. Any solutions?EDIT: Never mind, worked out what to do. You just have to change the names in the item files, so if in one file you have "item1, item2, item3" you would have to change these to "item1a, item2a, item3a" in the second item file
You need stBlocks = new BlockSt();
Or something like it your getting the error because stBlocks is equal to null
Edit:
Make your static{} a void and call it in the load method
I'm having this same problem. No matter what I do, all my recipes create "Multi Block IV". I can't get a recipe to create multi block i or ii or iii. I see some other folks had this issue and said they solved it. How did they do it?
peace
Plant Life, Trees, Flowers, Food and Farming! Pam's mods.
Here's my BlockMultiBlock.java:
and finally here is my mod_CarpentryCraft.java:
So, what's the issue? I remember my friend having this exact same problem and solving it but i am not sure how he did it and he is asleep right now.
Also, just as a side question, why Can't I put the recipe within its own "public static void addRecipes()" method like I did with everything else? Why do I have to put it in the "public void load()" method? I don't have to when I am using just modloader, and that is how I like to organize my code. I'm just wondering. Thanks.
I am having the same issue. Bear in mind, I'm using MCP7.0a, with 1.3.1, and all it takes to display something in the creative inventory is to say:
for example, to make it display on the Tools tab. However, only the item with the 0 id shows up.
And I am about to test this, but I think if you change it to it'll do the same for blocks.