Hi TechGuy,
I just tried to code a little Minecraft Mod but I always get it wrong.
This Mod should basicly add a new block to the game (recepe just a placeholder) but I always get the same error.
I dont know if I'm just stupid (btw. my first mod) or something.
mod_block.java
package net.minecraft.src;
import java.util.Random;
public class mod_Block extends BaseMod
{
public static final Block HayBlock = new BlockHay(1550,0).setHardness(0.1F).setResistance(5.0F).setBlockName("Hay").setLightValue(1F);
public void load()
{
HayBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/HayBlock.png");
ModLoader.registerBlock(HayBlock);
ModLoader.addName(HayBlock, "Hay");
ModLoader.addRecipe(new ItemStack(HayBlock, 1), new Object []{ "#", Character.valueOf('#'), Block.dirt});
}
public String Version()
{
return "1.2.3";
}
}
BlockHay.java
package net.minecraft.src;
import java.util.Random;
public class BlockHay extends Block
{
protected BlockHay (int i, int j)
{
super(i,j,Material.wood);
}
public int idDropped(int i, Random random)
{
return Item.wheat.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 4;
}
}
If I'm just stupid - sorry for getting on your nerves.
Thanks
(Sorry for the bad English - I'm German)
I should probably report the error:
I coded it in Eclipse and it always says:
The type mod_Block must implement the inherited abstract method BaseMod.getVersion()
Change your code to this
package net.minecraft.src;
import java.util.Random;
public class mod_Block extends BaseMod
{
public static final Block HayBlock = new BlockHay(200, ModLoader.addOverride("/terrain.png", "/HayBlock.png")).setHardness(0.1F).setResistance(5F).setBlockName("Hay").setLightValue(1F);
public mod_Block()
{
ModLoader.registerBlock(HayBlock);
ModLoader.addName(HayBlock, "Hay");
ModLoader.addRecipe(new ItemStack(HayBlock, 1), new Object []
{
"#", Character.valueOf('#'), Block.dirt
});
}
public void load()
{
}
public String getVersion()
{
return "1.2.3";
}
}
Also the image should be directed to wherever you saved it. I hope this helps
Also, I am currently making a mod and I am trying to have a mob wear armor. How would I go about doing that? I am using Techne to design the model but how do I code in for it to wear armor? cheers.
27 achievements
177 recipes
LWJGL Version: 2.4.2
ModLoader 1.2.3 Initializing...
Overriding /terrain.png with moondirt.png @ 168. 34 left.
Overriding /terrain.png with moongrasstop.png @ 169. 33 left.
Overriding /terrain.png with moongrasslado.png @ 170. 32 left.
Overriding /terrain.png with /moonsand.png @ 171. 31 left.
Overriding /terrain.png with /moonglass.png @ 172. 30 left.
Overriding /terrain.png with /moongrasslado.png @ 173. 29 left.
Overriding /terrain.png with /moon.png @ 184. 28 left.
Failed to load mod from "mod_moonbase.class"
Done.
WARNING: Found unknown Windows version: Windows 7
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
Starting up SoundSystem...
Initializing LWJGL OpenAL
(The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
OpenAL initialized.
java.lang.RuntimeException: java.lang.Exception: Image not found: moongrasstop.png
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1449)
at net.minecraft.src.ModLoader.onTick(ModLoader.java:1115)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:21)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:943)
at net.minecraft.client.Minecraft.run(Minecraft.java:799)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: Image not found: moongrasstop.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1035)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1441)
... 5 more
Stopping!
public static final Block moonstone = new Blockmoonstone (131,0) .setBlockName("moonstone").setHardness(1.8F).setResistance(3F).setLightValue(0.150F).setStepSound(Block.soundStoneFootstep);
public static final Block moonsand = new Blockmoonsand (132,0) .setBlockName("moonsand").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundSandFootstep);
public static final Block moonglass = new Blockmoonglass (139,0) .setBlockName("moonglass").setHardness(0.4F).setResistance(1F).setLightValue(0.500F).setStepSound(Block.soundGlassFootstep);
public static final Block moongrass = new Blockmoongrass (154,0) .setBlockName("moongrass").setHardness(0.8F).setResistance(2F).setLightValue(0.850F).setStepSound(Block.soundGravelFootstep);
public static int moongrassBottom = ModLoader.addOverride("/terrain.png", "moondirt.png");
public static int moongrassTop = ModLoader.addOverride("/terrain.png", "moongrasstop.png");
public static int moongrassSides = ModLoader.addOverride("/terrain.png", "moongrasslado.png");
public static final Block moondirt = new Blockmoondirt (135,0) .setBlockName("moondirt").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundGravelFootstep);
public void load()
{
ModLoader.registerBlock(moonstone);
Hi TechGuy,
I just tried to code a little Minecraft Mod but I always get it wrong.
This Mod should basicly add a new block to the game (recepe just a placeholder) but I always get the same error.
I dont know if I'm just stupid (btw. my first mod) or something.
mod_block.java
package net.minecraft.src;
import java.util.Random;
public class mod_Block extends BaseMod
{
public static final Block HayBlock = new BlockHay(1550,0).setHardness(0.1F).setResistance(5.0F).setBlockName("Hay").setLightValue(1F);
public void load()
{
HayBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/HayBlock.png");
ModLoader.registerBlock(HayBlock);
ModLoader.addName(HayBlock, "Hay");
ModLoader.addRecipe(new ItemStack(HayBlock, 1), new Object []{ "#", Character.valueOf('#'), Block.dirt});
}
public String Version()
{
return "1.2.3";
}
}
BlockHay.java
package net.minecraft.src;
import java.util.Random;
public class BlockHay extends Block
{
protected BlockHay (int i, int j)
{
super(i,j,Material.wood);
}
public int idDropped(int i, Random random)
{
return Item.wheat.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 4;
}
}
If I'm just stupid - sorry for getting on your nerves.
Thanks
(Sorry for the bad English - I'm German)
I should probably report the error:
I coded it in Eclipse and it always says:
The type mod_Block must implement the inherited abstract method BaseMod.getVersion()
Change
public String Version()
to
public String getVersion()
As someone said, you also need to have your block id under 256.
I am currently making a mod and I am trying to have a mob wear armor. How would I go about doing that? I am using Techne to design the model but how do I code in for it to wear armor? cheers.
You just need to add it into the model. There is no way of doing it in the code as far as I know. I just made a custom model for one of the mobs that wear armour in the mod I'm coding.
Whts is wrong with my Code? And some times appears String index Out of Range 4
Put a / before the name of the image in each of the overrides.
public static int moongrassBottom = ModLoader.addOverride("/terrain.png", "/moondirt.png");
public static int moongrassTop = ModLoader.addOverride("/terrain.png", "/moongrasstop.png");
public static int moongrassSides = ModLoader.addOverride("/terrain.png", "/moongrasslado.png");
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
uh can someone help? it says in the EntitySlab this line of code is "dead":
if (!super.shouldSideBeRendered(iblockaccess, i, j, k, l))
{
return false;
}and also in the mod_Block Character.valueOf gets a error i installed MCP correctly wtf is wrong
Why do you have an EntitySlab? Post the whole class, and your mod_ class too.
Oh, it's BlockSlab! *SUPER ULTRA MEGA MULITBLE 1000KPM FACEPALM*
This Block... Dont render with my texture... Always back to First Block or another, if I'm change the ID of Texture... Have something to do in this case?
And I realized that after I posted. But I do have another problem. I'm trying to test a crafting recipe for food with cocoa beans and it isn't working.
This is my code.
package net.minecraft.src;
public class mod_Chocolate extends BaseMod
{
public static final Item Chocolate = new ItemFood(309, 6, 1F, false).setItemName("Chocolate");
public void load()
{
Chocolate.iconIndex = ModLoader.addOverride("/gui/items.png", "/food/chocolate.png");
ModLoader.addName(Chocolate, "Chocolate");
ModLoader.addRecipe(new ItemStack(Chocolate, 1), new Object [] {"##", "##", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 3)});
}
public String getVersion()
{
return "1.2.3";
}
}
So I just finished coding and tested everything and it all works fine, but if I change my texturepack (only happens when I change to TPs with higher resolution than 16px) I get the placeholder as texture. Is there any way to get this arround somehow? Do I have to create a texture for every resolution? oO
I don't know anything about textures bigger than 16pixels, sorry.
But... I think have a another bug... All Blocks render correctly, except one...
This Block... Dont render with my texture... Always back to First Block or another, if I'm change the ID of Texture... Have something to do in this case?
And I realized that after I posted. But I do have another problem. I'm trying to test a crafting recipe for food with cocoa beans and it isn't working.
This is my code.
package net.minecraft.src;
public class mod_Chocolate extends BaseMod
{
public static final Item Chocolate = new ItemFood(309, 6, 1F, false).setItemName("Chocolate");
public void load()
{
Chocolate.iconIndex = ModLoader.addOverride("/gui/items.png", "/food/chocolate.png");
ModLoader.addName(Chocolate, "Chocolate");
ModLoader.addRecipe(new ItemStack(Chocolate, 1), new Object [] {"##", "##", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 3)});
}
public String getVersion()
{
return "1.2.3";
}
}
The recipes looks fine to me, try rewriting it again.
Make sure that your path is defining the right JDK version. I'd say that would probably be your main problem.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
package net.minecraft.src;
import java.util.Random;
import java.util.List;
public class mod_moonbase extends BaseMod
{
public static final Item bluedust = new Itembluedust(5000).setItemName("BlueStone");
public static final Block moonsand = new Blockmoonsand (132,0) .setBlockName("moonsand").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundSandFootstep);
public static final Block moonglass = new Blockmoonglass (133,0) .setBlockName("moonglass").setHardness(0.4F).setResistance(1F).setLightValue(0.500F).setStepSound(Block.soundGlassFootstep);
public static final Block moongrass = new Blockmoongrass (134,0) .setBlockName("moongrass").setHardness(0.8F).setResistance(2F).setLightValue(0.850F).setStepSound(Block.soundGravelFootstep);
public static final Block moondirt = new Blockmoondirt (135,0) .setBlockName("moondirt").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundGravelFootstep);
[b] public static final Block moonstone = new Blockmoonstone (131,0) .setBlockName("moonstone").setHardness(1.8F).setResistance(3F).setLightValue(0.150F).setStepSound(Block.soundStoneFootstep);[/b]
//Blocks with various texture
public static int moongrassBottom = ModLoader.addOverride("/terrain.png", "/moongrassbottom.png");
public static int moongrassTop = ModLoader.addOverride("/terrain.png", "/moongrasstop.png");
public static int moongrassSides = ModLoader.addOverride("/terrain.png", "/moongrasssides.png");
public void load()
//Blocks below
{
ModLoader.registerBlock(moonsand);
ModLoader.addName(moonsand,"Moonsand");
moonsand.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moonsand.png" );
ModLoader.addRecipe(new ItemStack(moonsand, 2), new Object[] {
"aaa", Character.valueOf('a'), Block.dirt
});
}
{
ModLoader.registerBlock(moonglass);
ModLoader.addName(moonglass,"MoonGlass");
moonglass.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moonglass.png" );
ModLoader.addSmelting(moonsand.blockID, new ItemStack(moonglass, 1));
};
{
ModLoader.registerBlock(moongrass);
ModLoader.addName(moongrass,"MoonGrass");
moongrass.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moongrasslado.png" );
ModLoader.addRecipe(new ItemStack(moongrass, 2), new Object[] {
"a", "b", "b", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
{
ModLoader.registerBlock(moonstone);
ModLoader.addName(moonstone,"MoonStone");
moonsand.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/MoonStone.png" );
ModLoader.addRecipe(new ItemStack(moonstone, 2), new Object[] {
"a", "b", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
}
{
ModLoader.registerBlock(moondirt);
ModLoader.addName(moondirt,"MoonDirt");
moondirt.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moondirt.png" );
ModLoader.addRecipe(new ItemStack(moondirt, 2), new Object[] {
"aa", "bb", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
}
//Items below
{
bluedust.iconIndex = ModLoader.addOverride("/gui/items.png", "/blue.png");
ModLoader.addName(bluedust, "BlueStone");
ModLoader.addRecipe(new ItemStack(bluedust, 5), new Object [] {"###", "#X#",Character.valueOf('X'), Item.redstone, Character.valueOf('#'), new ItemStack (Item.dyePowder, 1, 4)});
}
}
public String getVersion()
{
return "Minecraft Version 1.2_03";
}
}
package net.minecraft.src;
import java.util.Random;
public class Blockmoonstone extends Block
{
public Blockmoonstone(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return Block.cobblestone.blockID;
}
}
Make a Circuit, like a Redstone, is really hard? Or not so hard??
Hey Techguy I need some help I am trying to make a Transparent block, But.... There are a few errors. Help Please
mod_Pinkwindow:
package net.minecraft.src;
public class mod_Pinkwindow extends BaseMod
{
public static final Block Pinkwindow = new BlockPinkwindow(160, 0).setBlockName("Pinkwindow").setHardness(0.5F).setResistance(0.5F).setLightValue(0.5F);
public void load()
{
Pinkwindow.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Skins/Pinkwindow.png");
ModLoader.registerBlock(Pinkwindow);
ModLoader.addName(Pinkwindow, "Pink Glass");
ModLoader.addRecipe(new ItemStack(Pinkwindow, 4), new Object [] {"###", "%@%", "###", Character.valueOf('%'), Item.pinkdye, Character.valueOf('@'), Block.glass});
}
public String getVersion()
{
return "1.2_3";
}
}
BlockPinkwindow:
package net.minecraft.src;
public class BlockPinkwindow extends Block
{
public BlockPinkwindow(int i, int j)
{
super(i, j, Material.glass);
}
public boolean isOpaqueCube()
{
return false;
}
}
The error:
== MCP 6.0 (data: 6.0, client: 1.2.3, server: 1.2.3) ==
# 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_01\bin\javac" -g -source 1.6 -target 1.6 -class
path "lib;lib\*;jars\...' failed : 1
== ERRORS FOUND ==
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\net\minecraft\src\Mod_Pinkwindow.java:3: error: class mod_Pinkwind
ow is public, should be declared in a file named mod_Pinkwindow.java
public class mod_Pinkwindow extends BaseMod
^
src\minecraft\net\minecraft\src\Mod_Pinkwindow.java:12: error: cannot find symbo
l
ModLoader.addRecipe(new ItemStack(Pinkwindow, 4), new Object []
{"###", "%@%", "###", Character.valueOf('%'), Item.pinkdye, Character.valueOf('@
'), Block.glass});
^
symbol: variable pinkdye
location: class Item
2 errors
1 warning
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
Thanks.
Rollback Post to RevisionRollBack
How about you click that little + if I helped you, or you just <3 me :P.
package net.minecraft.src;
import java.util.Random;
import java.util.List;
public class mod_moonbase extends BaseMod
{
public static final Item bluedust = new Itembluedust(5000).setItemName("BlueStone");
public static final Block moonsand = new Blockmoonsand (132,0) .setBlockName("moonsand").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundSandFootstep);
public static final Block moonglass = new Blockmoonglass (133,0) .setBlockName("moonglass").setHardness(0.4F).setResistance(1F).setLightValue(0.500F).setStepSound(Block.soundGlassFootstep);
public static final Block moongrass = new Blockmoongrass (134,0) .setBlockName("moongrass").setHardness(0.8F).setResistance(2F).setLightValue(0.850F).setStepSound(Block.soundGravelFootstep);
public static final Block moondirt = new Blockmoondirt (135,0) .setBlockName("moondirt").setHardness(0.8F).setResistance(2F).setLightValue(0.750F).setStepSound(Block.soundGravelFootstep);
[b] public static final Block moonstone = new Blockmoonstone (131,0) .setBlockName("moonstone").setHardness(1.8F).setResistance(3F).setLightValue(0.150F).setStepSound(Block.soundStoneFootstep);[/b]
//Blocks with various texture
public static int moongrassBottom = ModLoader.addOverride("/terrain.png", "/moongrassbottom.png");
public static int moongrassTop = ModLoader.addOverride("/terrain.png", "/moongrasstop.png");
public static int moongrassSides = ModLoader.addOverride("/terrain.png", "/moongrasssides.png");
public void load()
//Blocks below
{
ModLoader.registerBlock(moonsand);
ModLoader.addName(moonsand,"Moonsand");
moonsand.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moonsand.png" );
ModLoader.addRecipe(new ItemStack(moonsand, 2), new Object[] {
"aaa", Character.valueOf('a'), Block.dirt
});
}
{
ModLoader.registerBlock(moonglass);
ModLoader.addName(moonglass,"MoonGlass");
moonglass.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moonglass.png" );
ModLoader.addSmelting(moonsand.blockID, new ItemStack(moonglass, 1));
};
{
ModLoader.registerBlock(moongrass);
ModLoader.addName(moongrass,"MoonGrass");
moongrass.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moongrasslado.png" );
ModLoader.addRecipe(new ItemStack(moongrass, 2), new Object[] {
"a", "b", "b", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
{
ModLoader.registerBlock(moonstone);
ModLoader.addName(moonstone,"MoonStone");
moonsand.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/MoonStone.png" );
ModLoader.addRecipe(new ItemStack(moonstone, 2), new Object[] {
"a", "b", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
}
{
ModLoader.registerBlock(moondirt);
ModLoader.addName(moondirt,"MoonDirt");
moondirt.blockIndexInTexture = ModLoader.addOverride( "/terrain.png", "/moondirt.png" );
ModLoader.addRecipe(new ItemStack(moondirt, 2), new Object[] {
"aa", "bb", Character.valueOf('a'), Block.dirt , Character.valueOf('b'), Block.sand
});
}
//Items below
{
bluedust.iconIndex = ModLoader.addOverride("/gui/items.png", "/blue.png");
ModLoader.addName(bluedust, "BlueStone");
ModLoader.addRecipe(new ItemStack(bluedust, 5), new Object [] {"###", "#X#",Character.valueOf('X'), Item.redstone, Character.valueOf('#'), new ItemStack (Item.dyePowder, 1, 4)});
}
}
public String getVersion()
{
return "Minecraft Version 1.2_03";
}
}
package net.minecraft.src;
import java.util.Random;
public class Blockmoonstone extends Block
{
public Blockmoonstone(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return Block.cobblestone.blockID;
}
}
Make a Circuit, like a Redstone, is really hard? Or not so hard??
Thank you for the fast Suport!
One thing I noticed is that you have capitals for your moon stone image and no others. You should get a crash if it isn't right, but just check it anyway.
For a redstone type block, it is sort of difficult. It just depends on how much experience with modding you have. Look at BlockRedstone for more info.
Hey Techguy I need some help I am trying to make a Transparent block, But.... There are a few errors. Help Please
mod_Pinkwindow:
package net.minecraft.src;
public class mod_Pinkwindow extends BaseMod
{
public static final Block Pinkwindow = new BlockPinkwindow(160, 0).setBlockName("Pinkwindow").setHardness(0.5F).setResistance(0.5F).setLightValue(0.5F);
public void load()
{
Pinkwindow.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Skins/Pinkwindow.png");
ModLoader.registerBlock(Pinkwindow);
ModLoader.addName(Pinkwindow, "Pink Glass");
ModLoader.addRecipe(new ItemStack(Pinkwindow, 4), new Object [] {"###", "%@%", "###", Character.valueOf('%'), Item.pinkdye, Character.valueOf('@'), Block.glass});
}
public String getVersion()
{
return "1.2_3";
}
}
BlockPinkwindow:
package net.minecraft.src;
public class BlockPinkwindow extends Block
{
public BlockPinkwindow(int i, int j)
{
super(i, j, Material.glass);
}
public boolean isOpaqueCube()
{
return false;
}
}
The error:
== MCP 6.0 (data: 6.0, client: 1.2.3, server: 1.2.3) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
&--#62; Cleaning bin
&--#62; Recompiling
'"C:\Program Files\Java\jdk1.7.0_01\bin\javac" -g -source 1.6 -target 1.6 -class
path "lib;lib\*;jars\...' failed : 1
== ERRORS FOUND ==
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\net\minecraft\src\Mod_Pinkwindow.java:3: error: class mod_Pinkwind
ow is public, should be declared in a file named mod_Pinkwindow.java
public class mod_Pinkwindow extends BaseMod
^
src\minecraft\net\minecraft\src\Mod_Pinkwindow.java:12: error: cannot find symbo
l
ModLoader.addRecipe(new ItemStack(Pinkwindow, 4), new Object []
{"###", "%@%", "###", Character.valueOf('%'), Item.pinkdye, Character.valueOf('@
'), Block.glass});
^
symbol: variable pinkdye
location: class Item
2 errors
1 warning
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
Thanks.
You need to make sure that the name of the actual .java file is the same as you have defined inside the class. The second error is that pinkdye doesn't exist. Pink dye is actually this:
Item.dyePowder, 1, 9
When used in recipes, even as an ingredient, it needs to be like this:
new ItemStack(Item.dyePower, 1, 9)
Also, you haven't defined what the # will do. If you just want the three items in the recipe, then just show them.
Your recipe should look like this:
ModLoader.addRecipe(new ItemStack(Pinkwindow, 4), new Object []
{"%@%", Character.valueOf('%'), new ItemStack(Item.dyePowder, 1, 9), Character.valueOf('@
'), Block.glass});
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Look at the Offspring info in the Achievement section.
Didn't you notice the your other achievement part in my post? I'm not talking about the default achievements. I'm trying to say this, I made 2 achievements, I want to know how to make it so that when you get the first achievement I made you are able to get the achievement for the second one. Hope that made sense.
Hi, I want to create a block that plays a custom sound when activated by redstone. Im a noob in this section, and have prepared the mod.class and block.class. However I do not know how to make it check for redstone input, or how to make it play a file from a folder.. Help?
Try simply copying the code from the noteblock. Although for custom sounds, you need audiomod and i typically stay away from that, so I really have no idea.
And here's the crash report when I try to recompile:
== MCP 6.0 (data: 6.0, client: 1.2.3, server: 1.2.3) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
&--#62; Cleaning bin
&--#62; Recompiling
'"C:\Program Files\Java\jdk1.7.0_01\bin\javac" -g -source 1.6 -target 1.6 -class
path "lib;lib\*;jars\...' failed : 1
== ERRORS FOUND ==
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\net\minecraft\src\GrimReaper.java:12: error: cannot find symbol
attackStrength = 4;
^
symbol: variable attackStrength
location: class GrimReaper
1 error
1 warning
==================
!! Can not find server sources, try decompiling !!
Make sure you read the notes that I put in the code and below it in the Understanding section. Your EntityNamehere class must extend EntityMob to use attackStrength and attack the player.
Hi there,
i've got a problem:
if i make two blocks both with diferent multiple textures, they look the same. For example i have a blockA with red on top and blue on the sides and blockB with yellow on top and green on the sides. I've scripted blockA first, copied the code and made blockB with a little bit tweaking and adjustment. But blockB does actually look like BlockA in Minecraft.
Is there any way to fix that problem?
mod_MinecartPlus:
package net.minecraft.src;
public class mod_MinecartPlus extends BaseMod{
//Blocks
public static final Block blockMinecartDispenser = new BlockMinecartDispenser(200, 0).setBlockName("minecartdispenser").setHardness(0.3F).setResistance(4F);
public static final Block blockMinecartCollecter = new BlockMinecartDispenser(201, 0).setBlockName("minecartcollecter").setHardness(0.3F).setResistance(4F);
@Override
public String getVersion() {
return "v1.2.3";
}
@Override
public void load() {
blockMinecartDispenser.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartDispenser/Base.png");
ModLoader.registerBlock(blockMinecartDispenser);
ModLoader.addName(blockMinecartDispenser, "Minecart Dispenser");
ModLoader.addRecipe(new ItemStack(blockMinecartDispenser, 1), new Object[] {
"M","D", Character.valueOf('M'), Item.minecartEmpty, Character.valueOf('D'), Block.dispenser
});
blockMinecartCollecter.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartCollecter/Base.png");
ModLoader.registerBlock(blockMinecartCollecter);
ModLoader.addName(blockMinecartCollecter, "Minecart Collecter");
ModLoader.addRecipe(new ItemStack(blockMinecartCollecter, 1), new Object[] {
"M","C", Character.valueOf('M'), Item.minecartEmpty, Character.valueOf('C'), Block.chest
});
}
}
BlockMinecartDispenser:
package net.minecraft.src;
import java.util.Random;
public class BlockMinecartDispenser extends Block {
private static int textureTopAndBottom = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartDispenser/TopAndBottom.png");
private static int textureFront = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartDispenser/Front.png");
private static int textureSide = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartDispenser/Side.png");
public BlockMinecartDispenser(int i, int j) {
super(i, j, Material.ground);
}
public int idDropped(int i, Random random, int j) {
return mod_MinecartPlus.blockMinecartDispenser.blockID;
}
public int quantityDropped(Random random) {
return 1;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4,
EntityLiving par5EntityLiving) {
int i = MathHelper
.floor_double((double) ((par5EntityLiving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
if (i == 0) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (i == 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (i == 2) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (i == 3) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
public void onNeighborBlockChange(World par1World, int par2, int par3,
int par4, int par5) {
if (par5 &--#62; 0 && Block.blocksList[par5].canProvidePower()) {
boolean flag = par1World.isBlockIndirectlyGettingPowered(par2,
par3, par4)
|| par1World.isBlockIndirectlyGettingPowered(par2,
par3 + 1, par4);
if (flag) {
par1World.scheduleBlockUpdate(par2, par3, par4, blockID,
tickRate());
}
}
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4,
Random par5Random) {
if (!par1World.isRemote
&& (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World
.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4))) {
dispenseMinecart(par1World, par2, par3, par4);
}
}
private void dispenseMinecart(World par1World, int par2, int par3, int par4) {
int i = par1World.getBlockMetadata(par2, par3, par4);
int j = 0;
int k = 0;
if (i == 3) {
k = 1;
} else if (i == 2) {
k = -1;
} else if (i == 5) {
j = 1;
} else {
j = -1;
}
double d = (double)par2 + (double)j * 0.6D + 0.5D;
double d1 = (double)par3 + 0.5D;
double d2 = (double)par4 + (double)k * 0.6D + 0.5D;
EntityMinecartND entityminecart = new EntityMinecartND(par1World, d + (double)j * 0.3D, d1 - 0.3D, d2 + (double)k * 0.3D, 0);
par1World.spawnEntityInWorld(entityminecart);
par1World.playAuxSFX(2000, (int)d, (int)d1, (int)d2, 1);
}
public int getBlockTextureFromSideAndMetadata(int i, int j) {
switch (i) {
case 0:
case 1:
// Top
return textureTopAndBottom;
// Front
default:
// if the asked face is equal with our front face, then give the
// integer of it.
if (i == j) {
// front
return textureFront;
} else {
// side
return textureSide;
}
}
}
}
BlockMinecartCollecter:
package net.minecraft.src;
import java.util.Random;
public class BlockMinecartCollecter extends Block {
private static int textureTopAndBottom = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartCollecter/TopAndBottom.png");
private static int textureFront = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartCollecter/Front.png");
private static int textureSide = ModLoader.addOverride("/terrain.png", "/minecartPlus/blockMinecartCollecter/Side.png");
public BlockMinecartCollecter(int i, int j) {
super(i, j, Material.ground);
}
public int idDropped(int i, Random random, int j) {
return mod_MinecartPlus.blockMinecartCollecter.blockID;
}
public int quantityDropped(Random random) {
return 1;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) {
int i = MathHelper.floor_double((double) ((par5EntityLiving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
if (i == 0) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
if (i == 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
}
if (i == 2) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
if (i == 3) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
}
@Override
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) {
//Checking if the entity collides is a minecart
if(entity instanceof EntityMinecart || entity instanceof EntityMinecartND) {
entity.setEntityDead();
System.out.print("Minecart Collided!");
}
}
public int getBlockTextureFromSideAndMetadata(int i, int j) {
switch (i) {
case 0:
case 1:
return textureTopAndBottom;
default:
// if the asked face is equal with our front face, then give the
// integer of it.
if (i == j) {
return textureFront;
} else {
return textureSide;
}
}
}
}
There is no error it's message i could post, so don't ask about the error message!
Cornyfisch
EDIT: Should i name it "Collecter" or "Collector"??? i'm german
It should be collector.
You obviously haven't used my tutorials on multi-textured blocks, so I'm not going to help. It sounds mean, but this is not a "post your problems here and I'll fix them for you" thread. That's what the Mod Development section is for. I'm only helping those who have used my tutorials and need help.
Hi, I want to create a block that plays a custom sound when activated by redstone. Im a noob in this section, and have prepared the mod.class and block.class. However I do not know how to make it check for redstone input, or how to make it play a file from a folder.. Help?
Try doing as Pollo_loco said. If you want custom sounds though, don't bother with AudioMod, see this tutorial.
Didn't you notice the your other achievement part in my post? I'm not talking about the default achievements. I'm trying to say this, I made 2 achievements, I want to know how to make it so that when you get the first achievement I made you are able to get the achievement for the second one. Hope that made sense.
TechGuy, could you show us how to make a mod that spawns a mob upon stacking few blocks, like with Snow Golems? I tried to take a look at iron golem and snow golem's codes but there was nothing related to the making of the mobs in there.
Look in BlockPumpkin as that is where the actual spawning of iron and snow golems takes place.
Hi! Could you also please do a tutorial for smp coding? How to make the items availible for smp?
I have to figure it out myself first. I know Flan has a tutorial on it, but it probably isn't updated. Once I've successfully ported the mod I'm coding to SMP, then I might make a tutorial
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Change your code to this
Also, I am currently making a mod and I am trying to have a mob wear armor. How would I go about doing that? I am using Techne to design the model but how do I code in for it to wear armor? cheers.
I have problems again...
Here the Code:
Whts is wrong with my Code? And some times appears String index Out of Range 4
Change
to
As someone said, you also need to have your block id under 256.
Are you running a 64 bit system?
You just put it inside your entity class somewhere. For example:
Look at the recipes section on the OP.
You just need to add it into the model. There is no way of doing it in the code as far as I know. I just made a custom model for one of the mobs that wear armour in the mod I'm coding.
Put a / before the name of the image in each of the overrides.
together they are powerful beyond imagination."
Oh, it's BlockSlab! *SUPER ULTRA MEGA MULITBLE 1000KPM FACEPALM*
But... I think have a another bug... All Blocks render correctly, except one...
This Block... Dont render with my texture... Always back to First Block or another, if I'm change the ID of Texture... Have something to do in this case?
This is my code.
No.
I don't know anything about textures bigger than 16pixels, sorry.
I'm not sure, post your code please.
Possibly.
What do you mean? Do you mean like you need to have an achievement to be able to get a new one?
The recipes looks fine to me, try rewriting it again.
Make sure that your path is defining the right JDK version. I'd say that would probably be your main problem.
together they are powerful beyond imagination."
Make a Circuit, like a Redstone, is really hard? Or not so hard??
Thank you for the fast Suport!
mod_Pinkwindow:
BlockPinkwindow:
The error:
Thanks.
Yes, but you have to get one of your other achievements to get it.
One thing I noticed is that you have capitals for your moon stone image and no others. You should get a crash if it isn't right, but just check it anyway.
For a redstone type block, it is sort of difficult. It just depends on how much experience with modding you have. Look at BlockRedstone for more info.
You need to make sure that the name of the actual .java file is the same as you have defined inside the class. The second error is that pinkdye doesn't exist. Pink dye is actually this:
When used in recipes, even as an ingredient, it needs to be like this:
Also, you haven't defined what the # will do. If you just want the three items in the recipe, then just show them.
Your recipe should look like this:
Look at the Offspring info in the Achievement section.
together they are powerful beyond imagination."
Didn't you notice the your other achievement part in my post? I'm not talking about the default achievements. I'm trying to say this, I made 2 achievements, I want to know how to make it so that when you get the first achievement I made you are able to get the achievement for the second one. Hope that made sense.
Try simply copying the code from the noteblock. Although for custom sounds, you need audiomod and i typically stay away from that, so I really have no idea.
Make sure you read the notes that I put in the code and below it in the Understanding section. Your EntityNamehere class must extend EntityMob to use attackStrength and attack the player.
It should be collector.
You obviously haven't used my tutorials on multi-textured blocks, so I'm not going to help. It sounds mean, but this is not a "post your problems here and I'll fix them for you" thread. That's what the Mod Development section is for. I'm only helping those who have used my tutorials and need help.
Try doing as Pollo_loco said. If you want custom sounds though, don't bother with AudioMod, see this tutorial.
Post your code so I can give you an example.
Look in BlockPumpkin as that is where the actual spawning of iron and snow golems takes place.
I don't know, I've been kind of busy lately. It should be soon though.
I have to figure it out myself first. I know Flan has a tutorial on it, but it probably isn't updated. Once I've successfully ported the mod I'm coding to SMP, then I might make a tutorial
together they are powerful beyond imagination."
Okay then. Thanks.