Development Galacticraft code overhaul?

Discussion in 'Support' started by Tesik, Sep 4, 2017.

  1. Tesik

    Tesik Member

    Joined:
    Jul 25, 2015
    Messages:
    18
    Likes Received:
    2
    Hello everyone, I have some notes to the structure and organization of galacticraft's code and I'd like to propose some changes to make the code more navigable, easier to maintain and just better overall, I hope you get the point.
    Here they are:
    1) Item/Block misplacement - Some resources, like titanium or desh and some machines, like geothermal generator, launch controller or terraformer are a part of the Galacticraft Planets mod. The machines and resources should be moved to GC Core so that they could be obtained through creative or/give.

    2) Resource blocks/items could be automated by exposing them in an enumeration. This way there could be a Storage Block or Ore Block class automatically creating a blockstate for every block, automatic compressor recipes and so on. It would mean less work with new resources and would be less prone to errors. I have also considered a registry but it would only be useful if other mods wanted to add resources to galacticraft.
    Here's an example of such enumeration:

    public enum EnumResource {
    SILICON = new EnumResource("silicon", 1, 2.0F, true, true, false, false, true, true);

    private final String name;
    private final int numId;
    private final float hardnessMultiplier;
    private final boolean hasOre;
    private final boolean hasLunarOre;
    private final boolean hasRaw;
    private final boolean hasIngot;
    private final boolean hasCompressed;
    private final boolean hasBlock;
    private final boolean oreDropsRaw;

    EnumResource(String name, int numId, float hardnessMultiplier, boolean hasOre, boolean hasLunarOre, boolean hasRaw, boolean hasIngot, boolean hasCompressed, boolean hasBlock, boolean oreDropsRaw){
    this.name = name;
    /*...just initialize all the variables here*/
    }
    public int getId(){return this.id}
    public String getName(){return this.name}
    public float getHardness(){return this.hardnessMultiplier}
    /*all other getters*/
    }​

    3) Canisters of liquids should use NBT to store a fluid stack. I will look up some more information about this and try to think up an implementation.
     
  2. MJRLegends

    MJRLegends Member

    Joined:
    Mar 13, 2015
    Messages:
    347
    Likes Received:
    44
    Im finding it hard to see the purpose of this, the Galacticraft code has the organised in the way the developers like to have it. There is no wrong way to layout any code, it could even be in one class if you wanted too.
     
  3. Tesik

    Tesik Member

    Joined:
    Jul 25, 2015
    Messages:
    18
    Likes Received:
    2
    I would rather say Galacticraft code is as organized as much effort the developers put into the organization.
    Of course, but that doesn't mean different layouts don't have different properties, such as execution speed, readability or editability.
    With the amount of features in GC, one class (without inner classes) wouldn't really be possible as minecraft/forge is kinda relying on polymorphism in some parts.
     
  4. MJRLegends

    MJRLegends Member

    Joined:
    Mar 13, 2015
    Messages:
    347
    Likes Received:
    44
    The point im trying to make here is its down to @micdoodle8 and @radfast to how they wanted to do it since there the ones using and coding with the layout, players of the mod dont see it so they dont have to worry
     

Share This Page