[IC2 Exp | 1.12.2] IC2Guns addon
-
-
I'm facing an issue with canning machine recipe:
Code
Display MoreNBTTagCompound fullMagazineNBT = ItemMagazine.getNBTForAmmo(ItemMagazine.MAX_AMMO); addCanningRecipe(input.forExactStack(new ItemStack(magazine, 1, 0, emptyMagazineNBT)), input.forStack(new ItemStack(cartridge, 20)), new ItemStack(magazine, 1, 0, fullMagazineNBT)); ... public static NBTTagCompound getNBTForAmmo (int value) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger(AMMO_KEY, value); return nbt; } ... private static void addCanningRecipe (IRecipeInput container, IRecipeInput filler, ItemStack out) { Recipes.cannerBottle.addRecipe(container, filler, out, false); }
Debugger shows that addCanningRecipe gets output item stack with NBT ammo MAX_AMMO = 20, however, this recipe produces a magazine with NBT ammo 0. Is it an API bug, or am I doing it the wrong way?
By the way, I'm totally not a Java programmer, so beware of ugly code. -
An addon style we've not seen in a long time, looking forward to see how it turns out.
As for your NBT issue, the ItemStack constructor is a little misleading in that whilst it takes in an NBTTagCompound, that's only for Forge's capabilities and not the ItemStack's own NBT. You'll want to do something like
JavaaddCanningRecipe(input.forExactStack(makeMagazine(0)), input.forStack(new ItemStack(cartridge, 20)), makeMagazine(ItemMagazine.MAX_AMMO); ... private static ItemStack makeMagazine(int ammo) { ItemStack magazine = new ItemStack(magazine); magazine.setTagCompound(ItemMagazine.getNBTForAmmo(ammo)); return magazine; }
That way the NBT is properly set for the ItemStack (using setTagCompound).
-
Hey, can someone attach a compiled version of this mod to this thread? I tried compiling it myself and either there's something wrong or I'm too dum dum to compile it myself, thanks.
-
try downloading the repo, run gradlew setupDecompWorkspace, and after that finishes, try gradlew build. the built mod should be in built/libs. Thats for Windows, idk about the other OS's though...
I don't think that gradlew eclipse is needed before building...
-
try downloading the repo, run gradlew setupDecompWorkspace, and after that finishes, try gradlew build. the built mod should be in built/libs. Thats for Windows, idk about the other OS's though...
I don't think that gradlew eclipse is needed before building...
Well yes, I did those steps, this time I tried it on another CLI tool and not powershell, and it.. worked?
-
Also how do you load a magazine into the rifle, can't seem to do anything with the rifle even after filling a few magazines and having them in my inv, etc.
-
The rifle doesn't seem to be finished yet, it's just an item which doesn't stack at the moment.
-
Also how do you load a magazine into the rifle, can't seem to do anything with the rifle even after filling a few magazines and having them in my inv, etc.
It's not finished, I've been working on it only for 4 days. I'm going to finish it in a week.
-
Alright, thanks.
-
Also, when starting my forge server with the mod I got this crash:
https://hastebin.com/feqobeyegi.rb
Hope that helps if you're planning to make this multiplayer compatible in the future.
-
Hope that helps if you're planning to make this multiplayer compatible in the future.
Of course.
I got this crash
Thx, seems like localization is client side only.
-
This is such a great idea. If you polish this and give some decent configure options via the configs I be happy to add this to my pack. I'm making a pack with mostly IC2 / TR mixed in and NO Tinkers. I think this would do wonders
-
This mod idea does carry such possibilities and oportunities. Would love to see something other than ICBM or Flans mods (nothing personal JambioFlan! loved your mod since 2010).
-
Is this dead? The Github link from the first post is broken.
This addon idea is one thing Industrialcraft was always lacking, so would love to see this completed.
-
Is this dead? The Github link from the first post is broken.
This addon idea is one thing Industrialcraft was always lacking, so would love to see this completed.
Yep, I got overcringed by Forge mess (and Java, hecking hate it), so I just gave this up. Sorry.
Here is source code (Idea project) for what I currently have. You can freely use it, try to finish this addon or even integrate it in IC.