Great tutorials! Just one question. How do you get the block to look like your texture if its in your inventory. When I pick up my block, it is purple and when I place it again it is still purple. I know that means missing texture so where do you put the texture?
The texture for your blocks or items should be in Your MCP Directory > bin > minecraft. For organizational purposes, it might be good to create a folder in here. For the sake of this example, we'll call the folder "Example". So then you'd put your textures in Your MCP Directory > bin > minecraft > Example.
After you put them in there, code for texture overrides would looks similar to his:
I found the answer to my question but now I have 1 more if anyone can answer it I will appreciate it.
I created my mod but I need it to be bigger. I was messing with the model code and I found out how to make him bigger,wider, etc. But the texture got all messed up. So lets say the leg wasn't tall enough, I mess with the code and get the leg where it need to be but the texture is all messed up/parts missing but if I mess with the texture part for that leg it doesn't do anything. Can anybody help me with this?
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Thanks for the help guys
made some changes, also I did not forget to add the modloader, turns out I forgot to capitalize the M in BaseMod
but now I got an actual error when I ran the game.
error report:
Mods loaded: 1
ModLoader 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 9f578458 --------
Generated 6/9/12 11:32 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.6.0_25, Sun Microsystems Inc.
VM: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: ATI Radeon HD 3450 version 2.1.8787, ATI Technologies Inc.
java.lang.Error: Unresolved compilation problem:
The method setBlockName(String) is undefined for the type BlockCobblestoneBrick
at net.minecraft.src.mod_Block.<init>(mod_Block.java:6)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT ebf282c ----------
code for the 2 files I created:
package net.minecraft.src;
public class mod_Block extends BaseMod
{
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0) .setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
CobblestoneBrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mcp62/eclipse/Client/bin/mods/Paranoidweazle's CastleMod v1.0/CobblestoneBrick.png");
ModLoader.registerBlock(CobblestoneBrick);
ModLoader.addName(CobblestoneBrick, "Cobblestone Brick");
ModLoader.addRecipe(new ItemStack(CobblestoneBrick, 4), new Object [] {"##", "##", Character.valueOf('#'), Block.cobblestone});
}
public String getVersion()
{
return "1.2.5";
}
}
for this code, in eclipse, it told me that there was an error in .setBlockName: The method setBlockName(String) is undefined for the type BlockCobblestoneBrick
package net.minecraft.src;
import java.util.Random;
public class BlockCobblestoneBrick
{
public BlockCobblestoneBrick(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
return mod_Block.CobblestoneBrick.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
as for this one, an error in line 9, super(i, j, Material.rock); : The constructor Object(int, int, Material) is undefined, what would I use to define it? the tutorial wasn't too clear on that part :/
again, thanks for any help
In mod_Block, this:
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0) .setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);
Should be this:
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0).setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);
'.setBlockName("")' had a space in between it and '(123, 0)'.
Can somebody familiar to forge link me a list or write a list on things you can do with forge? I've used it a while now and I find many good uses for it, but I know it has to have more to offer than just texture indexing, right?
Here is a list of tutorials that show you how to do numerous things with Forge.
package net.minecraft.src;[/sup]
[sup]public class mod_lolbrick extends BaseMod
{
public static final Block lolbrick = new lolbrick(160,0).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);[/sup]
[sup] public void load()
{
lolbrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "lolblock.png");
ModLoader.registerBlock(lolbrick);
ModLoader.addName(lolbrick, "Block Of Yellow");
ModLoader.addRecipe(new ItemStack(lolbrick, 4), new Object [] {"###","@[email protected]","###", Character.valueOf('#'), Item.coal, Character.valueOf('~'),Block.redstoneLampIdle, Character.valueOf('@'),Block.planks});
}[/sup]
[sup] public static final Block blueblock = new blueblock (161,1).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);[/sup]
[sup] public void load1()
{
blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png");
ModLoader.registerBlock(blueblock);
ModLoader.addName(blueblock, "Block Of Blue");
ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}[/sup]
[sup] public String getVersion()
{
return "1.2.5";
}
}
>
When I run the client in Eclipse Minecraft opens normally, and the first block("lolblock" or "Block Of Yellow") in the code is craftable and works fine, however the second block in the code ("Block Of Blue") is not craftable and does not show up in the game at all. As far as I know there are no bugs in the code show here or in the blueblock.java file
Put all the code for blue block:
blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png");
ModLoader.registerBlock(blueblock);
ModLoader.addName(blueblock, "Block Of Blue");
ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt});
into the load() method.
public void load()
{
lolbrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "lolblock.png");
ModLoader.registerBlock(lolbrick);
ModLoader.addName(lolbrick, "Block Of Yellow");
ModLoader.addRecipe(new ItemStack(lolbrick, 4), new Object [] {"###","@[email protected]","###", Character.valueOf('#'), Item.coal, Character.valueOf('~'),Block.redstoneLampIdle, Character.valueOf('@'),Block.planks});
blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png");
ModLoader.registerBlock(blueblock);
ModLoader.addName(blueblock, "Block Of Blue");
ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
It wont be read if it is in a method called load1().
public static final Block blueblock = new blueblock (161,1).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);
Needs to be here:
public class mod_lolbrick extends BaseMod
{
public static final Block lolbrick = new lolbrick(160,0).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);
public static final Block blueblock = new blueblock (161,1).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);
public void load()
The location of the instantiation lines does not matter as long as they aren't in a method and still inside the class braces.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Hey TechGuy, what's the best way to make it so that when you put a block in a chest, it turns into a diamond block and a gold block?
You would need to edit TileEntityChest and add a check to the itemId of the itemstack that is added. If the id of the itemstack is equal to your block then set the stack in the slot to your new thing. I'm not sure of the method names to use though.
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;[/sup]
[sup]public class mod_lolbrick extends BaseMod
{
public static final Block lolbrick = new lolbrick(160,0).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);[/sup]
[sup] public void load()
{
lolbrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "lolblock.png");
ModLoader.registerBlock(lolbrick);
ModLoader.addName(lolbrick, "Block Of Yellow");
ModLoader.addRecipe(new ItemStack(lolbrick, 4), new Object [] {"###","@[email protected]","###", Character.valueOf('#'), Item.coal, Character.valueOf('~'),Block.redstoneLampIdle, Character.valueOf('@'),Block.planks});
}[/sup]
[sup] public static final Block blueblock = new blueblock (161,1).setBlockName("lolbrick").setHardness(3F).setResistance(2F).setLightValue(-15F);[/sup]
[sup] public void load1()
{
blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png");
ModLoader.registerBlock(blueblock);
ModLoader.addName(blueblock, "Block Of Blue");
ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}[/sup]
[sup] public String getVersion()
{
return "1.2.5";
}
}
> When I run the client in Eclipse Minecraft opens normally, and the first block("lolblock" or "Block Of Yellow") in the code is craftable and works fine, however the second block in the code ("Block Of Blue") is not craftable and does not show up in the game at all. As far as I know there are no bugs in the code show here or in the blueblock.java file
You never declared your blueblock. (< disregard that, it's just in the wrong place. See this post) As alx2222 stated, place a public static final for your blueblock right under the one for your lolbrick.
You can also leave yourself comments in your code for organizational purposes. These comments will not effect the game at all, and will simply be for your eyes only. Like this:
The first comment is green, and turns the entire line it's placed on into a comment into a comment.
//Comment here
The second type creates basically the same, but with an explicit end. So, these comments can be placed directly in front of code as a label of sorts, or can have multiple lines to it.
Single line example:
/* Comment here */
Multiple line example:
/*Comment here
and here
and here
end comment*/
The third comment type is much like the second type from above, except that it's blue.
Single line example:
/** Blue comment here **/
Multiple line example:
/**Blue comment here
and here
and here
end Blue comment**/
You never declared your blueblock. As alx2222stated, place another public static final for your blueblock right under the one for your lolbrick.
You can also leave yourself comments in your code for organizational purposes. These comments will not effect the game at all, and will simply be for your eyes only. Like this:
//Comment here
/*Comment here
and here
and here
end comment*/
/**Blue comment here
and here
and here
end Blue comment**/
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
You know, I was thinking that it might be good if you made a (small) tutorial on how to make your mod_ file have several different items/blocks in it, as a lot of people seem to get confused when combining into one mod_ file (or with just making a mod with several different blocks in it) but that was just a thought.
You would need to edit TileEntityChest and add a check to the itemId of the itemstack that is added. If the id of the itemstack is equal to your block then set the stack in the slot to your new thing. I'm not sure of the method names to use though.
Dang. I'm trying to find a way to get a diamond and gold block out of an alloy.
You know, I was thinking that it might be good if you made a (small) tutorial on how to make your mod_ file have several different items/blocks in it, as a lot of people seem to get confused when combining into one mod_ file (or with just making a mod with several different blocks in it) but that was just a thought.
I think I should too.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
This is what I was talking about. I decided to make a quick Panda mob but for some reason its only as big as 1 block but I want it to be about as tall as a cow.
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0) .setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);
Should be this:
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0).setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);
'.setBlockName("")' had a space in between it and '(123, 0)'.
I just tried that, but it still gives me the same error :/
anything else I could try?
Edit: I found a way to fix it place a comma after 0: so it's (123,0,) however it says unexpected token, but I dont think that is a big error, that I should worry about, but I rather have the class error free, so if there is another solution, I'll try it.
but, I still get the error report when I run it, so could I get help on that?
package net.minecraft.src;
import java.util.Map;
import net.minecraft.client.Minecraft;
import java.util.List;
public class mod_MangMod extends BaseMod
{
public static final Block aliengrass = new aliengrass(160, 0).setBlockName("aliengrass").setHardness(0.5F).setResistance(4F);
public static int NamehereBottom = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassbottom.png");
public static int NamehereTop = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrasstop.png");
public static int NamehereSides = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassside.png");
public static final Item glasscup = new Item(5000).setItemName("glasscup");
public static final Item applejuice = new Item(5001).setItemName("applejuice");
public static final Item donut = new ItemFood(5002, 4, 1F, false).setItemName("donut");
public static final Item glazeddonut = new ItemFood(5003, 6, 1F, false).setItemName("glazeddonut");
public static final Item diamondbucket = new Item(5004).setItemName("diamondbucket");
public static final Item orange = new ItemFood(5005, 4, 1F, false).setItemName("orange");
public static final Item bacon = new ItemFood(5006, 9, 1F, false).setItemName("bacon");
public static final Item eggsandwich = new ItemFood(5007, 11, 1F, false).setItemName("eggsandwich");
public void load()
{
ModLoader.registerEntityID(innocentvillager.class, "innocentvillager", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(innocentvillager.class, 5, 1, 1, EnumCreatureType.creature, new BiomeGenBase[]
{
BiomeGenBase.plains,
BiomeGenBase.desert,
BiomeGenBase.desertHills,
BiomeGenBase.beach,
BiomeGenBase.extremeHills,
BiomeGenBase.extremeHillsEdge,
BiomeGenBase.forest,
BiomeGenBase.forestHills,
BiomeGenBase.taiga,
BiomeGenBase.taigaHills,
BiomeGenBase.swampland,
BiomeGenBase.river,
BiomeGenBase.jungle,
BiomeGenBase.jungleHills
});
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrass.png");
ModLoader.registerBlock(aliengrass);
ModLoader.addName(aliengrass, "Alien Grass");
ModLoader.addRecipe(new ItemStack(aliengrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
glasscup.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glasscup.png");
ModLoader.addName(glasscup, "Glass Cup");
ModLoader.addRecipe(new ItemStack(glasscup, 1), new Object [] {"# #", "###", Character.valueOf('#'), Block.glass});
applejuice.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/applejuice.png");
ModLoader.addName(applejuice, "Apple Juice");
ModLoader.addRecipe(new ItemStack(applejuice, 1), new Object [] {"#", "#", "%", Character.valueOf('#'), Item.appleRed, Character.valueOf('%'), glasscup});
donut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/donut.png");
ModLoader.addName(donut, "Donut");
ModLoader.addRecipe(new ItemStack(donut, 4), new Object [] {"###", "# #", "###", Character.valueOf('#'), Item.wheat});
glazeddonut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glazeddonut.png");
ModLoader.addName(glazeddonut, "Glazed Donut");
ModLoader.addRecipe(new ItemStack(glazeddonut, 1), new Object [] {"#", "%", Character.valueOf('#'), Item.sugar, Character.valueOf('%'), donut});
diamondbucket.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/diamondbucket.png");
ModLoader.addName(diamondbucket, "Diamond Bucket");
ModLoader.addRecipe(new ItemStack(diamondbucket, 1), new Object [] {"# #", " # ", Character.valueOf('#'), Item.diamond});
orange.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/orange.png");
ModLoader.addName(orange, "Orange");
bacon.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/bacon.png");
ModLoader.addName(bacon, "Bacon");
ModLoader.addSmelting(Item.porkCooked.shiftedIndex, new ItemStack(bacon, 1));
eggsandwich.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/eggsandwich.png");
ModLoader.addName(eggsandwich, "Egg Sandwich");
ModLoader.addRecipe(new ItemStack(eggsandwich, 1), new Object [] {"#", "%", "#", Character.valueOf('#'), Item.bread, Character.valueOf('%'), Item.egg});
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if(minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(glasscup, 1, i));
list.add(new ItemStack(applejuice, 1, i));
list.add(new ItemStack(donut, 1, i));
list.add(new ItemStack(glazeddonut, 1, i));
list.add(new ItemStack(diamondbucket, 1, i));
list.add(new ItemStack(orange, 1, i));
list.add(new ItemStack(bacon, 1, i));
list.add(new ItemStack(eggsandwich, 1, i));
}
creativeInventory = guiscreen;
return true;
}
private static GuiScreen creativeInventory;
public void addRenderer(Map map)
{
map.put(innocentvillager.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.5";
}
}
aliengrass.java
package net.minecraft.src;
public class aliengrass extends Block
{
public aliengrass(int i, int j)
{
super(i, j, Material.wood);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
return getBlockTextureFromSide(i);
}
public int getBlockTextureFromSide(int i)
{
if (i == 0)
{
return mod_MangMod.aliengrassbottom;
}
if (i == 1)
{
return mod_MangMod.aliengrassrop;
}
else
{
return mod_MangMod.aliengrassside;
}
}
}
package net.minecraft.src;
import java.util.Map;
import net.minecraft.client.Minecraft;
import java.util.List;
public class mod_MangMod extends BaseMod
{
public static final Block aliengrass = new aliengrass(160, 0).setBlockName("aliengrass").setHardness(0.5F).setResistance(4F);
public static int NamehereBottom = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassbottom.png");
public static int NamehereTop = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrasstop.png");
public static int NamehereSides = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassside.png");
public static final Item glasscup = new Item(5000).setItemName("glasscup");
public static final Item applejuice = new Item(5001).setItemName("applejuice");
public static final Item donut = new ItemFood(5002, 4, 1F, false).setItemName("donut");
public static final Item glazeddonut = new ItemFood(5003, 6, 1F, false).setItemName("glazeddonut");
public static final Item diamondbucket = new Item(5004).setItemName("diamondbucket");
public static final Item orange = new ItemFood(5005, 4, 1F, false).setItemName("orange");
public static final Item bacon = new ItemFood(5006, 9, 1F, false).setItemName("bacon");
public static final Item eggsandwich = new ItemFood(5007, 11, 1F, false).setItemName("eggsandwich");
public void load()
{
ModLoader.registerEntityID(innocentvillager.class, "innocentvillager", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(innocentvillager.class, 5, 1, 1, EnumCreatureType.creature, new BiomeGenBase[]
{
BiomeGenBase.plains,
BiomeGenBase.desert,
BiomeGenBase.desertHills,
BiomeGenBase.beach,
BiomeGenBase.extremeHills,
BiomeGenBase.extremeHillsEdge,
BiomeGenBase.forest,
BiomeGenBase.forestHills,
BiomeGenBase.taiga,
BiomeGenBase.taigaHills,
BiomeGenBase.swampland,
BiomeGenBase.river,
BiomeGenBase.jungle,
BiomeGenBase.jungleHills
});
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrass.png");
ModLoader.registerBlock(aliengrass);
ModLoader.addName(aliengrass, "Alien Grass");
ModLoader.addRecipe(new ItemStack(aliengrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
glasscup.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glasscup.png");
ModLoader.addName(glasscup, "Glass Cup");
ModLoader.addRecipe(new ItemStack(glasscup, 1), new Object [] {"# #", "###", Character.valueOf('#'), Block.glass});
applejuice.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/applejuice.png");
ModLoader.addName(applejuice, "Apple Juice");
ModLoader.addRecipe(new ItemStack(applejuice, 1), new Object [] {"#", "#", "%", Character.valueOf('#'), Item.appleRed, Character.valueOf('%'), glasscup});
donut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/donut.png");
ModLoader.addName(donut, "Donut");
ModLoader.addRecipe(new ItemStack(donut, 4), new Object [] {"###", "# #", "###", Character.valueOf('#'), Item.wheat});
glazeddonut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glazeddonut.png");
ModLoader.addName(glazeddonut, "Glazed Donut");
ModLoader.addRecipe(new ItemStack(glazeddonut, 1), new Object [] {"#", "%", Character.valueOf('#'), Item.sugar, Character.valueOf('%'), donut});
diamondbucket.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/diamondbucket.png");
ModLoader.addName(diamondbucket, "Diamond Bucket");
ModLoader.addRecipe(new ItemStack(diamondbucket, 1), new Object [] {"# #", " # ", Character.valueOf('#'), Item.diamond});
orange.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/orange.png");
ModLoader.addName(orange, "Orange");
bacon.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/bacon.png");
ModLoader.addName(bacon, "Bacon");
ModLoader.addSmelting(Item.porkCooked.shiftedIndex, new ItemStack(bacon, 1));
eggsandwich.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/eggsandwich.png");
ModLoader.addName(eggsandwich, "Egg Sandwich");
ModLoader.addRecipe(new ItemStack(eggsandwich, 1), new Object [] {"#", "%", "#", Character.valueOf('#'), Item.bread, Character.valueOf('%'), Item.egg});
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if(minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(glasscup, 1, i));
list.add(new ItemStack(applejuice, 1, i));
list.add(new ItemStack(donut, 1, i));
list.add(new ItemStack(glazeddonut, 1, i));
list.add(new ItemStack(diamondbucket, 1, i));
list.add(new ItemStack(orange, 1, i));
list.add(new ItemStack(bacon, 1, i));
list.add(new ItemStack(eggsandwich, 1, i));
}
creativeInventory = guiscreen;
return true;
}
private static GuiScreen creativeInventory;
public void addRenderer(Map map)
{
map.put(innocentvillager.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.5";
}
}
aliengrass.java
package net.minecraft.src;
public class aliengrass extends Block
{
public aliengrass(int i, int j)
{
super(i, j, Material.wood);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
return getBlockTextureFromSide(i);
}
public int getBlockTextureFromSide(int i)
{
if (i == 0)
{
return mod_MangMod.aliengrassbottom;
}
if (i == 1)
{
return mod_MangMod.aliengrassrop;
}
else
{
return mod_MangMod.aliengrassside;
}
}
}
Your aliengrass.java is trying to read from the ints you declared. But you didn't change the substitutes to reflect your personal block...
The code should look like this in your mod_* class.
public static int aliengrassbottom = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassbottom.png");
public static int aliengrassrop = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrasstop.png");
public static int aliengrassside = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassside.png");
(!) NOTE: The fix I just posted above also reflects a spelling mistake from your aliengrass.java code. ("aliengrassrop"). So, if you fix it in the aliengrass.java, also fix it in your mod_*.
I've recompiled minecraft.jar using MCP and moved my class files into a new minecraft.jar with modloader installed.Where do I put my textures in .minecraft if I said in the code to put them in \mcp62\bin\minecraft\items?
Also the method to fix my mod alx2222 posted worked fine.Thanks!
To test the code, you don't need to put them in the .jar at all. You just need to put them in a new folder at yourMCP directory > bin > minecraft.
So, inside of your MCP directory, open the folder called "bin". Inside that, open the "minecraft" folder. And finally, make a new folder here that reflects your texture override code, and place your textures inside of it.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffThe texture for your blocks or items should be in Your MCP Directory > bin > minecraft. For organizational purposes, it might be good to create a folder in here. For the sake of this example, we'll call the folder "Example". So then you'd put your textures in Your MCP Directory > bin > minecraft > Example.
After you put them in there, code for texture overrides would looks similar to his:
blockExample.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Example/blockExample.png");Hope that helps.
My Mod:
http://www.minecraftforum.net/topic/1275105-125-modloader-mo-stuff-mod-20-beta-incomplete-need-testers/
I created my mod but I need it to be bigger. I was messing with the model code and I found out how to make him bigger,wider, etc. But the texture got all messed up. So lets say the leg wasn't tall enough, I mess with the code and get the leg where it need to be but the texture is all messed up/parts missing but if I mess with the texture part for that leg it doesn't do anything. Can anybody help me with this?
together they are powerful beyond imagination."
In mod_Block, this:
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0) .setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);Should be this:
public static final Block CobblestoneBrick = new BlockCobblestoneBrick(123, 0).setBlockName("cobblestone brick").setHardness(3F).setResistance(4F).setLightValue(1F);'.setBlockName("")' had a space in between it and '(123, 0)'.
Here is a list of tutorials that show you how to do numerous things with Forge.
You need to use Forge API and set the harvest level of the block. Tutorial at the link I gave above.
Put all the code for blue block:
blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png"); ModLoader.registerBlock(blueblock); ModLoader.addName(blueblock, "Block Of Blue"); ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt});into the load() method.public void load() { lolbrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "lolblock.png"); ModLoader.registerBlock(lolbrick); ModLoader.addName(lolbrick, "Block Of Yellow"); ModLoader.addRecipe(new ItemStack(lolbrick, 4), new Object [] {"###","@[email protected]","###", Character.valueOf('#'), Item.coal, Character.valueOf('~'),Block.redstoneLampIdle, Character.valueOf('@'),Block.planks}); blueblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "blueblock.png"); ModLoader.registerBlock(blueblock); ModLoader.addName(blueblock, "Block Of Blue"); ModLoader.addRecipe(new ItemStack(blueblock, 2), new Object [] {"#", Character.valueOf('#'), Block.dirt}); }It wont be read if it is in a method called load1().
The location of the instantiation lines does not matter as long as they aren't in a method and still inside the class braces.
EDIT: It let me post!
together they are powerful beyond imagination."
You would need to edit TileEntityChest and add a check to the itemId of the itemstack that is added. If the id of the itemstack is equal to your block then set the stack in the slot to your new thing. I'm not sure of the method names to use though.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou never declared your blueblock.(< disregard that, it's just in the wrong place. See this post) As alx2222 stated, place a public static final for your blueblock right under the one for your lolbrick.You can also leave yourself comments in your code for organizational purposes. These comments will not effect the game at all, and will simply be for your eyes only. Like this:
The first comment is green, and turns the entire line it's placed on into a comment into a comment.
The second type creates basically the same, but with an explicit end. So, these comments can be placed directly in front of code as a label of sorts, or can have multiple lines to it.
The third comment type is much like the second type from above, except that it's blue.
They make things a lot easier to keep track of.
He did declare it, it is under the load method.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumDang. I'm trying to find a way to get a diamond and gold block out of an alloy.
I think I should too.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWell, you could make a new furnace-like block, that had one input and two outputs... Not sure how you would do this, but it could be done
I just tried that, but it still gives me the same error :/
anything else I could try?
Edit: I found a way to fix it place a comma after 0: so it's (123,0,) however it says unexpected token, but I dont think that is a big error, that I should worry about, but I rather have the class error free, so if there is another solution, I'll try it.
but, I still get the error report when I run it, so could I get help on that?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffOh. Explains why I didn't see it.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiummod_MangMod.java
package net.minecraft.src; import java.util.Map; import net.minecraft.client.Minecraft; import java.util.List; public class mod_MangMod extends BaseMod { public static final Block aliengrass = new aliengrass(160, 0).setBlockName("aliengrass").setHardness(0.5F).setResistance(4F); public static int NamehereBottom = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassbottom.png"); public static int NamehereTop = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrasstop.png"); public static int NamehereSides = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassside.png"); public static final Item glasscup = new Item(5000).setItemName("glasscup"); public static final Item applejuice = new Item(5001).setItemName("applejuice"); public static final Item donut = new ItemFood(5002, 4, 1F, false).setItemName("donut"); public static final Item glazeddonut = new ItemFood(5003, 6, 1F, false).setItemName("glazeddonut"); public static final Item diamondbucket = new Item(5004).setItemName("diamondbucket"); public static final Item orange = new ItemFood(5005, 4, 1F, false).setItemName("orange"); public static final Item bacon = new ItemFood(5006, 9, 1F, false).setItemName("bacon"); public static final Item eggsandwich = new ItemFood(5007, 11, 1F, false).setItemName("eggsandwich"); public void load() { ModLoader.registerEntityID(innocentvillager.class, "innocentvillager", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(innocentvillager.class, 5, 1, 1, EnumCreatureType.creature, new BiomeGenBase[] { BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.beach, BiomeGenBase.extremeHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.jungle, BiomeGenBase.jungleHills }); Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrass.png"); ModLoader.registerBlock(aliengrass); ModLoader.addName(aliengrass, "Alien Grass"); ModLoader.addRecipe(new ItemStack(aliengrass, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt}); glasscup.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glasscup.png"); ModLoader.addName(glasscup, "Glass Cup"); ModLoader.addRecipe(new ItemStack(glasscup, 1), new Object [] {"# #", "###", Character.valueOf('#'), Block.glass}); applejuice.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/applejuice.png"); ModLoader.addName(applejuice, "Apple Juice"); ModLoader.addRecipe(new ItemStack(applejuice, 1), new Object [] {"#", "#", "%", Character.valueOf('#'), Item.appleRed, Character.valueOf('%'), glasscup}); donut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/donut.png"); ModLoader.addName(donut, "Donut"); ModLoader.addRecipe(new ItemStack(donut, 4), new Object [] {"###", "# #", "###", Character.valueOf('#'), Item.wheat}); glazeddonut.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/glazeddonut.png"); ModLoader.addName(glazeddonut, "Glazed Donut"); ModLoader.addRecipe(new ItemStack(glazeddonut, 1), new Object [] {"#", "%", Character.valueOf('#'), Item.sugar, Character.valueOf('%'), donut}); diamondbucket.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/diamondbucket.png"); ModLoader.addName(diamondbucket, "Diamond Bucket"); ModLoader.addRecipe(new ItemStack(diamondbucket, 1), new Object [] {"# #", " # ", Character.valueOf('#'), Item.diamond}); orange.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/orange.png"); ModLoader.addName(orange, "Orange"); bacon.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/bacon.png"); ModLoader.addName(bacon, "Bacon"); ModLoader.addSmelting(Item.porkCooked.shiftedIndex, new ItemStack(bacon, 1)); eggsandwich.iconIndex = ModLoader.addOverride("/gui/items.png", "/mangmod/eggsandwich.png"); ModLoader.addName(eggsandwich, "Egg Sandwich"); ModLoader.addRecipe(new ItemStack(eggsandwich, 1), new Object [] {"#", "%", "#", Character.valueOf('#'), Item.bread, Character.valueOf('%'), Item.egg}); ModLoader.setInGameHook(this, true, false); ModLoader.setInGUIHook(this, true, false); } public boolean onTickInGame(float f, Minecraft minecraft) { if(minecraft.currentScreen == null) { creativeInventory = null; } return true; } public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen) { if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote) { Container container = ((GuiContainer)guiscreen).inventorySlots; List list = ((ContainerCreative)container).itemList; int i = 0; list.add(new ItemStack(glasscup, 1, i)); list.add(new ItemStack(applejuice, 1, i)); list.add(new ItemStack(donut, 1, i)); list.add(new ItemStack(glazeddonut, 1, i)); list.add(new ItemStack(diamondbucket, 1, i)); list.add(new ItemStack(orange, 1, i)); list.add(new ItemStack(bacon, 1, i)); list.add(new ItemStack(eggsandwich, 1, i)); } creativeInventory = guiscreen; return true; } private static GuiScreen creativeInventory; public void addRenderer(Map map) { map.put(innocentvillager.class, new RenderBiped(new ModelBiped(), 0.5F)); } public String getVersion() { return "1.2.5"; } }aliengrass.java
package net.minecraft.src; public class aliengrass extends Block { public aliengrass(int i, int j) { super(i, j, Material.wood); } public int getBlockTextureFromSideAndMetadata(int i, int j) { return getBlockTextureFromSide(i); } public int getBlockTextureFromSide(int i) { if (i == 0) { return mod_MangMod.aliengrassbottom; } if (i == 1) { return mod_MangMod.aliengrassrop; } else { return mod_MangMod.aliengrassside; } } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffYour aliengrass.java is trying to read from the ints you declared. But you didn't change the substitutes to reflect your personal block...
The code should look like this in your mod_* class.
public static int aliengrassbottom = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassbottom.png"); public static int aliengrassrop = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrasstop.png"); public static int aliengrassside = ModLoader.addOverride("/terrain.png", "/mangmod/aliengrassside.png");(!) NOTE: The fix I just posted above also reflects a spelling mistake from your aliengrass.java code. ("aliengrassrop"). So, if you fix it in the aliengrass.java, also fix it in your mod_*.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffTo test the code, you don't need to put them in the .jar at all. You just need to put them in a new folder at your MCP directory > bin > minecraft.
So, inside of your MCP directory, open the folder called "bin". Inside that, open the "minecraft" folder. And finally, make a new folder here that reflects your texture override code, and place your textures inside of it.