Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMVoid95 committed Aug 12, 2020
1 parent 4efc2a6 commit b66cbe7
Show file tree
Hide file tree
Showing 23 changed files with 271 additions and 423 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Delete Current Config For This Mod Before Running This Update

[Added]

- Option to choose addon for Separate Galaxy feature
- Default addon for Seperate Galaxy is now "none"
- Warning in crash-log if Separate Galaxy is enabled


[Changed/Removed]

- Parse loaded Addons from FML Loader
- Modpack Crashlog Data
7 changes: 0 additions & 7 deletions CHANGELOG.txt

This file was deleted.

8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ forge_version=14.23.5.2847
mcp=snapshot_20171003

## Mod Versioning
versionMajor=0
versionMinor=4
versionMajor=1
versionMinor=0
versionRev=0

## Cureforge Upload Configs
cf_project_id=359766
cf_release_type=release
cf_changelog_filename=CHANGELOG.txt
cf_changelog_type=text
cf_changelog_filename=CHANGELOG.md
cf_changelog_type=markdown
cf_versions=1.12.2
cf_use_custom_display_name=false
#dep_has_ats=false
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/net/rom/gctweaks/GalacticTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import java.util.Map;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
Expand All @@ -21,7 +19,7 @@
import net.rom.gctweaks.core.utils.I18nHelper;
import net.rom.gctweaks.core.utils.LogHelper;

