mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48bb35140c | ||
|
|
2b27b551a3 | ||
|
|
b846e30b67 | ||
|
|
48e5948ce9 |
No files matched your search
@@ -0,0 +1,44 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
+504
-149
@@ -1,25 +1,40 @@
|
||||
//version: 1652851397
|
||||
//version: 1667597057
|
||||
/*
|
||||
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/master/build.gradle for updates.
|
||||
*/
|
||||
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.matthewprenger.cursegradle.CurseArtifact
|
||||
import com.matthewprenger.cursegradle.CurseRelation
|
||||
import com.modrinth.minotaur.dependencies.ModDependency
|
||||
import com.modrinth.minotaur.dependencies.VersionDependency
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name 'forge'
|
||||
url 'https://maven.minecraftforge.net'
|
||||
}
|
||||
maven {
|
||||
// GTNH ForgeGradle Fork
|
||||
name = "GTNH Maven"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
@@ -28,31 +43,39 @@ buildscript {
|
||||
name 'Scala CI dependencies'
|
||||
url 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
maven {
|
||||
name 'jitpack'
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'scala'
|
||||
id 'maven-publish'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
||||
id 'de.undercouch.download' version '5.0.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
||||
id 'de.undercouch.download' version '5.0.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
||||
id 'com.diffplug.spotless' version '6.7.2' apply false
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
}
|
||||
boolean settingsupdated = verifySettingsGradle()
|
||||
settingsupdated = verifyGitAttributes() || settingsupdated
|
||||
if (settingsupdated)
|
||||
throw new GradleException("Settings has been updated, please re-run task.")
|
||||
|
||||
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'
|
||||
@@ -78,7 +101,14 @@ idea {
|
||||
}
|
||||
}
|
||||
|
||||
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
|
||||
|
||||
if (!disableSpotless) {
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
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())
|
||||
}
|
||||
|
||||
@@ -103,63 +133,79 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
||||
checkPropertyExists("usesShadowedDependencies")
|
||||
checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
||||
propertyDefaultIfUnset("noPublishedSources", false)
|
||||
propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
|
||||
propertyDefaultIfUnset("forceEnableMixins", false)
|
||||
propertyDefaultIfUnset("channel", "stable")
|
||||
propertyDefaultIfUnset("mappingsVersion", "12")
|
||||
propertyDefaultIfUnset("modrinthProjectId", "")
|
||||
propertyDefaultIfUnset("modrinthRelations", "")
|
||||
propertyDefaultIfUnset("curseForgeProjectId", "")
|
||||
propertyDefaultIfUnset("curseForgeRelations", "")
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
String kotlinSourceDir = "src/main/kotlin/"
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
|
||||
final String modGroupPath = modGroup.toString().replaceAll("\\.", "/")
|
||||
final String apiPackagePath = apiPackage.toString().replaceAll("\\.", "/")
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroupPath
|
||||
String targetPackageScala = scalaSourceDir + modGroupPath
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroupPath
|
||||
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
if(apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
if (apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath
|
||||
targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath
|
||||
targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath
|
||||
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
if (accessTransformersFile) {
|
||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||
if(!getFile(targetFile).exists()) {
|
||||
if (!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
}
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
|
||||
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
|
||||
if (usesMixins.toBoolean()) {
|
||||
if (mixinsPackage.isEmpty()) {
|
||||
throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!")
|
||||
}
|
||||
final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/")
|
||||
|
||||
targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath
|
||||
targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath
|
||||
targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath
|
||||
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
if (!mixinPlugin.isEmpty()) {
|
||||
String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt"
|
||||
if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
if (coreModClass) {
|
||||
final String coreModPath = coreModClass.toString().replaceAll("\\.", "/")
|
||||
String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + coreModPath + ".java"
|
||||
String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt"
|
||||
if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
@@ -189,7 +235,7 @@ 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' +
|
||||
'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'
|
||||
@@ -200,22 +246,21 @@ ext {
|
||||
modVersion = identifiedVersion
|
||||
}
|
||||
|
||||
if(identifiedVersion == versionOverride) {
|
||||
if (identifiedVersion == versionOverride) {
|
||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
archivesBaseName = customArchiveBaseName
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
def arguments = []
|
||||
def jvmArguments = []
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
arguments += [
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
@@ -234,16 +279,16 @@ minecraft {
|
||||
|
||||
if (replaceGradleTokenInFile) {
|
||||
replaceIn replaceGradleTokenInFile
|
||||
if(gradleTokenModId) {
|
||||
if (gradleTokenModId) {
|
||||
replace gradleTokenModId, modId
|
||||
}
|
||||
if(gradleTokenModName) {
|
||||
if (gradleTokenModName) {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
if (gradleTokenVersion) {
|
||||
replace gradleTokenVersion, modVersion
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
if (gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
}
|
||||
}
|
||||
@@ -252,7 +297,7 @@ minecraft {
|
||||
args(arguments)
|
||||
jvmArgs(jvmArguments)
|
||||
|
||||
if(developmentEnvironmentUserName) {
|
||||
if (developmentEnvironmentUserName) {
|
||||
args("--username", developmentEnvironmentUserName)
|
||||
}
|
||||
}
|
||||
@@ -263,7 +308,7 @@ minecraft {
|
||||
}
|
||||
}
|
||||
|
||||
if(file('addon.gradle').exists()) {
|
||||
if (file('addon.gradle').exists()) {
|
||||
apply from: 'addon.gradle'
|
||||
}
|
||||
|
||||
@@ -280,33 +325,23 @@ repositories {
|
||||
name 'Overmind forge repo mirror'
|
||||
url 'https://gregtech.overminddl1.com/'
|
||||
}
|
||||
if(usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
maven {
|
||||
name 'sponge'
|
||||
url 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
name = "GTNH Maven"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if(usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean()) {
|
||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||
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')
|
||||
// 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
|
||||
exclude module: 'launchwrapper'
|
||||
exclude module: 'guava'
|
||||
exclude module: 'gson'
|
||||
exclude module: 'commons-io'
|
||||
exclude module: 'log4j-core'
|
||||
}
|
||||
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
|
||||
annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor')
|
||||
}
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
compile('com.gtnewhorizon:gtnhmixins:2.0.1')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,13 +353,18 @@ def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||
|
||||
task generateAssets {
|
||||
if (usesMixins.toBoolean()) {
|
||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json")
|
||||
if (!mixinConfigFile.exists()) {
|
||||
def mixinPluginLine = ""
|
||||
if(!mixinPlugin.isEmpty()) {
|
||||
// We might not have a mixin plugin if we're using early/late mixins
|
||||
mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """
|
||||
}
|
||||
|
||||
mixinConfigFile.text = """{
|
||||
"required": true,
|
||||
"minVersion": "0.7.11",
|
||||
"package": "${modGroup}.${mixinsPackage}",
|
||||
"plugin": "${modGroup}.${mixinPlugin}",
|
||||
"minVersion": "0.8.5-GTNH",
|
||||
"package": "${modGroup}.${mixinsPackage}",${mixinPluginLine}
|
||||
"refmap": "${mixingConfigRefMap}",
|
||||
"target": "@env(DEFAULT)",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
@@ -354,7 +394,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)
|
||||
}
|
||||
|
||||
@@ -369,38 +412,38 @@ jar {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
if (usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(shadowJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
reobf {
|
||||
if(usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean()) {
|
||||
addExtraSrgFile mixinSrg
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if(usesMixins.toBoolean()) {
|
||||
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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runClient {
|
||||
if(developmentEnvironmentUserName) {
|
||||
if (developmentEnvironmentUserName) {
|
||||
arguments += [
|
||||
"--username",
|
||||
developmentEnvironmentUserName
|
||||
"--username",
|
||||
developmentEnvironmentUserName
|
||||
]
|
||||
}
|
||||
|
||||
@@ -415,9 +458,9 @@ runServer {
|
||||
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
javaLauncher.set(
|
||||
javaToolchains.launcherFor {
|
||||
languageVersion = projectJavaVersion
|
||||
}
|
||||
javaToolchains.launcherFor {
|
||||
languageVersion = projectJavaVersion
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -425,6 +468,7 @@ 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) {
|
||||
@@ -437,43 +481,44 @@ processResources {
|
||||
"modName": modName
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
}
|
||||
|
||||
// copy everything else that's not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
exclude 'spotless.gradle'
|
||||
}
|
||||
}
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
if (accessTransformersFile) {
|
||||
manifestAttributes += ["FMLAT": accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
if (coreModClass) {
|
||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
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
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allSource)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
from(sourceSets.main.allSource)
|
||||
from(file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
@@ -492,7 +537,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) {
|
||||
@@ -520,22 +568,22 @@ task devJar(type: Jar) {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
if (usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(circularResolverJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allSource) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
from(sourceSets.main.allSource) {
|
||||
include modGroupPath + "/" + apiPackagePath + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.output) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
from(sourceSets.main.output) {
|
||||
include modGroupPath + "/" + apiPackagePath + '/**'
|
||||
}
|
||||
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include("LICENSE")
|
||||
}
|
||||
|
||||
@@ -543,11 +591,11 @@ task apiJar(type: Jar) {
|
||||
}
|
||||
|
||||
artifacts {
|
||||
if(!noPublishedSources) {
|
||||
if (!noPublishedSources) {
|
||||
archives sourcesJar
|
||||
}
|
||||
archives devJar
|
||||
if(apiPackage) {
|
||||
if (apiPackage) {
|
||||
archives apiJar
|
||||
}
|
||||
}
|
||||
@@ -565,10 +613,10 @@ publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
if (usesShadowedDependencies.toBoolean()) {
|
||||
artifact source: shadowJar, classifier: ""
|
||||
}
|
||||
if(!noPublishedSources) {
|
||||
if (!noPublishedSources) {
|
||||
artifact source: sourcesJar, classifier: "sources"
|
||||
}
|
||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||
@@ -583,8 +631,11 @@ publishing {
|
||||
|
||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
||||
pom.withXml {
|
||||
def badArtifacts = [:].withDefault {[] as Set<String>}
|
||||
for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
|
||||
def badArtifacts = [:].withDefault { [] as Set<String> }
|
||||
for (configuration in [
|
||||
projectConfigs.minecraft,
|
||||
projectConfigs.minecraftDeps
|
||||
]) {
|
||||
for (dependency in configuration.allDependencies) {
|
||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
||||
}
|
||||
@@ -613,6 +664,113 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
|
||||
apply plugin: 'com.modrinth.minotaur'
|
||||
|
||||
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
|
||||
|
||||
modrinth {
|
||||
token = System.getenv("MODRINTH_TOKEN")
|
||||
projectId = modrinthProjectId
|
||||
versionNumber = identifiedVersion
|
||||
versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release"
|
||||
changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : ""
|
||||
uploadFile = jar
|
||||
additionalFiles = getSecondaryArtifacts()
|
||||
gameVersions = [minecraftVersion]
|
||||
loaders = ["forge"]
|
||||
debugMode = false
|
||||
}
|
||||
|
||||
if (modrinthRelations.size() != 0) {
|
||||
String[] deps = modrinthRelations.split(";")
|
||||
deps.each { dep ->
|
||||
if (dep.size() == 0) {
|
||||
return
|
||||
}
|
||||
String[] parts = dep.split(":")
|
||||
String[] qual = parts[0].split("-")
|
||||
addModrinthDep(qual[0], qual[1], parts[1])
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
addModrinthDep("required", "version", "gtnhmixins")
|
||||
}
|
||||
tasks.modrinth.dependsOn(build)
|
||||
tasks.publish.dependsOn(tasks.modrinth)
|
||||
}
|
||||
|
||||
if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) {
|
||||
apply plugin: 'com.matthewprenger.cursegradle'
|
||||
|
||||
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
|
||||
|
||||
curseforge {
|
||||
apiKey = System.getenv("CURSEFORGE_TOKEN")
|
||||
project {
|
||||
id = curseForgeProjectId
|
||||
if (changelogFile.exists()) {
|
||||
changelogType = "markdown"
|
||||
changelog = changelogFile
|
||||
}
|
||||
releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release"
|
||||
addGameVersion minecraftVersion
|
||||
addGameVersion "Forge"
|
||||
mainArtifact jar
|
||||
for (artifact in getSecondaryArtifacts()) addArtifact artifact
|
||||
}
|
||||
|
||||
options {
|
||||
javaIntegration = false
|
||||
forgeGradleIntegration = false
|
||||
debug = false
|
||||
}
|
||||
}
|
||||
|
||||
if (curseForgeRelations.size() != 0) {
|
||||
String[] deps = curseForgeRelations.split(";")
|
||||
deps.each { dep ->
|
||||
if (dep.size() == 0) {
|
||||
return
|
||||
}
|
||||
String[] parts = dep.split(":")
|
||||
addCurseForgeRelation(parts[0], parts[1])
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
addCurseForgeRelation("requiredDependency", "gtnhmixins")
|
||||
}
|
||||
tasks.curseforge.dependsOn(build)
|
||||
tasks.publish.dependsOn(tasks.curseforge)
|
||||
}
|
||||
|
||||
def addModrinthDep(scope, type, name) {
|
||||
com.modrinth.minotaur.dependencies.Dependency dep;
|
||||
if (!(scope in ["required", "optional", "incompatible", "embedded"])) {
|
||||
throw new Exception("Invalid modrinth dependency scope: " + scope)
|
||||
}
|
||||
switch (type) {
|
||||
case "project":
|
||||
dep = new ModDependency(name, scope)
|
||||
break
|
||||
case "version":
|
||||
dep = new VersionDependency(name, scope)
|
||||
break
|
||||
default:
|
||||
throw new Exception("Invalid modrinth dependency type: " + type)
|
||||
}
|
||||
project.modrinth.dependencies.add(dep)
|
||||
}
|
||||
|
||||
def addCurseForgeRelation(type, name) {
|
||||
if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) {
|
||||
throw new Exception("Invalid CurseForge relation type: " + type)
|
||||
}
|
||||
CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact
|
||||
CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation()))
|
||||
rel."$type"(name)
|
||||
}
|
||||
|
||||
// Updating
|
||||
task updateBuildScript {
|
||||
doLast {
|
||||
@@ -622,7 +780,7 @@ task updateBuildScript {
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (!project.getGradle().startParameter.isOffline() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (autoUpdateBuildScript.toBoolean()) {
|
||||
performBuildScriptUpdate(projectDir.toString())
|
||||
} else {
|
||||
@@ -631,7 +789,40 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
}
|
||||
|
||||
static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
|
||||
}
|
||||
|
||||
static URL exampleSettingsGradleUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example")
|
||||
}
|
||||
|
||||
static URL exampleGitAttributesUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes")
|
||||
}
|
||||
|
||||
|
||||
boolean verifyGitAttributes() {
|
||||
def gitattributesFile = getFile(".gitattributes")
|
||||
if (!gitattributesFile.exists()) {
|
||||
println("Downloading default .gitattributes")
|
||||
exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } }
|
||||
exec {
|
||||
workingDir '.'
|
||||
commandLine 'git', 'add', '--renormalize', '.'
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean verifySettingsGradle() {
|
||||
def settingsFile = getFile("settings.gradle")
|
||||
if (!settingsFile.exists()) {
|
||||
println("Downloading default settings.gradle")
|
||||
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean performBuildScriptUpdate(String projectDir) {
|
||||
@@ -639,6 +830,10 @@ boolean performBuildScriptUpdate(String 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!")
|
||||
boolean settingsupdated = verifySettingsGradle()
|
||||
settingsupdated = verifyGitAttributes() || settingsupdated
|
||||
if (settingsupdated)
|
||||
throw new GradleException("Settings has been updated, please re-run task.")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -658,7 +853,7 @@ boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||
|
||||
static String getVersionHash(String buildScriptContent) {
|
||||
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
|
||||
if(versionLine != null) {
|
||||
if (versionLine != null) {
|
||||
return versionLine.split(": ").last()
|
||||
}
|
||||
return ""
|
||||
@@ -669,7 +864,103 @@ configure(updateBuildScript) {
|
||||
description = 'Updates the build script to the latest version'
|
||||
}
|
||||
|
||||
// Deobfuscation
|
||||
// Parameter Deobfuscation
|
||||
|
||||
task deobfParams {
|
||||
doLast {
|
||||
|
||||
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion"
|
||||
String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
String paramsCSV = "$mcpDir/params.csv"
|
||||
|
||||
download.run {
|
||||
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
dest mcpZIP
|
||||
overwrite false
|
||||
}
|
||||
|
||||
if (!file(paramsCSV).exists()) {
|
||||
println("Extracting MCP archive ...")
|
||||
unzip(mcpZIP, mcpDir)
|
||||
}
|
||||
|
||||
println("Parsing params.csv ...")
|
||||
Map<String, String> params = new HashMap<>()
|
||||
Files.lines(Paths.get(paramsCSV)).forEach { line ->
|
||||
String[] cells = line.split(",")
|
||||
if (cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
|
||||
params.put(cells[0], cells[1])
|
||||
}
|
||||
}
|
||||
|
||||
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.")
|
||||
}
|
||||
}
|
||||
|
||||
static int replaceParams(File file, Map<String, String> params) {
|
||||
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()
|
||||
}
|
||||
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()
|
||||
}
|
||||
|
||||
configure(deobfParams) {
|
||||
group = 'forgegradle'
|
||||
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
|
||||
}
|
||||
|
||||
// Dependency Deobfuscation
|
||||
|
||||
def deobf(String sourceURL) {
|
||||
try {
|
||||
@@ -678,42 +969,57 @@ def deobf(String sourceURL) {
|
||||
|
||||
//get rid of directories:
|
||||
int lastSlash = fileName.lastIndexOf("/")
|
||||
if(lastSlash > 0) {
|
||||
if (lastSlash > 0) {
|
||||
fileName = fileName.substring(lastSlash + 1)
|
||||
}
|
||||
//get rid of extension:
|
||||
if(fileName.endsWith(".jar")) {
|
||||
if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
}
|
||||
|
||||
String hostName = url.getHost()
|
||||
if(hostName.startsWith("www.")) {
|
||||
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/" + String.valueOf(sourceURL.hashCode()))
|
||||
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 fileName) {
|
||||
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
|
||||
String bon2Dir = cacheDir + "forge_gradle/deobf"
|
||||
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
|
||||
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
|
||||
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
|
||||
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()) {
|
||||
if (file(deobfFile).exists()) {
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
mappingsVer = "snapshot_$id"
|
||||
} else {
|
||||
mappingsVer = "${channel}_$mappingsVersion"
|
||||
}
|
||||
|
||||
download.run {
|
||||
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
|
||||
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
|
||||
@@ -727,14 +1033,48 @@ def deobf(String sourceURL, String fileName) {
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
||||
workingDir bon2Dir
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
||||
}
|
||||
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
def zipMappings(String zipPath, String url, String bon2Dir) {
|
||||
File zipFile = new File(zipPath)
|
||||
if (zipFile.exists()) {
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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("methods.csv"))
|
||||
Files.copy(Paths.get(methodsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.close()
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
@@ -743,6 +1083,21 @@ def checkPropertyExists(String propertyName) {
|
||||
}
|
||||
}
|
||||
|
||||
def propertyDefaultIfUnset(String propertyName, defaultValue) {
|
||||
if (!project.hasProperty(propertyName) || project.property(propertyName) == "") {
|
||||
project.ext.setProperty(propertyName, defaultValue)
|
||||
}
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
}
|
||||
|
||||
def getSecondaryArtifacts() {
|
||||
// Because noPublishedSources from the beginning of the script is somehow not visible here...
|
||||
boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
def secondaryArtifacts = [devJar]
|
||||
if (!noPublishedSources) secondaryArtifacts += [sourcesJar]
|
||||
if (apiPackage) secondaryArtifacts += [apiJar]
|
||||
return secondaryArtifacts
|
||||
}
|
||||
@@ -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.5')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
* @author MineMaarten
|
||||
* www.minemaarten.com
|
||||
*/
|
||||
public interface IHeatExchangerLogic{
|
||||
public interface IHeatExchangerLogic {
|
||||
|
||||
/**
|
||||
* Call this to tick this logic, and make the heat disperse itself.
|
||||
@@ -19,7 +19,7 @@ public interface IHeatExchangerLogic{
|
||||
/**
|
||||
* When called (preferably on tile entity load and neighbor block/tile entity change) this will add all IHeatExchanger neighbor TileEntities as connected heat exchangers.
|
||||
* It will also take care of blocks like Lava.
|
||||
*
|
||||
*
|
||||
* You don't _have_ to call this method, if this heat exchanger is not connected to the outside world (for example the heat of the liquid
|
||||
* plastic in the Plastic Mixer).
|
||||
* @param world
|
||||
@@ -32,7 +32,7 @@ public interface IHeatExchangerLogic{
|
||||
public void initializeAsHull(World world, int x, int y, int z, ForgeDirection... validSides);
|
||||
|
||||
/**
|
||||
* When called, this will connect these two heat exchangers. You should only call this on one of the two heat exchangers.
|
||||
* When called, this will connect these two heat exchangers. You should only call this on one of the two heat exchangers.
|
||||
* @param exchanger
|
||||
*/
|
||||
public void addConnectedExchanger(IHeatExchangerLogic exchanger);
|
||||
@@ -73,5 +73,4 @@ public interface IHeatExchangerLogic{
|
||||
* @param amount
|
||||
*/
|
||||
public void addHeat(double amount);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package pneumaticCraft.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
@@ -20,7 +19,7 @@ import pneumaticCraft.api.item.IInventoryItem;
|
||||
/**
|
||||
* This class can be used to register and access various things to and from the mod.
|
||||
*/
|
||||
public class PneumaticRegistry{
|
||||
public class PneumaticRegistry {
|
||||
/**
|
||||
* This field, which is initialized in PneumaticCraft's preInit, will give you access to various registration and access options.
|
||||
* @deprecated This field isn't going to be removed, but it'll be marked private. use getInstance().
|
||||
@@ -28,15 +27,15 @@ public class PneumaticRegistry{
|
||||
@Deprecated
|
||||
public static IPneumaticCraftInterface instance;
|
||||
|
||||
public static IPneumaticCraftInterface getInstance(){
|
||||
public static IPneumaticCraftInterface getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void init(IPneumaticCraftInterface inter){
|
||||
if(instance == null) instance = inter;//only allow initialization once; by PneumaticCraft
|
||||
public static void init(IPneumaticCraftInterface inter) {
|
||||
if (instance == null) instance = inter; // only allow initialization once; by PneumaticCraft
|
||||
}
|
||||
|
||||
public static interface IPneumaticCraftInterface{
|
||||
public static interface IPneumaticCraftInterface {
|
||||
|
||||
/*
|
||||
* ------------- Pneumatic Helmet --------------
|
||||
@@ -83,10 +82,10 @@ public class PneumaticRegistry{
|
||||
* y level, and drop the deliveredStacks. When there isn't a clear path for the items to fall these 5 blocks the Drone will deliver at a
|
||||
* y level above the specified y that _is_ clear. If no clear blocks can be found (when there are only solid blocks), the Drone will
|
||||
* drop the items very high up in the air instead, and drop them there.
|
||||
*
|
||||
*
|
||||
* When the Drone is tried to be catched by a player (by wrenching it), the drone will only the drop the items that it was delivering (or
|
||||
* none if it dropped those items already). The Drone itself never will be dropped.
|
||||
*
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
@@ -138,7 +137,8 @@ public class PneumaticRegistry{
|
||||
* @return The amount of Security Stations that disallow interaction for the given player.
|
||||
* This method throws an IllegalArgumentException when tried to be called from the client side!
|
||||
*/
|
||||
public int getProtectingSecurityStations(World world, int x, int y, int z, EntityPlayer player, boolean showRangeLines);
|
||||
public int getProtectingSecurityStations(
|
||||
World world, int x, int y, int z, EntityPlayer player, boolean showRangeLines);
|
||||
|
||||
/**
|
||||
* Use this to register ISimpleBlockRenderHandler render id's of full blocks, those of which should be able to be used for the Pneumatic Door Base camouflage.
|
||||
@@ -153,6 +153,5 @@ public class PneumaticRegistry{
|
||||
* @param liquidToPointRatio The amount of liquid (in mB) used to get one XP point. In OpenBlocks this is 20 (mB/point).
|
||||
*/
|
||||
public void registerXPLiquid(Fluid fluid, int liquidToPointRatio);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package pneumaticCraft.api.actuator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IActuator{
|
||||
public interface IActuator {
|
||||
/**
|
||||
* Same as {@link pneumaticCraft.api.universalSensor.ISensorSetting#getSensorPath()}
|
||||
* @return
|
||||
@@ -25,7 +24,7 @@ public interface IActuator{
|
||||
public List<String> getDescription();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param universalActuator
|
||||
*/
|
||||
public void actuate(TileEntity universalActuator);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package pneumaticCraft.api.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockSupplier{
|
||||
public class BlockSupplier {
|
||||
// private static Class blockClass;
|
||||
|
||||
/**
|
||||
* @param blockName
|
||||
* @return
|
||||
*/
|
||||
public static Block getBlock(String blockName){
|
||||
public static Block getBlock(String blockName) {
|
||||
return GameRegistry.findBlock("PneumaticCraft", blockName);
|
||||
/*try {
|
||||
if(blockClass == null) blockClass = Class.forName("pneumaticCraft.common.block.Blockss");
|
||||
@@ -22,56 +22,56 @@ public class BlockSupplier{
|
||||
}
|
||||
|
||||
/*
|
||||
The following is a list of all the block names that can be passed as argument in getBlock(String) to get a PneumaticCraft block.
|
||||
|
||||
|
||||
pressureTube meta = tube type
|
||||
airCompressor
|
||||
airCannon
|
||||
pressureChamberWall meta < 6 ? wall : window
|
||||
pressureChamberValve
|
||||
pressureChamberInterface
|
||||
squidPlant
|
||||
fireFlower
|
||||
creeperPlant
|
||||
slimePlant
|
||||
rainPlant
|
||||
enderPlant
|
||||
lightningPlant
|
||||
adrenalinePlant
|
||||
burstPlant
|
||||
potionPlant
|
||||
repulsionPlant
|
||||
heliumPlant
|
||||
flyingFlower
|
||||
musicPlant
|
||||
propulsionPlant
|
||||
chopperPlant
|
||||
chargingStation
|
||||
elevatorBase
|
||||
elevatorFrame
|
||||
vacuumPump
|
||||
pneumaticDoorBase
|
||||
pneumaticDoor
|
||||
assemblyPlatform
|
||||
assemblyIOUnit
|
||||
assemblyDrill
|
||||
assemblyLaser
|
||||
assemblyController
|
||||
advancedPressureTube meta = tube type (like 'pressureTube')
|
||||
compressedIron
|
||||
uvLightBox
|
||||
etchingAcid
|
||||
securityStation
|
||||
universalSensor
|
||||
pneumaticGenerator
|
||||
electricCompressor
|
||||
pneumaticEngine
|
||||
kineticCompressor
|
||||
aerialInterface
|
||||
electrostaticCompressor
|
||||
aphorismTile
|
||||
omnidirectionalHopper
|
||||
The following is a list of all the block names that can be passed as argument in getBlock(String) to get a PneumaticCraft block.
|
||||
|
||||
*/
|
||||
|
||||
pressureTube meta = tube type
|
||||
airCompressor
|
||||
airCannon
|
||||
pressureChamberWall meta < 6 ? wall : window
|
||||
pressureChamberValve
|
||||
pressureChamberInterface
|
||||
squidPlant
|
||||
fireFlower
|
||||
creeperPlant
|
||||
slimePlant
|
||||
rainPlant
|
||||
enderPlant
|
||||
lightningPlant
|
||||
adrenalinePlant
|
||||
burstPlant
|
||||
potionPlant
|
||||
repulsionPlant
|
||||
heliumPlant
|
||||
flyingFlower
|
||||
musicPlant
|
||||
propulsionPlant
|
||||
chopperPlant
|
||||
chargingStation
|
||||
elevatorBase
|
||||
elevatorFrame
|
||||
vacuumPump
|
||||
pneumaticDoorBase
|
||||
pneumaticDoor
|
||||
assemblyPlatform
|
||||
assemblyIOUnit
|
||||
assemblyDrill
|
||||
assemblyLaser
|
||||
assemblyController
|
||||
advancedPressureTube meta = tube type (like 'pressureTube')
|
||||
compressedIron
|
||||
uvLightBox
|
||||
etchingAcid
|
||||
securityStation
|
||||
universalSensor
|
||||
pneumaticGenerator
|
||||
electricCompressor
|
||||
pneumaticEngine
|
||||
kineticCompressor
|
||||
aerialInterface
|
||||
electrostaticCompressor
|
||||
aphorismTile
|
||||
omnidirectionalHopper
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
* Should be implemented by any block that allows to be rotated by a Pneumatic Wrench. It uses almost the same
|
||||
* rotate method as the Vanilla (Forge) method. However it uses energy to rotate (when rotateBlock() return true).
|
||||
*/
|
||||
public interface IPneumaticWrenchable{
|
||||
public interface IPneumaticWrenchable {
|
||||
|
||||
public boolean rotateBlock(World world, EntityPlayer player, int x, int y, int z, ForgeDirection side);
|
||||
}
|
||||
@@ -4,15 +4,15 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* With this class you can retrieve new instances of the PneumaticCraft's IGuiAnimatedStat implementation. You can use these in Gui's as
|
||||
* With this class you can retrieve new instances of the PneumaticCraft's IGuiAnimatedStat implementation. You can use these in Gui's as
|
||||
* well as anywhere you like. When you use these in Gui's you need to pass a valid GuiScreen instance, if you don't you can just pass
|
||||
* null.
|
||||
*/
|
||||
public class GuiAnimatedStatSupplier{
|
||||
public class GuiAnimatedStatSupplier {
|
||||
private static Class animatedStatClass;
|
||||
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, int backgroundColor){
|
||||
return getAnimatedStat(new Class[]{GuiScreen.class, int.class}, gui, backgroundColor);
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, int backgroundColor) {
|
||||
return getAnimatedStat(new Class[] {GuiScreen.class, int.class}, gui, backgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,8 +22,9 @@ public class GuiAnimatedStatSupplier{
|
||||
* @param backgroundColor
|
||||
* @return
|
||||
*/
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, ItemStack iconStack, int backgroundColor){
|
||||
return getAnimatedStat(new Class[]{GuiScreen.class, int.class, ItemStack.class}, gui, backgroundColor, iconStack);
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, ItemStack iconStack, int backgroundColor) {
|
||||
return getAnimatedStat(
|
||||
new Class[] {GuiScreen.class, int.class, ItemStack.class}, gui, backgroundColor, iconStack);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,15 +34,18 @@ public class GuiAnimatedStatSupplier{
|
||||
* @param backgroundColor
|
||||
* @return
|
||||
*/
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, String iconTexture, int backgroundColor){
|
||||
return getAnimatedStat(new Class[]{GuiScreen.class, int.class, String.class}, gui, backgroundColor, iconTexture);
|
||||
public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, String iconTexture, int backgroundColor) {
|
||||
return getAnimatedStat(
|
||||
new Class[] {GuiScreen.class, int.class, String.class}, gui, backgroundColor, iconTexture);
|
||||
}
|
||||
|
||||
private static IGuiAnimatedStat getAnimatedStat(Class[] constructorClasses, Object... constructorParameters){
|
||||
private static IGuiAnimatedStat getAnimatedStat(Class[] constructorClasses, Object... constructorParameters) {
|
||||
try {
|
||||
if(animatedStatClass == null) animatedStatClass = Class.forName("pneumaticCraft.client.gui.widget.GuiAnimatedStat");
|
||||
return (IGuiAnimatedStat)animatedStatClass.getConstructor(constructorClasses).newInstance(constructorParameters);
|
||||
} catch(Exception e) {
|
||||
if (animatedStatClass == null)
|
||||
animatedStatClass = Class.forName("pneumaticCraft.client.gui.widget.GuiAnimatedStat");
|
||||
return (IGuiAnimatedStat)
|
||||
animatedStatClass.getConstructor(constructorClasses).newInstance(constructorParameters);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to retrieve an GuiAnimatedStat instance from PneumaticCraft.");
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package pneumaticCraft.api.client;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class GuiElementRenderer{
|
||||
public class GuiElementRenderer {
|
||||
private static Method drawGaugeMethod;
|
||||
|
||||
/**
|
||||
@@ -19,13 +18,43 @@ public class GuiElementRenderer{
|
||||
* @param yPos y position of the gauge.
|
||||
* @param zLevel z position of the gauge (Gui#zLevel, -90, for in normal GUI's).
|
||||
*/
|
||||
public static void drawPressureGauge(FontRenderer fontRenderer, float minPressure, float maxPressure, float dangerPressure, float minWorkingPressure, float currentPressure, int xPos, int yPos, float zLevel){
|
||||
public static void drawPressureGauge(
|
||||
FontRenderer fontRenderer,
|
||||
float minPressure,
|
||||
float maxPressure,
|
||||
float dangerPressure,
|
||||
float minWorkingPressure,
|
||||
float currentPressure,
|
||||
int xPos,
|
||||
int yPos,
|
||||
float zLevel) {
|
||||
try {
|
||||
if(drawGaugeMethod == null) {
|
||||
drawGaugeMethod = Class.forName("pneumaticCraft.client.gui.GuiUtils").getMethod("drawPressureGauge", FontRenderer.class, float.class, float.class, float.class, float.class, float.class, int.class, int.class, float.class);
|
||||
if (drawGaugeMethod == null) {
|
||||
drawGaugeMethod = Class.forName("pneumaticCraft.client.gui.GuiUtils")
|
||||
.getMethod(
|
||||
"drawPressureGauge",
|
||||
FontRenderer.class,
|
||||
float.class,
|
||||
float.class,
|
||||
float.class,
|
||||
float.class,
|
||||
float.class,
|
||||
int.class,
|
||||
int.class,
|
||||
float.class);
|
||||
}
|
||||
drawGaugeMethod.invoke(null, fontRenderer, minPressure, maxPressure, dangerPressure, minWorkingPressure, currentPressure, xPos, yPos, zLevel);
|
||||
} catch(Exception e) {
|
||||
drawGaugeMethod.invoke(
|
||||
null,
|
||||
fontRenderer,
|
||||
minPressure,
|
||||
maxPressure,
|
||||
dangerPressure,
|
||||
minWorkingPressure,
|
||||
currentPressure,
|
||||
xPos,
|
||||
yPos,
|
||||
zLevel);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to render a Pressure Gauge from PneumaticCraft.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ import java.util.List;
|
||||
* animated stats can be implemented as well via this interface, and they will interact with the PneumaticCraft GuiAnimatedStats
|
||||
* if you implement it correctly.
|
||||
*/
|
||||
|
||||
public interface IGuiAnimatedStat{
|
||||
public interface IGuiAnimatedStat {
|
||||
|
||||
/**
|
||||
* When you call this method with a set of coordinates representing the button location and dimensions, you'll get
|
||||
@@ -175,5 +174,4 @@ public interface IGuiAnimatedStat{
|
||||
* @return
|
||||
*/
|
||||
public boolean isClicked();
|
||||
|
||||
}
|
||||
+6
-7
@@ -1,23 +1,23 @@
|
||||
package pneumaticCraft.api.client.assemblymachine;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AssemblyRenderOverriding{
|
||||
public static final HashMap<Integer, IAssemblyRenderOverriding> renderOverrides = new HashMap<Integer, IAssemblyRenderOverriding>();
|
||||
public class AssemblyRenderOverriding {
|
||||
public static final HashMap<Integer, IAssemblyRenderOverriding> renderOverrides =
|
||||
new HashMap<Integer, IAssemblyRenderOverriding>();
|
||||
|
||||
public static void addRenderOverride(Block block, IAssemblyRenderOverriding renderOverride){
|
||||
public static void addRenderOverride(Block block, IAssemblyRenderOverriding renderOverride) {
|
||||
renderOverrides.put(Block.getIdFromBlock(block), renderOverride);
|
||||
}
|
||||
|
||||
public static void addRenderOverride(Item item, IAssemblyRenderOverriding renderOverride){
|
||||
public static void addRenderOverride(Item item, IAssemblyRenderOverriding renderOverride) {
|
||||
renderOverrides.put(Item.getIdFromItem(item), renderOverride);
|
||||
}
|
||||
|
||||
public static interface IAssemblyRenderOverriding{
|
||||
public static interface IAssemblyRenderOverriding {
|
||||
/**
|
||||
* This method will be called just before the IO Unit's held stack is being rendered. You can insert GL11 calls here to
|
||||
* rotate the model for example. push and pop matrices are not needed, this is done for you.
|
||||
@@ -50,6 +50,5 @@ public class AssemblyRenderOverriding{
|
||||
* @return
|
||||
*/
|
||||
public float getPlatformClawShift(ItemStack renderedStack);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockTrackEntry{
|
||||
public interface IBlockTrackEntry {
|
||||
/**
|
||||
* This method should return true if the coordinate checked is one that
|
||||
* should be tracked. Most entries will just return true when the blockID is
|
||||
* the one that they track.
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* The world that is examined.
|
||||
* @param x
|
||||
@@ -36,7 +35,7 @@ public interface IBlockTrackEntry{
|
||||
* Mob Spawners, to get the inventory at the client side and the time to the
|
||||
* next spawn respectively.
|
||||
* @param te The TileEntity at the currently checked location.
|
||||
*
|
||||
*
|
||||
* @return true if the Tile Entity should be updated, or false when it
|
||||
* doesn't have to.
|
||||
*/
|
||||
@@ -45,7 +44,7 @@ public interface IBlockTrackEntry{
|
||||
/**
|
||||
* The return of this method defines at how many tracked blocks of this type
|
||||
* the HUD should stop displaying text at the tracked blocks of this type.
|
||||
*
|
||||
*
|
||||
* @return amount of blocks the HUD should stop displaying the block info.
|
||||
*/
|
||||
public int spamThreshold();
|
||||
@@ -56,7 +55,7 @@ public interface IBlockTrackEntry{
|
||||
* the Item class. This method only will be called if
|
||||
* shouldTrackWithThisEntry() returned true and the player hovers over the
|
||||
* coordinate.
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* The world the block is in.
|
||||
* @param x
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Implement this class and register it by adding it to the entityTrackEntries class.
|
||||
* There needs to be a parameterless constructor. For every entity that's applicable for this definition, an instance is created.
|
||||
*/
|
||||
public interface IEntityTrackEntry{
|
||||
public interface IEntityTrackEntry {
|
||||
/**
|
||||
* Return true if you want to add a tooltip for the given entity.
|
||||
* @param entity
|
||||
@@ -39,11 +38,11 @@ public interface IEntityTrackEntry{
|
||||
/**
|
||||
* Just a basic implementation class that can be used if an update and render method isn't needed.
|
||||
*/
|
||||
public static abstract class EntityTrackEntry implements IEntityTrackEntry{
|
||||
public abstract static class EntityTrackEntry implements IEntityTrackEntry {
|
||||
@Override
|
||||
public void update(Entity entity){}
|
||||
public void update(Entity entity) {}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float partialTicks){}
|
||||
public void render(Entity entity, float partialTicks) {}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
/**
|
||||
* Just an interface to give access to GuiSreen#buttonList and GuiScreen#fontRenderer. An instance of this class can
|
||||
* safely be casted to GuiSreen if needed.
|
||||
*/
|
||||
public interface IGuiScreen{
|
||||
public interface IGuiScreen {
|
||||
public List getButtonList();
|
||||
|
||||
public FontRenderer getFontRenderer();
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
Use this interface to specify any hackable block. When it's your block, you can simply implement this interface in the
|
||||
block's class. If you don't have access to the class (vanilla blocks), you can implement this interface in a separate class
|
||||
and register it using PneumaticRegistry.registry.addHackable(blockClass, IHackableBlockClass). With the former way there will be one instance only per type. In the latter, there will
|
||||
be an IHackableBlock instance for every block.
|
||||
*/
|
||||
public interface IHackableBlock{
|
||||
* Use this interface to specify any hackable block. When it's your block, you can simply implement this interface in the
|
||||
* block's class. If you don't have access to the class (vanilla blocks), you can implement this interface in a separate class
|
||||
* and register it using PneumaticRegistry.registry.addHackable(blockClass, IHackableBlockClass). With the former way there will be one instance only per type. In the latter, there will
|
||||
* be an IHackableBlock instance for every block.
|
||||
*/
|
||||
public interface IHackableBlock {
|
||||
/**
|
||||
* Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart.
|
||||
* Null is a valid return: afterHackTick will not be triggered at all in that case.
|
||||
*
|
||||
*
|
||||
* CURRENTLY THIS ISN'T IMPLEMENTED.
|
||||
* @return
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
Returning true will allow the player to hack this block. This can be used to only allow hacking on certain conditions.
|
||||
*/
|
||||
* Returning true will allow the player to hack this block. This can be used to only allow hacking on certain conditions.
|
||||
*/
|
||||
public boolean canHack(IBlockAccess world, int x, int y, int z, EntityPlayer player);
|
||||
|
||||
/**
|
||||
Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added.
|
||||
This method is only called when canHack(World, int, int, int) returned true.
|
||||
The added lines automatically will be tried to get localized.
|
||||
*/
|
||||
* Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added.
|
||||
* This method is only called when canHack(World, int, int, int) returned true.
|
||||
* The added lines automatically will be tried to get localized.
|
||||
*/
|
||||
public void addInfo(World world, int x, int y, int z, List<String> curInfo, EntityPlayer player);
|
||||
|
||||
/**
|
||||
@@ -45,19 +44,19 @@ public interface IHackableBlock{
|
||||
public void addPostHackInfo(World world, int x, int y, int z, List<String> curInfo, EntityPlayer player);
|
||||
|
||||
/**
|
||||
Return the time it takes to hack this block in ticks. For more powerful hacks, a longer required hacking time is adviced.
|
||||
*/
|
||||
* Return the time it takes to hack this block in ticks. For more powerful hacks, a longer required hacking time is adviced.
|
||||
*/
|
||||
public int getHackTime(IBlockAccess world, int x, int y, int z, EntityPlayer player);
|
||||
|
||||
/**
|
||||
When the player hacked the block for getHackTime(World, int, int, int) ticks this will be called on both server and client side.
|
||||
*/
|
||||
* When the player hacked the block for getHackTime(World, int, int, int) ticks this will be called on both server and client side.
|
||||
*/
|
||||
public void onHackFinished(World world, int x, int y, int z, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Called every tick after the hacking finished (on both server and client side). Returning true will keep this going (for mob spawners, to keep them neutralized),
|
||||
* or false to stop ticking (for door/lever hacking).
|
||||
*
|
||||
*
|
||||
* CURRENTLY THIS METHOD WILL STOP GETTING INVOKED AFTER A SERVER RESTART!
|
||||
* @param world
|
||||
* @param x
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
Use this interface to specify any hackable entity. When it's your entity, you can simply implement this interface in the
|
||||
entity's class. If you don't have access to the class (vanilla entities), you can implement this interface in a separate class
|
||||
and register it using PneumaticRegistry.registry.addHackable(entityClass, IHackableEntityClass). In both ways there will be an IHackableEntity instance for every entity.
|
||||
*/
|
||||
public interface IHackableEntity{
|
||||
* Use this interface to specify any hackable entity. When it's your entity, you can simply implement this interface in the
|
||||
* entity's class. If you don't have access to the class (vanilla entities), you can implement this interface in a separate class
|
||||
* and register it using PneumaticRegistry.registry.addHackable(entityClass, IHackableEntityClass). In both ways there will be an IHackableEntity instance for every entity.
|
||||
*/
|
||||
public interface IHackableEntity {
|
||||
|
||||
/**
|
||||
* Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart.
|
||||
@@ -20,15 +19,15 @@ public interface IHackableEntity{
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
Returning true will allow the player to hack this entity. This can be used to only allow hacking on certain conditions.
|
||||
*/
|
||||
* Returning true will allow the player to hack this entity. This can be used to only allow hacking on certain conditions.
|
||||
*/
|
||||
public boolean canHack(Entity entity, EntityPlayer player);
|
||||
|
||||
/**
|
||||
Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added.
|
||||
This method is only called when canHack(Entity) returned true.
|
||||
The added lines automatically will be tried to get localized.
|
||||
*/
|
||||
* Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added.
|
||||
* This method is only called when canHack(Entity) returned true.
|
||||
* The added lines automatically will be tried to get localized.
|
||||
*/
|
||||
public void addInfo(Entity entity, List<String> curInfo, EntityPlayer player);
|
||||
|
||||
/**
|
||||
@@ -42,13 +41,13 @@ public interface IHackableEntity{
|
||||
public void addPostHackInfo(Entity entity, List<String> curInfo, EntityPlayer player);
|
||||
|
||||
/**
|
||||
Return the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is adviced.
|
||||
*/
|
||||
* Return the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is adviced.
|
||||
*/
|
||||
public int getHackTime(Entity entity, EntityPlayer player);
|
||||
|
||||
/**
|
||||
When the player hacked the entity for getHackTime(Entity) ticks this will be called on both client and server side.
|
||||
*/
|
||||
* When the player hacked the entity for getHackTime(Entity) ticks this will be called on both client and server side.
|
||||
*/
|
||||
public void onHackFinished(Entity entity, EntityPlayer player);
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
* The Option Page is the page you see when you press 'F' (by default) with a Pneumatic Helmet equipped. You can register this class
|
||||
* by returning a new instance of this class at {@link IUpgradeRenderHandler#getGuiOptionsPage()}
|
||||
*/
|
||||
public interface IOptionPage{
|
||||
public interface IOptionPage {
|
||||
|
||||
/**
|
||||
* This string is used in the text of the button of this page.
|
||||
|
||||
@@ -6,12 +6,12 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import pneumaticCraft.api.client.IGuiAnimatedStat;
|
||||
|
||||
/**
|
||||
* To add upgrades for in the Pneumatic Helmet implement this interface. You can add members to this class, however these can only
|
||||
* To add upgrades for in the Pneumatic Helmet implement this interface. You can add members to this class, however these can only
|
||||
* be client sided members as this class will be used as singleton. Therefore, only one of these instances exist at the server side
|
||||
* so any member that is used server side will affect every player.
|
||||
*
|
||||
*/
|
||||
public interface IUpgradeRenderHandler{
|
||||
public interface IUpgradeRenderHandler {
|
||||
|
||||
/**
|
||||
* Return here the name of the upgrade. This is displayed in the formatting [upgradeName] + " " + "found"/"not found" on
|
||||
@@ -84,7 +84,7 @@ public interface IUpgradeRenderHandler{
|
||||
|
||||
/**
|
||||
* When you have some options for your upgrade handler you could return a new instance of an IOptionsPage.
|
||||
* When you do so, it will automatically get picked up by the options handler, and it will be added to the
|
||||
* When you do so, it will automatically get picked up by the options handler, and it will be added to the
|
||||
* options GUI when this upgrade returns true when calling isEnabled(). Returning null is valid.
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ package pneumaticCraft.api.client.pneumaticHelmet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RenderHandlerRegistry{
|
||||
public class RenderHandlerRegistry {
|
||||
/**
|
||||
* With this field you can register your render handlers. This field is initialized in the PreInit phase of PneumaticCraft's loading phase.
|
||||
*/
|
||||
|
||||
@@ -2,10 +2,10 @@ package pneumaticCraft.api.drone;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class DroneConstructingEvent extends Event{
|
||||
public class DroneConstructingEvent extends Event {
|
||||
public IDrone drone;
|
||||
|
||||
public DroneConstructingEvent(IDrone drone){
|
||||
public DroneConstructingEvent(IDrone drone) {
|
||||
this.drone = drone;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package pneumaticCraft.api.drone;
|
||||
/**
|
||||
* DON'T IMPLEMENT, just use
|
||||
*/
|
||||
public interface IBlockInteractHandler{
|
||||
public interface IBlockInteractHandler {
|
||||
|
||||
/**
|
||||
* Returns a boolean[6] of all sides. when true, this side is accessible
|
||||
@@ -22,5 +22,4 @@ public interface IBlockInteractHandler{
|
||||
* (It's useless to search any further)
|
||||
*/
|
||||
public void abort();
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.world.ChunkPosition;
|
||||
* This will add a puzzle piece that has only a Area white- and blacklist parameter (similar to a GoTo piece).
|
||||
* It will do the specified behaviour. This can be used to create energy import/export widgets.
|
||||
*/
|
||||
public interface ICustomBlockInteract{
|
||||
public interface ICustomBlockInteract {
|
||||
|
||||
/**
|
||||
* Should return a unique Id, used in NBT saving and localization.
|
||||
@@ -23,12 +23,12 @@ public interface ICustomBlockInteract{
|
||||
|
||||
/**
|
||||
* The actual interaction.
|
||||
*
|
||||
*
|
||||
* For every position in the selected area the drone will visit every block (ordered from closest to furthest). It will call this method with 'simulate = true'. If this method returns true, the drone will navigate to this location, and call this method again with 'simulate = false' It will keep doing this until this method returns false.
|
||||
*
|
||||
*
|
||||
* When interactHandler.useCount() returns true:
|
||||
* In the interface of the puzzle piece users can specify a 'use count' and fill in the maximum count they want to use. When not simulating, you should only import/export up to interactHandler.getRemainingCount(), and you should notify the removed/added count by doing interactHandler.decreaseCount(int count).
|
||||
*
|
||||
*
|
||||
* @param pos current visited location
|
||||
* @param drone
|
||||
* @param interactHandler object you can use to use to get accessible sides and give feedback about counts.
|
||||
|
||||
@@ -13,9 +13,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import pneumaticCraft.api.item.IPressurizable;
|
||||
|
||||
public interface IDrone extends IPressurizable{
|
||||
public interface IDrone extends IPressurizable {
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param upgradeIndex metadata value of the upgrade item
|
||||
* @return amount of inserted upgrades in the drone
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ package pneumaticCraft.api.drone;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface IPathNavigator{
|
||||
public interface IPathNavigator {
|
||||
public boolean moveToXYZ(double x, double y, double z);
|
||||
|
||||
public boolean moveToEntity(Entity entity);
|
||||
|
||||
@@ -2,7 +2,7 @@ package pneumaticCraft.api.drone;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPathfindHandler{
|
||||
public interface IPathfindHandler {
|
||||
/**
|
||||
* When returned true, the drone can pathfind through this block. When false it can't.
|
||||
* @param world
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package pneumaticCraft.api.drone;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Fired when a Drone is trying to get a special coordinate, by accessing a variable with '$' prefix.
|
||||
* These event are posted on the MinecraftForge.EVENT_BUS.
|
||||
*/
|
||||
public abstract class SpecialVariableRetrievalEvent extends Event{
|
||||
public abstract class SpecialVariableRetrievalEvent extends Event {
|
||||
|
||||
/**
|
||||
* The special variable name, with the '$' stripped away.
|
||||
@@ -18,40 +18,39 @@ public abstract class SpecialVariableRetrievalEvent extends Event{
|
||||
/**
|
||||
* The returning coordinate
|
||||
*/
|
||||
|
||||
public SpecialVariableRetrievalEvent(String specialVarName){
|
||||
public SpecialVariableRetrievalEvent(String specialVarName) {
|
||||
|
||||
this.specialVarName = specialVarName;
|
||||
}
|
||||
|
||||
public static abstract class CoordinateVariable extends SpecialVariableRetrievalEvent{
|
||||
public abstract static class CoordinateVariable extends SpecialVariableRetrievalEvent {
|
||||
public ChunkPosition coordinate;
|
||||
|
||||
public CoordinateVariable(String specialVarName){
|
||||
public CoordinateVariable(String specialVarName) {
|
||||
super(specialVarName);
|
||||
}
|
||||
|
||||
public static class Drone extends CoordinateVariable{
|
||||
public static class Drone extends CoordinateVariable {
|
||||
public final IDrone drone;
|
||||
|
||||
public Drone(IDrone drone, String specialVarName){
|
||||
public Drone(IDrone drone, String specialVarName) {
|
||||
super(specialVarName);
|
||||
this.drone = drone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class ItemVariable extends SpecialVariableRetrievalEvent{
|
||||
public abstract static class ItemVariable extends SpecialVariableRetrievalEvent {
|
||||
public ItemStack item;
|
||||
|
||||
public ItemVariable(String specialVarName){
|
||||
public ItemVariable(String specialVarName) {
|
||||
super(specialVarName);
|
||||
}
|
||||
|
||||
public static class Drone extends ItemVariable{
|
||||
public static class Drone extends ItemVariable {
|
||||
public final IDrone drone;
|
||||
|
||||
public Drone(IDrone drone, String specialVarName){
|
||||
public Drone(IDrone drone, String specialVarName) {
|
||||
super(specialVarName);
|
||||
this.drone = drone;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package pneumaticCraft.api.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
@@ -10,7 +9,7 @@ import net.minecraft.item.ItemStack;
|
||||
* This will then will be used in the Pneumatic Helmet's item search.
|
||||
*
|
||||
*/
|
||||
public interface IInventoryItem{
|
||||
public interface IInventoryItem {
|
||||
|
||||
/**
|
||||
* @parm stack: Item that potentially has an inventory.
|
||||
|
||||
@@ -5,10 +5,10 @@ import net.minecraft.item.ItemStack;
|
||||
/**
|
||||
* Any item implementing this interface will be able to (dis)charge in a Charging Station.
|
||||
*/
|
||||
public interface IPressurizable{
|
||||
public interface IPressurizable {
|
||||
/**
|
||||
* This method should return the current pressure of the ItemStack given.
|
||||
*
|
||||
*
|
||||
* @param iStack Stack the pressure is asked from.
|
||||
* @return Pressure in bar.
|
||||
*/
|
||||
@@ -17,7 +17,7 @@ public interface IPressurizable{
|
||||
/**
|
||||
* this method is used to charge or discharge a pneumatic item. when the
|
||||
* value is negative the item should be discharging
|
||||
*
|
||||
*
|
||||
* @param iStack the ItemStack which has to be (dis)charged.
|
||||
* @param amount amount in mL that the item is (dis)charging.
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ public interface IPressurizable{
|
||||
* This method should return the maximum pressure of a pneumatic item. If it
|
||||
* has reached this maximum, it won't explode, but it wouldn't (try to)
|
||||
* charge either.
|
||||
*
|
||||
*
|
||||
* @param iStack the stack from which the maximum pressure is asked.
|
||||
* @return maximum pressure in bar.
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
* For now the only thing you can do with this is make program storages, later more interaction with programming puzzles is planned.
|
||||
* Puzzle pieces will be written onto the implementer's itemstack NBT, using the "progWidget" tag.
|
||||
*/
|
||||
public interface IProgrammable{
|
||||
public interface IProgrammable {
|
||||
|
||||
/**
|
||||
* When returned true, this stack is allowed to be programmed.
|
||||
@@ -30,5 +30,4 @@ public interface IProgrammable{
|
||||
* @return
|
||||
*/
|
||||
public boolean showProgramTooltip();
|
||||
|
||||
}
|
||||
@@ -1,47 +1,47 @@
|
||||
package pneumaticCraft.api.item;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemSupplier{
|
||||
public static Item getItem(String itemName){
|
||||
public class ItemSupplier {
|
||||
public static Item getItem(String itemName) {
|
||||
return GameRegistry.findItem("PneumaticCraft", itemName);
|
||||
}
|
||||
|
||||
/*
|
||||
The following is a list of all the item names that can be passed as argument in getItem(String) to get a PneumaticCraft item.
|
||||
|
||||
GPSTool Currently tracked coordinated is stored in NBT, with 'x', 'y', 'z' being the tag names for the x,y and z positions respectively.
|
||||
machineUpgrade damage value = upgrade type.
|
||||
ingotIronCompressed
|
||||
pressureGauge
|
||||
stoneBase
|
||||
cannonBarrel
|
||||
turbineBlade
|
||||
plasticPlant damage value = plant type. Mapped the same as Vanilla dye in terms of color.
|
||||
plastic damage value = plastic type. Mapped the same as Vanilla dye in terms of color.
|
||||
airCanister implements IPressurizable
|
||||
vortexCannon implements IPressurizable
|
||||
pneumaticCylinder
|
||||
pneumaticHelmet implements IPressurizable
|
||||
manometer implements IPressurizable
|
||||
turbineRotor
|
||||
assemblyProgram damage value = program type.
|
||||
emptyPCB
|
||||
unassembledPCB
|
||||
PCBBlueprint
|
||||
bucketEtchingAcid
|
||||
transistor
|
||||
capacitor
|
||||
printedCircuitBoard
|
||||
failedPCB
|
||||
networkComponent damage value = network component type.
|
||||
stopWorm
|
||||
nukeVirus
|
||||
compressedIronGear
|
||||
pneumaticWrench implements IPressurizable
|
||||
The following is a list of all the item names that can be passed as argument in getItem(String) to get a PneumaticCraft item.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
GPSTool Currently tracked coordinated is stored in NBT, with 'x', 'y', 'z' being the tag names for the x,y and z positions respectively.
|
||||
machineUpgrade damage value = upgrade type.
|
||||
ingotIronCompressed
|
||||
pressureGauge
|
||||
stoneBase
|
||||
cannonBarrel
|
||||
turbineBlade
|
||||
plasticPlant damage value = plant type. Mapped the same as Vanilla dye in terms of color.
|
||||
plastic damage value = plastic type. Mapped the same as Vanilla dye in terms of color.
|
||||
airCanister implements IPressurizable
|
||||
vortexCannon implements IPressurizable
|
||||
pneumaticCylinder
|
||||
pneumaticHelmet implements IPressurizable
|
||||
manometer implements IPressurizable
|
||||
turbineRotor
|
||||
assemblyProgram damage value = program type.
|
||||
emptyPCB
|
||||
unassembledPCB
|
||||
PCBBlueprint
|
||||
bucketEtchingAcid
|
||||
transistor
|
||||
capacitor
|
||||
printedCircuitBoard
|
||||
failedPCB
|
||||
networkComponent damage value = network component type.
|
||||
stopWorm
|
||||
nukeVirus
|
||||
compressedIronGear
|
||||
pneumaticWrench implements IPressurizable
|
||||
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -2,4 +2,3 @@
|
||||
package pneumaticCraft.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -2,12 +2,11 @@ package pneumaticCraft.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AssemblyRecipe{
|
||||
public class AssemblyRecipe {
|
||||
public static List<AssemblyRecipe> drillRecipes = new ArrayList<AssemblyRecipe>();
|
||||
public static List<AssemblyRecipe> laserRecipes = new ArrayList<AssemblyRecipe>();
|
||||
public static List<AssemblyRecipe> drillLaserRecipes = new ArrayList<AssemblyRecipe>();
|
||||
@@ -15,35 +14,34 @@ public class AssemblyRecipe{
|
||||
private final ItemStack input;
|
||||
private final ItemStack output;
|
||||
|
||||
public AssemblyRecipe(ItemStack input, ItemStack output){
|
||||
public AssemblyRecipe(ItemStack input, ItemStack output) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public ItemStack getInput(){
|
||||
public ItemStack getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput(){
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void addDrillRecipe(Object input, Object output){
|
||||
public static void addDrillRecipe(Object input, Object output) {
|
||||
drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output)));
|
||||
}
|
||||
|
||||
public static void addLaserRecipe(Object input, Object output){
|
||||
public static void addLaserRecipe(Object input, Object output) {
|
||||
laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output)));
|
||||
}
|
||||
|
||||
private static ItemStack getStackFromObject(Object object){
|
||||
if(object instanceof Block) {
|
||||
return new ItemStack((Block)object);
|
||||
} else if(object instanceof Item) {
|
||||
return new ItemStack((Item)object);
|
||||
private static ItemStack getStackFromObject(Object object) {
|
||||
if (object instanceof Block) {
|
||||
return new ItemStack((Block) object);
|
||||
} else if (object instanceof Item) {
|
||||
return new ItemStack((Item) object);
|
||||
} else {
|
||||
return (ItemStack)object;
|
||||
return (ItemStack) object;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package pneumaticCraft.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IPressureChamberRecipe{
|
||||
public interface IPressureChamberRecipe {
|
||||
|
||||
/**
|
||||
* Returns the threshold which is minimal to craft the recipe. Negative pressures also work.
|
||||
|
||||
@@ -2,10 +2,9 @@ package pneumaticCraft.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PressureChamberRecipe{
|
||||
public class PressureChamberRecipe {
|
||||
public static List<PressureChamberRecipe> chamberRecipes = new ArrayList<PressureChamberRecipe>();
|
||||
public static List<IPressureChamberRecipe> specialRecipes = new ArrayList<IPressureChamberRecipe>();
|
||||
|
||||
@@ -14,11 +13,10 @@ public class PressureChamberRecipe{
|
||||
public final float pressure;
|
||||
public final boolean outputAsBlock;
|
||||
|
||||
public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock){
|
||||
public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
pressure = pressureRequired;
|
||||
this.outputAsBlock = outputAsBlock;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,14 @@ package pneumaticCraft.api.tileentity;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
public class AirHandlerSupplier{
|
||||
public class AirHandlerSupplier {
|
||||
private static Constructor airHandlerConstructor;
|
||||
|
||||
public static IAirHandler getTierOneAirHandler(int volume){
|
||||
public static IAirHandler getTierOneAirHandler(int volume) {
|
||||
return getAirHandler(5F, 7F, volume);
|
||||
}
|
||||
|
||||
public static IAirHandler getTierTwoAirHandler(int volume){
|
||||
public static IAirHandler getTierTwoAirHandler(int volume) {
|
||||
return getAirHandler(20F, 25F, volume);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class AirHandlerSupplier{
|
||||
* Returns a new instance of an IAirHandler. This handler handles everything pressurized air related: Air dispersion,
|
||||
* blowing up when the pressure gets too high, providing a method for releasing air into the atmosphere...
|
||||
* PROVIDED THAT THE FOLLOWING METHODS ARE FORWARDED TO THIS INSTANCE:
|
||||
* {@link net.minecraft.tileentity.TileEntity#updateEntity()},
|
||||
* {@link net.minecraft.tileentity.TileEntity#updateEntity()},
|
||||
* {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)}
|
||||
* {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)}
|
||||
* {@link net.minecraft.tileentity.TileEntity#validate()}
|
||||
@@ -28,13 +28,16 @@ public class AirHandlerSupplier{
|
||||
* The higher the volume the slower the machine will charge/discharge.
|
||||
* @return
|
||||
*/
|
||||
public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, int volume){
|
||||
public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, int volume) {
|
||||
IAirHandler airHandler = null;
|
||||
try {
|
||||
if(airHandlerConstructor == null) airHandlerConstructor = Class.forName("pneumaticCraft.common.tileentity.TileEntityPneumaticBase").getConstructor(float.class, float.class, int.class);
|
||||
airHandler = (IAirHandler)airHandlerConstructor.newInstance(dangerPressure, criticalPressure, volume);
|
||||
} catch(Exception e) {
|
||||
System.err.println("[PneumaticCraft API] An error has occured whilst trying to get an AirHandler. Here's a stacktrace:");
|
||||
if (airHandlerConstructor == null)
|
||||
airHandlerConstructor = Class.forName("pneumaticCraft.common.tileentity.TileEntityPneumaticBase")
|
||||
.getConstructor(float.class, float.class, int.class);
|
||||
airHandler = (IAirHandler) airHandlerConstructor.newInstance(dangerPressure, criticalPressure, volume);
|
||||
} catch (Exception e) {
|
||||
System.err.println(
|
||||
"[PneumaticCraft API] An error has occured whilst trying to get an AirHandler. Here's a stacktrace:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return airHandler;
|
||||
@@ -44,8 +47,7 @@ public class AirHandlerSupplier{
|
||||
* Use the version with integer parameters
|
||||
*/
|
||||
@Deprecated
|
||||
public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, float maxFlow, float volume){
|
||||
return getAirHandler(dangerPressure, criticalPressure, (int)volume);
|
||||
public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, float maxFlow, float volume) {
|
||||
return getAirHandler(dangerPressure, criticalPressure, (int) volume);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package pneumaticCraft.api.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
/**
|
||||
* A way for you to access about everything you need from a pneumatic machine.
|
||||
* DO NOT IMPLEMENT THIS YOURSELF! Use AirHandlerSupplier to get an instance for your TileEntity, and implement IPneumaticMachine instead.
|
||||
*/
|
||||
|
||||
public interface IAirHandler extends IManoMeasurable{
|
||||
public interface IAirHandler extends IManoMeasurable {
|
||||
|
||||
/**
|
||||
* -----------Needs to be forwarded by the implementing TileEntity's updateEntity() method.
|
||||
@@ -110,5 +107,4 @@ public interface IAirHandler extends IManoMeasurable{
|
||||
* Needs to be forwarded from the implementing _Block_! Forward the Block's "onNeighborChange" method to this handler.
|
||||
*/
|
||||
public void onNeighborChange();
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import pneumaticCraft.api.IHeatExchangerLogic;
|
||||
* @author MineMaarten
|
||||
* www.minemaarten.com
|
||||
*/
|
||||
public interface IHeatExchanger{
|
||||
public interface IHeatExchanger {
|
||||
|
||||
/**
|
||||
* Get an instance of IHeatExchangerLogic from PneumaticRegistry.getInstance().getHeatExchangerLogic() and keep a global reference.
|
||||
@@ -20,5 +20,4 @@ public interface IHeatExchanger{
|
||||
* @return
|
||||
*/
|
||||
public IHeatExchangerLogic getHeatExchangerLogic(ForgeDirection side);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package pneumaticCraft.api.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface IManoMeasurable{
|
||||
public interface IManoMeasurable {
|
||||
/**
|
||||
* This method is invoked by the Manometer when a player right-clicks a TE or Entity with this interface implemented.
|
||||
* @param player that rightclicks the measurable TE, and therefore needs to get the message
|
||||
|
||||
@@ -2,16 +2,16 @@ package pneumaticCraft.api.tileentity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IPneumaticMachine{
|
||||
public interface IPneumaticMachine {
|
||||
|
||||
/**
|
||||
* In your TileEntity class which is implementing this interface you should keep a reference of an IAirHandler.
|
||||
* You can retrieve one by calling {@link AirHandlerSupplier#getAirHandler(net.minecraft.tileentity.TileEntity, float, float, float, float)}.
|
||||
* Do this when your TileEntity is initialized, i.e. xCoord,yCoord,zCoord and worldObj have a value.
|
||||
* Do this when your TileEntity is initialized, i.e. xCoord,yCoord,zCoord and worldObj have a value.
|
||||
* In this method you need to return this reference.
|
||||
*
|
||||
* IMPORTANT: You need to forward the {@link net.minecraft.tileentity.TileEntity#updateEntity()},
|
||||
* {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} ,
|
||||
*
|
||||
* IMPORTANT: You need to forward the {@link net.minecraft.tileentity.TileEntity#updateEntity()},
|
||||
* {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} ,
|
||||
* {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)} and
|
||||
* {@link net.minecraft.tileentity.TileEntity#validate()} (with the implementing TileEntity as additional parameter)
|
||||
* to the IAirHandler.
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityPollSensor implements IPollSensorSetting{
|
||||
public abstract class EntityPollSensor implements IPollSensorSetting {
|
||||
|
||||
@Override
|
||||
public String getSensorPath(){
|
||||
public String getSensorPath() {
|
||||
return "entityTracker";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollFrequency(){
|
||||
public int getPollFrequency() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText){
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x - sensorRange, y - sensorRange, z - sensorRange, x + 1 + sensorRange, y + 1 + sensorRange, z + 1 + sensorRange);
|
||||
public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText) {
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(
|
||||
x - sensorRange,
|
||||
y - sensorRange,
|
||||
z - sensorRange,
|
||||
x + 1 + sensorRange,
|
||||
y + 1 + sensorRange,
|
||||
z + 1 + sensorRange);
|
||||
return getRedstoneValue(world.getEntitiesWithinAABB(getEntityTracked(), aabb), textBoxText);
|
||||
}
|
||||
|
||||
public abstract Class getEntityTracked();
|
||||
|
||||
public abstract int getRedstoneValue(List<Entity> entities, String textBoxText);
|
||||
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.util.Rectangle;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public interface IBlockAndCoordinateEventSensor{
|
||||
public interface IBlockAndCoordinateEventSensor {
|
||||
/**
|
||||
* See {@link ISensorSetting#getSensorPath()}
|
||||
* @return
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.util.Rectangle;
|
||||
|
||||
public interface IBlockAndCoordinatePollSensor{
|
||||
public interface IBlockAndCoordinatePollSensor {
|
||||
/**
|
||||
* See {@link ISensorSetting#getSensorPath()}
|
||||
* @return
|
||||
@@ -46,7 +44,8 @@ public interface IBlockAndCoordinatePollSensor{
|
||||
* @param toolZ
|
||||
* @return
|
||||
*/
|
||||
public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText, int toolX, int toolY, int toolZ);
|
||||
public int getRedstoneValue(
|
||||
World world, int x, int y, int z, int sensorRange, String textBoxText, int toolX, int toolY, int toolZ);
|
||||
|
||||
/**
|
||||
* See {@link IPollSensorSetting#getPollFrequency()}
|
||||
@@ -59,5 +58,4 @@ public interface IBlockAndCoordinatePollSensor{
|
||||
* @param fontRenderer
|
||||
*/
|
||||
public void drawAdditionalInfo(FontRenderer fontRenderer);
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IEventSensorSetting extends ISensorSetting{
|
||||
public interface IEventSensorSetting extends ISensorSetting {
|
||||
|
||||
/**
|
||||
* This method is only invoked when a subscribed event is triggered.
|
||||
|
||||
@@ -2,7 +2,7 @@ package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPollSensorSetting extends ISensorSetting{
|
||||
public interface IPollSensorSetting extends ISensorSetting {
|
||||
|
||||
/**
|
||||
* The value returned here is the interval between every check in ticks (the interval of calling getRedstoneValue()).
|
||||
@@ -23,5 +23,4 @@ public interface IPollSensorSetting extends ISensorSetting{
|
||||
* @return
|
||||
*/
|
||||
public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText);
|
||||
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
import org.lwjgl.util.Rectangle;
|
||||
|
||||
public interface ISensorSetting{
|
||||
public interface ISensorSetting {
|
||||
/**
|
||||
* Should return the button path the player has to follow in which this setting is stored.
|
||||
* For instance, when the sensor should be located in player and is called speed, you should return "entityTracker/player/speed".
|
||||
* "entityTracker" indicates that this sensor needs an Entity Tracker upgrade to run. You can choose from the following upgrades:
|
||||
*
|
||||
*
|
||||
* -entityTracker
|
||||
* -blockTracker
|
||||
* -gpsTool (so you can use a certain coordinate (within range) to measure on)
|
||||
@@ -23,7 +21,7 @@ public interface ISensorSetting{
|
||||
* -coordinateTracker
|
||||
* -range
|
||||
* -security
|
||||
*
|
||||
*
|
||||
* You can allow only sensors to work by more than one upgrade, by seperating the upgrades with a '_'. For example,
|
||||
* "entityTracker_speed" will only let the sensor be chosen when both an Entity Tracker and a Speed Upgrade are inserted.
|
||||
* @return
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
package pneumaticCraft.api.universalSensor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public abstract class PlayerEventSensor implements IEventSensorSetting{
|
||||
public abstract class PlayerEventSensor implements IEventSensorSetting {
|
||||
|
||||
@Override
|
||||
public String getSensorPath(){
|
||||
public String getSensorPath() {
|
||||
return "entityTracker/Player";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText){
|
||||
if(event instanceof PlayerEvent) {
|
||||
EntityPlayer player = ((PlayerEvent)event).entityPlayer;
|
||||
if(Math.abs(player.posX - sensor.xCoord + 0.5D) < range + 0.5D && Math.abs(player.posY - sensor.yCoord + 0.5D) < range + 0.5D && Math.abs(player.posZ - sensor.zCoord + 0.5D) < range + 0.5D) {
|
||||
return emitRedstoneOnEvent((PlayerEvent)event, sensor, range);
|
||||
public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText) {
|
||||
if (event instanceof PlayerEvent) {
|
||||
EntityPlayer player = ((PlayerEvent) event).entityPlayer;
|
||||
if (Math.abs(player.posX - sensor.xCoord + 0.5D) < range + 0.5D
|
||||
&& Math.abs(player.posY - sensor.yCoord + 0.5D) < range + 0.5D
|
||||
&& Math.abs(player.posZ - sensor.zCoord + 0.5D) < range + 0.5D) {
|
||||
return emitRedstoneOnEvent((PlayerEvent) event, sensor, range);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -26,8 +28,7 @@ public abstract class PlayerEventSensor implements IEventSensorSetting{
|
||||
public abstract int emitRedstoneOnEvent(PlayerEvent event, TileEntity sensor, int range);
|
||||
|
||||
@Override
|
||||
public int getRedstonePulseLength(){
|
||||
public int getRedstonePulseLength() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package pneumaticCraft.api.universalSensor;
|
||||
/**
|
||||
* With this class you can register your own sensors.
|
||||
*/
|
||||
public class SensorRegistrator{
|
||||
public class SensorRegistrator {
|
||||
/**
|
||||
* This field will be initialized in the PreInit phase of PneumaticCraft's loading phase.
|
||||
* With this field you can register every Universal Sensor sensor you want. Just pass a new instance
|
||||
@@ -11,7 +11,7 @@ public class SensorRegistrator{
|
||||
*/
|
||||
public static ISensorRegistrator sensorRegistrator;
|
||||
|
||||
public static interface ISensorRegistrator{
|
||||
public static interface ISensorRegistrator {
|
||||
/**
|
||||
* Registry for IPollSensorSetting, EntityPollSensor and IEventSensorSetting, and any other instance of ISensorSetting.
|
||||
* @param sensor
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
|
||||
@@ -50,6 +49,7 @@ import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemStabilityGlyphBlock;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
@@ -57,8 +57,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
* Date: 17/01/14
|
||||
* Time: 19:48
|
||||
*/
|
||||
public class ModBlocks
|
||||
{
|
||||
public class ModBlocks {
|
||||
public static Block bloodStoneBrick;
|
||||
public static Block largeBloodStoneBrick;
|
||||
public static BlockAltar blockAltar;
|
||||
@@ -99,8 +98,7 @@ public class ModBlocks
|
||||
public static Block blockStabilityGlyph;
|
||||
public static Block blockCrucible;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
public static void init() {
|
||||
blockAltar = new BlockAltar();
|
||||
bloodRune = new BloodRune();
|
||||
speedRune = new SpeedRune();
|
||||
@@ -136,17 +134,19 @@ public class ModBlocks
|
||||
blockDemonChest = new BlockDemonChest();
|
||||
blockCrystal = new BlockCrystal();
|
||||
blockMimic = new MimicBlock();
|
||||
|
||||
|
||||
blockLifeEssence = new LifeEssenceBlock();
|
||||
blockEnchantmentGlyph = new BlockEnchantmentGlyph();
|
||||
blockStabilityGlyph = new BlockStabilityGlyph();
|
||||
blockCrucible = new BlockCrucible();
|
||||
}
|
||||
|
||||
public static void registerBlocksInPre()
|
||||
{
|
||||
public static void registerBlocksInPre() {
|
||||
GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar");
|
||||
GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.bloodRune,
|
||||
ItemBloodRuneBlock.class,
|
||||
"AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
|
||||
GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
|
||||
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
|
||||
GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune");
|
||||
@@ -170,10 +170,22 @@ public class ModBlocks
|
||||
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
|
||||
|
||||
GameRegistry.registerBlock(ModBlocks.blockConduit, "blockConduit");
|
||||
GameRegistry.registerBlock(ModBlocks.blockSpellParadigm, ItemSpellParadigmBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.blockSpellParadigm,
|
||||
ItemSpellParadigmBlock.class,
|
||||
"AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.blockSpellEnhancement,
|
||||
ItemSpellEnhancementBlock.class,
|
||||
"AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.blockSpellModifier,
|
||||
ItemSpellModifierBlock.class,
|
||||
"AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.blockSpellEffect,
|
||||
ItemSpellEffectBlock.class,
|
||||
"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
|
||||
|
||||
GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer");
|
||||
GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain");
|
||||
@@ -184,13 +196,12 @@ public class ModBlocks
|
||||
GameRegistry.registerBlock(ModBlocks.blockDemonChest, "blockDemonChest");
|
||||
GameRegistry.registerBlock(ModBlocks.blockCrystal, ItemCrystalBlock.class, "blockCrystal");
|
||||
GameRegistry.registerBlock(ModBlocks.blockMimic, "blockMimic");
|
||||
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
|
||||
GameRegistry.registerBlock(
|
||||
ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
|
||||
GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph");
|
||||
|
||||
|
||||
GameRegistry.registerBlock(ModBlocks.blockCrucible, "blockCrucible");
|
||||
}
|
||||
|
||||
public static void registerBlocksInInit()
|
||||
{
|
||||
}
|
||||
public static void registerBlocksInInit() {}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.items.*;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool;
|
||||
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool;
|
||||
import WayofTime.alchemicalWizardry.common.items.*;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire;
|
||||
@@ -52,6 +49,9 @@ import WayofTime.alchemicalWizardry.common.items.sigil.SigilVoid;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilWater;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
@@ -59,8 +59,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
* Date: 17/01/14
|
||||
* Time: 19:48
|
||||
*/
|
||||
public class ModItems
|
||||
{
|
||||
public class ModItems {
|
||||
public static Item weakBloodOrb;
|
||||
public static Item apprenticeBloodOrb;
|
||||
public static Item magicianBloodOrb;
|
||||
@@ -207,8 +206,7 @@ public class ModItems
|
||||
|
||||
public static Item ritualDismantler;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
public static void init() {
|
||||
weakBloodOrb = new EnergyBattery(5000).setUnlocalizedName("weakBloodOrb");
|
||||
apprenticeBloodOrb = new ApprenticeBloodOrb(25000).setUnlocalizedName("apprenticeBloodOrb");
|
||||
magicianBloodOrb = new MagicianBloodOrb(150000).setUnlocalizedName("magicianBloodOrb");
|
||||
@@ -270,7 +268,8 @@ public class ModItems
|
||||
sigilOfWind = new SigilOfWind().setUnlocalizedName("sigilOfWind");
|
||||
telepositionFocus = new TelepositionFocus(1).setUnlocalizedName("telepositionFocus");
|
||||
enhancedTelepositionFocus = new EnhancedTelepositionFocus().setUnlocalizedName("enhancedTelepositionFocus");
|
||||
reinforcedTelepositionFocus = new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus");
|
||||
reinforcedTelepositionFocus =
|
||||
new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus");
|
||||
demonicTelepositionFocus = new DemonicTelepositionFocus().setUnlocalizedName("demonicTelepositionFocus");
|
||||
imbuedSlate = new AWBaseItems().setUnlocalizedName("imbuedSlate");
|
||||
demonicSlate = new AWBaseItems().setUnlocalizedName("demonicSlate");
|
||||
@@ -292,7 +291,10 @@ public class ModItems
|
||||
energyBazookaThirdTier = new EnergyBazooka(3).setUnlocalizedName("energyBazookaThirdTier");
|
||||
itemBloodLightSigil = new SigilBloodLight().setUnlocalizedName("bloodLightSigil");
|
||||
itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal");
|
||||
bucketLife = new LifeBucket(ModBlocks.blockLifeEssence).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
|
||||
bucketLife = new LifeBucket(ModBlocks.blockLifeEssence)
|
||||
.setUnlocalizedName("bucketLife")
|
||||
.setContainerItem(Items.bucket)
|
||||
.setCreativeTab(CreativeTabs.tabMisc);
|
||||
itemSigilOfEnderSeverance = (new SigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance");
|
||||
baseItems = new ItemComponents().setUnlocalizedName("baseItems");
|
||||
baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems");
|
||||
@@ -343,8 +345,7 @@ public class ModItems
|
||||
ritualDismantler = new ItemRitualDismantler().setUnlocalizedName("ritualDismantler");
|
||||
}
|
||||
|
||||
public static void registerItems()
|
||||
{
|
||||
public static void registerItems() {
|
||||
GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb");
|
||||
GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb");
|
||||
GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb");
|
||||
|
||||
@@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ColourAndCoords
|
||||
{
|
||||
public class ColourAndCoords {
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
@@ -13,8 +12,7 @@ public class ColourAndCoords
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
|
||||
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z)
|
||||
{
|
||||
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) {
|
||||
this.colourRed = red;
|
||||
this.colourGreen = green;
|
||||
this.colourBlue = blue;
|
||||
@@ -25,13 +23,18 @@ public class ColourAndCoords
|
||||
this.zCoord = z;
|
||||
}
|
||||
|
||||
public static ColourAndCoords readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
return new ColourAndCoords(tag.getInteger("colourRed"), tag.getInteger("colourGreen"), tag.getInteger("colourBlue"), tag.getInteger("colourIntensity"), tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
public static ColourAndCoords readFromNBT(NBTTagCompound tag) {
|
||||
return new ColourAndCoords(
|
||||
tag.getInteger("colourRed"),
|
||||
tag.getInteger("colourGreen"),
|
||||
tag.getInteger("colourBlue"),
|
||||
tag.getInteger("colourIntensity"),
|
||||
tag.getInteger("xCoord"),
|
||||
tag.getInteger("yCoord"),
|
||||
tag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("colourRed", colourRed);
|
||||
tag.setInteger("colourGreen", colourGreen);
|
||||
tag.setInteger("colourBlue", colourBlue);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
public interface ILimitingLogic
|
||||
{
|
||||
public int getRoutingLimit();
|
||||
public interface ILimitingLogic {
|
||||
public int getRoutingLimit();
|
||||
}
|
||||
@@ -2,27 +2,22 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public class Int3
|
||||
{
|
||||
public class Int3 {
|
||||
public int xCoord;
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
|
||||
public Int3(int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
public Int3(int xCoord, int yCoord, int zCoord) {
|
||||
this.xCoord = xCoord;
|
||||
this.yCoord = yCoord;
|
||||
this.zCoord = zCoord;
|
||||
}
|
||||
|
||||
public static Int3 readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public static Int3 readFromNBT(NBTTagCompound tag) {
|
||||
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("xCoord", xCoord);
|
||||
tag.setInteger("yCoord", yCoord);
|
||||
tag.setInteger("zCoord", zCoord);
|
||||
@@ -31,14 +26,16 @@ public class Int3
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Int3 ? ((Int3) o).xCoord == this.xCoord && ((Int3) o).yCoord == this.yCoord && ((Int3) o).zCoord == this.zCoord : false;
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Int3
|
||||
? ((Int3) o).xCoord == this.xCoord
|
||||
&& ((Int3) o).yCoord == this.yCoord
|
||||
&& ((Int3) o).zCoord == this.zCoord
|
||||
: false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
return this.xCoord + this.yCoord << 8 + this.zCoord << 16;
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,18 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RoutingFocusLogic
|
||||
{
|
||||
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack)
|
||||
{
|
||||
return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) : false);
|
||||
}
|
||||
|
||||
public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack)
|
||||
{
|
||||
return previous || this.getDefaultMatch(keyStack, checkedStack);
|
||||
}
|
||||
public class RoutingFocusLogic {
|
||||
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) {
|
||||
return (keyStack != null
|
||||
? checkedStack != null
|
||||
&& keyStack.getItem() == checkedStack.getItem()
|
||||
&& (keyStack.getItem().getHasSubtypes()
|
||||
? keyStack.getItemDamage() == checkedStack.getItemDamage()
|
||||
: true)
|
||||
: false);
|
||||
}
|
||||
|
||||
public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) {
|
||||
return previous || this.getDefaultMatch(keyStack, checkedStack);
|
||||
}
|
||||
}
|
||||
@@ -2,63 +2,52 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RoutingFocusParadigm
|
||||
{
|
||||
public List<RoutingFocusLogic> logicList = new LinkedList();
|
||||
|
||||
public List<RoutingFocusPosAndFacing> locationList = new LinkedList();
|
||||
|
||||
public int maximumAmount = 0;
|
||||
|
||||
public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing)
|
||||
{
|
||||
locationList.add(facing);
|
||||
}
|
||||
|
||||
public void addLogic(RoutingFocusLogic logic)
|
||||
{
|
||||
if(logic instanceof ILimitingLogic)
|
||||
{
|
||||
maximumAmount += ((ILimitingLogic)logic).getRoutingLimit();
|
||||
}
|
||||
logicList.add(logic);
|
||||
}
|
||||
|
||||
public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack)
|
||||
{
|
||||
boolean isGood = false;
|
||||
boolean isFirst = true;
|
||||
for(RoutingFocusLogic logic : logicList)
|
||||
{
|
||||
if(isFirst)
|
||||
{
|
||||
isGood = logic.getDefaultMatch(keyStack, checkedStack);
|
||||
isFirst = false;
|
||||
continue;
|
||||
}
|
||||
isGood = logic.doesItemMatch(isGood, keyStack, checkedStack);
|
||||
}
|
||||
|
||||
return isGood;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
logicList.clear();
|
||||
locationList.clear();
|
||||
maximumAmount = 0;
|
||||
}
|
||||
|
||||
public void setMaximumAmount(int amt)
|
||||
{
|
||||
this.maximumAmount = amt;
|
||||
}
|
||||
|
||||
public int getMaximumAmount()
|
||||
{
|
||||
return this.maximumAmount;
|
||||
}
|
||||
public class RoutingFocusParadigm {
|
||||
public List<RoutingFocusLogic> logicList = new LinkedList();
|
||||
|
||||
public List<RoutingFocusPosAndFacing> locationList = new LinkedList();
|
||||
|
||||
public int maximumAmount = 0;
|
||||
|
||||
public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing) {
|
||||
locationList.add(facing);
|
||||
}
|
||||
|
||||
public void addLogic(RoutingFocusLogic logic) {
|
||||
if (logic instanceof ILimitingLogic) {
|
||||
maximumAmount += ((ILimitingLogic) logic).getRoutingLimit();
|
||||
}
|
||||
logicList.add(logic);
|
||||
}
|
||||
|
||||
public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) {
|
||||
boolean isGood = false;
|
||||
boolean isFirst = true;
|
||||
for (RoutingFocusLogic logic : logicList) {
|
||||
if (isFirst) {
|
||||
isGood = logic.getDefaultMatch(keyStack, checkedStack);
|
||||
isFirst = false;
|
||||
continue;
|
||||
}
|
||||
isGood = logic.doesItemMatch(isGood, keyStack, checkedStack);
|
||||
}
|
||||
|
||||
return isGood;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
logicList.clear();
|
||||
locationList.clear();
|
||||
maximumAmount = 0;
|
||||
}
|
||||
|
||||
public void setMaximumAmount(int amt) {
|
||||
this.maximumAmount = amt;
|
||||
}
|
||||
|
||||
public int getMaximumAmount() {
|
||||
return this.maximumAmount;
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,20 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RoutingFocusPosAndFacing
|
||||
{
|
||||
public Int3 location;
|
||||
public ForgeDirection facing;
|
||||
|
||||
public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing)
|
||||
{
|
||||
this.location = location;
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return obj instanceof RoutingFocusPosAndFacing ? facing.equals(((RoutingFocusPosAndFacing)obj).facing) && location.equals(((RoutingFocusPosAndFacing)obj).location) : false;
|
||||
}
|
||||
public class RoutingFocusPosAndFacing {
|
||||
public Int3 location;
|
||||
public ForgeDirection facing;
|
||||
|
||||
public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing) {
|
||||
this.location = location;
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof RoutingFocusPosAndFacing
|
||||
? facing.equals(((RoutingFocusPosAndFacing) obj).facing)
|
||||
&& location.equals(((RoutingFocusPosAndFacing) obj).location)
|
||||
: false;
|
||||
}
|
||||
}
|
||||
@@ -4,42 +4,40 @@ package WayofTime.alchemicalWizardry.api;
|
||||
* Created in Scala by Alex-Hawks
|
||||
* Translated and implemented by Arcaratus
|
||||
*/
|
||||
public class Vector3
|
||||
{
|
||||
public class Vector3 {
|
||||
public int x, y, z;
|
||||
|
||||
public Vector3(int x, int y, int z)
|
||||
{
|
||||
public Vector3(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vector3 add(Vector3 vec1)
|
||||
{
|
||||
public Vector3 add(Vector3 vec1) {
|
||||
return new Vector3(this.x + vec1.x, this.y + vec1.y, this.z + vec1.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return "V3(" + x + "}, " + y + "}," + z + "})";
|
||||
}
|
||||
|
||||
private boolean canEqual(Object object)
|
||||
{
|
||||
private boolean canEqual(Object object) {
|
||||
return object instanceof Vector3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
return object == this || object instanceof Vector3 && canEqual(this) && this.x == ((Vector3) object).x && this.y == ((Vector3) object).y && this.z == ((Vector3) object).z;
|
||||
public boolean equals(Object object) {
|
||||
return object == this
|
||||
|| object instanceof Vector3
|
||||
&& canEqual(this)
|
||||
&& this.x == ((Vector3) object).x
|
||||
&& this.y == ((Vector3) object).y
|
||||
&& this.z == ((Vector3) object).z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
return 48131 * x - 95021 * y + z;
|
||||
}
|
||||
}
|
||||
+17
-34
@@ -1,24 +1,18 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlchemicalPotionCreationHandler
|
||||
{
|
||||
public class AlchemicalPotionCreationHandler {
|
||||
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();
|
||||
|
||||
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration) {
|
||||
registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration));
|
||||
}
|
||||
|
||||
public static int getPotionIDForStack(ItemStack itemStack)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
public static int getPotionIDForStack(ItemStack itemStack) {
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(itemStack)) {
|
||||
return aphc.getPotionID();
|
||||
}
|
||||
}
|
||||
@@ -26,13 +20,10 @@ public class AlchemicalPotionCreationHandler
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getPotionTickDurationForStack(ItemStack itemStack)
|
||||
{
|
||||
public static int getPotionTickDurationForStack(ItemStack itemStack) {
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(itemStack)) {
|
||||
return aphc.getTickDuration();
|
||||
}
|
||||
}
|
||||
@@ -41,14 +32,10 @@ public class AlchemicalPotionCreationHandler
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList)
|
||||
{
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList) {
|
||||
for (ItemStack is : stackList) {
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(is)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -57,16 +44,12 @@ public class AlchemicalPotionCreationHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList)
|
||||
{
|
||||
public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList) {
|
||||
int i = 0;
|
||||
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
for (ItemStack is : stackList) {
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(is)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-22
@@ -3,50 +3,42 @@ package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemyPotionHandlerComponent
|
||||
{
|
||||
public class AlchemyPotionHandlerComponent {
|
||||
private ItemStack itemStack;
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
|
||||
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) {
|
||||
this.itemStack = itemStack;
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
}
|
||||
|
||||
public boolean compareItemStack(ItemStack comparedStack)
|
||||
{
|
||||
if (comparedStack != null && itemStack != null)
|
||||
{
|
||||
if (comparedStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
public boolean compareItemStack(ItemStack comparedStack) {
|
||||
if (comparedStack != null && itemStack != null) {
|
||||
if (comparedStack.getItem() instanceof ItemBlock) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
return comparedStack.getItem().equals(itemStack.getItem())
|
||||
&& comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
} else if (!(itemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
} else if (!(itemStack.getItem() instanceof ItemBlock)) {
|
||||
return comparedStack.getItem().equals(itemStack.getItem())
|
||||
&& comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public int getPotionID()
|
||||
{
|
||||
public int getPotionID() {
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration()
|
||||
{
|
||||
public int getTickDuration() {
|
||||
return this.tickDuration;
|
||||
}
|
||||
}
|
||||
@@ -4,68 +4,63 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class AlchemyPotionHelper
|
||||
{
|
||||
public class AlchemyPotionHelper {
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
private int concentration;
|
||||
private int durationFactor;
|
||||
|
||||
public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor)
|
||||
{
|
||||
public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor) {
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
this.concentration = concentration;
|
||||
this.durationFactor = durationFactor;
|
||||
}
|
||||
|
||||
public void setConcentration(int concentration)
|
||||
{
|
||||
public void setConcentration(int concentration) {
|
||||
this.concentration = concentration;
|
||||
}
|
||||
|
||||
public void setDurationFactor(int durationFactor)
|
||||
{
|
||||
public void setDurationFactor(int durationFactor) {
|
||||
this.durationFactor = durationFactor;
|
||||
}
|
||||
|
||||
public int getPotionID()
|
||||
{
|
||||
public int getPotionID() {
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration()
|
||||
{
|
||||
public int getTickDuration() {
|
||||
return this.tickDuration;
|
||||
}
|
||||
|
||||
public int getConcentration()
|
||||
{
|
||||
public int getConcentration() {
|
||||
return this.concentration;
|
||||
}
|
||||
|
||||
public int getdurationFactor()
|
||||
{
|
||||
public int getdurationFactor() {
|
||||
return this.durationFactor;
|
||||
}
|
||||
|
||||
public PotionEffect getPotionEffect()
|
||||
{
|
||||
if (potionID == Potion.heal.id || potionID == Potion.harm.id)
|
||||
{
|
||||
public PotionEffect getPotionEffect() {
|
||||
if (potionID == Potion.heal.id || potionID == Potion.harm.id) {
|
||||
return (new PotionEffect(potionID, 1, concentration));
|
||||
}
|
||||
|
||||
return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration));
|
||||
return (new PotionEffect(
|
||||
potionID,
|
||||
(int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)),
|
||||
concentration));
|
||||
}
|
||||
|
||||
public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
return new AlchemyPotionHelper(tagCompound.getInteger("potionID"), tagCompound.getInteger("tickDuration"), tagCompound.getInteger("concentration"), tagCompound.getInteger("durationFactor"));
|
||||
public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound) {
|
||||
return new AlchemyPotionHelper(
|
||||
tagCompound.getInteger("potionID"),
|
||||
tagCompound.getInteger("tickDuration"),
|
||||
tagCompound.getInteger("concentration"),
|
||||
tagCompound.getInteger("durationFactor"));
|
||||
}
|
||||
|
||||
public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph)
|
||||
{
|
||||
public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph) {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setInteger("potionID", aph.getPotionID());
|
||||
tagCompound.setInteger("tickDuration", aph.getTickDuration());
|
||||
|
||||
@@ -4,116 +4,96 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class AlchemyRecipe
|
||||
{
|
||||
public class AlchemyRecipe {
|
||||
private ItemStack output;
|
||||
private ItemStack[] recipe;
|
||||
private int bloodOrbLevel;
|
||||
private int amountNeeded;
|
||||
|
||||
public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
|
||||
{
|
||||
public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) {
|
||||
this.output = output;
|
||||
this.recipe = recipe;
|
||||
this.amountNeeded = amountNeeded;
|
||||
this.bloodOrbLevel = bloodOrbLevel;
|
||||
}
|
||||
|
||||
public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel)
|
||||
{
|
||||
if (slottedBloodOrbLevel < bloodOrbLevel)
|
||||
{
|
||||
public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel) {
|
||||
if (slottedBloodOrbLevel < bloodOrbLevel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack[] recipe;
|
||||
|
||||
if (items.length < 5)
|
||||
{
|
||||
if (items.length < 5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.recipe.length != 5)
|
||||
{
|
||||
if (this.recipe.length != 5) {
|
||||
ItemStack[] newRecipe = new ItemStack[5];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i + 1 > this.recipe.length)
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (i + 1 > this.recipe.length) {
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
newRecipe[i] = this.recipe[i];
|
||||
}
|
||||
}
|
||||
|
||||
recipe = newRecipe;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
recipe = this.recipe;
|
||||
}
|
||||
|
||||
boolean[] checkList = new boolean[5];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
checkList[i] = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ItemStack recipeItemStack = recipe[i];
|
||||
|
||||
if (recipeItemStack == null)
|
||||
{
|
||||
if (recipeItemStack == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean test = false;
|
||||
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
if (checkList[j])
|
||||
{
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (checkList[j]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack checkedItemStack = items[j];
|
||||
|
||||
if (checkedItemStack == null)
|
||||
{
|
||||
if (checkedItemStack == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean quickTest = false;
|
||||
|
||||
if (recipeItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (checkedItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (recipeItemStack.getItem() instanceof ItemBlock) {
|
||||
if (checkedItemStack.getItem() instanceof ItemBlock) {
|
||||
quickTest = true;
|
||||
}
|
||||
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
} else if (!(checkedItemStack.getItem() instanceof ItemBlock)) {
|
||||
quickTest = true;
|
||||
}
|
||||
|
||||
if (!quickTest)
|
||||
{
|
||||
if (!quickTest) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem())
|
||||
{
|
||||
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage()
|
||||
|| OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage())
|
||||
&& checkedItemStack.getItem() == recipeItemStack.getItem()) {
|
||||
test = true;
|
||||
checkList[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!test)
|
||||
{
|
||||
if (!test) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -121,23 +101,19 @@ public class AlchemyRecipe
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
public ItemStack getResult() {
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
public int getAmountNeeded()
|
||||
{
|
||||
public int getAmountNeeded() {
|
||||
return this.amountNeeded;
|
||||
}
|
||||
|
||||
public ItemStack[] getRecipe()
|
||||
{
|
||||
public ItemStack[] getRecipe() {
|
||||
return this.recipe;
|
||||
}
|
||||
|
||||
public int getOrbLevel()
|
||||
{
|
||||
public int getOrbLevel() {
|
||||
return this.bloodOrbLevel;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,30 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemyRecipeRegistry
|
||||
{
|
||||
public class AlchemyRecipeRegistry {
|
||||
public static List<AlchemyRecipe> recipes = new ArrayList();
|
||||
|
||||
public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
|
||||
{
|
||||
public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) {
|
||||
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
|
||||
}
|
||||
|
||||
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb)
|
||||
{
|
||||
if (bloodOrb == null)
|
||||
{
|
||||
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) {
|
||||
if (bloodOrb == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb))
|
||||
{
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
||||
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
|
||||
{
|
||||
for (AlchemyRecipe ar : recipes) {
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
||||
return (ar.getResult());
|
||||
}
|
||||
}
|
||||
@@ -40,24 +32,19 @@ public class AlchemyRecipeRegistry
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb)
|
||||
{
|
||||
if (bloodOrb == null)
|
||||
{
|
||||
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) {
|
||||
if (bloodOrb == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb))
|
||||
{
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
||||
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
|
||||
{
|
||||
for (AlchemyRecipe ar : recipes) {
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
||||
return (ar.getAmountNeeded());
|
||||
}
|
||||
}
|
||||
@@ -65,16 +52,12 @@ public class AlchemyRecipeRegistry
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack)
|
||||
{
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) {
|
||||
for (AlchemyRecipe ar : recipes) {
|
||||
ItemStack result = ar.getResult();
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
if (result.isItemEqual(itemStack))
|
||||
{
|
||||
if (result != null) {
|
||||
if (result.isItemEqual(itemStack)) {
|
||||
return ar.getRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IAlchemyGoggles
|
||||
{
|
||||
public interface IAlchemyGoggles {
|
||||
boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player);
|
||||
}
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public interface IReagentContainer
|
||||
{
|
||||
public interface IReagentContainer {
|
||||
ReagentStack getReagent();
|
||||
|
||||
int getReagentStackAmount();
|
||||
|
||||
@@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IReagentHandler
|
||||
{
|
||||
public interface IReagentHandler {
|
||||
int fill(ForgeDirection from, ReagentStack resource, boolean doFill);
|
||||
|
||||
ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain);
|
||||
|
||||
+1
-2
@@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISegmentedReagentHandler extends IReagentHandler
|
||||
{
|
||||
public interface ISegmentedReagentHandler extends IReagentHandler {
|
||||
int getNumberOfTanks();
|
||||
|
||||
int getTanksTunedToReagent(Reagent reagent);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public class Reagent
|
||||
{
|
||||
public class Reagent {
|
||||
public final String name;
|
||||
|
||||
public static final int REAGENT_SIZE = 1000;
|
||||
@@ -11,42 +10,35 @@ public class Reagent
|
||||
private int colourBlue = 0;
|
||||
private int colourIntensity = 255;
|
||||
|
||||
public Reagent(String name)
|
||||
{
|
||||
public Reagent(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setColour(int red, int green, int blue, int intensity)
|
||||
{
|
||||
public void setColour(int red, int green, int blue, int intensity) {
|
||||
this.colourRed = red;
|
||||
this.colourGreen = green;
|
||||
this.colourBlue = blue;
|
||||
this.colourIntensity = intensity;
|
||||
}
|
||||
|
||||
public int getColourRed()
|
||||
{
|
||||
public int getColourRed() {
|
||||
return colourRed;
|
||||
}
|
||||
|
||||
public int getColourGreen()
|
||||
{
|
||||
public int getColourGreen() {
|
||||
return colourGreen;
|
||||
}
|
||||
|
||||
public int getColourBlue()
|
||||
{
|
||||
public int getColourBlue() {
|
||||
return colourBlue;
|
||||
}
|
||||
|
||||
public int getColourIntensity()
|
||||
{
|
||||
public int getColourIntensity() {
|
||||
return colourIntensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Reagent && this == o && name.equals(((Reagent) o).name);
|
||||
}
|
||||
}
|
||||
+28
-56
@@ -2,45 +2,36 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ReagentContainer implements IReagentContainer
|
||||
{
|
||||
public class ReagentContainer implements IReagentContainer {
|
||||
protected ReagentStack reagentStack;
|
||||
protected int capacity;
|
||||
|
||||
public ReagentContainer(int capacity)
|
||||
{
|
||||
public ReagentContainer(int capacity) {
|
||||
this(null, capacity);
|
||||
}
|
||||
|
||||
public ReagentContainer(ReagentStack stack, int capacity)
|
||||
{
|
||||
public ReagentContainer(ReagentStack stack, int capacity) {
|
||||
this.reagentStack = stack;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ReagentContainer(Reagent reagent, int amount, int capacity)
|
||||
{
|
||||
public ReagentContainer(Reagent reagent, int amount, int capacity) {
|
||||
this(new ReagentStack(reagent, amount), capacity);
|
||||
}
|
||||
|
||||
public static ReagentContainer readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
public static ReagentContainer readFromNBT(NBTTagCompound nbt) {
|
||||
ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt);
|
||||
int capacity = nbt.getInteger("capacity");
|
||||
|
||||
if (reagent != null)
|
||||
{
|
||||
if (reagent != null) {
|
||||
return new ReagentContainer(reagent, capacity);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return new ReagentContainer(null, capacity);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (reagentStack != null)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
if (reagentStack != null) {
|
||||
reagentStack.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@@ -50,69 +41,56 @@ public class ReagentContainer implements IReagentContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack getReagent()
|
||||
{
|
||||
public ReagentStack getReagent() {
|
||||
return reagentStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReagentStackAmount()
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
public int getReagentStackAmount() {
|
||||
if (reagentStack == null) {
|
||||
return 0;
|
||||
}
|
||||
return reagentStack.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
public int fill(ReagentStack resource, boolean doFill) {
|
||||
if (resource == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!doFill)
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
if (!doFill) {
|
||||
if (reagentStack == null) {
|
||||
return Math.min(capacity, resource.amount);
|
||||
}
|
||||
|
||||
if (!reagentStack.isReagentEqual(resource))
|
||||
{
|
||||
if (!reagentStack.isReagentEqual(resource)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.min(capacity - reagentStack.amount, resource.amount);
|
||||
}
|
||||
|
||||
if (reagentStack == null)
|
||||
{
|
||||
if (reagentStack == null) {
|
||||
reagentStack = new ReagentStack(resource, Math.min(capacity, resource.amount));
|
||||
|
||||
return reagentStack.amount;
|
||||
}
|
||||
|
||||
if (!reagentStack.isReagentEqual(resource))
|
||||
{
|
||||
if (!reagentStack.isReagentEqual(resource)) {
|
||||
return 0;
|
||||
}
|
||||
int filled = capacity - reagentStack.amount;
|
||||
|
||||
if (resource.amount < filled)
|
||||
{
|
||||
if (resource.amount < filled) {
|
||||
reagentStack.amount += resource.amount;
|
||||
filled = resource.amount;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
reagentStack.amount = capacity;
|
||||
}
|
||||
|
||||
@@ -120,25 +98,20 @@ public class ReagentContainer implements IReagentContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
public ReagentStack drain(int maxDrain, boolean doDrain) {
|
||||
if (reagentStack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int drained = maxDrain;
|
||||
if (reagentStack.amount < drained)
|
||||
{
|
||||
if (reagentStack.amount < drained) {
|
||||
drained = reagentStack.amount;
|
||||
}
|
||||
|
||||
ReagentStack stack = new ReagentStack(reagentStack, drained);
|
||||
if (doDrain)
|
||||
{
|
||||
if (doDrain) {
|
||||
reagentStack.amount -= drained;
|
||||
if (reagentStack.amount <= 0)
|
||||
{
|
||||
if (reagentStack.amount <= 0) {
|
||||
reagentStack = null;
|
||||
}
|
||||
}
|
||||
@@ -146,8 +119,7 @@ public class ReagentContainer implements IReagentContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo getInfo()
|
||||
{
|
||||
public ReagentContainerInfo getInfo() {
|
||||
return new ReagentContainerInfo(this);
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -1,18 +1,15 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public final class ReagentContainerInfo
|
||||
{
|
||||
public final class ReagentContainerInfo {
|
||||
public final ReagentStack reagent;
|
||||
public final int capacity;
|
||||
|
||||
public ReagentContainerInfo(ReagentStack reagent, int capacity)
|
||||
{
|
||||
public ReagentContainerInfo(ReagentStack reagent, int capacity) {
|
||||
this.reagent = reagent;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ReagentContainerInfo(IReagentContainer tank)
|
||||
{
|
||||
public ReagentContainerInfo(IReagentContainer tank) {
|
||||
this.reagent = tank.getReagent();
|
||||
this.capacity = tank.getCapacity();
|
||||
}
|
||||
|
||||
+23
-47
@@ -4,11 +4,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ReagentRegistry
|
||||
{
|
||||
public class ReagentRegistry {
|
||||
public static Map<String, Reagent> reagentList = new HashMap();
|
||||
public static Map<ItemStack, ReagentStack> itemToReagentMap = new HashMap();
|
||||
|
||||
@@ -29,8 +27,7 @@ public class ReagentRegistry
|
||||
public static Reagent reductusReagent;
|
||||
public static Reagent potentiaReagent;
|
||||
|
||||
public static void initReagents()
|
||||
{
|
||||
public static void initReagents() {
|
||||
sanctusReagent = new Reagent("sanctus");
|
||||
incendiumReagent = new Reagent("incendium");
|
||||
aquasalusReagent = new Reagent("aquasalus");
|
||||
@@ -80,10 +77,8 @@ public class ReagentRegistry
|
||||
registerReagent("potentia", potentiaReagent);
|
||||
}
|
||||
|
||||
public static boolean registerReagent(String key, Reagent reagent)
|
||||
{
|
||||
if (reagentList.containsKey(key) || reagent == null)
|
||||
{
|
||||
public static boolean registerReagent(String key, Reagent reagent) {
|
||||
if (reagentList.containsKey(key) || reagent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,25 +87,19 @@ public class ReagentRegistry
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Reagent getReagentForKey(String key)
|
||||
{
|
||||
if (reagentList.containsKey(key))
|
||||
{
|
||||
public static Reagent getReagentForKey(String key) {
|
||||
if (reagentList.containsKey(key)) {
|
||||
return reagentList.get(key);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getKeyForReagent(Reagent reagent)
|
||||
{
|
||||
if (reagentList.containsValue(reagent))
|
||||
{
|
||||
public static String getKeyForReagent(Reagent reagent) {
|
||||
if (reagentList.containsValue(reagent)) {
|
||||
Set<Entry<String, Reagent>> set = reagentList.entrySet();
|
||||
for (Entry<String, Reagent> entry : set)
|
||||
{
|
||||
if (entry.getValue().equals(reagent))
|
||||
{
|
||||
for (Entry<String, Reagent> entry : set) {
|
||||
if (entry.getValue().equals(reagent)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
@@ -119,27 +108,20 @@ public class ReagentRegistry
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack)
|
||||
{
|
||||
public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack) {
|
||||
itemToReagentMap.put(stack, reagentStack);
|
||||
}
|
||||
|
||||
public static ReagentStack getReagentStackForItem(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
public static ReagentStack getReagentStackForItem(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet())
|
||||
{
|
||||
if (entry.getKey() != null && entry.getKey().isItemEqual(stack))
|
||||
{
|
||||
if (entry.getValue() == null)
|
||||
{
|
||||
for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet()) {
|
||||
if (entry.getKey() != null && entry.getKey().isItemEqual(stack)) {
|
||||
if (entry.getValue() == null) {
|
||||
return null;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
@@ -148,22 +130,16 @@ public class ReagentRegistry
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForReagent(Reagent reagent)
|
||||
{
|
||||
if (reagent == null)
|
||||
{
|
||||
public static ItemStack getItemForReagent(Reagent reagent) {
|
||||
if (reagent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet())
|
||||
{
|
||||
if (entry.getValue() != null && entry.getValue().reagent == reagent)
|
||||
{
|
||||
if (entry.getKey() == null)
|
||||
{
|
||||
for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet()) {
|
||||
if (entry.getValue() != null && entry.getValue().reagent == reagent) {
|
||||
if (entry.getKey() == null) {
|
||||
return null;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return entry.getKey().copy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,23 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ReagentStack
|
||||
{
|
||||
public class ReagentStack {
|
||||
public Reagent reagent;
|
||||
public int amount;
|
||||
|
||||
public ReagentStack(Reagent reagent, int amount)
|
||||
{
|
||||
public ReagentStack(Reagent reagent, int amount) {
|
||||
this.reagent = reagent;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public ReagentStack(ReagentStack reagentStack, int amount)
|
||||
{
|
||||
public ReagentStack(ReagentStack reagentStack, int amount) {
|
||||
this(reagentStack.reagent, amount);
|
||||
}
|
||||
|
||||
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) {
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent"));
|
||||
|
||||
if (reagent == null)
|
||||
{
|
||||
if (reagent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,16 +28,14 @@ public class ReagentStack
|
||||
return stack;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent));
|
||||
tag.setInteger("amount", this.amount);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public ReagentStack splitStack(int amount)
|
||||
{
|
||||
public ReagentStack splitStack(int amount) {
|
||||
ReagentStack copyStack = this.copy();
|
||||
int splitAmount = Math.min(amount, this.amount);
|
||||
copyStack.amount = splitAmount;
|
||||
@@ -51,13 +44,11 @@ public class ReagentStack
|
||||
return copyStack;
|
||||
}
|
||||
|
||||
public ReagentStack copy()
|
||||
{
|
||||
public ReagentStack copy() {
|
||||
return new ReagentStack(this.reagent, this.amount);
|
||||
}
|
||||
|
||||
public boolean isReagentEqual(ReagentStack other)
|
||||
{
|
||||
public boolean isReagentEqual(ReagentStack other) {
|
||||
return other != null && this.reagent == other.reagent;
|
||||
}
|
||||
}
|
||||
+12
-23
@@ -1,66 +1,55 @@
|
||||
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileReagentHandler extends TileEntity implements IReagentHandler
|
||||
{
|
||||
public class TileReagentHandler extends TileEntity implements IReagentHandler {
|
||||
protected ReagentContainer tank = new ReagentContainer(4000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
tank.readFromNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
tank.writeToNBT(tag);
|
||||
}
|
||||
|
||||
/* IReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) {
|
||||
return tank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null || !resource.isReagentEqual(tank.getReagent()))
|
||||
{
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isReagentEqual(tank.getReagent())) {
|
||||
return null;
|
||||
}
|
||||
return tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
{
|
||||
return new ReagentContainerInfo[]{tank.getInfo()};
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) {
|
||||
return new ReagentContainerInfo[] {tank.getInfo()};
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
-97
@@ -1,46 +1,38 @@
|
||||
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler
|
||||
{
|
||||
public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler {
|
||||
protected ReagentContainer[] tanks;
|
||||
protected Map<Reagent, Integer> attunedTankMap;
|
||||
|
||||
public TileSegmentedReagentHandler()
|
||||
{
|
||||
public TileSegmentedReagentHandler() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public TileSegmentedReagentHandler(int numberOfTanks)
|
||||
{
|
||||
public TileSegmentedReagentHandler(int numberOfTanks) {
|
||||
this(numberOfTanks, 1000);
|
||||
}
|
||||
|
||||
public TileSegmentedReagentHandler(int numberOfTanks, int tankSize)
|
||||
{
|
||||
public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) {
|
||||
super();
|
||||
|
||||
this.attunedTankMap = new HashMap();
|
||||
this.tanks = new ReagentContainer[numberOfTanks];
|
||||
for (int i = 0; i < numberOfTanks; i++)
|
||||
{
|
||||
for (int i = 0; i < numberOfTanks; i++) {
|
||||
this.tanks[i] = new ReagentContainer(tankSize);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
@@ -48,16 +40,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
for (int i = 0; i < size; i++) {
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
|
||||
NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < attunedTagList.tagCount(); i++)
|
||||
{
|
||||
for (int i = 0; i < attunedTagList.tagCount(); i++) {
|
||||
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
|
||||
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
|
||||
@@ -65,17 +55,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.tanks.length; i++)
|
||||
{
|
||||
for (int i = 0; i < this.tanks.length; i++) {
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if (this.tanks[i] != null)
|
||||
{
|
||||
if (this.tanks[i] != null) {
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
@@ -85,8 +72,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
|
||||
NBTTagList attunedTagList = new NBTTagList();
|
||||
|
||||
for (Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
|
||||
{
|
||||
for (Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet()) {
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
|
||||
savedTag.setInteger("amount", entry.getValue());
|
||||
@@ -98,64 +84,55 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
|
||||
/* ISegmentedReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) {
|
||||
int totalFill = 0;
|
||||
|
||||
boolean useTankLimit = !this.attunedTankMap.isEmpty();
|
||||
|
||||
if (resource != null)
|
||||
{
|
||||
if (resource != null) {
|
||||
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
|
||||
int tanksFilled = 0;
|
||||
|
||||
int maxFill = resource.amount;
|
||||
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--)
|
||||
{
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--) {
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null
|
||||
? false
|
||||
: tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
|
||||
if (doesReagentMatch)
|
||||
{
|
||||
if (doesReagentMatch) {
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) {
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
|
||||
if (tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
if (tanksFilled >= totalTanksFillable) {
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--)
|
||||
{
|
||||
for (int i = this.tanks.length - 1; i >= 0; i--) {
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean isTankEmpty = tanks[i].getReagent() == null;
|
||||
|
||||
if (isTankEmpty)
|
||||
{
|
||||
if (isTankEmpty) {
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) {
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
@@ -164,10 +141,8 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) {
|
||||
if (resource == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -175,18 +150,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
Reagent reagent = resource.reagent;
|
||||
int drained = 0;
|
||||
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
if (drained >= maxDrain)
|
||||
{
|
||||
for (int i = 0; i < tanks.length; i++) {
|
||||
if (drained >= maxDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (resource.isReagentEqual(tanks[i].getReagent()))
|
||||
{
|
||||
if (resource.isReagentEqual(tanks[i].getReagent())) {
|
||||
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
|
||||
if (drainStack != null)
|
||||
{
|
||||
if (drainStack != null) {
|
||||
drained += drainStack.amount;
|
||||
}
|
||||
}
|
||||
@@ -197,13 +168,10 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
for (int i = 0; i < tanks.length; i++) {
|
||||
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack != null) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -212,49 +180,40 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
{
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) {
|
||||
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
|
||||
for (int i = 0; i < this.getNumberOfTanks(); i++)
|
||||
{
|
||||
for (int i = 0; i < this.getNumberOfTanks(); i++) {
|
||||
info[i] = tanks[i].getInfo();
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfTanks()
|
||||
{
|
||||
public int getNumberOfTanks() {
|
||||
return tanks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTanksTunedToReagent(Reagent reagent)
|
||||
{
|
||||
if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
|
||||
{
|
||||
public int getTanksTunedToReagent(Reagent reagent) {
|
||||
if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null) {
|
||||
return this.attunedTankMap.get(reagent);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total)
|
||||
{
|
||||
if (total == 0 && this.attunedTankMap.containsKey(reagent))
|
||||
{
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total) {
|
||||
if (total == 0 && this.attunedTankMap.containsKey(reagent)) {
|
||||
this.attunedTankMap.remove(reagent);
|
||||
return;
|
||||
}
|
||||
@@ -263,21 +222,17 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Reagent, Integer> getAttunedTankMap()
|
||||
{
|
||||
public Map<Reagent, Integer> getAttunedTankMap() {
|
||||
return this.attunedTankMap;
|
||||
}
|
||||
|
||||
public boolean areTanksEmpty()
|
||||
{
|
||||
for (int i = 0; i < this.tanks.length; i++)
|
||||
{
|
||||
if (tanks[i] != null && tanks[i].reagentStack != null)
|
||||
{
|
||||
public boolean areTanksEmpty() {
|
||||
for (int i = 0; i < this.tanks.length; i++) {
|
||||
if (tanks[i] != null && tanks[i].reagentStack != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
-82
@@ -2,16 +2,14 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class AltarRecipe
|
||||
{
|
||||
public class AltarRecipe {
|
||||
public int minTier;
|
||||
public int liquidRequired;
|
||||
public boolean canBeFilled; //Tells the system that the item is an orb
|
||||
public boolean canBeFilled; // Tells the system that the item is an orb
|
||||
public int consumptionRate;
|
||||
public int drainRate;
|
||||
public ItemStack requiredItem;
|
||||
@@ -19,14 +17,27 @@ public class AltarRecipe
|
||||
public boolean useTag;
|
||||
public ArrayList<Object> input = new ArrayList<Object>();
|
||||
|
||||
public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
|
||||
{
|
||||
public AltarRecipe(
|
||||
ItemStack result,
|
||||
ItemStack requiredItem,
|
||||
int minTier,
|
||||
int liquidRequired,
|
||||
int consumptionRate,
|
||||
int drainRate,
|
||||
boolean canBeFilled) {
|
||||
this(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, false);
|
||||
}
|
||||
|
||||
public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled, boolean useTag)
|
||||
{
|
||||
this.result = result;
|
||||
|
||||
public AltarRecipe(
|
||||
ItemStack result,
|
||||
ItemStack requiredItem,
|
||||
int minTier,
|
||||
int liquidRequired,
|
||||
int consumptionRate,
|
||||
int drainRate,
|
||||
boolean canBeFilled,
|
||||
boolean useTag) {
|
||||
this.result = result;
|
||||
this.requiredItem = requiredItem;
|
||||
this.minTier = minTier;
|
||||
this.liquidRequired = liquidRequired;
|
||||
@@ -36,101 +47,83 @@ public class AltarRecipe
|
||||
this.useTag = useTag;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
public ItemStack getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ItemStack getRequiredItem()
|
||||
{
|
||||
public ItemStack getRequiredItem() {
|
||||
return this.requiredItem;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
|
||||
{
|
||||
if (comparedStack == null || this.requiredItem == null)
|
||||
{
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck) {
|
||||
if (comparedStack == null || this.requiredItem == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack) && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
|
||||
}
|
||||
|
||||
public boolean areRequiredTagsEqual(ItemStack comparedStack)
|
||||
{
|
||||
if(requiredItem.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound tag = requiredItem.getTagCompound();
|
||||
if(!comparedStack.hasTagCompound())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NBTTagCompound comparedTag = comparedStack.getTagCompound();
|
||||
|
||||
return this.areTagsEqual(tag, comparedTag);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag)
|
||||
{
|
||||
Set set = tag.func_150296_c();
|
||||
|
||||
for(Object obj : set)
|
||||
{
|
||||
if(obj instanceof String)
|
||||
{
|
||||
String str = (String)obj;
|
||||
|
||||
NBTBase baseTag = comparedTag.getTag(str);
|
||||
|
||||
if(baseTag instanceof NBTTagCompound)
|
||||
{
|
||||
NBTBase comparedBaseTag = comparedTag.getTag(str);
|
||||
if(comparedBaseTag instanceof NBTTagCompound)
|
||||
{
|
||||
if(!this.areTagsEqual(tag, comparedTag))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(baseTag != null && !baseTag.equals(comparedTag.getTag(str)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return tierCheck >= minTier
|
||||
&& this.requiredItem.isItemEqual(comparedStack)
|
||||
&& (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
|
||||
}
|
||||
|
||||
public int getMinTier()
|
||||
{
|
||||
public boolean areRequiredTagsEqual(ItemStack comparedStack) {
|
||||
if (requiredItem.hasTagCompound()) {
|
||||
NBTTagCompound tag = requiredItem.getTagCompound();
|
||||
if (!comparedStack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NBTTagCompound comparedTag = comparedStack.getTagCompound();
|
||||
|
||||
return this.areTagsEqual(tag, comparedTag);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag) {
|
||||
Set set = tag.func_150296_c();
|
||||
|
||||
for (Object obj : set) {
|
||||
if (obj instanceof String) {
|
||||
String str = (String) obj;
|
||||
|
||||
NBTBase baseTag = comparedTag.getTag(str);
|
||||
|
||||
if (baseTag instanceof NBTTagCompound) {
|
||||
NBTBase comparedBaseTag = comparedTag.getTag(str);
|
||||
if (comparedBaseTag instanceof NBTTagCompound) {
|
||||
if (!this.areTagsEqual(tag, comparedTag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (baseTag != null && !baseTag.equals(comparedTag.getTag(str))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getMinTier() {
|
||||
return this.minTier;
|
||||
}
|
||||
|
||||
public int getLiquidRequired()
|
||||
{
|
||||
public int getLiquidRequired() {
|
||||
return this.liquidRequired;
|
||||
}
|
||||
|
||||
public int getConsumptionRate()
|
||||
{
|
||||
public int getConsumptionRate() {
|
||||
return this.consumptionRate;
|
||||
}
|
||||
|
||||
public int getDrainRate()
|
||||
{
|
||||
public int getDrainRate() {
|
||||
return this.drainRate;
|
||||
}
|
||||
|
||||
public boolean getCanBeFilled()
|
||||
{
|
||||
public boolean getCanBeFilled() {
|
||||
return this.canBeFilled;
|
||||
}
|
||||
}
|
||||
+40
-40
@@ -4,44 +4,50 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AltarRecipeRegistry
|
||||
{
|
||||
public class AltarRecipeRegistry {
|
||||
public static List<AltarRecipe> altarRecipes = new LinkedList<>();
|
||||
public static Map<Integer, ItemStack> orbMap = new HashMap<>();
|
||||
|
||||
public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
|
||||
{
|
||||
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
|
||||
}
|
||||
|
||||
public static void registerNBTAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
|
||||
{
|
||||
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true));
|
||||
public static void registerAltarRecipe(
|
||||
ItemStack result,
|
||||
ItemStack requiredItem,
|
||||
int minTier,
|
||||
int liquidRequired,
|
||||
int consumptionRate,
|
||||
int drainRate,
|
||||
boolean canBeFilled) {
|
||||
altarRecipes.add(new AltarRecipe(
|
||||
result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
|
||||
}
|
||||
|
||||
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate)
|
||||
{
|
||||
if(!orbMap.containsKey(minTier))
|
||||
{
|
||||
orbMap.put(minTier, orbStack);
|
||||
}
|
||||
public static void registerNBTAltarRecipe(
|
||||
ItemStack result,
|
||||
ItemStack requiredItem,
|
||||
int minTier,
|
||||
int liquidRequired,
|
||||
int consumptionRate,
|
||||
int drainRate,
|
||||
boolean canBeFilled) {
|
||||
altarRecipes.add(new AltarRecipe(
|
||||
result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true));
|
||||
}
|
||||
|
||||
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) {
|
||||
if (!orbMap.containsKey(minTier)) {
|
||||
orbMap.put(minTier, orbStack);
|
||||
}
|
||||
registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true);
|
||||
}
|
||||
|
||||
public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
if(testItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar) {
|
||||
if (testItem == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (AltarRecipe recipe : altarRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -49,12 +55,9 @@ public class AltarRecipeRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for (AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar) {
|
||||
for (AltarRecipe recipe : altarRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) {
|
||||
return ItemStack.copyItemStack(recipe.getResult());
|
||||
}
|
||||
}
|
||||
@@ -62,12 +65,9 @@ public class AltarRecipeRegistry
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for (AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar) {
|
||||
for (AltarRecipe recipe : altarRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
|
||||
|
||||
public interface IFadedRune
|
||||
{
|
||||
int getAltarTierLimit(int meta);
|
||||
public interface IFadedRune {
|
||||
int getAltarTierLimit(int meta);
|
||||
}
|
||||
@@ -2,29 +2,24 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BindingRecipe
|
||||
{
|
||||
public class BindingRecipe {
|
||||
public ItemStack requiredItem;
|
||||
public ItemStack outputItem;
|
||||
|
||||
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem)
|
||||
{
|
||||
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem) {
|
||||
this.requiredItem = requiredItem;
|
||||
this.outputItem = outputItem;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack testStack)
|
||||
{
|
||||
public boolean doesRequiredItemMatch(ItemStack testStack) {
|
||||
return !(testStack == null || this.requiredItem == null) && this.requiredItem.isItemEqual(testStack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack inputItem)
|
||||
{
|
||||
public ItemStack getResult(ItemStack inputItem) {
|
||||
return this.getResult();
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
public ItemStack getResult() {
|
||||
return this.outputItem;
|
||||
}
|
||||
}
|
||||
+14
-28
@@ -1,25 +1,19 @@
|
||||
package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BindingRegistry
|
||||
{
|
||||
public class BindingRegistry {
|
||||
public static List<BindingRecipe> bindingRecipes = new LinkedList();
|
||||
|
||||
public static void registerRecipe(ItemStack output, ItemStack input)
|
||||
{
|
||||
public static void registerRecipe(ItemStack output, ItemStack input) {
|
||||
bindingRecipes.add(new BindingRecipe(output, input));
|
||||
}
|
||||
|
||||
public static boolean isRequiredItemValid(ItemStack testItem)
|
||||
{
|
||||
for (BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
public static boolean isRequiredItemValid(ItemStack testItem) {
|
||||
for (BindingRecipe recipe : bindingRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -27,12 +21,9 @@ public class BindingRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem)
|
||||
{
|
||||
for (BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem) {
|
||||
for (BindingRecipe recipe : bindingRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem)) {
|
||||
return recipe.getResult(testItem).copy();
|
||||
}
|
||||
}
|
||||
@@ -40,13 +31,10 @@ public class BindingRegistry
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getIndexForItem(ItemStack testItem)
|
||||
{
|
||||
public static int getIndexForItem(ItemStack testItem) {
|
||||
int i = 0;
|
||||
for (BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
for (BindingRecipe recipe : bindingRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem)) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
@@ -55,10 +43,8 @@ public class BindingRegistry
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack getOutputForIndex(int index)
|
||||
{
|
||||
if (bindingRecipes.size() <= index)
|
||||
{
|
||||
public static ItemStack getOutputForIndex(int index) {
|
||||
if (bindingRecipes.size() <= index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -1,36 +1,30 @@
|
||||
package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UnbindingRecipe
|
||||
{
|
||||
public class UnbindingRecipe {
|
||||
public ItemStack requiredItem;
|
||||
public List<ItemStack> outputItem;
|
||||
|
||||
public UnbindingRecipe(ItemStack inputItem, List<ItemStack> outputItem)
|
||||
{
|
||||
public UnbindingRecipe(ItemStack inputItem, List<ItemStack> outputItem) {
|
||||
this.requiredItem = inputItem;
|
||||
this.outputItem = outputItem;
|
||||
}
|
||||
|
||||
public UnbindingRecipe(ItemStack inputItem, ItemStack outputItem)
|
||||
{
|
||||
public UnbindingRecipe(ItemStack inputItem, ItemStack outputItem) {
|
||||
this.requiredItem = inputItem;
|
||||
List<ItemStack> newList = new ArrayList<ItemStack>();
|
||||
newList.add(outputItem);
|
||||
this.outputItem = newList;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack testStack)
|
||||
{
|
||||
public boolean doesRequiredItemMatch(ItemStack testStack) {
|
||||
return !(testStack == null || this.requiredItem == null) && this.requiredItem.isItemEqual(testStack);
|
||||
}
|
||||
|
||||
public List<ItemStack> getResult()
|
||||
{
|
||||
public List<ItemStack> getResult() {
|
||||
return this.outputItem;
|
||||
}
|
||||
}
|
||||
+17
-32
@@ -1,48 +1,38 @@
|
||||
package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UnbindingRegistry
|
||||
{
|
||||
public class UnbindingRegistry {
|
||||
public static List<UnbindingRecipe> unbindingRecipes = new LinkedList<UnbindingRecipe>();
|
||||
|
||||
public static void addAllUnbindingRecipesFromBinding()
|
||||
{
|
||||
for (BindingRecipe bindingRecipe : BindingRegistry.bindingRecipes)
|
||||
{
|
||||
public static void addAllUnbindingRecipesFromBinding() {
|
||||
for (BindingRecipe bindingRecipe : BindingRegistry.bindingRecipes) {
|
||||
List<ItemStack> subList = new ArrayList<ItemStack>();
|
||||
subList.add(bindingRecipe.requiredItem);
|
||||
unbindingRecipes.add(new UnbindingRecipe(bindingRecipe.outputItem, subList));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack input, List<ItemStack> output)
|
||||
{
|
||||
public static void registerRecipe(ItemStack input, List<ItemStack> output) {
|
||||
unbindingRecipes.add(new UnbindingRecipe(input, output));
|
||||
}
|
||||
|
||||
public static void registerRecipe(Item input, List<ItemStack> output)
|
||||
{
|
||||
public static void registerRecipe(Item input, List<ItemStack> output) {
|
||||
unbindingRecipes.add(new UnbindingRecipe(new ItemStack(input), output));
|
||||
}
|
||||
|
||||
public static void registerRecipe(Block input, List<ItemStack> output)
|
||||
{
|
||||
public static void registerRecipe(Block input, List<ItemStack> output) {
|
||||
unbindingRecipes.add(new UnbindingRecipe(new ItemStack(input), output));
|
||||
}
|
||||
|
||||
public static boolean isRequiredItemValid(ItemStack testItem)
|
||||
{
|
||||
for (UnbindingRecipe recipe : unbindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
public static boolean isRequiredItemValid(ItemStack testItem) {
|
||||
for (UnbindingRecipe recipe : unbindingRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -50,13 +40,10 @@ public class UnbindingRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getIndexForItem(ItemStack testItem)
|
||||
{
|
||||
public static int getIndexForItem(ItemStack testItem) {
|
||||
int i = 0;
|
||||
for (UnbindingRecipe recipe : unbindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
for (UnbindingRecipe recipe : unbindingRecipes) {
|
||||
if (recipe.doesRequiredItemMatch(testItem)) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
@@ -65,10 +52,8 @@ public class UnbindingRegistry
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static List<ItemStack> getOutputForIndex(int index)
|
||||
{
|
||||
if (unbindingRecipes.size() <= index)
|
||||
{
|
||||
public static List<ItemStack> getOutputForIndex(int index) {
|
||||
if (unbindingRecipes.size() <= index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.command;
|
||||
|
||||
import java.util.Locale;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
@@ -11,8 +12,6 @@ import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class SubCommandBase implements ISubCommand {
|
||||
|
||||
private ICommand parent;
|
||||
@@ -42,31 +41,37 @@ public abstract class SubCommandBase implements ISubCommand {
|
||||
public void processSubCommand(ICommandSender commandSender, String[] args) {
|
||||
|
||||
if (args.length == 0 && !getSubCommandName().equals("help"))
|
||||
displayErrorString(commandSender, String.format(StatCollector.translateToLocal("commands.format.error"), capitalizeFirstLetter(getSubCommandName()), getArgUsage(commandSender)));
|
||||
displayErrorString(
|
||||
commandSender,
|
||||
String.format(
|
||||
StatCollector.translateToLocal("commands.format.error"),
|
||||
capitalizeFirstLetter(getSubCommandName()),
|
||||
getArgUsage(commandSender)));
|
||||
|
||||
if (isBounded(0, 2, args.length) && args[0].equals("help"))
|
||||
displayHelpString(commandSender, String.format(StatCollector.translateToLocal("commands.format.help"), capitalizeFirstLetter(getSubCommandName()), getHelpText()));
|
||||
displayHelpString(
|
||||
commandSender,
|
||||
String.format(
|
||||
StatCollector.translateToLocal("commands.format.help"),
|
||||
capitalizeFirstLetter(getSubCommandName()),
|
||||
getHelpText()));
|
||||
}
|
||||
|
||||
protected EntityPlayerMP getCommandSenderAsPlayer(ICommandSender commandSender) {
|
||||
if (commandSender instanceof EntityPlayerMP)
|
||||
return (EntityPlayerMP)commandSender;
|
||||
else
|
||||
throw new PlayerNotFoundException(StatCollector.translateToLocal("commands.error.arg.player.missing"));
|
||||
if (commandSender instanceof EntityPlayerMP) return (EntityPlayerMP) commandSender;
|
||||
else throw new PlayerNotFoundException(StatCollector.translateToLocal("commands.error.arg.player.missing"));
|
||||
}
|
||||
|
||||
protected EntityPlayerMP getPlayer(ICommandSender commandSender, String playerName) {
|
||||
EntityPlayerMP entityplayermp = PlayerSelector.matchOnePlayer(commandSender, playerName);
|
||||
|
||||
if (entityplayermp != null)
|
||||
return entityplayermp;
|
||||
if (entityplayermp != null) return entityplayermp;
|
||||
else {
|
||||
entityplayermp = MinecraftServer.getServer().getConfigurationManager().func_152612_a(playerName);
|
||||
entityplayermp =
|
||||
MinecraftServer.getServer().getConfigurationManager().func_152612_a(playerName);
|
||||
|
||||
if (entityplayermp == null)
|
||||
throw new PlayerNotFoundException();
|
||||
else
|
||||
return entityplayermp;
|
||||
if (entityplayermp == null) throw new PlayerNotFoundException();
|
||||
else return entityplayermp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,15 +83,18 @@ public abstract class SubCommandBase implements ISubCommand {
|
||||
return given > low && given < high;
|
||||
}
|
||||
|
||||
protected void displayHelpString(ICommandSender commandSender, String display, Object ... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
protected void displayHelpString(ICommandSender commandSender, String display, Object... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info))
|
||||
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
|
||||
protected void displayErrorString(ICommandSender commandSender, String display, Object ... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
protected void displayErrorString(ICommandSender commandSender, String display, Object... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info))
|
||||
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
}
|
||||
|
||||
protected void displaySuccessString(ICommandSender commandSender, String display, Object ... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE)));
|
||||
protected void displaySuccessString(ICommandSender commandSender, String display, Object... info) {
|
||||
commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info))
|
||||
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE)));
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,11 @@ package WayofTime.alchemicalWizardry.api.compress;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class CompressionHandler
|
||||
{
|
||||
/**
|
||||
* Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not.
|
||||
* @param inv The inventory iterated through
|
||||
* @return The result of the compression
|
||||
*/
|
||||
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
|
||||
public abstract class CompressionHandler {
|
||||
/**
|
||||
* Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not.
|
||||
* @param inv The inventory iterated through
|
||||
* @return The result of the compression
|
||||
*/
|
||||
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -13,55 +12,48 @@ import net.minecraft.world.World;
|
||||
* A registry aimed to help compress items in an inventory into its compressible form.
|
||||
*
|
||||
*/
|
||||
public class CompressionRegistry
|
||||
{
|
||||
public static List<CompressionHandler> compressionRegistry = new ArrayList();
|
||||
public static Map<ItemStack, Integer> thresholdMap = new HashMap();
|
||||
|
||||
public static void registerHandler(CompressionHandler handler)
|
||||
{
|
||||
compressionRegistry.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an item so that it only compresses while above this threshold
|
||||
* @param stack
|
||||
* @param threshold
|
||||
*/
|
||||
public static void registerItemThreshold(ItemStack stack, int threshold)
|
||||
{
|
||||
thresholdMap.put(stack, threshold);
|
||||
}
|
||||
|
||||
public static ItemStack compressInventory(ItemStack[] inv, World world)
|
||||
{
|
||||
for(CompressionHandler handler : compressionRegistry)
|
||||
{
|
||||
ItemStack stack = handler.compressInventory(inv, world);
|
||||
if(stack != null)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getItemThreshold(ItemStack stack)
|
||||
{
|
||||
for(Entry<ItemStack, Integer> entry : thresholdMap.entrySet())
|
||||
{
|
||||
if(areItemStacksEqual(entry.getKey(), stack))
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack)
|
||||
{
|
||||
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
||||
public class CompressionRegistry {
|
||||
public static List<CompressionHandler> compressionRegistry = new ArrayList();
|
||||
public static Map<ItemStack, Integer> thresholdMap = new HashMap();
|
||||
|
||||
public static void registerHandler(CompressionHandler handler) {
|
||||
compressionRegistry.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an item so that it only compresses while above this threshold
|
||||
* @param stack
|
||||
* @param threshold
|
||||
*/
|
||||
public static void registerItemThreshold(ItemStack stack, int threshold) {
|
||||
thresholdMap.put(stack, threshold);
|
||||
}
|
||||
|
||||
public static ItemStack compressInventory(ItemStack[] inv, World world) {
|
||||
for (CompressionHandler handler : compressionRegistry) {
|
||||
ItemStack stack = handler.compressInventory(inv, world);
|
||||
if (stack != null) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getItemThreshold(ItemStack stack) {
|
||||
for (Entry<ItemStack, Integer> entry : thresholdMap.entrySet()) {
|
||||
if (areItemStacksEqual(entry.getKey(), stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
|
||||
return stack.isItemEqual(compressedStack)
|
||||
&& (stack.getTagCompound() == null
|
||||
? compressedStack.getTagCompound() == null
|
||||
: stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
||||
}
|
||||
}
|
||||
@@ -4,35 +4,31 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class AddToNetworkEvent extends Event
|
||||
{
|
||||
public String ownerNetwork;
|
||||
public int addedAmount;
|
||||
public int maximum;
|
||||
|
||||
/**
|
||||
* This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY,
|
||||
* the LP will still be drained but the soul network will not be added to.
|
||||
*
|
||||
* @param ownerNetwork Key used for the soul network
|
||||
* @param addedAmount Amount added
|
||||
* @param maximum Ceiling that the network can add to
|
||||
*/
|
||||
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum)
|
||||
{
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.addedAmount = addedAmount;
|
||||
this.maximum = maximum;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork()
|
||||
{
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getAddedAmount()
|
||||
{
|
||||
return this.addedAmount;
|
||||
}
|
||||
public class AddToNetworkEvent extends Event {
|
||||
public String ownerNetwork;
|
||||
public int addedAmount;
|
||||
public int maximum;
|
||||
|
||||
/**
|
||||
* This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY,
|
||||
* the LP will still be drained but the soul network will not be added to.
|
||||
*
|
||||
* @param ownerNetwork Key used for the soul network
|
||||
* @param addedAmount Amount added
|
||||
* @param maximum Ceiling that the network can add to
|
||||
*/
|
||||
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) {
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.addedAmount = addedAmount;
|
||||
this.maximum = maximum;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork() {
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getAddedAmount() {
|
||||
return this.addedAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ItemBindEvent extends Event
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public String key;
|
||||
public ItemStack itemStack;
|
||||
|
||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack)
|
||||
{
|
||||
super();
|
||||
this.player = player;
|
||||
this.key = key;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
public class ItemBindEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public String key;
|
||||
public ItemStack itemStack;
|
||||
|
||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) {
|
||||
super();
|
||||
this.player = player;
|
||||
this.key = key;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Cancelable
|
||||
public class ItemDrainInContainerEvent extends SoulNetworkEvent
|
||||
{
|
||||
public ItemStack stack;
|
||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.stack = stack;
|
||||
}
|
||||
public class ItemDrainInContainerEvent extends SoulNetworkEvent {
|
||||
public ItemStack stack;
|
||||
|
||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount) {
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.stack = stack;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,27 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
||||
{
|
||||
public final ItemStack itemStack;
|
||||
public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it
|
||||
public float damageAmount; //Amount of damage that would incur if the network could not drain properly
|
||||
|
||||
/**
|
||||
* Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties
|
||||
*
|
||||
* @param player Player using the item
|
||||
* @param ownerNetwork Network that the item is tied to
|
||||
* @param itemStack Item used
|
||||
* @param drainAmount Original drain amount - change to alter cost
|
||||
*/
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount)
|
||||
{
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
this.shouldDamage = false;
|
||||
this.damageAmount = (float)(drainAmount) / 100.0f;
|
||||
}
|
||||
}
|
||||
public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent {
|
||||
public final ItemStack itemStack;
|
||||
public boolean shouldDamage; // If true, will damage regardless of if the network had enough inside it
|
||||
public float damageAmount; // Amount of damage that would incur if the network could not drain properly
|
||||
|
||||
/**
|
||||
* Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties
|
||||
*
|
||||
* @param player Player using the item
|
||||
* @param ownerNetwork Network that the item is tied to
|
||||
* @param itemStack Item used
|
||||
* @param drainAmount Original drain amount - change to alter cost
|
||||
*/
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) {
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
this.shouldDamage = false;
|
||||
this.damageAmount = (float) (drainAmount) / 100.0f;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerAddToNetworkEvent extends AddToNetworkEvent
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public ItemStack itemStack;
|
||||
public PlayerAddToNetworkEvent(EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum)
|
||||
{
|
||||
super(ownerNetwork, addedAmount, maximum);
|
||||
this.player = player;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
public class PlayerAddToNetworkEvent extends AddToNetworkEvent {
|
||||
public final EntityPlayer player;
|
||||
public ItemStack itemStack;
|
||||
|
||||
public PlayerAddToNetworkEvent(
|
||||
EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum) {
|
||||
super(ownerNetwork, addedAmount, maximum);
|
||||
this.player = player;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerDrainNetworkEvent extends SoulNetworkEvent
|
||||
{
|
||||
public final EntityPlayer player; //Player that activated the event
|
||||
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
public class PlayerDrainNetworkEvent extends SoulNetworkEvent {
|
||||
public final EntityPlayer player; // Player that activated the event
|
||||
|
||||
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) {
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,27 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Cancelable
|
||||
public class RitualActivatedEvent extends RitualEvent
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack crystalStack;
|
||||
public int crystalTier;
|
||||
|
||||
public RitualActivatedEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, EntityPlayer player, ItemStack activationCrystal, int crystalTier)
|
||||
{
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
|
||||
this.player = player;
|
||||
this.crystalStack = activationCrystal;
|
||||
this.crystalTier = crystalTier;
|
||||
}
|
||||
public class RitualActivatedEvent extends RitualEvent {
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack crystalStack;
|
||||
public int crystalTier;
|
||||
|
||||
public RitualActivatedEvent(
|
||||
IMasterRitualStone mrs,
|
||||
String ownerKey,
|
||||
String ritualKey,
|
||||
EntityPlayer player,
|
||||
ItemStack activationCrystal,
|
||||
int crystalTier) {
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
|
||||
this.player = player;
|
||||
this.crystalStack = activationCrystal;
|
||||
this.crystalTier = crystalTier;
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,14 @@ package WayofTime.alchemicalWizardry.api.event;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class RitualEvent extends Event
|
||||
{
|
||||
public final IMasterRitualStone mrs;
|
||||
public String ownerKey;
|
||||
public final String ritualKey;
|
||||
|
||||
public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey)
|
||||
{
|
||||
this.mrs = mrs;
|
||||
this.ownerKey = ownerKey;
|
||||
this.ritualKey = ritualKey;
|
||||
}
|
||||
public class RitualEvent extends Event {
|
||||
public final IMasterRitualStone mrs;
|
||||
public String ownerKey;
|
||||
public final String ritualKey;
|
||||
|
||||
public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) {
|
||||
this.mrs = mrs;
|
||||
this.ownerKey = ownerKey;
|
||||
this.ritualKey = ritualKey;
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,9 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class RitualRunEvent extends RitualEvent
|
||||
{
|
||||
|
||||
|
||||
public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey)
|
||||
{
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
}
|
||||
public class RitualRunEvent extends RitualEvent {
|
||||
|
||||
public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) {
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,12 @@ package WayofTime.alchemicalWizardry.api.event;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod;
|
||||
|
||||
public class RitualStopEvent extends RitualEvent
|
||||
{
|
||||
public final RitualBreakMethod method;
|
||||
public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method)
|
||||
{
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
|
||||
this.method = method;
|
||||
}
|
||||
public class RitualStopEvent extends RitualEvent {
|
||||
public final RitualBreakMethod method;
|
||||
|
||||
public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method) {
|
||||
super(mrs, ownerKey, ritualKey);
|
||||
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@Cancelable
|
||||
public class SacrificeKnifeUsedEvent extends Event
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public boolean shouldDrainHealth;
|
||||
public boolean shouldFillAltar;
|
||||
public final int healthDrained;
|
||||
|
||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp)
|
||||
{
|
||||
this.player = player;
|
||||
this.shouldDrainHealth = shouldDrainHealth;
|
||||
this.shouldFillAltar = shouldFillAltar;
|
||||
this.healthDrained = hp;
|
||||
}
|
||||
public class SacrificeKnifeUsedEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public boolean shouldDrainHealth;
|
||||
public boolean shouldFillAltar;
|
||||
public final int healthDrained;
|
||||
|
||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp) {
|
||||
this.player = player;
|
||||
this.shouldDrainHealth = shouldDrainHealth;
|
||||
this.shouldFillAltar = shouldFillAltar;
|
||||
this.healthDrained = hp;
|
||||
}
|
||||
}
|
||||
@@ -2,25 +2,21 @@ package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class SoulNetworkEvent extends Event
|
||||
{
|
||||
public String ownerNetwork;
|
||||
public int drainAmount;
|
||||
|
||||
public SoulNetworkEvent(String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.drainAmount = drainAmount;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork()
|
||||
{
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getDrainAmount()
|
||||
{
|
||||
return this.drainAmount;
|
||||
}
|
||||
public class SoulNetworkEvent extends Event {
|
||||
public String ownerNetwork;
|
||||
public int drainAmount;
|
||||
|
||||
public SoulNetworkEvent(String ownerNetwork, int drainAmount) {
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.drainAmount = drainAmount;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork() {
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getDrainAmount() {
|
||||
return this.drainAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,56 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/** Fired when a teleposer attempts to transpose two blocks. Use this to perform special cleanup or compensation,
|
||||
or cancel it entirely to prevent the transposition. */
|
||||
* or cancel it entirely to prevent the transposition. */
|
||||
@Cancelable
|
||||
public class TeleposeEvent extends Event {
|
||||
|
||||
public final World initialWorld;
|
||||
public final int initialX;
|
||||
public final int initialY;
|
||||
public final int initialZ;
|
||||
|
||||
public final Block initialBlock;
|
||||
public final int initialMetadata;
|
||||
|
||||
public final World finalWorld;
|
||||
public final int finalX;
|
||||
public final int finalY;
|
||||
public final int finalZ;
|
||||
|
||||
public final Block finalBlock;
|
||||
public final int finalMetadata;
|
||||
|
||||
public TeleposeEvent(World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) {
|
||||
initialWorld = wi;
|
||||
initialX = xi;
|
||||
initialY = yi;
|
||||
initialZ = zi;
|
||||
|
||||
initialBlock = bi;
|
||||
initialMetadata = mi;
|
||||
|
||||
finalWorld = wf;
|
||||
finalX = xf;
|
||||
finalY = yf;
|
||||
finalZ = zf;
|
||||
|
||||
finalBlock = bf;
|
||||
finalMetadata = mf;
|
||||
}
|
||||
|
||||
public TileEntity getInitialTile() {
|
||||
return initialWorld.getTileEntity(initialX, initialY, initialZ);
|
||||
}
|
||||
|
||||
public TileEntity getFinalTile() {
|
||||
return finalWorld.getTileEntity(finalX, finalY, finalZ);
|
||||
}
|
||||
|
||||
public final World initialWorld;
|
||||
public final int initialX;
|
||||
public final int initialY;
|
||||
public final int initialZ;
|
||||
|
||||
public final Block initialBlock;
|
||||
public final int initialMetadata;
|
||||
|
||||
public final World finalWorld;
|
||||
public final int finalX;
|
||||
public final int finalY;
|
||||
public final int finalZ;
|
||||
|
||||
public final Block finalBlock;
|
||||
public final int finalMetadata;
|
||||
|
||||
public TeleposeEvent(
|
||||
World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) {
|
||||
initialWorld = wi;
|
||||
initialX = xi;
|
||||
initialY = yi;
|
||||
initialZ = zi;
|
||||
|
||||
initialBlock = bi;
|
||||
initialMetadata = mi;
|
||||
|
||||
finalWorld = wf;
|
||||
finalX = xf;
|
||||
finalY = yf;
|
||||
finalZ = zf;
|
||||
|
||||
finalBlock = bf;
|
||||
finalMetadata = mf;
|
||||
}
|
||||
|
||||
public TileEntity getInitialTile() {
|
||||
return initialWorld.getTileEntity(initialX, initialY, initialZ);
|
||||
}
|
||||
|
||||
public TileEntity getFinalTile() {
|
||||
return finalWorld.getTileEntity(finalX, finalY, finalZ);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
@@ -20,41 +11,59 @@ import amerifrance.guideapi.api.base.Book;
|
||||
import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
{
|
||||
public IRecipe recipe;
|
||||
|
||||
public OrbRecipeRenderer(IRecipe recipe)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry,
|
||||
int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase,
|
||||
FontRenderer fontRenderer) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png"));
|
||||
public class OrbRecipeRenderer implements IRecipeRenderer {
|
||||
public IRecipe recipe;
|
||||
|
||||
public OrbRecipeRenderer(IRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(
|
||||
Book book,
|
||||
CategoryAbstract category,
|
||||
EntryAbstract entry,
|
||||
int guiLeft,
|
||||
int guiTop,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
GuiBase guiBase,
|
||||
FontRenderer fontRenderer) {
|
||||
Minecraft.getMinecraft()
|
||||
.getTextureManager()
|
||||
.bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 105, 65);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.shapedOrb"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
if(recipe instanceof ShapelessBloodOrbRecipe)
|
||||
{
|
||||
ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
StatCollector.translateToLocal("text.recipe.shapedOrb"),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 12,
|
||||
0);
|
||||
if (recipe instanceof ShapelessBloodOrbRecipe) {
|
||||
ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
|
||||
int width = 3;
|
||||
int height = 3;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
if(list.size() - 1 < y * width + x)
|
||||
{
|
||||
continue;
|
||||
if (list.size() - 1 < y * width + x) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
|
||||
|
||||
Object component = list.get(y * width + x);
|
||||
if (component != null) {
|
||||
if (component instanceof ItemStack) {
|
||||
@@ -65,7 +74,8 @@ public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
guiBase.renderToolTip(
|
||||
APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
@@ -83,8 +93,7 @@ public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
guiBase.renderToolTip(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ShapedBloodOrbRecipe shapedBloodOrbRecipe = (ShapedBloodOrbRecipe) recipe;
|
||||
int width = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 4);
|
||||
int height = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 5);
|
||||
@@ -102,7 +111,8 @@ public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
guiBase.renderToolTip(
|
||||
APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
@@ -121,15 +131,20 @@ public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
guiBase.renderToolTip(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Book book, CategoryAbstract category,
|
||||
EntryAbstract entry, int guiLeft, int guiTop, int mouseX,
|
||||
int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void drawExtras(
|
||||
Book book,
|
||||
CategoryAbstract category,
|
||||
EntryAbstract entry,
|
||||
int guiLeft,
|
||||
int guiTop,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
GuiBase guiBase,
|
||||
FontRenderer fontRenderer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
|
||||
import amerifrance.guideapi.api.abstraction.EntryAbstract;
|
||||
@@ -17,6 +9,13 @@ import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class PageAltarRecipe extends PageBase {
|
||||
|
||||
@@ -34,15 +33,31 @@ public class PageAltarRecipe extends PageBase {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer) {
|
||||
public void draw(
|
||||
Book book,
|
||||
CategoryAbstract category,
|
||||
EntryAbstract entry,
|
||||
int guiLeft,
|
||||
int guiTop,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
GuiBase guiBase,
|
||||
FontRenderer fontRenderer) {
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png"));
|
||||
Minecraft.getMinecraft()
|
||||
.getTextureManager()
|
||||
.bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.altar"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
StatCollector.translateToLocal("text.recipe.altar"),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 12,
|
||||
0);
|
||||
|
||||
int inputX = (1 + 1) * 20 + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; //1 * 20
|
||||
int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; // 1 * 20
|
||||
GuiHelper.drawItemStack(input, inputX, inputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15)) {
|
||||
guiBase.renderToolTip(input, mouseX, mouseY);
|
||||
@@ -59,11 +74,38 @@ public class PageAltarRecipe extends PageBase {
|
||||
}
|
||||
|
||||
if (output.getItem() == Item.getItemFromBlock(Blocks.fire)) {
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.furnace.error"), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0xED073D);
|
||||
guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, "LP: " + String.valueOf(bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
StatCollector.translateToLocal("text.furnace.error"),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 4 * guiBase.ySize / 6,
|
||||
0xED073D);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 4 * guiBase.ySize / 6 + 15,
|
||||
0);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
"LP: " + String.valueOf(bloodRequired),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 4 * guiBase.ySize / 6 + 30,
|
||||
0);
|
||||
}
|
||||
guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.bloodRequired"), String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 4 * guiBase.ySize / 6,
|
||||
0);
|
||||
guiBase.drawCenteredString(
|
||||
fontRenderer,
|
||||
String.format(
|
||||
StatCollector.translateToLocal("text.recipe.altar.bloodRequired"),
|
||||
String.valueOf(bloodRequired)),
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 4 * guiBase.ySize / 6 + 15,
|
||||
0);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 798 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user