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:
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.
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*/
}
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.