@Mod(modid = Ref.MOD_ID, name = Ref.MOD_NAME, version = Ref.MOD_VERSION, dependencies = Ref.MOD_DEPENDENCIES, certificateFingerprint = Ref.MOD_FINGERPRINT, guiFactory = "net.rom.gctweaks.core.config.GuiConfigFactory", useMetadata = true)
@Mod(modid = Ref.MOD_ID, name = Ref.MOD_NAME, version = Ref.MOD_VERSION, dependencies = Ref.DEPS, certificateFingerprint = Ref.MOD_FINGERPRINT, useMetadata = true)
public class GalacticTweaks {

@Instance(Ref.MOD_ID)
Expand Down Expand Up @@ -66,10 +64,4 @@ private void syncConfig() {
ModuleController.modules.forEach(Module::syncConfig);

}

@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.getModID().equals(Ref.MOD_ID))
syncConfig();
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/rom/gctweaks/ModuleController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ModuleController {

public static void registerModules() {
modules.add(new GalacticraftModule("Galacticraft Module"));
modules.add(new ModpackModule("Modpack Module"));
modules.add(new ModpackModule());
}


Expand Down
8 changes: 6 additions & 2 deletions src/main/java/net/rom/gctweaks/Ref.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public class Ref {
public static final String MOD_FORGE = "forge";
public static final String MOD_FORGE_VERSION = "@FORGE_VERSION@";
public static final String MOD_FORGE_VERSION_MIN = "14.23.5.2847";
public static final String MOD_GC = "required-after:galacticraftcore@[4.0.2.261,];required-after:galacticraftplanets;after:extraplanets";
public static final String A = "after:asmodeuscore@[0.0.17,];";
public static final String B = "after:extraplanets;";
public static final String C = "after:galaxyspace;";

public static final String MOD_GC = "required-after:galacticraftcore@[4.0.2.261,];required-after:galacticraftplanets;";

// Dependencies
public static final String MOD_DEPENDENCIES = "required:forge@[" + MOD_FORGE_VERSION_MIN + ",);" + MOD_GC + ";";
public static final String DEPS = "required:forge@[" + MOD_FORGE_VERSION_MIN + ",);" + MOD_GC + ";" + A + B + C;

}
6 changes: 0 additions & 6 deletions src/main/java/net/rom/gctweaks/core/Feature.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
package net.rom.gctweaks.core;

import java.util.ArrayList;
import java.util.List;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import scala.actors.threadpool.Arrays;

/**
* The Abstract Class Feature.
*/
public abstract class Feature {

public List<String> categoryList = new ArrayList<String>(Arrays.asList(category()));

/**
* @return the category
*/
Expand Down
97 changes: 29 additions & 68 deletions src/main/java/net/rom/gctweaks/core/GCPlanets.java
Original file line number Diff line number Diff line change
@@ -1,101 +1,62 @@
package net.rom.gctweaks.core;

import com.mjr.extraplanets.Config;
import com.mjr.extraplanets.Constants;
import com.mjr.extraplanets.planets.ExtraPlanets_Planets;
import com.mjr.extraplanets.planets.Ceres.TeleportTypeCeres;
import com.mjr.extraplanets.planets.Ceres.WorldProviderCeres;
import com.mjr.extraplanets.planets.Ceres.worldgen.CeresBiomes;
import com.mjr.extraplanets.planets.Eris.TeleportTypeEris;
import com.mjr.extraplanets.planets.Eris.WorldProviderEris;
import com.mjr.extraplanets.planets.Eris.worldgen.ErisBiomes;
import com.mjr.extraplanets.planets.Jupiter.TeleportTypeJupiter;
import com.mjr.extraplanets.planets.Jupiter.WorldProviderJupiter;
import com.mjr.extraplanets.planets.Jupiter.worldgen.JupiterBiomes;
import com.mjr.extraplanets.planets.Mercury.TeleportTypeMercury;
import com.mjr.extraplanets.planets.Mercury.WorldProviderMercury;
import com.mjr.extraplanets.planets.Mercury.worldgen.MercuryBiomes;
import com.mjr.extraplanets.planets.Neptune.TeleportTypeNeptune;
import com.mjr.extraplanets.planets.Neptune.WorldProviderNeptune;
import com.mjr.extraplanets.planets.Neptune.worldgen.NeptuneBiomes;
import com.mjr.extraplanets.planets.Pluto.TeleportTypePluto;
import com.mjr.extraplanets.planets.Pluto.WorldProviderPluto;
import com.mjr.extraplanets.planets.Pluto.worldgen.PlutoBiomes;
import com.mjr.extraplanets.planets.Saturn.TeleportTypeSaturn;
import com.mjr.extraplanets.planets.Saturn.WorldProviderSaturn;
import com.mjr.extraplanets.planets.Saturn.worldgen.SaturnBiomes;
import com.mjr.extraplanets.planets.Uranus.TeleportTypeUranus;
import com.mjr.extraplanets.planets.Uranus.WorldProviderUranus;
import com.mjr.extraplanets.planets.Uranus.worldgen.UranusBiomes;

import micdoodle8.mods.galacticraft.api.GalacticraftRegistry;
import galaxyspace.systems.SolarSystem.SolarSystemBodies;
import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance;
import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry;
import micdoodle8.mods.galacticraft.api.galaxies.Planet;
import micdoodle8.mods.galacticraft.api.galaxies.SolarSystem;
import micdoodle8.mods.galacticraft.api.world.AtmosphereInfo;
import micdoodle8.mods.galacticraft.api.world.EnumAtmosphericGas;
import micdoodle8.mods.galacticraft.core.GalacticraftCore;
import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedCreeper;
import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedEnderman;
import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton;
import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider;
import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie;
import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.rom.gctweaks.GalacticTweaks;

public class GCPlanets {
public static Planet FAKE_OVERWORLD;
public static Planet FAKE_ASTEROIDS;

public static void init() {

public static void initEp() {
buildEp();
build();
}

/**
* This method contains statements from the ExtraPlanets_Planets class from the ExtraPlanets Mod
*
* They are provided here to ensure the moved planets still contain their world features.
*
* All credits for each statement goes to MJRLegends
* https://github.com/MJRLegends/ExtraPlanets/blob/dev_1.12.2/src/main/java/com/mjr/extraplanets/planets/ExtraPlanets_Planets.java
*/
private static void build() {
GalacticTweaks.logger.debug(GCSystems.EP_SYSTEM.getName());

try {
GalacticTweaks.logger.debug(GCSystems.EP_SYSTEM.getName());
} catch (Exception e) {

}

buildFakeEarth(FAKE_OVERWORLD, "fakeOverworld", GCSystems.EP_SYSTEM, GalacticraftCore.planetOverworld.getPhaseShift(), GalacticraftCore.planetOverworld.getRelativeDistanceFromCenter().scaledDistance);
buildAsteroids(FAKE_ASTEROIDS, "fakeRocks", GCSystems.EP_SYSTEM, AsteroidsModule.planetAsteroids.getPhaseShift(), 1.375F);


public static void initGs () {
buildGs();
build();
}

private static void buildEp () {
ExtraPlanets_Planets.MERCURY.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.CERES.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.JUPITER.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.SATURN.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.URANUS.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.NEPTUNE.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.PLUTO.setParentSolarSystem(GCSystems.EP_SYSTEM);

ExtraPlanets_Planets.ERIS.setParentSolarSystem(GCSystems.EP_SYSTEM);

}

private static void buildGs() {
SolarSystemBodies.planetMercury.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetCeres.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetJupiter.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetSaturn.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetUranus.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetNeptune.setParentSolarSystem(GCSystems.EP_SYSTEM);
SolarSystemBodies.planetPluto.setParentSolarSystem(GCSystems.EP_SYSTEM);
//SolarSystemBodies.planetEris.setParentSolarSystem(GCSystems.EP_SYSTEM);
}

private static void build () {

buildFakeEarth(FAKE_OVERWORLD, "fakeOverworld", GCSystems.EP_SYSTEM, GalacticraftCore.planetOverworld
.getPhaseShift(), GalacticraftCore.planetOverworld.getRelativeDistanceFromCenter().scaledDistance);
buildAsteroids(FAKE_ASTEROIDS, "fakeRocks", GCSystems.EP_SYSTEM, AsteroidsModule.planetAsteroids
.getPhaseShift(), 1.375F);
}

public static void buildAsteroids (Planet planet, String planetName, SolarSystem solarSystem, float randomPhase, float au) {
planet = new Planet(planetName).setParentSolarSystem(solarSystem);
planet.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(au, au));
Expand All @@ -106,7 +67,7 @@ public static void buildAsteroids (Planet planet, String planetName, SolarSystem
planet.setUnreachable();
GalaxyRegistry.registerPlanet(planet);
}

public static void buildFakeEarth (Planet planet, String planetName, SolarSystem solarSystem, float randomPhase, float au) {
planet = new Planet(planetName).setParentSolarSystem(solarSystem);
planet.setRelativeDistanceFromCenter(new ScalableDistance(au, au));
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/net/rom/gctweaks/core/GCSystems.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ private static void build() {
starSol4.setBodyIcon(new ResourceLocation(micdoodle8.mods.galacticraft.core.Constants.ASSET_PREFIX, "textures/gui/celestialbodies/sun.png"));
EP_SYSTEM.setMainStar(starSol4);
GalaxyRegistry.registerSolarSystem(EP_SYSTEM);

// OTHER = new SolarSystem("otherSystem", EXTRAPLANETS.getName()).setMapPosition(new Vector3(1.0F, -1.0F, 0.0F));
// Star starOther = (Star) new Star("othersys").setParentSolarSystem(OTHER).setTierRequired(-1);
// starOther.setBodyIcon(new ResourceLocation(micdoodle8.mods.galacticraft.core.Constants.ASSET_PREFIX, "textures/gui/celestialbodies/sun.png"));
// OTHER.setMainStar(starOther);
// GalaxyRegistry.registerSolarSystem(OTHER);

}
}
65 changes: 42 additions & 23 deletions src/main/java/net/rom/gctweaks/core/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,74 @@
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.rom.gctweaks.GalacticTweaks;

public abstract class Module {
private List<Feature> features = new ArrayList<>();
private String name;
private Configuration config;
private List<Feature> features = new ArrayList<>();
private List<NoConfigFeature> features2 = new ArrayList<>();
private String name;
private Configuration config;
private boolean setConfig;

public Module(String name) {
this.name = name;
this.setConfig = true;
this.name = name;
addFeatures();
}

public abstract void addFeatures();
public Module() {
this.setConfig = false;
addFeatures();
}

public abstract void addFeatures ();

public void preInit() {
public void preInit () {
features.stream().filter(Feature::usesEvents).forEach(MinecraftForge.EVENT_BUS::register);
features.stream().filter(Feature::usesEvents).forEach(feature -> GalacticTweaks.logger.info("Registered Event Handler class {}", feature.getClass().getName()));
features.forEach(Feature::preInit);
features2.stream().filter(NoConfigFeature::usesEvents).forEach(MinecraftForge.EVENT_BUS::register);
features2.forEach(NoConfigFeature::preInit);
}

public void proxyPreInit() {
public void proxyPreInit () {
features.stream().filter(Feature::sidedProxy).forEach(MinecraftForge.EVENT_BUS::register);
features.forEach(Feature::proxyPreInit);
features2.stream().filter(NoConfigFeature::sidedProxy).forEach(MinecraftForge.EVENT_BUS::register);
features2.forEach(NoConfigFeature::proxyPreInit);
}

public void setupConfig(FMLPreInitializationEvent event) {
File file = new File(event.getModConfigurationDirectory().toString() + "/GalacticTweaks/" + name + ".cfg");
config = new Configuration(file, "3");
config.load();
GalacticTweaks.logger.bigInfo("Loaded Version: %s | Defined Version: %s", config.getLoadedConfigVersion(), config.getDefinedConfigVersion());

public void setupConfig (FMLPreInitializationEvent event) {
if (setConfig) {
File file = new File(event.getModConfigurationDirectory().toString() + "/GalacticTweaks/" + name + ".cfg");
config = new Configuration(file, "3");
config.load();
}
}

public void init() {
public void init () {
features.forEach(Feature::init);
features2.forEach(NoConfigFeature::init);
}

public void postInit() {
public void postInit () {
features.forEach(Feature::postInit);
features2.forEach(NoConfigFeature::postInit);
}

public void proxyInit() {
public void proxyInit () {
features.forEach(Feature::proxyInit);
features2.forEach(NoConfigFeature::proxyInit);
}

public void proxyPostInit() {
public void proxyPostInit () {
features.forEach(Feature::proxyPostInit);
features2.forEach(NoConfigFeature::proxyPostInit);
}

public Configuration getConfig() {
public Configuration getConfig () {
return config;
}

public void syncConfig() {
public void syncConfig () {
features.forEach(feature -> {
feature.syncConfig(config, feature.category());
config.addCustomCategoryComment(feature.category()[0], feature.comment());
Expand All @@ -70,11 +84,16 @@ public void syncConfig() {
});
}

protected void registerFeature(Feature feature) {
protected void registerFeature (Feature feature) {
features.add(feature);
}

public void registerPacket(SimpleNetworkWrapper network) {
protected void registerFeature (NoConfigFeature feature) {
features2.add(feature);
}

public void registerPacket (SimpleNetworkWrapper network) {
features.forEach(feature -> feature.registerPacket(network));
features2.forEach(feature -> feature.registerPacket(network));
}
}
Loading

0 comments on commit b66cbe7

Please sign in to comment.