From 1c79537fd9066e665993d80045ecb16c0da99e06 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 19 Aug 2020 10:42:13 -0500 Subject: [PATCH 01/17] Revert "Added Command to Reset JoinWithOxygen for players" This reverts commit d4936a07f9e56e9822c2bf4d8b77f21da04ddc13. --- build.gradle | 7 +-- .../java/net/rom/gctweaks/GalacticTweaks.java | 9 +-- .../rom/gctweaks/core/CommandOxygenReset.java | 58 ------------------- 3 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java diff --git a/build.gradle b/build.gradle index 0897549..8fcf418 100644 --- a/build.gradle +++ b/build.gradle @@ -125,8 +125,8 @@ dependencies { compile "asmodeuscore:AsmodeusCore-Dev:0.0.18" compile "curse.maven:GSMod-0.0.14:3015062" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" - compile "com.mjr.extraplanets:ExtraPlanets:1.12.2-0.6.9:dev" - compile "com.mjr.mjrlegendslib:MJRLegendsLib:1.12.2-1.2.0:dev" + compile "com.mjr.extraplanets:ExtraPlanets:1.12.2-0.6.6:dev" + compile "com.mjr.mjrlegendslib:MJRLegendsLib:1.12.2-1.1.9:dev" } minecraft { @@ -141,9 +141,6 @@ minecraft { } else { replace '@FINGERPRINT@', '' } - - clientRunArgs += ['--username', "seemee68@yahoo.com"] - clientRunArgs += ['--password', "Jackal88"] } allprojects { diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 90d70ba..6d54ca9 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -10,12 +10,10 @@ 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.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; -import net.rom.gctweaks.core.CommandOxygenReset; import net.rom.gctweaks.core.Module; import net.rom.gctweaks.core.proxy.CommonProxy; import net.rom.gctweaks.core.utils.I18nHelper; @@ -53,7 +51,6 @@ public void preInit(FMLPreInitializationEvent event) { @EventHandler public void init(FMLInitializationEvent event) { ModuleController.modules.forEach(Module::init); - proxy.init(event); } @@ -65,10 +62,6 @@ public void postInit(FMLPostInitializationEvent event) { private void syncConfig() { ModuleController.modules.forEach(Module::syncConfig); + } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent event) { - event.registerServerCommand(new CommandOxygenReset()); - } } diff --git a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java b/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java deleted file mode 100644 index 16ebbe3..0000000 --- a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.rom.gctweaks.core; - -import java.util.List; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.rom.gctweaks.Ref; - -public class CommandOxygenReset extends CommandBase { - - @Override - public String getName () { - return "oxygenreset"; - } - - @Override - public String getUsage (ICommandSender sender) { - return "/" + this.getName() + " "; - } - - @Override - public int getRequiredPermissionLevel () { - return 3; - } - - @Override - public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); - } - return null; - } - - @Override - public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0 && args.length < 2) { - final EntityPlayer player = server.getPlayerList().getPlayerByUsername(args[0]); - - if(player != null) { - final NBTTagCompound entityData = player.getEntityData(); - final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); - final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; - persistedData.setBoolean(key, false); - String line = String.format("Sucessfully reset %s's OxygenGear-On-Join setting", player.getName()); - sender.sendMessage(new TextComponentString(line)); - } - } else { - sender.sendMessage(new TextComponentString(getUsage(sender))); - } - } -} From 7ec49ab30a46f77879febf4395936916880d44bb Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 19 Aug 2020 10:42:13 -0500 Subject: [PATCH 02/17] Revert "Added Command to Reset JoinWithOxygen for players" This reverts commit 0d6bdc149567a67ffdbdcf8a89a31ce14ac7e052. --- .../java/net/rom/gctweaks/GalacticTweaks.java | 9 +-- .../rom/gctweaks/core/CommandOxygenReset.java | 58 ------------------- 2 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 90d70ba..6d54ca9 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -10,12 +10,10 @@ 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.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; -import net.rom.gctweaks.core.CommandOxygenReset; import net.rom.gctweaks.core.Module; import net.rom.gctweaks.core.proxy.CommonProxy; import net.rom.gctweaks.core.utils.I18nHelper; @@ -53,7 +51,6 @@ public void preInit(FMLPreInitializationEvent event) { @EventHandler public void init(FMLInitializationEvent event) { ModuleController.modules.forEach(Module::init); - proxy.init(event); } @@ -65,10 +62,6 @@ public void postInit(FMLPostInitializationEvent event) { private void syncConfig() { ModuleController.modules.forEach(Module::syncConfig); + } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent event) { - event.registerServerCommand(new CommandOxygenReset()); - } } diff --git a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java b/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java deleted file mode 100644 index 16ebbe3..0000000 --- a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.rom.gctweaks.core; - -import java.util.List; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.rom.gctweaks.Ref; - -public class CommandOxygenReset extends CommandBase { - - @Override - public String getName () { - return "oxygenreset"; - } - - @Override - public String getUsage (ICommandSender sender) { - return "/" + this.getName() + " "; - } - - @Override - public int getRequiredPermissionLevel () { - return 3; - } - - @Override - public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); - } - return null; - } - - @Override - public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0 && args.length < 2) { - final EntityPlayer player = server.getPlayerList().getPlayerByUsername(args[0]); - - if(player != null) { - final NBTTagCompound entityData = player.getEntityData(); - final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); - final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; - persistedData.setBoolean(key, false); - String line = String.format("Sucessfully reset %s's OxygenGear-On-Join setting", player.getName()); - sender.sendMessage(new TextComponentString(line)); - } - } else { - sender.sendMessage(new TextComponentString(getUsage(sender))); - } - } -} From 3c045a2e51b58450acefa9392f1bb93ce55427a5 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 19 Aug 2020 10:42:13 -0500 Subject: [PATCH 03/17] Revert "Added Command to Reset JoinWithOxygen for players" This reverts commit d4936a07f9e56e9822c2bf4d8b77f21da04ddc13. --- build.gradle | 530 ------------------ .../java/net/rom/gctweaks/GalacticTweaks.java | 9 +- .../rom/gctweaks/core/CommandOxygenReset.java | 58 -- 3 files changed, 1 insertion(+), 596 deletions(-) delete mode 100644 build.gradle delete mode 100644 src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0897549..0000000 --- a/build.gradle +++ /dev/null @@ -1,530 +0,0 @@ -buildscript { - repositories { - jcenter() - mavenCentral() - maven { - name = "forge" - url = "https://files.minecraftforge.net/maven" - } - maven { - name = 'gradle' - url 'https://plugins.gradle.org/m2/' - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath "se.bjurr.gitchangelog:git-changelog-gradle-plugin:+" - } -} - -plugins { - id 'com.matthewprenger.cursegradle' version '1.4.0' - id "io.freefair.lombok" version "2.9.5" - id 'maven-publish' - id 'maven' -} - -apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' - -import groovy.json.JsonSlurper - -eclipse.project { - buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' - natures 'org.eclipse.buildship.core.gradleprojectnature' -} - -class Secrets { - Map m_data = null - - final String getProperty(final String key) { - return (m_data && (m_data[key] != null)) ? m_data[key] : '' - } -} - -final def secretFile -if (System.getenv('SECRET_FILE')) { - secretFile = file System.getenv().SECRET_FILE -} else { - secretFile = file 'secret.json' -} - -import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask -import java.util.regex.Matcher - -project.ext.secret = new Secrets() -if (secretFile.exists()) { - secretFile.withReader { - project.secret.m_data = new JsonSlurper().parse it - } -} - -def versionBuild = 0 -if (System.getenv("BUILD_NUMBER") != null) - versionBuild = System.getenv("BUILD_NUMBER") - -version = "${versionMajor}.${versionMinor}.${versionRev}" -group = "${group}" -archivesBaseName = "${name}" - -sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. -compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} - -configurations { - embed - implementation.extendsFrom(embed) -} - -String GCBuild = "261" -String GCVersion = "1.12.2-4.0.2.${GCBuild}" - -repositories { - ivy { - url "https://micdoodle8.com/new-builds/" - layout 'pattern', { - artifact "[organization]/${GCBuild}/[module]-[revision].jar" - } - metadataSources { - artifact() - } - } - maven { - name 'MJRLegends' - url = "https://maven.mjrlegends.com/" - } - maven { - name = 'curseforge' - url = 'https://minecraft.curseforge.com/api/maven/' - } - maven { - name 'DVS1 Maven FS' - url 'http://dvs1.progwml6.com/files/maven' - } - maven { - name 'IC2' - url = "http://maven.ic2.player.to" - } - maven { - name 'ReadOnlyMaven' - url = "https://maven.romvoid.dev" - } - maven { - url = "https://www.cursemaven.com" - } -} - -dependencies { - - compile "GC-1.12-dev:GalacticraftCore-Dev:${GCVersion}" - compile "GC-1.12-dev:Galacticraft-API:${GCVersion}" - compile "GC-1.12-dev:Galacticraft-Planets-Dev:${GCVersion}" - compile "GC-1.12-dev:MicdoodleCore-Dev:${GCVersion}" - compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api" - compile "asmodeuscore:AsmodeusCore-Dev:0.0.18" - compile "curse.maven:GSMod-0.0.14:3015062" - compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" - compile "com.mjr.extraplanets:ExtraPlanets:1.12.2-0.6.9:dev" - compile "com.mjr.mjrlegendslib:MJRLegendsLib:1.12.2-1.2.0:dev" -} - -minecraft { - version = "${mc_version}-${forge_version}" - runDir = "run" - replace '${version}', project.version - mappings = "${mcp}" - makeObfSourceJar false - - if (project.hasProperty('signSHA1') && getBooleanProperty('do_sign_jar')) { - replace '@FINGERPRINT@', secret.signSHA1 - } else { - replace '@FINGERPRINT@', '' - } - - clientRunArgs += ['--username', "seemee68@yahoo.com"] - clientRunArgs += ['--password', "Jackal88"] -} - -allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } -} - - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - -jar { - - manifest { - mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.archivesBaseName, - 'Implementation-Version': version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) - } -} - -task apiJar(type: Jar) { - onlyIf { - getBooleanProperty('create_api_jar') - } - from(sourceSets.main.output) { - include "net/rom/api/**" - } - from(sourceSets.main.java) { - include "net/rom/api/**" - } - - classifier = 'api' - from apiClasses - // from sourceSets.api.output - manifest.mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:api", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-api', - 'Implementation-Version': project.version, - 'Built-On': "${project.mc_version}-${project.forge_version}", - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})" - ) -} - -task deobfJar(type: Jar) { - onlyIf { - getBooleanProperty('create_deobf_jar') - } - - classifier = 'dev' - from sourceSets.main.output - manifest { - mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:deobf", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-deobf', - 'Implementation-Version': project.version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) - if (project.hasProperty('at_file')) { - attributes 'FMLAT': project.at_file - } - if (project.hasProperty('core_plugin')) { - attributes 'FMLCorePlugin': project.core_plugin - } - } -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - onlyIf { - getBooleanProperty('create_javadoc_jar') - } - - classifier = 'javadoc' - from javadoc.getDestinationDir() - manifest.mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:javadoc", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-javadoc', - 'Implementation-Version': project.version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) -} - -task signJar(type: SignJar, dependsOn: reobfJar) { - onlyIf { - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - inputFile = jar.archivePath - outputFile = jar.archivePath - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass -} - -task signApiJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_api_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = apiJar.archivePath - outputFile = apiJar.archivePath -} - -task signDeobfJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_deobf_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = deobfJar.archivePath - outputFile = deobfJar.archivePath -} - -task signSourceJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_source_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = sourceJar.archivePath - outputFile = sourceJar.archivePath -} - -task signJavadocJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_javadoc_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = javadocJar.archivePath - outputFile = javadocJar.archivePath -} - -if (getBooleanProperty('do_sign_jar')) { - build.dependsOn signJar - build.dependsOn signApiJar - build.dependsOn signDeobfJar - build.dependsOn signSourceJar - build.dependsOn signJavadocJar -} - -tasks.publish.dependsOn build -tasks.curseforge.dependsOn publish - -artifacts { - if (getBooleanProperty('create_api_jar')) { - archives apiJar - } - if (getBooleanProperty('create_deobf_jar')) { - archives deobfJar - } - if (getBooleanProperty('create_source_jar')) { - archives sourceJar - } - if (getBooleanProperty('create_javadoc_jar')) { - archives javadocJar - } -} - -curseforge { - if (project.hasProperty('cf_project_id')) { - apiKey = secret.curseforgeAPIKey - project { - id = project.cf_project_id - if (project.hasProperty('cf_changelog_filename')) { - changelog = file(project.cf_changelog_filename) - } else { - changelog = getGitChangelog - } - if (project.hasProperty('cf_changelog_type')) { - changelogType = project.cf_changelog_type - } - if ((project.hasProperty('cf_release_type')) && ((project.cf_release_type == 'alpha') || (project.cf_release_type == 'beta') || (project.cf_release_type == 'release'))) { - releaseType = project.cf_release_type - } else { - releaseType = 'alpha' - } - if (project.hasProperty('cf_versions')) { - final def versions = "${project.cf_versions}".split(', ') - versions.each { - addGameVersion "${it}" - } - } - mainArtifact(jar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version}" - } - if (project.hasProperty('cf_requirements') || project.hasProperty('cf_optionals') || project.hasProperty('cf_embeddeds') || project.hasProperty('cf_tools') || project.hasProperty('cf_incompatibles') || project.hasProperty('cf_includes')) { - relations { - if (project.hasProperty('cf_requirements')) { - final def requirements = "${project.cf_requirements}".split(', ') - requirements.each { - requiredDependency "${it}" - } - } - if (project.hasProperty('cf_optionals')) { - final def optionals = "${project.cf_optionals}".split(', ') - optionals.each { - optionalDependency "${it}" - } - } - if (project.hasProperty('cf_embeddeds')) { - final def embeddeds = "${project.cf_embeddeds}".split(', ') - embeddeds.each { - embeddedLibrary "${it}" - } - } - if (project.hasProperty('cf_tools')) { - final def tools = "${project.cf_tools}".split(', ') - tools.each { - tool "${it}" - } - } - if (project.hasProperty('cf_incompatibles')) { - final def incompatibles = "${project.cf_incompatibles}".split(', ') - incompatibles.each { - incompatible "${it}" - } - } - if (project.hasProperty('cf_includes')) { - final def includes = "${project.cf_includes}".split(', ') - includes.each { - include "${it}" - } - } - } - } - } - if (getBooleanProperty('create_api_jar')) { - addArtifact(apiJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} API" - } - } - } - if (getBooleanProperty('create_source_jar')) { - addArtifact(sourceJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Sources" - } - } - } - if (getBooleanProperty('create_deobf_jar')) { - addArtifact(deobfJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Development" - } - } - } - if (getBooleanProperty('create_javadoc_jar')) { - addArtifact(javadocJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Javadoc" - } - } - } - } - } -} - -String getModFile() { - String path = '' - final FileTree tree = fileTree(dir: 'src/main/java') - tree.include '**/*.java' - tree.visit { final element -> - if (element.file.isFile()) { - element.file.eachLine { final String s -> - final String sTrim = s.trim() - if (sTrim.startsWith('@Mod(')) { - path = "src/main/java/${element.relativePath}" - } - } - } - } - return path -} - -String getModVersion(final String type) { - return getModVersion(type, modFile) -} - -String getModVersion(final String type, final String modFile) { - if ((modFile != null) && (modFile != '')) { - final File file = file(modFile) - final def prefix = ~/^(?:\s*)(?:(?public|protected|private) )?(?:(?static) )?(?:(?final) )?String $type = "(?:(?\d*)\.)?(?:(?\d*)\.)?(?:(?[^."]*)\.?)(?[^"]*)";$/ - for (final String s in file.readLines()) { - final Matcher matcher = (s.trim() =~ prefix) - if (matcher.matches()) { - return "${matcher.group('major') ?: '0'}.${matcher.group('minor') ?: '0'}.${matcher.group('patch')}" - } - } - } - return '0.0.0' -} - -def getGitChangelog() { - try { - def stdout = new ByteArrayOutputStream() - def gitHash = System.getenv('GIT_COMMIT') - def gitPrevHash = System.getenv('GIT_PREVIOUS_COMMIT') - def travisRange = System.getenv('TRAVIS_COMMIT_RANGE') - if(gitHash && gitPrevHash) { - exec { - println gitHash - println gitPrevHash - commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + gitPrevHash + '...' + gitHash - standardOutput = stdout - } - return stdout.toString().trim() - } else if(travisRange) { - exec { - commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + travisRange - standardOutput = stdout - } - return stdout.toString().trim() - } else { - return ""; - } - } catch(ignored) { - return ""; - } -} - -boolean getBooleanProperty(final String property) { - if (project.hasProperty(property)) { - return ((String) project.findProperty(property)).toBoolean() - } else { - return false - } -} \ No newline at end of file diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 90d70ba..6d54ca9 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -10,12 +10,10 @@ 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.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; -import net.rom.gctweaks.core.CommandOxygenReset; import net.rom.gctweaks.core.Module; import net.rom.gctweaks.core.proxy.CommonProxy; import net.rom.gctweaks.core.utils.I18nHelper; @@ -53,7 +51,6 @@ public void preInit(FMLPreInitializationEvent event) { @EventHandler public void init(FMLInitializationEvent event) { ModuleController.modules.forEach(Module::init); - proxy.init(event); } @@ -65,10 +62,6 @@ public void postInit(FMLPostInitializationEvent event) { private void syncConfig() { ModuleController.modules.forEach(Module::syncConfig); + } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent event) { - event.registerServerCommand(new CommandOxygenReset()); - } } diff --git a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java b/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java deleted file mode 100644 index 16ebbe3..0000000 --- a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.rom.gctweaks.core; - -import java.util.List; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.rom.gctweaks.Ref; - -public class CommandOxygenReset extends CommandBase { - - @Override - public String getName () { - return "oxygenreset"; - } - - @Override - public String getUsage (ICommandSender sender) { - return "/" + this.getName() + " "; - } - - @Override - public int getRequiredPermissionLevel () { - return 3; - } - - @Override - public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); - } - return null; - } - - @Override - public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0 && args.length < 2) { - final EntityPlayer player = server.getPlayerList().getPlayerByUsername(args[0]); - - if(player != null) { - final NBTTagCompound entityData = player.getEntityData(); - final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); - final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; - persistedData.setBoolean(key, false); - String line = String.format("Sucessfully reset %s's OxygenGear-On-Join setting", player.getName()); - sender.sendMessage(new TextComponentString(line)); - } - } else { - sender.sendMessage(new TextComponentString(getUsage(sender))); - } - } -} From 80b862b4ec3789e6199e1fcb41dfeda250157dbb Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 19 Aug 2020 10:42:13 -0500 Subject: [PATCH 04/17] Revert "Added Command to Reset JoinWithOxygen for players" This reverts commit 0d6bdc149567a67ffdbdcf8a89a31ce14ac7e052. --- .../java/net/rom/gctweaks/GalacticTweaks.java | 9 +-- .../rom/gctweaks/core/CommandOxygenReset.java | 58 ------------------- 2 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 90d70ba..6d54ca9 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -10,12 +10,10 @@ 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.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; -import net.rom.gctweaks.core.CommandOxygenReset; import net.rom.gctweaks.core.Module; import net.rom.gctweaks.core.proxy.CommonProxy; import net.rom.gctweaks.core.utils.I18nHelper; @@ -53,7 +51,6 @@ public void preInit(FMLPreInitializationEvent event) { @EventHandler public void init(FMLInitializationEvent event) { ModuleController.modules.forEach(Module::init); - proxy.init(event); } @@ -65,10 +62,6 @@ public void postInit(FMLPostInitializationEvent event) { private void syncConfig() { ModuleController.modules.forEach(Module::syncConfig); + } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent event) { - event.registerServerCommand(new CommandOxygenReset()); - } } diff --git a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java b/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java deleted file mode 100644 index 16ebbe3..0000000 --- a/src/main/java/net/rom/gctweaks/core/CommandOxygenReset.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.rom.gctweaks.core; - -import java.util.List; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.rom.gctweaks.Ref; - -public class CommandOxygenReset extends CommandBase { - - @Override - public String getName () { - return "oxygenreset"; - } - - @Override - public String getUsage (ICommandSender sender) { - return "/" + this.getName() + " "; - } - - @Override - public int getRequiredPermissionLevel () { - return 3; - } - - @Override - public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); - } - return null; - } - - @Override - public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0 && args.length < 2) { - final EntityPlayer player = server.getPlayerList().getPlayerByUsername(args[0]); - - if(player != null) { - final NBTTagCompound entityData = player.getEntityData(); - final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); - final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; - persistedData.setBoolean(key, false); - String line = String.format("Sucessfully reset %s's OxygenGear-On-Join setting", player.getName()); - sender.sendMessage(new TextComponentString(line)); - } - } else { - sender.sendMessage(new TextComponentString(getUsage(sender))); - } - } -} From fc3329ae0c0b48b30bd1f6b0c4c5705abd363b5f Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 19 Aug 2020 10:55:35 -0500 Subject: [PATCH 05/17] Create build.gradle --- build.gradle | 527 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 527 insertions(+) create mode 100644 build.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..8fcf418 --- /dev/null +++ b/build.gradle @@ -0,0 +1,527 @@ +buildscript { + repositories { + jcenter() + mavenCentral() + maven { + name = "forge" + url = "https://files.minecraftforge.net/maven" + } + maven { + name = 'gradle' + url 'https://plugins.gradle.org/m2/' + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath "se.bjurr.gitchangelog:git-changelog-gradle-plugin:+" + } +} + +plugins { + id 'com.matthewprenger.cursegradle' version '1.4.0' + id "io.freefair.lombok" version "2.9.5" + id 'maven-publish' + id 'maven' +} + +apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' + +import groovy.json.JsonSlurper + +eclipse.project { + buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' + natures 'org.eclipse.buildship.core.gradleprojectnature' +} + +class Secrets { + Map m_data = null + + final String getProperty(final String key) { + return (m_data && (m_data[key] != null)) ? m_data[key] : '' + } +} + +final def secretFile +if (System.getenv('SECRET_FILE')) { + secretFile = file System.getenv().SECRET_FILE +} else { + secretFile = file 'secret.json' +} + +import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask +import java.util.regex.Matcher + +project.ext.secret = new Secrets() +if (secretFile.exists()) { + secretFile.withReader { + project.secret.m_data = new JsonSlurper().parse it + } +} + +def versionBuild = 0 +if (System.getenv("BUILD_NUMBER") != null) + versionBuild = System.getenv("BUILD_NUMBER") + +version = "${versionMajor}.${versionMinor}.${versionRev}" +group = "${group}" +archivesBaseName = "${name}" + +sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +compileJava { + sourceCompatibility = targetCompatibility = '1.8' +} + +configurations { + embed + implementation.extendsFrom(embed) +} + +String GCBuild = "261" +String GCVersion = "1.12.2-4.0.2.${GCBuild}" + +repositories { + ivy { + url "https://micdoodle8.com/new-builds/" + layout 'pattern', { + artifact "[organization]/${GCBuild}/[module]-[revision].jar" + } + metadataSources { + artifact() + } + } + maven { + name 'MJRLegends' + url = "https://maven.mjrlegends.com/" + } + maven { + name = 'curseforge' + url = 'https://minecraft.curseforge.com/api/maven/' + } + maven { + name 'DVS1 Maven FS' + url 'http://dvs1.progwml6.com/files/maven' + } + maven { + name 'IC2' + url = "http://maven.ic2.player.to" + } + maven { + name 'ReadOnlyMaven' + url = "https://maven.romvoid.dev" + } + maven { + url = "https://www.cursemaven.com" + } +} + +dependencies { + + compile "GC-1.12-dev:GalacticraftCore-Dev:${GCVersion}" + compile "GC-1.12-dev:Galacticraft-API:${GCVersion}" + compile "GC-1.12-dev:Galacticraft-Planets-Dev:${GCVersion}" + compile "GC-1.12-dev:MicdoodleCore-Dev:${GCVersion}" + compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api" + compile "asmodeuscore:AsmodeusCore-Dev:0.0.18" + compile "curse.maven:GSMod-0.0.14:3015062" + compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" + compile "com.mjr.extraplanets:ExtraPlanets:1.12.2-0.6.6:dev" + compile "com.mjr.mjrlegendslib:MJRLegendsLib:1.12.2-1.1.9:dev" +} + +minecraft { + version = "${mc_version}-${forge_version}" + runDir = "run" + replace '${version}', project.version + mappings = "${mcp}" + makeObfSourceJar false + + if (project.hasProperty('signSHA1') && getBooleanProperty('do_sign_jar')) { + replace '@FINGERPRINT@', secret.signSHA1 + } else { + replace '@FINGERPRINT@', '' + } +} + +allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} + + +processResources { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else except the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} + +jar { + + manifest { + mainAttributes( + 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}", + 'Timestamp': System.currentTimeMillis(), + 'Implementation-Title': project.archivesBaseName, + 'Implementation-Version': version, + 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Built-On': "${project.mc_version}-${project.forge_version}" + ) + } +} + +task apiJar(type: Jar) { + onlyIf { + getBooleanProperty('create_api_jar') + } + from(sourceSets.main.output) { + include "net/rom/api/**" + } + from(sourceSets.main.java) { + include "net/rom/api/**" + } + + classifier = 'api' + from apiClasses + // from sourceSets.api.output + manifest.mainAttributes( + 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:api", + 'Timestamp': System.currentTimeMillis(), + 'Implementation-Title': project.name + '-api', + 'Implementation-Version': project.version, + 'Built-On': "${project.mc_version}-${project.forge_version}", + 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})" + ) +} + +task deobfJar(type: Jar) { + onlyIf { + getBooleanProperty('create_deobf_jar') + } + + classifier = 'dev' + from sourceSets.main.output + manifest { + mainAttributes( + 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:deobf", + 'Timestamp': System.currentTimeMillis(), + 'Implementation-Title': project.name + '-deobf', + 'Implementation-Version': project.version, + 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Built-On': "${project.mc_version}-${project.forge_version}" + ) + if (project.hasProperty('at_file')) { + attributes 'FMLAT': project.at_file + } + if (project.hasProperty('core_plugin')) { + attributes 'FMLCorePlugin': project.core_plugin + } + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + onlyIf { + getBooleanProperty('create_javadoc_jar') + } + + classifier = 'javadoc' + from javadoc.getDestinationDir() + manifest.mainAttributes( + 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:javadoc", + 'Timestamp': System.currentTimeMillis(), + 'Implementation-Title': project.name + '-javadoc', + 'Implementation-Version': project.version, + 'Built-On-Java': "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})", + 'Built-On': "${project.mc_version}-${project.forge_version}" + ) +} + +task signJar(type: SignJar, dependsOn: reobfJar) { + onlyIf { + getBooleanProperty('do_sign_jar') && + project.hasProperty('keyStore') + } + + inputFile = jar.archivePath + outputFile = jar.archivePath + + keyStore = secret.keyStore + alias = secret.keyStoreAlias + storePass = secret.keyStorePass + keyPass = secret.keyStoreKeyPass +} + +task signApiJar(type: SignJar) { + onlyIf { + getBooleanProperty('create_api_jar') && + getBooleanProperty('do_sign_jar') && + project.hasProperty('keyStore') + } + + keyStore = secret.keyStore + alias = secret.keyStoreAlias + storePass = secret.keyStorePass + keyPass = secret.keyStoreKeyPass + + inputFile = apiJar.archivePath + outputFile = apiJar.archivePath +} + +task signDeobfJar(type: SignJar) { + onlyIf { + getBooleanProperty('create_deobf_jar') && + getBooleanProperty('do_sign_jar') && + project.hasProperty('keyStore') + } + + keyStore = secret.keyStore + alias = secret.keyStoreAlias + storePass = secret.keyStorePass + keyPass = secret.keyStoreKeyPass + + inputFile = deobfJar.archivePath + outputFile = deobfJar.archivePath +} + +task signSourceJar(type: SignJar) { + onlyIf { + getBooleanProperty('create_source_jar') && + getBooleanProperty('do_sign_jar') && + project.hasProperty('keyStore') + } + + keyStore = secret.keyStore + alias = secret.keyStoreAlias + storePass = secret.keyStorePass + keyPass = secret.keyStoreKeyPass + + inputFile = sourceJar.archivePath + outputFile = sourceJar.archivePath +} + +task signJavadocJar(type: SignJar) { + onlyIf { + getBooleanProperty('create_javadoc_jar') && + getBooleanProperty('do_sign_jar') && + project.hasProperty('keyStore') + } + + keyStore = secret.keyStore + alias = secret.keyStoreAlias + storePass = secret.keyStorePass + keyPass = secret.keyStoreKeyPass + + inputFile = javadocJar.archivePath + outputFile = javadocJar.archivePath +} + +if (getBooleanProperty('do_sign_jar')) { + build.dependsOn signJar + build.dependsOn signApiJar + build.dependsOn signDeobfJar + build.dependsOn signSourceJar + build.dependsOn signJavadocJar +} + +tasks.publish.dependsOn build +tasks.curseforge.dependsOn publish + +artifacts { + if (getBooleanProperty('create_api_jar')) { + archives apiJar + } + if (getBooleanProperty('create_deobf_jar')) { + archives deobfJar + } + if (getBooleanProperty('create_source_jar')) { + archives sourceJar + } + if (getBooleanProperty('create_javadoc_jar')) { + archives javadocJar + } +} + +curseforge { + if (project.hasProperty('cf_project_id')) { + apiKey = secret.curseforgeAPIKey + project { + id = project.cf_project_id + if (project.hasProperty('cf_changelog_filename')) { + changelog = file(project.cf_changelog_filename) + } else { + changelog = getGitChangelog + } + if (project.hasProperty('cf_changelog_type')) { + changelogType = project.cf_changelog_type + } + if ((project.hasProperty('cf_release_type')) && ((project.cf_release_type == 'alpha') || (project.cf_release_type == 'beta') || (project.cf_release_type == 'release'))) { + releaseType = project.cf_release_type + } else { + releaseType = 'alpha' + } + if (project.hasProperty('cf_versions')) { + final def versions = "${project.cf_versions}".split(', ') + versions.each { + addGameVersion "${it}" + } + } + mainArtifact(jar) { + if (getBooleanProperty('cf_use_custom_display_name')) { + displayName = "${project.name} ${project.display_version}" + } + if (project.hasProperty('cf_requirements') || project.hasProperty('cf_optionals') || project.hasProperty('cf_embeddeds') || project.hasProperty('cf_tools') || project.hasProperty('cf_incompatibles') || project.hasProperty('cf_includes')) { + relations { + if (project.hasProperty('cf_requirements')) { + final def requirements = "${project.cf_requirements}".split(', ') + requirements.each { + requiredDependency "${it}" + } + } + if (project.hasProperty('cf_optionals')) { + final def optionals = "${project.cf_optionals}".split(', ') + optionals.each { + optionalDependency "${it}" + } + } + if (project.hasProperty('cf_embeddeds')) { + final def embeddeds = "${project.cf_embeddeds}".split(', ') + embeddeds.each { + embeddedLibrary "${it}" + } + } + if (project.hasProperty('cf_tools')) { + final def tools = "${project.cf_tools}".split(', ') + tools.each { + tool "${it}" + } + } + if (project.hasProperty('cf_incompatibles')) { + final def incompatibles = "${project.cf_incompatibles}".split(', ') + incompatibles.each { + incompatible "${it}" + } + } + if (project.hasProperty('cf_includes')) { + final def includes = "${project.cf_includes}".split(', ') + includes.each { + include "${it}" + } + } + } + } + } + if (getBooleanProperty('create_api_jar')) { + addArtifact(apiJar) { + if (getBooleanProperty('cf_use_custom_display_name')) { + displayName = "${project.name} ${project.display_version} API" + } + } + } + if (getBooleanProperty('create_source_jar')) { + addArtifact(sourceJar) { + if (getBooleanProperty('cf_use_custom_display_name')) { + displayName = "${project.name} ${project.display_version} Sources" + } + } + } + if (getBooleanProperty('create_deobf_jar')) { + addArtifact(deobfJar) { + if (getBooleanProperty('cf_use_custom_display_name')) { + displayName = "${project.name} ${project.display_version} Development" + } + } + } + if (getBooleanProperty('create_javadoc_jar')) { + addArtifact(javadocJar) { + if (getBooleanProperty('cf_use_custom_display_name')) { + displayName = "${project.name} ${project.display_version} Javadoc" + } + } + } + } + } +} + +String getModFile() { + String path = '' + final FileTree tree = fileTree(dir: 'src/main/java') + tree.include '**/*.java' + tree.visit { final element -> + if (element.file.isFile()) { + element.file.eachLine { final String s -> + final String sTrim = s.trim() + if (sTrim.startsWith('@Mod(')) { + path = "src/main/java/${element.relativePath}" + } + } + } + } + return path +} + +String getModVersion(final String type) { + return getModVersion(type, modFile) +} + +String getModVersion(final String type, final String modFile) { + if ((modFile != null) && (modFile != '')) { + final File file = file(modFile) + final def prefix = ~/^(?:\s*)(?:(?public|protected|private) )?(?:(?static) )?(?:(?final) )?String $type = "(?:(?\d*)\.)?(?:(?\d*)\.)?(?:(?[^."]*)\.?)(?[^"]*)";$/ + for (final String s in file.readLines()) { + final Matcher matcher = (s.trim() =~ prefix) + if (matcher.matches()) { + return "${matcher.group('major') ?: '0'}.${matcher.group('minor') ?: '0'}.${matcher.group('patch')}" + } + } + } + return '0.0.0' +} + +def getGitChangelog() { + try { + def stdout = new ByteArrayOutputStream() + def gitHash = System.getenv('GIT_COMMIT') + def gitPrevHash = System.getenv('GIT_PREVIOUS_COMMIT') + def travisRange = System.getenv('TRAVIS_COMMIT_RANGE') + if(gitHash && gitPrevHash) { + exec { + println gitHash + println gitPrevHash + commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + gitPrevHash + '...' + gitHash + standardOutput = stdout + } + return stdout.toString().trim() + } else if(travisRange) { + exec { + commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + travisRange + standardOutput = stdout + } + return stdout.toString().trim() + } else { + return ""; + } + } catch(ignored) { + return ""; + } +} + +boolean getBooleanProperty(final String property) { + if (project.hasProperty(property)) { + return ((String) project.findProperty(property)).toBoolean() + } else { + return false + } +} \ No newline at end of file From f5dcb960b5ff8071506c7513c1ac2e95ec71229e Mon Sep 17 00:00:00 2001 From: ROM Date: Thu, 27 Aug 2020 19:56:49 -0500 Subject: [PATCH 06/17] Update README.md --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e61535d..14c687c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ -# GalacticTweaks - GalacticTweaks + +

+
+ +

+ + + +

[ ~ The Galacticraft Tweaker Mod ~ ]

+

That's Not A CraftTweaker Addon

+ +

+ + MIT License + + + + Made With love +

+

+ + + + +

+ +--- From 9c8f17f5a1603037e79a8241a74432e5d8ad0608 Mon Sep 17 00:00:00 2001 From: ROM Date: Thu, 27 Aug 2020 20:52:01 -0500 Subject: [PATCH 07/17] Create CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ + From ceb391e5062eb4e26a5bdcb30941bc682f3ac26b Mon Sep 17 00:00:00 2001 From: ROM Date: Thu, 27 Aug 2020 21:03:09 -0500 Subject: [PATCH 08/17] Update README.md --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 14c687c..5a54d99 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,81 @@

- ---- + +## Table of Contents + +* [About](#about) +* [Issues](#issues) +* [Building](#building) +* [Contribution](#contribution) + +## About + +A tweaks mod for the Galacticraft Mod. As the name implies it adds various tweaks to give additional gameplay options, also contains fixes for various mechanics where needed or wanted by popular/personal opinion. + +## Issues + +GalacticTweaks crashing, have a suggestion, found a bug? Create an issue now! + +1. Make sure your issue has not already been answered or fixed and you are using the latest version of this mod and Galacticraft. Also think about whether your issue is a valid one before submitting it. + * If it is already possible with vanilla, within Galacticraft, another Addon or This mod itself, the suggestion will be considered invalid. + * Asking for a back-port to an older Minecraft version will also be considered invalid +2. Go to [the issues page](https://github.com/ReadOnly-Mods/GalacticTweaks/issues) and click [The Provided Template](https://github.com/ReadOnly-Mods/GalacticTweaks/issues/new/choose) +3. use one of the provided templates. It will also contain further details about required or useful information to add. Failure to follow the template will result in your suggestion/issue being closed +4. Click `Submit`, and wait for feedback! + +Providing as many details as possible does help us to find and resolve the issue faster and also you getting a fixed version as fast as possible. + +Please note that we might close any issue not matching these requirements. + +## Building + +1. Clone this repository via + - SSH `git clone git@github.com:ReadOnly-Mods/GalacticTweaks.git` or + - HTTPS `git clone https://github.com/ReadOnly-Mods/GalacticTweaks.git` +2. Build using the `gradlew build` command. Jar will be in `build/libs` +3. For core developer: Setup IDE + - IntelliJ: Import as gradle project + - Eclipse: Import as gradle project or execute gradle task `eclipse` and potentially `setupDecompWorkspace` + +## Contribution + +Before adding major changes, you might want to discuss them with us first. +If you are still willing to contribute to this project, you can contribute via [Pull-Request](https://help.github.com/articles/creating-a-pull-request). + +The [guidelines for contributing](https://github.com/ReadOnly-Mods/GalacticTweaks/blob/dev-1.12.2/CONTRIBUTING.md) contain more detailed information about topics like the used code style and should also be considered. + +Here are a few things to keep in mind that will help get your PR approved. + +* A PR should be focused on content. Any PRs where the changes are only syntax will be rejected. +* Use the file you are editing as a style guide. +* Consider your feature. [Suggestion Guidelines](http://ae-mod.info/Suggestion-Guidelines/) + - Is your suggestion already possible using Galacticraft or other Addons? + - Make sure your feature isn't already in the works, or hasn't been rejected previously. + - If your feature can be done by any popular mod, discuss with us first. + +**Getting Started** + +1. Fork this repository +2. Clone the fork via + * SSH `git clone git@github.com:/GalacticTweaks.git` or + * HTTPS `git clone https://github.com//GalacticTweaks.git` +3. It is prefered you create a new branch and base it off Dev-1.12.2 (Branches based off the realease branch will be rejected) +4. Run `gradlew setupDecompWorkspace` setup your Development Environment +5. Ensure any changes are tested prior to commiting to your new branch with `gradlew runClient` + - 5a. If adding any dependencies for your changes, these MUST be approved prior to adding +6. Commit changes to your forked repo +7. Publish your new branch to your Github fork +8. Create a Pull-Request on GitHub +9. Wait for review +10. Squash commits for cleaner history + +If you are only doing single file pull requests, GitHub supports using a quick way without the need of cloning your fork. Also read up about [syncing](https://help.github.com/articles/syncing-a-fork) if you plan to contribute on regular basis. + +### English Text + +`en_us.lang` is included in this repository, fixes to typos are welcome. + +### Encoding + +Files must be encoded as UTF-8. From f3872c516d4db858ed1fcfe54407eed1de301414 Mon Sep 17 00:00:00 2001 From: ROM Date: Thu, 27 Aug 2020 21:03:59 -0500 Subject: [PATCH 09/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a54d99..afc7e28 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Here are a few things to keep in mind that will help get your PR approved. - Make sure your feature isn't already in the works, or hasn't been rejected previously. - If your feature can be done by any popular mod, discuss with us first. -**Getting Started** +### Getting Started 1. Fork this repository 2. Clone the fork via From 0a83e82ad6c878aa1eae534a5703ce635c7923cb Mon Sep 17 00:00:00 2001 From: ROM Date: Thu, 27 Aug 2020 21:13:20 -0500 Subject: [PATCH 10/17] Update CONTRIBUTING.md --- CONTRIBUTING.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b13789..8be8a06 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,56 @@ +# How to contribute + +We want to keep it as easy as possible to contribute changes. +There are a few guidelines that we need contributors to follow +so that we can keep on top of things. + +## Getting Started + +### Submitting Changes + +* Submit an issue to the github project, assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Make sure you fill in the earliest version that you know has the issue. + * Waiting for feedback is suggested. +* Fork the repository on GitHub +* Create a topic branch from where you want to base your work. + * This `dev-1.12.2` branch that is under active development. + * Only target the Release branch + * To quickly create a topic branch based on the development branch; `git + checkout -b my_contribution_branch`. Please avoid working + directly on the `dev-1.12.2` branch. +* Make commits of logical units. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Make sure your commit messages are in the proper format. + +```` + (#12345) An Example Commit Message Adding An Example Feature/Fix + + If your commit requires additional information for the developers + you can add it after the first line with a space. + + The first line must contain your issue/suggestion ticket # +```` +* Always fully test your changes. +* Describing the process you used to test your changes in detail will help speed up this process. + +## Making Trivial Changes + +### Documentation + +For changes of a trivial nature to comments and documentation, it is not always necessary to create a new issue. +We usually use `squash and merge`. +```` + +### Semantic Changes + +In order to keep the code in a state where PRs can be safely merged, it is important to +avoid changes to syntax or changes that don't add any real value to the code base. PRs +that make changes only to syntax or "clean up" the code will be rejected. Any code clean-up +should be coordinated with the core team first. + +# Additional Resources + +* [General GitHub documentation](http://help.github.com/) +* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) From ac79fff1826b4beb633a9c967b20f6809b0a106b Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Sat, 29 Aug 2020 20:24:15 -0500 Subject: [PATCH 11/17] Push new build.gradle --- build.gradle | 15 ++++- src/main/java/net/rom/gctweaks/Ref.java | 5 +- .../java/net/rom/gctweaks/core/GCPlanets.java | 60 +++++++++++++++++-- .../rom/gctweaks/core/compat/CompatMods.java | 1 + 4 files changed, 71 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 8fcf418..8e06f19 100644 --- a/build.gradle +++ b/build.gradle @@ -121,12 +121,21 @@ dependencies { compile "GC-1.12-dev:Galacticraft-API:${GCVersion}" compile "GC-1.12-dev:Galacticraft-Planets-Dev:${GCVersion}" compile "GC-1.12-dev:MicdoodleCore-Dev:${GCVersion}" + compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" + + + // LOAD GC ADDONS compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api" - compile "asmodeuscore:AsmodeusCore-Dev:0.0.18" + compile "curse.maven:AsmodeusCore-Dev:3039768" compile "curse.maven:GSMod-0.0.14:3015062" + compile "curse.maven:ExtraPlanets-1.7.0:3031689" + runtime "curse.maven:MJRLib-1.2.0:3029769" + compile "curse.maven:ZollernGalaxy-2.0.17:3044657" + compile "curse.maven:MorePlanets-2.1.13-GC261:3043460" + runtime "curse.maven:SteveKinGLib-1.1.7:3043444" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" - compile "com.mjr.extraplanets:ExtraPlanets:1.12.2-0.6.6:dev" - compile "com.mjr.mjrlegendslib:MJRLegendsLib:1.12.2-1.1.9:dev" + runtime "mezz.jei:jei_1.12.2:4.15.0.297" + } minecraft { diff --git a/src/main/java/net/rom/gctweaks/Ref.java b/src/main/java/net/rom/gctweaks/Ref.java index 6f14b9b..23cb803 100644 --- a/src/main/java/net/rom/gctweaks/Ref.java +++ b/src/main/java/net/rom/gctweaks/Ref.java @@ -18,10 +18,13 @@ public class Ref { 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 D = "after:zollerngalaxy;"; + public static final String E = "after:moreplanets;"; + public static final String OPTS = A + B + C + D + E; public static final String MOD_GC = "required-after:galacticraftcore@[4.0.2.261,];required-after:galacticraftplanets;"; // Dependencies - public static final String DEPS = "required:forge@[" + MOD_FORGE_VERSION_MIN + ",);" + MOD_GC + ";" + A + B + C; + public static final String DEPS = "required:forge@[" + MOD_FORGE_VERSION_MIN + ",);" + MOD_GC + ";" + OPTS; } diff --git a/src/main/java/net/rom/gctweaks/core/GCPlanets.java b/src/main/java/net/rom/gctweaks/core/GCPlanets.java index c946242..6b5ad48 100644 --- a/src/main/java/net/rom/gctweaks/core/GCPlanets.java +++ b/src/main/java/net/rom/gctweaks/core/GCPlanets.java @@ -1,7 +1,10 @@ package net.rom.gctweaks.core; +import java.util.Map; + import com.mjr.extraplanets.planets.ExtraPlanets_Planets; +import asmodeuscore.core.configs.AsmodeusConfig; import galaxyspace.systems.SolarSystem.SolarSystemBodies; import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance; @@ -12,12 +15,15 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; import net.minecraft.util.ResourceLocation; +import net.rom.gctweaks.core.compat.CompatMods; +import stevekung.mods.moreplanets.init.MPPlanets; +import zollerngalaxy.planets.ZGPlanets; public class GCPlanets { public static Planet FAKE_OVERWORLD; public static Planet FAKE_ASTEROIDS; - - public static void initEp() { + + public static void initEp () { buildEp(); build(); } @@ -26,7 +32,7 @@ public static void initGs () { buildGs(); build(); } - + private static void buildEp () { ExtraPlanets_Planets.MERCURY.setParentSolarSystem(GCSystems.EP_SYSTEM); ExtraPlanets_Planets.CERES.setParentSolarSystem(GCSystems.EP_SYSTEM); @@ -37,8 +43,8 @@ private static void buildEp () { ExtraPlanets_Planets.PLUTO.setParentSolarSystem(GCSystems.EP_SYSTEM); ExtraPlanets_Planets.ERIS.setParentSolarSystem(GCSystems.EP_SYSTEM); } - - private static void buildGs() { + + private static void buildGs () { SolarSystemBodies.planetMercury.setParentSolarSystem(GCSystems.EP_SYSTEM); SolarSystemBodies.planetCeres.setParentSolarSystem(GCSystems.EP_SYSTEM); SolarSystemBodies.planetJupiter.setParentSolarSystem(GCSystems.EP_SYSTEM); @@ -46,7 +52,6 @@ private static void buildGs() { 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 () { @@ -55,6 +60,49 @@ private static void build () { .getPhaseShift(), GalacticraftCore.planetOverworld.getRelativeDistanceFromCenter().scaledDistance); buildAsteroids(FAKE_ASTEROIDS, "fakeRocks", GCSystems.EP_SYSTEM, AsteroidsModule.planetAsteroids .getPhaseShift(), 1.375F); + fixPlanetIcons(); + } + + private static void fixPlanetIcons () { + if (CompatMods.ZOLLERN.isLoaded() || CompatMods.MOREPLANETS.isLoaded()) { + for (Map.Entry planet : GalaxyRegistry.getRegisteredPlanets().entrySet()) { + Planet p = planet.getValue(); + if (p.getRelativeSize() != 1.0F) { + p.setRelativeSize(1.0F); + } + } + } + +// if (AsmodeusConfig.enableNewGalaxyMap) { +// if (CompatMods.ZOLLERN.isLoaded()) { +// ZGPlanets.starPsios.setRelativeSize(1.0F); +// ZGPlanets.starPraedyth.setRelativeSize(1.0F); +// ZGPlanets.starSol2.setRelativeSize(1.0F); +// ZGPlanets.starPantheon.setRelativeSize(1.0F); +// ZGPlanets.starOlympus.setRelativeSize(1.0F); +// ZGPlanets.starAsgard.setRelativeSize(1.0F); +// ZGPlanets.starVega.setRelativeSize(1.0F); +// ZGPlanets.starNova.setRelativeSize(1.0F); +// ZGPlanets.planetZollus.setRelativeSize(1.0F); +// ZGPlanets.planetKriffon.setRelativeSize(1.0F); +// ZGPlanets.planetPurgot.setRelativeSize(1.0F); +// ZGPlanets.planetEden.setRelativeSize(1.0F); +// ZGPlanets.planetXathius.setRelativeSize(1.0F); +// ZGPlanets.planetOasis.setRelativeSize(1.0F); +// ZGPlanets.planetXantheon.setRelativeSize(1.0F); +// ZGPlanets.planetCandora.setRelativeSize(1.0F); +// ZGPlanets.planetAtheon.setRelativeSize(1.0F); +// ZGPlanets.planetAltum.setRelativeSize(1.0F); +// ZGPlanets.planetCaligro.setRelativeSize(1.0F); +// } +// if (CompatMods.MOREPLANETS.isLoaded()) { +// MPPlanets.LAZENDUS.setRelativeSize(1.0F); +// MPPlanets.DIONA.setRelativeSize(1.0F); +// MPPlanets.CHALOS.setRelativeSize(1.0F); +// MPPlanets.NIBIRU.setRelativeSize(1.0F); +// MPPlanets.KOENTUS.setRelativeSize(1.0F); +// } +// } } public static void buildAsteroids (Planet planet, String planetName, SolarSystem solarSystem, float randomPhase, float au) { diff --git a/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java b/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java index deb0a0d..b4b2fba 100644 --- a/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java +++ b/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java @@ -15,6 +15,7 @@ public enum CompatMods implements IStringSerializable { GALAXYSPACE("galaxyspace"), PLANETPROGRESSION("planetprogression"), ASMODEUSCORE("asmodeuscore"), + ZOLLERN("zollerngalaxy"), MOREPLANETS("moreplanets"); private final String modid; From e5b0fcad8f8fb09cbdd01b5dc516a3e2e6a05f9e Mon Sep 17 00:00:00 2001 From: The Doctor <63055140+mMONTAGEe@users.noreply.github.com> Date: Wed, 2 Sep 2020 11:07:57 +0400 Subject: [PATCH 12/17] Ru translation --- src/main/resources/assets/gtweaks/lang/ru_ru.lang | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/resources/assets/gtweaks/lang/ru_ru.lang diff --git a/src/main/resources/assets/gtweaks/lang/ru_ru.lang b/src/main/resources/assets/gtweaks/lang/ru_ru.lang new file mode 100644 index 0000000..e2aa6c3 --- /dev/null +++ b/src/main/resources/assets/gtweaks/lang/ru_ru.lang @@ -0,0 +1,5 @@ +galaxy.wormhole= Алт Солнце +solarsystem.secondSystem=Альтернативное Солнце +star.epsystem=Солнце +planet.fakeOverworld=Земля +planet.fakeRocks=Астероиды \ No newline at end of file From d8ca2edde048540048a9e41667d74f4371b4384d Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Wed, 2 Sep 2020 15:22:33 -0500 Subject: [PATCH 13/17] try mixing mixins --- build.gradle | 404 +++--------------- gradle.properties | 2 +- .../core/mixins/CommandLocateMixin.java | 27 ++ .../mixins/GalacticTweaksMixinPlugin.java | 42 ++ .../SeperateAddonPlanets.java | 4 +- src/main/resources/mixins.galactictweaks.json | 15 + 6 files changed, 139 insertions(+), 355 deletions(-) create mode 100644 src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java create mode 100644 src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java create mode 100644 src/main/resources/mixins.galactictweaks.json diff --git a/build.gradle b/build.gradle index 8e06f19..69e1084 100644 --- a/build.gradle +++ b/build.gradle @@ -1,68 +1,38 @@ buildscript { repositories { - jcenter() - mavenCentral() maven { name = "forge" url = "https://files.minecraftforge.net/maven" - } - maven { - name = 'gradle' - url 'https://plugins.gradle.org/m2/' } + maven { + name = 'sponge' + url = 'https://repo.spongepowered.org/maven' + } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath "se.bjurr.gitchangelog:git-changelog-gradle-plugin:+" + classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' } } plugins { id 'com.matthewprenger.cursegradle' version '1.4.0' - id "io.freefair.lombok" version "2.9.5" - id 'maven-publish' + id 'net.ltgt.apt' version '0.10' // for lombok + id 'maven-publish' + id 'eclipse' id 'maven' } apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' - -import groovy.json.JsonSlurper - -eclipse.project { - buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' - natures 'org.eclipse.buildship.core.gradleprojectnature' -} - -class Secrets { - Map m_data = null +apply plugin: 'org.spongepowered.mixin' - final String getProperty(final String key) { - return (m_data && (m_data[key] != null)) ? m_data[key] : '' - } -} +apply from: "https://raw.githubusercontent.com/ReadOnly-Mods/Misc/master/Gradle/secretfile.gradle" -final def secretFile -if (System.getenv('SECRET_FILE')) { - secretFile = file System.getenv().SECRET_FILE -} else { - secretFile = file 'secret.json' -} - -import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask -import java.util.regex.Matcher - -project.ext.secret = new Secrets() -if (secretFile.exists()) { - secretFile.withReader { - project.secret.m_data = new JsonSlurper().parse it - } +if (project.hasProperty('secretFile')) { + + loadSecrets(new File((String) findProperty('secretFile'))) } -def versionBuild = 0 -if (System.getenv("BUILD_NUMBER") != null) - versionBuild = System.getenv("BUILD_NUMBER") - version = "${versionMajor}.${versionMinor}.${versionRev}" group = "${group}" archivesBaseName = "${name}" @@ -77,19 +47,14 @@ configurations { implementation.extendsFrom(embed) } -String GCBuild = "261" -String GCVersion = "1.12.2-4.0.2.${GCBuild}" +project.ext { + GCBuild = "261" + GCVersion = "1.12.2-4.0.2.${GCBuild}" +} +apply from: "https://raw.githubusercontent.com/ReadOnly-Mods/Misc/master/Gradle/gcdevfiles.gradle" repositories { - ivy { - url "https://micdoodle8.com/new-builds/" - layout 'pattern', { - artifact "[organization]/${GCBuild}/[module]-[revision].jar" - } - metadataSources { - artifact() - } - } + jcenter() maven { name 'MJRLegends' url = "https://maven.mjrlegends.com/" @@ -107,35 +72,30 @@ repositories { url = "http://maven.ic2.player.to" } maven { - name 'ReadOnlyMaven' - url = "https://maven.romvoid.dev" + url = "https://www.cursemaven.com" } maven { - url = "https://www.cursemaven.com" + url "http://repo.spongepowered.org/maven/" } } dependencies { + + compile "org.projectlombok:lombok:1.18.12" + apt "org.projectlombok:lombok:1.18.12" - compile "GC-1.12-dev:GalacticraftCore-Dev:${GCVersion}" - compile "GC-1.12-dev:Galacticraft-API:${GCVersion}" - compile "GC-1.12-dev:Galacticraft-Planets-Dev:${GCVersion}" - compile "GC-1.12-dev:MicdoodleCore-Dev:${GCVersion}" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" - // LOAD GC ADDONS compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api" compile "curse.maven:AsmodeusCore-Dev:3039768" compile "curse.maven:GSMod-0.0.14:3015062" compile "curse.maven:ExtraPlanets-1.7.0:3031689" runtime "curse.maven:MJRLib-1.2.0:3029769" - compile "curse.maven:ZollernGalaxy-2.0.17:3044657" - compile "curse.maven:MorePlanets-2.1.13-GC261:3043460" - runtime "curse.maven:SteveKinGLib-1.1.7:3043444" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" runtime "mezz.jei:jei_1.12.2:4.15.0.297" - + embed("org.spongepowered:mixin:0.7.11-SNAPSHOT") { transitive = false } + } minecraft { @@ -143,229 +103,55 @@ minecraft { runDir = "run" replace '${version}', project.version mappings = "${mcp}" - makeObfSourceJar false if (project.hasProperty('signSHA1') && getBooleanProperty('do_sign_jar')) { replace '@FINGERPRINT@', secret.signSHA1 } else { replace '@FINGERPRINT@', '' } + + clientRunArgs += "--mixin mixins.galactictweaks.json" + serverRunArgs += "--mixin mixins.galactictweaks.json" } -allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } -} - - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } +sourceSets { + main { + ext.refMap = "mixins.galactictweaks.refmap.json" + } } jar { - - manifest { - mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.archivesBaseName, - 'Implementation-Version': version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) - } -} - -task apiJar(type: Jar) { - onlyIf { - getBooleanProperty('create_api_jar') - } - from(sourceSets.main.output) { - include "net/rom/api/**" - } - from(sourceSets.main.java) { - include "net/rom/api/**" - } - - classifier = 'api' - from apiClasses - // from sourceSets.api.output - manifest.mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:api", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-api', - 'Implementation-Version': project.version, - 'Built-On': "${project.mc_version}-${project.forge_version}", - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})" - ) -} - -task deobfJar(type: Jar) { - onlyIf { - getBooleanProperty('create_deobf_jar') - } - - classifier = 'dev' - from sourceSets.main.output + from(configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }) { + exclude "LICENSE.txt", "META-INF/*.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF" + } manifest { - mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:deobf", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-deobf', - 'Implementation-Version': project.version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) - if (project.hasProperty('at_file')) { - attributes 'FMLAT': project.at_file - } - if (project.hasProperty('core_plugin')) { - attributes 'FMLCorePlugin': project.core_plugin - } - } -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - onlyIf { - getBooleanProperty('create_javadoc_jar') + attributes( + "FMLAT": "galactictweaks_at.cfg", + "FMLCorePluginContainsFMLMod": "true", + "TweakClass": "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs": "mixins.galactictweaks.json", + "ForceLoadAsMod": "true" + ) } - - classifier = 'javadoc' - from javadoc.getDestinationDir() - manifest.mainAttributes( - 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}:javadoc", - 'Timestamp': System.currentTimeMillis(), - 'Implementation-Title': project.name + '-javadoc', - 'Implementation-Version': project.version, - 'Built-On-Java': "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})", - 'Built-On': "${project.mc_version}-${project.forge_version}" - ) } task signJar(type: SignJar, dependsOn: reobfJar) { onlyIf { - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') + project.hasProperty('keyStore') } inputFile = jar.archivePath outputFile = jar.archivePath - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass -} - -task signApiJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_api_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = apiJar.archivePath - outputFile = apiJar.archivePath -} - -task signDeobfJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_deobf_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = deobfJar.archivePath - outputFile = deobfJar.archivePath -} - -task signSourceJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_source_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = sourceJar.archivePath - outputFile = sourceJar.archivePath -} - -task signJavadocJar(type: SignJar) { - onlyIf { - getBooleanProperty('create_javadoc_jar') && - getBooleanProperty('do_sign_jar') && - project.hasProperty('keyStore') - } - - keyStore = secret.keyStore - alias = secret.keyStoreAlias - storePass = secret.keyStorePass - keyPass = secret.keyStoreKeyPass - - inputFile = javadocJar.archivePath - outputFile = javadocJar.archivePath -} - -if (getBooleanProperty('do_sign_jar')) { - build.dependsOn signJar - build.dependsOn signApiJar - build.dependsOn signDeobfJar - build.dependsOn signSourceJar - build.dependsOn signJavadocJar -} - -tasks.publish.dependsOn build -tasks.curseforge.dependsOn publish - -artifacts { - if (getBooleanProperty('create_api_jar')) { - archives apiJar - } - if (getBooleanProperty('create_deobf_jar')) { - archives deobfJar - } - if (getBooleanProperty('create_source_jar')) { - archives sourceJar - } - if (getBooleanProperty('create_javadoc_jar')) { - archives javadocJar - } + keyStore = findProperty('keyStore') + alias = findProperty('keyStoreAlias') + storePass = findProperty('keyStorePass') + keyPass = findProperty('keyStoreKeyPass') } curseforge { if (project.hasProperty('cf_project_id')) { - apiKey = secret.curseforgeAPIKey + apiKey = findProperty('curseforgeAPIKey') ?: 0 project { id = project.cf_project_id if (project.hasProperty('cf_changelog_filename')) { @@ -432,100 +218,12 @@ curseforge { } } } - if (getBooleanProperty('create_api_jar')) { - addArtifact(apiJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} API" - } - } - } - if (getBooleanProperty('create_source_jar')) { - addArtifact(sourceJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Sources" - } - } - } - if (getBooleanProperty('create_deobf_jar')) { - addArtifact(deobfJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Development" - } - } - } - if (getBooleanProperty('create_javadoc_jar')) { - addArtifact(javadocJar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version} Javadoc" - } - } - } } } } -String getModFile() { - String path = '' - final FileTree tree = fileTree(dir: 'src/main/java') - tree.include '**/*.java' - tree.visit { final element -> - if (element.file.isFile()) { - element.file.eachLine { final String s -> - final String sTrim = s.trim() - if (sTrim.startsWith('@Mod(')) { - path = "src/main/java/${element.relativePath}" - } - } - } - } - return path -} - -String getModVersion(final String type) { - return getModVersion(type, modFile) -} - -String getModVersion(final String type, final String modFile) { - if ((modFile != null) && (modFile != '')) { - final File file = file(modFile) - final def prefix = ~/^(?:\s*)(?:(?public|protected|private) )?(?:(?static) )?(?:(?final) )?String $type = "(?:(?\d*)\.)?(?:(?\d*)\.)?(?:(?[^."]*)\.?)(?[^"]*)";$/ - for (final String s in file.readLines()) { - final Matcher matcher = (s.trim() =~ prefix) - if (matcher.matches()) { - return "${matcher.group('major') ?: '0'}.${matcher.group('minor') ?: '0'}.${matcher.group('patch')}" - } - } - } - return '0.0.0' -} - -def getGitChangelog() { - try { - def stdout = new ByteArrayOutputStream() - def gitHash = System.getenv('GIT_COMMIT') - def gitPrevHash = System.getenv('GIT_PREVIOUS_COMMIT') - def travisRange = System.getenv('TRAVIS_COMMIT_RANGE') - if(gitHash && gitPrevHash) { - exec { - println gitHash - println gitPrevHash - commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + gitPrevHash + '...' + gitHash - standardOutput = stdout - } - return stdout.toString().trim() - } else if(travisRange) { - exec { - commandLine 'git', 'log', '--pretty=tformat:- %s - %aN', '' + travisRange - standardOutput = stdout - } - return stdout.toString().trim() - } else { - return ""; - } - } catch(ignored) { - return ""; - } -} +build.dependsOn signJar +tasks.curseforge.dependsOn(build) boolean getBooleanProperty(final String property) { if (project.hasProperty(property)) { diff --git a/gradle.properties b/gradle.properties index 9302d84..ff28842 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ mcp=snapshot_20171003 ## Mod Versioning versionMajor=1 versionMinor=1 -versionRev=0 +versionRev=1 ## Cureforge Upload Configs cf_project_id=359766 diff --git a/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java b/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java new file mode 100644 index 0000000..6755e19 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java @@ -0,0 +1,27 @@ +package net.rom.gctweaks.core.mixins; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandLocate; + +@Mixin(CommandLocate.class) +public abstract class CommandLocateMixin { + + @Redirect( + method = "getTabCompletions(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/command/ICommandSender;[Ljava/lang/String;Lnet/minecraft/util/math/BlockPos;)Ljava/util/List;", + at = @At( + value = "INVOKE", + target = "net/minecraft/command/CommandLocate.getListOfStringsMatchingLastWord([Ljava/lang/String;[Ljava/lang/String;)Ljava/util/List;")) + private List addDungeonsToList (String[] args, String... possibilities) { + List list = CommandBase.getListOfStringsMatchingLastWord(args, "Dungeon"); + list.addAll(Arrays.stream(possibilities).collect(Collectors.toList())); + return CommandBase.getListOfStringsMatchingLastWord(args, list); + } +} diff --git a/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java b/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java new file mode 100644 index 0000000..fcb1313 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java @@ -0,0 +1,42 @@ +package net.rom.gctweaks.core.mixins; + +import java.util.List; +import java.util.Set; + +import org.spongepowered.asm.lib.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +public class GalacticTweaksMixinPlugin implements IMixinConfigPlugin { + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) + { + return true; + } + + @Override + public List getMixins() + { + return null; + } + + @Override + public String getRefMapperConfig() + { + return null; + } + + @Override + public void onLoad(String mixinPackage) {} + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) {} + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + +} diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java b/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java index d3c5275..ee3958a 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java +++ b/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java @@ -1,5 +1,6 @@ package net.rom.gctweaks.galacticraftchanges; +import asmodeuscore.core.astronomy.BodiesRegistry; import net.minecraftforge.common.config.Configuration; import net.rom.gctweaks.core.Feature; import net.rom.gctweaks.core.GCPlanets; @@ -38,7 +39,8 @@ public void syncConfig (Configuration config, String[] category) { @Override public void preInit () { if (seperatePlanets && CompatMods.EXTRAPLANETS.isLoaded() && CompatMods.GALAXYSPACE.isLoaded()) { - + BodiesRegistry.setMaxTier(10); + switch (modid) { case "extraplanets": GCSystems.init(); diff --git a/src/main/resources/mixins.galactictweaks.json b/src/main/resources/mixins.galactictweaks.json new file mode 100644 index 0000000..4818d74 --- /dev/null +++ b/src/main/resources/mixins.galactictweaks.json @@ -0,0 +1,15 @@ +{ + "required": true, + "minVersion": "0.7.11", + "compatibilityLevel": "JAVA_8", + "package": "net.rom.gctweaks.core.mixins", + "plugin": "net.rom.gctweaks.core.mixins.GalacticTweaksMixinPlugin", + "refmap": "mixins.galactictweaks.refmap.json", + "target": "@env(DEFAULT)", + "mixins": [ + "CommandLocateMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file From 288489fd7c66451b81265591d2fd6c72ab7c74b7 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Sat, 5 Sep 2020 07:13:49 -0500 Subject: [PATCH 14/17] refactor and change up stuff | remove mixins --- .gitignore | 3 +- build.gradle | 248 +++++++----------- gradle.properties | 15 +- sonar.json | 4 + .../java/net/rom/gctweaks/GalacticTweaks.java | 96 ++++++- .../net/rom/gctweaks/ModuleController.java | 16 +- src/main/java/net/rom/gctweaks/Ref.java | 8 +- .../java/net/rom/gctweaks/base/Feature.java | 42 +++ .../rom/gctweaks/base/InternalFeature.java | 37 +++ .../net/rom/gctweaks/base/InternalModule.java | 61 +++++ .../rom/gctweaks/{core => base}/Module.java | 21 +- .../{ => base}/core/compat/CompatMods.java | 2 +- .../core/compat/PlanetProgressionCompat.java | 2 +- .../{ => base}/core/proxy/ClientProxy.java | 6 +- .../{ => base}/core/proxy/CommonProxy.java | 2 +- .../{ => base}/core/utils/GameUtil.java | 3 +- .../{ => base}/core/utils/I18nHelper.java | 2 +- .../{ => base}/core/utils/LogHelper.java | 2 +- .../gctweaks/{ => base}/core/utils/Utilz.java | 2 +- .../base/version/CommandDownloadUpdate.java | 49 ++++ .../gctweaks/base/version/DownloadUpdate.java | 77 ++++++ .../base/version/ThreadVersionChecker.java | 37 +++ .../gctweaks/base/version/VersionChecker.java | 61 +++++ .../java/net/rom/gctweaks/core/Feature.java | 92 ------- .../rom/gctweaks/core/NoConfigFeature.java | 73 ------ .../core/mixins/CommandLocateMixin.java | 27 -- .../mixins/GalacticTweaksMixinPlugin.java | 42 --- .../GalacticraftModule.java | 21 -- .../rom/gctweaks/gc/GalacticraftModule.java | 29 ++ .../features}/CompressorFixes.java | 4 +- .../features}/MobsBreatheInSpace.java | 4 +- .../features}/NoSpaceMusic.java | 4 +- .../features}/OverworldComets.java | 4 +- .../features/galaxyfeature}/GCPlanets.java | 7 +- .../features/galaxyfeature}/GCSystems.java | 2 +- .../galaxyfeature}/SeperateAddonPlanets.java | 8 +- .../oxygenfeature}/SpawnWithOxygenEquip.java | 82 +++--- .../command/CommandOxygenReset.java | 76 ++++++ .../rom/gctweaks/internal/BuiltInModule.java | 15 ++ .../gctweaks/internal/CrashLogWarning.java | 128 +++++++++ .../gctweaks/modpacks/CustomCrashLogData.java | 77 ------ .../rom/gctweaks/modpacks/ModpackModule.java | 17 -- .../resources/assets/gtweaks/lang/en_us.lang | 19 +- 43 files changed, 908 insertions(+), 619 deletions(-) create mode 100644 sonar.json create mode 100644 src/main/java/net/rom/gctweaks/base/Feature.java create mode 100644 src/main/java/net/rom/gctweaks/base/InternalFeature.java create mode 100644 src/main/java/net/rom/gctweaks/base/InternalModule.java rename src/main/java/net/rom/gctweaks/{core => base}/Module.java (74%) rename src/main/java/net/rom/gctweaks/{ => base}/core/compat/CompatMods.java (95%) rename src/main/java/net/rom/gctweaks/{ => base}/core/compat/PlanetProgressionCompat.java (93%) rename src/main/java/net/rom/gctweaks/{ => base}/core/proxy/ClientProxy.java (82%) rename src/main/java/net/rom/gctweaks/{ => base}/core/proxy/CommonProxy.java (92%) rename src/main/java/net/rom/gctweaks/{ => base}/core/utils/GameUtil.java (97%) rename src/main/java/net/rom/gctweaks/{ => base}/core/utils/I18nHelper.java (99%) rename src/main/java/net/rom/gctweaks/{ => base}/core/utils/LogHelper.java (99%) rename src/main/java/net/rom/gctweaks/{ => base}/core/utils/Utilz.java (97%) create mode 100644 src/main/java/net/rom/gctweaks/base/version/CommandDownloadUpdate.java create mode 100644 src/main/java/net/rom/gctweaks/base/version/DownloadUpdate.java create mode 100644 src/main/java/net/rom/gctweaks/base/version/ThreadVersionChecker.java create mode 100644 src/main/java/net/rom/gctweaks/base/version/VersionChecker.java delete mode 100644 src/main/java/net/rom/gctweaks/core/Feature.java delete mode 100644 src/main/java/net/rom/gctweaks/core/NoConfigFeature.java delete mode 100644 src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java delete mode 100644 src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java delete mode 100644 src/main/java/net/rom/gctweaks/galacticraftchanges/GalacticraftModule.java create mode 100644 src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features}/CompressorFixes.java (97%) rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features}/MobsBreatheInSpace.java (94%) rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features}/NoSpaceMusic.java (95%) rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features}/OverworldComets.java (97%) rename src/main/java/net/rom/gctweaks/{core => gc/features/galaxyfeature}/GCPlanets.java (96%) rename src/main/java/net/rom/gctweaks/{core => gc/features/galaxyfeature}/GCSystems.java (95%) rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features/galaxyfeature}/SeperateAddonPlanets.java (88%) rename src/main/java/net/rom/gctweaks/{galacticraftchanges => gc/features/oxygenfeature}/SpawnWithOxygenEquip.java (92%) create mode 100644 src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/command/CommandOxygenReset.java create mode 100644 src/main/java/net/rom/gctweaks/internal/BuiltInModule.java create mode 100644 src/main/java/net/rom/gctweaks/internal/CrashLogWarning.java delete mode 100644 src/main/java/net/rom/gctweaks/modpacks/CustomCrashLogData.java delete mode 100644 src/main/java/net/rom/gctweaks/modpacks/ModpackModule.java diff --git a/.gitignore b/.gitignore index 5276d8e..50150ed 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,5 @@ build # other eclipse run -secrets.json .gradle -/secret.json +build.properties diff --git a/build.gradle b/build.gradle index 69e1084..e601073 100644 --- a/build.gradle +++ b/build.gradle @@ -1,37 +1,39 @@ buildscript { - repositories { - maven { - name = "forge" - url = "https://files.minecraftforge.net/maven" - } + repositories { + maven { + name = "gradle" + url = "https://plugins.gradle.org/m2/" + } maven { - name = 'sponge' - url = 'https://repo.spongepowered.org/maven' + name = "forge" + url = "https://files.minecraftforge.net/maven" } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' - } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7" + } } plugins { - id 'com.matthewprenger.cursegradle' version '1.4.0' - id 'net.ltgt.apt' version '0.10' // for lombok - id 'maven-publish' + id 'com.matthewprenger.cursegradle' version '1.4.0' + id 'net.ltgt.apt' version '0.10' id 'eclipse' - id 'maven' + id "jacoco" } +apply plugin: "java" +apply plugin: "org.sonarqube" apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'org.spongepowered.mixin' -apply from: "https://raw.githubusercontent.com/ReadOnly-Mods/Misc/master/Gradle/secretfile.gradle" -if (project.hasProperty('secretFile')) { - - loadSecrets(new File((String) findProperty('secretFile'))) -} +// ========================================== +// Load Secrets +// ========================================== +apply from: "https://raw.githubusercontent.com/ReadOnly-Mods/Misc/master/Gradle/secret.gradle" +loadSecrets() +// ========================================== + version = "${versionMajor}.${versionMinor}.${versionRev}" group = "${group}" @@ -39,19 +41,30 @@ archivesBaseName = "${name}" sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} - -configurations { - embed - implementation.extendsFrom(embed) + sourceCompatibility = targetCompatibility = '1.8' } +// ========================================== +// Load GC Dev Files +// ========================================== project.ext { - GCBuild = "261" - GCVersion = "1.12.2-4.0.2.${GCBuild}" + GCBuild = "261" + GCVersion = "1.12.2-4.0.2.${GCBuild}" } apply from: "https://raw.githubusercontent.com/ReadOnly-Mods/Misc/master/Gradle/gcdevfiles.gradle" +// ========================================== + +sonarqube { + properties { + property 'sonar.GalacticTweaks', 'GalacticTweaks SonarQube Scanner' + } +} + +jacocoTestReport { + reports { + xml.enabled true + } +} repositories { jcenter() @@ -62,11 +75,11 @@ repositories { maven { name = 'curseforge' url = 'https://minecraft.curseforge.com/api/maven/' - } - maven { - name 'DVS1 Maven FS' - url 'http://dvs1.progwml6.com/files/maven' - } + } + maven { + name 'DVS1 Maven FS' + url 'http://dvs1.progwml6.com/files/maven' + } maven { name 'IC2' url = "http://maven.ic2.player.to" @@ -75,17 +88,24 @@ repositories { url = "https://www.cursemaven.com" } maven { - url "http://repo.spongepowered.org/maven/" + // Location of CurseAPI Files + url "https://jitpack.io" } } dependencies { + compile "com.vdurmont:semver4j:3.1.0" + + compile("com.github.TheRandomLabs:CurseAPI:master-SNAPSHOT"){ + exclude group: 'com.google.guava', module: 'guava' + } + compile "org.projectlombok:lombok:1.18.12" apt "org.projectlombok:lombok:1.18.12" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" - + // LOAD GC ADDONS compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api" compile "curse.maven:AsmodeusCore-Dev:3039768" @@ -94,141 +114,63 @@ dependencies { runtime "curse.maven:MJRLib-1.2.0:3029769" compile "industrial-craft:industrialcraft-2-2.8.99:ex112:api" runtime "mezz.jei:jei_1.12.2:4.15.0.297" - embed("org.spongepowered:mixin:0.7.11-SNAPSHOT") { transitive = false } - -} -minecraft { - version = "${mc_version}-${forge_version}" - runDir = "run" - replace '${version}', project.version - mappings = "${mcp}" - - if (project.hasProperty('signSHA1') && getBooleanProperty('do_sign_jar')) { - replace '@FINGERPRINT@', secret.signSHA1 - } else { - replace '@FINGERPRINT@', '' - } - - clientRunArgs += "--mixin mixins.galactictweaks.json" - serverRunArgs += "--mixin mixins.galactictweaks.json" } -sourceSets { - main { - ext.refMap = "mixins.galactictweaks.refmap.json" - } +minecraft { + version = "${mc_version}-${forge_version}" + runDir = "run" + mappings = "${mcp}" + + replace '@VERSION@', project.version + replace '@MCVERSION@', project.minecraft.version + replace '@FINGERPRINT@', project.findProperty('signSHA1') + replaceIn "Ref.java" } jar { - from(configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }) { - exclude "LICENSE.txt", "META-INF/*.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF" + manifest { + mainAttributes( + 'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}", + 'Timestamp': System.currentTimeMillis(), + 'Implementation-Title': project.archivesBaseName, + 'Implementation-Version': version, + 'Built-On-Java': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Built-On': "${project.mc_version}-${project.forge_version}" + ) } - manifest { - attributes( - "FMLAT": "galactictweaks_at.cfg", - "FMLCorePluginContainsFMLMod": "true", - "TweakClass": "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs": "mixins.galactictweaks.json", - "ForceLoadAsMod": "true" - ) - } } task signJar(type: SignJar, dependsOn: reobfJar) { - onlyIf { - project.hasProperty('keyStore') - } + onlyIf { + project.hasProperty('keyStore') + } - inputFile = jar.archivePath - outputFile = jar.archivePath + inputFile = jar.archivePath + outputFile = jar.archivePath - keyStore = findProperty('keyStore') - alias = findProperty('keyStoreAlias') - storePass = findProperty('keyStorePass') - keyPass = findProperty('keyStoreKeyPass') + keyStore = findProperty('keyStore') + alias = findProperty('keyStoreAlias') + storePass = findProperty('keyStorePass') + keyPass = findProperty('keyStoreKeyPass') } curseforge { - if (project.hasProperty('cf_project_id')) { - apiKey = findProperty('curseforgeAPIKey') ?: 0 + if (secret.containsKey('curseapi')) { + apiKey = secret.curseapi project { - id = project.cf_project_id - if (project.hasProperty('cf_changelog_filename')) { - changelog = file(project.cf_changelog_filename) - } else { - changelog = getGitChangelog - } - if (project.hasProperty('cf_changelog_type')) { - changelogType = project.cf_changelog_type - } - if ((project.hasProperty('cf_release_type')) && ((project.cf_release_type == 'alpha') || (project.cf_release_type == 'beta') || (project.cf_release_type == 'release'))) { - releaseType = project.cf_release_type - } else { - releaseType = 'alpha' - } - if (project.hasProperty('cf_versions')) { - final def versions = "${project.cf_versions}".split(', ') - versions.each { - addGameVersion "${it}" - } - } + id = "359766" + changelog = file("CHANGELOG.md") + changelogType = "markdown" + releaseType = "release" + addGameVersion mc_version + mainArtifact(jar) { - if (getBooleanProperty('cf_use_custom_display_name')) { - displayName = "${project.name} ${project.display_version}" - } - if (project.hasProperty('cf_requirements') || project.hasProperty('cf_optionals') || project.hasProperty('cf_embeddeds') || project.hasProperty('cf_tools') || project.hasProperty('cf_incompatibles') || project.hasProperty('cf_includes')) { - relations { - if (project.hasProperty('cf_requirements')) { - final def requirements = "${project.cf_requirements}".split(', ') - requirements.each { - requiredDependency "${it}" - } - } - if (project.hasProperty('cf_optionals')) { - final def optionals = "${project.cf_optionals}".split(', ') - optionals.each { - optionalDependency "${it}" - } - } - if (project.hasProperty('cf_embeddeds')) { - final def embeddeds = "${project.cf_embeddeds}".split(', ') - embeddeds.each { - embeddedLibrary "${it}" - } - } - if (project.hasProperty('cf_tools')) { - final def tools = "${project.cf_tools}".split(', ') - tools.each { - tool "${it}" - } - } - if (project.hasProperty('cf_incompatibles')) { - final def incompatibles = "${project.cf_incompatibles}".split(', ') - incompatibles.each { - incompatible "${it}" - } - } - if (project.hasProperty('cf_includes')) { - final def includes = "${project.cf_includes}".split(', ') - includes.each { - include "${it}" - } - } - } - } + displayName = "GalacticTweaks-" + mc_version + "-" + version } } - } + } } build.dependsOn signJar -tasks.curseforge.dependsOn(build) - -boolean getBooleanProperty(final String property) { - if (project.hasProperty(property)) { - return ((String) project.findProperty(property)).toBoolean() - } else { - return false - } -} \ No newline at end of file +tasks.curseforge.dependsOn(build) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ff28842..ffe2fd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,8 +15,8 @@ mcp=snapshot_20171003 ## Mod Versioning versionMajor=1 -versionMinor=1 -versionRev=1 +versionMinor=2 +versionRev=0 ## Cureforge Upload Configs cf_project_id=359766 @@ -24,13 +24,4 @@ cf_release_type=release cf_changelog_filename=CHANGELOG.md cf_changelog_type=markdown cf_versions=1.12.2 -cf_use_custom_display_name=false -#dep_has_ats=false - -## Jar Stuff -do_sign_jar=false -#fingerprint= -create_source_jar=false -create_api_jar=false -create_deobf_jar=false -create_javadoc_jar=false \ No newline at end of file +cf_use_custom_display_name=false \ No newline at end of file diff --git a/sonar.json b/sonar.json new file mode 100644 index 0000000..2b0ca49 --- /dev/null +++ b/sonar.json @@ -0,0 +1,4 @@ +{ + "sonarHost": "http://provider.readonly.ml:9000/", + "sonarProjectKey": "net.rom:GalacticTweaks" +} diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 6d54ca9..513d2cb 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -7,17 +7,23 @@ 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.FMLFingerprintViolationEvent; 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.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; -import net.rom.gctweaks.core.Module; -import net.rom.gctweaks.core.proxy.CommonProxy; -import net.rom.gctweaks.core.utils.I18nHelper; -import net.rom.gctweaks.core.utils.LogHelper; +import net.rom.gctweaks.base.InternalModule; +import net.rom.gctweaks.base.Module; +import net.rom.gctweaks.base.core.proxy.CommonProxy; +import net.rom.gctweaks.base.core.utils.GameUtil; +import net.rom.gctweaks.base.core.utils.I18nHelper; +import net.rom.gctweaks.base.core.utils.LogHelper; +import net.rom.gctweaks.base.version.CommandDownloadUpdate; +import net.rom.gctweaks.gc.features.oxygenfeature.command.CommandOxygenReset; @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 { @@ -33,35 +39,103 @@ public boolean networkCheck(Map map, Side side) { return true; } - @SidedProxy(clientSide = "net.rom.gctweaks.core.proxy.ClientProxy", serverSide = "net.rom.gctweaks.core.proxy.CommonProxy") + @SidedProxy(clientSide = "net.rom.gctweaks.base.core.proxy.ClientProxy", serverSide = "net.rom.gctweaks.base.core.proxy.CommonProxy") public static CommonProxy proxy; + + @EventHandler + public void onFingerprintViolation (FMLFingerprintViolationEvent event) { + if(!GameUtil.isDeobfuscated()) { + logger.warn("Invalid fingerprint detected! The file " + event.getSource().getName() + + " may have been tampered with. This version will NOT be supported by the author!"); + } else { + logger.info("Ignoring fingerprint signing since we are in a Development Enviroment"); + } + + } @EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); + + // ========================================== + // Internal Modules + // ========================================== + // ~ Register ~ // + ModuleController.registerInternalModules(); + + // ~ Network ~ // + ModuleController.internals.forEach(module -> module.registerPacket(network)); + + // ~ Phase ~ // + ModuleController.internals.forEach(InternalModule::preInit); + + // ========================================== + // Feature Modules + // ========================================== + // ~ Register ~ // ModuleController.registerModules(); + + // ~ Configurations ~ // ModuleController.modules.forEach(module -> module.setupConfig(event)); - syncConfig(); + ModuleController.modules.forEach(Module::syncConfig); + + // ~ Network ~ // ModuleController.modules.forEach(module -> module.registerPacket(network)); + // ~ Phase ~ // ModuleController.modules.forEach(Module::preInit); proxy.preInit(event); } @EventHandler public void init(FMLInitializationEvent event) { + + // ========================================== + // Internal Modules + // ========================================== + // ~ Phase ~ // + ModuleController.internals.forEach(InternalModule::init); + + // ========================================== + // Feature Modules + // ========================================== + // ~ Phase ~ // ModuleController.modules.forEach(Module::init); proxy.init(event); } @EventHandler public void postInit(FMLPostInitializationEvent event) { + + // ========================================== + // Internal Modules + // ========================================== + // ~ Phase ~ // + ModuleController.internals.forEach(InternalModule::postInit); + + // ========================================== + // Feature Modules + // ========================================== + // ~ Phase ~ // ModuleController.modules.forEach(Module::postInit); proxy.postInit(event); } - - private void syncConfig() { - ModuleController.modules.forEach(Module::syncConfig); - - } + + @EventHandler + public void onServerStarting(FMLServerStartingEvent event) { + + // ========================================== + // Internal Modules + // ========================================== + // ~ Phase ~ // + ModuleController.internals.forEach(internal -> internal.serverStartingEvent(event)); + + // ========================================== + // Feature Modules + // ========================================== + // ~ Phase ~ // + ModuleController.modules.forEach(module -> module.serverStartingEvent(event)); + + event.registerServerCommand(new CommandDownloadUpdate()); + } } diff --git a/src/main/java/net/rom/gctweaks/ModuleController.java b/src/main/java/net/rom/gctweaks/ModuleController.java index a4f9f42..44f357d 100644 --- a/src/main/java/net/rom/gctweaks/ModuleController.java +++ b/src/main/java/net/rom/gctweaks/ModuleController.java @@ -3,18 +3,22 @@ import java.util.ArrayList; import java.util.List; -import net.rom.gctweaks.core.Module; -import net.rom.gctweaks.galacticraftchanges.GalacticraftModule; -import net.rom.gctweaks.modpacks.ModpackModule; +import net.rom.gctweaks.base.InternalModule; +import net.rom.gctweaks.base.Module; +import net.rom.gctweaks.gc.GalacticraftModule; +import net.rom.gctweaks.internal.BuiltInModule; public class ModuleController { public static List modules = new ArrayList<>(); + public static List internals = new ArrayList<>(); + public static void registerModules() { modules.add(new GalacticraftModule("Galacticraft Module")); - modules.add(new ModpackModule()); } - - + + public static void registerInternalModules() { + internals.add(new BuiltInModule()); + } } diff --git a/src/main/java/net/rom/gctweaks/Ref.java b/src/main/java/net/rom/gctweaks/Ref.java index 23cb803..a891430 100644 --- a/src/main/java/net/rom/gctweaks/Ref.java +++ b/src/main/java/net/rom/gctweaks/Ref.java @@ -3,13 +3,11 @@ public class Ref { // Mod info - public static final String MOD_ID = "gtweaks"; + public static final String MOD_ID = "gctweaks"; public static final String MOD_NAME = "GalacticTweaks"; - public static final String MOD_VERSION = "${version}"; - public static final String MOD_BUILD_NUMBER = "@BUILD_NUMBER@"; - public static final String MOD_MC_VERSION = "@MC_VERSION@"; + public static final String MOD_VERSION = "@VERSION@"; + public static final String MOD_MC_VERSION = "@MCVERSION@"; public static final String MOD_FINGERPRINT = "@FINGERPRINT@"; - public static final String VERSION_URL = ""; // MOD ID's public static final String MOD_FORGE = "forge"; diff --git a/src/main/java/net/rom/gctweaks/base/Feature.java b/src/main/java/net/rom/gctweaks/base/Feature.java new file mode 100644 index 0000000..a0059eb --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/Feature.java @@ -0,0 +1,42 @@ +package net.rom.gctweaks.base; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; + +/** + * The Abstract Class Feature. + */ +public abstract class Feature { + + public void preInit () {} + + public void init () {} + + public void postInit () {} + + public void proxyPostInit () {} + + public void proxyPreInit () {} + + public void proxyInit () {} + + public void ServerStartingEvent (FMLServerStartingEvent event) {} + + public abstract String[] category (); + + public abstract String comment (); + + public abstract void syncConfig (Configuration config, String[] strings); + + public boolean usesEvents () { + return false; + } + + public boolean sidedProxy () { + return false; + } + + public void registerPacket (SimpleNetworkWrapper network) {} + +} diff --git a/src/main/java/net/rom/gctweaks/base/InternalFeature.java b/src/main/java/net/rom/gctweaks/base/InternalFeature.java new file mode 100644 index 0000000..894824a --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/InternalFeature.java @@ -0,0 +1,37 @@ +package net.rom.gctweaks.base; + +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; + +public abstract class InternalFeature { + + public void preInit () {} + + public void init () {} + + public void postInit () {} + + public void proxyPostInit () {} + + public void proxyPreInit () {} + + public void proxyInit () {} + + public boolean usesEvents () { + return false; + } + + public boolean sidedProxy () { + return false; + } + + public void ServerStartingEvent (FMLServerStartingEvent event) {} + + /** + * Register packet. + * + * @param network + */ + public void registerPacket (SimpleNetworkWrapper network) {} + +} diff --git a/src/main/java/net/rom/gctweaks/base/InternalModule.java b/src/main/java/net/rom/gctweaks/base/InternalModule.java new file mode 100644 index 0000000..3161aa2 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/InternalModule.java @@ -0,0 +1,61 @@ +package net.rom.gctweaks.base; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; + +public abstract class InternalModule { + private List internals = new ArrayList<>(); + + public abstract void addInternalFeature (); + + public InternalModule() { + addInternalFeature(); + } + + public void preInit () { + internals.stream().filter(InternalFeature::usesEvents).forEach(MinecraftForge.EVENT_BUS::register); + internals.forEach(InternalFeature::preInit); + } + + public void init () { + internals.forEach(InternalFeature::init); + } + + public void postInit () { + internals.forEach(InternalFeature::postInit); + } + + + ////////// PROXIES /////////// + + public void proxyPreInit () { + internals.stream().filter(InternalFeature::sidedProxy).forEach(MinecraftForge.EVENT_BUS::register); + internals.forEach(InternalFeature::proxyPreInit); + } + + public void proxyInit () { + internals.forEach(InternalFeature::proxyInit); + } + + public void proxyPostInit () { + internals.forEach(InternalFeature::proxyPostInit); + } + + public void serverStartingEvent(FMLServerStartingEvent event) { + internals.forEach(internal -> internal.ServerStartingEvent(event)); + } + + ////////// MISC ////////// + + protected void registerInternalFeature (InternalFeature feature) { + internals.add(feature); + } + + public void registerPacket (SimpleNetworkWrapper network) { + internals.forEach(feature -> feature.registerPacket(network)); + } +} diff --git a/src/main/java/net/rom/gctweaks/core/Module.java b/src/main/java/net/rom/gctweaks/base/Module.java similarity index 74% rename from src/main/java/net/rom/gctweaks/core/Module.java rename to src/main/java/net/rom/gctweaks/base/Module.java index 2a48378..f725bc2 100644 --- a/src/main/java/net/rom/gctweaks/core/Module.java +++ b/src/main/java/net/rom/gctweaks/base/Module.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core; +package net.rom.gctweaks.base; import java.io.File; import java.util.ArrayList; @@ -7,11 +7,11 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; public abstract class Module { private List features = new ArrayList<>(); - private List features2 = new ArrayList<>(); private String name; private Configuration config; private boolean setConfig; @@ -32,15 +32,11 @@ public Module() { public void preInit () { features.stream().filter(Feature::usesEvents).forEach(MinecraftForge.EVENT_BUS::register); features.forEach(Feature::preInit); - features2.stream().filter(NoConfigFeature::usesEvents).forEach(MinecraftForge.EVENT_BUS::register); - features2.forEach(NoConfigFeature::preInit); } 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) { @@ -53,22 +49,22 @@ public void setupConfig (FMLPreInitializationEvent event) { public void init () { features.forEach(Feature::init); - features2.forEach(NoConfigFeature::init); } public void postInit () { features.forEach(Feature::postInit); - features2.forEach(NoConfigFeature::postInit); } public void proxyInit () { features.forEach(Feature::proxyInit); - features2.forEach(NoConfigFeature::proxyInit); } public void proxyPostInit () { features.forEach(Feature::proxyPostInit); - features2.forEach(NoConfigFeature::proxyPostInit); + } + + public void serverStartingEvent(FMLServerStartingEvent event) { + features.forEach(feature -> feature.ServerStartingEvent(event)); } public Configuration getConfig () { @@ -88,12 +84,7 @@ protected void registerFeature (Feature feature) { features.add(feature); } - 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)); } } diff --git a/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java b/src/main/java/net/rom/gctweaks/base/core/compat/CompatMods.java similarity index 95% rename from src/main/java/net/rom/gctweaks/core/compat/CompatMods.java rename to src/main/java/net/rom/gctweaks/base/core/compat/CompatMods.java index b4b2fba..070ad72 100644 --- a/src/main/java/net/rom/gctweaks/core/compat/CompatMods.java +++ b/src/main/java/net/rom/gctweaks/base/core/compat/CompatMods.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.compat; +package net.rom.gctweaks.base.core.compat; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/net/rom/gctweaks/core/compat/PlanetProgressionCompat.java b/src/main/java/net/rom/gctweaks/base/core/compat/PlanetProgressionCompat.java similarity index 93% rename from src/main/java/net/rom/gctweaks/core/compat/PlanetProgressionCompat.java rename to src/main/java/net/rom/gctweaks/base/core/compat/PlanetProgressionCompat.java index e6aa62b..568774b 100644 --- a/src/main/java/net/rom/gctweaks/core/compat/PlanetProgressionCompat.java +++ b/src/main/java/net/rom/gctweaks/base/core/compat/PlanetProgressionCompat.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.compat; +package net.rom.gctweaks.base.core.compat; import com.mjr.planetprogression.api.research.ResearchHooksSP; diff --git a/src/main/java/net/rom/gctweaks/core/proxy/ClientProxy.java b/src/main/java/net/rom/gctweaks/base/core/proxy/ClientProxy.java similarity index 82% rename from src/main/java/net/rom/gctweaks/core/proxy/ClientProxy.java rename to src/main/java/net/rom/gctweaks/base/core/proxy/ClientProxy.java index 11c0d70..8fc5a03 100644 --- a/src/main/java/net/rom/gctweaks/core/proxy/ClientProxy.java +++ b/src/main/java/net/rom/gctweaks/base/core/proxy/ClientProxy.java @@ -1,10 +1,11 @@ -package net.rom.gctweaks.core.proxy; +package net.rom.gctweaks.base.core.proxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.rom.gctweaks.ModuleController; -import net.rom.gctweaks.core.Module; +import net.rom.gctweaks.base.Module; +import net.rom.gctweaks.base.version.VersionChecker; public class ClientProxy extends CommonProxy { @@ -17,6 +18,7 @@ public void preInit(FMLPreInitializationEvent event) { @Override public void init(FMLInitializationEvent event) { ModuleController.modules.forEach(Module::proxyInit); + VersionChecker.init(); super.init(event); } diff --git a/src/main/java/net/rom/gctweaks/core/proxy/CommonProxy.java b/src/main/java/net/rom/gctweaks/base/core/proxy/CommonProxy.java similarity index 92% rename from src/main/java/net/rom/gctweaks/core/proxy/CommonProxy.java rename to src/main/java/net/rom/gctweaks/base/core/proxy/CommonProxy.java index c5a125b..5abf32f 100644 --- a/src/main/java/net/rom/gctweaks/core/proxy/CommonProxy.java +++ b/src/main/java/net/rom/gctweaks/base/core/proxy/CommonProxy.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.proxy; +package net.rom.gctweaks.base.core.proxy; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLInitializationEvent; diff --git a/src/main/java/net/rom/gctweaks/core/utils/GameUtil.java b/src/main/java/net/rom/gctweaks/base/core/utils/GameUtil.java similarity index 97% rename from src/main/java/net/rom/gctweaks/core/utils/GameUtil.java rename to src/main/java/net/rom/gctweaks/base/core/utils/GameUtil.java index dd2fe02..64c2e2c 100644 --- a/src/main/java/net/rom/gctweaks/core/utils/GameUtil.java +++ b/src/main/java/net/rom/gctweaks/base/core/utils/GameUtil.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.utils; +package net.rom.gctweaks.base.core.utils; import net.minecraft.client.Minecraft; import net.minecraft.launchwrapper.Launch; @@ -51,7 +51,6 @@ public static Minecraft getMinecraft() { * tooltip caches are done in {@link LoaderState#AVAILABLE}, in-game is * {@link LoaderState#SERVER_STARTED}. * - * @since 3.0.8 */ public static boolean shouldCalculateTooltip() { LoaderState state = Loader.instance().getLoaderState(); diff --git a/src/main/java/net/rom/gctweaks/core/utils/I18nHelper.java b/src/main/java/net/rom/gctweaks/base/core/utils/I18nHelper.java similarity index 99% rename from src/main/java/net/rom/gctweaks/core/utils/I18nHelper.java rename to src/main/java/net/rom/gctweaks/base/core/utils/I18nHelper.java index 3c96149..1ed944a 100644 --- a/src/main/java/net/rom/gctweaks/core/utils/I18nHelper.java +++ b/src/main/java/net/rom/gctweaks/base/core/utils/I18nHelper.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.utils; +package net.rom.gctweaks.base.core.utils; import java.util.HashSet; import java.util.Locale; diff --git a/src/main/java/net/rom/gctweaks/core/utils/LogHelper.java b/src/main/java/net/rom/gctweaks/base/core/utils/LogHelper.java similarity index 99% rename from src/main/java/net/rom/gctweaks/core/utils/LogHelper.java rename to src/main/java/net/rom/gctweaks/base/core/utils/LogHelper.java index 17816d5..d25381e 100644 --- a/src/main/java/net/rom/gctweaks/core/utils/LogHelper.java +++ b/src/main/java/net/rom/gctweaks/base/core/utils/LogHelper.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.rom.gctweaks.core.utils; +package net.rom.gctweaks.base.core.utils; import java.io.IOException; diff --git a/src/main/java/net/rom/gctweaks/core/utils/Utilz.java b/src/main/java/net/rom/gctweaks/base/core/utils/Utilz.java similarity index 97% rename from src/main/java/net/rom/gctweaks/core/utils/Utilz.java rename to src/main/java/net/rom/gctweaks/base/core/utils/Utilz.java index a2dd226..ffdbb1b 100644 --- a/src/main/java/net/rom/gctweaks/core/utils/Utilz.java +++ b/src/main/java/net/rom/gctweaks/base/core/utils/Utilz.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core.utils; +package net.rom.gctweaks.base.core.utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.text.TextComponentString; diff --git a/src/main/java/net/rom/gctweaks/base/version/CommandDownloadUpdate.java b/src/main/java/net/rom/gctweaks/base/version/CommandDownloadUpdate.java new file mode 100644 index 0000000..6bd28f7 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/version/CommandDownloadUpdate.java @@ -0,0 +1,49 @@ +package net.rom.gctweaks.base.version; + +import com.therandomlabs.curseapi.CurseException; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; + +public class CommandDownloadUpdate extends CommandBase { + + @Override + public String getName () { + return "download-latest-gctweaks"; + } + + @Override + public String getUsage (ICommandSender sender) { + return "/download-latest-gctweaks "; + } + + @Override + public boolean checkPermission (MinecraftServer server, ICommandSender sender) { + return server.isSinglePlayer() || super.checkPermission(server, sender); + } + + @Override + public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (args.length == 1) + if (VersionChecker.downloadedFile) + sender.sendMessage(new TextComponentTranslation("gctweaks.versions.downloadedAlready") + .setStyle(new Style().setColor(TextFormatting.RED))); + else if (VersionChecker.startedDownload) + sender.sendMessage(new TextComponentTranslation("gctweaks.versions.downloadingAlready") + .setStyle(new Style().setColor(TextFormatting.RED))); + else + try { + new DownloadUpdate(args[0]); + } + catch (CurseException e) { + e.printStackTrace(); + } + + } + +} diff --git a/src/main/java/net/rom/gctweaks/base/version/DownloadUpdate.java b/src/main/java/net/rom/gctweaks/base/version/DownloadUpdate.java new file mode 100644 index 0000000..afa8503 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/version/DownloadUpdate.java @@ -0,0 +1,77 @@ +package net.rom.gctweaks.base.version; + +import java.awt.Desktop; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Optional; + +import com.therandomlabs.curseapi.CurseAPI; +import com.therandomlabs.curseapi.CurseException; +import com.therandomlabs.curseapi.project.CurseProject; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; + +public class DownloadUpdate { + + private final String fileId; + private final int PROJECT = 359766; + private final CurseProject proj; + + public DownloadUpdate(String fileId) throws CurseException { + + final Optional project = CurseAPI.project(PROJECT); + proj = project.get(); + this.fileId = fileId; + + run(); + } + + public void run () { + String fileName = null; + try { + fileName = proj.files().fileWithID(Integer.parseInt(fileId)).displayName(); + } + catch (NumberFormatException | CurseException e) { + e.printStackTrace(); + } + + ITextComponent component = ITextComponent.Serializer + .jsonToComponent(I18n.format("gctweaks.versions.startingDownload", fileName)); + ITextComponent component2 = ITextComponent.Serializer + .jsonToComponent(I18n.format("gctweaks.versions.startingDownload2")); + if (Minecraft.getMinecraft().player != null) { + + Minecraft.getMinecraft().player.sendMessage(component); + Minecraft.getMinecraft().player.sendMessage(component2); + } + + VersionChecker.startedDownload = true; + + Path dir = new File(Minecraft.getMinecraft().mcDataDir, "mods").toPath(); + try { + proj.files().fileWithID(Integer.parseInt(fileId)).downloadToDirectory(dir); + } + catch (NumberFormatException | CurseException e) { + e.printStackTrace(); + } + + if (Minecraft.getMinecraft().player != null) + Minecraft.getMinecraft().player + .sendMessage(new TextComponentTranslation("gctweaks.versions.doneDownloading", fileName) + .setStyle(new Style().setColor(TextFormatting.GREEN))); + + try { + Desktop.getDesktop().open(dir.toFile()); + } + catch (IOException e) { + e.printStackTrace(); + } + VersionChecker.downloadedFile = true; + } +} diff --git a/src/main/java/net/rom/gctweaks/base/version/ThreadVersionChecker.java b/src/main/java/net/rom/gctweaks/base/version/ThreadVersionChecker.java new file mode 100644 index 0000000..e7d6892 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/version/ThreadVersionChecker.java @@ -0,0 +1,37 @@ +package net.rom.gctweaks.base.version; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +import net.minecraftforge.common.MinecraftForge; +import net.rom.gctweaks.Ref; + +public class ThreadVersionChecker extends Thread { + + public ThreadVersionChecker() { + setName("Version Checker Thread"); + setDaemon(true); + start(); + } + + @Override + public void run () { + try { + URL url = new URL("https://raw.githubusercontent.com/ReadOnly-Mods/ReadOnly-Versions/master/" + + MinecraftForge.MC_VERSION + ".txt"); + BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); + String line; + while ((line = r.readLine()) != null) { + if(line.contains(Ref.MOD_ID)) { + VersionChecker.onlineVersion = line; + } + } + r.close(); + } + catch (Exception e) { + e.printStackTrace(); + } + VersionChecker.doneChecking = true; + } +} diff --git a/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java b/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java new file mode 100644 index 0000000..26f5779 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java @@ -0,0 +1,61 @@ +package net.rom.gctweaks.base.version; + +import com.vdurmont.semver4j.Semver; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.translation.I18n; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; +import net.minecraftforge.fml.relauncher.Side; +import net.rom.gctweaks.Ref; + + +@Mod.EventBusSubscriber(value = Side.CLIENT, modid = Ref.MOD_ID) +public final class VersionChecker { + + private VersionChecker() {} + + public static volatile boolean doneChecking = false; + public static volatile String onlineVersion = ""; + public static volatile String fileId = ""; + private static boolean triedToWarnPlayer = false; + public static volatile boolean startedDownload = false; + public static volatile boolean downloadedFile = false; + + public static void init () { + new ThreadVersionChecker(); + } + + @SubscribeEvent + public static void onTick (ClientTickEvent event) { + if (event.phase == Phase.END && Minecraft.getMinecraft().player != null && !triedToWarnPlayer && doneChecking) { + if (!onlineVersion.isEmpty()) { + EntityPlayer player = Minecraft.getMinecraft().player; + Semver online = new Semver(onlineVersion.split(":")[0]); + Semver client = new Semver(Ref.MOD_VERSION); + fileId = onlineVersion.split(":")[1]; + if (online.isGreaterThan(client)) { + player.sendMessage(new TextComponentTranslation("gctweaks.versions.notify") + .setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); + player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated0")); + player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated1", client + .toString())); + player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated2", online + .toString())); + player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated0")); + ITextComponent component = ITextComponent.Serializer.fromJsonLenient(I18n + .translateToLocal("gctweaks.versions.updateMessage").replaceAll("%version%", fileId)); + player.sendMessage(component); + } + } + triedToWarnPlayer = true; + } + } +} diff --git a/src/main/java/net/rom/gctweaks/core/Feature.java b/src/main/java/net/rom/gctweaks/core/Feature.java deleted file mode 100644 index bcb35a8..0000000 --- a/src/main/java/net/rom/gctweaks/core/Feature.java +++ /dev/null @@ -1,92 +0,0 @@ -package net.rom.gctweaks.core; - -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; - -/** - * The Abstract Class Feature. - */ -public abstract class Feature { - - /** - * @return the category - */ - public abstract String[] category(); - - /** - * @return the comment - */ - public abstract String comment(); - - /** - * Pre init. - */ - public void preInit() { - - } - - /** - * Inits the. - */ - public void init() { - - } - - /** - * Post init. - */ - public void postInit() { - - } - - /** - * Post init. - */ - public void proxyPostInit() { - - } - - /** - * Pre init. - */ - public void proxyPreInit() { - - } - - /** - * Inits the. - */ - public void proxyInit() { - - } - - /** - * Sync config. - * - * @param config the config - * @param strings the category - */ - public abstract void syncConfig(Configuration config, String[] strings); - - /** - * Feature uses events. - * - * @return true, if successful - */ - public boolean usesEvents() { - return false; - } - - public boolean sidedProxy() { - return false; - } - - /** - * Register packet. - * - * @param network - */ - public void registerPacket(SimpleNetworkWrapper network) { - } - -} diff --git a/src/main/java/net/rom/gctweaks/core/NoConfigFeature.java b/src/main/java/net/rom/gctweaks/core/NoConfigFeature.java deleted file mode 100644 index a255a7a..0000000 --- a/src/main/java/net/rom/gctweaks/core/NoConfigFeature.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.rom.gctweaks.core; - -import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; - -/** - * The Abstract Class Feature. - */ -public abstract class NoConfigFeature { - - /** - * Pre init. - */ - public void preInit() { - - } - - /** - * Inits the. - */ - public void init() { - - } - - /** - * Post init. - */ - public void postInit() { - - } - - /** - * Post init. - */ - public void proxyPostInit() { - - } - - /** - * Pre init. - */ - public void proxyPreInit() { - - } - - /** - * Inits the. - */ - public void proxyInit() { - - } - - /** - * Feature uses events. - * - * @return true, if successful - */ - public boolean usesEvents() { - return false; - } - - public boolean sidedProxy() { - return false; - } - - /** - * Register packet. - * - * @param network - */ - public void registerPacket(SimpleNetworkWrapper network) { - } - -} diff --git a/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java b/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java deleted file mode 100644 index 6755e19..0000000 --- a/src/main/java/net/rom/gctweaks/core/mixins/CommandLocateMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.rom.gctweaks.core.mixins; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandLocate; - -@Mixin(CommandLocate.class) -public abstract class CommandLocateMixin { - - @Redirect( - method = "getTabCompletions(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/command/ICommandSender;[Ljava/lang/String;Lnet/minecraft/util/math/BlockPos;)Ljava/util/List;", - at = @At( - value = "INVOKE", - target = "net/minecraft/command/CommandLocate.getListOfStringsMatchingLastWord([Ljava/lang/String;[Ljava/lang/String;)Ljava/util/List;")) - private List addDungeonsToList (String[] args, String... possibilities) { - List list = CommandBase.getListOfStringsMatchingLastWord(args, "Dungeon"); - list.addAll(Arrays.stream(possibilities).collect(Collectors.toList())); - return CommandBase.getListOfStringsMatchingLastWord(args, list); - } -} diff --git a/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java b/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java deleted file mode 100644 index fcb1313..0000000 --- a/src/main/java/net/rom/gctweaks/core/mixins/GalacticTweaksMixinPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.rom.gctweaks.core.mixins; - -import java.util.List; -import java.util.Set; - -import org.spongepowered.asm.lib.tree.ClassNode; -import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; -import org.spongepowered.asm.mixin.extensibility.IMixinInfo; - -public class GalacticTweaksMixinPlugin implements IMixinConfigPlugin { - - @Override - public boolean shouldApplyMixin(String targetClassName, String mixinClassName) - { - return true; - } - - @Override - public List getMixins() - { - return null; - } - - @Override - public String getRefMapperConfig() - { - return null; - } - - @Override - public void onLoad(String mixinPackage) {} - - @Override - public void acceptTargets(Set myTargets, Set otherTargets) {} - - @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} - - @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} - -} diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/GalacticraftModule.java b/src/main/java/net/rom/gctweaks/galacticraftchanges/GalacticraftModule.java deleted file mode 100644 index 3155e51..0000000 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/GalacticraftModule.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.rom.gctweaks.galacticraftchanges; - -import net.rom.gctweaks.core.Module; - -public class GalacticraftModule extends Module { - - public GalacticraftModule(String name) { - super(name); - } - - @Override - public void addFeatures() { - registerFeature(new MobsBreatheInSpace()); - registerFeature(new SpawnWithOxygenEquip()); - registerFeature(new NoSpaceMusic()); - registerFeature(new CompressorFixes()); - registerFeature(new OverworldComets()); - registerFeature(new SeperateAddonPlanets()); - } - -} diff --git a/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java b/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java new file mode 100644 index 0000000..0ff4dd3 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java @@ -0,0 +1,29 @@ +package net.rom.gctweaks.gc; + +import net.rom.gctweaks.base.Module; +import net.rom.gctweaks.gc.features.CompressorFixes; +import net.rom.gctweaks.gc.features.MobsBreatheInSpace; +import net.rom.gctweaks.gc.features.NoSpaceMusic; +import net.rom.gctweaks.gc.features.OverworldComets; +import net.rom.gctweaks.gc.features.galaxyfeature.SeperateAddonPlanets; +import net.rom.gctweaks.gc.features.oxygenfeature.SpawnWithOxygenEquip; +import net.rom.gctweaks.gc.features.sprfeature.SpaceRaceFeature; + +public class GalacticraftModule extends Module { + + public GalacticraftModule(String name) { + super(name); + } + + @Override + public void addFeatures() { + registerFeature(new MobsBreatheInSpace()); + registerFeature(new SpawnWithOxygenEquip()); + registerFeature(new NoSpaceMusic()); + registerFeature(new CompressorFixes()); + registerFeature(new OverworldComets()); + registerFeature(new SeperateAddonPlanets()); + registerFeature(new SpaceRaceFeature()); + } + +} diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/CompressorFixes.java b/src/main/java/net/rom/gctweaks/gc/features/CompressorFixes.java similarity index 97% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/CompressorFixes.java rename to src/main/java/net/rom/gctweaks/gc/features/CompressorFixes.java index 2053417..1887d05 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/CompressorFixes.java +++ b/src/main/java/net/rom/gctweaks/gc/features/CompressorFixes.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features; import micdoodle8.mods.galacticraft.api.recipe.CompressorRecipes; import micdoodle8.mods.galacticraft.core.GCItems; @@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.oredict.OreDictionary; -import net.rom.gctweaks.core.Feature; +import net.rom.gctweaks.base.Feature; public class CompressorFixes extends Feature { diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/MobsBreatheInSpace.java b/src/main/java/net/rom/gctweaks/gc/features/MobsBreatheInSpace.java similarity index 94% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/MobsBreatheInSpace.java rename to src/main/java/net/rom/gctweaks/gc/features/MobsBreatheInSpace.java index 714225a..2d727ca 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/MobsBreatheInSpace.java +++ b/src/main/java/net/rom/gctweaks/gc/features/MobsBreatheInSpace.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features; import micdoodle8.mods.galacticraft.api.event.oxygen.GCCoreOxygenSuffocationEvent; import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; @@ -7,7 +7,7 @@ import net.minecraft.entity.passive.EntityAnimal; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.rom.gctweaks.core.Feature; +import net.rom.gctweaks.base.Feature; public class MobsBreatheInSpace extends Feature { diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/NoSpaceMusic.java b/src/main/java/net/rom/gctweaks/gc/features/NoSpaceMusic.java similarity index 95% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/NoSpaceMusic.java rename to src/main/java/net/rom/gctweaks/gc/features/NoSpaceMusic.java index c2ee09c..4f440f1 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/NoSpaceMusic.java +++ b/src/main/java/net/rom/gctweaks/gc/features/NoSpaceMusic.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features; import java.lang.reflect.Field; @@ -8,7 +8,7 @@ import net.minecraft.client.audio.MusicTicker; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.FMLClientHandler; -import net.rom.gctweaks.core.Feature; +import net.rom.gctweaks.base.Feature; public class NoSpaceMusic extends Feature { diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/OverworldComets.java b/src/main/java/net/rom/gctweaks/gc/features/OverworldComets.java similarity index 97% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/OverworldComets.java rename to src/main/java/net/rom/gctweaks/gc/features/OverworldComets.java index 1e34d13..66bf3f8 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/OverworldComets.java +++ b/src/main/java/net/rom/gctweaks/gc/features/OverworldComets.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features; import micdoodle8.mods.galacticraft.core.entities.EntityMeteor; import net.minecraft.entity.EntityLivingBase; @@ -9,7 +9,7 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.rom.gctweaks.core.Feature; +import net.rom.gctweaks.base.Feature; public class OverworldComets extends Feature { diff --git a/src/main/java/net/rom/gctweaks/core/GCPlanets.java b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java similarity index 96% rename from src/main/java/net/rom/gctweaks/core/GCPlanets.java rename to src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java index 6b5ad48..f722fd5 100644 --- a/src/main/java/net/rom/gctweaks/core/GCPlanets.java +++ b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java @@ -1,10 +1,9 @@ -package net.rom.gctweaks.core; +package net.rom.gctweaks.gc.features.galaxyfeature; import java.util.Map; import com.mjr.extraplanets.planets.ExtraPlanets_Planets; -import asmodeuscore.core.configs.AsmodeusConfig; import galaxyspace.systems.SolarSystem.SolarSystemBodies; import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance; @@ -15,9 +14,7 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; import net.minecraft.util.ResourceLocation; -import net.rom.gctweaks.core.compat.CompatMods; -import stevekung.mods.moreplanets.init.MPPlanets; -import zollerngalaxy.planets.ZGPlanets; +import net.rom.gctweaks.base.core.compat.CompatMods; public class GCPlanets { public static Planet FAKE_OVERWORLD; diff --git a/src/main/java/net/rom/gctweaks/core/GCSystems.java b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCSystems.java similarity index 95% rename from src/main/java/net/rom/gctweaks/core/GCSystems.java rename to src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCSystems.java index fe08db4..f8c9e22 100644 --- a/src/main/java/net/rom/gctweaks/core/GCSystems.java +++ b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCSystems.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.core; +package net.rom.gctweaks.gc.features.galaxyfeature; import asmodeuscore.core.astronomy.BodiesRegistry; diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/SeperateAddonPlanets.java similarity index 88% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java rename to src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/SeperateAddonPlanets.java index ee3958a..0f88a62 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/SeperateAddonPlanets.java +++ b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/SeperateAddonPlanets.java @@ -1,11 +1,9 @@ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features.galaxyfeature; import asmodeuscore.core.astronomy.BodiesRegistry; import net.minecraftforge.common.config.Configuration; -import net.rom.gctweaks.core.Feature; -import net.rom.gctweaks.core.GCPlanets; -import net.rom.gctweaks.core.GCSystems; -import net.rom.gctweaks.core.compat.CompatMods; +import net.rom.gctweaks.base.Feature; +import net.rom.gctweaks.base.core.compat.CompatMods; public class SeperateAddonPlanets extends Feature { diff --git a/src/main/java/net/rom/gctweaks/galacticraftchanges/SpawnWithOxygenEquip.java b/src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/SpawnWithOxygenEquip.java similarity index 92% rename from src/main/java/net/rom/gctweaks/galacticraftchanges/SpawnWithOxygenEquip.java rename to src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/SpawnWithOxygenEquip.java index 8e46cd8..c2858d6 100644 --- a/src/main/java/net/rom/gctweaks/galacticraftchanges/SpawnWithOxygenEquip.java +++ b/src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/SpawnWithOxygenEquip.java @@ -1,4 +1,4 @@ -package net.rom.gctweaks.galacticraftchanges; +package net.rom.gctweaks.gc.features.oxygenfeature; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.entities.player.GCCapabilities; @@ -11,10 +11,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import net.rom.gctweaks.Ref; -import net.rom.gctweaks.core.Feature; +import net.rom.gctweaks.base.Feature; +import net.rom.gctweaks.gc.features.oxygenfeature.command.CommandOxygenReset; public class SpawnWithOxygenEquip extends Feature { @@ -70,38 +72,6 @@ public boolean usesEvents () { return true; } - private static ItemStack setTanks () { - ItemStack tank = null; - switch (tanksValue) { - case "heavy": - tank = getStack(GCItems.oxTankHeavy); - break; - case "medium": - tank = getStack(GCItems.oxTankMedium); - break; - case "light": - tank = getStack(GCItems.oxTankLight); - default: - break; - } - return tank; - } - - private static ItemStack setThermals (int meta) { - ItemStack thermal = null; - switch (thermalArmor) { - case "isothermal": - thermal = getStack(VenusItems.thermalPaddingTier2, meta); - break; - case "thermal": - thermal = getStack(AsteroidsItems.thermalPadding, meta); - break; - default: - break; - } - return thermal; - } - @SubscribeEvent public void playerLogin (PlayerLoggedInEvent event) { final EntityPlayer player = event.player; @@ -110,7 +80,7 @@ public void playerLogin (PlayerLoggedInEvent event) { final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; - + if (!persistedData.getBoolean(key)) { if (spawnWithOxygenEquip) { GCPlayerStats gcstats = event.player.getCapability(GCCapabilities.GC_STATS_CAPABILITY, null); @@ -135,11 +105,44 @@ public void playerLogin (PlayerLoggedInEvent event) { gcstats.setExtendedInventory(inv); persistedData.setBoolean(key, true); } - } else { + } + else { // Do Nothing } } + private static ItemStack setTanks () { + ItemStack tank = null; + switch (tanksValue) { + case "heavy": + tank = getStack(GCItems.oxTankHeavy); + break; + case "medium": + tank = getStack(GCItems.oxTankMedium); + break; + case "light": + tank = getStack(GCItems.oxTankLight); + default: + break; + } + return tank; + } + + private static ItemStack setThermals (int meta) { + ItemStack thermal = null; + switch (thermalArmor) { + case "isothermal": + thermal = getStack(VenusItems.thermalPaddingTier2, meta); + break; + case "thermal": + thermal = getStack(AsteroidsItems.thermalPadding, meta); + break; + default: + break; + } + return thermal; + } + public static ItemStack getStack (Item item, int meta) { return new ItemStack(item, 1, meta); } @@ -147,4 +150,11 @@ public static ItemStack getStack (Item item, int meta) { public static ItemStack getStack (Item item) { return new ItemStack(item, 1); } + + @Override + public void ServerStartingEvent (FMLServerStartingEvent event) { + if (spawnWithOxygenEquip) + event.registerServerCommand(new CommandOxygenReset()); + } + } diff --git a/src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/command/CommandOxygenReset.java b/src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/command/CommandOxygenReset.java new file mode 100644 index 0000000..71b3cbb --- /dev/null +++ b/src/main/java/net/rom/gctweaks/gc/features/oxygenfeature/command/CommandOxygenReset.java @@ -0,0 +1,76 @@ +package net.rom.gctweaks.gc.features.oxygenfeature.command; + +import java.util.List; + +import com.google.common.collect.ImmutableList; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.rom.gctweaks.Ref; + +public class CommandOxygenReset extends CommandBase { + + @Override + public String getName () { + return "oxygenreset"; + } + + @Override + public List getAliases () { + return ImmutableList.of("oxyreset", "oxyr", "oreset"); + } + + @Override + public String getUsage (ICommandSender sender) { + StringBuilder aliases = new StringBuilder(); + aliases.append(String.join(" | ", getAliases())); + + return String + .format("%sUsage: %s/%s \n%sAliases: %s%s", TextFormatting.RED, TextFormatting.AQUA, getName(), TextFormatting.RED, TextFormatting.GREEN, aliases + .toString()); + } + + @Override + public int getRequiredPermissionLevel () { + return 3; + } + + @Override + public boolean checkPermission (MinecraftServer server, ICommandSender sender) { + return true; + } + + @Override + public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); + } + return null; + } + + @Override + public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (args.length > 0 && args.length < 2) { + final EntityPlayer player = server.getPlayerList().getPlayerByUsername(args[0]); + + if(player != null) { + final NBTTagCompound entityData = player.getEntityData(); + final NBTTagCompound persistedData = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); + entityData.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistedData); + final String key = Ref.MOD_ID + ":" + "ReceivedOxygen"; + persistedData.setBoolean(key, false); + String line = String.format("Sucessfully reset %s's OxygenGear-On-Join setting", player.getName()); + sender.sendMessage(new TextComponentString(line)); + } + } else { + sender.sendMessage(new TextComponentString(getUsage(sender))); + } + } +} diff --git a/src/main/java/net/rom/gctweaks/internal/BuiltInModule.java b/src/main/java/net/rom/gctweaks/internal/BuiltInModule.java new file mode 100644 index 0000000..fa38e48 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/internal/BuiltInModule.java @@ -0,0 +1,15 @@ +package net.rom.gctweaks.internal; + +import net.rom.gctweaks.base.InternalModule; + +public class BuiltInModule extends InternalModule { + + public BuiltInModule() { + super(); + } + + @Override + public void addInternalFeature () { + registerInternalFeature(new CrashLogWarning()); + } +} diff --git a/src/main/java/net/rom/gctweaks/internal/CrashLogWarning.java b/src/main/java/net/rom/gctweaks/internal/CrashLogWarning.java new file mode 100644 index 0000000..6aed632 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/internal/CrashLogWarning.java @@ -0,0 +1,128 @@ +package net.rom.gctweaks.internal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.ICrashCallable; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.versioning.ArtifactVersion; +import net.rom.gctweaks.base.InternalFeature; +import net.rom.gctweaks.gc.features.galaxyfeature.SeperateAddonPlanets; + +public class CrashLogWarning extends InternalFeature { + + private static List loaded = Loader.instance().getActiveModList(); + private static Map sets = new HashMap(); + private static Map cores = new HashMap(); + private static Set> setRemove = new HashSet>(); + private static Set> coreRemove = new HashSet>(); + + private static String setter = "\n\t|\t"; + private static String setter2 = "\t|\t"; + + private static void getDeps () { + for (ModContainer mod : loaded) { + for (ArtifactVersion a : mod.getDependencies()) { + if (a.getLabel().contains("galacticraft")) { + sets.putIfAbsent(mod.getName(), mod.getVersion()); + } + } + if (mod.getModId().equalsIgnoreCase("galacticraftcore")) { + sets.putIfAbsent(mod.getName(), mod.getVersion()); + } + if (mod.getModId().equalsIgnoreCase("asmodeuscore")) { + cores.putIfAbsent(mod.getName(), mod.getVersion()); + } + if (mod.getModId().equalsIgnoreCase("mjrlegendslib")) { + cores.putIfAbsent(mod.getName(), mod.getVersion()); + } + } + sets.remove("GalacticTweaks"); + } + + private static void formatCores (StringBuilder builder) { + for (Entry mod : sets.entrySet()) { + if (mod.getKey().equalsIgnoreCase("Extra Planets")) { + for (Entry core : cores.entrySet()) { + if (core.getKey().equalsIgnoreCase("MJRLegendsLib")) { + builder.append(setter2 + String.format("| %-20s %20s \n" + setter2 + "| --> %-16s %20s \n", mod + .getKey(), mod.getValue(), core.getKey(), core.getValue())); + coreRemove.add(core); + } + } + setRemove.add(mod); + } + if (mod.getKey().equalsIgnoreCase("GalaxySpace")) { + for (Entry core : cores.entrySet()) { + if (core.getKey().equalsIgnoreCase("AsmodeusCore")) { + builder.append(setter2 + String.format("| %-20s %20s \n" + setter2 + "| --> %-16s %20s \n", mod + .getKey(), mod.getValue(), core.getKey(), core.getValue())); + coreRemove.add(core); + } + } + setRemove.add(mod); + } + } + sets.entrySet().removeAll(setRemove); + cores.entrySet().removeAll(coreRemove); + } + + public static void onCrash (StringBuilder builder) { + if (SeperateAddonPlanets.seperatePlanets == true) { + builder.append(setter); + builder.append(setter); + builder.append(setter + "\t\t\t\t\t~~~~~~~~~~ NOTICE ~~~~~~~~~~"); + builder.append(setter + "GalacticTweaks Separate Galaxy feature is enabled, If this crash is caused by"); + builder.append(setter + + "any planet that is under the new Galaxy, DO NOT send a new issue to the addons "); + builder.append(setter + "dev for that planet, Please report the issue to GalacticTweaks issue tracker first."); + builder.append(setter); + builder.append(setter + "\t\t\t\t\t\t### ADDON DEVS ###"); + builder.append(setter + "This notice is for you to be aware that any crash-report sent containing this"); + builder.append(setter + "notice may not be as a result of your addon, please disregard if not"); + builder.append(setter); + builder.append(setter); + } + } + + @Override + public void postInit () { + getDeps(); + FMLCommonHandler.instance().registerCrashCallable(new PackCrashEnhancement()); + + } + + public class PackCrashEnhancement implements ICrashCallable { + @Override + public String getLabel () { + + String space = " \n\n"; + + return space + "\t################ [GALACTICTWEAKS DATA START] ################"; + } + + @Override + public String call () { + + StringBuilder builder = new StringBuilder(); + onCrash(builder); + builder.append(setter); + builder.append("---------------------------------------------\n"); + formatCores(builder); + sets.entrySet().stream().sorted(Map.Entry.comparingByValue()) + .forEach(s -> builder.append(setter2 + String.format("| %-20s %20s %n", s.getKey(), s.getValue()))); + + builder.append(setter2 + "---------------------------------------------"); + builder.append(setter); + builder.append("\n\t################# [GALACTICTWEAKS DATA END] #################\n\n"); + return builder.toString(); + } + } +} diff --git a/src/main/java/net/rom/gctweaks/modpacks/CustomCrashLogData.java b/src/main/java/net/rom/gctweaks/modpacks/CustomCrashLogData.java deleted file mode 100644 index 82cb03d..0000000 --- a/src/main/java/net/rom/gctweaks/modpacks/CustomCrashLogData.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.rom.gctweaks.modpacks; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ICrashCallable; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.versioning.ArtifactVersion; -import net.rom.gctweaks.core.NoConfigFeature; -import net.rom.gctweaks.galacticraftchanges.SeperateAddonPlanets; - -public class CustomCrashLogData extends NoConfigFeature { - - String split = "\n#########################################\n "; - - - private static List loaded = Loader.instance().getActiveModList(); - private static Map sets = new HashMap(); - - private static void getDeps () { - for (ModContainer mod : loaded) { - for (ArtifactVersion a : mod.getDependencies()) { - if (a.getLabel().contains("galacticraft")) { - sets.putIfAbsent(mod.getName(), mod.getVersion()); - } - } - } - sets.remove("GalacticTweaks"); - } - - public static void onCrash (StringBuilder builder) { - if (SeperateAddonPlanets.seperatePlanets == true) { - builder.append("\n~~~~~~~~~~ NOTICE ~~~~~~~~~~\n"); - builder.append("GalacticTweaks Seperate Planets feature is enabled, If this crash is caused\n"); - builder.append("by any planet that is under the new Galaxy, DO NOT create a new issue to the addons dev\n"); - builder.append("for that planet, Please report the issue to GalacticTweaks issue tracker.\n"); - builder.append("\n### ADDON DEVS ###\n"); - builder.append("This notice is for you to be aware that any crash-report sent may not be as a result of your addon, please disregard\n\n"); - } - } - - @Override - public void postInit () { - getDeps(); - FMLCommonHandler.instance().registerCrashCallable(new PackCrashEnhancement()); - - } - - public class PackCrashEnhancement implements ICrashCallable { - @Override - public String getLabel () { - - String label = split + "GALACTICTWEAKS DATA\n"; - - return label; - } - - @Override - public String call () { - - StringBuilder builder = new StringBuilder(); - onCrash(builder); - builder.append("---------------------------------------------\n"); - for (Entry set : sets.entrySet()) { - builder.append(String.format("| %-20s %20s %n", set.getKey(), set.getValue())); - } - builder.append("---------------------------------------------\n"); - builder.append(split); - return builder.toString(); - } - } - -} diff --git a/src/main/java/net/rom/gctweaks/modpacks/ModpackModule.java b/src/main/java/net/rom/gctweaks/modpacks/ModpackModule.java deleted file mode 100644 index 07ecff6..0000000 --- a/src/main/java/net/rom/gctweaks/modpacks/ModpackModule.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.rom.gctweaks.modpacks; - -import net.rom.gctweaks.core.Module; - -public class ModpackModule extends Module { - - public ModpackModule() { - super(); - } - - - @Override - public void addFeatures() { - registerFeature(new CustomCrashLogData()); - } - -} diff --git a/src/main/resources/assets/gtweaks/lang/en_us.lang b/src/main/resources/assets/gtweaks/lang/en_us.lang index 9e6db6c..942e52d 100644 --- a/src/main/resources/assets/gtweaks/lang/en_us.lang +++ b/src/main/resources/assets/gtweaks/lang/en_us.lang @@ -2,4 +2,21 @@ galaxy.wormhole= Alt Sol solarsystem.secondSystem=Alternate Sol star.epsystem=Sun planet.fakeOverworld=Earth -planet.fakeRocks=Asteroids \ No newline at end of file +planet.fakeRocks=Asteroids + +gctweaks.leaverace.playerleave=You have sucsessfully left %s +gctweaks.leaverace.leader=Team Leaders cannot use this command! +gctweaks.leaverace.noarg=Command has no arguments! +gctweaks.leaverace.useage=%s +gctweaks.leaverace.noteam=You must be in a team to use this command! + +gctweaks.versions.notify=Hey player! Hey player hey! GalacticTweaks update! +gctweaks.versions.outdated0=§6**************************************** +gctweaks.versions.outdated1=§6* §aRunning......v§c%s +gctweaks.versions.outdated2=§6* §aLatest.........v§9%s +gctweaks.versions.updateMessage=["Click To... [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to automatically download the latest version","color":"green"}},"clickEvent":{"action":"run_command","value":"/download-latest-gctweaks %version%"}},"]"] +gctweaks.versions.startingDownload=[{"text":"Starting download . . . . . Please do not remove your hard disk. Enjoying ","color":"aqua"},{"text":"GalacticTweaks?","color":"green"}] +gctweaks.versions.startingDownload2=[{"text":" Consider supporting ","color":"aqua"},{"text":"ROMVoid95","color":"light_purple"},{"text":" on [","color":"aqua"},{"text":"Patreon","color":"gold","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to ROMVoid95's Patreon","color":"light_purple"}},"clickEvent":{"action":"open_url","value":"http://www.patreon.com/romvoid95"}},{"text":"]!","color":"aqua"}] +gctweaks.versions.doneDownloading=Finished downloading . . . . . Delete your old GalacticTweaks jar and reload your game to update. +gctweaks.versions.downloadedAlready=You already downloaded the latest version. Close your game, delete the old version from your mods folder and load it again to update! +gctweaks.versions.downloadingAlready=The update is already downloading, give it some time, will you? \ No newline at end of file From cbe032e3927dd2420eca1156fe5800b5a1a56ae6 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Sat, 5 Sep 2020 07:14:37 -0500 Subject: [PATCH 15/17] Add Command to leave SpaceRace Team --- .../features/sprfeature/SpaceRaceFeature.java | 34 +++++++ .../command/CommandLeaveSpaceRace.java | 97 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 src/main/java/net/rom/gctweaks/gc/features/sprfeature/SpaceRaceFeature.java create mode 100644 src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java diff --git a/src/main/java/net/rom/gctweaks/gc/features/sprfeature/SpaceRaceFeature.java b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/SpaceRaceFeature.java new file mode 100644 index 0000000..b060a5f --- /dev/null +++ b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/SpaceRaceFeature.java @@ -0,0 +1,34 @@ +package net.rom.gctweaks.gc.features.sprfeature; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.rom.gctweaks.base.Feature; +import net.rom.gctweaks.gc.features.sprfeature.command.CommandLeaveSpaceRace; + +public class SpaceRaceFeature extends Feature { + + private static boolean spacerace; + + @Override + public String[] category () { + return new String[] { "space-race" }; + } + + @Override + public String comment () { + return "Additional Features related to Galacticraft SpaceRace Teams"; + } + + @Override + public void syncConfig (Configuration config, String[] category) { + spacerace = config + .get(category[0], "Enable SpaceRace Feature", false, "Set to true if you want to enable features for Galacticraft SpaceRace") + .getBoolean(); + } + + @Override + public void ServerStartingEvent (FMLServerStartingEvent event) { + if (spacerace) + event.registerServerCommand(new CommandLeaveSpaceRace()); + } +} diff --git a/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java new file mode 100644 index 0000000..f85cc0f --- /dev/null +++ b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java @@ -0,0 +1,97 @@ +package net.rom.gctweaks.gc.features.sprfeature.command; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nullable; + +import com.google.common.collect.ImmutableList; + +import micdoodle8.mods.galacticraft.core.dimension.SpaceRace; +import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; +import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.util.PlayerUtil; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; + +public class CommandLeaveSpaceRace extends CommandBase { + + @Override + public int getRequiredPermissionLevel () { + return 0; + } + + @Override + public boolean checkPermission (MinecraftServer server, ICommandSender sender) { + return sender.canUseCommand(this.getRequiredPermissionLevel(), this.getName()); + } + + @Override + public String getUsage (ICommandSender sender) { + StringBuilder aliases = new StringBuilder(); + aliases.append(String.join(" | ", getAliases())); + + return String + .format("%sUsage: %s/%s \n%sAliases: %s%s", TextFormatting.RED, TextFormatting.AQUA, getName(), TextFormatting.RED, TextFormatting.GREEN, aliases + .toString()); + } + + @Override + public String getName () { + return "leaverace"; + } + + @Override + public List getAliases () { + return ImmutableList.of("lrace", "quitrace", "qrace", "lr", "qr"); + } + + @Override + public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + EntityPlayerMP player = PlayerUtil.getPlayerBaseServerFromPlayerUsername(server, sender.getName(), true); + + if (args.length == 0) { + + SpaceRace race = SpaceRaceManager.getSpaceRaceFromPlayer(player.getName()); + + if (race != null) { + List names = new ArrayList(race.getPlayerNames()); + String owner = race.getPlayerNames().get(0); + if (!sender.getName().equalsIgnoreCase(owner)) { + + names.remove(player.getName()); + race.setPlayerNames(names); + race.tick(); + SpaceRaceManager.sendSpaceRaceData(server, player, race); + + if (!race.getPlayerNames().contains(player.getName())) { + sender.sendMessage(new TextComponentTranslation("gctweaks.leaverace.playerleave", race + .getTeamName())); + } else { + + } + } else { + sender.sendMessage(new TextComponentTranslation("gctweaks.leaverace.leader")); + } + } else { + sender.sendMessage(new TextComponentTranslation("gctweaks.leaverace.noteam")); + } + } + else { + sender.sendMessage(new TextComponentTranslation("gctweaks.leaverace.noarg")); + sender.sendMessage(new TextComponentTranslation("gctweaks.leaverace.useage", this.getUsage(sender))); + } + } + + @Override + public List getTabCompletions (MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { + return getListOfStringsMatchingLastWord(args, getAliases()); + } +} From 7fd2d339de774c440b0a0162fecbb01a00a39e84 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Sat, 5 Sep 2020 08:25:09 -0500 Subject: [PATCH 16/17] Add fixPlanetIcons feature --- CHANGELOG.md | 10 +--- .../java/net/rom/gctweaks/GalacticTweaks.java | 1 - .../gctweaks/base/version/VersionChecker.java | 2 + .../rom/gctweaks/gc/GalacticraftModule.java | 3 +- .../gc/features/FixAsmodeusMapIcons.java | 55 +++++++++++++++++++ .../gc/features/galaxyfeature/GCPlanets.java | 46 ---------------- .../command/CommandLeaveSpaceRace.java | 2 - 7 files changed, 61 insertions(+), 58 deletions(-) create mode 100644 src/main/java/net/rom/gctweaks/gc/features/FixAsmodeusMapIcons.java diff --git a/CHANGELOG.md b/CHANGELOG.md index ee943eb..6bfce3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,6 @@ [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 + - command /leaverace to leave GC SpaceRace team + - Team owners cannot use command - - [Changed/Removed] - - - Parse loaded Addons from FML Loader - - Modpack Crashlog Data diff --git a/src/main/java/net/rom/gctweaks/GalacticTweaks.java b/src/main/java/net/rom/gctweaks/GalacticTweaks.java index 513d2cb..e8954dc 100644 --- a/src/main/java/net/rom/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/rom/gctweaks/GalacticTweaks.java @@ -23,7 +23,6 @@ import net.rom.gctweaks.base.core.utils.I18nHelper; import net.rom.gctweaks.base.core.utils.LogHelper; import net.rom.gctweaks.base.version.CommandDownloadUpdate; -import net.rom.gctweaks.gc.features.oxygenfeature.command.CommandOxygenReset; @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 { diff --git a/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java b/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java index 26f5779..c2b5d2e 100644 --- a/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java +++ b/src/main/java/net/rom/gctweaks/base/version/VersionChecker.java @@ -18,6 +18,7 @@ @Mod.EventBusSubscriber(value = Side.CLIENT, modid = Ref.MOD_ID) +@SuppressWarnings("deprecation") public final class VersionChecker { private VersionChecker() {} @@ -50,6 +51,7 @@ public static void onTick (ClientTickEvent event) { player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated2", online .toString())); player.sendMessage(new TextComponentTranslation("gctweaks.versions.outdated0")); + ITextComponent component = ITextComponent.Serializer.fromJsonLenient(I18n .translateToLocal("gctweaks.versions.updateMessage").replaceAll("%version%", fileId)); player.sendMessage(component); diff --git a/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java b/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java index 0ff4dd3..713630e 100644 --- a/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java +++ b/src/main/java/net/rom/gctweaks/gc/GalacticraftModule.java @@ -2,6 +2,7 @@ import net.rom.gctweaks.base.Module; import net.rom.gctweaks.gc.features.CompressorFixes; +import net.rom.gctweaks.gc.features.FixAsmodeusMapIcons; import net.rom.gctweaks.gc.features.MobsBreatheInSpace; import net.rom.gctweaks.gc.features.NoSpaceMusic; import net.rom.gctweaks.gc.features.OverworldComets; @@ -24,6 +25,6 @@ public void addFeatures() { registerFeature(new OverworldComets()); registerFeature(new SeperateAddonPlanets()); registerFeature(new SpaceRaceFeature()); + registerFeature(new FixAsmodeusMapIcons()); } - } diff --git a/src/main/java/net/rom/gctweaks/gc/features/FixAsmodeusMapIcons.java b/src/main/java/net/rom/gctweaks/gc/features/FixAsmodeusMapIcons.java new file mode 100644 index 0000000..7f58010 --- /dev/null +++ b/src/main/java/net/rom/gctweaks/gc/features/FixAsmodeusMapIcons.java @@ -0,0 +1,55 @@ +package net.rom.gctweaks.gc.features; + +import java.util.Map; +import java.util.Map.Entry; + +import asmodeuscore.core.configs.AsmodeusConfig; +import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry; +import micdoodle8.mods.galacticraft.api.galaxies.Planet; +import micdoodle8.mods.galacticraft.api.galaxies.SolarSystem; +import net.minecraftforge.common.config.Configuration; +import net.rom.gctweaks.base.Feature; +import net.rom.gctweaks.base.core.compat.CompatMods; + +public class FixAsmodeusMapIcons extends Feature { + + public static boolean fixIcons; + + @Override + public String comment () { + return "Fixes the Planet/Star icon sizes from More Planets & ZollernGalaxy"; + } + + @Override + public String[] category () { + return new String[] { "fix-icons" }; + } + + @Override + public void syncConfig (Configuration config, String[] category) { + fixIcons = config + .get(category[0], "fixAsmodeusMapIcons", false, "Set to true to enable Fix Icons feature\nOnly affects icons if enableNewGalaxyMap is enabled in 'Asmodeuscore/core.conf'") + .getBoolean(); + } + + @Override + public void postInit () { + if (FixAsmodeusMapIcons.fixIcons) { + if (CompatMods.ZOLLERN.isLoaded() || CompatMods.MOREPLANETS.isLoaded()) { + if (AsmodeusConfig.enableNewGalaxyMap) { + fixPlanetIcons(); + } + } + } + } + + + public static void fixPlanetIcons () { + for (Map.Entry planet : GalaxyRegistry.getRegisteredPlanets().entrySet()) { + planet.getValue().setRelativeSize(1.0F); + } + for (Entry star : GalaxyRegistry.getRegisteredSolarSystems().entrySet()) { + star.getValue().getMainStar().setRelativeSize(1.0F); + } + } +} diff --git a/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java index f722fd5..00e61fd 100644 --- a/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java +++ b/src/main/java/net/rom/gctweaks/gc/features/galaxyfeature/GCPlanets.java @@ -1,7 +1,5 @@ package net.rom.gctweaks.gc.features.galaxyfeature; -import java.util.Map; - import com.mjr.extraplanets.planets.ExtraPlanets_Planets; import galaxyspace.systems.SolarSystem.SolarSystemBodies; @@ -14,7 +12,6 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; import net.minecraft.util.ResourceLocation; -import net.rom.gctweaks.base.core.compat.CompatMods; public class GCPlanets { public static Planet FAKE_OVERWORLD; @@ -57,49 +54,6 @@ private static void build () { .getPhaseShift(), GalacticraftCore.planetOverworld.getRelativeDistanceFromCenter().scaledDistance); buildAsteroids(FAKE_ASTEROIDS, "fakeRocks", GCSystems.EP_SYSTEM, AsteroidsModule.planetAsteroids .getPhaseShift(), 1.375F); - fixPlanetIcons(); - } - - private static void fixPlanetIcons () { - if (CompatMods.ZOLLERN.isLoaded() || CompatMods.MOREPLANETS.isLoaded()) { - for (Map.Entry planet : GalaxyRegistry.getRegisteredPlanets().entrySet()) { - Planet p = planet.getValue(); - if (p.getRelativeSize() != 1.0F) { - p.setRelativeSize(1.0F); - } - } - } - -// if (AsmodeusConfig.enableNewGalaxyMap) { -// if (CompatMods.ZOLLERN.isLoaded()) { -// ZGPlanets.starPsios.setRelativeSize(1.0F); -// ZGPlanets.starPraedyth.setRelativeSize(1.0F); -// ZGPlanets.starSol2.setRelativeSize(1.0F); -// ZGPlanets.starPantheon.setRelativeSize(1.0F); -// ZGPlanets.starOlympus.setRelativeSize(1.0F); -// ZGPlanets.starAsgard.setRelativeSize(1.0F); -// ZGPlanets.starVega.setRelativeSize(1.0F); -// ZGPlanets.starNova.setRelativeSize(1.0F); -// ZGPlanets.planetZollus.setRelativeSize(1.0F); -// ZGPlanets.planetKriffon.setRelativeSize(1.0F); -// ZGPlanets.planetPurgot.setRelativeSize(1.0F); -// ZGPlanets.planetEden.setRelativeSize(1.0F); -// ZGPlanets.planetXathius.setRelativeSize(1.0F); -// ZGPlanets.planetOasis.setRelativeSize(1.0F); -// ZGPlanets.planetXantheon.setRelativeSize(1.0F); -// ZGPlanets.planetCandora.setRelativeSize(1.0F); -// ZGPlanets.planetAtheon.setRelativeSize(1.0F); -// ZGPlanets.planetAltum.setRelativeSize(1.0F); -// ZGPlanets.planetCaligro.setRelativeSize(1.0F); -// } -// if (CompatMods.MOREPLANETS.isLoaded()) { -// MPPlanets.LAZENDUS.setRelativeSize(1.0F); -// MPPlanets.DIONA.setRelativeSize(1.0F); -// MPPlanets.CHALOS.setRelativeSize(1.0F); -// MPPlanets.NIBIRU.setRelativeSize(1.0F); -// MPPlanets.KOENTUS.setRelativeSize(1.0F); -// } -// } } public static void buildAsteroids (Planet planet, String planetName, SolarSystem solarSystem, float randomPhase, float au) { diff --git a/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java index f85cc0f..6918b71 100644 --- a/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java +++ b/src/main/java/net/rom/gctweaks/gc/features/sprfeature/command/CommandLeaveSpaceRace.java @@ -9,7 +9,6 @@ import micdoodle8.mods.galacticraft.core.dimension.SpaceRace; import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -17,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; From b499857a80bbb1572d8c11a3ffad044a372c19c3 Mon Sep 17 00:00:00 2001 From: ROMVoid95 Date: Sat, 5 Sep 2020 08:32:36 -0500 Subject: [PATCH 17/17] update Changelog / bump version --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bfce3c..9d69f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ [Added] - - command /leaverace to leave GC SpaceRace team - - Team owners cannot use command + - command /leaverace to leave GC SpaceRace team + (Team owners cannot use command) + - Feature to fix planet/star Icon sizes when using AsmodeusCore celestial map \ No newline at end of file