SM84CE's probable addon: Coaxium Mod

  • 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:

    [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:

    The post was edited 1 time, last by SM84CE: spelling mistake ().

  • 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:

    The post was edited 1 time, last by SM84CE ().

  • Post by SM84CE ().

    This post was deleted by the author themselves ().
  • 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?

    My favorite...

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

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

  • 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:

    The post was edited 1 time, last by SM84CE: fixed spelling mistake ().

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

    Java
    1. 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
    1. public final int numberOfCells;
    2. public ItemCoaxiumRod(String name, int cells)
    3. {
    4. super(); //for the Item class
    5. numberOfCells = cells; //some methods dealt with this...
    6. }
    7. ...

    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 :)

    My favorite...

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

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

  • 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

    My favorite...

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

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

  • 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
    1. public ItemCoaxiumRod(String name, int cells)
    2. {
    3. super();
    4.         setRegistryName("mymodid", name);
    5. numberOfCells = cells;
    6. }

    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?


    My favorite...

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

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

  • 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?

    My favorite...

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

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

  • 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.