aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle426
-rw-r--r--dependencies.gradle8
-rw-r--r--repositories.gradle36
-rw-r--r--settings.gradle10
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java4
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java57
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java4
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java10
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java9
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java165
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java5
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java2
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java21
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java170
-rw-r--r--src/main/resources/assets/gtneioreplugin/lang/en_US.lang6
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.pngbin0 -> 446 bytes
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.pngbin0 -> 426 bytes
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.pngbin0 -> 521 bytes
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.pngbin0 -> 492 bytes
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.pngbin0 -> 511 bytes
-rw-r--r--src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.pngbin0 -> 496 bytes
21 files changed, 685 insertions, 248 deletions
diff --git a/build.gradle b/build.gradle
index e182c451c6..ec6cfc966c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,9 @@
-//version: 1656760175
+//version: 1659365110
/*
-DO NOT CHANGE THIS FILE!
-
-Also, you may replace this file at any time if there is an update available.
-Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
-*/
+ DO NOT CHANGE THIS FILE!
+ Also, you may replace this file at any time if there is an update available.
+ Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
+ */
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
@@ -21,6 +20,8 @@ import java.util.zip.ZipOutputStream
buildscript {
repositories {
+ mavenCentral()
+
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
@@ -42,7 +43,6 @@ buildscript {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
}
}
-
plugins {
id 'java-library'
id 'idea'
@@ -59,6 +59,13 @@ plugins {
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
id "com.diffplug.spotless" version "6.7.2"
}
+verifySettingsGradle()
+
+dependencies {
+ implementation 'com.diffplug:blowdryer:1.6.0'
+}
+
+apply plugin: 'com.diffplug.blowdryer'
if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
@@ -83,37 +90,7 @@ idea {
downloadSources = true
}
}
-
-// Spotless autoformatter
-// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
-// Can be locally toggled via spotless:off/spotless:on comments
-spotless {
- encoding 'UTF-8'
-
- format 'misc', {
- target '.gitignore'
-
- trimTrailingWhitespace()
- indentWithSpaces(4)
- endWithNewline()
- }
- java {
- toggleOffOn()
- importOrder()
- removeUnusedImports()
- palantirJavaFormat('1.1.0') // last version supporting jvm 8
- }
- kotlin {
- toggleOffOn()
- ktfmt('0.39')
- }
- groovyGradle {
- toggleOffOn()
- importOrder()
- target '*.gradle'
- greclipse('4.19.0') // last version supporting jvm 8
- }
-}
+apply from: Blowdryer.file('spotless.gradle')
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
@@ -140,12 +117,11 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
-boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
-boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
-String channel = project.findProperty('channel') ? project.channel : 'stable'
-String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12'
-String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
-
+boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
+boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
+boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false
+String channel = project.hasProperty('channel') ? project.channel : 'stable'
+String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12'
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
@@ -228,10 +204,10 @@ try {
}
catch (Exception ignored) {
out.style(Style.Failure).text(
- 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
- 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
- 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
- )
+ 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
+ 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
+ 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
+ )
versionOverride = 'NO-GIT-TAG-SET'
identifiedVersion = versionOverride
}
@@ -255,7 +231,7 @@ else {
def arguments = []
def jvmArguments = []
-if (usesMixins.toBoolean()) {
+if (usesMixins.toBoolean() || forceEnableMixins) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
@@ -320,7 +296,7 @@ repositories {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
- if(usesMixins.toBoolean()) {
+ if(usesMixins.toBoolean() || forceEnableMixins) {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
@@ -337,6 +313,8 @@ dependencies {
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
+ }
+ if(usesMixins.toBoolean() || forceEnableMixins) {
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
// Mixin includes a lot of dependencies that are too up-to-date
@@ -394,7 +372,10 @@ shadowJar {
}
minimize() // This will only allow shading for actually used classes
- configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
+ configurations = [
+ project.configurations.shadowImplementation,
+ project.configurations.shadowCompile
+ ]
dependsOn(relocateShadowJar)
}
@@ -425,12 +406,12 @@ afterEvaluate {
if(usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
- "-AreobfSrgFile=${tasks.reobf.srg}",
- "-AoutSrgFile=${mixinSrg}",
- "-AoutRefMapFile=${refMap}",
- // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
- "-XDenableSunApiLintControl",
- "-XDignore.symbol.file"
+ "-AreobfSrgFile=${tasks.reobf.srg}",
+ "-AoutSrgFile=${mixinSrg}",
+ "-AoutRefMapFile=${refMap}",
+ // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
+ "-XDenableSunApiLintControl",
+ "-XDignore.symbol.file"
]
}
}
@@ -439,8 +420,8 @@ afterEvaluate {
runClient {
if(developmentEnvironmentUserName) {
arguments += [
- "--username",
- developmentEnvironmentUserName
+ "--username",
+ developmentEnvironmentUserName
]
}
@@ -458,13 +439,14 @@ tasks.withType(JavaExec).configureEach {
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
- )
+ )
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
+ exclude("spotless.gradle")
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
@@ -472,9 +454,9 @@ processResources {
// replace modVersion and minecraftVersion
expand "minecraftVersion": project.minecraft.version,
- "modVersion": modVersion,
- "modId": modId,
- "modName": modName
+ "modVersion": modVersion,
+ "modId": modId,
+ "modName": modName
}
if(usesMixins.toBoolean()) {
@@ -484,6 +466,7 @@ processResources {
// copy everything else that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
+ exclude 'spotless.gradle'
}
}
@@ -503,9 +486,9 @@ def getManifestAttributes() {
if(usesMixins.toBoolean()) {
manifestAttributes += [
- "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
- "MixinConfigs" : "mixins." + modId + ".json",
- "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
+ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
+ "MixinConfigs" : "mixins." + modId + ".json",
+ "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
]
}
return manifestAttributes
@@ -532,7 +515,10 @@ task shadowDevJar(type: ShadowJar) {
}
minimize() // This will only allow shading for actually used classes
- configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
+ configurations = [
+ project.configurations.shadowImplementation,
+ project.configurations.shadowCompile
+ ]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
@@ -624,7 +610,10 @@ publishing {
// remove extra garbage from minecraft and minecraftDeps configuration
pom.withXml {
def badArtifacts = [:].withDefault {[] as Set<String>}
- for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
+ for (configuration in [
+ projectConfigs.minecraft,
+ projectConfigs.minecraftDeps
+ ]) {
for (dependency in configuration.allDependencies) {
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
}
@@ -658,7 +647,7 @@ task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
- print("Build script already up-to-date!")
+ print("Build script already up-to-date!")
}
}
@@ -673,12 +662,26 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
}
+static URL exampleSettingsGradleUrl() {
+ new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example")
+}
+
+
+def verifySettingsGradle() {
+ def settingsFile = getFile("settings.gradle")
+ if (!settingsFile.exists()) {
+ println("Downloading default settings.gradle")
+ exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
+ throw new GradleException("Settings.gradle has been updated, please re-run task.")
+ }
+}
boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
+ verifySettingsGradle()
return true
}
return false
@@ -739,194 +742,195 @@ task deobfParams {
}
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
- out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
- }
+ out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
+}
}
static int replaceParams(File file, Map<String, String> params) {
- int fileCount = 0
+int fileCount = 0
- if(file.isDirectory()) {
- for(File f : file.listFiles()) {
- fileCount += replaceParams(f, params)
- }
- return fileCount
- }
- println("Visiting ${file.getName()} ...")
- try {
- String content = new String(Files.readAllBytes(file.toPath()))
- int hash = content.hashCode()
- params.forEach{key, value ->
- content = content.replaceAll(key, value)
- }
- if(hash != content.hashCode()) {
- Files.write(file.toPath(), content.getBytes("UTF-8"))
- return 1
- }
- } catch(Exception e) {
- e.printStackTrace()
+if(file.isDirectory()) {
+ for(File f : file.listFiles()) {
+ fileCount += replaceParams(f, params)
}
- return 0
+ return fileCount
+}
+println("Visiting ${file.getName()} ...")
+try {
+ String content = new String(Files.readAllBytes(file.toPath()))
+ int hash = content.hashCode()
+ params.forEach{key, value ->
+ content = content.replaceAll(key, value)
+ }
+ if(hash != content.hashCode()) {
+ Files.write(file.toPath(), content.getBytes("UTF-8"))
+ return 1
+ }
+} catch(Exception e) {
+ e.printStackTrace()
+}
+return 0
}
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
static unzip(String zipFileName, String outputDir) {
- byte[] buffer = new byte[16384]
- ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
- ZipEntry zipEntry = zis.getNextEntry()
- while (zipEntry != null) {
- File newFile = new File(outputDir + File.separator, zipEntry.name)
- if (zipEntry.isDirectory()) {
- if (!newFile.isDirectory() && !newFile.mkdirs()) {
- throw new IOException("Failed to create directory $newFile")
- }
- } else {
- // fix for Windows-created archives
- File parent = newFile.parentFile
- if (!parent.isDirectory() && !parent.mkdirs()) {
- throw new IOException("Failed to create directory $parent")
- }
- // write file content
- FileOutputStream fos = new FileOutputStream(newFile)
- int len = 0
- while ((len = zis.read(buffer)) > 0) {
- fos.write(buffer, 0, len)
- }
- fos.close()
- }
- zipEntry = zis.getNextEntry()
- }
- zis.closeEntry()
- zis.close()
+byte[] buffer = new byte[16384]
+ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
+ZipEntry zipEntry = zis.getNextEntry()
+while (zipEntry != null) {
+ File newFile = new File(outputDir + File.separator, zipEntry.name)
+ if (zipEntry.isDirectory()) {
+ if (!newFile.isDirectory() && !newFile.mkdirs()) {
+ throw new IOException("Failed to create directory $newFile")
+ }
+ } else {
+ // fix for Windows-created archives
+ File parent = newFile.parentFile
+ if (!parent.isDirectory() && !parent.mkdirs()) {
+ throw new IOException("Failed to create directory $parent")
+ }
+ // write file content
+ FileOutputStream fos = new FileOutputStream(newFile)
+ int len = 0
+ while ((len = zis.read(buffer)) > 0) {
+ fos.write(buffer, 0, len)
+ }
+ fos.close()
+ }
+ zipEntry = zis.getNextEntry()
+}
+zis.closeEntry()
+zis.close()
}
configure(deobfParams) {
- group = 'forgegradle'
- description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
+group = 'forgegradle'
+description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
}
// Dependency Deobfuscation
def deobf(String sourceURL) {
- try {
- URL url = new URL(sourceURL)
- String fileName = url.getFile()
-
- //get rid of directories:
- int lastSlash = fileName.lastIndexOf("/")
- if(lastSlash > 0) {
- fileName = fileName.substring(lastSlash + 1)
- }
- //get rid of extension:
- if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
- fileName = fileName.substring(0, fileName.lastIndexOf("."))
- }
+try {
+ URL url = new URL(sourceURL)
+ String fileName = url.getFile()
- String hostName = url.getHost()
- if(hostName.startsWith("www.")) {
- hostName = hostName.substring(4)
- }
- List parts = Arrays.asList(hostName.split("\\."))
- Collections.reverse(parts)
- hostName = String.join(".", parts)
+ //get rid of directories:
+ int lastSlash = fileName.lastIndexOf("/")
+ if(lastSlash > 0) {
+ fileName = fileName.substring(lastSlash + 1)
+ }
+ //get rid of extension:
+ if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
+ fileName = fileName.substring(0, fileName.lastIndexOf("."))
+ }
- return deobf(sourceURL, "$hostName/$fileName")
- } catch(Exception e) {
- return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
+ String hostName = url.getHost()
+ if(hostName.startsWith("www.")) {
+ hostName = hostName.substring(4)
}
+ List parts = Arrays.asList(hostName.split("\\."))
+ Collections.reverse(parts)
+ hostName = String.join(".", parts)
+
+ return deobf(sourceURL, "$hostName/$fileName")
+} catch(Exception e) {
+ return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
+}
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String rawFileName) {
- String bon2Version = "2.5.1"
- String fileName = URLDecoder.decode(rawFileName, "UTF-8")
- String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
- String bon2Dir = "$cacheDir/forge_gradle/deobf"
- String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
- String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
- String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
-
- if(file(deobfFile).exists()) {
- return files(deobfFile)
- }
+String bon2Version = "2.5.1"
+String fileName = URLDecoder.decode(rawFileName, "UTF-8")
+String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
+String bon2Dir = "$cacheDir/forge_gradle/deobf"
+String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
+String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
+String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
+
+if(file(deobfFile).exists()) {
+ return files(deobfFile)
+}
- String mappingsVer
- if(remoteMappings) {
- String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
- String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
+String mappingsVer
+String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
+if(remoteMappings) {
+ String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
+ String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
- zipMappings(mappingsZIP, remoteMappings, bon2Dir)
+ zipMappings(mappingsZIP, remoteMappings, bon2Dir)
- mappingsVer = "snapshot_$id"
- } else {
- mappingsVer = "${channel}_$mappingsVersion"
- }
+ mappingsVer = "snapshot_$id"
+} else {
+ mappingsVer = "${channel}_$mappingsVersion"
+}
- download.run {
- src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
- dest bon2File
- quiet true
- overwrite false
- }
+download.run {
+ src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
+ dest bon2File
+ quiet true
+ overwrite false
+}
- download.run {
- src sourceURL
- dest obfFile
- quiet true
- overwrite false
- }
+download.run {
+ src sourceURL
+ dest obfFile
+ quiet true
+ overwrite false
+}
- exec {
- commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
- workingDir bon2Dir
- standardOutput = new FileOutputStream("${deobfFile}.log")
- }
+exec {
+ commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
+ workingDir bon2Dir
+ standardOutput = new FileOutputStream("${deobfFile}.log")
+}
- return files(deobfFile)
+return files(deobfFile)
}
def zipMappings(String zipPath, String url, String bon2Dir) {
- File zipFile = new File(zipPath)
- if(zipFile.exists()) {
- return
- }
+File zipFile = new File(zipPath)
+if(zipFile.exists()) {
+ return
+}
- String fieldsCache = "$bon2Dir/data/fields.csv"
- String methodsCache = "$bon2Dir/data/methods.csv"
+String fieldsCache = "$bon2Dir/data/fields.csv"
+String methodsCache = "$bon2Dir/data/methods.csv"
- download.run {
- src "${url}fields.csv"
- dest fieldsCache
- quiet true
- }
- download.run {
- src "${url}methods.csv"
- dest methodsCache
- quiet true
- }
+download.run {
+ src "${url}fields.csv"
+ dest fieldsCache
+ quiet true
+}
+download.run {
+ src "${url}methods.csv"
+ dest methodsCache
+ quiet true
+}
- zipFile.getParentFile().mkdirs()
- ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
+zipFile.getParentFile().mkdirs()
+ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
- zos.putNextEntry(new ZipEntry("fields.csv"))
- Files.copy(Paths.get(fieldsCache), zos)
- zos.closeEntry()
+zos.putNextEntry(new ZipEntry("fields.csv"))
+Files.copy(Paths.get(fieldsCache), zos)
+zos.closeEntry()
- zos.putNextEntry(new ZipEntry("methods.csv"))
- Files.copy(Paths.get(methodsCache), zos)
- zos.closeEntry()
+zos.putNextEntry(new ZipEntry("methods.csv"))
+Files.copy(Paths.get(methodsCache), zos)
+zos.closeEntry()
- zos.close()
+zos.close()
}
// Helper methods
def checkPropertyExists(String propertyName) {
- if (!project.hasProperty(propertyName)) {
- throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
- }
+if (!project.hasProperty(propertyName)) {
+ throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
+}
}
def getFile(String relativePath) {
- return new File(projectDir, relativePath)
+return new File(projectDir, relativePath)
}
diff --git a/dependencies.gradle b/dependencies.gradle
index a94333541e..18093d7d3d 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -1,10 +1,10 @@
// Add your dependencies here
dependencies {
- compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev')
- compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev')
+ compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev')
+ compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev')
- compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
+ compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
- compileOnly('com.opencsv:opencsv:4.0')
+ compileOnly('com.opencsv:opencsv:4.0')
}
diff --git a/repositories.gradle b/repositories.gradle
index f67e7c627d..e850975183 100644
--- a/repositories.gradle
+++ b/repositories.gradle
@@ -1,22 +1,22 @@
// Add any additional repositiroes for your dependencies here
repositories {
- maven {
- name 'GTNH Maven'
- url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
- }
- maven {
- name 'ic2'
- url 'http://maven.ic2.player.to/'
- metadataSources {
- mavenPom()
- artifact()
- }
- }
- maven {
- url 'https://cursemaven.com'
- content {
- includeGroup 'curse.maven'
- }
- }
+ maven {
+ name 'GTNH Maven'
+ url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
+ }
+ maven {
+ name 'ic2'
+ url 'http://maven.ic2.player.to/'
+ metadataSources {
+ mavenPom()
+ artifact()
+ }
+ }
+ maven {
+ url 'https://cursemaven.com'
+ content {
+ includeGroup 'curse.maven'
+ }
+ }
}
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000000..97d8f71c52
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,10 @@
+plugins {
+ id 'com.diffplug.blowdryerSetup' version '1.6.0'
+}
+
+apply plugin: 'com.diffplug.blowdryerSetup'
+
+blowdryerSetup {
+ github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4')
+ //devLocal '.' // Use this when testing config updates locally
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
index 55a8680555..9876e07276 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
@@ -11,9 +11,11 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import pers.gwyog.gtneioreplugin.plugin.IMCForNEI;
import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
+import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper;
import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper;
@Mod(
@@ -75,6 +77,7 @@ public class GTNEIOrePlugin {
@EventHandler
public void init(FMLInitializationEvent event) {
ModBlocks.init();
+ IMCForNEI.IMCSender();
}
@EventHandler
@@ -82,6 +85,7 @@ public class GTNEIOrePlugin {
if (event.getSide() == Side.CLIENT) {
new GT5OreLayerHelper();
new GT5OreSmallHelper();
+ new GT5UndergroundFluidHelper();
new GuiRecipeHelper();
if (csv) {
new pers.gwyog.gtneioreplugin.util.CSVMaker().run();
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java
new file mode 100644
index 0000000000..bcba2eed1a
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java
@@ -0,0 +1,57 @@
+package pers.gwyog.gtneioreplugin.plugin;
+
+import cpw.mods.fml.common.event.FMLInterModComms;
+import net.minecraft.nbt.NBTTagCompound;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
+
+public class IMCForNEI {
+ public static void IMCSender() {
+ // Though these 2 are already registered in NEI jar, we need to re-register
+ // because new DimensionDisplayItems made tabs a bit taller.
+ sendHandler("pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat", "gregtech:gt.blockores:386");
+
+ sendHandler("pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat", "gregtech:gt.blockores:85");
+
+ sendHandler(
+ "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid",
+ "gregtech:gt.metaitem.01:32619");
+ sendCatalyst(
+ "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid",
+ "gregtech:gt.blockmachines:1157");
+ sendCatalyst(
+ "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid",
+ "gregtech:gt.blockmachines:141");
+ sendCatalyst(
+ "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid",
+ "gregtech:gt.blockmachines:142");
+ sendCatalyst(
+ "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid",
+ "gregtech:gt.blockmachines:148");
+ }
+
+ private static void sendHandler(String name, String itemStack) {
+ NBTTagCompound aNBT = new NBTTagCompound();
+ aNBT.setString("handler", name);
+ aNBT.setString("modName", GTNEIOrePlugin.NAME);
+ aNBT.setString("modId", GTNEIOrePlugin.MODID);
+ aNBT.setBoolean("modRequired", true);
+ aNBT.setString("itemName", itemStack);
+ aNBT.setInteger("handlerHeight", 160);
+ aNBT.setInteger("handlerWidth", 166);
+ aNBT.setInteger("maxRecipesPerPage", 2);
+ aNBT.setInteger("yShift", 0);
+ FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT);
+ }
+
+ private static void sendCatalyst(String name, String itemStack, int priority) {
+ NBTTagCompound aNBT = new NBTTagCompound();
+ aNBT.setString("handlerID", name);
+ aNBT.setString("itemName", itemStack);
+ aNBT.setInteger("priority", priority);
+ FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT);
+ }
+
+ private static void sendCatalyst(String name, String itemStack) {
+ sendCatalyst(name, itemStack, 0);
+ }
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
index ee76cff2d2..17193b07fe 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
@@ -4,6 +4,7 @@ import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid;
import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat;
public class NEIPluginConfig implements IConfigureNEI {
@@ -22,9 +23,12 @@ public class NEIPluginConfig implements IConfigureNEI {
public void loadConfig() {
PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat();
PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat();
+ PluginGT5UndergroundFluid pluginGT5UndergroundFluid = new PluginGT5UndergroundFluid();
API.registerRecipeHandler(pluginVeinStat);
API.registerUsageHandler(pluginVeinStat);
API.registerRecipeHandler(pluginSmallOreStat);
API.registerUsageHandler(pluginSmallOreStat);
+ API.registerRecipeHandler(pluginGT5UndergroundFluid);
+ API.registerUsageHandler(pluginGT5UndergroundFluid);
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
index de36d22bc9..71c770a86b 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
@@ -25,7 +25,7 @@ public abstract class PluginBase extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
- int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll"));
+ int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"));
transferRects.add(new RecipeTransferRect(
new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId()));
}
@@ -35,4 +35,12 @@ public abstract class PluginBase extends TemplateRecipeHandler {
public int getGuiWidth() {
return 166;
}
+
+ /**
+ * Draw the "see all recipes" transfer label
+ */
+ protected void drawSeeAllRecipesLabel() {
+ GuiDraw.drawStringR(
+ EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false);
+ }
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
index 6abc3ea96c..1c7e14db79 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
@@ -8,7 +8,6 @@ import gregtech.api.util.GT_LanguageManager;
import java.awt.Point;
import java.awt.Rectangle;
import net.minecraft.client.resources.I18n;
-import net.minecraft.util.EnumChatFormatting;
import pers.gwyog.gtneioreplugin.plugin.PluginBase;
import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper;
@@ -89,12 +88,4 @@ public abstract class PluginGT5Base extends PluginBase {
protected void drawDimNames(String dimNames) {
GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false);
}
-
- /**
- * Draw the "see all recipes" transfer label
- */
- protected void drawSeeAllRecipesLabel() {
- GuiDraw.drawStringR(
- EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false);
- }
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java
new file mode 100644
index 0000000000..0cdf2b53b7
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java
@@ -0,0 +1,165 @@
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.PositionedStack;
+import gregtech.api.util.GT_Utility;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import pers.gwyog.gtneioreplugin.plugin.PluginBase;
+import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay;
+import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper;
+import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper.UndergroundFluidWrapper;
+
+public class PluginGT5UndergroundFluid extends PluginBase {
+
+ private static final int lineSpace = 20;
+ private static final int xDimensionDisplay = 30;
+ private static final int halfItemLength = 16 / 2;
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId())) {
+ for (Map.Entry<String, List<UndergroundFluidWrapper>> entry :
+ GT5UndergroundFluidHelper.getAllEntries().entrySet()) {
+ Fluid fluid = FluidRegistry.getFluid(entry.getKey());
+ if (fluid != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue()));
+ }
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack result) {
+ Fluid fluid = null;
+ FluidStack containerFluid = GT_Utility.getFluidForFilledItem(result, true);
+ if (containerFluid != null) {
+ fluid = containerFluid.getFluid();
+ }
+ if (fluid == null) {
+ FluidStack displayFluid = GT_Utility.getFluidFromDisplayStack(result);
+ if (displayFluid != null) {
+ fluid = displayFluid.getFluid();
+ }
+ }
+ if (fluid == null) return;
+
+ List<UndergroundFluidWrapper> wrappers = GT5UndergroundFluidHelper.getEntry(fluid.getName());
+ if (wrappers != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, wrappers));
+ }
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack ingredient) {
+ String dimension = ItemDimensionDisplay.getDimension(ingredient);
+ if (dimension != null) {
+ for (Map.Entry<String, List<UndergroundFluidWrapper>> entry :
+ GT5UndergroundFluidHelper.getAllEntries().entrySet()) {
+ boolean found = false;
+ for (UndergroundFluidWrapper wrapper : entry.getValue()) {
+ if (wrapper.dimension.equals(dimension)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ Fluid fluid = FluidRegistry.getFluid(entry.getKey());
+ if (fluid != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue()));
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void drawExtras(int recipeIndex) {
+ drawSeeAllRecipesLabel();
+
+ int xChance = 85;
+ int xAmount = 140;
+ int yHeader = 30;
+ int black = 0x404040;
+
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.dimension") + ":", xDimensionDisplay, yHeader, black, false);
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.chance") + ":", xChance, yHeader, black, false);
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.fluidAmount") + ":", xAmount, yHeader, black, false);
+
+ int y = 50;
+ CachedUndergroundFluidRecipe recipe = (CachedUndergroundFluidRecipe) this.arecipes.get(recipeIndex);
+ for (int i = 0; i < recipe.dimensionDisplayItems.size(); i++) {
+ GuiDraw.drawStringC(
+ new DecimalFormat("0.#").format((double) recipe.chances.get(i) / 100) + "%",
+ xChance,
+ y,
+ black,
+ false);
+ GuiDraw.drawStringC(
+ recipe.minAmounts.get(i).toString() + "-"
+ + recipe.maxAmounts.get(i).toString(),
+ xAmount,
+ y,
+ black,
+ false);
+ y += lineSpace;
+ }
+ }
+
+ @Override
+ public String getOutputId() {
+ return "GTOrePluginUndergroundFluid";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return I18n.format("gtnop.gui.undergroundFluid.name");
+ }
+
+ private class CachedUndergroundFluidRecipe extends CachedRecipe {
+
+ private final PositionedStack targetFluidDisplay;
+ private final List<PositionedStack> dimensionDisplayItems = new ArrayList<>();
+ private final List<Integer> chances = new ArrayList<>();
+ private final List<Integer> maxAmounts = new ArrayList<>();
+ private final List<Integer> minAmounts = new ArrayList<>();
+
+ private CachedUndergroundFluidRecipe(Fluid fluid, List<UndergroundFluidWrapper> wrappers) {
+ targetFluidDisplay =
+ new PositionedStack(GT_Utility.getFluidDisplayStack(fluid), getGuiWidth() / 2 - halfItemLength, 3);
+ int y = 50 - halfItemLength;
+ for (UndergroundFluidWrapper wrapper : wrappers) {
+ ItemStack dimensionDisplay = ItemDimensionDisplay.getItem(wrapper.dimension);
+ if (dimensionDisplay != null) {
+ dimensionDisplayItems.add(new PositionedStack(
+ dimensionDisplay,
+ xDimensionDisplay - halfItemLength,
+ y + GuiDraw.fontRenderer.FONT_HEIGHT / 2));
+ y += lineSpace;
+ chances.add(wrapper.chance);
+ maxAmounts.add(wrapper.maxAmount);
+ minAmounts.add(wrapper.minAmount);
+ }
+ }
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return targetFluidDisplay;
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ return dimensionDisplayItems;
+ }
+ }
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java
index 7584cf405c..0e5bf0c24b 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java
@@ -1,5 +1,7 @@
package pers.gwyog.gtneioreplugin.plugin.item;
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG;
+
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import java.util.Objects;
@@ -29,6 +31,9 @@ public class ItemDimensionDisplay extends ItemBlock {
if (block != null) {
return new ItemStack(block);
}
+ if (dimension != null) {
+ LOG.warn("Unknown dimension queried for ItemDimensionDisplay: " + dimension);
+ }
return null;
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java
index 3b281713f7..b175b456b1 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java
@@ -62,6 +62,7 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer {
case "Ce":
case "Eu":
case "Ga":
+ case "Rb":
return "T3";
case "Io":
case "Me":
@@ -71,6 +72,7 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer {
case "Mi":
case "Ob":
case "Ti":
+ case "Ra":
return "T5";
case "Pr":
case "Tr":
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
index 90d49d7e35..74f726dac1 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
@@ -5,6 +5,7 @@ import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.stream.Collectors;
import net.minecraft.client.resources.I18n;
public class DimensionHelper {
@@ -29,6 +30,7 @@ public class DimensionHelper {
"GalaxySpace_Ceres",
"GalaxySpace_Europa",
"GalaxySpace_Ganymede",
+ "Ross128b",
// T4
"GalaxySpace_Io",
"GalaxySpace_Mercury",
@@ -38,6 +40,7 @@ public class DimensionHelper {
"GalaxySpace_Miranda",
"GalaxySpace_Oberon",
"GalaxySpace_Titan",
+ "Ross128ba",
// T6
"GalaxySpace_Proteus",
"GalaxySpace_Triton",
@@ -56,6 +59,14 @@ public class DimensionHelper {
"GalaxySpace_VegaB",
};
+ public static String[] DimNameTrimmed = Arrays.stream(DimName)
+ .map(n -> n.replaceAll("GalacticraftCore_", "")
+ .replaceAll("GalacticraftMars_", "")
+ .replaceAll("GalaxySpace_", "")
+ .replaceAll("Vanilla_", "Vanilla "))
+ .collect(Collectors.toList())
+ .toArray(new String[0]);
+
public static String[]
DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except capital letter in
// name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA
@@ -78,6 +89,7 @@ public class DimensionHelper {
"Ce", // GalaxySpace_Ceres
"Eu", // GalaxySpace_Europa
"Ga", // GalaxySpace_Ganymede
+ "Rb", // Ross128b
// T4
"Io", // GalaxySpace_Io
"Me", // GalaxySpace_Mercury
@@ -87,6 +99,7 @@ public class DimensionHelper {
"Mi", // GalaxySpace_Miranda
"Ob", // GalaxySpace_Oberon
"Ti", // GalaxySpace_Titan
+ "Ra", // Ross128ba
// T6
"Pr", // GalaxySpace_Proteus
"Tr", // GalaxySpace_Triton
@@ -113,11 +126,7 @@ public class DimensionHelper {
String s = dims[j];
for (int i = 0; i < DimNameDisplayed.length; i++) {
if (s.equals(DimNameDisplayed[i])) {
- String k = DimName[i]
- .replaceAll("GalacticraftCore_", "")
- .replaceAll("GalacticraftMars_", "")
- .replaceAll("GalaxySpace_", "")
- .replaceAll("Vanilla_", "Vanilla ");
+ String k = DimNameTrimmed[i];
s = I18n.format("gtnop.world." + k);
switch (k) {
case "Moon":
@@ -133,6 +142,7 @@ public class DimensionHelper {
case "Ceres":
case "Europa":
case "Ganymede":
+ case "Ross128b":
s = "T3: " + s;
break;
case "Io":
@@ -144,6 +154,7 @@ public class DimensionHelper {
case "Miranda":
case "Oberon":
case "Titan":
+ case "Ross128ba":
s = "T5: " + s;
break;
case "Proteus":
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java
new file mode 100644
index 0000000000..731867953d
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java
@@ -0,0 +1,170 @@
+package pers.gwyog.gtneioreplugin.util;
+
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG;
+
+import com.google.common.collect.BiMap;
+import gregtech.GT_Mod;
+import gregtech.api.objects.GT_UO_Dimension;
+import gregtech.api.objects.GT_UO_DimensionList;
+import gregtech.api.objects.GT_UO_Fluid;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import net.minecraft.world.WorldProvider;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+
+public class GT5UndergroundFluidHelper {
+
+ /**
+ * Need to store fluid name instead of fluid
+ * because fluid instance might be different between gas and liquid
+ */
+ private static final Map<String, List<UndergroundFluidWrapper>> fluidMap = new HashMap<>();
+
+ @SuppressWarnings("unchecked")
+ public GT5UndergroundFluidHelper() {
+ try {
+ Field fieldDimensionList = GT_UO_DimensionList.class.getDeclaredField("fDimensionList");
+ fieldDimensionList.setAccessible(true);
+ BiMap<String, GT_UO_Dimension> dimensionList =
+ (BiMap<String, GT_UO_Dimension>) fieldDimensionList.get(GT_Mod.gregtechproxy.mUndergroundOil);
+ for (Map.Entry<String, GT_UO_Dimension> dimensionEntry : dimensionList.entrySet()) {
+ String rawDimension = dimensionEntry.getKey();
+ String dimension = null;
+ try {
+ dimension = getDimensionFromID(Integer.parseInt(rawDimension));
+ } catch (NumberFormatException ignored) {
+ Field fieldProviders = DimensionManager.class.getDeclaredField("providers");
+ fieldProviders.setAccessible(true);
+ Hashtable<Integer, Class<? extends WorldProvider>> providers =
+ (Hashtable<Integer, Class<? extends WorldProvider>>) fieldProviders.get(null);
+
+ // some short dimension names like Io might be caught by multiple dimension classes,
+ // so we'll check them all.
+ // List<WorldProvider> dimensionCandidates = providers.values()
+ List<Class<? extends WorldProvider>> dimensionCandidates = providers.values().stream()
+ .filter(p -> p.getName().contains(rawDimension))
+ .collect(Collectors.toList());
+ loop:
+ for (Class<? extends WorldProvider> candidate : dimensionCandidates) {
+ for (int i = 0; i < DimensionHelper.DimNameTrimmed.length; i++) {
+ if (DimensionHelper.DimNameTrimmed[i].equalsIgnoreCase(
+ candidate.newInstance().getDimensionName())) {
+ dimension = DimensionHelper.DimNameDisplayed[i];
+ break loop;
+ }
+ }
+ }
+ }
+
+ if (dimension == null) {
+ dimension = getDimensionForEdgeCase(rawDimension);
+ if (dimension == null) {
+ LOG.warn("Unknown dimension found in GT5 config: " + rawDimension);
+ continue;
+ }
+ }
+
+ Field fieldFluids = GT_UO_Dimension.class.getDeclaredField("fFluids");
+ fieldFluids.setAccessible(true);
+ BiMap<String, GT_UO_Fluid> fluids =
+ (BiMap<String, GT_UO_Fluid>) fieldFluids.get(dimensionEntry.getValue());
+
+ int maxChance = 0;
+ for (Map.Entry<String, GT_UO_Fluid> fluidEntry : fluids.entrySet()) {
+ maxChance += fluidEntry.getValue().Chance;
+ }
+
+ for (Map.Entry<String, GT_UO_Fluid> fluidEntry : fluids.entrySet()) {
+ Fluid fluid = FluidRegistry.getFluid(fluidEntry.getKey());
+ if (fluid != null) {
+ UndergroundFluidWrapper wrapper = new UndergroundFluidWrapper(
+ dimension,
+ fluidEntry.getValue().Chance * 10000 / maxChance,
+ fluidEntry.getValue().MaxAmount,
+ fluidEntry.getValue().MinAmount);
+ if (fluidMap.containsKey(fluid.getName())) {
+ fluidMap.get(fluid.getName()).add(wrapper);
+ } else {
+ fluidMap.put(fluid.getName(), new ArrayList<>(Collections.singletonList(wrapper)));
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (List<UndergroundFluidWrapper> wrappers : fluidMap.values()) {
+ wrappers.sort(Comparator.comparingInt(
+ w -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(w.dimension)));
+ }
+ }
+
+ public static List<UndergroundFluidWrapper> getEntry(String fluidName) {
+ return fluidMap.get(fluidName);
+ }
+
+ public static Map<String, List<UndergroundFluidWrapper>> getAllEntries() {
+ return fluidMap;
+ }
+
+ @SuppressWarnings("SwitchStatementWithTooFewBranches")
+ private String getDimensionFromID(int id) {
+ switch (id) {
+ case 0:
+ return "Ow";
+ default:
+ return null;
+ }
+ }
+
+ private String getDimensionForEdgeCase(String rawDimension) {
+ switch (rawDimension) {
+ case "aCentauriBb":
+ return "CB";
+ case "BarnardaC":
+ return "BC";
+ case "BarnardaE":
+ return "BE";
+ case "BarnardaF":
+ return "BF";
+ case "TCetiE":
+ return "TE";
+ default:
+ LOG.warn("Unknown dimension name while parsing: " + rawDimension);
+ return null;
+ }
+ }
+
+ public static class UndergroundFluidWrapper {
+
+ /**
+ * Using {@link DimensionHelper#DimNameDisplayed}
+ */
+ public final String dimension;
+ /**
+ * Chance of this fluid field being generated. 10000 means 100% of the dimension
+ */
+ public final int chance;
+
+ public final int maxAmount;
+ public final int minAmount;
+
+ public UndergroundFluidWrapper(String dimension, int chance, int maxAmount, int minAmount) {
+ this.dimension = dimension;
+ this.chance = chance;
+ this.maxAmount = maxAmount;
+ this.minAmount = minAmount;
+ }
+ }
+}
diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
index dd65efe1ff..e55dedc668 100644
--- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
+++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
@@ -2,6 +2,7 @@
gtnop.gui.veinStat.name=Vein Stats
gtnop.gui.asteroidStat.name=Asteroid Stats
gtnop.gui.smallOreStat.name=Small Ore Stats
+gtnop.gui.undergroundFluid.name=Underground Fluid Stats
gtnop.gui.ieVeinStat.name=IE Vein Stats
gtnop.gui.bedrockOreStat.name=Bedrock Ore Stats
@@ -14,6 +15,9 @@ gtnop.gui.nei.genHeight=Height
gtnop.gui.nei.weightedChance=Weight
gtnop.gui.nei.worldNames=Generated world
gtnop.gui.nei.restrictBiome=Restricted biome
+gtnop.gui.nei.dimension=Dimension
+gtnop.gui.nei.chance=Chance
+gtnop.gui.nei.fluidAmount=Amount
gtnop.gui.nei.asteroidPrimary=Main-Gen1
gtnop.gui.nei.asteroidSecondary=Main-Gen2
@@ -50,11 +54,13 @@ gtnop.world.Ceres=Ceres
gtnop.world.Europa=Europa
gtnop.world.Ganymede=Ganymede
gtnop.world.Callisto=Callisto
+gtnop.world.Ross128b=Ross128b
gtnop.world.Io=Io
gtnop.world.Venus=Venus
gtnop.world.Mercury=Mercury
gtnop.world.Enceladus=Enceladus
gtnop.world.Titan=Titan
+gtnop.world.Ross128ba=Ross128ba
gtnop.world.Miranda=Miranda
gtnop.world.Oberon=Oberon
gtnop.world.Proteus=Proteus
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png
new file mode 100644
index 0000000000..bd7a426d98
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png
Binary files differ
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png
new file mode 100644
index 0000000000..5f5322c16f
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png
Binary files differ
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png
new file mode 100644
index 0000000000..2f40ded50c
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png
Binary files differ
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png
new file mode 100644
index 0000000000..de3fd5d20c
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png
Binary files differ
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png
new file mode 100644
index 0000000000..824764eca6
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png
Binary files differ
diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png
new file mode 100644
index 0000000000..8c46a5ec54
--- /dev/null
+++ b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png
Binary files differ