Question:
Help with programming a simple Minecraft mod?
Tomcat
2011-11-14 19:49:17 UTC
Alright, so I'm using the MCP (ver. 4.4) to practice making mods for minecraft.
The goal was to create a simple mod that made chocolate milk from having cocoa beans placed in a crafting square above a bucket of milk.

I created the code, compiled it, and it returns no errors. However, when I attempt to make said item in a crafting grid, nothing happens. No chocolate milk is made. I do not wish to use ModLoader for this mod due to the fact that I have tried 23 times to install ModLoader into Minecraft and crashed every time. Some help would be greatly appreciated.

I have two .java files in the src folder that I made: one is called ItemChocolateMilk.java and Start2.java. The code for both are posted below.

This is my code:

For ItemChocolateMilk.java:

package net.minecraft.src;

public class ItemChocolateMilk extends Item
{

public ItemChocolateMilk(int itemIndex)
{
super(itemIndex);
maxStackSize = 1;
setIconIndex(70);
setItemName("Chocolate Milk");

//Recipe is a bucket of milk below cocoa beans
CraftingManager.getInstance().addRecipe(new ItemStack(itemsList[shiftedIndex], 1), new Object[] {
"#", "X", Character.valueOf('#'), Item.bucketMilk, Character.valueOf('X'), new ItemStack(Item.dyePowder,3)
});

chocolatemilkID = shiftedIndex;
}

public static int chocolatemilkID;
}

For Start2.java:

import net.minecraft.src.ItemChocolateMilk;

public class Start2
{

public Start2()
{
}

public static void main(String args[])
{
net.minecraft.src.ItemChocolateMilk g = new net.minecraft.src.ItemChocolateMilk(390);
Start.main(args);
}
}
Four answers:
2011-11-15 05:16:46 UTC
Well I had the same problem. The problem is that your Start2 Class is not being called before Start therefore not initializing your custom item. It seems as though the tutorials for MCP 4.4 are out of date. I asked around in the IRC channel and they pointed me towards using the MCP Mod System instead of the regular MCP. There are a couple of basic tutorials on the Mod System to get you started, including setting up new items and blocks, and making them craftable. I was looking for a pure "inject" classes framework which was what MCP looked like but, Using the MCP Mod System requires the user to download the MCP Mod System Users jars. So I am hoping that someone will update a tutorial on how to create pure MCP mods soon. Until then use the MCP Mod System. Links are Follows:



Download:

http://mcp.ocean-labs.de/index.php/MCP_Mod_System



Tutorials:

http://mcp.ocean-labs.de/index.php/MCP_Mod_System:_Basic_Block_Tutorial

http://mcp.ocean-labs.de/index.php/MCP_Mod_System:_Block_Texture_Override_Tutorial

http://mcp.ocean-labs.de/index.php/MCP_Mod_System:_Basic_Item_With_Custom_Texture

http://mcp.ocean-labs.de/index.php/MCP_Mod_System:_Basic_Entity_Tutorial



If someone has a better answer I would like to know as well.





Mike
2016-11-15 14:06:10 UTC
Cocoa Bean Minecraft
2016-11-29 16:28:43 UTC
acquire the Optifine mod. It would not do something with gameplay mechanics besides the shown fact that it could make your minecraft run quicker so which you will play IndustrialCraft and/or Millenaire. i exploit it and that i went from around 15 fps to approximately forty. those are way extra suitable effects than what individuals get besides the shown fact that it may nevertheless fairly help your minecraft run quicker.
?
2016-04-23 03:05:34 UTC
Possessing problems in coming up with tips for your landscape style? Do you want a new landscape but don’t know in which to begin? Then let this skilled guidebook https://tr.im/D35Ci aid you.



Ideas 4 landscaping are diverse from many other accessible resources. If one seriously needs to get any benefit he need to consider and go for Ideas 4 Landscaping rather than wasting his time on any other such resources. There are a lot of factors behind this that why should one choose and go for Ideas 4 Landscaping.

It provides you info and instruction with detailed labeled diagram that prove to be really valuable for you. There are unique approaches and strategy to deal every single person , the beginners will be treats as beginners.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...