SM84CE's first addon: Coaxium Addon for IC2

  • DOWNLOAD HERE! https://www.curseforge.com/min…xium-mod-1-12-2-ic2-addon



    First off, sorry if this is in the wrong subforum, I really had no idea where to put it.


    I recently got into modding and decided to try some IC2 based stuff. I know some Java, and followed the vanilla tutorials here:

    External Content www.youtube.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.
    [Numbers 1-12]

    I decided to try and add in Coaxium, from the Star Wars series. That went well, so I decided to make it an IC2 reactor fuel. That's where I got stuck. I can't seem to find documentation on the API, and couldn't find any source for these types of mods (ones that added in reactor fuels). Anyone here that is willing to help me out?

    My favorite...

    Armor: :Quantum-Helmet::Quantum-Bodyarmor::Quantum-Leggings::Quantum-Boots:

    Item: :Uranium::Uranium Ore::Reactor:

    Edited 2 times, last by SM84CE: download link ().

    • Official Post

    The API jar on Jenkins contains the source files the for API interfaces as well as the compiled versions which document a rough outline of how they're meant to be used. Beyond that you're welcome to ask here or take a look into the dev jar to see how IC2 uses things itself.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • So how would I make a reactor fuel? Would my CustomFuel extend ItemReactorUranium? Do I need to implement anything? I've also seen that when you use the eclipse "add unimplemented methods" option, it fills in the returns for the methods with placeholders, null for objects/ strings, etc. What do I have to replace those with?

    My favorite...

    Armor: :Quantum-Helmet::Quantum-Bodyarmor::Quantum-Leggings::Quantum-Boots:

    Item: :Uranium::Uranium Ore::Reactor:

    Edited once, last by SM84CE ().

  • Can anyone help me out? I can't figure this out :( Do I just copy and paste the methods from the extended class into my class and change the return values? EX: If I were to extend ItemReactorUranium, would I just copy/paste the methods into my CustomFuel class? I'm assuming I need to @Override the methods... If so, do I do that with the implemented class, IReactorComponent?

    • Official Post

    You'll definitely want to implement IReactorComponent, for a simple fuel rod I guess you would just follow the same logic that ItemReactorUranium does to implement all the methods. Some of the IReactorComponent methods aren't typically needed for a fuel rod so looking in Uranium's super class shows you what the defaults should be to avoid unintentionally interfering with the reactor (which leaving Eclipse's auto-generated returns could do). The logic won't transpose perfectly as Item (which you'll want to be extending too) doesn't have all the methods Uranium needs in terms of damage storage especially, but fundamentally you're just storing the value in the ItemStack's NBT and don't need all the extra logic IC2 has for flexibility so the amount of implementing for that you need to do is reasonably limited.

    Doing a completely custom fuel rod implementation is all about doing the heat producing logic in processChamber and doing power production either in acceptUraniumPulse or also in processChamber, depending on how you want your fuel rod to work. A reactor only ticks once a second (rather than the normal game's 20 times), so things at slowed down more comparatively to make live debugging a little easier without needing break points.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • So how would I extend 2 classes in my ItemCoaxiumRod class?

    Also, where is the ItemUranium class? I'm assuming that it's in the mod itself?

    I also assume that ItemReactorUranium has a method for NBT data storage?

    Also, I'm assuming that the Uranium superclass is ItemReactorUranium?


    Sorry for the questions, I kinda don't know how to make mods with IC2 integration :P

    My favorite...

    Armor: :Quantum-Helmet::Quantum-Bodyarmor::Quantum-Leggings::Quantum-Boots:

    Item: :Uranium::Uranium Ore::Reactor:

    Edited once, last by SM84CE: fixed spelling mistake ().

    • Official Post

    You don't extend them both as IReactorComponent is an interface. You'll end up with something along the lines of

    Java
    public class ItemCoaxiumRod extends Item implements IReactorComponent {

    ItemUranium as a class doesn't exist, it was just to save me having to type out ItemReactorUranium each time. It has the logic that determines how uranium rods act, whilst its superclass AbstractDamageableReactorComponent has the default implementations of IReactorComponent (some of which are overriden in ItemReactorUranium) and it is AbstractDamageableReactorComponent's superclass ItemGradualInt which has the NBT damage storing/loading in.


    It's worth noting that ItemGradualInt especially is used in multiple places so some of it won't be especially necessary for your usage I shouldn't think (such as implementing ICustomDamageItem), overriding getDamage, setDamage, isDamaged and isDamageable is probably all you technically need. Although overriding getDurabilityForDisplay and getMaxDamage is very much advisable too.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • Where would I copy all of the methods from? When I used the eclipse add unimplemented methods feature, it put some methods that I found in ItemReactorUranium, there were also some in ItemReactorUranium's superclass, do I just copy and paste them and change "protected ..." to "public ..." in the method headers?

    Should my constructor look like this?

    Code
    public final int numberOfCells;
        
        public ItemCoaxiumRod(String name, int cells)
        {
            super(); //for the Item class
            numberOfCells = cells; //some methods dealt with this...
        }
    ...

    Also, with the import ic2.core.item.reactor.ItemReactorUranium.ItemStackCoord, eclipse says that ItemStackCoord isn't visible, do I need to copy and paste that method into my class, change it to public, and @Override it?


    Sorry for all the questions... I just didn't think this would be so hard :P

    If possible, an example class for making a fuel rod would help, a lot :)

  • With my previous post in mind, here is my ItemCoaxiumRod.java file, there is one problem: The item itself isn't available in the Creative inventory. When I add the ModItems.ITEMS.add(this), I get a NullPointerException (crash log below). I am declaring my Item in my ModItems class, in init package like this:

    public static final ItemCoaxiumRod COAXIUM_ROD = new ItemCoaxiumRod("coaxium_rod", 1);



    Crash report:

    https://pastebin.com/X5FvhYrS

    • Official Post

    Where would I copy all of the methods from? When I used the eclipse add unimplemented methods feature, it put some methods that I found in ItemReactorUranium, there were also some in ItemReactorUranium's superclass, do I just copy and paste them and change "protected ..." to "public ..." in the method headers?

    The fact you got some from both is what you'd expect, ItemReactorUranium will override some of them but doesn't need to override all of them as the superclass will handle them sufficiently. All you've got to do is make sure the ones that ItemReactorUranium implements you implement likewise and the ones that it doesn't you handle the way the superclass does. Providing you're wanting it to act like uranium fuel rods at least.

    Should my constructor look like this?

    If you're wanting to support dual and quad rods rather than just single ones (like uranium does), then yes. Otherwise it's doing more than it necessarily needs to do.

    Also, with the import ic2.core.item.reactor.ItemReactorUranium.ItemStackCoord, eclipse says that ItemStackCoord isn't visible, do I need to copy and paste that method into my class, change it to public, and @Override it?

    You'll want to copy that, it's only designed to be used from ItemReactorUranium thus is also private.

    With my previous post in mind, here is my ItemCoaxiumRod.java file, there is one problem: The item itself isn't available in the Creative inventory. When I add the ModItems.ITEMS.add(this), I get a NullPointerException (crash log below).

    You've not set the registry name of your items, thus when you try and register them it will crash. Given that you're already passing the name into your constructor, you might as well use it:

    Java
    public ItemCoaxiumRod(String name, int cells)
        {
            super();
            setRegistryName("mymodid", name);
            numberOfCells = cells;
        }

    Of course there are other places you could do it instead (such as on the field as setRegistryName returns the item back to you), that's down to code style.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • So I got it to appear, it can now be placed in a reactor and outputs 5EU/t, and produces heat... I'm planning on the recipe needing an Iridium Reinforced Fuel Rod, and making the rod produce no heat or negative heat, hence the iridium costs. Where would I set my ItemCoaxiumRod to produce no/negative heat?


    Also, there is no durability bar, I found the set/get damage methods in ItemGradualInt, you said Override them, what goes into the method body, and do I override get/set Custom Damage, or the get/setDamage method?


  • bump? Is there any methods I have to add to have a duration? I'm going to try and figure the heat out for myself, don't want to seem like I want you guys to write my mod for me, I just need a lot of help :P


    I've also thought of adding dense diamond plates to the corners of the empty rod (I'll handle the dense diamond plates/ plates in my mod, no worries :) )

    Also, how do I make a block cutting blade with a higher hardness?

    • Official Post

    I did mention what you'd need, but you've had long enough to work it out so you'll get the answer anyway :P

    Block cutting blades are just items which implement IBlockCuttingBlade which is fairly clear on how to implement given all you have to do is return the hardness in the one method it specifies ;)

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • Lol... I'll get used to it (hopefully), don't worry :P I'll probably make the durability 40 or 30k, because of the high fuel rod costs...

  • So I added in all the mentioned methods, but there is no durability. I'm assuming that decrementing the damage has to be done somewhere, but where? Also, is there any method that needs to be called to show the durability?

    • Official Post

    Given that you copied the uranium code, there'd be a big hint to compare what you've got vs what that has ;)


    Java
    if (!heatRun && getCustomDamage(stack) >= this.getMaxCustomDamage(stack) - 1) {
        reactor.setItemAt(x, y, ItemStack.EMPTY); //Or whatever your fuel rod produces when it runs out
    } else if (!heatRun) {
        stack.attemptDamageItem(1, itemRand, null); //Hit the stack, the reactor's world random could be use instead if you wanted
    }

    Is missing off the bottom of processChamber

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • *sigh*. What would I do without this forum :P


    Well, at least I knew that some method was missing... At this point, you basically own the Coaxium Fuel Rod :P


    And I guess there would've been a hint, but I had no idea it was there :P

    Maybe next time I'll catch that...


    I'd ask what do do about single.dual/quad cells, but I have a getDepletedStack method that returns an ItemStack, so I'll handle that by just calling the method on setItem(...,getDepletedStack(...))

    My favorite...

    Armor: :Quantum-Helmet::Quantum-Bodyarmor::Quantum-Leggings::Quantum-Boots:

    Item: :Uranium::Uranium Ore::Reactor:

    Edited once, last by SM84CE ().

  • Progress update: Single rods can now be made, TODO: dual/quad rods, and making a Cesium rod/fuel from the byproducts of Coaxium rods.


    One question, the recipe for the fuel rod for Coaxium fuel is this:

    Should I return 3/4 of the Iridium AND Diamonds used to make it, or more iridium and less diamonds? The Diamonds are returned from the Thermal Centrifuge in block form, and the iridium is my mod's dust, which can be compressed back into ore. Ore can also be centrifuged into dust.


    All of these resources because these fuel rods produce NO HEAT, which makes is easy to produce a LOT of power in a small space, especially with breeder reactors.

  • First off, sorry if this is in the wrong subforum, I really had no idea where to put it.

    Personally, I'd suggest either "Pending Addons" or "Addon Discussion". I haven't decided whether I'd use this mod myself when it becomes available for download, but I will want to be able to find the thread so I can add the components to my planner. Also, I hope it will be okay to include the assets for said components in the planner when the time comes.

  • Personally, I'd suggest either "Pending Addons" or "Addon Discussion". I haven't decided whether I'd use this mod myself when it becomes available for download, but I will want to be able to find the thread so I can add the components to my planner. Also, I hope it will be okay to include the assets for said components in the planner when the time comes.

    I did add a request in the shoutbox for this to be moved (I thought it would be more of a general thread, but it morphed into this, which then morphed into an addon :P)


    Definitely! After it's released, send me a PM or whatever asking for the fuel rod classes (assuming those get directly integrated into the planner to determine the behaviors), etc. and I'll send them to you