Ok, thank you. Again, sorry for not getting it as quickly as maybe I should. Like I said, I have absolutely no experience in coding and am just doing this because I thought it'd be fun. So thank you for the help and for being patient with me.
Posts by Hitorikirino
-
-
So more like this?
public static void AllGemsEnergyCrystal()
{
ItemStack stack1 = ic2.api.Items.getItem("energyCrystal");
stack1 = stack1.copy();
stack1.stackSize = 1;
ItemStack stack2 = new ItemStack(Item.redstone, 1);
for (ItemStack stack3 : OreDictionary.getOres("gemSapphire"))
{
stack3 = stack3.copy();
stack3.stackSize = 1;
ic2.api.Ic2Recipes.addCraftingRecipe(stack1, new Object[] {"XXX", "XAX", "XXX", false, stack2, new ItemStack(Item.redstone, 1), stack3, "gemSapphire"});
}
}EDIT:
Not like that I take it, as it's still not working. Sorry I'm not picking up on this better, I just don't have any experience coding and just thought it would be fun to try my hand at it. Thanks for your help and for being patient with me.
-
As far as I can tell, AEtherchild, all you have to do is install MCP without any APIs and then put whatever API you want to use in the mcp/src/minecraft directory afterwards. See some of the previous posts in this thread for a specific list of steps. If I'm wrong on this please correct me GregoriusT.
Also, I ran into another question for you that I can't find an answer to. What is the syntax for adding a shaped crafting recipe to IC2? All the wiki, or the API, says is, "addCraftingRecipe (ItemStack result, Object...args)". So I don't understand how to write out that bit. I tried the code below thinking maybe the args it wanted were basically just the items for each slot when crafting, but it crashed while loading saying there was an IC2 crafting recipe error.
Here's the code I tried:
public static void AllGemsEnergyCrystal()
{
ItemStack stack1 = ic2.api.Items.getItem("energyCrystal");
stack1 = stack1.copy();
stack1.stackSize = 1;
for (ItemStack stack2 : OreDictionary.getOres("dustRedstone"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
for (ItemStack stack3 : OreDictionary.getOres("gemSapphire"))
{
stack3 = stack3.copy();
stack3.stackSize = 1;
ic2.api.Ic2Recipes.addCraftingRecipe(stack1, stack2, stack2, stack2, stack2, stack3, stack2, stack2, stack2, stack2);
}
}
} -
Hmm, well I tried making it run @PostInit, but then none of the recipes show up in game. And that's literally the only change I made, @Init to @PostInit.
Also tried both with, and without, the (FMLInitializationEvent event) in the public void load line. No difference either way.Edit to add the code:
package hitorikirino.mod;import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;@Mod(modid = "Hitorikirino_Recipes_Mod", name = "Hitorikirino's Recipe Mod", version = "0.2")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class NewRecipes
{
@PostInit
public void load()
{
WolframiumFuel();
ManganeseElectrolyze();
AluminumCompress();
GreenSaphCentrifuge();
QuartzCompress();
XychoriumElectrolyze();
BlueXychoriumElectrolyze();
XychoriumCentrifuge();
BlueXychoriumCentrifuge();
SiliconFuel();
BeryliumFuel();
ChloriteFuel();
SodiumPersulfateFuel();
CalciumCarbonateFuel();
MagnesiumElectrolyze();
PhosphorElectrolyze();
NikoliteElectrolyze();
}
public static void WolframiumFuel()
{
int EUout = 150;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 4);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void SiliconFuel()
{
int EUout = 10;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 7);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void BeryliumFuel()
{
int EUout = 100;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 10);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void ChloriteFuel()
{
int EUout = 200;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 13);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void SodiumPersulfateFuel()
{
int EUout = 20;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 32);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void CalciumCarbonateFuel()
{
int EUout = 5;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 33);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 3);
}
public static void ManganeseElectrolyze()
{
int duration = 6000;
int amountOfCells = 1;
int amountOfDusts = 1;
int EUt = 128;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 16);
for (ItemStack stack1 : OreDictionary.getOres("dustManganese"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDusts;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
public static void AluminumCompress()
{
for (ItemStack stack2 : OreDictionary.getOres("ingotAluminium"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
for (ItemStack stack1 : OreDictionary.getOres("aluminumNatural"))
{
stack1 = stack1.copy();
stack1.stackSize = 1;
ic2.api.Ic2Recipes.addCompressorRecipe(stack1, stack2);
}
}
}
public static void GreenSaphCentrifuge()
{
int duration = 12000;
int amountOfCells = 0;
for (ItemStack stack1 : OreDictionary.getOres("gemGreenSapphire"))
{
stack1 = stack1.copy();
stack1.stackSize = 1;
for (ItemStack stack2 : OreDictionary.getOres("gemEmerald"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
gregtechmod.api.GregTech_API.addCentrifugeRecipe(stack1, amountOfCells, stack2, null, null, null, duration);
}
}
}
public static void QuartzCompress()
{
ItemStack stack2 = new ItemStack(Item.enderPearl);
stack2 = stack2.copy();
stack2.stackSize = 1;
for (ItemStack stack1 : OreDictionary.getOres("crystalQuartz"))
{
stack1 = stack1.copy();
stack1.stackSize = 10;
ic2.api.Ic2Recipes.addCompressorRecipe(stack1, stack2);
}
}
public static void XychoriumElectrolyze()
{
int duration = 72000;
int amountOfCells = 0;
int amountOfXy = 16;
int EUt = 128;
for (ItemStack stack1 : OreDictionary.getOres("xychoriumGem"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfXy;
for (ItemStack stack2 : OreDictionary.getOres("plateIridium"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
}
public static void BlueXychoriumElectrolyze()
{
int duration = 72000;
int amountOfCells = 0;
int amountOfXy = 16;
int EUt = 128;
for (ItemStack stack1 : OreDictionary.getOres("xychoriumBlue"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfXy;
for (ItemStack stack2 : OreDictionary.getOres("plateIridium"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
}
public static void XychoriumCentrifuge()
{
int duration = 12000;
int amountOfCells = 1;
int amountOfXy = 16;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 4);
for (ItemStack stack1 : OreDictionary.getOres("xychoriumGem"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfXy;
gregtechmod.api.GregTech_API.addCentrifugeRecipe(stack1, amountOfCells, stack2, null, null, null, duration);
}
}
public static void BlueXychoriumCentrifuge()
{
int duration = 12000;
int amountOfCells = 1;
int amountOfXy = 16;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 4);
for (ItemStack stack1 : OreDictionary.getOres("xychoriumBlue"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfXy;
gregtechmod.api.GregTech_API.addCentrifugeRecipe(stack1, amountOfCells, stack2, null, null, null, duration);
}
}
public static void MagnesiumElectrolyze()
{
int duration = 3000;
int amountOfCells = 1;
int amountOfDust = 16;
int EUt = 16;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 16);
for (ItemStack stack1 : OreDictionary.getOres("dustMagnesium"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDust;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
public static void PhosphorElectrolyze()
{
int duration = 3000;
int amountOfCells = 8;
int amountOfDust = 16;
int EUt = 16;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 19);
for (ItemStack stack1 : OreDictionary.getOres("dustPhosphorus"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDust;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
public static void NikoliteElectrolyze()
{
int duration = 3000;
int amountOfCells = 1;
int amountOfDust = 16;
int EUt = 32;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 13);
for (ItemStack stack1 : OreDictionary.getOres("dustNikolite"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDust;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
}EDIT2:
Ok, nevermind, I see what I did wrong there and it's working now. Needed the (FMLPostInitializationEvent event), derp.
So now I think everything is working as it should. Again, thank you very much for the help and great mod!
-
Ok! Now the fuel recipes are working also.
After setting the debug mode on for NEI I do see the "Ore Dictionary" page along with everything else. The only difference I see there is that your dust has a second "itemDustManganese" entry, and his only has the "dustManganese" entry. Is that the problem?
-
It's really ok to just remove them? That won't mess up your mod? It seems like a lot of code to just delete.
EDIT: Ok, that did work and now the recipes are working as well. I am very happy right now.
Thank you for all the help!
And by the way, GregTech is one of my favorite mods. It's just freaking awesome!
EDIT2: Ok, so some of the recipes are working. Any idea why recipes using ore dictionary entries from Metallurgy 2 wouldn't show up in game? What I mean is I added a recipe using "dustManganese" which is in the ore dictionary, now in the game the recipe doesn't show up for the Metallurgy 2 Manganese dust, but it does show up for the GregTech Manganese dust. This is confusing to me because they're both in the ore dictionary with the same name "dustManganese". So what gives?
This happens no matter what dust I use from Metallurgy 2, even when it's the only one of it's type in the ore dictionary, like the dustHepatizon. In that case the recipe just doesn't show up in game at all (since the Metallurgy 2 dust is the only one there). Am I doing something wrong again? *bangs head against wall*
Also, I'm trying to add wolframium as a fuel for the semifluid generator and the recipe isn't showing up in game. So what am I doing wrong in this code:
package hitorikirino.mod;import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;@Mod(modid = "Hitorikirino_Recipes_Mod", name = "Hitorikirino's Recipe Mod", version = "0.2")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class NewRecipes
{
@Init
public void load(FMLInitializationEvent event)
{
WolframiumFuel();
ManganeseElectrolyze();
ManganeseCentrifuge();
AluminumCompress();
}
public static void WolframiumFuel()
{
int EUout = 10;
int amountOfCells = 1;
ItemStack stack1 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 4);
gregtechmod.api.GregTech_API.addFuel(stack1, null, EUout, 4);
}
public static void ManganeseElectrolyze()
{
int duration = 6000;
int amountOfCells = 1;
int amountOfDusts = 1;
int EUt = 128;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 8);
for (ItemStack stack1 : OreDictionary.getOres("dustManganese"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDusts;
gregtechmod.api.GregTech_API.addElectrolyzerRecipe(stack1, amountOfCells, stack2, null, null, null, duration, EUt);
}
}
public static void ManganeseCentrifuge()
{
int duration = 6000;
int amountOfCells = 1;
int amountOfDusts = 1;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCells, 16);
for (ItemStack stack1 : OreDictionary.getOres("dustManganese"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfDusts;
gregtechmod.api.GregTech_API.addCentrifugeRecipe(stack1, amountOfCells, stack2, null, null, null, duration);
}
}
public static void AluminumCompress()
{
for (ItemStack stack2 : OreDictionary.getOres("ingotAluminium"))
{
stack2 = stack2.copy();
stack2.stackSize = 1;
for (ItemStack stack1 : OreDictionary.getOres("aluminumNatural"))
{
stack1 = stack1.copy();
stack1.stackSize = 1;
ic2.api.Ic2Recipes.addCompressorRecipe(stack1, stack2);
}
}
}
} -
Ok, that must be what I'm doing wrong. I described what I did to set up everything in my first post and this is what I was doing:
1. Download & unpack the mcp725.zip file to it's own directory
2. Install a fresh copy of MC1.4.6 with no mods
3. Copy the bin and resource directories from the fresh MC install to the mcp/jars directory
4. Copy Minecraft_server.jar to the mcp/jars directory (Also 1.4.6)
5. Download the forge source code and extract it to the mcp directory (winds up in mcp/forge) (version 1.4.6-6.5.0.489 for MC 1.4.6)
6. Download the IC2 and GregTech APIs and put them both in mcp/forge/client and mcp/forge/common
7. Run mcp/forge/install.cmd and wait for it to finish (This is when I see the ~80 errors if I'm including the GregTech API)
8. Run Eclipse and select mcp/eclipse as my workspaceIn your install steps I have everything up until step 6. The "Minecraft" project folder you're talking about is "mcp/Eclipse/Minecraft"? Or is it "mcp/src/Minecraft"?
On step 7 which src folder are you talking about? The directions I found by Wuppy, and others, said there should be a mcp/forge/src directory, but there isn't. Am I supposed to just create that directory and throw the APIs in there instead of mcp/forge/client and mcp/forge/common? Or are you talking about the mcp/src directory and just put the APIs in there after running install?
Is there anything other than the APIs for IC2, GregTech, and Metallurgy 2, that I need to put in there?
I just tested your install method and it seemed to work perfectly for getting everything set up, but I still got the same errors when I tried to recompile and reobfuscate. Still nothing in the reobf directory afterwards.
My exact steps:
1. unpack mcp725.zip to it's own directory
2. copy the "bin" and "resources" directories from a clean MC 1.4.6 install into mcp/jars
3. copy minecraft_server.jar into mcp/jars
4. unpack the forge source zip into mcp/forge
5. ran mcp/forge/install.cmd (This completed with no errors)
6. ran Eclipse and selected mcp/eclipse as my workspace
7. closed Eclipse
8. placed the IC2 API in mcp/src/minecraft/ic2
9. placed the GregTech API in mcp/src/minecraft/gregtechmod
10. ran Eclipse again, noticed that it had the ic2.api and gregtechmod.api packages as I assume it should at this point
Also noticed that there were some errors in the gregtechmod.api package, didn't touch them as I probably don't understand enough of this to make those errors go away.
11. created a new package and class
12. pasted my code into the new class and saved everything
13. closed Eclipse and tried to run recompile and reobfuscate. Got the same errors and result as before.Please tell me there's something I'm doing wrong in there somewhere and it's an easy fix.
Again, thank you for all the help. I would never have been able to get even this far without you guys explaining it to me.
-
Thank you both for the help! That has allowed me to at least write the code without Eclipse giving me errors.
Now I'm running into another problem though. When I run recompile I wind up getting more errors and it tells me, "Can not find server sources, try decompiling." And then if I run reobfuscate I get more errors and it says, "can not find client bins, try recompiling." and "can not find server md5s". After this there is nothing in the reobf directory.
This makes me wonder if I'm still not setting up my MCP directory/install correctly? What am I missing here? I followed all the directions I could find to set it up, and the code seems to work in Eclipse, so what am I messing up now? I'm using Wuppy's tutorials on how to make a forge mod. As I understand it, once I write the code and save the files, I should just have to run recompile, then reobfuscate, and everything I need should wind up in the reobf directory right?
Just in case I'm still messing up the code, here's what I've got so far:
For the IC2 macerator test recipe:
package test.Test;import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;@Mod(modid = "Test_Mod", name = "Test Mod", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Test
{@Init
public void load(FMLInitializationEvent event)
{
ItemStack stack1 = ic2.api.Items.getItem("resin").copy();
stack1.stackSize = 1;
ItemStack stack2 = ic2.api.Items.getItem("rubber").copy();
stack2.stackSize = 2;
ic2.api.Ic2Recipes.addMaceratorRecipe(stack1, stack2);
}
}And for the GregTech Industrial Centrifuge test recipe:
package test.Test;import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;@Mod(modid = "Test_GregTech_Mod", name = "GregTech Test Mod", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class TestGTech
{
@Init
public void load(FMLInitializationEvent event)
{
int duration = 500;
int amountOfCarbonCells = 1;
int amountOfIronDust = 1;
ItemStack stack2 = gregtechmod.api.GregTech_API.getGregTechItem(2, amountOfCarbonCells, 8);
for (ItemStack stack1 : OreDictionary.getOres("dustIron"))
{
stack1 = stack1.copy();
stack1.stackSize = amountOfIronDust;
gregtechmod.api.GregTech_API.addCentrifugeRecipe(stack1, amountOfCarbonCells, stack2, null, null, null, duration);
}
}
}Again, thanks for the help guys.
-
Ok, so I am a complete noob in terms of modding MC or Java coding. I spent the entirety of last night trying to figure this out and am completely lost and confused.
All I want to do is add some recipes to the machines in GregTech using items from GregTech, IC2, and Metallurgy 2. I'm not adding anything new, no new items or anything, just new recipes. Just as an example, I would like to be able to throw some Hepatizon dust from Metallurgy 2 into a GregTech Industrial Centrifuge to get a Carbon Cell. I've spent hours reading and watching tutorials but am just not understanding it. I'm not sure I've got MCP set up properly, and I know I'm not getting the syntax for the actual code right, but I can't figure out what I'm doing wrong and need help.
So far I've followed the directions for installing MCP with forge and an external API. I have gotten the IC2 api to work (I think), but I keep getting around 80 errors when I try to do it with the GregTech API.
Here's what I'm doing step by step, please let me know if I'm messing any of this up:
1. Download & unpack the mcp725.zip file to it's own directory
2. Install a fresh copy of MC1.4.6 with no mods
3. Copy the bin and resource directories from the fresh MC install to the mcp/jars directory
4. Copy Minecraft_server.jar to the mcp/jars directory (Also 1.4.6)
5. Download the forge source code and extract it to the mcp directory (winds up in mcp/forge) (version 1.4.6-6.5.0.489 for MC 1.4.6)
6. Download the IC2 and GregTech APIs and put them both in mcp/forge/client and mcp/forge/common
7. Run mcp/forge/install.cmd and wait for it to finish (This is when I see the ~80 errors if I'm including the GregTech API)
8. Run Eclipse and select mcp/eclipse as my workspaceIn Eclipse:
9. Create a new package under minecraft/src
10. Create a new class within the new package
11. Try to write the mod and fail horriblySo far I've just been trying to add a regular macerator recipe just to figure out how to add recipes using items from a mod. I have been stuck on that all night.
Here is the code I've been trying to use:package test.Test;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import ic2.api.Ic2Recipes
import ic2.api.Items@Mod(modid = "Test_Mod", name = "Test Mod", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Test
{
@Init
public void load(FMLInitializationEvent event)
{
ItemStack stack1 = new ItemStack(ic2.api.Items.getItem(resin));
ItemStack stack2 = new ItemStack(ic2.api.Items.getItem(rubber));addMaceratorRecipe(ItemStack stack1, ItemStack stack2)
}
}Clearly, I have no idea what I'm doing despite using the MineCraftForge Wiki tutorials and IC2 API information on http://ic2api.player.to.
So, the questions I have right now are:
1. Am I installing mcp with the APIs correctly? If not, what am I doing wrong?
2. How do I correctly add a macerator recipe to IC2 using items from IC2?
3. How do I add a recipe to the GregTech Industrial Centrifuge (or any of the other GregTech machines) using items from IC2 & GregTech?
4. How do I use items from Metallurgy 2, or any other mod, in recipes for IC2 and/or GregTech machines?I am really at my wits end with this and will be eternally grateful to anyone who can help me out.