diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..4ffbd90
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,22 @@
+# This is the universal Text Editor Configuration
+# for all GTNewHorizons projects
+# See: https://editorconfig.org/
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{bat,ini}]
+end_of_line = crlf
+
+[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
+indent_size = 2
+
+[*.lang]
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fd2792b
--- /dev/null
+++ b/.gitattributes
@@ -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
diff --git a/.github/scripts/update_version b/.github/scripts/update_version
new file mode 100644
index 0000000..3e5f752
--- /dev/null
+++ b/.github/scripts/update_version
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+if ! git diff --name-only HEAD HEAD~1 | grep -qF 'build.gradle'; then
+ new_version="$(date +%s)"
+ sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle
+ git add build.gradle
+ git commit -m "[ci skip] update build script version to $new_version"
+ git push
+ printf 'Updated buildscript version to %s\n' "$new_version"
+else
+ printf 'Ignored buildscript version update: no changes detected\n'
+fi
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000..3ee2f68
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,13 @@
+
+name: Build and test
+
+on:
+ pull_request:
+ branches: [ master, main ]
+ push:
+ branches: [ master, main ]
+
+jobs:
+ build-and-test:
+ uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
+ secrets: inherit
diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml
new file mode 100644
index 0000000..e4c0be6
--- /dev/null
+++ b/.github/workflows/release-tags.yml
@@ -0,0 +1,14 @@
+
+name: Release tagged build
+
+on:
+ push:
+ tags: [ '*' ]
+
+permissions:
+ contents: write
+
+jobs:
+ release-tags:
+ uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
+ secrets: inherit
diff --git a/.gitignore b/.gitignore
index 7e1d585..34ac734 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,32 @@
-# These are some examples of commonly ignored file patterns.
-# You should customize this list as applicable to your project.
-# Learn more about .gitignore:
-# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
-
-# eclipse
-bin
-*.launch
+.gradle
.settings
-.metadata
+/.idea/
+/.vscode/
+/run/
+/build/
+/eclipse/
.classpath
.project
-
-# gradle
-build
-.gradle
-
-# other
-eclipse
-run
+/bin/
+/config/
+/crash-reports/
+/logs/
+options.txt
+/saves/
+usernamecache.json
+banned-ips.json
+banned-players.json
+eula.txt
+ops.json
+server.properties
+servers.dat
+usercache.json
+whitelist.json
+/out/
+*.iml
+*.ipr
+*.iws
+src/main/resources/mixins.*([!.]).json
*.bat
+*.DS_Store
+!gradlew.bat
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 0000000..a6b5f68
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1,3 @@
+# Any Github changes require admin approval
+/.github/** @GTNewHorizons/admin
+
diff --git a/build.gradle b/build.gradle
index e9eeda4..846a351 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,64 +1,1534 @@
+//version: 1677938302
+/*
+ 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.diffplug.blowdryer.Blowdryer
+import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
+import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
+import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
+import com.matthewprenger.cursegradle.CurseArtifact
+import com.matthewprenger.cursegradle.CurseRelation
+import com.modrinth.minotaur.dependencies.ModDependency
+import com.modrinth.minotaur.dependencies.VersionDependency
+import cpw.mods.fml.relauncher.Side
+import org.gradle.api.tasks.options.Option;
+import org.gradle.internal.logging.text.StyledTextOutput.Style
+import org.gradle.internal.logging.text.StyledTextOutputFactory
+import org.gradle.internal.xml.XmlTransformer
+import org.jetbrains.gradle.ext.*
+
+import java.nio.file.Files
+import java.nio.file.Paths
+import java.util.concurrent.TimeUnit
+import java.util.zip.ZipEntry
+import java.util.zip.ZipOutputStream
+import javax.inject.Inject
+
buildscript {
repositories {
mavenCentral()
+
maven {
- name = "forge"
- url = "http://files.minecraftforge.net/maven"
+ name 'forge'
+ url 'https://maven.minecraftforge.net'
}
maven {
- name = "sonatype"
- url = "https://oss.sonatype.org/content/repositories/snapshots/"
+ // GTNH RetroFuturaGradle and ASM Fork
+ name "GTNH Maven"
+ url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
+ allowInsecureProtocol = true
}
+ maven {
+ name 'sonatype'
+ url 'https://oss.sonatype.org/content/repositories/snapshots/'
+ }
+ maven {
+ name 'Scala CI dependencies'
+ url 'https://repo1.maven.org/maven2/'
+ }
+
+ mavenLocal()
}
- dependencies {
- classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
+}
+plugins {
+ id 'java-library'
+ id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
+ id 'eclipse'
+ id 'scala'
+ id 'maven-publish'
+ id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
+ id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
+ id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
+ id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle
+ id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
+ id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
+ id 'de.undercouch.download' version '5.3.0'
+ id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
+ 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
+ id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3'
+}
+boolean settingsupdated = verifySettingsGradle()
+settingsupdated = verifyGitAttributes() || settingsupdated
+if (settingsupdated)
+ throw new GradleException("Settings has been updated, please re-run task.")
+
+if (project.file('.git/HEAD').isFile()) {
+ apply plugin: 'com.palantir.git-version'
+}
+
+def out = services.get(StyledTextOutputFactory).create('an-output')
+
+def projectJavaVersion = JavaLanguageVersion.of(8)
+
+boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
+
+checkPropertyExists("modName")
+checkPropertyExists("modId")
+checkPropertyExists("modGroup")
+checkPropertyExists("autoUpdateBuildScript")
+checkPropertyExists("minecraftVersion")
+checkPropertyExists("forgeVersion")
+checkPropertyExists("replaceGradleTokenInFile")
+checkPropertyExists("gradleTokenVersion")
+checkPropertyExists("apiPackage")
+checkPropertyExists("accessTransformersFile")
+checkPropertyExists("usesMixins")
+checkPropertyExists("mixinPlugin")
+checkPropertyExists("mixinsPackage")
+checkPropertyExists("coreModClass")
+checkPropertyExists("containsMixinsAndOrCoreModOnly")
+checkPropertyExists("usesShadowedDependencies")
+checkPropertyExists("developmentEnvironmentUserName")
+
+propertyDefaultIfUnset("generateGradleTokenClass", "")
+propertyDefaultIfUnset("includeWellKnownRepositories", true)
+propertyDefaultIfUnset("noPublishedSources", false)
+propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
+propertyDefaultIfUnset("forceEnableMixins", false)
+propertyDefaultIfUnset("channel", "stable")
+propertyDefaultIfUnset("mappingsVersion", "12")
+propertyDefaultIfUnset("modrinthProjectId", "")
+propertyDefaultIfUnset("modrinthRelations", "")
+propertyDefaultIfUnset("curseForgeProjectId", "")
+propertyDefaultIfUnset("curseForgeRelations", "")
+propertyDefaultIfUnset("minimizeShadowedDependencies", true)
+propertyDefaultIfUnset("relocateShadowedDependencies", true)
+// Deprecated properties (kept for backwards compat)
+propertyDefaultIfUnset("gradleTokenModId", "")
+propertyDefaultIfUnset("gradleTokenModName", "")
+propertyDefaultIfUnset("gradleTokenGroupName", "")
+
+propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only
+propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only
+
+// this is meant to be set using the user wide property file. by default we do nothing.
+propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea"
+
+project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts
+if (!disableSpotless) {
+ apply plugin: 'com.diffplug.spotless'
+ apply from: Blowdryer.file('spotless.gradle')
+}
+
+String javaSourceDir = "src/main/java/"
+String scalaSourceDir = "src/main/scala/"
+String kotlinSourceDir = "src/main/kotlin/"
+
+if (usesShadowedDependencies.toBoolean()) {
+ apply plugin: "com.github.johnrengelman.shadow"
+}
+
+java {
+ toolchain {
+ if (enableModernJavaSyntax.toBoolean()) {
+ languageVersion.set(JavaLanguageVersion.of(17))
+ } else {
+ languageVersion.set(projectJavaVersion)
+ }
+ vendor.set(JvmVendorSpec.AZUL)
+ }
+ if (!noPublishedSources) {
+ withSourcesJar()
}
}
-apply plugin: 'forge'
+pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
+ // If Kotlin is enabled in the project
+ kotlin {
+ jvmToolchain(8)
+ }
+ // Kotlin hacks our source sets, so we hack Kotlin's tasks
+ def disabledKotlinTaskList = [
+ "kaptGenerateStubsMcLauncherKotlin",
+ "kaptGenerateStubsPatchedMcKotlin",
+ "kaptGenerateStubsInjectedTagsKotlin",
+ "compileMcLauncherKotlin",
+ "compilePatchedMcKotlin",
+ "compileInjectedTagsKotlin",
+ "kaptMcLauncherKotlin",
+ "kaptPatchedMcKotlin",
+ "kaptInjectedTagsKotlin",
+ "kspMcLauncherKotlin",
+ "kspPatchedMcKotlin",
+ "kspInjectedTagsKotlin",
+ ]
+ tasks.configureEach { task ->
+ if (task.name in disabledKotlinTaskList) {
+ task.enabled = false
+ }
+ }
+}
+
+configurations {
+ create("runtimeOnlyNonPublishable") {
+ description = "Runtime only dependencies that are not published alongside the jar"
+ canBeConsumed = false
+ canBeResolved = false
+ }
+}
+
+if (enableModernJavaSyntax.toBoolean()) {
+ repositories {
+ mavenCentral {
+ mavenContent {
+ includeGroup("me.eigenraven.java8unsupported")
+ }
+ }
+ }
+
+ dependencies {
+ annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
+ compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
+ transitive = false // We only care about the 1 annotation class
+ }
+ // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937.
+ patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0')
+ }
+
+ tasks.withType(JavaCompile).configureEach {
+ if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) {
+ return
+ }
+ sourceCompatibility = 17 // for the IDE support
+ options.release.set(8)
+
+ javaCompiler.set(javaToolchains.compilerFor {
+ languageVersion.set(JavaLanguageVersion.of(17))
+ vendor.set(JvmVendorSpec.AZUL)
+ })
+ }
+}
+
+eclipse {
+ classpath {
+ downloadSources = true
+ downloadJavadoc = true
+ }
+}
+
+final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char)
+final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char)
+
+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 + 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) {
+ for (atFile in accessTransformersFile.split(",")) {
+ String targetFile = "src/main/resources/META-INF/" + atFile.trim()
+ if (!getFile(targetFile).exists()) {
+ throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
+ }
+ tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
+ tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
+ }
+} else {
+ boolean atsFound = false
+ for (File at : sourceSets.getByName("main").resources.files) {
+ if (at.name.toLowerCase().endsWith("_at.cfg")) {
+ atsFound = true
+ tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
+ tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
+ }
+ }
+ for (File at : sourceSets.getByName("api").resources.files) {
+ if (at.name.toLowerCase().endsWith("_at.cfg")) {
+ atsFound = true
+ tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
+ tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
+ }
+ }
+ if (atsFound) {
+ logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name")
+ }
+}
+
+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)
+ }
+
+ 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) {
+ 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)
+ }
+}
+
+configurations.configureEach {
+ resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
+
+ // Make sure GregTech build won't time out
+ System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
+ System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
+}
+
+// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
+try {
+ 'git config core.fileMode false'.execute()
+}
+catch (Exception ignored) {
+ out.style(Style.Failure).println("git isn't installed at all")
+}
+
+// Pulls version first from the VERSION env and then git tag
+String identifiedVersion
+String versionOverride = System.getenv("VERSION") ?: null
+try {
+ identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
+}
+catch (Exception ignored) {
+ out.style(Style.Failure).text(
+ 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
+ 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
+ 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
+ )
+ versionOverride = 'NO-GIT-TAG-SET'
+ identifiedVersion = versionOverride
+}
+version = identifiedVersion
+ext {
+ modVersion = identifiedVersion
+}
+
+if (identifiedVersion == versionOverride) {
+ out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
+}
+
+group = "com.github.GTNewHorizons"
+if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
+ archivesBaseName = customArchiveBaseName
+} else {
+ archivesBaseName = modId
+}
-version = "1.0"
-group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
-archivesBaseName = "modid"
minecraft {
- version = "1.7.10-10.13.4.1614-1.7.10"
- runDir = "eclipse"
+ if (replaceGradleTokenInFile) {
+ for (f in replaceGradleTokenInFile.split(',')) {
+ tagReplacementFiles.add f
+ }
+ }
+ if (gradleTokenModId) {
+ injectedTags.put gradleTokenModId, modId
+ }
+ if (gradleTokenModName) {
+ injectedTags.put gradleTokenModName, modName
+ }
+ if (gradleTokenVersion) {
+ injectedTags.put gradleTokenVersion, modVersion
+ }
+ if (gradleTokenGroupName) {
+ injectedTags.put gradleTokenGroupName, modGroup
+ }
+ if (enableGenericInjection.toBoolean()) {
+ injectMissingGenerics.set(true)
+ }
+
+ username = developmentEnvironmentUserName.toString()
+
+ lwjgl3Version = "3.3.2-SNAPSHOT"
+
+ // Enable assertions in the current mod
+ extraRunJvmArguments.add("-ea:${modGroup}")
+
+ if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
+ extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
+
+ if (usesMixinDebug.toBoolean()) {
+ extraRunJvmArguments.addAll([
+ "-Dmixin.debug.countInjections=true",
+ "-Dmixin.debug.verbose=true",
+ "-Dmixin.debug.export=true"
+ ])
+ }
+ }
+
+ // Blowdryer is present in some old mod builds, do not propagate it further as a dependency
+ // IC2 has no reobf jars in its Maven
+ groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"])
+}
+
+if (generateGradleTokenClass) {
+ tasks.injectTags.outputClassName.set(generateGradleTokenClass)
+}
+
+// Custom reobf auto-mappings
+configurations.configureEach {
+ dependencies.configureEach { dep ->
+ if (dep instanceof org.gradle.api.artifacts.ExternalModuleDependency) {
+ if (dep.group == "net.industrial-craft" && dep.name == "industrialcraft-2") {
+ // https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971
+ project.dependencies.reobfJarConfiguration("curse.maven:ic2-242638:2353971")
+ }
+ }
+ }
+ def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE)
+ if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) {
+ resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+ // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server
+ if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') {
+ details.useVersion '2388750'
+ details.because 'Pick obfuscated jar'
+ }
+ }
+ }
+}
+
+// Ensure tests have access to minecraft classes
+sourceSets {
+ test {
+ java {
+ compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output
+ runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output
+ }
+ }
+}
+
+if (file('addon.gradle').exists()) {
+ apply from: 'addon.gradle'
+}
+
+// Allow unsafe repos but warn
+repositories.configureEach { repo ->
+ if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
+ if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
+ logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'")
+ repo.allowInsecureProtocol = true
+ }
+ }
+}
+
+apply from: 'repositories.gradle'
+
+configurations {
+ runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
+ testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
+ for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
+ if (usesShadowedDependencies.toBoolean()) {
+ config.extendsFrom(shadowImplementation)
+ // TODO: remove Compile after all uses are refactored to Implementation
+ config.extendsFrom(shadeCompile)
+ config.extendsFrom(shadowCompile)
+ }
+ }
+ // A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api"
+ create("compile") {
+ description = "Deprecated: use api or implementation instead, gets put in api"
+ canBeConsumed = false
+ canBeResolved = false
+ visible = false
+ }
+ create("testCompile") {
+ description = "Deprecated: use testImplementation instead"
+ canBeConsumed = false
+ canBeResolved = false
+ visible = false
+ }
+ api.extendsFrom(compile)
+ testImplementation.extendsFrom(testCompile)
+}
+
+afterEvaluate {
+ if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) {
+ logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`")
+ logger.warn("For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle")
+ }
+}
+
+repositories {
+ maven {
+ name 'Overmind forge repo mirror'
+ url 'https://gregtech.overminddl1.com/'
+ mavenContent {
+ excludeGroup("net.minecraftforge") // missing the `universal` artefact
+ }
+ }
+ maven {
+ name = "GTNH Maven"
+ url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
+ allowInsecureProtocol = true
+ }
+ if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
+ if (usesMixinDebug.toBoolean()) {
+ maven {
+ name = "Fabric Maven"
+ url = "https://maven.fabricmc.net/"
+ }
+ }
+ }
+ maven {
+ name 'sonatype'
+ url 'https://oss.sonatype.org/content/repositories/snapshots/'
+ content {
+ includeGroup "org.lwjgl"
+ }
+ }
+ if (includeWellKnownRepositories.toBoolean()) {
+ maven {
+ name "CurseMaven"
+ url "https://cursemaven.com"
+ content {
+ includeGroup "curse.maven"
+ }
+ }
+ maven {
+ name = "ic2"
+ url = "https://maven.ic2.player.to/"
+ metadataSources {
+ mavenPom()
+ artifact()
+ }
+ }
+ maven {
+ name = "ic2-mirror"
+ url = "https://maven2.ic2.player.to/"
+ metadataSources {
+ mavenPom()
+ artifact()
+ }
+ }
+ maven {
+ name "MMD Maven"
+ url "https://maven.mcmoddev.com/"
+ }
+ }
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- // you may put jars on which you depend on in ./libs
- // or you may define them like so..
- //compile "some.group:artifact:version:classifier"
- //compile "some.group:artifact:version"
-
- // real examples
- //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
- //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
+ 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('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
+ if (usesMixinDebug.toBoolean()) {
+ runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
+ }
+ }
+ if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
+ implementation('com.gtnewhorizon:gtnhmixins:2.1.13')
+ }
+}
- // for more info...
- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
- // http://www.gradle.org/docs/current/userguide/dependency_management.html
+pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
+ if (usesMixins.toBoolean()) {
+ dependencies {
+ kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor')
+ }
+ }
+}
+
+apply from: 'dependencies.gradle'
+
+def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
+def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
+def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
+def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
+
+tasks.register('generateAssets') {
+ group = "GTNH Buildscript"
+ description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed"
+ onlyIf { usesMixins.toBoolean() }
+ doLast {
+ 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.8.5-GTNH",
+ "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine}
+ "refmap": "${mixingConfigRefMap}",
+ "target": "@env(DEFAULT)",
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [],
+ "server": []
+}
+"""
+ }
+ }
+}
+
+if (usesMixins.toBoolean()) {
+ tasks.named("reobfJar", ReobfuscatedJar).configure {
+ extraSrgFiles.from(mixinSrg)
+ }
+
+ tasks.named("processResources").configure {
+ dependsOn("generateAssets")
+ }
+
+ tasks.named("compileJava", JavaCompile).configure {
+ doFirst {
+ new File(mixinTmpDir).mkdirs()
+ }
+ options.compilerArgs += [
+ "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
+ "-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"
+ ]
+ }
+
+ pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
+ kapt {
+ correctErrorTypes = true
+ javacOptions {
+ option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
+ option("-AoutSrgFile=$mixinSrg")
+ option("-AoutRefMapFile=$refMap")
+ }
+ }
+ tasks.configureEach { task ->
+ if (task.name == "kaptKotlin") {
+ task.doFirst {
+ new File(mixinTmpDir).mkdirs()
+ }
+ }
+ }
+ }
}
-processResources
-{
+tasks.named("processResources", ProcessResources).configure {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
- inputs.property "mcversion", project.minecraft.version
+ inputs.property "mcversion", project.minecraft.mcVersion
+ exclude("spotless.gradle")
- // replace stuff in mcmod.info, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
-
- // replace version and mcversion
- expand 'version':project.version, 'mcversion':project.minecraft.version
+ // replace stuff in mcmod.info, nothing else. replaces ${key} with value in text
+ filesMatching("mcmod.info") {
+ expand "minecraftVersion": project.minecraft.mcVersion,
+ "modVersion": modVersion,
+ "modId": modId,
+ "modName": modName
}
-
- // copy everything else, thats not the mcmod.info
- from(sourceSets.main.resources.srcDirs) {
- exclude 'mcmod.info'
+
+ if (usesMixins.toBoolean()) {
+ from refMap
+ dependsOn("compileJava", "compileScala")
}
}
+
+ext.java17Toolchain = (JavaToolchainSpec spec) -> {
+ spec.languageVersion.set(JavaLanguageVersion.of(17))
+ spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
+}
+
+ext.java17DependenciesCfg = configurations.create("java17Dependencies") {
+ extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution
+ canBeConsumed = false
+}
+ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") {
+ canBeConsumed = false
+}
+
+dependencies {
+ def lwjgl3ifyVersion = '1.1.35'
+ def asmVersion = '9.4'
+ if (modId != 'lwjgl3ify') {
+ java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
+ }
+ if (modId != 'hodgepodge') {
+ java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40')
+ }
+
+ java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
+ java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
+ java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
+ java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
+ java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
+ java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
+ java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
+ java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
+ java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
+}
+
+ext.java17JvmArgs = [
+ // Java 9+ support
+ "--illegal-access=warn",
+ "-Djava.security.manager=allow",
+ "-Dfile.encoding=UTF-8",
+ "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
+ "--add-opens", "java.base/java.net=ALL-UNNAMED",
+ "--add-opens", "java.base/java.nio=ALL-UNNAMED",
+ "--add-opens", "java.base/java.io=ALL-UNNAMED",
+ "--add-opens", "java.base/java.lang=ALL-UNNAMED",
+ "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
+ "--add-opens", "java.base/java.text=ALL-UNNAMED",
+ "--add-opens", "java.base/java.util=ALL-UNNAMED",
+ "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
+ "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
+ "--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
+ "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
+ "--add-modules", "jdk.dynalink",
+ "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
+ "--add-modules", "java.sql.rowset",
+ "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
+]
+
+ext.hotswapJvmArgs = [
+ // DCEVM advanced hot reload
+ "-XX:+AllowEnhancedClassRedefinition",
+ "-XX:HotswapAgent=fatjar"
+]
+
+ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") {
+ group = "GTNH Buildscript"
+ description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory"
+ def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar'
+ def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")}
+ def targetFilename = "hotswap-agent.jar"
+ onlyIf {
+ !targetFolderProvider.get().file(targetFilename).asFile.exists()
+ }
+ doLast {
+ def targetFolder = targetFolderProvider.get()
+ targetFolder.asFile.mkdirs()
+ download.run {
+ src hsaUrl
+ dest targetFolder.file(targetFilename).asFile
+ overwrite false
+ tempAndMove true
+ }
+ }
+}
+
+public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
+ // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable
+ private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP"));
+
+ @Input
+ public boolean getEnableHotswap() { return enableHotswap }
+ @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger")
+ public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
+
+ @Inject
+ public RunHotswappableMinecraftTask(Side side, String superTask, org.gradle.api.invocation.Gradle gradle) {
+ super(side, gradle)
+
+ this.lwjglVersion = 3
+ this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
+ this.extraJvmArgs.addAll(project.java17JvmArgs)
+ this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : []))
+
+ this.classpath(project.java17PatchDependenciesCfg)
+ if (side == Side.CLIENT) {
+ this.classpath(project.minecraftTasks.lwjgl3Configuration)
+ }
+ // Use a raw provider instead of map to not create a dependency on the task
+ this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath))
+ this.classpath.filter { file ->
+ !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
+ }
+ this.classpath(project.java17DependenciesCfg)
+
+ if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
+ this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
+ }
+ }
+}
+
+def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient")
+runClient17Task.configure {
+ setup(project)
+ group = "Modded Minecraft"
+ description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
+ dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
+ mainClass = "GradleStart"
+ username = minecraft.username
+ userUUID = minecraft.userUUID
+}
+
+def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer")
+runServer17Task.configure {
+ setup(project)
+ group = "Modded Minecraft"
+ description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge"
+ dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
+ mainClass = "GradleStartServer"
+ extraArgs.add("nogui")
+}
+
+def getManifestAttributes() {
+ def manifestAttributes = [:]
+ if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
+ manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
+ }
+
+ if (accessTransformersFile) {
+ manifestAttributes += ["FMLAT": accessTransformersFile.toString()]
+ }
+
+ if (coreModClass) {
+ manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
+ }
+
+ if (usesMixins.toBoolean()) {
+ manifestAttributes += [
+ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
+ "MixinConfigs" : "mixins." + modId + ".json",
+ "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean()
+ ]
+ }
+ return manifestAttributes
+}
+
+tasks.named("jar", Jar).configure {
+ manifest {
+ attributes(getManifestAttributes())
+ }
+}
+
+if (usesShadowedDependencies.toBoolean()) {
+ tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
+ target = tasks.shadowJar
+ prefix = modGroup + ".shadow"
+ enabled = relocateShadowedDependencies.toBoolean()
+ }
+ tasks.named("shadowJar", ShadowJar).configure {
+ manifest {
+ attributes(getManifestAttributes())
+ }
+
+ if (minimizeShadowedDependencies.toBoolean()) {
+ minimize() // This will only allow shading for actually used classes
+ }
+ configurations = [
+ project.configurations.shadowImplementation,
+ project.configurations.shadowCompile,
+ project.configurations.shadeCompile
+ ]
+ archiveClassifier.set('dev')
+ if (relocateShadowedDependencies.toBoolean()) {
+ dependsOn(relocateShadowJar)
+ }
+ }
+ configurations.runtimeElements.outgoing.artifacts.clear()
+ configurations.apiElements.outgoing.artifacts.clear()
+ configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
+ configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
+ tasks.named("jar", Jar) {
+ enabled = false
+ finalizedBy(tasks.shadowJar)
+ }
+ tasks.named("reobfJar", ReobfuscatedJar) {
+ inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
+ }
+ AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName("java")
+ javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
+ skip()
+ }
+ for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
+ tasks.named(runTask).configure {
+ dependsOn("shadowJar")
+ }
+ }
+}
+ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
+ext.publishableObfJar = tasks.reobfJar
+
+tasks.register('apiJar', Jar) {
+ from(sourceSets.main.allSource) {
+ include modGroupPath + "/" + apiPackagePath + '/**'
+ }
+
+ from(sourceSets.main.output) {
+ include modGroupPath + "/" + apiPackagePath + '/**'
+ }
+
+ from(sourceSets.main.resources.srcDirs) {
+ include("LICENSE")
+ }
+
+ getArchiveClassifier().set('api')
+}
+
+artifacts {
+ if (!noPublishedSources) {
+ archives tasks.named("sourcesJar")
+ }
+ if (apiPackage) {
+ archives tasks.named("apiJar")
+ }
+}
+
+idea {
+ module {
+ downloadJavadoc = true
+ downloadSources = true
+ inheritOutputDirs = true
+ }
+ project {
+ settings {
+ if (ideaOverrideBuildType != "") {
+ delegateActions {
+ if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) {
+ delegateBuildRunToGradle = true
+ testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE
+ } else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) {
+ delegateBuildRunToGradle = false
+ testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
+ } else {
+ throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.')
+ }
+ }
+ }
+ runConfigurations {
+ "1. Run Client"(Gradle) {
+ taskNames = ["runClient"]
+ }
+ "2. Run Server"(Gradle) {
+ taskNames = ["runServer"]
+ }
+ "1a. Run Client (Java 17)"(Gradle) {
+ taskNames = ["runClient17"]
+ }
+ "2a. Run Server (Java 17)"(Gradle) {
+ taskNames = ["runServer17"]
+ }
+ "1b. Run Client (Java 17, Hotswap)"(Gradle) {
+ taskNames = ["runClient17"]
+ envs = ["HOTSWAP": "true"]
+ }
+ "2b. Run Server (Java 17, Hotswap)"(Gradle) {
+ taskNames = ["runServer17"]
+ envs = ["HOTSWAP": "true"]
+ }
+ "3. Run Obfuscated Client"(Gradle) {
+ taskNames = ["runObfClient"]
+ }
+ "4. Run Obfuscated Server"(Gradle) {
+ taskNames = ["runObfServer"]
+ }
+ if (!disableSpotless) {
+ "5. Apply spotless"(Gradle) {
+ taskNames = ["spotlessApply"]
+ }
+ }
+ def coreModArgs = ""
+ if (coreModClass) {
+ coreModArgs = ' "-Dfml.coreMods.load=' + modGroup + '.' + coreModClass + '"'
+ }
+ "Run Client (IJ Native)"(Application) {
+ mainClass = "GradleStart"
+ moduleName = project.name + ".ideVirtualMain"
+ afterEvaluate {
+ workingDirectory = tasks.runClient.workingDir.absolutePath
+ programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
+ jvmArgs = tasks.runClient.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') +
+ ' ' + tasks.runClient.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') +
+ coreModArgs
+ }
+ }
+ "Run Server (IJ Native)"(Application) {
+ mainClass = "GradleStartServer"
+ moduleName = project.name + ".ideVirtualMain"
+ afterEvaluate {
+ workingDirectory = tasks.runServer.workingDir.absolutePath
+ programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
+ jvmArgs = tasks.runServer.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') +
+ ' ' + tasks.runServer.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') +
+ coreModArgs
+ }
+ }
+ }
+ compiler.javac {
+ afterEvaluate {
+ moduleJavacAdditionalOptions = [
+ (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
+ ]
+ }
+ }
+ withIDEADir { File ideaDir ->
+ if (!ideaDir.path.contains(".idea")) {
+ // If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory
+ ideaDir = new File(ideaDir, ".idea")
+ }
+ if (ideaDir.isDirectory()) {
+ def miscFile = new File(ideaDir, "misc.xml")
+ if (miscFile.isFile()) {
+ boolean dirty = false
+ def miscTransformer = new XmlTransformer()
+ miscTransformer.addAction { root ->
+ Node rootNode = root.asNode()
+ def rootManager = rootNode
+ .component.find { it.@name == 'ProjectRootManager' }
+ if (!rootManager) {
+ rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2'])
+ dirty = true
+ }
+ def output = rootManager.output
+ if (!output) {
+ output = rootManager.appendNode('output')
+ dirty = true
+ }
+ if (!output.@url) {
+ // Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow.
+ // This is a sensible default for most setups
+ output.@url = 'file://$PROJECT_DIR$/build/ideaBuild'
+ dirty = true
+ }
+ }
+ def result = miscTransformer.transform(miscFile.text)
+ if (dirty) {
+ miscFile.write(result)
+ }
+ } else {
+ miscFile.text = """
+
+
+
+
+
+"""
+ }
+ }
+ }
+ }
+ }
+}
+
+tasks.named("processIdeaSettings").configure {
+ dependsOn("injectTags")
+}
+
+// workaround variable hiding in pom processing
+def projectConfigs = project.configurations
+
+publishing {
+ publications {
+ create("maven", MavenPublication) {
+ from components.java
+
+ if (apiPackage) {
+ artifact apiJar
+ }
+
+ groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group
+ artifactId = System.getenv("ARTIFACT_ID") ?: project.name
+ // Using the identified version, not project.version as it has the prepended 1.7.10
+ version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
+ }
+ }
+
+ repositories {
+ maven {
+ url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
+ allowInsecureProtocol = true
+ credentials {
+ username = System.getenv("MAVEN_USER") ?: "NONE"
+ password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
+ }
+ }
+ }
+}
+
+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 = publishableObfJar
+ 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", "project", "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 publishableObfJar
+ 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(String scope, String type, String 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(String type, String 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
+
+def buildscriptGradleVersion = "8.0.1"
+
+tasks.named('wrapper', Wrapper).configure {
+ gradleVersion = buildscriptGradleVersion
+}
+
+tasks.register('updateBuildScript') {
+ group = 'GTNH Buildscript'
+ description = 'Updates the build script to the latest version'
+
+ if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
+ dependsOn('wrapper')
+ }
+
+ doLast {
+ if (performBuildScriptUpdate()) return
+
+ print("Build script already up-to-date!")
+ }
+}
+
+if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_UPDATE_CHECK') && isNewBuildScriptVersionAvailable()) {
+ if (autoUpdateBuildScript.toBoolean()) {
+ performBuildScriptUpdate()
+ } else {
+ out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
+ if (gradle.gradleVersion != buildscriptGradleVersion) {
+ out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n")
+ }
+ }
+}
+
+static URL availableBuildScriptUrl() {
+ 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() {
+ if (isNewBuildScriptVersionAvailable()) {
+ def buildscriptFile = getFile("build.gradle")
+ availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
+ def out = services.get(StyledTextOutputFactory).create('buildscript-update-output')
+ 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
+}
+
+boolean isNewBuildScriptVersionAvailable() {
+ Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
+
+ String currentBuildScript = getFile("build.gradle").getText()
+ String currentBuildScriptHash = getVersionHash(currentBuildScript)
+ String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
+ String availableBuildScriptHash = getVersionHash(availableBuildScript)
+
+ boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
+ return !isUpToDate
+}
+
+static String getVersionHash(String buildScriptContent) {
+ String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
+ if (versionLine != null) {
+ return versionLine.split(": ").last()
+ }
+ return ""
+}
+
+// Parameter Deobfuscation
+
+tasks.register('deobfParams') {
+ group = 'GTNH Buildscript'
+ description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
+ doLast { // TODO
+
+ 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 ...")
+ copy {
+ from(zipTree(mcpZIP))
+ into(mcpDir)
+ }
+ }
+
+ println("Parsing params.csv ...")
+ Map 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 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
+}
+
+// Dependency Deobfuscation
+
+def deobf(String sourceURL) {
+ try {
+ URL url = new URL(sourceURL)
+ String fileName = url.getFile()
+
+ //get rid of directories:
+ int lastSlash = fileName.lastIndexOf("/")
+ if (lastSlash > 0) {
+ fileName = fileName.substring(lastSlash + 1)
+ }
+ //get rid of extension:
+ if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
+ fileName = fileName.substring(0, fileName.lastIndexOf("."))
+ }
+
+ String hostName = url.getHost()
+ if (hostName.startsWith("www.")) {
+ hostName = hostName.substring(4)
+ }
+ List parts = Arrays.asList(hostName.split("\\."))
+ Collections.reverse(parts)
+ hostName = String.join(".", parts)
+
+ return deobf(sourceURL, "$hostName/$fileName")
+ } catch (Exception ignored) {
+ return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
+ }
+}
+
+def deobfMaven(String repoURL, String mavenDep) {
+ if (!repoURL.endsWith("/")) {
+ repoURL += "/"
+ }
+ String[] parts = mavenDep.split(":")
+ parts[0] = parts[0].replace('.', '/')
+ def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar"
+ return deobf(jarURL)
+}
+
+def deobfCurse(String curseDep) {
+ try {
+ return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
+ } catch (Exception ignored) {
+ out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
+ }
+}
+
+// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
+def deobf(String sourceURL, String rawFileName) {
+ String bon2Version = "2.5.1"
+ String fileName = URLDecoder.decode(rawFileName, "UTF-8")
+ String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
+ String bon2Dir = "$cacheDir/forge_gradle/deobf"
+ String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
+ String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
+ String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
+
+ if (file(deobfFile).exists()) {
+ return files(deobfFile)
+ }
+
+ String 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 "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
+ dest bon2File
+ quiet true
+ overwrite false
+ }
+
+ download.run {
+ src sourceURL
+ dest obfFile
+ quiet true
+ overwrite false
+ }
+
+ exec {
+ commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
+ workingDir bon2Dir
+ 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) {
+ if (!project.hasProperty(propertyName)) {
+ throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
+ }
+}
+
+def 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 = [publishableDevJar]
+ if (!noPublishedSources) secondaryArtifacts += [sourcesJar]
+ if (apiPackage) secondaryArtifacts += [apiJar]
+ return secondaryArtifacts
+}
diff --git a/dependencies.gradle b/dependencies.gradle
new file mode 100644
index 0000000..9399817
--- /dev/null
+++ b/dependencies.gradle
@@ -0,0 +1,11 @@
+dependencies {
+ api('com.github.GTNewHorizons:Botania:1.9.2-GTNH:dev')
+ api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
+ api('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev')
+ api('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
+ compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
+ compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.1.5:dev")
+ compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.8-GTNH:dev")
+ compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.6:dev")
+ //compileOnly("com.github.stanhebben:MineTweaker3:1.7.10-3.0.10B:dev")
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..7e499a3
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,143 @@
+modName = Advanded Botany
+
+# This is a case-sensitive string to identify your mod. Convention is to use lower case.
+modId = AdvancedBotany
+
+modGroup = ab
+
+# WHY is there no version field?
+# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
+# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
+
+# Will update your build.gradle automatically whenever an update is available
+autoUpdateBuildScript = false
+
+minecraftVersion = 1.7.10
+forgeVersion = 10.13.4.1614
+
+# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
+channel = stable
+mappingsVersion = 12
+
+# Define other MCP mappings for dependency deobfuscation
+remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
+
+# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
+# restart Minecraft in development. Choose this dependent on your mod:
+# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
+# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
+developmentEnvironmentUserName = Developer
+
+# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
+# See https://github.com/bsideup/jabel for details on how this works.
+enableModernJavaSyntax = true
+
+# Enables injecting missing generics into the decompiled source code for a better coding experience
+# Turns most publically visible List, Map, etc. into proper List, Map types
+enableGenericInjection = false
+
+# Generate a class with String fields for the mod id, name, version and group name named with the fields below
+generateGradleTokenClass = ab.Tags
+gradleTokenModId = GRADLETOKEN
+gradleTokenModName = GRADLETOKEN
+gradleTokenVersion = GRADLETOKEN
+gradleTokenGroupName =
+# [DEPRECATED]
+# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
+# public static final String VERSION = "GRADLETOKEN_VERSION";
+# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
+# version in @Mod([...], version = VERSION, [...])
+# Leave these properties empty to skip individual token replacements
+replaceGradleTokenInFile =
+
+# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
+# leave this property empty.
+# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
+apiPackage =
+
+# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
+# There can be multiple files in a comma-separated list.
+# Example value: mymodid_at.cfg,nei_at.cfg
+accessTransformersFile =
+
+# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
+usesMixins = false
+# Adds some debug arguments like verbose output and export
+usesMixinDebug = false
+# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
+mixinPlugin =
+# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
+mixinsPackage =
+# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
+# This parameter is for legacy compatibility only
+# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
+coreModClass =
+# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
+# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
+containsMixinsAndOrCoreModOnly = false
+
+# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
+forceEnableMixins = false
+
+# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
+# responsibility check the licence and request permission for distribution, if required.
+usesShadowedDependencies = false
+# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
+# their own classes, making the minimization unreliable.
+minimizeShadowedDependencies = true
+# If disabled, won't rename the shadowed classes.
+relocateShadowedDependencies = true
+
+# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
+includeWellKnownRepositories = true
+
+# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
+
+# The project's ID on Modrinth. Can be either the slug or the ID.
+# Leave this empty if you don't want to publish on Modrinth.
+modrinthProjectId =
+
+# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
+# Syntax: scope1-type1:name1;scope2-type2:name2;...
+# Where scope can be one of [required, optional, incompatible, embedded],
+# type can be one of [project, version],
+# and the name is the Modrinth project or version slug/id of the other mod.
+# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
+# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
+modrinthRelations =
+
+
+# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
+
+# The project's numeric ID on CurseForge. You can find this in the About Project box.
+# Leave this empty if you don't want to publish on CurseForge.
+curseForgeProjectId =
+
+# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
+# Syntax: type1:name1;type2:name2;...
+# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
+# and the name is the CurseForge project slug of the other mod.
+# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
+# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
+curseForgeRelations =
+
+
+# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
+# projects. New projects should not use this parameter.
+# customArchiveBaseName =
+
+# Optional parameter to prevent the source code from being published
+# noPublishedSources =
+
+# Uncomment this to disable spotless checks
+# This should only be uncommented to keep it easier to sync with upstream/other forks.
+# That is, if there is no other active fork/upstream, NEVER change this.
+# disableSpotless = true
+
+# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
+# (force use delegated build).
+# This is meant to be set in $HOME/.gradle/gradle.properties.
+# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
+# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
+# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
+# ideaOverrideBuildType = idea
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index b761216..ccebba7 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ff2a712..fc10b60 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Jul 02 15:54:47 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
+networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
diff --git a/gradlew b/gradlew
index 91a7e26..79a61d4 100644
--- a/gradlew
+++ b/gradlew
@@ -1,79 +1,129 @@
-#!/usr/bin/env bash
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
-warn ( ) {
+warn () {
echo "$*"
-}
+} >&2
-die ( ) {
+die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -82,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
+ JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -90,75 +140,105 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/repositories.gradle b/repositories.gradle
new file mode 100644
index 0000000..c884390
--- /dev/null
+++ b/repositories.gradle
@@ -0,0 +1,5 @@
+// Add any additional repositories for your dependencies here
+
+repositories {
+
+}
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..01ea5f1
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,28 @@
+
+pluginManagement {
+ repositories {
+ maven {
+ // RetroFuturaGradle
+ name "GTNH Maven"
+ url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
+ allowInsecureProtocol = true
+ mavenContent {
+ includeGroup("com.gtnewhorizons.retrofuturagradle")
+ }
+ }
+ gradlePluginPortal()
+ mavenCentral()
+ mavenLocal()
+ }
+}
+
+plugins {
+ id 'com.diffplug.blowdryerSetup' version '1.6.0'
+ id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
+}
+
+blowdryerSetup {
+ repoSubfolder 'gtnhShared'
+ github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
+ //devLocal '.' // Use this when testing config updates locally
+}
diff --git a/src/main/java/ab/AdvancedBotany.java b/src/main/java/ab/AdvancedBotany.java
index c16d481..69f8220 100644
--- a/src/main/java/ab/AdvancedBotany.java
+++ b/src/main/java/ab/AdvancedBotany.java
@@ -1,40 +1,45 @@
package ab;
+import net.minecraft.creativetab.CreativeTabs;
+
import ab.common.core.proxy.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraftforge.common.MinecraftForge;
-@Mod (modid = AdvancedBotany.modid, name="Advanced Botany", version = AdvancedBotany.version, dependencies = "required-after:Botania", guiFactory = "ab.client.core.handler.GuiABFactory")
+@Mod(
+ modid = AdvancedBotany.modid,
+ name = "Advanced Botany",
+ version = AdvancedBotany.version,
+ dependencies = "required-after:Botania",
+ guiFactory = "ab.client.core.handler.GuiABFactory")
public class AdvancedBotany {
-
- public static final String modid = "AdvancedBotany";
- public static final String version = "1.3.1.5";
- @Mod.Instance("AdvancedBotany")
+ public static final String modid = "AdvancedBotany";
+ public static final String version = "1.3.1.5";
+
+ @Mod.Instance("AdvancedBotany")
public static AdvancedBotany instance;
-
- @SidedProxy(clientSide = "ab.client.core.proxy.ClientProxy", serverSide = "ab.common.core.proxy.CommonProxy")
+
+ @SidedProxy(clientSide = "ab.client.core.proxy.ClientProxy", serverSide = "ab.common.core.proxy.CommonProxy")
public static CommonProxy proxy;
-
- @Mod.EventHandler
- public void preInit(FMLPreInitializationEvent event) {
- proxy.preInit(event);
- }
- @Mod.EventHandler
- public void init(FMLInitializationEvent event) {
- proxy.init(event);
- }
+ @Mod.EventHandler
+ public void preInit(FMLPreInitializationEvent event) {
+ proxy.preInit(event);
+ }
- @Mod.EventHandler
- public void postInit(FMLPostInitializationEvent event) {
- proxy.postInit(event);
- }
-
- public static final CreativeTabs tabAB = new AdvancedBotanyTab("tabAB");
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent event) {
+ proxy.init(event);
+ }
+
+ @Mod.EventHandler
+ public void postInit(FMLPostInitializationEvent event) {
+ proxy.postInit(event);
+ }
+
+ public static final CreativeTabs tabAB = new AdvancedBotanyTab("tabAB");
}
diff --git a/src/main/java/ab/AdvancedBotanyTab.java b/src/main/java/ab/AdvancedBotanyTab.java
index 7b50763..cfcf8bb 100644
--- a/src/main/java/ab/AdvancedBotanyTab.java
+++ b/src/main/java/ab/AdvancedBotanyTab.java
@@ -1,24 +1,23 @@
package ab;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.ItemListAB;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
public class AdvancedBotanyTab extends CreativeTabs {
- public AdvancedBotanyTab(String str) {
- super(str);
- this.setNoTitle();
- this.setBackgroundImageName("ab.png");
- }
-
- @SideOnly(Side.CLIENT)
- public Item getTabIconItem() {
- return ItemBlock.getItemFromBlock(BlockListAB.blockABSpreader);
- }
-}
\ No newline at end of file
+ public AdvancedBotanyTab(String str) {
+ super(str);
+ this.setNoTitle();
+ this.setBackgroundImageName("ab.png");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Item getTabIconItem() {
+ return ItemBlock.getItemFromBlock(BlockListAB.blockABSpreader);
+ }
+}
diff --git a/src/main/java/ab/api/AchievementAB.java b/src/main/java/ab/api/AchievementAB.java
index a255eea..4c4aaaf 100644
--- a/src/main/java/ab/api/AchievementAB.java
+++ b/src/main/java/ab/api/AchievementAB.java
@@ -1,17 +1,16 @@
package ab.api;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
+
import vazkii.botania.api.item.IRelic;
public class AchievementAB extends Achievement {
-
- public AchievementAB(String name, int x, int y, ItemStack icon, Achievement parent) {
- super("achievement.ab:" + name, "ab:" + name, x, y, icon, parent);
- AdvancedBotanyAPI.achievements.add(this);
- registerStat();
- if(icon.getItem() instanceof IRelic)
- ((IRelic)icon.getItem()).setBindAchievement(this);
- }
+
+ public AchievementAB(String name, int x, int y, ItemStack icon, Achievement parent) {
+ super("achievement.ab:" + name, "ab:" + name, x, y, icon, parent);
+ AdvancedBotanyAPI.achievements.add(this);
+ registerStat();
+ if (icon.getItem() instanceof IRelic) ((IRelic) icon.getItem()).setBindAchievement(this);
+ }
}
diff --git a/src/main/java/ab/api/AdvancedBotanyAPI.java b/src/main/java/ab/api/AdvancedBotanyAPI.java
index dbe8568..1fa307e 100644
--- a/src/main/java/ab/api/AdvancedBotanyAPI.java
+++ b/src/main/java/ab/api/AdvancedBotanyAPI.java
@@ -3,10 +3,6 @@ package ab.api;
import java.util.ArrayList;
import java.util.List;
-import ab.api.recipe.RecipeAdvancedPlate;
-import ab.api.recipe.RecipeAncientAlphirine;
-import ab.common.core.handler.ConfigABHandler;
-import ab.common.lib.register.ItemListAB;
import net.minecraft.block.Block;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
@@ -15,39 +11,51 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.EnumHelper;
-import vazkii.botania.common.item.ModItems;
+
+import ab.api.recipe.RecipeAdvancedPlate;
+import ab.api.recipe.RecipeAncientAlphirine;
+import ab.common.core.handler.ConfigABHandler;
public class AdvancedBotanyAPI {
- public static List advancedPlateRecipes = new ArrayList();
- public static List alphirineRecipes = new ArrayList();
- public static List farmlandList = new ArrayList();
- public static List achievements = new ArrayList();
- public static List relicList = new ArrayList();
- public static List diceList = new ArrayList();
-
- public static Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
- public static ItemArmor.ArmorMaterial nebulaArmorMaterial = EnumHelper.addArmorMaterial("NEBULA", 0, new int[] { (int)(3 * ConfigABHandler.protectionFactorNebula), (int)(8 * ConfigABHandler.protectionFactorNebula), (int)(6 * ConfigABHandler.protectionFactorNebula), (int)(3 * ConfigABHandler.protectionFactorNebula) }, 26);
- public static ItemArmor.ArmorMaterial wildHundArmor = EnumHelper.addArmorMaterial("WILD_HUNT_MATERIAL", 34, new int[] { 7, 8, 3, 2 }, 26);
-
- public static EnumRarity rarityNebula = EnumHelper.addRarity("NEBULA", EnumChatFormatting.LIGHT_PURPLE, "Nebula");
- public static EnumRarity rarityWildHunt = EnumHelper.addRarity("WILD_HUNT", EnumChatFormatting.AQUA, "WildHunt");
-
- public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3, int mana, int color) {
- RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, color, input1, input2, input3);
- advancedPlateRecipes.add(recipe);
- return recipe;
- }
-
- public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
- RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
- alphirineRecipes.add(recipe);
- return recipe;
- }
-
- public static TerraFarmlandList registerFarmlandSeed(Block block, int meta) {
- TerraFarmlandList seed = new TerraFarmlandList(block, meta);
- farmlandList.add(seed);
- return seed;
- }
-}
\ No newline at end of file
+ public static List advancedPlateRecipes = new ArrayList();
+ public static List alphirineRecipes = new ArrayList();
+ public static List farmlandList = new ArrayList();
+ public static List achievements = new ArrayList();
+ public static List relicList = new ArrayList();
+ public static List diceList = new ArrayList();
+
+ public static Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
+ public static ItemArmor.ArmorMaterial nebulaArmorMaterial = EnumHelper.addArmorMaterial(
+ "NEBULA",
+ 0,
+ new int[] { (int) (3 * ConfigABHandler.protectionFactorNebula),
+ (int) (8 * ConfigABHandler.protectionFactorNebula),
+ (int) (6 * ConfigABHandler.protectionFactorNebula),
+ (int) (3 * ConfigABHandler.protectionFactorNebula) },
+ 26);
+ public static ItemArmor.ArmorMaterial wildHundArmor = EnumHelper
+ .addArmorMaterial("WILD_HUNT_MATERIAL", 34, new int[] { 7, 8, 3, 2 }, 26);
+
+ public static EnumRarity rarityNebula = EnumHelper.addRarity("NEBULA", EnumChatFormatting.LIGHT_PURPLE, "Nebula");
+ public static EnumRarity rarityWildHunt = EnumHelper.addRarity("WILD_HUNT", EnumChatFormatting.AQUA, "WildHunt");
+
+ public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2,
+ ItemStack input3, int mana, int color) {
+ RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, color, input1, input2, input3);
+ advancedPlateRecipes.add(recipe);
+ return recipe;
+ }
+
+ public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
+ RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
+ alphirineRecipes.add(recipe);
+ return recipe;
+ }
+
+ public static TerraFarmlandList registerFarmlandSeed(Block block, int meta) {
+ TerraFarmlandList seed = new TerraFarmlandList(block, meta);
+ farmlandList.add(seed);
+ return seed;
+ }
+}
diff --git a/src/main/java/ab/api/IBoundRender.java b/src/main/java/ab/api/IBoundRender.java
index 2727d55..801d688 100644
--- a/src/main/java/ab/api/IBoundRender.java
+++ b/src/main/java/ab/api/IBoundRender.java
@@ -1,9 +1,10 @@
package ab.api;
import net.minecraft.util.ChunkCoordinates;
+
import vazkii.botania.api.wand.IWandBindable;
public interface IBoundRender extends IWandBindable {
-
- public ChunkCoordinates[] getBlocksCoord();
+
+ public ChunkCoordinates[] getBlocksCoord();
}
diff --git a/src/main/java/ab/api/IRankItem.java b/src/main/java/ab/api/IRankItem.java
index 08ee4bb..b76a28e 100644
--- a/src/main/java/ab/api/IRankItem.java
+++ b/src/main/java/ab/api/IRankItem.java
@@ -1,11 +1,12 @@
package ab.api;
import net.minecraft.item.ItemStack;
+
import vazkii.botania.api.mana.IManaItem;
public interface IRankItem extends IManaItem {
-
- public int getLevel(ItemStack stack);
-
- public int[] getLevels();
+
+ public int getLevel(ItemStack stack);
+
+ public int[] getLevels();
}
diff --git a/src/main/java/ab/api/IRenderHud.java b/src/main/java/ab/api/IRenderHud.java
index 04558bc..f194a24 100644
--- a/src/main/java/ab/api/IRenderHud.java
+++ b/src/main/java/ab/api/IRenderHud.java
@@ -5,5 +5,5 @@ import net.minecraft.client.gui.ScaledResolution;
public interface IRenderHud {
- public void renderHud(Minecraft mc, ScaledResolution res);
+ public void renderHud(Minecraft mc, ScaledResolution res);
}
diff --git a/src/main/java/ab/api/TerraFarmlandList.java b/src/main/java/ab/api/TerraFarmlandList.java
index 05c90da..092a27b 100644
--- a/src/main/java/ab/api/TerraFarmlandList.java
+++ b/src/main/java/ab/api/TerraFarmlandList.java
@@ -4,19 +4,19 @@ import net.minecraft.block.Block;
public class TerraFarmlandList {
- Block block;
- int meta;
-
- public TerraFarmlandList(Block block, int meta) {
- this.block = block;
- this.meta = meta;
- }
-
- public Block getBlock() {
- return block;
- }
-
- public int getMeta() {
- return meta;
- }
+ Block block;
+ int meta;
+
+ public TerraFarmlandList(Block block, int meta) {
+ this.block = block;
+ this.meta = meta;
+ }
+
+ public Block getBlock() {
+ return block;
+ }
+
+ public int getMeta() {
+ return meta;
+ }
}
diff --git a/src/main/java/ab/api/recipe/RecipeAdvancedPlate.java b/src/main/java/ab/api/recipe/RecipeAdvancedPlate.java
index 72a3895..d17cb8d 100644
--- a/src/main/java/ab/api/recipe/RecipeAdvancedPlate.java
+++ b/src/main/java/ab/api/recipe/RecipeAdvancedPlate.java
@@ -8,63 +8,60 @@ import net.minecraft.item.ItemStack;
public class RecipeAdvancedPlate {
- private ItemStack output;
- private int color;
- private List inputs;
- private int mana;
-
- public RecipeAdvancedPlate(ItemStack output, int mana, int color, ItemStack... inputs) {
- this.output = output;
- this.mana = mana;
- this.color = color;
- List inputsToSet = new ArrayList();
- for (ItemStack obj : inputs)
- inputsToSet.add(obj);
- this.inputs = inputsToSet;
- }
-
- public List getInputs() {
- return new ArrayList(this.inputs);
- }
-
- public ItemStack getOutput() {
- return this.output;
- }
-
- public int getManaUsage() {
- return this.mana;
- }
-
- public int getColor() {
- return this.color;
- }
-
- public boolean matches(IInventory inv) {
- List inputsMissing = new ArrayList(this.inputs);
- for (int i = 1; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if (stack == null)
- break;
- int stackIndex = -1;
- for (int j = 0; j < inputsMissing.size(); j++) {
- ItemStack input = inputsMissing.get(j);
- if (input instanceof ItemStack && simpleAreStacksEqual(input.copy(), stack)) {
- stackIndex = j;
- break;
- }
- }
- if (stackIndex != -1) {
- inputsMissing.remove(stackIndex);
- } else {
- return false;
- }
- }
- return inputsMissing.isEmpty();
- }
-
- boolean simpleAreStacksEqual(ItemStack input, ItemStack stack) {
- if(input.getItemDamage() == 32767)
- input.setItemDamage(stack.getItemDamage());
- return (input.getItem() == stack.getItem() && input.getItemDamage() == stack.getItemDamage());
- }
+ private ItemStack output;
+ private int color;
+ private List inputs;
+ private int mana;
+
+ public RecipeAdvancedPlate(ItemStack output, int mana, int color, ItemStack... inputs) {
+ this.output = output;
+ this.mana = mana;
+ this.color = color;
+ List inputsToSet = new ArrayList();
+ for (ItemStack obj : inputs) inputsToSet.add(obj);
+ this.inputs = inputsToSet;
+ }
+
+ public List getInputs() {
+ return new ArrayList(this.inputs);
+ }
+
+ public ItemStack getOutput() {
+ return this.output;
+ }
+
+ public int getManaUsage() {
+ return this.mana;
+ }
+
+ public int getColor() {
+ return this.color;
+ }
+
+ public boolean matches(IInventory inv) {
+ List inputsMissing = new ArrayList(this.inputs);
+ for (int i = 1; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack == null) break;
+ int stackIndex = -1;
+ for (int j = 0; j < inputsMissing.size(); j++) {
+ ItemStack input = inputsMissing.get(j);
+ if (input instanceof ItemStack && simpleAreStacksEqual(input.copy(), stack)) {
+ stackIndex = j;
+ break;
+ }
+ }
+ if (stackIndex != -1) {
+ inputsMissing.remove(stackIndex);
+ } else {
+ return false;
+ }
+ }
+ return inputsMissing.isEmpty();
+ }
+
+ boolean simpleAreStacksEqual(ItemStack input, ItemStack stack) {
+ if (input.getItemDamage() == 32767) input.setItemDamage(stack.getItemDamage());
+ return (input.getItem() == stack.getItem() && input.getItemDamage() == stack.getItemDamage());
+ }
}
diff --git a/src/main/java/ab/api/recipe/RecipeAncientAlphirine.java b/src/main/java/ab/api/recipe/RecipeAncientAlphirine.java
index b690667..9210587 100644
--- a/src/main/java/ab/api/recipe/RecipeAncientAlphirine.java
+++ b/src/main/java/ab/api/recipe/RecipeAncientAlphirine.java
@@ -1,40 +1,36 @@
package ab.api.recipe;
-import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class RecipeAncientAlphirine {
- private ItemStack output;
- private ItemStack input;
- private int chance;
-
- public RecipeAncientAlphirine(ItemStack output, ItemStack input, int chance) {
- this.output = output;
- this.input = input;
- if(chance > 100)
- chance = 100;
- else if(chance <= 0)
- chance = 1;
- this.chance = chance;
- }
-
- public ItemStack getOutput() {
- return output;
- }
-
- public ItemStack getInput() {
- return input;
- }
-
- public int getChance() {
- return chance;
- }
-
- public boolean matches(ItemStack stack) {
- ItemStack inputCopy = this.input.copy();
- if(inputCopy.getItemDamage() == 32767)
- inputCopy.setItemDamage(stack.getItemDamage());
- return stack.getItem() == input.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
- }
+ private ItemStack output;
+ private ItemStack input;
+ private int chance;
+
+ public RecipeAncientAlphirine(ItemStack output, ItemStack input, int chance) {
+ this.output = output;
+ this.input = input;
+ if (chance > 100) chance = 100;
+ else if (chance <= 0) chance = 1;
+ this.chance = chance;
+ }
+
+ public ItemStack getOutput() {
+ return output;
+ }
+
+ public ItemStack getInput() {
+ return input;
+ }
+
+ public int getChance() {
+ return chance;
+ }
+
+ public boolean matches(ItemStack stack) {
+ ItemStack inputCopy = this.input.copy();
+ if (inputCopy.getItemDamage() == 32767) inputCopy.setItemDamage(stack.getItemDamage());
+ return stack.getItem() == input.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
+ }
}
diff --git a/src/main/java/ab/api/recipe/lexicon/AdvancedPlateCraftPage.java b/src/main/java/ab/api/recipe/lexicon/AdvancedPlateCraftPage.java
index 47994fa..3fc7db7 100644
--- a/src/main/java/ab/api/recipe/lexicon/AdvancedPlateCraftPage.java
+++ b/src/main/java/ab/api/recipe/lexicon/AdvancedPlateCraftPage.java
@@ -3,14 +3,6 @@ package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.AdvancedBotanyAPI;
-import ab.api.recipe.RecipeAdvancedPlate;
-import ab.client.core.ClientHelper;
-import ab.common.lib.register.BlockListAB;
-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.client.gui.GuiScreen;
@@ -18,104 +10,114 @@ import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.client.core.handler.ClientTickHandler;
-import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.page.PageRecipe;
+import ab.api.AdvancedBotanyAPI;
+import ab.api.recipe.RecipeAdvancedPlate;
+import ab.client.core.ClientHelper;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class AdvancedPlateCraftPage extends PageRecipe {
-
- private static final ResourceLocation plateOverlay = new ResourceLocation("botania:textures/gui/petalOverlay.png");
- private RecipeAdvancedPlate recipe;
- private final ItemStack resultStack;
- int ticksElapsed = 0;
- public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack) {
- this(entry, stack, "");
- }
-
- public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack, String str) {
- super(str);
- resultStack = stack;
- refreshRecipe(entry, stack);
- }
-
- public ItemStack getResult() {
- return resultStack;
- }
-
- public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
- RecipeAdvancedPlate rec = null;
- for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
- if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
- rec = recipe;
- break;
- }
- }
- if(rec == null)
- entry.pages.remove(this);
- recipe = rec;
- }
-
- public void onPageAdded(LexiconEntry entry, int index) {
- LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
- }
-
- @SideOnly(Side.CLIENT)
- public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
- TextureManager render = (Minecraft.getMinecraft()).renderEngine;
- renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
- renderItemAtGridPos(gui, 2, 1, new ItemStack(BlockListAB.blockABPlate), false);
- List inputs = recipe.getInputs();
- int degreePerInput = (int)(360.0F / inputs.size());
- float currentDegree = ConfigHandler.lexiconRotatingItems ? (GuiScreen.isShiftKeyDown() ? this.ticksElapsed : (this.ticksElapsed + ClientTickHandler.partialTicks)) : 0.0F;
- for (ItemStack obj : inputs) {
- ItemStack copy = obj.copy();
- if (copy.getItemDamage() == 32767)
- copy.setItemDamage(0);
- renderItemAtAngle(gui, currentDegree, copy);
- currentDegree += degreePerInput;
- }
- renderManaBar(gui, mx, my);
- render.bindTexture(plateOverlay);
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- ((GuiScreen)gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
- GL11.glDisable(3042);
- }
-
- @SideOnly(Side.CLIENT)
- public void renderManaBar(IGuiLexiconEntry gui, int mx, int my) {
- FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
- font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 1711276032);
- int x = gui.getLeft() + gui.getWidth() / 2 - 50;
- int y = gui.getTop() + 120;
- String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
- ClientHelper.renderPoolManaBar(x, y - 5, 0x239ddc, 1.0f, this.recipe.getManaUsage());
- boolean unicode = font.getUnicodeFlag();
- font.setUnicodeFlag(true);
- font.drawString(stopStr, x + 49 - font.getStringWidth(stopStr) / 2, y + 18, -1728053248);
- font.setUnicodeFlag(unicode);
- GL11.glDisable(3042);
- }
-
- @SideOnly(Side.CLIENT)
- public void updateScreen() {
- if (GuiScreen.isShiftKeyDown())
- return;
- this.ticksElapsed++;
- }
-
- public List getDisplayedRecipes() {
- ArrayList list = new ArrayList();
- list.add(recipe.getOutput());
- return list;
- }
+ private static final ResourceLocation plateOverlay = new ResourceLocation("botania:textures/gui/petalOverlay.png");
+ private RecipeAdvancedPlate recipe;
+ private final ItemStack resultStack;
+ int ticksElapsed = 0;
+
+ public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack) {
+ this(entry, stack, "");
+ }
+
+ public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack, String str) {
+ super(str);
+ resultStack = stack;
+ refreshRecipe(entry, stack);
+ }
+
+ public ItemStack getResult() {
+ return resultStack;
+ }
+
+ public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
+ RecipeAdvancedPlate rec = null;
+ for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
+ if (stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
+ rec = recipe;
+ break;
+ }
+ }
+ if (rec == null) entry.pages.remove(this);
+ recipe = rec;
+ }
+
+ public void onPageAdded(LexiconEntry entry, int index) {
+ LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
+ TextureManager render = (Minecraft.getMinecraft()).renderEngine;
+ renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
+ renderItemAtGridPos(gui, 2, 1, new ItemStack(BlockListAB.blockABPlate), false);
+ List inputs = recipe.getInputs();
+ int degreePerInput = (int) (360.0F / inputs.size());
+ float currentDegree = ConfigHandler.lexiconRotatingItems ? (GuiScreen.isShiftKeyDown() ? this.ticksElapsed
+ : (this.ticksElapsed + ClientTickHandler.partialTicks)) : 0.0F;
+ for (ItemStack obj : inputs) {
+ ItemStack copy = obj.copy();
+ if (copy.getItemDamage() == 32767) copy.setItemDamage(0);
+ renderItemAtAngle(gui, currentDegree, copy);
+ currentDegree += degreePerInput;
+ }
+ renderManaBar(gui, mx, my);
+ render.bindTexture(plateOverlay);
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
+ GL11.glDisable(3042);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void renderManaBar(IGuiLexiconEntry gui, int mx, int my) {
+ FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
+ font.drawString(
+ manaUsage,
+ gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2,
+ gui.getTop() + 105,
+ 1711276032);
+ int x = gui.getLeft() + gui.getWidth() / 2 - 50;
+ int y = gui.getTop() + 120;
+ String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
+ ClientHelper.renderPoolManaBar(x, y - 5, 0x239ddc, 1.0f, this.recipe.getManaUsage());
+ boolean unicode = font.getUnicodeFlag();
+ font.setUnicodeFlag(true);
+ font.drawString(stopStr, x + 49 - font.getStringWidth(stopStr) / 2, y + 18, -1728053248);
+ font.setUnicodeFlag(unicode);
+ GL11.glDisable(3042);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateScreen() {
+ if (GuiScreen.isShiftKeyDown()) return;
+ this.ticksElapsed++;
+ }
+
+ public List getDisplayedRecipes() {
+ ArrayList list = new ArrayList();
+ list.add(recipe.getOutput());
+ return list;
+ }
}
diff --git a/src/main/java/ab/api/recipe/lexicon/AlphirineCraftPage.java b/src/main/java/ab/api/recipe/lexicon/AlphirineCraftPage.java
index 5e70d5b..dffa016 100644
--- a/src/main/java/ab/api/recipe/lexicon/AlphirineCraftPage.java
+++ b/src/main/java/ab/api/recipe/lexicon/AlphirineCraftPage.java
@@ -3,14 +3,6 @@ package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.AdvancedBotanyAPI;
-import ab.api.recipe.RecipeAdvancedPlate;
-import ab.api.recipe.RecipeAncientAlphirine;
-import ab.client.core.ClientHelper;
-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.client.gui.GuiScreen;
@@ -19,79 +11,91 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lexicon.page.PageRecipe;
-import vazkii.botania.common.lexicon.page.PageText;
+import ab.api.AdvancedBotanyAPI;
+import ab.api.recipe.RecipeAncientAlphirine;
+import ab.client.core.ClientHelper;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class AlphirineCraftPage extends PageRecipe {
-
- private static final ResourceLocation alphirineOverlay = new ResourceLocation("botania:textures/gui/pureDaisyOverlay.png");
- private RecipeAncientAlphirine recipe;
- private final ItemStack resultStack;
-
- public AlphirineCraftPage(LexiconEntry entry, ItemStack stack) {
- this(entry, stack, "");
- }
-
- public AlphirineCraftPage(LexiconEntry entry, ItemStack stack, String str) {
- super(str);
- resultStack = stack;
- refreshRecipe(entry, stack);
- }
-
- public ItemStack getResult() {
- return resultStack;
- }
-
- public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
- RecipeAncientAlphirine rec = null;
- for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
- if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
- rec = recipe;
- break;
- }
- }
- if(rec == null)
- entry.pages.remove(this);
- recipe = rec;
- }
-
- public void onPageAdded(LexiconEntry entry, int index) {
- LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
- }
-
- @SideOnly(Side.CLIENT)
- public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
- TextureManager render = (Minecraft.getMinecraft()).renderEngine;
- FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- render.bindTexture(alphirineOverlay);
- ((GuiScreen)gui).drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
- ItemStack inp = recipe.getInput().copy();
- if(inp.getItemDamage() == 32767)
- inp.setItemDamage(0);
- this.renderItem(gui, gui.getLeft() + 34, gui.getTop() + 59, inp, false);
- this.renderItem(gui, gui.getLeft() + 62, gui.getTop() + 57, ItemBlockSpecialFlower.ofType("ancientAlphirine").copy(), false);
- this.renderItem(gui, gui.getLeft() + 93, gui.getTop() + 54, recipe.getOutput().copy(), false);
- int x = gui.getLeft() + gui.getWidth() / 2 - 50;
- int y = gui.getTop() + 85;
- String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
- boolean unicode = font.getUnicodeFlag();
- font.setUnicodeFlag(true);
- font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
- font.setUnicodeFlag(unicode);
- ClientHelper.drawChanceBar(x + 21, y + 14, recipe.getChance());
- GL11.glDisable(3042);
- }
-
- public List getDisplayedRecipes() {
- ArrayList list = new ArrayList();
- list.add(recipe.getOutput());
- return list;
- }
+
+ private static final ResourceLocation alphirineOverlay = new ResourceLocation(
+ "botania:textures/gui/pureDaisyOverlay.png");
+ private RecipeAncientAlphirine recipe;
+ private final ItemStack resultStack;
+
+ public AlphirineCraftPage(LexiconEntry entry, ItemStack stack) {
+ this(entry, stack, "");
+ }
+
+ public AlphirineCraftPage(LexiconEntry entry, ItemStack stack, String str) {
+ super(str);
+ resultStack = stack;
+ refreshRecipe(entry, stack);
+ }
+
+ public ItemStack getResult() {
+ return resultStack;
+ }
+
+ public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
+ RecipeAncientAlphirine rec = null;
+ for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
+ if (stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
+ rec = recipe;
+ break;
+ }
+ }
+ if (rec == null) entry.pages.remove(this);
+ recipe = rec;
+ }
+
+ public void onPageAdded(LexiconEntry entry, int index) {
+ LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
+ TextureManager render = (Minecraft.getMinecraft()).renderEngine;
+ FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ render.bindTexture(alphirineOverlay);
+ ((GuiScreen) gui)
+ .drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
+ ItemStack inp = recipe.getInput().copy();
+ if (inp.getItemDamage() == 32767) inp.setItemDamage(0);
+ this.renderItem(gui, gui.getLeft() + 34, gui.getTop() + 59, inp, false);
+ this.renderItem(
+ gui,
+ gui.getLeft() + 62,
+ gui.getTop() + 57,
+ ItemBlockSpecialFlower.ofType("ancientAlphirine").copy(),
+ false);
+ this.renderItem(gui, gui.getLeft() + 93, gui.getTop() + 54, recipe.getOutput().copy(), false);
+ int x = gui.getLeft() + gui.getWidth() / 2 - 50;
+ int y = gui.getTop() + 85;
+ String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
+ boolean unicode = font.getUnicodeFlag();
+ font.setUnicodeFlag(true);
+ font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
+ font.setUnicodeFlag(unicode);
+ ClientHelper.drawChanceBar(x + 21, y + 14, recipe.getChance());
+ GL11.glDisable(3042);
+ }
+
+ public List getDisplayedRecipes() {
+ ArrayList list = new ArrayList();
+ list.add(recipe.getOutput());
+ return list;
+ }
}
diff --git a/src/main/java/ab/client/core/ClientHelper.java b/src/main/java/ab/client/core/ClientHelper.java
index b703be4..6f1c27a 100644
--- a/src/main/java/ab/client/core/ClientHelper.java
+++ b/src/main/java/ab/client/core/ClientHelper.java
@@ -4,239 +4,241 @@ import java.awt.Color;
import java.nio.FloatBuffer;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.Vector3;
public class ClientHelper {
-
- public static final ResourceLocation miscHuds = new ResourceLocation("ab:textures/misc/miscHuds.png");
- private static final ResourceLocation field_147529_c = new ResourceLocation("textures/environment/end_sky.png");
- private static final ResourceLocation field_147526_d = new ResourceLocation("textures/entity/end_portal.png");
- private static final Random field_147527_e = new Random(31100L);
- public static Minecraft mc = Minecraft.getMinecraft();
- private static FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16);
-
- public static void renderCosmicBackground() {
- field_147527_e.setSeed(31100L);
- float f4 = 0.24F;
- for (int i = 0; i < 16; i++) {
- GL11.glPushMatrix();
- float f5 = (16 - i);
- float f6 = 0.0625F;
- float f7 = 1.0F / (f5 + 1.0F);
- if (i == 0) {
- mc.renderEngine.bindTexture(field_147529_c);
- f7 = 0.1F;
- f5 = 65.0F;
- f6 = 0.125F;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- }
- if (i == 1) {
- mc.renderEngine.bindTexture(field_147526_d);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
- f6 = 0.5F;
- }
- GL11.glTranslatef(0.0f, 1.5f, 0.0f);
- GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
- GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
- GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
- GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
- GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
- GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
- GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
- GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
- GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
- GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
- GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
- GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
- GL11.glPopMatrix();
- GL11.glMatrixMode(GL11.GL_TEXTURE);
- GL11.glPushMatrix();
- GL11.glLoadIdentity();
- GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 20000L) / 20000.0F, 0.0F);
- GL11.glScalef(f6, f6, f6);
- GL11.glTranslatef(0.5F, 0.5F, 0.0F);
- GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
- GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
- Tessellator tessellator = Tessellator.instance;
- tessellator.startDrawingQuads();
- Color color = Color.getHSBColor((float)Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
- float f11 = color.getRed() / 255.0F;
- float f12 = color.getGreen() / 255.0F;
- float f13 = color.getBlue() / 255.0F;
- tessellator.setBrightness(60);
- tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
- tessellator.addVertex(0.0D, f4, 0.0D);
- tessellator.addVertex(0.0D, f4, 1.0D);
- tessellator.addVertex(1.0D, f4, 1.0D);
- tessellator.addVertex(1.0D, f4, 0.0D);
- tessellator.draw();
- GL11.glPopMatrix();
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- }
- GL11.glDisable(GL11.GL_BLEND);
+
+ public static final ResourceLocation miscHuds = new ResourceLocation("ab:textures/misc/miscHuds.png");
+ private static final ResourceLocation field_147529_c = new ResourceLocation("textures/environment/end_sky.png");
+ private static final ResourceLocation field_147526_d = new ResourceLocation("textures/entity/end_portal.png");
+ private static final Random field_147527_e = new Random(31100L);
+ public static Minecraft mc = Minecraft.getMinecraft();
+ private static FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16);
+
+ public static void renderCosmicBackground() {
+ field_147527_e.setSeed(31100L);
+ float f4 = 0.24F;
+ for (int i = 0; i < 16; i++) {
+ GL11.glPushMatrix();
+ float f5 = (16 - i);
+ float f6 = 0.0625F;
+ float f7 = 1.0F / (f5 + 1.0F);
+ if (i == 0) {
+ mc.renderEngine.bindTexture(field_147529_c);
+ f7 = 0.1F;
+ f5 = 65.0F;
+ f6 = 0.125F;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ }
+ if (i == 1) {
+ mc.renderEngine.bindTexture(field_147526_d);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
+ f6 = 0.5F;
+ }
+ GL11.glTranslatef(0.0f, 1.5f, 0.0f);
+ GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
+ GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
+ GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
+ GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
+ GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
+ GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
+ GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
+ GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
+ GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
+ GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
+ GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
+ GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
+ GL11.glPopMatrix();
+ GL11.glMatrixMode(GL11.GL_TEXTURE);
+ GL11.glPushMatrix();
+ GL11.glLoadIdentity();
+ GL11.glTranslatef(0.0F, (float) (Minecraft.getSystemTime() % 20000L) / 20000.0F, 0.0F);
+ GL11.glScalef(f6, f6, f6);
+ GL11.glTranslatef(0.5F, 0.5F, 0.0F);
+ GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
+ Tessellator tessellator = Tessellator.instance;
+ tessellator.startDrawingQuads();
+ Color color = Color.getHSBColor((float) Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
+ float f11 = color.getRed() / 255.0F;
+ float f12 = color.getGreen() / 255.0F;
+ float f13 = color.getBlue() / 255.0F;
+ tessellator.setBrightness(60);
+ tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
+ tessellator.addVertex(0.0D, f4, 0.0D);
+ tessellator.addVertex(0.0D, f4, 1.0D);
+ tessellator.addVertex(1.0D, f4, 1.0D);
+ tessellator.addVertex(1.0D, f4, 0.0D);
+ tessellator.draw();
+ GL11.glPopMatrix();
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ }
+ GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
- }
-
- private static FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) {
- field_147528_b.clear();
- field_147528_b.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_);
- field_147528_b.flip();
- return field_147528_b;
- }
-
- public static void drawArrow(int x, int y, boolean side) {
- mc.renderEngine.bindTexture(miscHuds);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
- vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 10, side ? 0 : 22, 38);
- }
-
- public static void drawChanceBar(int x, int y, int chance) {
- mc.renderEngine.bindTexture(miscHuds);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
- vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 0, 57, 6);
- int chancePercentage = Math.max(0, (int)((chance / 100.f) * 55.0D));
- vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, 55, 4);
- Color color = new Color(Color.HSBtoRGB((chance) / 360.0f, ((float)Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2D) + 1.0F) * 0.3F + 0.4F, 1.0f));
- GL11.glColor4ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue(), (byte)255);
- vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, Math.min(55, chancePercentage), 4);
- }
-
- public static void renderPoolManaBar(int x, int y, int color, float alpha, int mana) {
- Minecraft mc = Minecraft.getMinecraft();
- int poolCount = (int)Math.floor(mana / 1000000.0D);
- if(poolCount < 0)
- poolCount = 0;
- int onePoolMana = mana - (poolCount * 1000000);
- String strPool = poolCount + "x";
- int xc = x - mc.fontRenderer.getStringWidth(strPool) / 2;
- int yc = y;
- GL11.glPushMatrix();
- GL11.glTranslatef(xc + 42.0f, yc + 5.0f, 0.0f);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
- RenderHelper.disableStandardItemLighting();
- GL11.glTranslatef(18.0f, 5.0f, 300.0f);
- mc.fontRenderer.drawString(strPool, 0, 0, color);
- GL11.glPopMatrix();
- if((poolCount * 1000000) == mana)
- onePoolMana = poolCount * 1000000;
- HUDHandler.renderManaBar(x, y, color, alpha, onePoolMana, 1000000);
- }
-
- public static void drawPoolManaHUD(ScaledResolution res, String name, int mana, int maxMana, int color) {
- Minecraft mc = Minecraft.getMinecraft();
- int poolCount = (int)Math.floor(mana / 1000000.0D);
- int maxPoolCount = (int)Math.floor(maxMana / 1000000.0D);
- if(poolCount < 0)
- poolCount = 0;
- if(maxPoolCount < 0)
- maxPoolCount = 0;
- int onePoolMana = mana - (poolCount * 1000000);
- String strPool = poolCount + "x / " + maxPoolCount + "x";
- int xc = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(strPool) / 2 - 3;
- int yc = res.getScaledHeight() / 2;
- GL11.glPushMatrix();
- GL11.glTranslatef(xc - 6.0f, yc + 30.0f, 0.0f);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
- RenderHelper.disableStandardItemLighting();
- GL11.glTranslatef(18.0f, 4.5f, 300.0f);
- mc.fontRenderer.drawStringWithShadow(strPool, 0, 0, color);
- GL11.glPopMatrix();
- if((poolCount * 1000000) == mana)
- onePoolMana = poolCount * 1000000;
- HUDHandler.drawSimpleManaHUD(color, onePoolMana, 1000000, name, res);
- }
-
- public static void setLightmapTextureCoords() {
- int light = 15728880;
- int lightmapX = light % 65536;
- int lightmapY = light / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
- }
-
- public static Vector3 setRotation(float angel, float vX, float vY, float vZ, Vector3 v3) {
- Vector3 rVec = new Vector3(vX, vY, vZ);
- Vector3 rVec1 = v3.copy().normalize();
- double rAngel = Math.toRadians(angel) * 0.5f;
- double sin = Math.sin(rAngel);
- double x = rVec.x * sin;
- double y = rVec.y * sin;
- double z = rVec.z * sin;
- rAngel = Math.cos(rAngel);
- double d = -x * rVec1.x - y * rVec1.y - z * rVec1.z;
- double d1 = rAngel * rVec1.x + y * rVec1.z - z * rVec1.y;
- double d2 = rAngel * rVec1.y - x * rVec1.z + z * rVec1.x;
- double d3 = rAngel * rVec1.z + x * rVec1.y - y * rVec1.x;
- v3.x = d1 * rAngel - d * x - d2 * z + d3 * y;
- v3.y = d2 * rAngel - d * y + d1 * z - d3 * x;
- v3.z = d3 * rAngel - d * z - d1 * y + d2 * x;
- return v3;
- }
-
- public static Color getCorporeaRuneColor(int posX, int posY, int posZ, int meta) {
- double time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
- time += (new Random((posX ^ posY ^ posZ))).nextInt(360);
- float sin = (float)(Math.sin(time / 20.0f) * 0.15f) - 0.15f;
- int color = 0;
- switch(meta) {
- case 0:
- color = Color.HSBtoRGB(0.0f, 0.0f, 0.54f + (sin / 1.2f));
- break;
- case 1:
- color = Color.HSBtoRGB(0.688f, 0.93f, 0.96f + sin - 0.15f);
- break;
- case 2:
- color = Color.HSBtoRGB(0.983f, 0.99f, 1.0f + sin - 0.15f);
- break;
- case 3:
- color = Color.HSBtoRGB(0.319f, 0.92f, 0.95f + sin - 0.15f);
- break;
- case 4:
- color = Color.HSBtoRGB(0.536f, 0.53f, 0.92f + sin - 0.15f);
- break;
- }
- return new Color(color);
- }
-
- public static void renderIcon(IIcon icon, int light) {
- Tessellator tessellator = Tessellator.instance;
- float f = icon.getMinU();
- float f1 = icon.getMaxU();
- float f2 = icon.getMinV();
- float f3 = icon.getMaxV();
- float f4 = 1.0F;
- float f5 = 0.5F;
- float f6 = 0.25F;
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- tessellator.addVertexWithUV((0.0F - f5), (0.0F - f6), 0.0D, f, f3);
- tessellator.addVertexWithUV((f4 - f5), (0.0F - f6), 0.0D, f1, f3);
- tessellator.addVertexWithUV((f4 - f5), (f4 - f6), 0.0D, f1, f2);
- tessellator.addVertexWithUV((0.0F - f5), (f4 - f6), 0.0D, f, f2);
- tessellator.draw();
- }
-}
\ No newline at end of file
+ }
+
+ private static FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_,
+ float p_147525_4_) {
+ field_147528_b.clear();
+ field_147528_b.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_);
+ field_147528_b.flip();
+ return field_147528_b;
+ }
+
+ public static void drawArrow(int x, int y, boolean side) {
+ mc.renderEngine.bindTexture(miscHuds);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
+ vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 10, side ? 0 : 22, 38);
+ }
+
+ public static void drawChanceBar(int x, int y, int chance) {
+ mc.renderEngine.bindTexture(miscHuds);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
+ vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 0, 57, 6);
+ int chancePercentage = Math.max(0, (int) ((chance / 100.f) * 55.0D));
+ vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, 55, 4);
+ Color color = new Color(
+ Color.HSBtoRGB(
+ (chance) / 360.0f,
+ ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2D)
+ + 1.0F) * 0.3F + 0.4F,
+ 1.0f));
+ GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
+ vazkii.botania.client.core.helper.RenderHelper
+ .drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, Math.min(55, chancePercentage), 4);
+ }
+
+ public static void renderPoolManaBar(int x, int y, int color, float alpha, int mana) {
+ Minecraft mc = Minecraft.getMinecraft();
+ int poolCount = (int) Math.floor(mana / 1000000.0D);
+ if (poolCount < 0) poolCount = 0;
+ int onePoolMana = mana - (poolCount * 1000000);
+ String strPool = poolCount + "x";
+ int xc = x - mc.fontRenderer.getStringWidth(strPool) / 2;
+ int yc = y;
+ GL11.glPushMatrix();
+ GL11.glTranslatef(xc + 42.0f, yc + 5.0f, 0.0f);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance()
+ .renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glTranslatef(18.0f, 5.0f, 300.0f);
+ mc.fontRenderer.drawString(strPool, 0, 0, color);
+ GL11.glPopMatrix();
+ if ((poolCount * 1000000) == mana) onePoolMana = poolCount * 1000000;
+ HUDHandler.renderManaBar(x, y, color, alpha, onePoolMana, 1000000);
+ }
+
+ public static void drawPoolManaHUD(ScaledResolution res, String name, int mana, int maxMana, int color) {
+ Minecraft mc = Minecraft.getMinecraft();
+ int poolCount = (int) Math.floor(mana / 1000000.0D);
+ int maxPoolCount = (int) Math.floor(maxMana / 1000000.0D);
+ if (poolCount < 0) poolCount = 0;
+ if (maxPoolCount < 0) maxPoolCount = 0;
+ int onePoolMana = mana - (poolCount * 1000000);
+ String strPool = poolCount + "x / " + maxPoolCount + "x";
+ int xc = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(strPool) / 2 - 3;
+ int yc = res.getScaledHeight() / 2;
+ GL11.glPushMatrix();
+ GL11.glTranslatef(xc - 6.0f, yc + 30.0f, 0.0f);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance()
+ .renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glTranslatef(18.0f, 4.5f, 300.0f);
+ mc.fontRenderer.drawStringWithShadow(strPool, 0, 0, color);
+ GL11.glPopMatrix();
+ if ((poolCount * 1000000) == mana) onePoolMana = poolCount * 1000000;
+ HUDHandler.drawSimpleManaHUD(color, onePoolMana, 1000000, name, res);
+ }
+
+ public static void setLightmapTextureCoords() {
+ int light = 15728880;
+ int lightmapX = light % 65536;
+ int lightmapY = light / 65536;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
+ }
+
+ public static Vector3 setRotation(float angel, float vX, float vY, float vZ, Vector3 v3) {
+ Vector3 rVec = new Vector3(vX, vY, vZ);
+ Vector3 rVec1 = v3.copy().normalize();
+ double rAngel = Math.toRadians(angel) * 0.5f;
+ double sin = Math.sin(rAngel);
+ double x = rVec.x * sin;
+ double y = rVec.y * sin;
+ double z = rVec.z * sin;
+ rAngel = Math.cos(rAngel);
+ double d = -x * rVec1.x - y * rVec1.y - z * rVec1.z;
+ double d1 = rAngel * rVec1.x + y * rVec1.z - z * rVec1.y;
+ double d2 = rAngel * rVec1.y - x * rVec1.z + z * rVec1.x;
+ double d3 = rAngel * rVec1.z + x * rVec1.y - y * rVec1.x;
+ v3.x = d1 * rAngel - d * x - d2 * z + d3 * y;
+ v3.y = d2 * rAngel - d * y + d1 * z - d3 * x;
+ v3.z = d3 * rAngel - d * z - d1 * y + d2 * x;
+ return v3;
+ }
+
+ public static Color getCorporeaRuneColor(int posX, int posY, int posZ, int meta) {
+ double time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
+ time += (new Random((posX ^ posY ^ posZ))).nextInt(360);
+ float sin = (float) (Math.sin(time / 20.0f) * 0.15f) - 0.15f;
+ int color = 0;
+ switch (meta) {
+ case 0:
+ color = Color.HSBtoRGB(0.0f, 0.0f, 0.54f + (sin / 1.2f));
+ break;
+ case 1:
+ color = Color.HSBtoRGB(0.688f, 0.93f, 0.96f + sin - 0.15f);
+ break;
+ case 2:
+ color = Color.HSBtoRGB(0.983f, 0.99f, 1.0f + sin - 0.15f);
+ break;
+ case 3:
+ color = Color.HSBtoRGB(0.319f, 0.92f, 0.95f + sin - 0.15f);
+ break;
+ case 4:
+ color = Color.HSBtoRGB(0.536f, 0.53f, 0.92f + sin - 0.15f);
+ break;
+ }
+ return new Color(color);
+ }
+
+ public static void renderIcon(IIcon icon, int light) {
+ Tessellator tessellator = Tessellator.instance;
+ float f = icon.getMinU();
+ float f1 = icon.getMaxU();
+ float f2 = icon.getMinV();
+ float f3 = icon.getMaxV();
+ float f4 = 1.0F;
+ float f5 = 0.5F;
+ float f6 = 0.25F;
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ tessellator.addVertexWithUV((0.0F - f5), (0.0F - f6), 0.0D, f, f3);
+ tessellator.addVertexWithUV((f4 - f5), (0.0F - f6), 0.0D, f1, f3);
+ tessellator.addVertexWithUV((f4 - f5), (f4 - f6), 0.0D, f1, f2);
+ tessellator.addVertexWithUV((0.0F - f5), (f4 - f6), 0.0D, f, f2);
+ tessellator.draw();
+ }
+}
diff --git a/src/main/java/ab/client/core/handler/BoundRenderHandler.java b/src/main/java/ab/client/core/handler/BoundRenderHandler.java
index 8649878..5ec87a9 100644
--- a/src/main/java/ab/client/core/handler/BoundRenderHandler.java
+++ b/src/main/java/ab/client/core/handler/BoundRenderHandler.java
@@ -2,10 +2,6 @@ package ab.client.core.handler;
import java.awt.Color;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IBoundRender;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
@@ -19,111 +15,121 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.api.IBoundRender;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class BoundRenderHandler {
- @SubscribeEvent
- public void onWorldRenderLast(RenderWorldLastEvent event) {
- GL11.glPushMatrix();
- GL11.glPushAttrib(2896);
- GL11.glDisable(2929);
- GL11.glDisable(3553);
- GL11.glDisable(2896);
- GL11.glEnable(3042);
- Tessellator.renderingWorldRenderer = false;
- EntityClientPlayerMP entityClientPlayerMP = (Minecraft.getMinecraft()).thePlayer;
- ItemStack stack = entityClientPlayerMP.getCurrentEquippedItem();
- int color = Color.HSBtoRGB((ClientTickHandler.ticksInGame % 200) / 200.0F, 0.6F, 1.0F);
- if(stack != null && stack.getItem() instanceof ICoordBoundItem) {
- ChunkCoordinates[] coords = null;
- MovingObjectPosition pos = (Minecraft.getMinecraft()).objectMouseOver;
- if(pos != null) {
- TileEntity tile = (Minecraft.getMinecraft()).theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
- if(tile != null && tile instanceof IBoundRender)
- coords = ((IBoundRender)tile).getBlocksCoord();
- }
- if(coords != null)
- for(int i = 0; i < coords.length; i++) {
- if(coords[i].posY == -1)
- continue;
- renderBlockOutlineAt(coords[i], color, 1.0f);
- }
- }
- GL11.glEnable(2929);
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- GL11.glPopAttrib();
- GL11.glPopMatrix();
- }
-
- private void renderBlockOutlineAt(ChunkCoordinates pos, int color, float thickness) {
- GL11.glPushMatrix();
- GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1.0D);
- Color colorRGB = new Color(color);
- GL11.glColor4ub((byte)colorRGB.getRed(), (byte)colorRGB.getGreen(), (byte)colorRGB.getBlue(), (byte)-1);
- WorldClient worldClient = (Minecraft.getMinecraft()).theWorld;
- Block block = worldClient.getBlock(pos.posX, pos.posY, pos.posZ);
- if(block != null) {
- AxisAlignedBB axis;
- if(block instanceof IWireframeAABBProvider) {
- axis = ((IWireframeAABBProvider)block).getWireframeAABB((World)worldClient, pos.posX, pos.posY, pos.posZ);
- } else {
- axis = block.getSelectedBoundingBoxFromPool((World)worldClient, pos.posX, pos.posY, pos.posZ);
- }
- if(axis != null) {
- axis.minX -= pos.posX;
- axis.maxX -= pos.posX;
- axis.minY -= pos.posY;
- axis.maxY -= pos.posY;
- axis.minZ -= (pos.posZ + 1);
- axis.maxZ -= (pos.posZ + 1);
- GL11.glScalef(1.0F, 1.0F, 1.0F);
- GL11.glLineWidth(thickness);
- renderBlockOutline(axis);
- GL11.glLineWidth(thickness + 3.0F);
- GL11.glColor4ub((byte)colorRGB.getRed(), (byte)colorRGB.getGreen(), (byte)colorRGB.getBlue(), (byte)64);
- renderBlockOutline(axis);
- }
- }
- GL11.glPopMatrix();
- }
-
- private void renderBlockOutline(AxisAlignedBB aabb) {
- Tessellator tessellator = Tessellator.instance;
- double ix = aabb.minX;
- double iy = aabb.minY;
- double iz = aabb.minZ;
- double ax = aabb.maxX;
- double ay = aabb.maxY;
- double az = aabb.maxZ;
- tessellator.startDrawing(1);
- tessellator.addVertex(ix, iy, iz);
- tessellator.addVertex(ix, ay, iz);
- tessellator.addVertex(ix, ay, iz);
- tessellator.addVertex(ax, ay, iz);
- tessellator.addVertex(ax, ay, iz);
- tessellator.addVertex(ax, iy, iz);
- tessellator.addVertex(ax, iy, iz);
- tessellator.addVertex(ix, iy, iz);
- tessellator.addVertex(ix, iy, az);
- tessellator.addVertex(ix, ay, az);
- tessellator.addVertex(ix, iy, az);
- tessellator.addVertex(ax, iy, az);
- tessellator.addVertex(ax, iy, az);
- tessellator.addVertex(ax, ay, az);
- tessellator.addVertex(ix, ay, az);
- tessellator.addVertex(ax, ay, az);
- tessellator.addVertex(ix, iy, iz);
- tessellator.addVertex(ix, iy, az);
- tessellator.addVertex(ix, ay, iz);
- tessellator.addVertex(ix, ay, az);
- tessellator.addVertex(ax, iy, iz);
- tessellator.addVertex(ax, iy, az);
- tessellator.addVertex(ax, ay, iz);
- tessellator.addVertex(ax, ay, az);
- tessellator.draw();
- }
+ @SubscribeEvent
+ public void onWorldRenderLast(RenderWorldLastEvent event) {
+ GL11.glPushMatrix();
+ GL11.glPushAttrib(2896);
+ GL11.glDisable(2929);
+ GL11.glDisable(3553);
+ GL11.glDisable(2896);
+ GL11.glEnable(3042);
+ Tessellator.renderingWorldRenderer = false;
+ EntityClientPlayerMP entityClientPlayerMP = (Minecraft.getMinecraft()).thePlayer;
+ ItemStack stack = entityClientPlayerMP.getCurrentEquippedItem();
+ int color = Color.HSBtoRGB((ClientTickHandler.ticksInGame % 200) / 200.0F, 0.6F, 1.0F);
+ if (stack != null && stack.getItem() instanceof ICoordBoundItem) {
+ ChunkCoordinates[] coords = null;
+ MovingObjectPosition pos = (Minecraft.getMinecraft()).objectMouseOver;
+ if (pos != null) {
+ TileEntity tile = (Minecraft.getMinecraft()).theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
+ if (tile != null && tile instanceof IBoundRender) coords = ((IBoundRender) tile).getBlocksCoord();
+ }
+ if (coords != null) for (int i = 0; i < coords.length; i++) {
+ if (coords[i].posY == -1) continue;
+ renderBlockOutlineAt(coords[i], color, 1.0f);
+ }
+ }
+ GL11.glEnable(2929);
+ GL11.glEnable(3553);
+ GL11.glDisable(3042);
+ GL11.glPopAttrib();
+ GL11.glPopMatrix();
+ }
+
+ private void renderBlockOutlineAt(ChunkCoordinates pos, int color, float thickness) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(
+ pos.posX - RenderManager.renderPosX,
+ pos.posY - RenderManager.renderPosY,
+ pos.posZ - RenderManager.renderPosZ + 1.0D);
+ Color colorRGB = new Color(color);
+ GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) -1);
+ WorldClient worldClient = (Minecraft.getMinecraft()).theWorld;
+ Block block = worldClient.getBlock(pos.posX, pos.posY, pos.posZ);
+ if (block != null) {
+ AxisAlignedBB axis;
+ if (block instanceof IWireframeAABBProvider) {
+ axis = ((IWireframeAABBProvider) block)
+ .getWireframeAABB((World) worldClient, pos.posX, pos.posY, pos.posZ);
+ } else {
+ axis = block.getSelectedBoundingBoxFromPool((World) worldClient, pos.posX, pos.posY, pos.posZ);
+ }
+ if (axis != null) {
+ axis.minX -= pos.posX;
+ axis.maxX -= pos.posX;
+ axis.minY -= pos.posY;
+ axis.maxY -= pos.posY;
+ axis.minZ -= (pos.posZ + 1);
+ axis.maxZ -= (pos.posZ + 1);
+ GL11.glScalef(1.0F, 1.0F, 1.0F);
+ GL11.glLineWidth(thickness);
+ renderBlockOutline(axis);
+ GL11.glLineWidth(thickness + 3.0F);
+ GL11.glColor4ub(
+ (byte) colorRGB.getRed(),
+ (byte) colorRGB.getGreen(),
+ (byte) colorRGB.getBlue(),
+ (byte) 64);
+ renderBlockOutline(axis);
+ }
+ }
+ GL11.glPopMatrix();
+ }
+
+ private void renderBlockOutline(AxisAlignedBB aabb) {
+ Tessellator tessellator = Tessellator.instance;
+ double ix = aabb.minX;
+ double iy = aabb.minY;
+ double iz = aabb.minZ;
+ double ax = aabb.maxX;
+ double ay = aabb.maxY;
+ double az = aabb.maxZ;
+ tessellator.startDrawing(1);
+ tessellator.addVertex(ix, iy, iz);
+ tessellator.addVertex(ix, ay, iz);
+ tessellator.addVertex(ix, ay, iz);
+ tessellator.addVertex(ax, ay, iz);
+ tessellator.addVertex(ax, ay, iz);
+ tessellator.addVertex(ax, iy, iz);
+ tessellator.addVertex(ax, iy, iz);
+ tessellator.addVertex(ix, iy, iz);
+ tessellator.addVertex(ix, iy, az);
+ tessellator.addVertex(ix, ay, az);
+ tessellator.addVertex(ix, iy, az);
+ tessellator.addVertex(ax, iy, az);
+ tessellator.addVertex(ax, iy, az);
+ tessellator.addVertex(ax, ay, az);
+ tessellator.addVertex(ix, ay, az);
+ tessellator.addVertex(ax, ay, az);
+ tessellator.addVertex(ix, iy, iz);
+ tessellator.addVertex(ix, iy, az);
+ tessellator.addVertex(ix, ay, iz);
+ tessellator.addVertex(ix, ay, az);
+ tessellator.addVertex(ax, iy, iz);
+ tessellator.addVertex(ax, iy, az);
+ tessellator.addVertex(ax, ay, iz);
+ tessellator.addVertex(ax, ay, az);
+ tessellator.draw();
+ }
}
diff --git a/src/main/java/ab/client/core/handler/ClientHandler.java b/src/main/java/ab/client/core/handler/ClientHandler.java
index 574c794..8eb306a 100644
--- a/src/main/java/ab/client/core/handler/ClientHandler.java
+++ b/src/main/java/ab/client/core/handler/ClientHandler.java
@@ -4,124 +4,125 @@ import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IBoundRender;
-import ab.api.IRankItem;
-import ab.client.core.handler.PlayerItemUsingSound.ClientSoundHandler;
-import ab.common.block.tile.TileLebethronCore;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
-import cpw.mods.fml.relauncher.ReflectionHelper;
-import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraft.profiler.Profiler;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.ChunkCoordinates;
-import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.RenderWorldLastEvent;
-import vazkii.botania.api.wand.ICoordBoundItem;
-import vazkii.botania.api.wand.IWireframeAABBProvider;
+
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.lib.LibObfuscation;
+import ab.api.IRankItem;
+import ab.client.core.handler.PlayerItemUsingSound.ClientSoundHandler;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.relauncher.ReflectionHelper;
public class ClientHandler {
-
- @SubscribeEvent
- public void renderTick(TickEvent.RenderTickEvent event) {
- if(event.phase != TickEvent.Phase.START)
- renderTooltip();
- }
-
- @SubscribeEvent
- public void clientTickEnd(TickEvent.ClientTickEvent event) {
- if(event.phase == TickEvent.Phase.END) {
- ItemsRemainingRender.tick();
- ClientSoundHandler.tick();
- }
- }
-
- public static void renderTooltip() {
- Minecraft mc = Minecraft.getMinecraft();
- GuiScreen gui = mc.currentScreen;
- if (gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
- GuiContainer container = (GuiContainer)gui;
- Slot slot = (Slot)ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
- if (slot != null && slot.getHasStack()) {
- ItemStack stack = slot.getStack();
- if (stack != null) {
- List tooltip;
- ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
- FontRenderer font = mc.fontRenderer;
- int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
- int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
- try {
- tooltip = stack.getTooltip((EntityPlayer)mc.thePlayer, mc.gameSettings.advancedItemTooltips);
- } catch (Exception e) {
- tooltip = new ArrayList();
- }
- int width = 0;
- for (String s : tooltip)
- width = Math.max(width, font.getStringWidth(s) + 2);
- int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
- int height = 3;
- int offx = 11;
- int offy = 17;
- boolean offscreen = (mouseX + width + 19 >= res.getScaledWidth());
- int fixY = res.getScaledHeight() - mouseY + tooltipHeight;
- if (fixY < 0)
- offy -= fixY;
- if (offscreen)
- offx = -13 - width;
- if (stack.getItem() instanceof IRankItem) {
- drawRankItemBar(stack, mouseX, mouseY, offx, offy, width, height, font);
- }
- }
- }
- }
- }
-
- private static void drawRankItemBar(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
- IRankItem item = (IRankItem)stack.getItem();
- int level = item.getLevel(stack);
- int max = item.getLevels()[Math.min(item.getLevels().length - 1, level + 1)];
- boolean ss = (level >= item.getLevels().length - 1);
- int curr = item.getMana(stack);
- float percent = (level == 0) ? 0.0F : ((float)curr / (float)max);
- int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int)(width * percent));
- float huePer = (width == 0) ? 0.0F : (1.0F / width);
- float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
- GL11.glDisable(2929);
- Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, -16777216);
- for(int i = 0; i < rainbowWidth; i++)
- Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1.0F, 1.0F));
- Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, -11184811);
- String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00A7");
- GL11.glPushAttrib(2896);
- GL11.glDisable(2896);
- font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 16777215);
- if(!ss) {
- rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00A7");
- font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 16777215);
- }
- GL11.glEnable(2929);
- GL11.glPopAttrib();
- }
-}
\ No newline at end of file
+
+ @SubscribeEvent
+ public void renderTick(TickEvent.RenderTickEvent event) {
+ if (event.phase != TickEvent.Phase.START) renderTooltip();
+ }
+
+ @SubscribeEvent
+ public void clientTickEnd(TickEvent.ClientTickEvent event) {
+ if (event.phase == TickEvent.Phase.END) {
+ ItemsRemainingRender.tick();
+ ClientSoundHandler.tick();
+ }
+ }
+
+ public static void renderTooltip() {
+ Minecraft mc = Minecraft.getMinecraft();
+ GuiScreen gui = mc.currentScreen;
+ if (gui != null && gui instanceof GuiContainer
+ && mc.thePlayer != null
+ && mc.thePlayer.inventory.getItemStack() == null) {
+ GuiContainer container = (GuiContainer) gui;
+ Slot slot = (Slot) ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ if (stack != null) {
+ List tooltip;
+ ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
+ FontRenderer font = mc.fontRenderer;
+ int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
+ int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
+ try {
+ tooltip = stack.getTooltip((EntityPlayer) mc.thePlayer, mc.gameSettings.advancedItemTooltips);
+ } catch (Exception e) {
+ tooltip = new ArrayList();
+ }
+ int width = 0;
+ for (String s : tooltip) width = Math.max(width, font.getStringWidth(s) + 2);
+ int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
+ int height = 3;
+ int offx = 11;
+ int offy = 17;
+ boolean offscreen = (mouseX + width + 19 >= res.getScaledWidth());
+ int fixY = res.getScaledHeight() - mouseY + tooltipHeight;
+ if (fixY < 0) offy -= fixY;
+ if (offscreen) offx = -13 - width;
+ if (stack.getItem() instanceof IRankItem) {
+ drawRankItemBar(stack, mouseX, mouseY, offx, offy, width, height, font);
+ }
+ }
+ }
+ }
+ }
+
+ private static void drawRankItemBar(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width,
+ int height, FontRenderer font) {
+ IRankItem item = (IRankItem) stack.getItem();
+ int level = item.getLevel(stack);
+ int max = item.getLevels()[Math.min(item.getLevels().length - 1, level + 1)];
+ boolean ss = (level >= item.getLevels().length - 1);
+ int curr = item.getMana(stack);
+ float percent = (level == 0) ? 0.0F : ((float) curr / (float) max);
+ int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int) (width * percent));
+ float huePer = (width == 0) ? 0.0F : (1.0F / width);
+ float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
+ GL11.glDisable(2929);
+ Gui.drawRect(
+ mouseX + offx - 1,
+ mouseY - offy - height - 1,
+ mouseX + offx + width + 1,
+ mouseY - offy,
+ -16777216);
+ for (int i = 0; i < rainbowWidth; i++) Gui.drawRect(
+ mouseX + offx + i,
+ mouseY - offy - height,
+ mouseX + offx + i + 1,
+ mouseY - offy,
+ Color.HSBtoRGB(hueOff + huePer * i, 1.0F, 1.0F));
+ Gui.drawRect(
+ mouseX + offx + rainbowWidth,
+ mouseY - offy - height,
+ mouseX + offx + width,
+ mouseY - offy,
+ -11184811);
+ String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00A7");
+ GL11.glPushAttrib(2896);
+ GL11.glDisable(2896);
+ font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 16777215);
+ if (!ss) {
+ rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00A7");
+ font.drawStringWithShadow(
+ rank,
+ mouseX + offx + width - font.getStringWidth(rank),
+ mouseY - offy - 12,
+ 16777215);
+ }
+ GL11.glEnable(2929);
+ GL11.glPopAttrib();
+ }
+}
diff --git a/src/main/java/ab/client/core/handler/GuiABConfigHandler.java b/src/main/java/ab/client/core/handler/GuiABConfigHandler.java
index 663b274..eeff55e 100644
--- a/src/main/java/ab/client/core/handler/GuiABConfigHandler.java
+++ b/src/main/java/ab/client/core/handler/GuiABConfigHandler.java
@@ -1,18 +1,21 @@
package ab.client.core.handler;
-import java.util.ArrayList;
-import java.util.List;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraftforge.common.config.ConfigElement;
import ab.AdvancedBotany;
import ab.common.core.handler.ConfigABHandler;
import cpw.mods.fml.client.config.GuiConfig;
-import cpw.mods.fml.client.config.IConfigElement;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraftforge.common.config.ConfigElement;
public class GuiABConfigHandler extends GuiConfig {
- public GuiABConfigHandler(GuiScreen parentScreen) {
- super(parentScreen, (new ConfigElement(ConfigABHandler.config.getCategory("general"))).getChildElements(), AdvancedBotany.modid, false, false, GuiConfig.getAbridgedConfigPath(ConfigABHandler.config.toString()));
- }
+ public GuiABConfigHandler(GuiScreen parentScreen) {
+ super(
+ parentScreen,
+ (new ConfigElement(ConfigABHandler.config.getCategory("general"))).getChildElements(),
+ AdvancedBotany.modid,
+ false,
+ false,
+ GuiConfig.getAbridgedConfigPath(ConfigABHandler.config.toString()));
+ }
}
diff --git a/src/main/java/ab/client/core/handler/GuiABFactory.java b/src/main/java/ab/client/core/handler/GuiABFactory.java
index d8855d9..c951fd8 100644
--- a/src/main/java/ab/client/core/handler/GuiABFactory.java
+++ b/src/main/java/ab/client/core/handler/GuiABFactory.java
@@ -2,23 +2,24 @@ package ab.client.core.handler;
import java.util.Set;
-import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
+import cpw.mods.fml.client.IModGuiFactory;
+
public class GuiABFactory implements IModGuiFactory {
- public void initialize(Minecraft minecraftInstance) {}
-
- public Class extends GuiScreen> mainConfigGuiClass() {
- return GuiABConfigHandler.class;
- }
-
- public Set runtimeGuiCategories() {
- return null;
- }
-
- public IModGuiFactory.RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element) {
- return null;
- }
+ public void initialize(Minecraft minecraftInstance) {}
+
+ public Class extends GuiScreen> mainConfigGuiClass() {
+ return GuiABConfigHandler.class;
+ }
+
+ public Set runtimeGuiCategories() {
+ return null;
+ }
+
+ public IModGuiFactory.RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element) {
+ return null;
+ }
}
diff --git a/src/main/java/ab/client/core/handler/HudRenderHandler.java b/src/main/java/ab/client/core/handler/HudRenderHandler.java
index a348f50..e0d76a7 100644
--- a/src/main/java/ab/client/core/handler/HudRenderHandler.java
+++ b/src/main/java/ab/client/core/handler/HudRenderHandler.java
@@ -1,62 +1,46 @@
package ab.client.core.handler;
-import java.awt.Color;
-
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IRenderHud;
-import ab.common.block.tile.TileLebethronCore;
-import ab.common.item.equipment.ItemBlackHalo;
-import ab.common.item.equipment.armor.ItemNebulaArmor;
-import ab.common.item.equipment.armor.ItemNebulaHelm;
-import ab.common.lib.register.ItemListAB;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.ItemRenderer;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.texture.TextureMap;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
-import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.RenderPlayerEvent;
-import vazkii.botania.api.item.IPhantomInkable;
-import vazkii.botania.client.core.handler.ClientTickHandler;
+
import vazkii.botania.common.item.ItemLexicon;
import vazkii.botania.common.item.ItemTwigWand;
+import ab.api.IRenderHud;
+import ab.common.item.equipment.ItemBlackHalo;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class HudRenderHandler {
-
- @SubscribeEvent
- public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
- Minecraft mc = Minecraft.getMinecraft();
- Profiler profiler = mc.mcProfiler;
- ItemStack equippedStack = mc.thePlayer.getCurrentEquippedItem();
- if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
- profiler.startSection("advabcedBotany-hud");
- MovingObjectPosition pos = mc.objectMouseOver;
- if (pos != null) {
- Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
- TileEntity tile = mc.theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
- boolean canRender = equippedStack != null && (equippedStack.getItem() instanceof ItemTwigWand || equippedStack.getItem() instanceof ItemLexicon);
- if(tile != null && tile instanceof IRenderHud && !canRender) {
- ((IRenderHud)tile).renderHud(mc, event.resolution);
- }
- }
- if(equippedStack != null && equippedStack.getItem() instanceof ItemBlackHalo) {
- profiler.startSection("blackHalo");
- ItemBlackHalo.renderHUD(event.resolution, mc.thePlayer, equippedStack);
- profiler.endSection();
- }
- profiler.endStartSection("itemsRemainingAB");
- ItemsRemainingRender.render(event.resolution, event.partialTicks);
- profiler.endSection();
- }
- }
+
+ @SubscribeEvent
+ public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
+ Minecraft mc = Minecraft.getMinecraft();
+ Profiler profiler = mc.mcProfiler;
+ ItemStack equippedStack = mc.thePlayer.getCurrentEquippedItem();
+ if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
+ profiler.startSection("advabcedBotany-hud");
+ MovingObjectPosition pos = mc.objectMouseOver;
+ if (pos != null) {
+ Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
+ TileEntity tile = mc.theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
+ boolean canRender = equippedStack != null && (equippedStack.getItem() instanceof ItemTwigWand
+ || equippedStack.getItem() instanceof ItemLexicon);
+ if (tile != null && tile instanceof IRenderHud && !canRender) {
+ ((IRenderHud) tile).renderHud(mc, event.resolution);
+ }
+ }
+ if (equippedStack != null && equippedStack.getItem() instanceof ItemBlackHalo) {
+ profiler.startSection("blackHalo");
+ ItemBlackHalo.renderHUD(event.resolution, mc.thePlayer, equippedStack);
+ profiler.endSection();
+ }
+ profiler.endStartSection("itemsRemainingAB");
+ ItemsRemainingRender.render(event.resolution, event.partialTicks);
+ profiler.endSection();
+ }
+ }
}
diff --git a/src/main/java/ab/client/core/handler/ItemsRemainingRender.java b/src/main/java/ab/client/core/handler/ItemsRemainingRender.java
index 63774f2..a6916f0 100644
--- a/src/main/java/ab/client/core/handler/ItemsRemainingRender.java
+++ b/src/main/java/ab/client/core/handler/ItemsRemainingRender.java
@@ -1,63 +1,63 @@
package ab.client.core.handler;
-import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
public class ItemsRemainingRender {
- private static int maxTicks = 30;
- private static int leaveTicks = 20;
- private static ItemStack stack;
- private static int ticks;
- private static String text;
-
- @SideOnly(Side.CLIENT)
- public static void render(ScaledResolution resolution, float partTicks) {
- if(ticks > 0 && stack != null) {
- int pos = maxTicks - ticks;
- Minecraft mc = Minecraft.getMinecraft();
- int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
- int y = resolution.getScaledHeight() / 2;
- int start = maxTicks - leaveTicks;
- float alpha = (ticks + partTicks > start) ? 1.0F : ((ticks + partTicks) / start);
- GL11.glDisable(3008);
- GL11.glEnable(3042);
- GL11.glEnable(32826);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
- RenderHelper.enableGUIStandardItemLighting();
- int xp = x + (int)(16.0F * (1.0F - alpha));
- GL11.glTranslatef(xp, y, 0.0F);
- GL11.glScalef(alpha, 1.0F, 1.0F);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, 0);
- GL11.glScalef(1.0F / alpha, 1.0F, 1.0F);
- GL11.glTranslatef(-xp, -y, 0.0F);
- RenderHelper.disableStandardItemLighting();
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glEnable(3042);
- int color = 0xFFFFFF | (int)(alpha * 255.0F) << 24;
- mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
- GL11.glDisable(3042);
- GL11.glEnable(3008);
- }
- }
-
- @SideOnly(Side.CLIENT)
- public static void tick() {
- if(ticks > 0)
- ticks--;
- }
-
- public static void set(ItemStack stack, String text) {
- ItemsRemainingRender.stack = stack;
- ItemsRemainingRender.text = text;
- ticks = (stack == null) ? 0 : maxTicks;
- }
-}
\ No newline at end of file
+ private static int maxTicks = 30;
+ private static int leaveTicks = 20;
+ private static ItemStack stack;
+ private static int ticks;
+ private static String text;
+
+ @SideOnly(Side.CLIENT)
+ public static void render(ScaledResolution resolution, float partTicks) {
+ if (ticks > 0 && stack != null) {
+ int pos = maxTicks - ticks;
+ Minecraft mc = Minecraft.getMinecraft();
+ int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
+ int y = resolution.getScaledHeight() / 2;
+ int start = maxTicks - leaveTicks;
+ float alpha = (ticks + partTicks > start) ? 1.0F : ((ticks + partTicks) / start);
+ GL11.glDisable(3008);
+ GL11.glEnable(3042);
+ GL11.glEnable(32826);
+ GL11.glBlendFunc(770, 771);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
+ RenderHelper.enableGUIStandardItemLighting();
+ int xp = x + (int) (16.0F * (1.0F - alpha));
+ GL11.glTranslatef(xp, y, 0.0F);
+ GL11.glScalef(alpha, 1.0F, 1.0F);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, 0);
+ GL11.glScalef(1.0F / alpha, 1.0F, 1.0F);
+ GL11.glTranslatef(-xp, -y, 0.0F);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glEnable(3042);
+ int color = 0xFFFFFF | (int) (alpha * 255.0F) << 24;
+ mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
+ GL11.glDisable(3042);
+ GL11.glEnable(3008);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public static void tick() {
+ if (ticks > 0) ticks--;
+ }
+
+ public static void set(ItemStack stack, String text) {
+ ItemsRemainingRender.stack = stack;
+ ItemsRemainingRender.text = text;
+ ticks = (stack == null) ? 0 : maxTicks;
+ }
+}
diff --git a/src/main/java/ab/client/core/handler/PlayerItemUsingSound.java b/src/main/java/ab/client/core/handler/PlayerItemUsingSound.java
index 522283a..ad30176 100644
--- a/src/main/java/ab/client/core/handler/PlayerItemUsingSound.java
+++ b/src/main/java/ab/client/core/handler/PlayerItemUsingSound.java
@@ -11,73 +11,79 @@ import net.minecraft.util.ResourceLocation;
public class PlayerItemUsingSound {
- public EntityPlayer player;
- public ISound sound;
- public int maxTick = 0;
- public int tick = 0;
- public boolean isDeadingSound = false;
- public boolean hasCheckUse;
-
- public PlayerItemUsingSound(EntityPlayer player, ISound sound, int maxTick, boolean hasCheckUse) {
- this.player = player;
- this.sound = sound;
- this.maxTick = maxTick;
- this.hasCheckUse = hasCheckUse;
- }
-
- public static class ClientSoundHandler {
-
- public static Minecraft mc = Minecraft.getMinecraft();
- public static List soundsList = new ArrayList();
-
- public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick, boolean hasCheckUse) {
- if(!soundsList.isEmpty())
- for(int i = 0; i < soundsList.size(); i++) {
- PlayerItemUsingSound playerSound = soundsList.get(i);
- if(playerSound.player.getCommandSenderName().equals(player.getCommandSenderName())) {
- if(playerSound.maxTick != 0 && playerSound.maxTick <= playerSound.tick && !playerSound.isDeadingSound) {
- playerSound.isDeadingSound = true;
- setSound(player, name, volume, pitch, maxTick, hasCheckUse);
- return;
- }
- return;
- } else
- setSound(player, name, volume, pitch, maxTick, hasCheckUse);
- }
- else
- setSound(player, name, volume, pitch, maxTick, hasCheckUse);
- }
-
- public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick) {
- playSound(player, name, volume, pitch, maxTick, true);
- }
-
- public static void playSound(EntityPlayer player, String name, float volume, float pitch) {
- playSound(player, name, volume, pitch, 0);
- }
-
- protected static void setSound(EntityPlayer player, String name, float volume, float pitch, int maxTick, boolean hasCheckUse) {
- PositionedSoundRecord posSound = new PositionedSoundRecord(new ResourceLocation(name), volume, pitch, (float)player.posX, (float)player.posY, (float)player.posZ);
- soundsList.add(new PlayerItemUsingSound(player, posSound, maxTick, hasCheckUse));
- mc.getSoundHandler().playSound(posSound);
- }
-
- public static void tick() {
- if(!soundsList.isEmpty()) {
- for(int i = 0; i < soundsList.size(); i++) {
- PlayerItemUsingSound playerSound = soundsList.get(i);
- playerSound.tick++;
- if(!mc.getSoundHandler().isSoundPlaying(playerSound.sound)) {
- soundsList.remove(playerSound);
- continue;
- } else if(playerSound.hasCheckUse && !playerSound.player.isUsingItem()) {
- if(mc.getSoundHandler().isSoundPlaying(playerSound.sound))
- mc.getSoundHandler().stopSound(playerSound.sound);
- soundsList.remove(playerSound);
- continue;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
+ public EntityPlayer player;
+ public ISound sound;
+ public int maxTick = 0;
+ public int tick = 0;
+ public boolean isDeadingSound = false;
+ public boolean hasCheckUse;
+
+ public PlayerItemUsingSound(EntityPlayer player, ISound sound, int maxTick, boolean hasCheckUse) {
+ this.player = player;
+ this.sound = sound;
+ this.maxTick = maxTick;
+ this.hasCheckUse = hasCheckUse;
+ }
+
+ public static class ClientSoundHandler {
+
+ public static Minecraft mc = Minecraft.getMinecraft();
+ public static List soundsList = new ArrayList();
+
+ public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick,
+ boolean hasCheckUse) {
+ if (!soundsList.isEmpty()) for (int i = 0; i < soundsList.size(); i++) {
+ PlayerItemUsingSound playerSound = soundsList.get(i);
+ if (playerSound.player.getCommandSenderName().equals(player.getCommandSenderName())) {
+ if (playerSound.maxTick != 0 && playerSound.maxTick <= playerSound.tick
+ && !playerSound.isDeadingSound) {
+ playerSound.isDeadingSound = true;
+ setSound(player, name, volume, pitch, maxTick, hasCheckUse);
+ return;
+ }
+ return;
+ } else setSound(player, name, volume, pitch, maxTick, hasCheckUse);
+ }
+ else setSound(player, name, volume, pitch, maxTick, hasCheckUse);
+ }
+
+ public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick) {
+ playSound(player, name, volume, pitch, maxTick, true);
+ }
+
+ public static void playSound(EntityPlayer player, String name, float volume, float pitch) {
+ playSound(player, name, volume, pitch, 0);
+ }
+
+ protected static void setSound(EntityPlayer player, String name, float volume, float pitch, int maxTick,
+ boolean hasCheckUse) {
+ PositionedSoundRecord posSound = new PositionedSoundRecord(
+ new ResourceLocation(name),
+ volume,
+ pitch,
+ (float) player.posX,
+ (float) player.posY,
+ (float) player.posZ);
+ soundsList.add(new PlayerItemUsingSound(player, posSound, maxTick, hasCheckUse));
+ mc.getSoundHandler().playSound(posSound);
+ }
+
+ public static void tick() {
+ if (!soundsList.isEmpty()) {
+ for (int i = 0; i < soundsList.size(); i++) {
+ PlayerItemUsingSound playerSound = soundsList.get(i);
+ playerSound.tick++;
+ if (!mc.getSoundHandler().isSoundPlaying(playerSound.sound)) {
+ soundsList.remove(playerSound);
+ continue;
+ } else if (playerSound.hasCheckUse && !playerSound.player.isUsingItem()) {
+ if (mc.getSoundHandler().isSoundPlaying(playerSound.sound))
+ mc.getSoundHandler().stopSound(playerSound.sound);
+ soundsList.remove(playerSound);
+ continue;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/ab/client/core/handler/PlayerRendererHandler.java b/src/main/java/ab/client/core/handler/PlayerRendererHandler.java
index a818a4a..832d679 100644
--- a/src/main/java/ab/client/core/handler/PlayerRendererHandler.java
+++ b/src/main/java/ab/client/core/handler/PlayerRendererHandler.java
@@ -2,12 +2,6 @@ package ab.client.core.handler;
import java.awt.Color;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.core.ClientHelper;
-import ab.common.item.equipment.armor.ItemNebulaArmor;
-import ab.common.item.equipment.armor.ItemNebulaHelm;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -17,72 +11,87 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.core.ClientHelper;
+import ab.common.item.equipment.armor.ItemNebulaArmor;
+import ab.common.item.equipment.armor.ItemNebulaHelm;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PlayerRendererHandler {
- @SubscribeEvent
- public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
- EntityPlayer player = event.entityPlayer;
- ItemStack item = player.getCurrentArmor(3);
- if(item != null && item.getItem() instanceof ItemNebulaHelm) {
- Item helm = player.getCurrentArmor(3).getItem();
- boolean hasPhantomInk = helm instanceof IPhantomInkable && ((IPhantomInkable)helm).hasPhantomInk(item);
- if(!hasPhantomInk && ((ItemNebulaHelm)helm).enableCosmicFace(item)) {
- float angelX = event.renderer.modelBipedMain.bipedHead.rotateAngleX * 180.0F / (float)Math.PI;
- float angelY = event.renderer.modelBipedMain.bipedHead.rotateAngleY * 180.0F / (float)Math.PI;
- GL11.glPushMatrix();
- if(player.isSneaking())
- GL11.glTranslatef(event.renderer.modelBipedMain.bipedHead.rotationPointX * 0.0625f, event.renderer.modelBipedMain.bipedHead.rotationPointY * 0.0625f, 0.0f);
- GL11.glRotatef(angelY, 0.0F, 1.0F, 0.0F);
- GL11.glRotatef(angelX, 1.0F, 0.0F, 0.0F);
- renderCosmicFace();
- GL11.glPopMatrix();
- }
- }
- }
-
- private void renderCosmicFace() {
- double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glDisable(2884);
-
- GL11.glPushMatrix();
- GL11.glScalef(0.5f, 0.4f, 0.4f);
- GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
- GL11.glTranslatef(-0.5f, -0.8675f, 0.0f);
- GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- boolean hasFog = GL11.glGetBoolean(2912);
- if(hasFog)
- GL11.glDisable(2912);
- ClientHelper.renderCosmicBackground();
- if(hasFog)
- GL11.glEnable(2912);
- GL11.glPopMatrix();
-
- int light = 15728880;
- int lightmapX = light % 65536;
- int lightmapY = light / 65536;
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
- (Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glTranslatef(-0.2F, -0.35F, -0.25F);
- GL11.glScalef(0.4f, 0.4f, 0.4f);
- float f = ItemNebulaArmor.nebulaEyes.getMinU();
- float f1 = ItemNebulaArmor.nebulaEyes.getMaxU();
- float f2 = ItemNebulaArmor.nebulaEyes.getMinV();
- float f3 = ItemNebulaArmor.nebulaEyes.getMaxV();
- Color color = Color.getHSBColor((float)Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
- float r = color.getRed() / 510.0F;
- float g = color.getGreen() / 510.0F;
- float b = color.getBlue() / 510.0F;
- GL11.glColor4f(0.5f + r, 0.5f + g, 0.5f + b, 0.685f + (float)Math.sin(worldTime / 50.0D) * 0.175F);
- ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, ItemNebulaArmor.nebulaEyes.getIconWidth(), ItemNebulaArmor.nebulaEyes.getIconHeight(), 0.03125F);
- GL11.glDisable(3042);
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- }
-}
\ No newline at end of file
+ @SubscribeEvent
+ public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
+ EntityPlayer player = event.entityPlayer;
+ ItemStack item = player.getCurrentArmor(3);
+ if (item != null && item.getItem() instanceof ItemNebulaHelm) {
+ Item helm = player.getCurrentArmor(3).getItem();
+ boolean hasPhantomInk = helm instanceof IPhantomInkable && ((IPhantomInkable) helm).hasPhantomInk(item);
+ if (!hasPhantomInk && ((ItemNebulaHelm) helm).enableCosmicFace(item)) {
+ float angelX = event.renderer.modelBipedMain.bipedHead.rotateAngleX * 180.0F / (float) Math.PI;
+ float angelY = event.renderer.modelBipedMain.bipedHead.rotateAngleY * 180.0F / (float) Math.PI;
+ GL11.glPushMatrix();
+ if (player.isSneaking()) GL11.glTranslatef(
+ event.renderer.modelBipedMain.bipedHead.rotationPointX * 0.0625f,
+ event.renderer.modelBipedMain.bipedHead.rotationPointY * 0.0625f,
+ 0.0f);
+ GL11.glRotatef(angelY, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(angelX, 1.0F, 0.0F, 0.0F);
+ renderCosmicFace();
+ GL11.glPopMatrix();
+ }
+ }
+ }
+
+ private void renderCosmicFace() {
+ double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glDisable(2884);
+
+ GL11.glPushMatrix();
+ GL11.glScalef(0.5f, 0.4f, 0.4f);
+ GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
+ GL11.glTranslatef(-0.5f, -0.8675f, 0.0f);
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ boolean hasFog = GL11.glGetBoolean(2912);
+ if (hasFog) GL11.glDisable(2912);
+ ClientHelper.renderCosmicBackground();
+ if (hasFog) GL11.glEnable(2912);
+ GL11.glPopMatrix();
+
+ int light = 15728880;
+ int lightmapX = light % 65536;
+ int lightmapY = light / 65536;
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
+ (Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationItemsTexture);
+ GL11.glTranslatef(-0.2F, -0.35F, -0.25F);
+ GL11.glScalef(0.4f, 0.4f, 0.4f);
+ float f = ItemNebulaArmor.nebulaEyes.getMinU();
+ float f1 = ItemNebulaArmor.nebulaEyes.getMaxU();
+ float f2 = ItemNebulaArmor.nebulaEyes.getMinV();
+ float f3 = ItemNebulaArmor.nebulaEyes.getMaxV();
+ Color color = Color.getHSBColor((float) Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
+ float r = color.getRed() / 510.0F;
+ float g = color.getGreen() / 510.0F;
+ float b = color.getBlue() / 510.0F;
+ GL11.glColor4f(0.5f + r, 0.5f + g, 0.5f + b, 0.685f + (float) Math.sin(worldTime / 50.0D) * 0.175F);
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ f1,
+ f2,
+ f,
+ f3,
+ ItemNebulaArmor.nebulaEyes.getIconWidth(),
+ ItemNebulaArmor.nebulaEyes.getIconHeight(),
+ 0.03125F);
+ GL11.glDisable(3042);
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/ab/client/core/proxy/ClientProxy.java b/src/main/java/ab/client/core/proxy/ClientProxy.java
index 703bf7f..54ec5c6 100644
--- a/src/main/java/ab/client/core/proxy/ClientProxy.java
+++ b/src/main/java/ab/client/core/proxy/ClientProxy.java
@@ -1,5 +1,9 @@
package ab.client.core.proxy;
+import net.minecraftforge.client.MinecraftForgeClient;
+import net.minecraftforge.common.MinecraftForge;
+
+import vazkii.botania.common.Botania;
import ab.client.core.handler.BoundRenderHandler;
import ab.client.core.handler.ClientHandler;
import ab.client.core.handler.HudRenderHandler;
@@ -21,13 +25,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import net.minecraft.client.renderer.entity.Render;
-import net.minecraft.client.renderer.entity.RenderSnowball;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.client.MinecraftForgeClient;
-import net.minecraftforge.common.MinecraftForge;
-import vazkii.botania.common.Botania;
-import vazkii.botania.common.item.ModItems;
public class ClientProxy extends CommonProxy {
@@ -36,53 +33,54 @@ public class ClientProxy extends CommonProxy {
}
public void init(FMLInitializationEvent event) {
- super.init(event);
-
- FMLCommonHandler.instance().bus().register(new ClientHandler());
- MinecraftForge.EVENT_BUS.register(new HudRenderHandler());
- MinecraftForge.EVENT_BUS.register(new PlayerRendererHandler());
- MinecraftForge.EVENT_BUS.register(new BoundRenderHandler());
-
- ClientRegistry.bindTileEntitySpecialRenderer(TileNidavellirForge.class, new RenderTileNidavellirForge());
- ClientRegistry.bindTileEntitySpecialRenderer(TileABSpreader.class, new RenderTileABSpreader());
- ClientRegistry.bindTileEntitySpecialRenderer(TileManaContainer.class, new RenderTileManaContainer());
- ClientRegistry.bindTileEntitySpecialRenderer(TileManaCrystalCube.class, new RenderTileManaCrystalCube());
- if(ConfigABHandler.hasManaCharger)
- ClientRegistry.bindTileEntitySpecialRenderer(TileManaCharger.class, new RenderTileManaCharger());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEngineerHopper.class, new RenderTileEngineerHopper());
- ClientRegistry.bindTileEntitySpecialRenderer(TileBoardFate.class, new RenderTileBoardFate());
- ClientRegistry.bindTileEntitySpecialRenderer(TileGameBoard.class, new RenderTileGameBoard());
- if(Botania.thaumcraftLoaded && ConfigABHandler.hasAutoThaum)
- ClientRegistry.bindTileEntitySpecialRenderer(TileMagicCraftCrate.class, new RenderTileMagicCraftingCrate());
-
- BlockListAB.blockABSpreaderRI = RenderingRegistry.getNextAvailableRenderId();
- BlockListAB.blockManaContainerRI = RenderingRegistry.getNextAvailableRenderId();
- BlockListAB.blockManaCrystalCubeRI = RenderingRegistry.getNextAvailableRenderId();
- BlockListAB.blockManaChargerRI = RenderingRegistry.getNextAvailableRenderId();
- BlockListAB.blockEngineerHopperRI = RenderingRegistry.getNextAvailableRenderId();
- BlockListAB.blockABPlateRI = RenderingRegistry.getNextAvailableRenderId();
-
+ super.init(event);
+
+ FMLCommonHandler.instance().bus().register(new ClientHandler());
+ MinecraftForge.EVENT_BUS.register(new HudRenderHandler());
+ MinecraftForge.EVENT_BUS.register(new PlayerRendererHandler());
+ MinecraftForge.EVENT_BUS.register(new BoundRenderHandler());
+
+ ClientRegistry.bindTileEntitySpecialRenderer(TileNidavellirForge.class, new RenderTileNidavellirForge());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileABSpreader.class, new RenderTileABSpreader());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileManaContainer.class, new RenderTileManaContainer());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileManaCrystalCube.class, new RenderTileManaCrystalCube());
+ if (ConfigABHandler.hasManaCharger)
+ ClientRegistry.bindTileEntitySpecialRenderer(TileManaCharger.class, new RenderTileManaCharger());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEngineerHopper.class, new RenderTileEngineerHopper());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileBoardFate.class, new RenderTileBoardFate());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileGameBoard.class, new RenderTileGameBoard());
+ if (Botania.thaumcraftLoaded && ConfigABHandler.hasAutoThaum)
+ ClientRegistry.bindTileEntitySpecialRenderer(TileMagicCraftCrate.class, new RenderTileMagicCraftingCrate());
+
+ BlockListAB.blockABSpreaderRI = RenderingRegistry.getNextAvailableRenderId();
+ BlockListAB.blockManaContainerRI = RenderingRegistry.getNextAvailableRenderId();
+ BlockListAB.blockManaCrystalCubeRI = RenderingRegistry.getNextAvailableRenderId();
+ BlockListAB.blockManaChargerRI = RenderingRegistry.getNextAvailableRenderId();
+ BlockListAB.blockEngineerHopperRI = RenderingRegistry.getNextAvailableRenderId();
+ BlockListAB.blockABPlateRI = RenderingRegistry.getNextAvailableRenderId();
+
RenderingRegistry.registerBlockHandler(new RenderBlockABSpreader());
RenderingRegistry.registerBlockHandler(new RenderBlockManaContainer());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCrystalCube());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCharger());
RenderingRegistry.registerBlockHandler(new RenderBlockEngineerHopper());
RenderingRegistry.registerBlockHandler(new RenderBlockNidavellirForge());
-
+
RenderingRegistry.registerEntityRenderingHandler(EntityAdvancedSpark.class, new RenderEntityAdvancedSpark());
RenderingRegistry.registerEntityRenderingHandler(EntityNebulaBlaze.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntityManaVine.class, new EntityNullRender());
- RenderingRegistry.registerEntityRenderingHandler(EntityAlphirinePortal.class, new RenderEntityAlphirinePortal());
+ RenderingRegistry
+ .registerEntityRenderingHandler(EntityAlphirinePortal.class, new RenderEntityAlphirinePortal());
RenderingRegistry.registerEntityRenderingHandler(EntitySword.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntitySeed.class, new EntityNullRender());
-
+
MinecraftForgeClient.registerItemRenderer(ItemListAB.itemAntigravityCharm, new RenderItemAntigravityCharm());
MinecraftForgeClient.registerItemRenderer(ItemListAB.itemSphereNavigation, new RenderItemSphereNavigation());
}
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
-// ItemStack crashGameForRender = null;
-// System.out.println(crashGameForRender.stackSize);
+ // ItemStack crashGameForRender = null;
+ // System.out.println(crashGameForRender.stackSize);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ab/client/gui/ContainerItemChest.java b/src/main/java/ab/client/gui/ContainerItemChest.java
index 6504e51..1dd827b 100644
--- a/src/main/java/ab/client/gui/ContainerItemChest.java
+++ b/src/main/java/ab/client/gui/ContainerItemChest.java
@@ -1,79 +1,80 @@
package ab.client.gui;
-import ab.common.item.relic.ItemTalismanHiddenRiches;
-import ab.common.lib.register.ItemListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
+
import vazkii.botania.client.gui.SlotLocked;
+import ab.common.item.relic.ItemTalismanHiddenRiches;
public class ContainerItemChest extends Container {
- public InventoryItemChest itemChestInv;
- private int numRows;
-
- public ContainerItemChest(EntityPlayer player) {
- int slot = player.inventory.currentItem;
- InventoryPlayer inventoryPlayer = player.inventory;
- this.itemChestInv = new InventoryItemChest(player, slot, ItemTalismanHiddenRiches.getOpenChest(player.getHeldItem()));
- this.numRows = itemChestInv.getSizeInventory() / 9;
- int i, j, k;
- for(j = 0; j < this.numRows; ++j) {
- for(k = 0; k < 9; ++k) {
- this.addSlotToContainer(new SlotItemChest(itemChestInv, k + j * 9, 8 + k * 18, 18 + j * 18, k));
- }
- }
- for(i = 0; i < 3; i++) {
- for (j = 0; j < 9; j++)
- addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 85 + i * 18));
- }
- for(i = 0; i < 9; i++) {
- if(player.inventory.currentItem == i) {
- addSlotToContainer(new SlotLocked(inventoryPlayer, i, 8 + i * 18, 143));
- } else {
- addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 143));
- }
- }
- }
-
- public boolean canInteractWith(EntityPlayer player) {
- boolean can = this.itemChestInv.isUseableByPlayer(player);
- if(!can)
- onContainerClosed(player);
- return can;
- }
-
- public void onContainerClosed(EntityPlayer player) {
- super.onContainerClosed(player);
- this.itemChestInv.pushInventory();
- }
-
- public ItemStack transferStackInSlot(EntityPlayer player, int i) {
- ItemStack itemstack = null;
- Slot slot = (Slot)this.inventorySlots.get(i);
- if(slot != null && slot.getHasStack()) {
- ItemStack stack = slot.getStack();
- itemstack = stack.copy();
- if(!itemChestInv.isRelicTalisman(stack)) {
- if(i < itemChestInv.getSizeInventory()) {
- if(!this.mergeItemStack(stack, itemChestInv.getSizeInventory(), inventorySlots.size(), true)) {
- return null;
- }
- }
- else if(!this.mergeItemStack(stack, 0, itemChestInv.getSizeInventory(), false)) {
- return null;
- }
- } else {
- return null;
- }
- if(stack.stackSize == 0) {
- slot.putStack((ItemStack)null);
- } else {
- slot.onSlotChanged();
- }
- }
- return itemstack;
- }
-}
\ No newline at end of file
+ public InventoryItemChest itemChestInv;
+ private int numRows;
+
+ public ContainerItemChest(EntityPlayer player) {
+ int slot = player.inventory.currentItem;
+ InventoryPlayer inventoryPlayer = player.inventory;
+ this.itemChestInv = new InventoryItemChest(
+ player,
+ slot,
+ ItemTalismanHiddenRiches.getOpenChest(player.getHeldItem()));
+ this.numRows = itemChestInv.getSizeInventory() / 9;
+ int i, j, k;
+ for (j = 0; j < this.numRows; ++j) {
+ for (k = 0; k < 9; ++k) {
+ this.addSlotToContainer(new SlotItemChest(itemChestInv, k + j * 9, 8 + k * 18, 18 + j * 18, k));
+ }
+ }
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 9; j++)
+ addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 85 + i * 18));
+ }
+ for (i = 0; i < 9; i++) {
+ if (player.inventory.currentItem == i) {
+ addSlotToContainer(new SlotLocked(inventoryPlayer, i, 8 + i * 18, 143));
+ } else {
+ addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 143));
+ }
+ }
+ }
+
+ public boolean canInteractWith(EntityPlayer player) {
+ boolean can = this.itemChestInv.isUseableByPlayer(player);
+ if (!can) onContainerClosed(player);
+ return can;
+ }
+
+ public void onContainerClosed(EntityPlayer player) {
+ super.onContainerClosed(player);
+ this.itemChestInv.pushInventory();
+ }
+
+ public ItemStack transferStackInSlot(EntityPlayer player, int i) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(i);
+ if (slot != null && slot.getHasStack()) {
+ ItemStack stack = slot.getStack();
+ itemstack = stack.copy();
+ if (!itemChestInv.isRelicTalisman(stack)) {
+ if (i < itemChestInv.getSizeInventory()) {
+ if (!this.mergeItemStack(stack, itemChestInv.getSizeInventory(), inventorySlots.size(), true)) {
+ return null;
+ }
+ } else if (!this.mergeItemStack(stack, 0, itemChestInv.getSizeInventory(), false)) {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ if (stack.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+ }
+ return itemstack;
+ }
+}
diff --git a/src/main/java/ab/client/gui/GuiItemChest.java b/src/main/java/ab/client/gui/GuiItemChest.java
index f9645a4..0fcd8ca 100644
--- a/src/main/java/ab/client/gui/GuiItemChest.java
+++ b/src/main/java/ab/client/gui/GuiItemChest.java
@@ -1,35 +1,37 @@
package ab.client.gui;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
-public class GuiItemChest extends GuiContainer {
-
- private static final ResourceLocation field_147017_u = new ResourceLocation("textures/gui/container/generic_54.png");
- private int inventoryRows;
+import org.lwjgl.opengl.GL11;
- public GuiItemChest(EntityPlayer player) {
- super(new ContainerItemChest(player));
- short short1 = 222;
+public class GuiItemChest extends GuiContainer {
+
+ private static final ResourceLocation field_147017_u = new ResourceLocation(
+ "textures/gui/container/generic_54.png");
+ private int inventoryRows;
+
+ public GuiItemChest(EntityPlayer player) {
+ super(new ContainerItemChest(player));
+ short short1 = 222;
int i = short1 - 108;
- this.inventoryRows = ((ContainerItemChest)this.inventorySlots).itemChestInv.getSizeInventory() / 9;
- this.ySize = i + this.inventoryRows * 18;
- }
-
- protected boolean checkHotbarKeys(int p_146983_1_) {
- return false;
- }
-
- protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
- this.fontRendererObj.drawString(I18n.format("container.chest", new Object[0]), 8, 6, 4210752);
- this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
- }
-
- protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+ this.inventoryRows = ((ContainerItemChest) this.inventorySlots).itemChestInv.getSizeInventory() / 9;
+ this.ySize = i + this.inventoryRows * 18;
+ }
+
+ protected boolean checkHotbarKeys(int p_146983_1_) {
+ return false;
+ }
+
+ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
+ this.fontRendererObj.drawString(I18n.format("container.chest", new Object[0]), 8, 6, 4210752);
+ this.fontRendererObj
+ .drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
+ }
+
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(field_147017_u);
int k = (this.width - this.xSize) / 2;
diff --git a/src/main/java/ab/client/gui/InventoryItemChest.java b/src/main/java/ab/client/gui/InventoryItemChest.java
index 4d15762..36d0964 100644
--- a/src/main/java/ab/client/gui/InventoryItemChest.java
+++ b/src/main/java/ab/client/gui/InventoryItemChest.java
@@ -1,118 +1,114 @@
package ab.client.gui;
-import ab.common.item.relic.ItemTalismanHiddenRiches;
-import ab.common.lib.register.ItemListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
+import ab.common.item.relic.ItemTalismanHiddenRiches;
+import ab.common.lib.register.ItemListAB;
+
public class InventoryItemChest implements IInventory {
- EntityPlayer player;
- int slot;
- ItemStack[] stacks = null;
- boolean invPushed = false;
- ItemStack storedInv = null;
- int openChest;
-
- public InventoryItemChest(EntityPlayer player, int slot, int openChest) {
- this.player = player;
- this.slot = slot;
- this.openChest = openChest;
- }
-
- public static boolean isRelicTalisman(ItemStack stack) {
- return (stack != null && stack.getItem() == ItemListAB.itemTalismanHiddenRiches);
- }
-
- protected ItemStack getStack() {
- ItemStack stack = this.player.inventory.getStackInSlot(this.slot);
- if(stack != null)
- this.storedInv = stack;
- return stack;
- }
-
- protected ItemStack[] getInventory() {
- if(this.stacks != null)
- return this.stacks;
- ItemStack stack = getStack();
- if(isRelicTalisman(getStack())) {
- this.stacks = ItemTalismanHiddenRiches.getChestLoot(stack, openChest);
- return this.stacks;
- }
- return new ItemStack[getSizeInventory()];
- }
-
- public void pushInventory() {
- if(this.invPushed)
- return;
- ItemStack stack = getStack();
- if(stack == null)
- stack = this.storedInv;
- if(stack != null) {
- ItemStack[] inv = getInventory();
- ItemTalismanHiddenRiches.setChestLoot(stack, inv, openChest);
- ItemTalismanHiddenRiches.setOpenChest(stack, -1);
- }
- this.invPushed = true;
- }
-
- public int getSizeInventory() {
- return 27;
- }
-
- public ItemStack getStackInSlot(int i) {
- return getInventory()[i];
- }
-
- public ItemStack decrStackSize(int i, int j) {
- ItemStack[] inventorySlots = getInventory();
- if(inventorySlots[i] != null) {
- if((inventorySlots[i]).stackSize <= j) {
- ItemStack itemStack = inventorySlots[i];
- inventorySlots[i] = null;
- return itemStack;
- }
- ItemStack stackAt = inventorySlots[i].splitStack(j);
- if((inventorySlots[i]).stackSize == 0)
- inventorySlots[i] = null;
- return stackAt;
- }
- return null;
- }
-
- public ItemStack getStackInSlotOnClosing(int i) {
- return getStackInSlot(i);
- }
-
- public void setInventorySlotContents(int i, ItemStack itemstack) {
- ItemStack[] inventorySlots = getInventory();
- inventorySlots[i] = itemstack;
- }
-
- public int getInventoryStackLimit() {
- return isRelicTalisman(getStack()) ? 64 : 0;
- }
-
- public boolean isUseableByPlayer(EntityPlayer entityplayer) {
- return isRelicTalisman(getStack());
- }
-
- public boolean isItemValidForSlot(int i, ItemStack itemstack) {
- return isRelicTalisman(getStack());
- }
-
- public boolean hasCustomInventoryName() {
- return false;
- }
-
- public void openInventory() {}
-
- public void closeInventory() {}
-
- public String getInventoryName() {
- return "itemChestTalisman";
- }
-
- public void markDirty() {}
-}
\ No newline at end of file
+ EntityPlayer player;
+ int slot;
+ ItemStack[] stacks = null;
+ boolean invPushed = false;
+ ItemStack storedInv = null;
+ int openChest;
+
+ public InventoryItemChest(EntityPlayer player, int slot, int openChest) {
+ this.player = player;
+ this.slot = slot;
+ this.openChest = openChest;
+ }
+
+ public static boolean isRelicTalisman(ItemStack stack) {
+ return (stack != null && stack.getItem() == ItemListAB.itemTalismanHiddenRiches);
+ }
+
+ protected ItemStack getStack() {
+ ItemStack stack = this.player.inventory.getStackInSlot(this.slot);
+ if (stack != null) this.storedInv = stack;
+ return stack;
+ }
+
+ protected ItemStack[] getInventory() {
+ if (this.stacks != null) return this.stacks;
+ ItemStack stack = getStack();
+ if (isRelicTalisman(getStack())) {
+ this.stacks = ItemTalismanHiddenRiches.getChestLoot(stack, openChest);
+ return this.stacks;
+ }
+ return new ItemStack[getSizeInventory()];
+ }
+
+ public void pushInventory() {
+ if (this.invPushed) return;
+ ItemStack stack = getStack();
+ if (stack == null) stack = this.storedInv;
+ if (stack != null) {
+ ItemStack[] inv = getInventory();
+ ItemTalismanHiddenRiches.setChestLoot(stack, inv, openChest);
+ ItemTalismanHiddenRiches.setOpenChest(stack, -1);
+ }
+ this.invPushed = true;
+ }
+
+ public int getSizeInventory() {
+ return 27;
+ }
+
+ public ItemStack getStackInSlot(int i) {
+ return getInventory()[i];
+ }
+
+ public ItemStack decrStackSize(int i, int j) {
+ ItemStack[] inventorySlots = getInventory();
+ if (inventorySlots[i] != null) {
+ if ((inventorySlots[i]).stackSize <= j) {
+ ItemStack itemStack = inventorySlots[i];
+ inventorySlots[i] = null;
+ return itemStack;
+ }
+ ItemStack stackAt = inventorySlots[i].splitStack(j);
+ if ((inventorySlots[i]).stackSize == 0) inventorySlots[i] = null;
+ return stackAt;
+ }
+ return null;
+ }
+
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return getStackInSlot(i);
+ }
+
+ public void setInventorySlotContents(int i, ItemStack itemstack) {
+ ItemStack[] inventorySlots = getInventory();
+ inventorySlots[i] = itemstack;
+ }
+
+ public int getInventoryStackLimit() {
+ return isRelicTalisman(getStack()) ? 64 : 0;
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return isRelicTalisman(getStack());
+ }
+
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ return isRelicTalisman(getStack());
+ }
+
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+
+ public String getInventoryName() {
+ return "itemChestTalisman";
+ }
+
+ public void markDirty() {}
+}
diff --git a/src/main/java/ab/client/gui/SlotItemChest.java b/src/main/java/ab/client/gui/SlotItemChest.java
index 20cd3cb..347309e 100644
--- a/src/main/java/ab/client/gui/SlotItemChest.java
+++ b/src/main/java/ab/client/gui/SlotItemChest.java
@@ -5,20 +5,20 @@ import net.minecraft.item.ItemStack;
public class SlotItemChest extends Slot {
- InventoryItemChest itemChestInv;
- int slot;
-
- public SlotItemChest(InventoryItemChest inv, int index, int x, int y, int slot) {
- super(inv, index, x, y);
- this.itemChestInv = inv;
- this.slot = slot;
- }
+ InventoryItemChest itemChestInv;
+ int slot;
- public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
- itemChestInv.setInventorySlotContents(slot, newStack);
- }
-
- public boolean isItemValid(ItemStack stack) {
- return !itemChestInv.isRelicTalisman(stack);
- }
+ public SlotItemChest(InventoryItemChest inv, int index, int x, int y, int slot) {
+ super(inv, index, x, y);
+ this.itemChestInv = inv;
+ this.slot = slot;
+ }
+
+ public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
+ itemChestInv.setInventorySlotContents(slot, newStack);
+ }
+
+ public boolean isItemValid(ItemStack stack) {
+ return !itemChestInv.isRelicTalisman(stack);
+ }
}
diff --git a/src/main/java/ab/client/model/ModelDiceFate.java b/src/main/java/ab/client/model/ModelDiceFate.java
index 47dd312..4523135 100644
--- a/src/main/java/ab/client/model/ModelDiceFate.java
+++ b/src/main/java/ab/client/model/ModelDiceFate.java
@@ -6,31 +6,31 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelDiceFate extends ModelBase {
- private final ModelRenderer bb_main;
+ private final ModelRenderer bb_main;
- public ModelDiceFate() {
-
- textureWidth = 48;
- textureHeight = 48;
+ public ModelDiceFate() {
- bb_main = new ModelRenderer(this);
- bb_main.setRotationPoint(0.0F, 18.0F, 0.0F);
- bb_main.cubeList.add(new ModelBox(bb_main, 0, 24, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
- }
+ textureWidth = 48;
+ textureHeight = 48;
- public void render(float rotX, float rotY, float rotZ) {
- setRotationAngle(bb_main, getAngel(rotX), getAngel(rotY), getAngel(rotZ));
- bb_main.render(0.0625f);
- }
-
- private float getAngel(float rot) {
- return rot / 180.0F * (float)Math.PI;
- }
+ bb_main = new ModelRenderer(this);
+ bb_main.setRotationPoint(0.0F, 18.0F, 0.0F);
+ bb_main.cubeList.add(new ModelBox(bb_main, 0, 24, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
+ }
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
-}
\ No newline at end of file
+ public void render(float rotX, float rotY, float rotZ) {
+ setRotationAngle(bb_main, getAngel(rotX), getAngel(rotY), getAngel(rotZ));
+ bb_main.render(0.0625f);
+ }
+
+ private float getAngel(float rot) {
+ return rot / 180.0F * (float) Math.PI;
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ab/client/model/ModelEngineerHopper.java b/src/main/java/ab/client/model/ModelEngineerHopper.java
index 3bd4707..bf3c7ea 100644
--- a/src/main/java/ab/client/model/ModelEngineerHopper.java
+++ b/src/main/java/ab/client/model/ModelEngineerHopper.java
@@ -1,64 +1,64 @@
package ab.client.model;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
+import org.lwjgl.opengl.GL11;
+
public class ModelEngineerHopper extends ModelBase {
-
- private final ModelRenderer hopperBase;
- private final ModelRenderer hopperTop;
- private final ModelRenderer hopperBottom;
- public ModelEngineerHopper() {
- textureWidth = 64;
- textureHeight = 64;
+ private final ModelRenderer hopperBase;
+ private final ModelRenderer hopperTop;
+ private final ModelRenderer hopperBottom;
- hopperBase = new ModelRenderer(this);
- hopperBase.setRotationPoint(0.0F, 24.0F, 0.0F);
- hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 45, -7.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 12, 27, -5.0F, -11.2F, -5.0F, 10, 3, 10, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 38, -6.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 38, 4.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 49, -2.0F, -11.0F, -6.0F, 4, 5, 2, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 49, -2.0F, -11.0F, 4.0F, 4, 5, 2, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 32, 45, 5.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 50, -5.0F, -16.0F, 5.0F, 10, 5, 2, 0.0F));
- hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 42, -5.0F, -16.0F, -7.0F, 10, 5, 2, 0.0F));
-
- hopperTop = new ModelRenderer(this);
- hopperTop.setRotationPoint(0.0F, 24.0F, 0.0F);
- hopperTop.cubeList.add(new ModelBox(hopperTop, 20, 13, -3.0F, -20.0F, -3.0F, 6, 6, 6, 0.0F));
-
- hopperBottom = new ModelRenderer(this);
- hopperBottom.setRotationPoint(0.0F, 24.0F, 0.0F);
- hopperBottom.cubeList.add(new ModelBox(hopperBottom, 24, 3, -2.0F, -5.0F, -2.0F, 4, 4, 4, 0.0F));
- }
-
- public void renderHoper(double time) {
- float offset = (float)Math.sin(time / 10.0D) * 0.05F + 0.01F;
- hopperBase.render(0.0625f);
-
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0f, offset, 0.0f);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
- hopperTop.render(0.0625f);
- GL11.glPopMatrix();
-
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0f, -offset, 0.0f);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
- hopperBottom.render(0.0625f);
- GL11.glPopMatrix();
- }
+ public ModelEngineerHopper() {
+ textureWidth = 64;
+ textureHeight = 64;
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
+ hopperBase = new ModelRenderer(this);
+ hopperBase.setRotationPoint(0.0F, 24.0F, 0.0F);
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 45, -7.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 12, 27, -5.0F, -11.2F, -5.0F, 10, 3, 10, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 38, -6.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 38, 4.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 49, -2.0F, -11.0F, -6.0F, 4, 5, 2, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 49, -2.0F, -11.0F, 4.0F, 4, 5, 2, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 32, 45, 5.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 50, -5.0F, -16.0F, 5.0F, 10, 5, 2, 0.0F));
+ hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 42, -5.0F, -16.0F, -7.0F, 10, 5, 2, 0.0F));
+
+ hopperTop = new ModelRenderer(this);
+ hopperTop.setRotationPoint(0.0F, 24.0F, 0.0F);
+ hopperTop.cubeList.add(new ModelBox(hopperTop, 20, 13, -3.0F, -20.0F, -3.0F, 6, 6, 6, 0.0F));
+
+ hopperBottom = new ModelRenderer(this);
+ hopperBottom.setRotationPoint(0.0F, 24.0F, 0.0F);
+ hopperBottom.cubeList.add(new ModelBox(hopperBottom, 24, 3, -2.0F, -5.0F, -2.0F, 4, 4, 4, 0.0F));
+ }
+
+ public void renderHoper(double time) {
+ float offset = (float) Math.sin(time / 10.0D) * 0.05F + 0.01F;
+ hopperBase.render(0.0625f);
+
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0f, offset, 0.0f);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
+ hopperTop.render(0.0625f);
+ GL11.glPopMatrix();
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0f, -offset, 0.0f);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
+ hopperBottom.render(0.0625f);
+ GL11.glPopMatrix();
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
}
diff --git a/src/main/java/ab/client/model/ModelManaCharger.java b/src/main/java/ab/client/model/ModelManaCharger.java
index 1e6d85a..0865afa 100644
--- a/src/main/java/ab/client/model/ModelManaCharger.java
+++ b/src/main/java/ab/client/model/ModelManaCharger.java
@@ -1,120 +1,137 @@
package ab.client.model;
-import java.util.Random;
-
-import org.lwjgl.opengl.GL11;
-
-import ab.client.render.tile.RenderTileManaCharger;
-import ab.common.block.tile.TileManaCharger;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.item.ItemStack;
-import vazkii.botania.api.mana.IManaItem;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.LightningHandler;
-import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
+import ab.client.render.tile.RenderTileManaCharger;
+import ab.common.block.tile.TileManaCharger;
public class ModelManaCharger extends ModelBase {
-
- private final ModelRenderer chargerBase;
- private final ModelRenderer chargerPlate;
-
- public ModelManaCharger() {
- textureWidth = 32;
- textureHeight = 32;
+ private final ModelRenderer chargerBase;
+ private final ModelRenderer chargerPlate;
- chargerBase = new ModelRenderer(this);
- chargerBase.setRotationPoint(0.0F, 24.0F, 0.0F);
- chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 9, -2.5F, -9.0F, -2.5F, 5, 4, 5, 0.0F));
- chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 0, -3.5F, -11.0F, -3.5F, 7, 2, 7, 0.0F));
- chargerBase.cubeList.add(new ModelBox(chargerBase, 20, 9, -1.5F, -5.0F, -1.5F, 3, 3, 3, 0.0F));
+ public ModelManaCharger() {
+ textureWidth = 32;
+ textureHeight = 32;
- chargerPlate = new ModelRenderer(this);
- chargerPlate.setRotationPoint(0.0F, 17.0F, 0.0F);
- chargerPlate.cubeList.add(new ModelBox(chargerPlate, 0, 18, 5.0F, 0.0F, -2.0F, 4, 1, 4, 0.0F));
- }
+ chargerBase = new ModelRenderer(this);
+ chargerBase.setRotationPoint(0.0F, 24.0F, 0.0F);
+ chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 9, -2.5F, -9.0F, -2.5F, 5, 4, 5, 0.0F));
+ chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 0, -3.5F, -11.0F, -3.5F, 7, 2, 7, 0.0F));
+ chargerBase.cubeList.add(new ModelBox(chargerBase, 20, 9, -1.5F, -5.0F, -1.5F, 3, 3, 3, 0.0F));
- public void render(RenderTileManaCharger render, double time) {
- TileManaCharger tile = render.charger;
- float offset = (float)Math.sin(time / 40.0D) * 0.1F + 0.05F;
- float polerot = -((float)time / 16.0F) * 25.0F;
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0F, offset, 0.0F);
- GL11.glRotatef(polerot, 0.0F, 1.0F, 0.0F);
- chargerBase.render(0.0625f);
- if (tile.getStackInSlot(0) != null) {
- float rot = this.chargerPlate.rotateAngleY * 180.0F / (float)Math.PI;
- GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.125F, 0.8125F, 0.125F);
- GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
- render.renderItemStack(tile.getStackInSlot(0));
- }
- GL11.glPopMatrix();
-
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0F, offset / 1.3f + 0.185f, 0.0F);
- GL11.glScalef(0.85f, 0.85f, 0.85f);
- for (int i = 1; i < 5; i++) {
- switch(i) {
- case 1: chargerPlate.rotateAngleY = 3.1416F;
- break;
- case 2: chargerPlate.rotateAngleY = 0;
- break;
- case 3: chargerPlate.rotateAngleY = 1.5708F;
- break;
- case 4: chargerPlate.rotateAngleY = -1.5708F;
- break;
- }
- if(tile.getWorldObj() != null)
- time += i * 36.0f;
- float offset1 = (float)Math.sin(time / 15.0D) * 0.1F - 0.1F;
- if(time == -1.0D)
- offset1 = 0.0F;
- ItemStack stack = tile.getStackInSlot(i);
- GL11.glTranslatef(0.0F, -offset1, 0.0F);
- if(stack != null) {
- GL11.glPushMatrix();
- float manaPercent = TileManaCharger.getManaPercent(stack);
- float rot = this.chargerPlate.rotateAngleY * 180.0F / (float)Math.PI;
- if(manaPercent < 100.0f) {
- float chargeY = (offset1 + (offset1 / 2.4f)) * ((100.0f - manaPercent) / 150.0f);
- GL11.glTranslatef(0.0F, chargeY, 0.0F);
- if(tile.clientTick[i] > 12) {
- float posX = 0;
- float posZ = 0;
- switch(i) {
- case 1: posX = 0.0f; posZ = -0.375f;
- break;
- case 2: posX = 0.0f; posZ = 0.375f;
- break;
- case 3: posX = -0.375f; posZ = 0.0f;
- break;
- case 4: posX = 0.375f; posZ = 0.0f;
- break;
- }
- Vector3 itemVec = Vector3.fromTileEntity(render.charger).add(0.5D + posX + ((Math.random() / 8) - 0.0625f), 0.67D + offset1, 0.5D + posZ + ((Math.random() / 8) - 0.0625f));
- Vector3 tileVec = Vector3.fromTileEntity(render.charger).add(0.5D + posX, 0.7425D + offset1 - (chargeY / 2), 0.5D + posZ);
- LightningHandler.spawnLightningBolt(render.charger.getWorldObj(), itemVec, tileVec, 10.0F, render.charger.getWorldObj().rand.nextLong(), 1140881820, 1140901631);
- render.charger.clientTick[i] = 0;
- }
- }
- GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(0.3125F, 1.06F, 0.1245F);
- GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
- render.renderItemStack(stack);
- GL11.glPopMatrix();
- }
- chargerPlate.render(0.0625f);
- GL11.glTranslatef(0.0F, offset1, 0.0F);
- }
- GL11.glPopMatrix();
- }
+ chargerPlate = new ModelRenderer(this);
+ chargerPlate.setRotationPoint(0.0F, 17.0F, 0.0F);
+ chargerPlate.cubeList.add(new ModelBox(chargerPlate, 0, 18, 5.0F, 0.0F, -2.0F, 4, 1, 4, 0.0F));
+ }
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
-}
\ No newline at end of file
+ public void render(RenderTileManaCharger render, double time) {
+ TileManaCharger tile = render.charger;
+ float offset = (float) Math.sin(time / 40.0D) * 0.1F + 0.05F;
+ float polerot = -((float) time / 16.0F) * 25.0F;
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, offset, 0.0F);
+ GL11.glRotatef(polerot, 0.0F, 1.0F, 0.0F);
+ chargerBase.render(0.0625f);
+ if (tile.getStackInSlot(0) != null) {
+ float rot = this.chargerPlate.rotateAngleY * 180.0F / (float) Math.PI;
+ GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.125F, 0.8125F, 0.125F);
+ GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
+ render.renderItemStack(tile.getStackInSlot(0));
+ }
+ GL11.glPopMatrix();
+
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, offset / 1.3f + 0.185f, 0.0F);
+ GL11.glScalef(0.85f, 0.85f, 0.85f);
+ for (int i = 1; i < 5; i++) {
+ switch (i) {
+ case 1:
+ chargerPlate.rotateAngleY = 3.1416F;
+ break;
+ case 2:
+ chargerPlate.rotateAngleY = 0;
+ break;
+ case 3:
+ chargerPlate.rotateAngleY = 1.5708F;
+ break;
+ case 4:
+ chargerPlate.rotateAngleY = -1.5708F;
+ break;
+ }
+ if (tile.getWorldObj() != null) time += i * 36.0f;
+ float offset1 = (float) Math.sin(time / 15.0D) * 0.1F - 0.1F;
+ if (time == -1.0D) offset1 = 0.0F;
+ ItemStack stack = tile.getStackInSlot(i);
+ GL11.glTranslatef(0.0F, -offset1, 0.0F);
+ if (stack != null) {
+ GL11.glPushMatrix();
+ float manaPercent = TileManaCharger.getManaPercent(stack);
+ float rot = this.chargerPlate.rotateAngleY * 180.0F / (float) Math.PI;
+ if (manaPercent < 100.0f) {
+ float chargeY = (offset1 + (offset1 / 2.4f)) * ((100.0f - manaPercent) / 150.0f);
+ GL11.glTranslatef(0.0F, chargeY, 0.0F);
+ if (tile.clientTick[i] > 12) {
+ float posX = 0;
+ float posZ = 0;
+ switch (i) {
+ case 1:
+ posX = 0.0f;
+ posZ = -0.375f;
+ break;
+ case 2:
+ posX = 0.0f;
+ posZ = 0.375f;
+ break;
+ case 3:
+ posX = -0.375f;
+ posZ = 0.0f;
+ break;
+ case 4:
+ posX = 0.375f;
+ posZ = 0.0f;
+ break;
+ }
+ Vector3 itemVec = Vector3.fromTileEntity(render.charger).add(
+ 0.5D + posX + ((Math.random() / 8) - 0.0625f),
+ 0.67D + offset1,
+ 0.5D + posZ + ((Math.random() / 8) - 0.0625f));
+ Vector3 tileVec = Vector3.fromTileEntity(render.charger)
+ .add(0.5D + posX, 0.7425D + offset1 - (chargeY / 2), 0.5D + posZ);
+ LightningHandler.spawnLightningBolt(
+ render.charger.getWorldObj(),
+ itemVec,
+ tileVec,
+ 10.0F,
+ render.charger.getWorldObj().rand.nextLong(),
+ 1140881820,
+ 1140901631);
+ render.charger.clientTick[i] = 0;
+ }
+ }
+ GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(0.3125F, 1.06F, 0.1245F);
+ GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
+ render.renderItemStack(stack);
+ GL11.glPopMatrix();
+ }
+ chargerPlate.render(0.0625f);
+ GL11.glTranslatef(0.0F, offset1, 0.0F);
+ }
+ GL11.glPopMatrix();
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ab/client/model/ModelManaContainer.java b/src/main/java/ab/client/model/ModelManaContainer.java
index 6ab6fb0..5d730d3 100644
--- a/src/main/java/ab/client/model/ModelManaContainer.java
+++ b/src/main/java/ab/client/model/ModelManaContainer.java
@@ -5,42 +5,42 @@ import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public class ModelManaContainer extends ModelBase {
-
- private final ModelRenderer bb_main;
- public ModelManaContainer() {
- textureWidth = 64;
- textureHeight = 64;
+ private final ModelRenderer bb_main;
- bb_main = new ModelRenderer(this);
- bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
- bb_main.cubeList.add(new ModelBox(bb_main, 6, 14, -7.0F, -15.0F, -7.0F, 14, 5, 3, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 24, 0, -5.0F, -10.2F, -5.0F, 10, 4, 10, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 49, 37, -6.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 50, 26, 4.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 13, 23, -2.0F, -10.0F, -6.0F, 4, 6, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 0, 23, -2.0F, -10.0F, 4.0F, 4, 6, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 27, 23, -5.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 40, 14, -3.0F, -6.2F, -3.0F, 6, 5, 6, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 55, 0, -6.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 28, 28, 4.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 55, 5, 4.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 28, 23, -6.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 1, 0, 4.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 16, 5, -4.0F, -18.0F, 4.0F, 8, 3, 1, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 16, 0, -4.0F, -18.0F, -5.0F, 8, 3, 1, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 14, 38, -7.0F, -15.0F, 4.0F, 14, 5, 3, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 41, 48, 4.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
- bb_main.cubeList.add(new ModelBox(bb_main, 18, 48, -7.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
- }
+ public ModelManaContainer() {
+ textureWidth = 64;
+ textureHeight = 64;
- public void render() {
- bb_main.render(0.0625f);
- }
+ bb_main = new ModelRenderer(this);
+ bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
+ bb_main.cubeList.add(new ModelBox(bb_main, 6, 14, -7.0F, -15.0F, -7.0F, 14, 5, 3, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 24, 0, -5.0F, -10.2F, -5.0F, 10, 4, 10, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 49, 37, -6.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 50, 26, 4.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 13, 23, -2.0F, -10.0F, -6.0F, 4, 6, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 0, 23, -2.0F, -10.0F, 4.0F, 4, 6, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 27, 23, -5.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 40, 14, -3.0F, -6.2F, -3.0F, 6, 5, 6, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 55, 0, -6.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 28, 28, 4.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 55, 5, 4.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 28, 23, -6.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 1, 0, 4.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 16, 5, -4.0F, -18.0F, 4.0F, 8, 3, 1, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 16, 0, -4.0F, -18.0F, -5.0F, 8, 3, 1, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 14, 38, -7.0F, -15.0F, 4.0F, 14, 5, 3, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 41, 48, 4.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
+ bb_main.cubeList.add(new ModelBox(bb_main, 18, 48, -7.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
+ }
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
+ public void render() {
+ bb_main.render(0.0625f);
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
}
diff --git a/src/main/java/ab/client/model/ModelNidavellirForge.java b/src/main/java/ab/client/model/ModelNidavellirForge.java
index 8788939..bcd8528 100644
--- a/src/main/java/ab/client/model/ModelNidavellirForge.java
+++ b/src/main/java/ab/client/model/ModelNidavellirForge.java
@@ -6,42 +6,42 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelNidavellirForge extends ModelBase {
- private final ModelRenderer bottomAnvil;
- private final ModelRenderer topAnvil;
-
- public ModelNidavellirForge() {
- textureWidth = 48;
- textureHeight = 48;
+ private final ModelRenderer bottomAnvil;
+ private final ModelRenderer topAnvil;
- bottomAnvil = new ModelRenderer(this);
- bottomAnvil.setRotationPoint(0.0F, 24.0F, 0.0F);
- bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 26, -3.0F, -1.0F, -4.0F, 6, 1, 1, 0.0F));
- bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 31, -5.0F, -1.0F, -3.0F, 12, 1, 6, 0.0F));
- bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 17, -2.0F, -3.0F, -2.0F, 4, 1, 4, 0.0F));
- bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 8, -4.0F, -2.0F, -3.0F, 8, 1, 6, 0.0F));
- bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 23, -3.0F, -1.0F, 3.0F, 6, 1, 1, 0.0F));
+ public ModelNidavellirForge() {
+ textureWidth = 48;
+ textureHeight = 48;
- topAnvil = new ModelRenderer(this);
- topAnvil.setRotationPoint(0.0F, 26.0F, 0.0F);
- topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 23, -6.5F, -11.0F, -3.0F, 12, 2, 6, 0.0F));
- topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 38, -5.5F, -12.0F, -4.0F, 13, 2, 8, 0.0F));
- topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 15, -5.5F, -9.0F, -3.0F, 9, 2, 6, 0.0F));
- topAnvil.cubeList.add(new ModelBox(topAnvil, 17, 0, -4.5F, -11.0F, 2.5F, 7, 3, 1, 0.0F));
- topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 0, -4.5F, -11.0F, -3.5F, 7, 3, 1, 0.0F));
- topAnvil.cubeList.add(new ModelBox(topAnvil, 30, 12, -2.5F, -7.0F, -2.0F, 5, 1, 4, 0.0F));
- }
-
- public void renderBottom() {
- bottomAnvil.render(0.0625f);
- }
-
- public void renderTop() {
- topAnvil.render(0.0625f);
- }
-
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
-}
\ No newline at end of file
+ bottomAnvil = new ModelRenderer(this);
+ bottomAnvil.setRotationPoint(0.0F, 24.0F, 0.0F);
+ bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 26, -3.0F, -1.0F, -4.0F, 6, 1, 1, 0.0F));
+ bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 31, -5.0F, -1.0F, -3.0F, 12, 1, 6, 0.0F));
+ bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 17, -2.0F, -3.0F, -2.0F, 4, 1, 4, 0.0F));
+ bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 8, -4.0F, -2.0F, -3.0F, 8, 1, 6, 0.0F));
+ bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 23, -3.0F, -1.0F, 3.0F, 6, 1, 1, 0.0F));
+
+ topAnvil = new ModelRenderer(this);
+ topAnvil.setRotationPoint(0.0F, 26.0F, 0.0F);
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 23, -6.5F, -11.0F, -3.0F, 12, 2, 6, 0.0F));
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 38, -5.5F, -12.0F, -4.0F, 13, 2, 8, 0.0F));
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 15, -5.5F, -9.0F, -3.0F, 9, 2, 6, 0.0F));
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 17, 0, -4.5F, -11.0F, 2.5F, 7, 3, 1, 0.0F));
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 0, -4.5F, -11.0F, -3.5F, 7, 3, 1, 0.0F));
+ topAnvil.cubeList.add(new ModelBox(topAnvil, 30, 12, -2.5F, -7.0F, -2.0F, 5, 1, 4, 0.0F));
+ }
+
+ public void renderBottom() {
+ bottomAnvil.render(0.0625f);
+ }
+
+ public void renderTop() {
+ topAnvil.render(0.0625f);
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ab/client/model/armor/ModelArmorNebula.java b/src/main/java/ab/client/model/armor/ModelArmorNebula.java
index ba1fede..ca6b3d6 100644
--- a/src/main/java/ab/client/model/armor/ModelArmorNebula.java
+++ b/src/main/java/ab/client/model/armor/ModelArmorNebula.java
@@ -1,341 +1,330 @@
package ab.client.model.armor;
-import java.awt.Color;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.core.ClientHelper;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
-import net.minecraft.util.ResourceLocation;
-import vazkii.botania.client.core.handler.ClientTickHandler;
+
+import org.lwjgl.opengl.GL11;
public class ModelArmorNebula extends ModelBiped {
-
- private final ModelRenderer head;
- private final ModelRenderer cube_r1;
- private final ModelRenderer cube_r2;
- private final ModelRenderer cube_r3;
- private final ModelRenderer cube_r12;
- private final ModelRenderer cube_r13;
- private final ModelRenderer cube_r14;
- private final ModelRenderer cube_r15;
- private final ModelRenderer chestplate;
- private final ModelRenderer cube_r16;
- private final ModelRenderer cube_r4;
- private final ModelRenderer cube_r4_r1;
- private final ModelRenderer cube_r5;
- private final ModelRenderer cube_r5_r1;
- private final ModelRenderer cube_r6;
- private final ModelRenderer cube_r7;
- private final ModelRenderer cube_r7_r1;
- private final ModelRenderer cube_r7_r2;
- private final ModelRenderer lArm;
- private final ModelRenderer cube_r17;
- private final ModelRenderer cube_r8;
- private final ModelRenderer cube_r9;
- private final ModelRenderer rArm;
- private final ModelRenderer cube_r18;
- private final ModelRenderer cube_r10;
- private final ModelRenderer cube_r11;
- private final ModelRenderer lLeg;
- private final ModelRenderer cube_r19;
- private final ModelRenderer cube_r20;
- private final ModelRenderer cube_r21;
- private final ModelRenderer rLeg;
- private final ModelRenderer cube_r22;
- private final ModelRenderer cube_r23;
- private final ModelRenderer cube_r24;
- private final ModelRenderer lBoot;
- private final ModelRenderer cube_r25;
- private final ModelRenderer cube_r26;
- private final ModelRenderer rBoot;
- private final ModelRenderer cube_r27;
- private final ModelRenderer cube_r28;
-
- int slot;
- public ModelArmorNebula(int slot) {
- this.slot = slot;
-
- textureWidth = 64;
- textureHeight = 128;
-
- head = new ModelRenderer(this);
- head.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.cubeList.add(new ModelBox(head, 0, 66, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.21F));
- head.cubeList.add(new ModelBox(head, 36, 90, -3.0F, -8.75F, -3.0F, 6, 1, 4, 0.21F));
-
- head.cubeList.add(new ModelBox(head, 0, 90, -4.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
- head.cubeList.add(new ModelBox(head, 19, 86, 3.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
- head.cubeList.add(new ModelBox(head, 28, 80, -3.0F, -6.0F, -4.0F, 6, 1, 1, 0.2075F));
- head.cubeList.add(new ModelBox(head, 23, 81, -4.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
- head.cubeList.add(new ModelBox(head, 23, 78, 3.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
+ private final ModelRenderer head;
+ private final ModelRenderer cube_r1;
+ private final ModelRenderer cube_r2;
+ private final ModelRenderer cube_r3;
+ private final ModelRenderer cube_r12;
+ private final ModelRenderer cube_r13;
+ private final ModelRenderer cube_r14;
+ private final ModelRenderer cube_r15;
+ private final ModelRenderer chestplate;
+ private final ModelRenderer cube_r16;
+ private final ModelRenderer cube_r4;
+ private final ModelRenderer cube_r4_r1;
+ private final ModelRenderer cube_r5;
+ private final ModelRenderer cube_r5_r1;
+ private final ModelRenderer cube_r6;
+ private final ModelRenderer cube_r7;
+ private final ModelRenderer cube_r7_r1;
+ private final ModelRenderer cube_r7_r2;
+ private final ModelRenderer lArm;
+ private final ModelRenderer cube_r17;
+ private final ModelRenderer cube_r8;
+ private final ModelRenderer cube_r9;
+ private final ModelRenderer rArm;
+ private final ModelRenderer cube_r18;
+ private final ModelRenderer cube_r10;
+ private final ModelRenderer cube_r11;
+ private final ModelRenderer lLeg;
+ private final ModelRenderer cube_r19;
+ private final ModelRenderer cube_r20;
+ private final ModelRenderer cube_r21;
+ private final ModelRenderer rLeg;
+ private final ModelRenderer cube_r22;
+ private final ModelRenderer cube_r23;
+ private final ModelRenderer cube_r24;
+ private final ModelRenderer lBoot;
+ private final ModelRenderer cube_r25;
+ private final ModelRenderer cube_r26;
+ private final ModelRenderer rBoot;
+ private final ModelRenderer cube_r27;
+ private final ModelRenderer cube_r28;
- cube_r1 = new ModelRenderer(this);
- cube_r1.setRotationPoint(0.0F, 0.0F, 0.3F);
- head.addChild(cube_r1);
- setRotationAngle(cube_r1, -0.1745F, -0.3491F, 0.0F);
- cube_r1.cubeList.add(new ModelBox(cube_r1, 16, 78, 0.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
+ int slot;
- cube_r2 = new ModelRenderer(this);
- cube_r2.setRotationPoint(0.0F, 0.0F, 0.3F);
- head.addChild(cube_r2);
- setRotationAngle(cube_r2, -0.1745F, 0.3491F, 0.0F);
- cube_r2.cubeList.add(new ModelBox(cube_r2, 9, 78, -2.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
+ public ModelArmorNebula(int slot) {
+ this.slot = slot;
- cube_r3 = new ModelRenderer(this);
- cube_r3.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.addChild(cube_r3);
- setRotationAngle(cube_r3, -0.2618F, 0.0F, 0.0F);
- cube_r3.cubeList.add(new ModelBox(cube_r3, 5, 83, -1.0F, -9.0F, -2.5F, 2, 1, 5, 0.21F));
+ textureWidth = 64;
+ textureHeight = 128;
- cube_r12 = new ModelRenderer(this);
- cube_r12.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.addChild(cube_r12);
- setRotationAngle(cube_r12, 0.7418F, 0.0F, -0.0873F);
- cube_r12.cubeList.add(new ModelBox(cube_r12, 47, 83, -4.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
+ head = new ModelRenderer(this);
+ head.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.cubeList.add(new ModelBox(head, 0, 66, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.21F));
+ head.cubeList.add(new ModelBox(head, 36, 90, -3.0F, -8.75F, -3.0F, 6, 1, 4, 0.21F));
- cube_r13 = new ModelRenderer(this);
- cube_r13.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.addChild(cube_r13);
- setRotationAngle(cube_r13, 0.7418F, 0.0F, 0.0873F);
- cube_r13.cubeList.add(new ModelBox(cube_r13, 45, 76, 2.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
+ head.cubeList.add(new ModelBox(head, 0, 90, -4.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
+ head.cubeList.add(new ModelBox(head, 19, 86, 3.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
+ head.cubeList.add(new ModelBox(head, 28, 80, -3.0F, -6.0F, -4.0F, 6, 1, 1, 0.2075F));
+ head.cubeList.add(new ModelBox(head, 23, 81, -4.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
+ head.cubeList.add(new ModelBox(head, 23, 78, 3.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
- cube_r14 = new ModelRenderer(this);
- cube_r14.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.addChild(cube_r14);
- setRotationAngle(cube_r14, -0.0873F, 0.0F, 0.0F);
- cube_r14.cubeList.add(new ModelBox(cube_r14, 31, 84, -1.0F, -5.0F, -4.6F, 2, 1, 1, 0.21F));
+ cube_r1 = new ModelRenderer(this);
+ cube_r1.setRotationPoint(0.0F, 0.0F, 0.3F);
+ head.addChild(cube_r1);
+ setRotationAngle(cube_r1, -0.1745F, -0.3491F, 0.0F);
+ cube_r1.cubeList.add(new ModelBox(cube_r1, 16, 78, 0.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
- cube_r15 = new ModelRenderer(this);
- cube_r15.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.addChild(cube_r15);
- setRotationAngle(cube_r15, -0.48F, 0.0F, 0.0F);
- cube_r15.cubeList.add(new ModelBox(cube_r15, 0, 78, -1.0F, -7.9F, -8.0F, 2, 4, 2, 0.21F));
+ cube_r2 = new ModelRenderer(this);
+ cube_r2.setRotationPoint(0.0F, 0.0F, 0.3F);
+ head.addChild(cube_r2);
+ setRotationAngle(cube_r2, -0.1745F, 0.3491F, 0.0F);
+ cube_r2.cubeList.add(new ModelBox(cube_r2, 9, 78, -2.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
- chestplate = new ModelRenderer(this);
- chestplate.setRotationPoint(0.0F, 0.0F, 0.0F);
- chestplate.cubeList.add(new ModelBox(chestplate, 0, 0, -4.5F, -0.2F, -3.0F, 9, 11, 6, 0.0F));
- chestplate.cubeList.add(new ModelBox(chestplate, 31, 10, -2.5F, 5.7F, 1.9F, 5, 4, 2, 0.0F));
- chestplate.cubeList.add(new ModelBox(chestplate, 31, 0, -3.5F, -0.6F, 2.6F, 7, 7, 2, 0.0F));
+ cube_r3 = new ModelRenderer(this);
+ cube_r3.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.addChild(cube_r3);
+ setRotationAngle(cube_r3, -0.2618F, 0.0F, 0.0F);
+ cube_r3.cubeList.add(new ModelBox(cube_r3, 5, 83, -1.0F, -9.0F, -2.5F, 2, 1, 5, 0.21F));
- cube_r16 = new ModelRenderer(this);
- cube_r16.setRotationPoint(0.0F, 24.0F, -1.0F);
- chestplate.addChild(cube_r16);
- setRotationAngle(cube_r16, 0.1309F, 0.0F, 0.0F);
- cube_r16.cubeList.add(new ModelBox(cube_r16, 57, 16, -1.0F, -20.7F, 7.7F, 2, 6, 1, 0.0F));
+ cube_r12 = new ModelRenderer(this);
+ cube_r12.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.addChild(cube_r12);
+ setRotationAngle(cube_r12, 0.7418F, 0.0F, -0.0873F);
+ cube_r12.cubeList.add(new ModelBox(cube_r12, 47, 83, -4.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
- cube_r4 = new ModelRenderer(this);
- cube_r4.setRotationPoint(-0.1F, 25.2F, 3.35F);
- chestplate.addChild(cube_r4);
- setRotationAngle(cube_r4, 0.2618F, 0.0F, 0.1745F);
-
+ cube_r13 = new ModelRenderer(this);
+ cube_r13.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.addChild(cube_r13);
+ setRotationAngle(cube_r13, 0.7418F, 0.0F, 0.0873F);
+ cube_r13.cubeList.add(new ModelBox(cube_r13, 45, 76, 2.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
- cube_r4_r1 = new ModelRenderer(this);
- cube_r4_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
- cube_r4.addChild(cube_r4_r1);
- setRotationAngle(cube_r4_r1, -0.5236F, 0.0F, 0.0F);
- cube_r4_r1.cubeList.add(new ModelBox(cube_r4_r1, 50, 8, -2.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
+ cube_r14 = new ModelRenderer(this);
+ cube_r14.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.addChild(cube_r14);
+ setRotationAngle(cube_r14, -0.0873F, 0.0F, 0.0F);
+ cube_r14.cubeList.add(new ModelBox(cube_r14, 31, 84, -1.0F, -5.0F, -4.6F, 2, 1, 1, 0.21F));
- cube_r5 = new ModelRenderer(this);
- cube_r5.setRotationPoint(-0.1F, 25.2F, 3.35F);
- chestplate.addChild(cube_r5);
- setRotationAngle(cube_r5, 0.2618F, 0.0F, -0.1745F);
-
+ cube_r15 = new ModelRenderer(this);
+ cube_r15.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.addChild(cube_r15);
+ setRotationAngle(cube_r15, -0.48F, 0.0F, 0.0F);
+ cube_r15.cubeList.add(new ModelBox(cube_r15, 0, 78, -1.0F, -7.9F, -8.0F, 2, 4, 2, 0.21F));
- cube_r5_r1 = new ModelRenderer(this);
- cube_r5_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
- cube_r5.addChild(cube_r5_r1);
- setRotationAngle(cube_r5_r1, -0.5236F, 0.0F, 0.0F);
- cube_r5_r1.cubeList.add(new ModelBox(cube_r5_r1, 50, 0, 0.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
+ chestplate = new ModelRenderer(this);
+ chestplate.setRotationPoint(0.0F, 0.0F, 0.0F);
+ chestplate.cubeList.add(new ModelBox(chestplate, 0, 0, -4.5F, -0.2F, -3.0F, 9, 11, 6, 0.0F));
+ chestplate.cubeList.add(new ModelBox(chestplate, 31, 10, -2.5F, 5.7F, 1.9F, 5, 4, 2, 0.0F));
+ chestplate.cubeList.add(new ModelBox(chestplate, 31, 0, -3.5F, -0.6F, 2.6F, 7, 7, 2, 0.0F));
- cube_r6 = new ModelRenderer(this);
- cube_r6.setRotationPoint(0.0F, 24.0F, 0.0F);
- chestplate.addChild(cube_r6);
- setRotationAngle(cube_r6, -0.1745F, 0.0F, 0.0F);
-
+ cube_r16 = new ModelRenderer(this);
+ cube_r16.setRotationPoint(0.0F, 24.0F, -1.0F);
+ chestplate.addChild(cube_r16);
+ setRotationAngle(cube_r16, 0.1309F, 0.0F, 0.0F);
+ cube_r16.cubeList.add(new ModelBox(cube_r16, 57, 16, -1.0F, -20.7F, 7.7F, 2, 6, 1, 0.0F));
- cube_r7 = new ModelRenderer(this);
- cube_r7.setRotationPoint(0.0F, 23.75F, 0.0F);
- chestplate.addChild(cube_r7);
- setRotationAngle(cube_r7, -0.0873F, 0.0F, 0.0F);
-
+ cube_r4 = new ModelRenderer(this);
+ cube_r4.setRotationPoint(-0.1F, 25.2F, 3.35F);
+ chestplate.addChild(cube_r4);
+ setRotationAngle(cube_r4, 0.2618F, 0.0F, 0.1745F);
- cube_r7_r1 = new ModelRenderer(this);
- cube_r7_r1.setRotationPoint(0.0F, -0.3F, 0.0F);
- cube_r7.addChild(cube_r7_r1);
- setRotationAngle(cube_r7_r1, 0.2182F, 0.0F, 0.0F);
- cube_r7_r1.cubeList.add(new ModelBox(cube_r7_r1, 34, 68, -1.5F, -23.1842F, -1.1615F, 3, 8, 2, 0.0F));
+ cube_r4_r1 = new ModelRenderer(this);
+ cube_r4_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
+ cube_r4.addChild(cube_r4_r1);
+ setRotationAngle(cube_r4_r1, -0.5236F, 0.0F, 0.0F);
+ cube_r4_r1.cubeList.add(new ModelBox(cube_r4_r1, 50, 8, -2.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
- cube_r7_r2 = new ModelRenderer(this);
- cube_r7_r2.setRotationPoint(0.0F, -0.3F, 0.0F);
- cube_r7.addChild(cube_r7_r2);
- setRotationAngle(cube_r7_r2, 0.2618F, 0.0F, 0.0F);
- cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 34, 17, 1.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
- cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 54, 69, -3.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
+ cube_r5 = new ModelRenderer(this);
+ cube_r5.setRotationPoint(-0.1F, 25.2F, 3.35F);
+ chestplate.addChild(cube_r5);
+ setRotationAngle(cube_r5, 0.2618F, 0.0F, -0.1745F);
- lArm = new ModelRenderer(this);
- lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
- lArm.cubeList.add(new ModelBox(lArm, 0, 27, -4.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
- lArm.cubeList.add(new ModelBox(lArm, 21, 27, -3.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
+ cube_r5_r1 = new ModelRenderer(this);
+ cube_r5_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
+ cube_r5.addChild(cube_r5_r1);
+ setRotationAngle(cube_r5_r1, -0.5236F, 0.0F, 0.0F);
+ cube_r5_r1.cubeList.add(new ModelBox(cube_r5_r1, 50, 0, 0.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
- cube_r17 = new ModelRenderer(this);
- cube_r17.setRotationPoint(0.0F, -3.5F, 0.0F);
- lArm.addChild(cube_r17);
- setRotationAngle(cube_r17, 0.8727F, 0.0F, 0.0F);
- cube_r17.cubeList.add(new ModelBox(cube_r17, 45, 63, -1.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
+ cube_r6 = new ModelRenderer(this);
+ cube_r6.setRotationPoint(0.0F, 24.0F, 0.0F);
+ chestplate.addChild(cube_r6);
+ setRotationAngle(cube_r6, -0.1745F, 0.0F, 0.0F);
- cube_r8 = new ModelRenderer(this);
- cube_r8.setRotationPoint(5.2F, 22.3F, 0.0F);
- lArm.addChild(cube_r8);
- setRotationAngle(cube_r8, 0.0F, 0.0F, 0.2182F);
- cube_r8.cubeList.add(new ModelBox(cube_r8, 54, 25, -14.0918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
+ cube_r7 = new ModelRenderer(this);
+ cube_r7.setRotationPoint(0.0F, 23.75F, 0.0F);
+ chestplate.addChild(cube_r7);
+ setRotationAngle(cube_r7, -0.0873F, 0.0F, 0.0F);
- cube_r9 = new ModelRenderer(this);
- cube_r9.setRotationPoint(5.2F, 22.3F, 0.0F);
- lArm.addChild(cube_r9);
- setRotationAngle(cube_r9, 0.0F, 0.0F, 0.0873F);
- cube_r9.cubeList.add(new ModelBox(cube_r9, 16, 19, -11.8564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
+ cube_r7_r1 = new ModelRenderer(this);
+ cube_r7_r1.setRotationPoint(0.0F, -0.3F, 0.0F);
+ cube_r7.addChild(cube_r7_r1);
+ setRotationAngle(cube_r7_r1, 0.2182F, 0.0F, 0.0F);
+ cube_r7_r1.cubeList.add(new ModelBox(cube_r7_r1, 34, 68, -1.5F, -23.1842F, -1.1615F, 3, 8, 2, 0.0F));
- rArm = new ModelRenderer(this);
- rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
- rArm.cubeList.add(new ModelBox(rArm, 38, 26, -1.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
- rArm.cubeList.add(new ModelBox(rArm, 0, 38, -1.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
+ cube_r7_r2 = new ModelRenderer(this);
+ cube_r7_r2.setRotationPoint(0.0F, -0.3F, 0.0F);
+ cube_r7.addChild(cube_r7_r2);
+ setRotationAngle(cube_r7_r2, 0.2618F, 0.0F, 0.0F);
+ cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 34, 17, 1.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
+ cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 54, 69, -3.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
- cube_r18 = new ModelRenderer(this);
- cube_r18.setRotationPoint(-10.0F, -3.5F, 0.0F);
- rArm.addChild(cube_r18);
- setRotationAngle(cube_r18, 0.8727F, 0.0F, 0.0F);
- cube_r18.cubeList.add(new ModelBox(cube_r18, 45, 63, 9.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
+ lArm = new ModelRenderer(this);
+ lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
+ lArm.cubeList.add(new ModelBox(lArm, 0, 27, -4.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
+ lArm.cubeList.add(new ModelBox(lArm, 21, 27, -3.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
- cube_r10 = new ModelRenderer(this);
- cube_r10.setRotationPoint(-4.8F, 22.3F, 0.0F);
- rArm.addChild(cube_r10);
- setRotationAngle(cube_r10, 0.0F, 0.0F, -0.2182F);
- cube_r10.cubeList.add(new ModelBox(cube_r10, 19, 36, 11.6918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
+ cube_r17 = new ModelRenderer(this);
+ cube_r17.setRotationPoint(0.0F, -3.5F, 0.0F);
+ lArm.addChild(cube_r17);
+ setRotationAngle(cube_r17, 0.8727F, 0.0F, 0.0F);
+ cube_r17.cubeList.add(new ModelBox(cube_r17, 45, 63, -1.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
- cube_r11 = new ModelRenderer(this);
- cube_r11.setRotationPoint(-4.8F, 22.3F, 0.0F);
- rArm.addChild(cube_r11);
- setRotationAngle(cube_r11, 0.0F, 0.0F, -0.0873F);
- cube_r11.cubeList.add(new ModelBox(cube_r11, 24, 38, 7.4564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
+ cube_r8 = new ModelRenderer(this);
+ cube_r8.setRotationPoint(5.2F, 22.3F, 0.0F);
+ lArm.addChild(cube_r8);
+ setRotationAngle(cube_r8, 0.0F, 0.0F, 0.2182F);
+ cube_r8.cubeList.add(new ModelBox(cube_r8, 54, 25, -14.0918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
- lLeg = new ModelRenderer(this);
- lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
- lLeg.cubeList.add(new ModelBox(lLeg, 0, 50, -4.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
+ cube_r9 = new ModelRenderer(this);
+ cube_r9.setRotationPoint(5.2F, 22.3F, 0.0F);
+ lArm.addChild(cube_r9);
+ setRotationAngle(cube_r9, 0.0F, 0.0F, 0.0873F);
+ cube_r9.cubeList.add(new ModelBox(cube_r9, 16, 19, -11.8564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
- cube_r19 = new ModelRenderer(this);
- cube_r19.setRotationPoint(0.0F, 0.0F, 0.0F);
- lLeg.addChild(cube_r19);
- setRotationAngle(cube_r19, 0.2618F, 0.0F, 0.0F);
- cube_r19.cubeList.add(new ModelBox(cube_r19, 46, 17, -3.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
+ rArm = new ModelRenderer(this);
+ rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
+ rArm.cubeList.add(new ModelBox(rArm, 38, 26, -1.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
+ rArm.cubeList.add(new ModelBox(rArm, 0, 38, -1.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
- cube_r20 = new ModelRenderer(this);
- cube_r20.setRotationPoint(0.0F, 0.0F, 0.0F);
- lLeg.addChild(cube_r20);
- setRotationAngle(cube_r20, 0.3054F, 0.0F, 0.0F);
- cube_r20.cubeList.add(new ModelBox(cube_r20, 7, 20, -3.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
+ cube_r18 = new ModelRenderer(this);
+ cube_r18.setRotationPoint(-10.0F, -3.5F, 0.0F);
+ rArm.addChild(cube_r18);
+ setRotationAngle(cube_r18, 0.8727F, 0.0F, 0.0F);
+ cube_r18.cubeList.add(new ModelBox(cube_r18, 45, 63, 9.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
- cube_r21 = new ModelRenderer(this);
- cube_r21.setRotationPoint(0.0F, 12.0F, 1.0F);
- lLeg.addChild(cube_r21);
- setRotationAngle(cube_r21, 0.1745F, 0.0F, -0.1745F);
- cube_r21.cubeList.add(new ModelBox(cube_r21, 17, 48, -3.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
+ cube_r10 = new ModelRenderer(this);
+ cube_r10.setRotationPoint(-4.8F, 22.3F, 0.0F);
+ rArm.addChild(cube_r10);
+ setRotationAngle(cube_r10, 0.0F, 0.0F, -0.2182F);
+ cube_r10.cubeList.add(new ModelBox(cube_r10, 19, 36, 11.6918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
- rLeg = new ModelRenderer(this);
- rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
- rLeg.cubeList.add(new ModelBox(rLeg, 42, 38, 0.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
+ cube_r11 = new ModelRenderer(this);
+ cube_r11.setRotationPoint(-4.8F, 22.3F, 0.0F);
+ rArm.addChild(cube_r11);
+ setRotationAngle(cube_r11, 0.0F, 0.0F, -0.0873F);
+ cube_r11.cubeList.add(new ModelBox(cube_r11, 24, 38, 7.4564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
- cube_r22 = new ModelRenderer(this);
- cube_r22.setRotationPoint(0.0F, 0.0F, 0.0F);
- rLeg.addChild(cube_r22);
- setRotationAngle(cube_r22, 0.2618F, 0.0F, 0.0F);
- cube_r22.cubeList.add(new ModelBox(cube_r22, 35, 46, 1.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
+ lLeg = new ModelRenderer(this);
+ lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
+ lLeg.cubeList.add(new ModelBox(lLeg, 0, 50, -4.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
- cube_r23 = new ModelRenderer(this);
- cube_r23.setRotationPoint(0.0F, 0.0F, 0.0F);
- rLeg.addChild(cube_r23);
- setRotationAngle(cube_r23, 0.3054F, 0.0F, 0.0F);
- cube_r23.cubeList.add(new ModelBox(cube_r23, 0, 20, 1.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
+ cube_r19 = new ModelRenderer(this);
+ cube_r19.setRotationPoint(0.0F, 0.0F, 0.0F);
+ lLeg.addChild(cube_r19);
+ setRotationAngle(cube_r19, 0.2618F, 0.0F, 0.0F);
+ cube_r19.cubeList.add(new ModelBox(cube_r19, 46, 17, -3.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
- cube_r24 = new ModelRenderer(this);
- cube_r24.setRotationPoint(0.0F, 12.0F, 1.0F);
- rLeg.addChild(cube_r24);
- setRotationAngle(cube_r24, 0.1745F, 0.0F, 0.1745F);
- cube_r24.cubeList.add(new ModelBox(cube_r24, 26, 48, 1.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
+ cube_r20 = new ModelRenderer(this);
+ cube_r20.setRotationPoint(0.0F, 0.0F, 0.0F);
+ lLeg.addChild(cube_r20);
+ setRotationAngle(cube_r20, 0.3054F, 0.0F, 0.0F);
+ cube_r20.cubeList.add(new ModelBox(cube_r20, 7, 20, -3.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
- lBoot = new ModelRenderer(this);
- lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
- lBoot.cubeList.add(new ModelBox(lBoot, 18, 56, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
+ cube_r21 = new ModelRenderer(this);
+ cube_r21.setRotationPoint(0.0F, 12.0F, 1.0F);
+ lLeg.addChild(cube_r21);
+ setRotationAngle(cube_r21, 0.1745F, 0.0F, -0.1745F);
+ cube_r21.cubeList.add(new ModelBox(cube_r21, 17, 48, -3.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
- cube_r25 = new ModelRenderer(this);
- cube_r25.setRotationPoint(0.0F, 12.0F, -1.0F);
- lBoot.addChild(cube_r25);
- setRotationAngle(cube_r25, -0.3054F, 0.0F, 0.0F);
- cube_r25.cubeList.add(new ModelBox(cube_r25, 40, 52, 1.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
+ rLeg = new ModelRenderer(this);
+ rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
+ rLeg.cubeList.add(new ModelBox(rLeg, 42, 38, 0.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
- cube_r26 = new ModelRenderer(this);
- cube_r26.setRotationPoint(0.0F, 12.0F, -1.0F);
- lBoot.addChild(cube_r26);
- setRotationAngle(cube_r26, 0.7418F, 0.0F, 0.1745F);
- cube_r26.cubeList.add(new ModelBox(cube_r26, 33, 54, 3.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
+ cube_r22 = new ModelRenderer(this);
+ cube_r22.setRotationPoint(0.0F, 0.0F, 0.0F);
+ rLeg.addChild(cube_r22);
+ setRotationAngle(cube_r22, 0.2618F, 0.0F, 0.0F);
+ cube_r22.cubeList.add(new ModelBox(cube_r22, 35, 46, 1.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
- rBoot = new ModelRenderer(this);
- rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
- rBoot.cubeList.add(new ModelBox(rBoot, 44, 53, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
+ cube_r23 = new ModelRenderer(this);
+ cube_r23.setRotationPoint(0.0F, 0.0F, 0.0F);
+ rLeg.addChild(cube_r23);
+ setRotationAngle(cube_r23, 0.3054F, 0.0F, 0.0F);
+ cube_r23.cubeList.add(new ModelBox(cube_r23, 0, 20, 1.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
- cube_r27 = new ModelRenderer(this);
- cube_r27.setRotationPoint(0.0F, 12.0F, -1.0F);
- rBoot.addChild(cube_r27);
- setRotationAngle(cube_r27, -0.3054F, 0.0F, 0.0F);
- cube_r27.cubeList.add(new ModelBox(cube_r27, 27, 65, -3.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
+ cube_r24 = new ModelRenderer(this);
+ cube_r24.setRotationPoint(0.0F, 12.0F, 1.0F);
+ rLeg.addChild(cube_r24);
+ setRotationAngle(cube_r24, 0.1745F, 0.0F, 0.1745F);
+ cube_r24.cubeList.add(new ModelBox(cube_r24, 26, 48, 1.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
- cube_r28 = new ModelRenderer(this);
- cube_r28.setRotationPoint(0.0F, 12.0F, -1.0F);
- rBoot.addChild(cube_r28);
- setRotationAngle(cube_r28, 0.7418F, 0.0F, -0.1745F);
- cube_r28.cubeList.add(new ModelBox(cube_r28, 37, 61, -4.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
- }
-
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- if(entity instanceof net.minecraft.entity.monster.EntitySkeleton || entity instanceof net.minecraft.entity.monster.EntityZombie)
- setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
- else {
- prepareForRender(entity);
- setRotationAngles(f, f1, f2, f3, f4, f5, entity);
- }
- this.head.showModel = (this.slot == 0);
- this.chestplate.showModel = (this.slot == 1);
- this.lArm.showModel = (this.slot == 1);
- this.rArm.showModel = (this.slot == 1);
- this.rLeg.showModel = (this.slot == 2);
- this.lLeg.showModel = (this.slot == 2);
- this.lBoot.showModel = (this.slot == 3);
- this.rBoot.showModel = (this.slot == 3);
- this.bipedHeadwear.showModel = false;
- this.bipedHead = this.head;
- this.bipedBody = this.chestplate;
- this.bipedRightArm = this.lArm;
- this.bipedLeftArm = this.rArm;
- if(this.slot == 2) {
- this.bipedRightLeg = this.lLeg;
- this.bipedLeftLeg = this.rLeg;
- } else {
- this.bipedRightLeg = this.rBoot;
- this.bipedLeftLeg = this.lBoot;
- }
- if(this.isChild) {
+ lBoot = new ModelRenderer(this);
+ lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
+ lBoot.cubeList.add(new ModelBox(lBoot, 18, 56, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
+
+ cube_r25 = new ModelRenderer(this);
+ cube_r25.setRotationPoint(0.0F, 12.0F, -1.0F);
+ lBoot.addChild(cube_r25);
+ setRotationAngle(cube_r25, -0.3054F, 0.0F, 0.0F);
+ cube_r25.cubeList.add(new ModelBox(cube_r25, 40, 52, 1.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
+
+ cube_r26 = new ModelRenderer(this);
+ cube_r26.setRotationPoint(0.0F, 12.0F, -1.0F);
+ lBoot.addChild(cube_r26);
+ setRotationAngle(cube_r26, 0.7418F, 0.0F, 0.1745F);
+ cube_r26.cubeList.add(new ModelBox(cube_r26, 33, 54, 3.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
+
+ rBoot = new ModelRenderer(this);
+ rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
+ rBoot.cubeList.add(new ModelBox(rBoot, 44, 53, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
+
+ cube_r27 = new ModelRenderer(this);
+ cube_r27.setRotationPoint(0.0F, 12.0F, -1.0F);
+ rBoot.addChild(cube_r27);
+ setRotationAngle(cube_r27, -0.3054F, 0.0F, 0.0F);
+ cube_r27.cubeList.add(new ModelBox(cube_r27, 27, 65, -3.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
+
+ cube_r28 = new ModelRenderer(this);
+ cube_r28.setRotationPoint(0.0F, 12.0F, -1.0F);
+ rBoot.addChild(cube_r28);
+ setRotationAngle(cube_r28, 0.7418F, 0.0F, -0.1745F);
+ cube_r28.cubeList.add(new ModelBox(cube_r28, 37, 61, -4.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
+ }
+
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
+ if (entity instanceof net.minecraft.entity.monster.EntitySkeleton
+ || entity instanceof net.minecraft.entity.monster.EntityZombie)
+ setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
+ else {
+ prepareForRender(entity);
+ setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ }
+ this.head.showModel = (this.slot == 0);
+ this.chestplate.showModel = (this.slot == 1);
+ this.lArm.showModel = (this.slot == 1);
+ this.rArm.showModel = (this.slot == 1);
+ this.rLeg.showModel = (this.slot == 2);
+ this.lLeg.showModel = (this.slot == 2);
+ this.lBoot.showModel = (this.slot == 3);
+ this.rBoot.showModel = (this.slot == 3);
+ this.bipedHeadwear.showModel = false;
+ this.bipedHead = this.head;
+ this.bipedBody = this.chestplate;
+ this.bipedRightArm = this.lArm;
+ this.bipedLeftArm = this.rArm;
+ if (this.slot == 2) {
+ this.bipedRightLeg = this.lLeg;
+ this.bipedLeftLeg = this.rLeg;
+ } else {
+ this.bipedRightLeg = this.rBoot;
+ this.bipedLeftLeg = this.lBoot;
+ }
+ if (this.isChild) {
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
@@ -361,48 +350,49 @@ public class ModelArmorNebula extends ModelBiped {
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
}
- }
-
- public void prepareForRender(Entity entity) {
- EntityLivingBase living = (EntityLivingBase)entity;
- this.isSneak = (living != null) ? living.isSneaking() : false;
- if (living != null && living instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)living;
- ItemStack itemstack = player.inventory.getCurrentItem();
- this.heldItemRight = (itemstack != null) ? 1 : 0;
- this.aimedBow = false;
- if (itemstack != null && player.getItemInUseCount() > 0) {
- EnumAction enumaction = itemstack.getItemUseAction();
- if (enumaction == EnumAction.block) {
- this.heldItemRight = 3;
- } else if (enumaction == EnumAction.bow) {
- this.aimedBow = true;
- }
- }
- }
- }
-
- public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
- setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
- float f6 = MathHelper.sin(this.onGround * 3.1415927F);
- float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
- this.bipedRightArm.rotateAngleZ = 0.0F;
- this.bipedLeftArm.rotateAngleZ = 0.0F;
- this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
- this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
- this.bipedRightArm.rotateAngleX = -1.5707964F;
- this.bipedLeftArm.rotateAngleX = -1.5707964F;
- this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
- this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
- this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
- this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
- this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
- this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
- }
-
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
-}
\ No newline at end of file
+ }
+
+ public void prepareForRender(Entity entity) {
+ EntityLivingBase living = (EntityLivingBase) entity;
+ this.isSneak = (living != null) ? living.isSneaking() : false;
+ if (living != null && living instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) living;
+ ItemStack itemstack = player.inventory.getCurrentItem();
+ this.heldItemRight = (itemstack != null) ? 1 : 0;
+ this.aimedBow = false;
+ if (itemstack != null && player.getItemInUseCount() > 0) {
+ EnumAction enumaction = itemstack.getItemUseAction();
+ if (enumaction == EnumAction.block) {
+ this.heldItemRight = 3;
+ } else if (enumaction == EnumAction.bow) {
+ this.aimedBow = true;
+ }
+ }
+ }
+ }
+
+ public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_,
+ float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
+ setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
+ float f6 = MathHelper.sin(this.onGround * 3.1415927F);
+ float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
+ this.bipedRightArm.rotateAngleZ = 0.0F;
+ this.bipedLeftArm.rotateAngleZ = 0.0F;
+ this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
+ this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
+ this.bipedRightArm.rotateAngleX = -1.5707964F;
+ this.bipedLeftArm.rotateAngleX = -1.5707964F;
+ this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
+ this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
+ this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
+ this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
+ this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
+ this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ab/client/model/armor/ModelArmorWildHunt.java b/src/main/java/ab/client/model/armor/ModelArmorWildHunt.java
index 50c3290..8640707 100644
--- a/src/main/java/ab/client/model/armor/ModelArmorWildHunt.java
+++ b/src/main/java/ab/client/model/armor/ModelArmorWildHunt.java
@@ -1,7 +1,5 @@
package ab.client.model.armor;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
@@ -12,345 +10,348 @@ import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
+import org.lwjgl.opengl.GL11;
+
public class ModelArmorWildHunt extends ModelBiped {
-
- private final ModelRenderer head;
- private final ModelRenderer cube_r1;
- private final ModelRenderer cube_r2;
- private final ModelRenderer cube_r3;
- private final ModelRenderer cube_r4;
- private final ModelRenderer cube_r5;
- private final ModelRenderer cube_r6;
- private final ModelRenderer cube_r7;
- private final ModelRenderer cube_r8;
- private final ModelRenderer cube_r9;
- private final ModelRenderer cube_r10;
- private final ModelRenderer cube_r11;
- private final ModelRenderer cube_r12;
- private final ModelRenderer cube_r13;
- private final ModelRenderer cube_r14;
- private final ModelRenderer cube_r15;
- private final ModelRenderer cube_r16;
- private final ModelRenderer chest;
- private final ModelRenderer cube_r17;
- private final ModelRenderer cube_r18;
- private final ModelRenderer cube_r19;
- private final ModelRenderer cloak;
- private final ModelRenderer cube_r20;
- private final ModelRenderer lArm;
- private final ModelRenderer cube_r21;
- private final ModelRenderer cube_r22;
- private final ModelRenderer cube_r23;
- private final ModelRenderer cube_r24;
- private final ModelRenderer cube_r25;
- private final ModelRenderer cube_r26;
- private final ModelRenderer rArm;
- private final ModelRenderer cube_r27;
- private final ModelRenderer cube_r28;
- private final ModelRenderer cube_r29;
- private final ModelRenderer cube_r30;
- private final ModelRenderer cube_r31;
- private final ModelRenderer cube_r32;
- private final ModelRenderer lLeg;
- private final ModelRenderer cube_r33;
- private final ModelRenderer rLeg;
- private final ModelRenderer cube_r34;
- private final ModelRenderer rBoot;
- private final ModelRenderer lBoot;
-
- int slot;
-
- public ModelArmorWildHunt(int slot) {
- this.slot = slot;
-
- textureWidth = 64;
- textureHeight = 128;
- head = new ModelRenderer(this);
- head.setRotationPoint(0.0F, 0.0F, 0.0F);
- head.cubeList.add(new ModelBox(head, 32, 7, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.25F));
- head.cubeList.add(new ModelBox(head, 38, 18, -4.0F, -8.6F, -4.0F, 8, 1, 5, 0.0F));
- head.cubeList.add(new ModelBox(head, 21, 20, -3.0F, -8.6F, 1.0F, 6, 1, 2, 0.0F));
- head.cubeList.add(new ModelBox(head, 46, 86, -3.5F, -6.0F, 3.0F, 7, 1, 1, 0.1F));
- head.cubeList.add(new ModelBox(head, 40, 25, 3.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
- head.cubeList.add(new ModelBox(head, 52, 25, -4.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
- head.cubeList.add(new ModelBox(head, 28, 0, -4.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
- head.cubeList.add(new ModelBox(head, 33, 7, 3.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
+ private final ModelRenderer head;
+ private final ModelRenderer cube_r1;
+ private final ModelRenderer cube_r2;
+ private final ModelRenderer cube_r3;
+ private final ModelRenderer cube_r4;
+ private final ModelRenderer cube_r5;
+ private final ModelRenderer cube_r6;
+ private final ModelRenderer cube_r7;
+ private final ModelRenderer cube_r8;
+ private final ModelRenderer cube_r9;
+ private final ModelRenderer cube_r10;
+ private final ModelRenderer cube_r11;
+ private final ModelRenderer cube_r12;
+ private final ModelRenderer cube_r13;
+ private final ModelRenderer cube_r14;
+ private final ModelRenderer cube_r15;
+ private final ModelRenderer cube_r16;
+ private final ModelRenderer chest;
+ private final ModelRenderer cube_r17;
+ private final ModelRenderer cube_r18;
+ private final ModelRenderer cube_r19;
+ private final ModelRenderer cloak;
+ private final ModelRenderer cube_r20;
+ private final ModelRenderer lArm;
+ private final ModelRenderer cube_r21;
+ private final ModelRenderer cube_r22;
+ private final ModelRenderer cube_r23;
+ private final ModelRenderer cube_r24;
+ private final ModelRenderer cube_r25;
+ private final ModelRenderer cube_r26;
+ private final ModelRenderer rArm;
+ private final ModelRenderer cube_r27;
+ private final ModelRenderer cube_r28;
+ private final ModelRenderer cube_r29;
+ private final ModelRenderer cube_r30;
+ private final ModelRenderer cube_r31;
+ private final ModelRenderer cube_r32;
+ private final ModelRenderer lLeg;
+ private final ModelRenderer cube_r33;
+ private final ModelRenderer rLeg;
+ private final ModelRenderer cube_r34;
+ private final ModelRenderer rBoot;
+ private final ModelRenderer lBoot;
- cube_r1 = new ModelRenderer(this);
- cube_r1.setRotationPoint(0.0F, 3.8F, -2.7F);
- head.addChild(cube_r1);
- setRotationAngle(cube_r1, -0.1745F, 0.0F, 0.1309F);
- cube_r1.cubeList.add(new ModelBox(cube_r1, 31, 25, 1.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
+ int slot;
- cube_r2 = new ModelRenderer(this);
- cube_r2.setRotationPoint(0.0F, 3.8F, -2.7F);
- head.addChild(cube_r2);
- setRotationAngle(cube_r2, -0.1745F, 0.0F, -0.1309F);
- cube_r2.cubeList.add(new ModelBox(cube_r2, 22, 25, -3.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
+ public ModelArmorWildHunt(int slot) {
+ this.slot = slot;
- cube_r3 = new ModelRenderer(this);
- cube_r3.setRotationPoint(0.0F, 4.0F, -1.0F);
- head.addChild(cube_r3);
- setRotationAngle(cube_r3, -0.1309F, 0.0F, 0.0F);
- cube_r3.cubeList.add(new ModelBox(cube_r3, 21, 12, -1.0F, -13.1F, -2.8F, 2, 1, 6, 0.0F));
+ textureWidth = 64;
+ textureHeight = 128;
- cube_r4 = new ModelRenderer(this);
- cube_r4.setRotationPoint(0.3F, 4.0F, -1.2F);
- head.addChild(cube_r4);
- setRotationAngle(cube_r4, -0.1309F, 0.0F, 0.0F);
- cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 61, 1.0F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
- cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 55, -3.6F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
+ head = new ModelRenderer(this);
+ head.setRotationPoint(0.0F, 0.0F, 0.0F);
+ head.cubeList.add(new ModelBox(head, 32, 7, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.25F));
+ head.cubeList.add(new ModelBox(head, 38, 18, -4.0F, -8.6F, -4.0F, 8, 1, 5, 0.0F));
+ head.cubeList.add(new ModelBox(head, 21, 20, -3.0F, -8.6F, 1.0F, 6, 1, 2, 0.0F));
+ head.cubeList.add(new ModelBox(head, 46, 86, -3.5F, -6.0F, 3.0F, 7, 1, 1, 0.1F));
+ head.cubeList.add(new ModelBox(head, 40, 25, 3.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
+ head.cubeList.add(new ModelBox(head, 52, 25, -4.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
+ head.cubeList.add(new ModelBox(head, 28, 0, -4.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
+ head.cubeList.add(new ModelBox(head, 33, 7, 3.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
- cube_r5 = new ModelRenderer(this);
- cube_r5.setRotationPoint(-0.3F, 4.0F, -1.2F);
- head.addChild(cube_r5);
- setRotationAngle(cube_r5, 0.2182F, 0.0F, 0.0F);
- cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 71, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
- cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 67, 1.6F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
+ cube_r1 = new ModelRenderer(this);
+ cube_r1.setRotationPoint(0.0F, 3.8F, -2.7F);
+ head.addChild(cube_r1);
+ setRotationAngle(cube_r1, -0.1745F, 0.0F, 0.1309F);
+ cube_r1.cubeList.add(new ModelBox(cube_r1, 31, 25, 1.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
- cube_r6 = new ModelRenderer(this);
- cube_r6.setRotationPoint(0.0F, 4.0F, -1.0F);
- head.addChild(cube_r6);
- setRotationAngle(cube_r6, 0.1309F, 0.0F, 0.0F);
- cube_r6.cubeList.add(new ModelBox(cube_r6, 24, 8, -1.0F, -11.2F, -2.0F, 2, 2, 1, 0.1F));
+ cube_r2 = new ModelRenderer(this);
+ cube_r2.setRotationPoint(0.0F, 3.8F, -2.7F);
+ head.addChild(cube_r2);
+ setRotationAngle(cube_r2, -0.1745F, 0.0F, -0.1309F);
+ cube_r2.cubeList.add(new ModelBox(cube_r2, 22, 25, -3.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
- cube_r7 = new ModelRenderer(this);
- cube_r7.setRotationPoint(-0.8F, 5.5F, -0.1F);
- head.addChild(cube_r7);
- setRotationAngle(cube_r7, -0.1309F, 1.5708F, 0.0F);
- cube_r7.cubeList.add(new ModelBox(cube_r7, 56, 43, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
+ cube_r3 = new ModelRenderer(this);
+ cube_r3.setRotationPoint(0.0F, 4.0F, -1.0F);
+ head.addChild(cube_r3);
+ setRotationAngle(cube_r3, -0.1309F, 0.0F, 0.0F);
+ cube_r3.cubeList.add(new ModelBox(cube_r3, 21, 12, -1.0F, -13.1F, -2.8F, 2, 1, 6, 0.0F));
- cube_r8 = new ModelRenderer(this);
- cube_r8.setRotationPoint(0.8F, 4.5F, -0.1F);
- head.addChild(cube_r8);
- setRotationAngle(cube_r8, 0.2182F, -1.5708F, 0.0F);
- cube_r8.cubeList.add(new ModelBox(cube_r8, 56, 68, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
+ cube_r4 = new ModelRenderer(this);
+ cube_r4.setRotationPoint(0.3F, 4.0F, -1.2F);
+ head.addChild(cube_r4);
+ setRotationAngle(cube_r4, -0.1309F, 0.0F, 0.0F);
+ cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 61, 1.0F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
+ cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 55, -3.6F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
- cube_r9 = new ModelRenderer(this);
- cube_r9.setRotationPoint(0.8F, 5.5F, -0.1F);
- head.addChild(cube_r9);
- setRotationAngle(cube_r9, -0.1309F, -1.5708F, 0.0F);
- cube_r9.cubeList.add(new ModelBox(cube_r9, 56, 49, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
+ cube_r5 = new ModelRenderer(this);
+ cube_r5.setRotationPoint(-0.3F, 4.0F, -1.2F);
+ head.addChild(cube_r5);
+ setRotationAngle(cube_r5, 0.2182F, 0.0F, 0.0F);
+ cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 71, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
+ cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 67, 1.6F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
- cube_r10 = new ModelRenderer(this);
- cube_r10.setRotationPoint(-0.8F, 4.5F, -0.1F);
- head.addChild(cube_r10);
- setRotationAngle(cube_r10, 0.2182F, 1.5708F, 0.0F);
- cube_r10.cubeList.add(new ModelBox(cube_r10, 56, 74, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
+ cube_r6 = new ModelRenderer(this);
+ cube_r6.setRotationPoint(0.0F, 4.0F, -1.0F);
+ head.addChild(cube_r6);
+ setRotationAngle(cube_r6, 0.1309F, 0.0F, 0.0F);
+ cube_r6.cubeList.add(new ModelBox(cube_r6, 24, 8, -1.0F, -11.2F, -2.0F, 2, 2, 1, 0.1F));
- cube_r11 = new ModelRenderer(this);
- cube_r11.setRotationPoint(0.0F, 3.9F, -0.7F);
- head.addChild(cube_r11);
- setRotationAngle(cube_r11, -0.1309F, 0.0F, 0.0F);
- cube_r11.cubeList.add(new ModelBox(cube_r11, 56, 62, -1.0F, -15.7F, -6.6F, 2, 3, 2, -0.35F));
+ cube_r7 = new ModelRenderer(this);
+ cube_r7.setRotationPoint(-0.8F, 5.5F, -0.1F);
+ head.addChild(cube_r7);
+ setRotationAngle(cube_r7, -0.1309F, 1.5708F, 0.0F);
+ cube_r7.cubeList.add(new ModelBox(cube_r7, 56, 43, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
- cube_r12 = new ModelRenderer(this);
- cube_r12.setRotationPoint(0.0F, 3.9F, -0.7F);
- head.addChild(cube_r12);
- setRotationAngle(cube_r12, 0.2182F, 0.0F, 0.0F);
- cube_r12.cubeList.add(new ModelBox(cube_r12, 56, 55, -1.0F, -14.7F, -1.7F, 2, 4, 2, -0.2F));
+ cube_r8 = new ModelRenderer(this);
+ cube_r8.setRotationPoint(0.8F, 4.5F, -0.1F);
+ head.addChild(cube_r8);
+ setRotationAngle(cube_r8, 0.2182F, -1.5708F, 0.0F);
+ cube_r8.cubeList.add(new ModelBox(cube_r8, 56, 68, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
- cube_r13 = new ModelRenderer(this);
- cube_r13.setRotationPoint(-1.6F, 3.8F, -1.6F);
- head.addChild(cube_r13);
- setRotationAngle(cube_r13, 0.2182F, 0.7854F, 0.0F);
- cube_r13.cubeList.add(new ModelBox(cube_r13, 47, 43, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
+ cube_r9 = new ModelRenderer(this);
+ cube_r9.setRotationPoint(0.8F, 5.5F, -0.1F);
+ head.addChild(cube_r9);
+ setRotationAngle(cube_r9, -0.1309F, -1.5708F, 0.0F);
+ cube_r9.cubeList.add(new ModelBox(cube_r9, 56, 49, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
- cube_r14 = new ModelRenderer(this);
- cube_r14.setRotationPoint(1.6F, 3.8F, -1.6F);
- head.addChild(cube_r14);
- setRotationAngle(cube_r14, -0.1309F, -0.7854F, 0.0F);
- cube_r14.cubeList.add(new ModelBox(cube_r14, 0, 0, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
+ cube_r10 = new ModelRenderer(this);
+ cube_r10.setRotationPoint(-0.8F, 4.5F, -0.1F);
+ head.addChild(cube_r10);
+ setRotationAngle(cube_r10, 0.2182F, 1.5708F, 0.0F);
+ cube_r10.cubeList.add(new ModelBox(cube_r10, 56, 74, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
- cube_r15 = new ModelRenderer(this);
- cube_r15.setRotationPoint(1.6F, 3.8F, -1.6F);
- head.addChild(cube_r15);
- setRotationAngle(cube_r15, 0.2182F, -0.7854F, 0.0F);
- cube_r15.cubeList.add(new ModelBox(cube_r15, 47, 49, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
+ cube_r11 = new ModelRenderer(this);
+ cube_r11.setRotationPoint(0.0F, 3.9F, -0.7F);
+ head.addChild(cube_r11);
+ setRotationAngle(cube_r11, -0.1309F, 0.0F, 0.0F);
+ cube_r11.cubeList.add(new ModelBox(cube_r11, 56, 62, -1.0F, -15.7F, -6.6F, 2, 3, 2, -0.35F));
- cube_r16 = new ModelRenderer(this);
- cube_r16.setRotationPoint(-1.6F, 3.8F, -1.6F);
- head.addChild(cube_r16);
- setRotationAngle(cube_r16, -0.1309F, 0.7854F, 0.0F);
- cube_r16.cubeList.add(new ModelBox(cube_r16, 0, 6, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
+ cube_r12 = new ModelRenderer(this);
+ cube_r12.setRotationPoint(0.0F, 3.9F, -0.7F);
+ head.addChild(cube_r12);
+ setRotationAngle(cube_r12, 0.2182F, 0.0F, 0.0F);
+ cube_r12.cubeList.add(new ModelBox(cube_r12, 56, 55, -1.0F, -14.7F, -1.7F, 2, 4, 2, -0.2F));
- chest = new ModelRenderer(this);
- chest.setRotationPoint(0.0F, 0.0F, 0.0F);
- chest.cubeList.add(new ModelBox(chest, 49, 25, -1.0F, 7.85F, -2.9F, 2, 2, 1, 0.0F));
- chest.cubeList.add(new ModelBox(chest, 0, 84, -4.0F, 0.9F, -3.1F, 8, 7, 1, 0.0F));
- chest.cubeList.add(new ModelBox(chest, 19, 85, -2.5F, 4.7F, 1.9F, 5, 6, 1, 0.0F));
- chest.cubeList.add(new ModelBox(chest, 44, 89, -3.5F, 0.0F, 1.1F, 7, 7, 2, 0.0F));
- chest.cubeList.add(new ModelBox(chest, 0, 93, -4.0F, 0.0F, -2.0F, 8, 12, 4, 0.2F));
+ cube_r13 = new ModelRenderer(this);
+ cube_r13.setRotationPoint(-1.6F, 3.8F, -1.6F);
+ head.addChild(cube_r13);
+ setRotationAngle(cube_r13, 0.2182F, 0.7854F, 0.0F);
+ cube_r13.cubeList.add(new ModelBox(cube_r13, 47, 43, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
- cube_r17 = new ModelRenderer(this);
- cube_r17.setRotationPoint(0.0F, -3.0F, 1.2F);
- chest.addChild(cube_r17);
- setRotationAngle(cube_r17, 0.0873F, 0.0F, 0.0F);
- cube_r17.cubeList.add(new ModelBox(cube_r17, 36, 1, -4.0F, 10.1F, -5.1F, 8, 4, 1, -0.1F));
+ cube_r14 = new ModelRenderer(this);
+ cube_r14.setRotationPoint(1.6F, 3.8F, -1.6F);
+ head.addChild(cube_r14);
+ setRotationAngle(cube_r14, -0.1309F, -0.7854F, 0.0F);
+ cube_r14.cubeList.add(new ModelBox(cube_r14, 0, 0, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
- cube_r18 = new ModelRenderer(this);
- cube_r18.setRotationPoint(0.0F, 20.5F, 0.8F);
- chest.addChild(cube_r18);
- setRotationAngle(cube_r18, 0.0F, 0.0F, 0.0436F);
- cube_r18.cubeList.add(new ModelBox(cube_r18, 51, 35, 0.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
+ cube_r15 = new ModelRenderer(this);
+ cube_r15.setRotationPoint(1.6F, 3.8F, -1.6F);
+ head.addChild(cube_r15);
+ setRotationAngle(cube_r15, 0.2182F, -0.7854F, 0.0F);
+ cube_r15.cubeList.add(new ModelBox(cube_r15, 47, 49, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
- cube_r19 = new ModelRenderer(this);
- cube_r19.setRotationPoint(0.0F, 20.5F, 0.8F);
- chest.addChild(cube_r19);
- setRotationAngle(cube_r19, 0.0F, 0.0F, -0.0436F);
- cube_r19.cubeList.add(new ModelBox(cube_r19, 58, 35, -2.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
+ cube_r16 = new ModelRenderer(this);
+ cube_r16.setRotationPoint(-1.6F, 3.8F, -1.6F);
+ head.addChild(cube_r16);
+ setRotationAngle(cube_r16, -0.1309F, 0.7854F, 0.0F);
+ cube_r16.cubeList.add(new ModelBox(cube_r16, 0, 6, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
- cloak = new ModelRenderer(this);
- cloak.setRotationPoint(0.0F, 2.0F, 0.0F);
+ chest = new ModelRenderer(this);
+ chest.setRotationPoint(0.0F, 0.0F, 0.0F);
+ chest.cubeList.add(new ModelBox(chest, 49, 25, -1.0F, 7.85F, -2.9F, 2, 2, 1, 0.0F));
+ chest.cubeList.add(new ModelBox(chest, 0, 84, -4.0F, 0.9F, -3.1F, 8, 7, 1, 0.0F));
+ chest.cubeList.add(new ModelBox(chest, 19, 85, -2.5F, 4.7F, 1.9F, 5, 6, 1, 0.0F));
+ chest.cubeList.add(new ModelBox(chest, 44, 89, -3.5F, 0.0F, 1.1F, 7, 7, 2, 0.0F));
+ chest.cubeList.add(new ModelBox(chest, 0, 93, -4.0F, 0.0F, -2.0F, 8, 12, 4, 0.2F));
- cube_r20 = new ModelRenderer(this);
- cube_r20.setRotationPoint(0.0F, -6.0F, 1.0F);
- cloak.addChild(cube_r20);
- setRotationAngle(cube_r20, 0.2182F, 0.0F, 0.0F);
- cube_r20.cubeList.add(new ModelBox(cube_r20, 0, 71, -3.0F, 4.6F, 1.4F, 6, 10, 0, 0.0F));
+ cube_r17 = new ModelRenderer(this);
+ cube_r17.setRotationPoint(0.0F, -3.0F, 1.2F);
+ chest.addChild(cube_r17);
+ setRotationAngle(cube_r17, 0.0873F, 0.0F, 0.0F);
+ cube_r17.cubeList.add(new ModelBox(cube_r17, 36, 1, -4.0F, 10.1F, -5.1F, 8, 4, 1, -0.1F));
- lArm = new ModelRenderer(this);
- lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
- lArm.cubeList.add(new ModelBox(lArm, 31, 95, -3.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
- lArm.cubeList.add(new ModelBox(lArm, 19, 59, -3.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
- lArm.cubeList.add(new ModelBox(lArm, 19, 51, -3.9F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
+ cube_r18 = new ModelRenderer(this);
+ cube_r18.setRotationPoint(0.0F, 20.5F, 0.8F);
+ chest.addChild(cube_r18);
+ setRotationAngle(cube_r18, 0.0F, 0.0F, 0.0436F);
+ cube_r18.cubeList.add(new ModelBox(cube_r18, 51, 35, 0.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
- cube_r21 = new ModelRenderer(this);
- cube_r21.setRotationPoint(-1.1F, 10.3F, 0.5F);
- lArm.addChild(cube_r21);
- setRotationAngle(cube_r21, -0.1309F, 0.7854F, 0.0F);
- cube_r21.cubeList.add(new ModelBox(cube_r21, 0, 29, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
+ cube_r19 = new ModelRenderer(this);
+ cube_r19.setRotationPoint(0.0F, 20.5F, 0.8F);
+ chest.addChild(cube_r19);
+ setRotationAngle(cube_r19, 0.0F, 0.0F, -0.0436F);
+ cube_r19.cubeList.add(new ModelBox(cube_r19, 58, 35, -2.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
- cube_r22 = new ModelRenderer(this);
- cube_r22.setRotationPoint(0.8F, 9.9F, 1.0F);
- lArm.addChild(cube_r22);
- setRotationAngle(cube_r22, -0.1309F, 0.0F, 0.0F);
- cube_r22.cubeList.add(new ModelBox(cube_r22, 9, 51, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
+ cloak = new ModelRenderer(this);
+ cloak.setRotationPoint(0.0F, 2.0F, 0.0F);
- cube_r23 = new ModelRenderer(this);
- cube_r23.setRotationPoint(0.8F, 9.9F, 1.0F);
- lArm.addChild(cube_r23);
- setRotationAngle(cube_r23, 0.2182F, 0.0F, 0.0F);
- cube_r23.cubeList.add(new ModelBox(cube_r23, 9, 63, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
+ cube_r20 = new ModelRenderer(this);
+ cube_r20.setRotationPoint(0.0F, -6.0F, 1.0F);
+ cloak.addChild(cube_r20);
+ setRotationAngle(cube_r20, 0.2182F, 0.0F, 0.0F);
+ cube_r20.cubeList.add(new ModelBox(cube_r20, 0, 71, -3.0F, 4.6F, 1.4F, 6, 10, 0, 0.0F));
- cube_r24 = new ModelRenderer(this);
- cube_r24.setRotationPoint(-1.1F, 9.7F, -0.8F);
- lArm.addChild(cube_r24);
- setRotationAngle(cube_r24, 0.2182F, 2.3562F, 0.0F);
- cube_r24.cubeList.add(new ModelBox(cube_r24, 0, 47, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
+ lArm = new ModelRenderer(this);
+ lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
+ lArm.cubeList.add(new ModelBox(lArm, 31, 95, -3.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
+ lArm.cubeList.add(new ModelBox(lArm, 19, 59, -3.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
+ lArm.cubeList.add(new ModelBox(lArm, 19, 51, -3.9F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
- cube_r25 = new ModelRenderer(this);
- cube_r25.setRotationPoint(-1.1F, 9.9F, -0.8F);
- lArm.addChild(cube_r25);
- setRotationAngle(cube_r25, -0.1309F, 2.3562F, 0.0F);
- cube_r25.cubeList.add(new ModelBox(cube_r25, 0, 23, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
+ cube_r21 = new ModelRenderer(this);
+ cube_r21.setRotationPoint(-1.1F, 10.3F, 0.5F);
+ lArm.addChild(cube_r21);
+ setRotationAngle(cube_r21, -0.1309F, 0.7854F, 0.0F);
+ cube_r21.cubeList.add(new ModelBox(cube_r21, 0, 29, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
- cube_r26 = new ModelRenderer(this);
- cube_r26.setRotationPoint(-1.1F, 10.1F, 0.5F);
- lArm.addChild(cube_r26);
- setRotationAngle(cube_r26, 0.2182F, 0.7854F, 0.0F);
- cube_r26.cubeList.add(new ModelBox(cube_r26, 0, 53, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
+ cube_r22 = new ModelRenderer(this);
+ cube_r22.setRotationPoint(0.8F, 9.9F, 1.0F);
+ lArm.addChild(cube_r22);
+ setRotationAngle(cube_r22, -0.1309F, 0.0F, 0.0F);
+ cube_r22.cubeList.add(new ModelBox(cube_r22, 9, 51, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
- rArm = new ModelRenderer(this);
- rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
- rArm.cubeList.add(new ModelBox(rArm, 19, 72, -1.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
- rArm.cubeList.add(new ModelBox(rArm, 31, 105, -1.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
- rArm.cubeList.add(new ModelBox(rArm, 19, 43, -0.1F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
+ cube_r23 = new ModelRenderer(this);
+ cube_r23.setRotationPoint(0.8F, 9.9F, 1.0F);
+ lArm.addChild(cube_r23);
+ setRotationAngle(cube_r23, 0.2182F, 0.0F, 0.0F);
+ cube_r23.cubeList.add(new ModelBox(cube_r23, 9, 63, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
- cube_r27 = new ModelRenderer(this);
- cube_r27.setRotationPoint(1.1F, 10.1F, 0.5F);
- rArm.addChild(cube_r27);
- setRotationAngle(cube_r27, 0.2182F, -0.7854F, 0.0F);
- cube_r27.cubeList.add(new ModelBox(cube_r27, 0, 59, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
+ cube_r24 = new ModelRenderer(this);
+ cube_r24.setRotationPoint(-1.1F, 9.7F, -0.8F);
+ lArm.addChild(cube_r24);
+ setRotationAngle(cube_r24, 0.2182F, 2.3562F, 0.0F);
+ cube_r24.cubeList.add(new ModelBox(cube_r24, 0, 47, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
- cube_r28 = new ModelRenderer(this);
- cube_r28.setRotationPoint(1.1F, 10.3F, 0.5F);
- rArm.addChild(cube_r28);
- setRotationAngle(cube_r28, -0.1309F, -0.7854F, 0.0F);
- cube_r28.cubeList.add(new ModelBox(cube_r28, 0, 35, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
+ cube_r25 = new ModelRenderer(this);
+ cube_r25.setRotationPoint(-1.1F, 9.9F, -0.8F);
+ lArm.addChild(cube_r25);
+ setRotationAngle(cube_r25, -0.1309F, 2.3562F, 0.0F);
+ cube_r25.cubeList.add(new ModelBox(cube_r25, 0, 23, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
- cube_r29 = new ModelRenderer(this);
- cube_r29.setRotationPoint(1.2F, 10.0F, -0.8F);
- rArm.addChild(cube_r29);
- setRotationAngle(cube_r29, -0.1309F, -2.3562F, 0.0F);
- cube_r29.cubeList.add(new ModelBox(cube_r29, 0, 41, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
+ cube_r26 = new ModelRenderer(this);
+ cube_r26.setRotationPoint(-1.1F, 10.1F, 0.5F);
+ lArm.addChild(cube_r26);
+ setRotationAngle(cube_r26, 0.2182F, 0.7854F, 0.0F);
+ cube_r26.cubeList.add(new ModelBox(cube_r26, 0, 53, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
- cube_r30 = new ModelRenderer(this);
- cube_r30.setRotationPoint(1.2F, 9.8F, -0.8F);
- rArm.addChild(cube_r30);
- setRotationAngle(cube_r30, 0.2182F, -2.3562F, 0.0F);
- cube_r30.cubeList.add(new ModelBox(cube_r30, 0, 65, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
+ rArm = new ModelRenderer(this);
+ rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
+ rArm.cubeList.add(new ModelBox(rArm, 19, 72, -1.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
+ rArm.cubeList.add(new ModelBox(rArm, 31, 105, -1.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
+ rArm.cubeList.add(new ModelBox(rArm, 19, 43, -0.1F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
- cube_r31 = new ModelRenderer(this);
- cube_r31.setRotationPoint(3.3F, 10.0F, 1.0F);
- rArm.addChild(cube_r31);
- setRotationAngle(cube_r31, -0.1309F, 0.0F, 0.0F);
- cube_r31.cubeList.add(new ModelBox(cube_r31, 9, 57, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
+ cube_r27 = new ModelRenderer(this);
+ cube_r27.setRotationPoint(1.1F, 10.1F, 0.5F);
+ rArm.addChild(cube_r27);
+ setRotationAngle(cube_r27, 0.2182F, -0.7854F, 0.0F);
+ cube_r27.cubeList.add(new ModelBox(cube_r27, 0, 59, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
- cube_r32 = new ModelRenderer(this);
- cube_r32.setRotationPoint(3.3F, 10.0F, 1.0F);
- rArm.addChild(cube_r32);
- setRotationAngle(cube_r32, 0.2182F, 0.0F, 0.0F);
- cube_r32.cubeList.add(new ModelBox(cube_r32, 9, 67, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
+ cube_r28 = new ModelRenderer(this);
+ cube_r28.setRotationPoint(1.1F, 10.3F, 0.5F);
+ rArm.addChild(cube_r28);
+ setRotationAngle(cube_r28, -0.1309F, -0.7854F, 0.0F);
+ cube_r28.cubeList.add(new ModelBox(cube_r28, 0, 35, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
- lLeg = new ModelRenderer(this);
- lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
- lLeg.cubeList.add(new ModelBox(lLeg, 48, 103, -4.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
+ cube_r29 = new ModelRenderer(this);
+ cube_r29.setRotationPoint(1.2F, 10.0F, -0.8F);
+ rArm.addChild(cube_r29);
+ setRotationAngle(cube_r29, -0.1309F, -2.3562F, 0.0F);
+ cube_r29.cubeList.add(new ModelBox(cube_r29, 0, 41, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
- cube_r33 = new ModelRenderer(this);
- cube_r33.setRotationPoint(0.0F, 11.9F, 1.0F);
- lLeg.addChild(cube_r33);
- setRotationAngle(cube_r33, 0.0873F, 0.0F, 0.0F);
- cube_r33.cubeList.add(new ModelBox(cube_r33, 37, 122, -3.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
+ cube_r30 = new ModelRenderer(this);
+ cube_r30.setRotationPoint(1.2F, 9.8F, -0.8F);
+ rArm.addChild(cube_r30);
+ setRotationAngle(cube_r30, 0.2182F, -2.3562F, 0.0F);
+ cube_r30.cubeList.add(new ModelBox(cube_r30, 0, 65, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
- rLeg = new ModelRenderer(this);
- rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
- rLeg.cubeList.add(new ModelBox(rLeg, 48, 116, 0.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
+ cube_r31 = new ModelRenderer(this);
+ cube_r31.setRotationPoint(3.3F, 10.0F, 1.0F);
+ rArm.addChild(cube_r31);
+ setRotationAngle(cube_r31, -0.1309F, 0.0F, 0.0F);
+ cube_r31.cubeList.add(new ModelBox(cube_r31, 9, 57, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
- cube_r34 = new ModelRenderer(this);
- cube_r34.setRotationPoint(0.0F, 11.9F, 1.0F);
- rLeg.addChild(cube_r34);
- setRotationAngle(cube_r34, 0.0873F, 0.0F, 0.0F);
- cube_r34.cubeList.add(new ModelBox(cube_r34, 37, 115, 0.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
+ cube_r32 = new ModelRenderer(this);
+ cube_r32.setRotationPoint(3.3F, 10.0F, 1.0F);
+ rArm.addChild(cube_r32);
+ setRotationAngle(cube_r32, 0.2182F, 0.0F, 0.0F);
+ cube_r32.cubeList.add(new ModelBox(cube_r32, 9, 67, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
- rBoot = new ModelRenderer(this);
- rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
- rBoot.cubeList.add(new ModelBox(rBoot, 0, 120, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
+ lLeg = new ModelRenderer(this);
+ lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
+ lLeg.cubeList.add(new ModelBox(lLeg, 48, 103, -4.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
- lBoot = new ModelRenderer(this);
- lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
- lBoot.cubeList.add(new ModelBox(lBoot, 0, 111, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
- }
-
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- if(entity instanceof net.minecraft.entity.monster.EntitySkeleton || entity instanceof net.minecraft.entity.monster.EntityZombie)
- setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
- else {
- prepareForRender(entity);
- setRotationAngles(f, f1, f2, f3, f4, f5, entity);
- }
- this.head.showModel = (this.slot == 0);
- this.chest.showModel = (this.slot == 1);
- this.lArm.showModel = (this.slot == 1);
- this.rArm.showModel = (this.slot == 1);
- this.rLeg.showModel = (this.slot == 2);
- this.lLeg.showModel = (this.slot == 2);
- this.lBoot.showModel = (this.slot == 3);
- this.rBoot.showModel = (this.slot == 3);
- this.bipedHeadwear.showModel = false;
- this.bipedHead = this.head;
- this.bipedBody = this.chest;
- this.bipedRightArm = this.lArm;
- this.bipedLeftArm = this.rArm;
- if(this.slot == 2) {
- this.bipedRightLeg = this.lLeg;
- this.bipedLeftLeg = this.rLeg;
- } else {
- this.bipedRightLeg = this.rBoot;
- this.bipedLeftLeg = this.lBoot;
- }
- if(this.isChild) {
+ cube_r33 = new ModelRenderer(this);
+ cube_r33.setRotationPoint(0.0F, 11.9F, 1.0F);
+ lLeg.addChild(cube_r33);
+ setRotationAngle(cube_r33, 0.0873F, 0.0F, 0.0F);
+ cube_r33.cubeList.add(new ModelBox(cube_r33, 37, 122, -3.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
+
+ rLeg = new ModelRenderer(this);
+ rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
+ rLeg.cubeList.add(new ModelBox(rLeg, 48, 116, 0.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
+
+ cube_r34 = new ModelRenderer(this);
+ cube_r34.setRotationPoint(0.0F, 11.9F, 1.0F);
+ rLeg.addChild(cube_r34);
+ setRotationAngle(cube_r34, 0.0873F, 0.0F, 0.0F);
+ cube_r34.cubeList.add(new ModelBox(cube_r34, 37, 115, 0.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
+
+ rBoot = new ModelRenderer(this);
+ rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
+ rBoot.cubeList.add(new ModelBox(rBoot, 0, 120, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
+
+ lBoot = new ModelRenderer(this);
+ lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
+ lBoot.cubeList.add(new ModelBox(lBoot, 0, 111, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
+ }
+
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
+ if (entity instanceof net.minecraft.entity.monster.EntitySkeleton
+ || entity instanceof net.minecraft.entity.monster.EntityZombie)
+ setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
+ else {
+ prepareForRender(entity);
+ setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ }
+ this.head.showModel = (this.slot == 0);
+ this.chest.showModel = (this.slot == 1);
+ this.lArm.showModel = (this.slot == 1);
+ this.rArm.showModel = (this.slot == 1);
+ this.rLeg.showModel = (this.slot == 2);
+ this.lLeg.showModel = (this.slot == 2);
+ this.lBoot.showModel = (this.slot == 3);
+ this.rBoot.showModel = (this.slot == 3);
+ this.bipedHeadwear.showModel = false;
+ this.bipedHead = this.head;
+ this.bipedBody = this.chest;
+ this.bipedRightArm = this.lArm;
+ this.bipedLeftArm = this.rArm;
+ if (this.slot == 2) {
+ this.bipedRightLeg = this.lLeg;
+ this.bipedLeftLeg = this.rLeg;
+ } else {
+ this.bipedRightLeg = this.rBoot;
+ this.bipedLeftLeg = this.lBoot;
+ }
+ if (this.isChild) {
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
@@ -376,48 +377,49 @@ public class ModelArmorWildHunt extends ModelBiped {
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
}
- }
-
- public void prepareForRender(Entity entity) {
- EntityLivingBase living = (EntityLivingBase)entity;
- this.isSneak = (living != null) ? living.isSneaking() : false;
- if(living != null && living instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)living;
- ItemStack itemstack = player.inventory.getCurrentItem();
- this.heldItemRight = (itemstack != null) ? 1 : 0;
- this.aimedBow = false;
- if(itemstack != null && player.getItemInUseCount() > 0) {
- EnumAction enumaction = itemstack.getItemUseAction();
- if(enumaction == EnumAction.block) {
- this.heldItemRight = 3;
- } else if(enumaction == EnumAction.bow) {
- this.aimedBow = true;
- }
- }
- }
- }
-
- public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
- setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
- float f6 = MathHelper.sin(this.onGround * 3.1415927F);
- float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
- this.bipedRightArm.rotateAngleZ = 0.0F;
- this.bipedLeftArm.rotateAngleZ = 0.0F;
- this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
- this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
- this.bipedRightArm.rotateAngleX = -1.5707964F;
- this.bipedLeftArm.rotateAngleX = -1.5707964F;
- this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
- this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
- this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
- this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
- this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
- this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
- }
-
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
-}
\ No newline at end of file
+ }
+
+ public void prepareForRender(Entity entity) {
+ EntityLivingBase living = (EntityLivingBase) entity;
+ this.isSneak = (living != null) ? living.isSneaking() : false;
+ if (living != null && living instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) living;
+ ItemStack itemstack = player.inventory.getCurrentItem();
+ this.heldItemRight = (itemstack != null) ? 1 : 0;
+ this.aimedBow = false;
+ if (itemstack != null && player.getItemInUseCount() > 0) {
+ EnumAction enumaction = itemstack.getItemUseAction();
+ if (enumaction == EnumAction.block) {
+ this.heldItemRight = 3;
+ } else if (enumaction == EnumAction.bow) {
+ this.aimedBow = true;
+ }
+ }
+ }
+ }
+
+ public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_,
+ float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
+ setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
+ float f6 = MathHelper.sin(this.onGround * 3.1415927F);
+ float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
+ this.bipedRightArm.rotateAngleZ = 0.0F;
+ this.bipedLeftArm.rotateAngleZ = 0.0F;
+ this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
+ this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
+ this.bipedRightArm.rotateAngleX = -1.5707964F;
+ this.bipedLeftArm.rotateAngleX = -1.5707964F;
+ this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
+ this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
+ this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
+ this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
+ this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
+ this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
+ }
+
+ public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
+ modelRenderer.rotateAngleX = x;
+ modelRenderer.rotateAngleY = y;
+ modelRenderer.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ab/client/nei/NEIConfig.java b/src/main/java/ab/client/nei/NEIConfig.java
index e42cdc5..90063ce 100644
--- a/src/main/java/ab/client/nei/NEIConfig.java
+++ b/src/main/java/ab/client/nei/NEIConfig.java
@@ -1,29 +1,29 @@
package ab.client.nei;
+import net.minecraft.item.ItemStack;
+
import ab.AdvancedBotany;
-import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.BlockListAB;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
-import net.minecraft.item.ItemStack;
public class NEIConfig implements IConfigureNEI {
- public String getName() {
- return AdvancedBotany.modid;
- }
+ public String getName() {
+ return AdvancedBotany.modid;
+ }
- public String getVersion() {
- return AdvancedBotany.version;
- }
+ public String getVersion() {
+ return AdvancedBotany.version;
+ }
- public void loadConfig() {
- API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAlphirine());
- API.registerUsageHandler((IUsageHandler)new RecipeHandlerAlphirine());
- API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAdvancedPlate());
- API.registerUsageHandler((IUsageHandler)new RecipeHandlerAdvancedPlate());
- API.hideItem(new ItemStack(BlockListAB.blockAntigravitation));
- }
+ public void loadConfig() {
+ API.registerRecipeHandler((ICraftingHandler) new RecipeHandlerAlphirine());
+ API.registerUsageHandler((IUsageHandler) new RecipeHandlerAlphirine());
+ API.registerRecipeHandler((ICraftingHandler) new RecipeHandlerAdvancedPlate());
+ API.registerUsageHandler((IUsageHandler) new RecipeHandlerAdvancedPlate());
+ API.hideItem(new ItemStack(BlockListAB.blockAntigravitation));
+ }
}
diff --git a/src/main/java/ab/client/nei/RecipeHandlerAdvancedPlate.java b/src/main/java/ab/client/nei/RecipeHandlerAdvancedPlate.java
index 3937bb5..b0f9294 100644
--- a/src/main/java/ab/client/nei/RecipeHandlerAdvancedPlate.java
+++ b/src/main/java/ab/client/nei/RecipeHandlerAdvancedPlate.java
@@ -3,116 +3,122 @@ package ab.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
import org.lwjgl.opengl.GL11;
+
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.client.core.ClientHelper;
-import ab.client.nei.RecipeHandlerAlphirine.CachedHandlerAlphirine;
import ab.common.lib.register.BlockListAB;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.StatCollector;
public class RecipeHandlerAdvancedPlate extends TemplateRecipeHandler {
-
- public class CachedAdvancedPlateRecipe extends TemplateRecipeHandler.CachedRecipe {
-
- public List inputs = new ArrayList();
- public PositionedStack output;
- public int manaUsage;
-
- public CachedAdvancedPlateRecipe(RecipeAdvancedPlate recipe) {
- setIngredients(recipe.getInputs());
- this.output = new PositionedStack(recipe.getOutput(), 111, 21);
- this.inputs.add(new PositionedStack(new ItemStack(BlockListAB.blockABPlate), 73, 55));
- this.manaUsage = recipe.getManaUsage();
- }
-
- public void setIngredients(List inputs) {
- float degreePerInput = 360.0F / inputs.size();
- float currentDegree = -90.0F;
- for (Object o : inputs) {
- int posX = (int)Math.round(73.0D + Math.cos(currentDegree * Math.PI / 180.0D) * 32.0D);
- int posY = (int)Math.round(55.0D + Math.sin(currentDegree * Math.PI / 180.0D) * 32.0D);
- this.inputs.add(new PositionedStack(o, posX, posY));
- currentDegree += degreePerInput;
- }
- }
-
- public List getIngredients() {
- return getCycledIngredients(RecipeHandlerAdvancedPlate.this.cycleticks / 20, this.inputs);
- }
-
- public PositionedStack getResult() {
- return this.output;
- }
- }
-
- public String getRecipeName() {
- return StatCollector.translateToLocal("ab.nei.advancedPlate");
- }
-
- public String getRecipeID() {
- return "ab.advancedPlate";
- }
-
- public String getGuiTexture() {
- return "botania:textures/gui/neiBlank.png";
- }
-
- public void loadTransferRects() {
- this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID(), new Object[0]));
- }
-
- public int recipiesPerPage() {
- return 1;
- }
-
- public void drawBackground(int recipe) {
- super.drawBackground(recipe);
- GL11.glEnable(3042);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
- GuiDraw.changeTexture("botania:textures/gui/petalOverlay.png");
- GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
- int mana = ((CachedAdvancedPlateRecipe)this.arecipes.get(recipe)).manaUsage;
- ClientHelper.renderPoolManaBar(32, 112, 0x239ddc, 1.0f, mana);
- }
-
- public CachedAdvancedPlateRecipe getCachedRecipe(RecipeAdvancedPlate recipe) {
- return new CachedAdvancedPlateRecipe(recipe);
- }
-
- public void loadCraftingRecipes(String outputId, Object... results) {
- if (outputId.equals(getRecipeID())) {
- for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
- this.arecipes.add(getCachedRecipe(recipe));
- }
- } else {
- super.loadCraftingRecipes(outputId, results);
- }
- }
-
- public void loadCraftingRecipes(ItemStack result) {
- for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
- if (recipe == null)
- continue;
- if (((recipe.getOutput()).stackTagCompound != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result)) || ((recipe.getOutput()).stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)))
- this.arecipes.add(getCachedRecipe(recipe));
- }
- }
-
- public void loadUsageRecipes(ItemStack ingredient) {
- for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
- if (recipe == null)
- continue;
- CachedAdvancedPlateRecipe crecipe = getCachedRecipe(recipe);
- if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
- this.arecipes.add(crecipe);
- }
- }
+
+ public class CachedAdvancedPlateRecipe extends TemplateRecipeHandler.CachedRecipe {
+
+ public List inputs = new ArrayList();
+ public PositionedStack output;
+ public int manaUsage;
+
+ public CachedAdvancedPlateRecipe(RecipeAdvancedPlate recipe) {
+ setIngredients(recipe.getInputs());
+ this.output = new PositionedStack(recipe.getOutput(), 111, 21);
+ this.inputs.add(new PositionedStack(new ItemStack(BlockListAB.blockABPlate), 73, 55));
+ this.manaUsage = recipe.getManaUsage();
+ }
+
+ public void setIngredients(List inputs) {
+ float degreePerInput = 360.0F / inputs.size();
+ float currentDegree = -90.0F;
+ for (Object o : inputs) {
+ int posX = (int) Math.round(73.0D + Math.cos(currentDegree * Math.PI / 180.0D) * 32.0D);
+ int posY = (int) Math.round(55.0D + Math.sin(currentDegree * Math.PI / 180.0D) * 32.0D);
+ this.inputs.add(new PositionedStack(o, posX, posY));
+ currentDegree += degreePerInput;
+ }
+ }
+
+ public List getIngredients() {
+ return getCycledIngredients(RecipeHandlerAdvancedPlate.this.cycleticks / 20, this.inputs);
+ }
+
+ public PositionedStack getResult() {
+ return this.output;
+ }
+ }
+
+ public String getRecipeName() {
+ return StatCollector.translateToLocal("ab.nei.advancedPlate");
+ }
+
+ public String getRecipeID() {
+ return "ab.advancedPlate";
+ }
+
+ public String getGuiTexture() {
+ return "botania:textures/gui/neiBlank.png";
+ }
+
+ public void loadTransferRects() {
+ this.transferRects.add(
+ new TemplateRecipeHandler.RecipeTransferRect(
+ new Rectangle(72, 54, 18, 18),
+ getRecipeID(),
+ new Object[0]));
+ }
+
+ public int recipiesPerPage() {
+ return 1;
+ }
+
+ public void drawBackground(int recipe) {
+ super.drawBackground(recipe);
+ GL11.glEnable(3042);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
+ GuiDraw.changeTexture("botania:textures/gui/petalOverlay.png");
+ GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
+ int mana = ((CachedAdvancedPlateRecipe) this.arecipes.get(recipe)).manaUsage;
+ ClientHelper.renderPoolManaBar(32, 112, 0x239ddc, 1.0f, mana);
+ }
+
+ public CachedAdvancedPlateRecipe getCachedRecipe(RecipeAdvancedPlate recipe) {
+ return new CachedAdvancedPlateRecipe(recipe);
+ }
+
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getRecipeID())) {
+ for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
+ this.arecipes.add(getCachedRecipe(recipe));
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ public void loadCraftingRecipes(ItemStack result) {
+ for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
+ if (recipe == null) continue;
+ if (((recipe.getOutput()).stackTagCompound != null
+ && NEIServerUtils.areStacksSameType(recipe.getOutput(), result))
+ || ((recipe.getOutput()).stackTagCompound == null
+ && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)))
+ this.arecipes.add(getCachedRecipe(recipe));
+ }
+ }
+
+ public void loadUsageRecipes(ItemStack ingredient) {
+ for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
+ if (recipe == null) continue;
+ CachedAdvancedPlateRecipe crecipe = getCachedRecipe(recipe);
+ if (crecipe.contains(crecipe.getIngredients(), ingredient)
+ || crecipe.contains(crecipe.getOtherStacks(), ingredient))
+ this.arecipes.add(crecipe);
+ }
+ }
}
diff --git a/src/main/java/ab/client/nei/RecipeHandlerAlphirine.java b/src/main/java/ab/client/nei/RecipeHandlerAlphirine.java
index d667526..f0c24cf 100644
--- a/src/main/java/ab/client/nei/RecipeHandlerAlphirine.java
+++ b/src/main/java/ab/client/nei/RecipeHandlerAlphirine.java
@@ -4,7 +4,13 @@ import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
import org.lwjgl.opengl.GL11;
+
+import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.client.core.ClientHelper;
@@ -12,110 +18,104 @@ import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.StatCollector;
-import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class RecipeHandlerAlphirine extends TemplateRecipeHandler {
-
- public class CachedHandlerAlphirine extends TemplateRecipeHandler.CachedRecipe {
-
- public List inputs = new ArrayList();
- public PositionedStack output;
- public List otherStacks = new ArrayList();
- public int chance;
-
- public CachedHandlerAlphirine(RecipeAncientAlphirine recipe) {
- if (recipe == null)
- return;
- this.inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType("ancientAlphirine"), 71, 23));
- this.inputs.add(new PositionedStack(recipe.getInput(), 42, 23));
- this.output = new PositionedStack(recipe.getOutput(), 101, 23);
- this.chance = recipe.getChance();
- }
-
- public List getIngredients() {
- return getCycledIngredients(RecipeHandlerAlphirine.this.cycleticks / 20, this.inputs);
- }
-
- public PositionedStack getResult() {
- return this.output;
- }
-
- public List getOtherStacks() {
- return this.otherStacks;
- }
-
- public boolean contains(Collection ingredients, ItemStack ingredient) {
- if (ingredients == this.inputs)
- for (PositionedStack stack : ingredients) {
- if (stack.contains(ingredient))
- return true;
- }
- return super.contains(ingredients, ingredient);
- }
- }
-
- public String getRecipeName() {
- return StatCollector.translateToLocal("ab.nei.alphirine");
- }
-
- public String getRecipeID() {
- return "ab.alphirine";
- }
-
- public String getGuiTexture() {
- return "botania:textures/gui/neiBlank.png";
- }
-
- public int recipiesPerPage() {
- return 2;
- }
-
- public void loadTransferRects() {
- this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(70, 22, 18, 18), getRecipeID(), new Object[0]));
- }
-
- public void drawBackground(int recipe) {
- super.drawBackground(recipe);
- GL11.glEnable(3042);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
- GuiDraw.changeTexture("botania:textures/gui/pureDaisyOverlay.png");
- GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
- int chance = ((CachedHandlerAlphirine)this.arecipes.get(recipe)).chance;
- ClientHelper.drawChanceBar(52, 58, chance);
- }
-
- public void loadCraftingRecipes(String outputId, Object... results) {
- if (outputId.equals(getRecipeID())) {
- for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
- if (recipe == null)
- continue;
- this.arecipes.add(new CachedHandlerAlphirine(recipe));
- }
- } else {
- super.loadCraftingRecipes(outputId, results);
- }
- }
-
- public void loadCraftingRecipes(ItemStack result) {
- for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
- if (recipe == null)
- continue;
- if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
- this.arecipes.add(new CachedHandlerAlphirine(recipe));
- }
- }
-
- public void loadUsageRecipes(ItemStack ingredient) {
- for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
- if (recipe == null)
- continue;
- CachedHandlerAlphirine crecipe = new CachedHandlerAlphirine(recipe);
- if (crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
- this.arecipes.add(crecipe);
- }
- }
+
+ public class CachedHandlerAlphirine extends TemplateRecipeHandler.CachedRecipe {
+
+ public List inputs = new ArrayList();
+ public PositionedStack output;
+ public List otherStacks = new ArrayList();
+ public int chance;
+
+ public CachedHandlerAlphirine(RecipeAncientAlphirine recipe) {
+ if (recipe == null) return;
+ this.inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType("ancientAlphirine"), 71, 23));
+ this.inputs.add(new PositionedStack(recipe.getInput(), 42, 23));
+ this.output = new PositionedStack(recipe.getOutput(), 101, 23);
+ this.chance = recipe.getChance();
+ }
+
+ public List getIngredients() {
+ return getCycledIngredients(RecipeHandlerAlphirine.this.cycleticks / 20, this.inputs);
+ }
+
+ public PositionedStack getResult() {
+ return this.output;
+ }
+
+ public List getOtherStacks() {
+ return this.otherStacks;
+ }
+
+ public boolean contains(Collection ingredients, ItemStack ingredient) {
+ if (ingredients == this.inputs) for (PositionedStack stack : ingredients) {
+ if (stack.contains(ingredient)) return true;
+ }
+ return super.contains(ingredients, ingredient);
+ }
+ }
+
+ public String getRecipeName() {
+ return StatCollector.translateToLocal("ab.nei.alphirine");
+ }
+
+ public String getRecipeID() {
+ return "ab.alphirine";
+ }
+
+ public String getGuiTexture() {
+ return "botania:textures/gui/neiBlank.png";
+ }
+
+ public int recipiesPerPage() {
+ return 2;
+ }
+
+ public void loadTransferRects() {
+ this.transferRects.add(
+ new TemplateRecipeHandler.RecipeTransferRect(
+ new Rectangle(70, 22, 18, 18),
+ getRecipeID(),
+ new Object[0]));
+ }
+
+ public void drawBackground(int recipe) {
+ super.drawBackground(recipe);
+ GL11.glEnable(3042);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
+ GuiDraw.changeTexture("botania:textures/gui/pureDaisyOverlay.png");
+ GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
+ int chance = ((CachedHandlerAlphirine) this.arecipes.get(recipe)).chance;
+ ClientHelper.drawChanceBar(52, 58, chance);
+ }
+
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getRecipeID())) {
+ for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
+ if (recipe == null) continue;
+ this.arecipes.add(new CachedHandlerAlphirine(recipe));
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ public void loadCraftingRecipes(ItemStack result) {
+ for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
+ if (recipe == null) continue;
+ if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
+ this.arecipes.add(new CachedHandlerAlphirine(recipe));
+ }
+ }
+
+ public void loadUsageRecipes(ItemStack ingredient) {
+ for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
+ if (recipe == null) continue;
+ CachedHandlerAlphirine crecipe = new CachedHandlerAlphirine(recipe);
+ if (crecipe.contains(crecipe.getIngredients(), ingredient)
+ || crecipe.contains(crecipe.getOtherStacks(), ingredient))
+ this.arecipes.add(crecipe);
+ }
+ }
}
diff --git a/src/main/java/ab/client/render/block/RenderBlockABSpreader.java b/src/main/java/ab/client/render/block/RenderBlockABSpreader.java
index f47c6a2..8ff07e8 100644
--- a/src/main/java/ab/client/render/block/RenderBlockABSpreader.java
+++ b/src/main/java/ab/client/render/block/RenderBlockABSpreader.java
@@ -1,36 +1,38 @@
package ab.client.render.block;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.tile.TileABSpreader;
-import ab.common.lib.register.BlockListAB;
-import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+import ab.common.block.tile.TileABSpreader;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+
public class RenderBlockABSpreader implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- TileABSpreader spreader = new TileABSpreader();
- spreader.rotationX = -180.0F;
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)spreader, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockABSpreaderRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
-}
\ No newline at end of file
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ TileABSpreader spreader = new TileABSpreader();
+ spreader.rotationX = -180.0F;
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) spreader, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockABSpreaderRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+}
diff --git a/src/main/java/ab/client/render/block/RenderBlockEngineerHopper.java b/src/main/java/ab/client/render/block/RenderBlockEngineerHopper.java
index daf0560..1bb93e3 100644
--- a/src/main/java/ab/client/render/block/RenderBlockEngineerHopper.java
+++ b/src/main/java/ab/client/render/block/RenderBlockEngineerHopper.java
@@ -1,36 +1,38 @@
package ab.client.render.block;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.tile.TileEngineerHopper;
-import ab.common.lib.register.BlockListAB;
-import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+import ab.common.block.tile.TileEngineerHopper;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+
public class RenderBlockEngineerHopper implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- GL11.glScalef(1.4f, 1.4f, 1.4f);
- TileEngineerHopper hopper = new TileEngineerHopper();
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)hopper, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockEngineerHopperRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
-}
\ No newline at end of file
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ GL11.glScalef(1.4f, 1.4f, 1.4f);
+ TileEngineerHopper hopper = new TileEngineerHopper();
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) hopper, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockEngineerHopperRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+}
diff --git a/src/main/java/ab/client/render/block/RenderBlockManaCharger.java b/src/main/java/ab/client/render/block/RenderBlockManaCharger.java
index b118d7e..f8c2654 100644
--- a/src/main/java/ab/client/render/block/RenderBlockManaCharger.java
+++ b/src/main/java/ab/client/render/block/RenderBlockManaCharger.java
@@ -1,36 +1,38 @@
package ab.client.render.block;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.tile.TileManaCharger;
-import ab.common.lib.register.BlockListAB;
-import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+import ab.common.block.tile.TileManaCharger;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+
public class RenderBlockManaCharger implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.625F, -0.5F);
- GL11.glScalef(1.35f, 1.35f, 1.35f);
- TileManaCharger charger = new TileManaCharger();
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)charger, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockManaChargerRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
-}
\ No newline at end of file
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.625F, -0.5F);
+ GL11.glScalef(1.35f, 1.35f, 1.35f);
+ TileManaCharger charger = new TileManaCharger();
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) charger, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockManaChargerRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+}
diff --git a/src/main/java/ab/client/render/block/RenderBlockManaContainer.java b/src/main/java/ab/client/render/block/RenderBlockManaContainer.java
index 7392138..4832c45 100644
--- a/src/main/java/ab/client/render/block/RenderBlockManaContainer.java
+++ b/src/main/java/ab/client/render/block/RenderBlockManaContainer.java
@@ -1,38 +1,40 @@
package ab.client.render.block;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.RenderTileManaContainer;
import ab.common.block.tile.TileManaContainer;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.IBlockAccess;
public class RenderBlockManaContainer implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- GL11.glScalef(1.4f, 1.4f, 1.4f);
- TileManaContainer container = new TileManaContainer();
- RenderTileManaContainer.metadata = metadata;
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)container, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockManaContainerRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
-}
\ No newline at end of file
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ GL11.glScalef(1.4f, 1.4f, 1.4f);
+ TileManaContainer container = new TileManaContainer();
+ RenderTileManaContainer.metadata = metadata;
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) container, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockManaContainerRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+}
diff --git a/src/main/java/ab/client/render/block/RenderBlockManaCrystalCube.java b/src/main/java/ab/client/render/block/RenderBlockManaCrystalCube.java
index 2340836..d84e47f 100644
--- a/src/main/java/ab/client/render/block/RenderBlockManaCrystalCube.java
+++ b/src/main/java/ab/client/render/block/RenderBlockManaCrystalCube.java
@@ -1,37 +1,39 @@
package ab.client.render.block;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.tile.TileManaCrystalCube;
-import ab.common.lib.register.BlockListAB;
-import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
+import org.lwjgl.opengl.GL11;
+
+import ab.common.block.tile.TileManaCrystalCube;
+import ab.common.lib.register.BlockListAB;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+
public class RenderBlockManaCrystalCube implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- GL11.glDisable(3008);
- TileManaCrystalCube cube = new TileManaCrystalCube();
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)cube, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glEnable(3008);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockManaCrystalCubeRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ GL11.glDisable(3008);
+ TileManaCrystalCube cube = new TileManaCrystalCube();
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) cube, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glEnable(3008);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockManaCrystalCubeRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
}
diff --git a/src/main/java/ab/client/render/block/RenderBlockNidavellirForge.java b/src/main/java/ab/client/render/block/RenderBlockNidavellirForge.java
index afc65ac..4a7c863 100644
--- a/src/main/java/ab/client/render/block/RenderBlockNidavellirForge.java
+++ b/src/main/java/ab/client/render/block/RenderBlockNidavellirForge.java
@@ -1,38 +1,40 @@
package ab.client.render.block;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.RenderTileManaContainer;
import ab.common.block.tile.TileNidavellirForge;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.IBlockAccess;
public class RenderBlockNidavellirForge implements ISimpleBlockRenderingHandler {
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.5F, -0.375F, -0.5F);
- GL11.glScalef(1.25f, 1.25f, 1.25f);
- TileNidavellirForge forge = new TileNidavellirForge();
- RenderTileManaContainer.metadata = metadata;
- TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)forge, 0.0D, 0.0D, 0.0D, 0.0F);
- GL11.glPopMatrix();
- }
-
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
- return false;
- }
-
- public int getRenderId() {
- return BlockListAB.blockABPlateRI;
- }
-
- public boolean shouldRender3DInInventory(int modelId) {
- return true;
- }
-}
\ No newline at end of file
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.5F, -0.375F, -0.5F);
+ GL11.glScalef(1.25f, 1.25f, 1.25f);
+ TileNidavellirForge forge = new TileNidavellirForge();
+ RenderTileManaContainer.metadata = metadata;
+ TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity) forge, 0.0D, 0.0D, 0.0D, 0.0F);
+ GL11.glPopMatrix();
+ }
+
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ return false;
+ }
+
+ public int getRenderId() {
+ return BlockListAB.blockABPlateRI;
+ }
+
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+}
diff --git a/src/main/java/ab/client/render/entity/EntityNullRender.java b/src/main/java/ab/client/render/entity/EntityNullRender.java
index 06ab517..7fed810 100644
--- a/src/main/java/ab/client/render/entity/EntityNullRender.java
+++ b/src/main/java/ab/client/render/entity/EntityNullRender.java
@@ -6,10 +6,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class EntityNullRender extends Render {
-
- public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {}
-
- protected ResourceLocation getEntityTexture(Entity entity) {
- return AbstractClientPlayer.locationStevePng;
- }
+
+ public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {}
+
+ protected ResourceLocation getEntityTexture(Entity entity) {
+ return AbstractClientPlayer.locationStevePng;
+ }
}
diff --git a/src/main/java/ab/client/render/entity/RenderEntityAdvancedSpark.java b/src/main/java/ab/client/render/entity/RenderEntityAdvancedSpark.java
index 3ad2e99..158bb55 100644
--- a/src/main/java/ab/client/render/entity/RenderEntityAdvancedSpark.java
+++ b/src/main/java/ab/client/render/entity/RenderEntityAdvancedSpark.java
@@ -1,20 +1,21 @@
package ab.client.render.entity;
-import ab.common.entity.EntityAdvancedSpark;
-import ab.common.item.ItemAdvancedSpark;
-import ab.common.lib.register.ItemListAB;
import net.minecraft.util.IIcon;
+
import vazkii.botania.client.render.entity.RenderSparkBase;
import vazkii.botania.common.item.ItemSparkUpgrade;
+import ab.common.entity.EntityAdvancedSpark;
+import ab.common.item.ItemAdvancedSpark;
public class RenderEntityAdvancedSpark extends RenderSparkBase {
-
- public IIcon getSpinningIcon(EntityAdvancedSpark entity) {
- int upgrade = entity.getUpgrade() - 1;
- return (upgrade >= 0 && upgrade < ItemSparkUpgrade.worldIcons.length) ? ItemSparkUpgrade.worldIcons[upgrade] : null;
- }
-
- public IIcon getBaseIcon(EntityAdvancedSpark entity) {
- return ItemAdvancedSpark.worldIcon;
- }
+
+ public IIcon getSpinningIcon(EntityAdvancedSpark entity) {
+ int upgrade = entity.getUpgrade() - 1;
+ return (upgrade >= 0 && upgrade < ItemSparkUpgrade.worldIcons.length) ? ItemSparkUpgrade.worldIcons[upgrade]
+ : null;
+ }
+
+ public IIcon getBaseIcon(EntityAdvancedSpark entity) {
+ return ItemAdvancedSpark.worldIcon;
+ }
}
diff --git a/src/main/java/ab/client/render/entity/RenderEntityAlphirinePortal.java b/src/main/java/ab/client/render/entity/RenderEntityAlphirinePortal.java
index 6e5269c..2a81fd9 100644
--- a/src/main/java/ab/client/render/entity/RenderEntityAlphirinePortal.java
+++ b/src/main/java/ab/client/render/entity/RenderEntityAlphirinePortal.java
@@ -1,58 +1,46 @@
package ab.client.render.entity;
-import java.awt.Color;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.core.ClientHelper;
-import ab.common.block.BlockLebethronWood;
-import ab.common.lib.register.BlockListAB;
-import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.client.renderer.ItemRenderer;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.World;
-import net.minecraftforge.client.ForgeHooksClient;
-import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.core.ClientHelper;
+import ab.common.block.BlockLebethronWood;
public class RenderEntityAlphirinePortal extends Render {
- public void doRender(Entity entity, double x, double y, double z, float fl, float fl1) {
- double worldTime = (entity.worldObj == null) ? 0.0D : (ClientTickHandler.ticksInGame + fl1);
- if(entity != null)
- worldTime += (new Random(((int)entity.posX ^ (int)entity.posY ^ (int)entity.posZ))).nextInt(360);
- Minecraft mc = Minecraft.getMinecraft();
- float burn = Math.min(1.0f, entity.ticksExisted * 0.0561f);
- GL11.glPushMatrix();
- GL11.glTranslated(x, y, z);
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- burn = Math.max(0.0f, (float)(burn + (Math.sin(worldTime / 3.2f) / 9.0f)));
- GL11.glScalef(burn / 3.15f, burn / 3.15f, burn / 3.15f);
- GL11.glRotatef(180.0f - this.renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
- GL11.glRotatef(-this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
- GL11.glDisable(GL11.GL_CULL_FACE);
- mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- ClientHelper.setLightmapTextureCoords();
- ClientHelper.renderIcon(BlockLebethronWood.iconPortal, 220);
- GL11.glEnable(GL11.GL_CULL_FACE);
- GL11.glDisable(3042);
- GL11.glPopMatrix();
- }
+ public void doRender(Entity entity, double x, double y, double z, float fl, float fl1) {
+ double worldTime = (entity.worldObj == null) ? 0.0D : (ClientTickHandler.ticksInGame + fl1);
+ if (entity != null)
+ worldTime += (new Random(((int) entity.posX ^ (int) entity.posY ^ (int) entity.posZ))).nextInt(360);
+ Minecraft mc = Minecraft.getMinecraft();
+ float burn = Math.min(1.0f, entity.ticksExisted * 0.0561f);
+ GL11.glPushMatrix();
+ GL11.glTranslated(x, y, z);
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ burn = Math.max(0.0f, (float) (burn + (Math.sin(worldTime / 3.2f) / 9.0f)));
+ GL11.glScalef(burn / 3.15f, burn / 3.15f, burn / 3.15f);
+ GL11.glRotatef(180.0f - this.renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
+ GL11.glRotatef(-this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ ClientHelper.setLightmapTextureCoords();
+ ClientHelper.renderIcon(BlockLebethronWood.iconPortal, 220);
+ GL11.glEnable(GL11.GL_CULL_FACE);
+ GL11.glDisable(3042);
+ GL11.glPopMatrix();
+ }
- protected ResourceLocation getEntityTexture(Entity entity) {
- return AbstractClientPlayer.locationStevePng;
- }
+ protected ResourceLocation getEntityTexture(Entity entity) {
+ return AbstractClientPlayer.locationStevePng;
+ }
}
diff --git a/src/main/java/ab/client/render/item/RenderItemAntigravityCharm.java b/src/main/java/ab/client/render/item/RenderItemAntigravityCharm.java
index 10f0921..e22ff67 100644
--- a/src/main/java/ab/client/render/item/RenderItemAntigravityCharm.java
+++ b/src/main/java/ab/client/render/item/RenderItemAntigravityCharm.java
@@ -1,58 +1,75 @@
package ab.client.render.item;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.item.ItemAntigravityCharm;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.common.core.helper.ItemNBTHelper;
+import ab.common.item.ItemAntigravityCharm;
public class RenderItemAntigravityCharm implements IItemRenderer {
-
- public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
- return true;
- }
-
- public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
- return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
- }
-
- public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
- int dmg = item.getItemDamage();
- IIcon icon = ItemAntigravityCharm.icons[0];
- IIcon iconIsland = ItemAntigravityCharm.icons[1];
- GL11.glPushMatrix();
- if(type == type.INVENTORY) {
- GL11.glScalef(16, 16, 16);
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(-1.0f, -1.0f, 0);
- } else if(type == type.ENTITY) {
- GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
- if (item.isOnItemFrame())
- GL11.glTranslatef(0.0F, -0.3F, 0.01F);
- }
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(770, 771, 1, 0);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
- double time = (double) Minecraft.getSystemTime();
- if(type != type.INVENTORY) {
- GL11.glScalef(1.0f, 1.0f, 1.05f);
- GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
- }
- if(ItemNBTHelper.getBoolean(item, "isActive", true)) {
- GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 -0.05f, 0.0f);
- } else {
- GL11.glTranslated(0.0f, -0.125f, 0.0f);
- }
- ItemRenderer.renderItemIn2D(Tessellator.instance, iconIsland.getMaxU(), iconIsland.getMinV(), iconIsland.getMinU(), iconIsland.getMaxV(), iconIsland.getIconWidth(), iconIsland.getIconHeight(), 0.0625F);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glPopMatrix();
- }
+
+ public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
+ return true;
+ }
+
+ public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item,
+ IItemRenderer.ItemRendererHelper helper) {
+ return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION
+ || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
+ }
+
+ public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
+ int dmg = item.getItemDamage();
+ IIcon icon = ItemAntigravityCharm.icons[0];
+ IIcon iconIsland = ItemAntigravityCharm.icons[1];
+ GL11.glPushMatrix();
+ if (type == type.INVENTORY) {
+ GL11.glScalef(16, 16, 16);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glTranslatef(-1.0f, -1.0f, 0);
+ } else if (type == type.ENTITY) {
+ GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
+ if (item.isOnItemFrame()) GL11.glTranslatef(0.0F, -0.3F, 0.01F);
+ }
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ icon.getMaxU(),
+ icon.getMinV(),
+ icon.getMinU(),
+ icon.getMaxV(),
+ icon.getIconWidth(),
+ icon.getIconHeight(),
+ 0.0625F);
+ double time = (double) Minecraft.getSystemTime();
+ if (type != type.INVENTORY) {
+ GL11.glScalef(1.0f, 1.0f, 1.05f);
+ GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
+ }
+ if (ItemNBTHelper.getBoolean(item, "isActive", true)) {
+ GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 - 0.05f, 0.0f);
+ } else {
+ GL11.glTranslated(0.0f, -0.125f, 0.0f);
+ }
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ iconIsland.getMaxU(),
+ iconIsland.getMinV(),
+ iconIsland.getMinU(),
+ iconIsland.getMaxV(),
+ iconIsland.getIconWidth(),
+ iconIsland.getIconHeight(),
+ 0.0625F);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/ab/client/render/item/RenderItemSphereNavigation.java b/src/main/java/ab/client/render/item/RenderItemSphereNavigation.java
index 5e33c77..1febe26 100644
--- a/src/main/java/ab/client/render/item/RenderItemSphereNavigation.java
+++ b/src/main/java/ab/client/render/item/RenderItemSphereNavigation.java
@@ -1,8 +1,5 @@
package ab.client.render.item;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.item.relic.ItemSphereNavigation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -10,47 +7,75 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
-import vazkii.botania.common.core.helper.ItemNBTHelper;
+
+import org.lwjgl.opengl.GL11;
+
+import ab.common.item.relic.ItemSphereNavigation;
public class RenderItemSphereNavigation implements IItemRenderer {
- public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
- return true;
- }
-
- public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
- return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
- }
-
- public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
- GL11.glPushMatrix();
- if(type == type.INVENTORY) {
- GL11.glScalef(16, 16, 16);
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(-1.0f, -1.0f, 0);
- } else if(type == type.ENTITY) {
- GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
- if(stack.isOnItemFrame())
- GL11.glTranslatef(0.0F, -0.3F, 0.01F);
- }
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(770, 771, 1, 0);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- IIcon icon = ItemSphereNavigation.icons[0];
- ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
- IIcon iconEnable = ItemSphereNavigation.icons[stack.getItemDamage() == 0 ? 4 : 3];
- ItemRenderer.renderItemIn2D(Tessellator.instance, iconEnable.getMaxU(), iconEnable.getMinV(), iconEnable.getMinU(), iconEnable.getMaxV(), iconEnable.getIconWidth(), iconEnable.getIconHeight(), 0.0625F);
- double time = (double) Minecraft.getSystemTime();
- if(type != type.INVENTORY) {
- GL11.glScalef(1.0f, 1.0f, 1.05f);
- GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
- }
- IIcon iconBlock = ItemSphereNavigation.icons[ItemSphereNavigation.getFindBlock(stack) != null ? 1 : 2];
- if(ItemSphereNavigation.getFindBlock(stack) != null) {
- GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 - 0.015f, 0.0f);
- }
- ItemRenderer.renderItemIn2D(Tessellator.instance, iconBlock.getMaxU(), iconBlock.getMinV(), iconBlock.getMinU(), iconBlock.getMaxV(), iconBlock.getIconWidth(), iconBlock.getIconHeight(), 0.0625F);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glPopMatrix();
- }
+ public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
+ return true;
+ }
+
+ public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item,
+ IItemRenderer.ItemRendererHelper helper) {
+ return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION
+ || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
+ }
+
+ public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
+ GL11.glPushMatrix();
+ if (type == type.INVENTORY) {
+ GL11.glScalef(16, 16, 16);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glTranslatef(-1.0f, -1.0f, 0);
+ } else if (type == type.ENTITY) {
+ GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
+ if (stack.isOnItemFrame()) GL11.glTranslatef(0.0F, -0.3F, 0.01F);
+ }
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ IIcon icon = ItemSphereNavigation.icons[0];
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ icon.getMaxU(),
+ icon.getMinV(),
+ icon.getMinU(),
+ icon.getMaxV(),
+ icon.getIconWidth(),
+ icon.getIconHeight(),
+ 0.0625F);
+ IIcon iconEnable = ItemSphereNavigation.icons[stack.getItemDamage() == 0 ? 4 : 3];
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ iconEnable.getMaxU(),
+ iconEnable.getMinV(),
+ iconEnable.getMinU(),
+ iconEnable.getMaxV(),
+ iconEnable.getIconWidth(),
+ iconEnable.getIconHeight(),
+ 0.0625F);
+ double time = (double) Minecraft.getSystemTime();
+ if (type != type.INVENTORY) {
+ GL11.glScalef(1.0f, 1.0f, 1.05f);
+ GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
+ }
+ IIcon iconBlock = ItemSphereNavigation.icons[ItemSphereNavigation.getFindBlock(stack) != null ? 1 : 2];
+ if (ItemSphereNavigation.getFindBlock(stack) != null) {
+ GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 - 0.015f, 0.0f);
+ }
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ iconBlock.getMaxU(),
+ iconBlock.getMinV(),
+ iconBlock.getMinU(),
+ iconBlock.getMaxV(),
+ iconBlock.getIconWidth(),
+ iconBlock.getIconHeight(),
+ 0.0625F);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileABSpreader.java b/src/main/java/ab/client/render/tile/RenderTileABSpreader.java
index 3818c34..ec35ba6 100644
--- a/src/main/java/ab/client/render/tile/RenderTileABSpreader.java
+++ b/src/main/java/ab/client/render/tile/RenderTileABSpreader.java
@@ -1,8 +1,5 @@
package ab.client.render.tile;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.tile.TileABSpreader;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
@@ -12,20 +9,26 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.mana.ILens;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.client.model.ModelSpreader;
import vazkii.botania.client.render.item.RenderLens;
+import ab.common.block.tile.TileABSpreader;
public class RenderTileABSpreader extends TileEntitySpecialRenderer {
-
- private static final ResourceLocation texture_0 = new ResourceLocation("ab:textures/model/lebethronSpreader.png");
- private static final ResourceLocation texture_1 = new ResourceLocation("ab:textures/model/lebethronSpreader_halloween.png");
+
+ private static final ResourceLocation texture_0 = new ResourceLocation("ab:textures/model/lebethronSpreader.png");
+ private static final ResourceLocation texture_1 = new ResourceLocation(
+ "ab:textures/model/lebethronSpreader_halloween.png");
private static final ModelSpreader model = new ModelSpreader();
- public void renderTileEntityAt(final TileEntity tileentity, final double x, final double y, final double z, final float ticks) {
- TileABSpreader spreader = (TileABSpreader)tileentity;
+ public void renderTileEntityAt(final TileEntity tileentity, final double x, final double y, final double z,
+ final float ticks) {
+ TileABSpreader spreader = (TileABSpreader) tileentity;
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
@@ -35,26 +38,24 @@ public class RenderTileABSpreader extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.0f, -1.0f, 0.0f);
GL11.glRotatef(spreader.rotationY, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(0.0f, 1.0f, 0.0f);
- if (!ClientProxy.dootDoot)
- Minecraft.getMinecraft().renderEngine.bindTexture(texture_0);
- else
- Minecraft.getMinecraft().renderEngine.bindTexture(texture_1);
+ if (!ClientProxy.dootDoot) Minecraft.getMinecraft().renderEngine.bindTexture(texture_0);
+ else Minecraft.getMinecraft().renderEngine.bindTexture(texture_1);
GL11.glScalef(1.0f, -1.0f, -1.0f);
- double time = ClientTickHandler.ticksInGame + ticks;
-
+ double time = ClientTickHandler.ticksInGame + ticks;
+
model.render();
GL11.glColor3f(1.0f, 1.0f, 1.0f);
GL11.glPushMatrix();
final double worldTicks = (tileentity.getWorldObj() == null) ? 0.0 : time;
- GL11.glRotatef((float)worldTicks % 360.0f, 0.0f, 1.0f, 0.0f);
- GL11.glTranslatef(0.0f, (float)Math.sin(worldTicks / 20.0) * 0.05f, 0.0f);
+ GL11.glRotatef((float) worldTicks % 360.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glTranslatef(0.0f, (float) Math.sin(worldTicks / 20.0) * 0.05f, 0.0f);
model.renderCube();
GL11.glPopMatrix();
GL11.glScalef(1.0f, -1.0f, -1.0f);
final ItemStack stack = spreader.getStackInSlot(0);
if (stack != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- final ILens lens = (ILens)stack.getItem();
+ final ILens lens = (ILens) stack.getItem();
GL11.glPushMatrix();
GL11.glTranslatef(-0.4f, -1.4f, -0.4375f);
GL11.glScalef(0.8f, 0.8f, 0.8f);
@@ -86,5 +87,5 @@ public class RenderTileABSpreader extends TileEntitySpecialRenderer {
}
GL11.glEnable(32826);
GL11.glPopMatrix();
- }
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileBoardFate.java b/src/main/java/ab/client/render/tile/RenderTileBoardFate.java
index 7f236c8..4d2f2f4 100644
--- a/src/main/java/ab/client/render/tile/RenderTileBoardFate.java
+++ b/src/main/java/ab/client/render/tile/RenderTileBoardFate.java
@@ -2,76 +2,76 @@ package ab.client.render.tile;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.model.ModelDiceFate;
-import ab.common.block.tile.TileBoardFate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.model.ModelDiceFate;
+import ab.common.block.tile.TileBoardFate;
public class RenderTileBoardFate extends TileEntitySpecialRenderer {
-
- private static final ModelDiceFate model = new ModelDiceFate();
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/diceFate.png");
- public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
- double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
- if(tile != null)
- time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
- TileBoardFate board = (TileBoardFate)tile;
- GL11.glEnable(3042);
- GL11.glEnable(32826);
- GL11.glBlendFunc(770, 771);
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5f, y, z + 0.5f);
- GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
- for(int i = 0; i < board.getSizeInventory(); i++) {
- if(board.getStackInSlot(i) == null)
- continue;
- time += i * 83.256f;
- GL11.glPushMatrix();
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- float dropAnim = (1.0f - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
- dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
- float alpha = (float)Math.cos(dropAnim);
- float indet = i == 0 ? 0.16f + (0.08f * dropAnim) : -0.16f - (0.08f * dropAnim);
- GL11.glTranslated(indet, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), indet);
- GL11.glScalef(0.25f, 0.25f, 0.25f);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- float dropAngel = 70.0f * dropAnim;
- switch(board.slotChance[i]) {
- case 1:
- model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 2:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 3:
- model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 4:
- model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 5:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
- break;
- case 6:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
- break;
- default:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- }
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- GL11.glEnable(32826);
- GL11.glDisable(3042);
- }
-}
\ No newline at end of file
+ private static final ModelDiceFate model = new ModelDiceFate();
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/diceFate.png");
+
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
+ double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
+ if (tile != null) time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
+ TileBoardFate board = (TileBoardFate) tile;
+ GL11.glEnable(3042);
+ GL11.glEnable(32826);
+ GL11.glBlendFunc(770, 771);
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.5f, y, z + 0.5f);
+ GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
+ for (int i = 0; i < board.getSizeInventory(); i++) {
+ if (board.getStackInSlot(i) == null) continue;
+ time += i * 83.256f;
+ GL11.glPushMatrix();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ float dropAnim = (1.0f
+ - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
+ dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
+ float alpha = (float) Math.cos(dropAnim);
+ float indet = i == 0 ? 0.16f + (0.08f * dropAnim) : -0.16f - (0.08f * dropAnim);
+ GL11.glTranslated(indet, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), indet);
+ GL11.glScalef(0.25f, 0.25f, 0.25f);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ float dropAngel = 70.0f * dropAnim;
+ switch (board.slotChance[i]) {
+ case 1:
+ model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 2:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 3:
+ model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 4:
+ model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 5:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
+ break;
+ case 6:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
+ break;
+ default:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ }
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
+ GL11.glPopMatrix();
+ GL11.glEnable(32826);
+ GL11.glDisable(3042);
+ }
+}
diff --git a/src/main/java/ab/client/render/tile/RenderTileEngineerHopper.java b/src/main/java/ab/client/render/tile/RenderTileEngineerHopper.java
index e635505..d8202ec 100644
--- a/src/main/java/ab/client/render/tile/RenderTileEngineerHopper.java
+++ b/src/main/java/ab/client/render/tile/RenderTileEngineerHopper.java
@@ -2,34 +2,34 @@ package ab.client.render.tile;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.model.ModelEngineerHopper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.model.ModelEngineerHopper;
public class RenderTileEngineerHopper extends TileEntitySpecialRenderer {
-
- private static final ModelEngineerHopper model = new ModelEngineerHopper();
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/engineerHopper.png");
- public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
- double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
- if(tile != null)
- time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
- GL11.glPushMatrix();
- GL11.glEnable(32826);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(x, y, z);
- GL11.glTranslatef(0.5f, 1.0625f, 0.5f);
- GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
- GL11.glScalef(0.7f, 0.7f, 0.7f);
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- model.renderHoper(time);
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- }
+ private static final ModelEngineerHopper model = new ModelEngineerHopper();
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/engineerHopper.png");
+
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
+ double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
+ if (tile != null) time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(x, y, z);
+ GL11.glTranslatef(0.5f, 1.0625f, 0.5f);
+ GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
+ GL11.glScalef(0.7f, 0.7f, 0.7f);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ model.renderHoper(time);
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileGameBoard.java b/src/main/java/ab/client/render/tile/RenderTileGameBoard.java
index f769d94..22b2a35 100644
--- a/src/main/java/ab/client/render/tile/RenderTileGameBoard.java
+++ b/src/main/java/ab/client/render/tile/RenderTileGameBoard.java
@@ -2,95 +2,95 @@ package ab.client.render.tile;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.model.ModelDiceFate;
-import ab.common.block.tile.TileGameBoard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.model.ModelDiceFate;
+import ab.common.block.tile.TileGameBoard;
public class RenderTileGameBoard extends TileEntitySpecialRenderer {
-
- private static final ModelDiceFate model = new ModelDiceFate();
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/gameDice.png");
- private static final ResourceLocation textureEnemy = new ResourceLocation("ab:textures/model/gameDice_enemy.png");
-
- public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
- double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
- if(tile != null)
- time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
- TileGameBoard board = (TileGameBoard)tile;
- GL11.glEnable(3042);
- GL11.glEnable(32826);
- GL11.glBlendFunc(770, 771);
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5f, y, z + 0.5f);
- GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
- for(int i = 0; i < board.slotChance.length; i++) {
- if(board.slotChance[i] == 0)
- continue;
- time += i * 83.256f;
- GL11.glPushMatrix();
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- float posX = 0.0f;
- float posZ = 0.0f;
- float dropAnim = (1.0f - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
- dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
- float alpha = (float)Math.cos(dropAnim);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
- switch(i) {
- case 0:
- posX = 0.16f + 0.08f * dropAnim;
- posZ = 0.16f + 0.08f * dropAnim;
- break;
- case 1:
- posX = -0.16f - 0.08f * dropAnim;
- posZ = 0.16f + 0.08f * dropAnim;
- break;
- case 2:
- posX = 0.16f + 0.08f * dropAnim;
- posZ = -0.16f - 0.08f * dropAnim;
- break;
- case 3:
- posX = -0.16f - 0.08f * dropAnim;
- posZ = -0.16f - 0.08f * dropAnim;
- break;
- }
- GL11.glTranslated(posX, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), posZ);
- GL11.glScalef(0.25f, 0.25f, 0.25f);
- Minecraft.getMinecraft().renderEngine.bindTexture(i > 1 ? textureEnemy : texture);
- float dropAngel = 70.0f * dropAnim;
- switch(board.slotChance[i]) {
- case 1:
- model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 2:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 3:
- model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 4:
- model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- case 5:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
- break;
- case 6:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
- break;
- default:
- model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
- break;
- }
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- GL11.glEnable(32826);
- GL11.glDisable(3042);
- }
+
+ private static final ModelDiceFate model = new ModelDiceFate();
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/gameDice.png");
+ private static final ResourceLocation textureEnemy = new ResourceLocation("ab:textures/model/gameDice_enemy.png");
+
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
+ double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
+ if (tile != null) time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
+ TileGameBoard board = (TileGameBoard) tile;
+ GL11.glEnable(3042);
+ GL11.glEnable(32826);
+ GL11.glBlendFunc(770, 771);
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.5f, y, z + 0.5f);
+ GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
+ for (int i = 0; i < board.slotChance.length; i++) {
+ if (board.slotChance[i] == 0) continue;
+ time += i * 83.256f;
+ GL11.glPushMatrix();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ float posX = 0.0f;
+ float posZ = 0.0f;
+ float dropAnim = (1.0f
+ - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
+ dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
+ float alpha = (float) Math.cos(dropAnim);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
+ switch (i) {
+ case 0:
+ posX = 0.16f + 0.08f * dropAnim;
+ posZ = 0.16f + 0.08f * dropAnim;
+ break;
+ case 1:
+ posX = -0.16f - 0.08f * dropAnim;
+ posZ = 0.16f + 0.08f * dropAnim;
+ break;
+ case 2:
+ posX = 0.16f + 0.08f * dropAnim;
+ posZ = -0.16f - 0.08f * dropAnim;
+ break;
+ case 3:
+ posX = -0.16f - 0.08f * dropAnim;
+ posZ = -0.16f - 0.08f * dropAnim;
+ break;
+ }
+ GL11.glTranslated(posX, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), posZ);
+ GL11.glScalef(0.25f, 0.25f, 0.25f);
+ Minecraft.getMinecraft().renderEngine.bindTexture(i > 1 ? textureEnemy : texture);
+ float dropAngel = 70.0f * dropAnim;
+ switch (board.slotChance[i]) {
+ case 1:
+ model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 2:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 3:
+ model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 4:
+ model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ case 5:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
+ break;
+ case 6:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
+ break;
+ default:
+ model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
+ break;
+ }
+ GL11.glPopMatrix();
+ }
+ GL11.glPopMatrix();
+ GL11.glEnable(32826);
+ GL11.glDisable(3042);
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileMagicCraftingCrate.java b/src/main/java/ab/client/render/tile/RenderTileMagicCraftingCrate.java
index a073680..4c8636a 100644
--- a/src/main/java/ab/client/render/tile/RenderTileMagicCraftingCrate.java
+++ b/src/main/java/ab/client/render/tile/RenderTileMagicCraftingCrate.java
@@ -2,11 +2,6 @@ package ab.client.render.tile;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.common.block.BlockMagicCraftCrate;
-import ab.common.block.tile.TileMagicCraftCrate;
-import ab.common.lib.register.BlockListAB;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
@@ -20,115 +15,119 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.common.block.BlockMagicCraftCrate;
+import ab.common.block.tile.TileMagicCraftCrate;
+import ab.common.lib.register.BlockListAB;
public class RenderTileMagicCraftingCrate extends TileEntitySpecialRenderer {
-
- private ModelCrateBook model = new ModelCrateBook();
- public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
- double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + fq);
- if(tile != null)
- time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
- float f1 = 0.002f;
- float f2 = 0.125f;
- float f3 = 0.1875f;
- float f4 = 0.25f;
- TileMagicCraftCrate crate = (TileMagicCraftCrate) tile;
- boolean[][] pattern = crate.getPattern();
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- Tessellator t = new Tessellator();
- t.startDrawingQuads();
- t.setColorRGBA_I(0xfc0195, 50);
- IIcon icon = ((BlockMagicCraftCrate)BlockListAB.blockMagicCraftCrate).nothing;
- float maxU = icon.getMaxU();
- float maxV = icon.getMaxV();
- float minU = icon.getMinU();
- float minV = icon.getMinV();
- boolean hasPattern = false;
- for(int i = 0; i < 3; i++)
- for(int j = 0; j < 3; j++) {
- if(!pattern[i][j]) {
- int i1 = 2 - i;
- int j1 = 2 - j;
- hasPattern = true;
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1+ f2, maxU, maxV);
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1, maxU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1, minU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1+ f2, minU, maxV);
- float f0 = f2;
- if(i == 0 && j == 1)
- f0 = 0.0625f;
- float minY = (float) (y + f4 + f3 * i1);
- float maxY = minY + f0;
- t.addVertexWithUV(x + f4 + f3 * j1, minY, z - f1, maxU, maxV);
- t.addVertexWithUV(x + f4 + f3 * j1, maxY, z - f1, maxU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z - f1, minU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z - f1, minU, maxV);
- t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1, maxU, maxV);
- t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1, maxU, minV);
- t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1 + f2, minU, minV);
- t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1 + f2, minU, maxV);
- j1 = j;
- t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1 + f2, maxU, maxV);
- t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1 + f2, maxU, minV);
- t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1, minU, minV);
- t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1, minU, maxV);
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z + 1 + f1, maxU, maxV);
- t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z + 1 + f1, maxU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1, maxY, z + 1 + f1, minU, minV);
- t.addVertexWithUV(x + f4 + f3 * j1, minY, z + 1 + f1, minU, maxV);
- }
- }
- t.draw();
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- ItemStack wand = crate.getStackInSlot(10);
- if(wand != null) {
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5f, y + 1.12f + (Math.sin(time / 24.0D) / 40.0D - 0.05D), z + 0.275f);
- GL11.glRotated(Math.sin(time / 24.0D) * 5.0f, 0.0f, 1.0f, 0.0f);
- GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
- EntityItem entity = new EntityItem(tile.getWorldObj(), 0, -0.125, 0, wand.copy());
- entity.hoverStart = 0.0f;
- RenderItem.renderInFrame = true;
- RenderManager.instance.renderEntityWithPosYaw(entity, 0, -0.285, 0, 0.0f, 0.0f);
- RenderItem.renderInFrame = false;
- GL11.glPopMatrix();
- }
- ItemStack book = crate.getStackInSlot(11);
- if(book != null) {
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.7f, y + 0.825f + (Math.sin(-time / 24.0D) / 40.0D - 0.05D), z + 0.825f);
- GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
- GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
- GL11.glRotated(Math.sin(-time / 24.0D) * 5.0f, 0.0f, 0.0f, 1.0f);
- Minecraft.getMinecraft().renderEngine.bindTexture(model.texture);
- model.render();
- GL11.glPopMatrix();
- }
- }
-
- public class ModelCrateBook extends ModelBase {
- public final ResourceLocation texture = new ResourceLocation("thaumcraft:textures/models/fortress_armor.png");
- private ModelRenderer Book;
-
- public ModelCrateBook() {
- textureWidth = 128;
- textureHeight = 64;
- Book = new ModelRenderer(this, 100, 8);
- Book.addBox(1.0F, -0.3F, 4.0F, 5, 7, 2);
- Book.setRotationPoint(0.0F, 0.0F, 0.0F);
- Book.setTextureSize(128, 64);
- }
-
- public void render() {
- Book.render(0.0625f);
- }
- }
+ private ModelCrateBook model = new ModelCrateBook();
+
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
+ double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + fq);
+ if (tile != null) time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
+ float f1 = 0.002f;
+ float f2 = 0.125f;
+ float f3 = 0.1875f;
+ float f4 = 0.25f;
+ TileMagicCraftCrate crate = (TileMagicCraftCrate) tile;
+ boolean[][] pattern = crate.getPattern();
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ Tessellator t = new Tessellator();
+ t.startDrawingQuads();
+ t.setColorRGBA_I(0xfc0195, 50);
+ IIcon icon = ((BlockMagicCraftCrate) BlockListAB.blockMagicCraftCrate).nothing;
+ float maxU = icon.getMaxU();
+ float maxV = icon.getMaxV();
+ float minU = icon.getMinU();
+ float minV = icon.getMinV();
+ boolean hasPattern = false;
+ for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) {
+ if (!pattern[i][j]) {
+ int i1 = 2 - i;
+ int j1 = 2 - j;
+ hasPattern = true;
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1 + f2, maxU, maxV);
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1, maxU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1, minU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1 + f2, minU, maxV);
+ float f0 = f2;
+ if (i == 0 && j == 1) f0 = 0.0625f;
+ float minY = (float) (y + f4 + f3 * i1);
+ float maxY = minY + f0;
+ t.addVertexWithUV(x + f4 + f3 * j1, minY, z - f1, maxU, maxV);
+ t.addVertexWithUV(x + f4 + f3 * j1, maxY, z - f1, maxU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z - f1, minU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z - f1, minU, maxV);
+ t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1, maxU, maxV);
+ t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1, maxU, minV);
+ t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1 + f2, minU, minV);
+ t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1 + f2, minU, maxV);
+ j1 = j;
+ t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1 + f2, maxU, maxV);
+ t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1 + f2, maxU, minV);
+ t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1, minU, minV);
+ t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1, minU, maxV);
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z + 1 + f1, maxU, maxV);
+ t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z + 1 + f1, maxU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1, maxY, z + 1 + f1, minU, minV);
+ t.addVertexWithUV(x + f4 + f3 * j1, minY, z + 1 + f1, minU, maxV);
+ }
+ }
+ t.draw();
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ ItemStack wand = crate.getStackInSlot(10);
+ if (wand != null) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.5f, y + 1.12f + (Math.sin(time / 24.0D) / 40.0D - 0.05D), z + 0.275f);
+ GL11.glRotated(Math.sin(time / 24.0D) * 5.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
+ EntityItem entity = new EntityItem(tile.getWorldObj(), 0, -0.125, 0, wand.copy());
+ entity.hoverStart = 0.0f;
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(entity, 0, -0.285, 0, 0.0f, 0.0f);
+ RenderItem.renderInFrame = false;
+ GL11.glPopMatrix();
+ }
+ ItemStack book = crate.getStackInSlot(11);
+ if (book != null) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.7f, y + 0.825f + (Math.sin(-time / 24.0D) / 40.0D - 0.05D), z + 0.825f);
+ GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
+ GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glRotated(Math.sin(-time / 24.0D) * 5.0f, 0.0f, 0.0f, 1.0f);
+ Minecraft.getMinecraft().renderEngine.bindTexture(model.texture);
+ model.render();
+ GL11.glPopMatrix();
+ }
+ }
+
+ public class ModelCrateBook extends ModelBase {
+
+ public final ResourceLocation texture = new ResourceLocation("thaumcraft:textures/models/fortress_armor.png");
+ private ModelRenderer Book;
+
+ public ModelCrateBook() {
+ textureWidth = 128;
+ textureHeight = 64;
+ Book = new ModelRenderer(this, 100, 8);
+ Book.addBox(1.0F, -0.3F, 4.0F, 5, 7, 2);
+ Book.setRotationPoint(0.0F, 0.0F, 0.0F);
+ Book.setTextureSize(128, 64);
+ }
+
+ public void render() {
+ Book.render(0.0625f);
+ }
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileManaCharger.java b/src/main/java/ab/client/render/tile/RenderTileManaCharger.java
index 1df9592..c7d08bc 100644
--- a/src/main/java/ab/client/render/tile/RenderTileManaCharger.java
+++ b/src/main/java/ab/client/render/tile/RenderTileManaCharger.java
@@ -1,14 +1,8 @@
package ab.client.render.tile;
import java.awt.Color;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.model.ModelManaCharger;
-import ab.common.block.tile.TileManaCharger;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
@@ -22,68 +16,97 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
+import ab.client.model.ModelManaCharger;
+import ab.common.block.tile.TileManaCharger;
public class RenderTileManaCharger extends TileEntitySpecialRenderer {
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/manaCharger.png");
- private static final ModelManaCharger model = new ModelManaCharger();
- public TileManaCharger charger;
-
- public void renderTileEntityAt(final TileEntity tile, final double x, final double y, final double z, final float ticks) {
- this.charger = (TileManaCharger)tile;
- double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
- if (tile != null)
- time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
- GL11.glPushMatrix();
- GL11.glEnable(32826);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(x, y, z);
- GL11.glTranslatef(0.5f, 1.65f, 0.5f);
- GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- model.render(this, time);
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- }
-
- public void renderItemStack(ItemStack stack) {
- if (stack != null) {
- Minecraft mc = Minecraft.getMinecraft();
- mc.renderEngine.bindTexture((stack.getItem() instanceof net.minecraft.item.ItemBlock) ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
- float s = 0.25F;
- GL11.glScalef(s, s, s);
- GL11.glScalef(2.0F, 2.0F, 2.0F);
- if (!ForgeHooksClient.renderEntityItem(new EntityItem(this.charger.getWorldObj(), this.charger.xCoord, this.charger.yCoord, this.charger.zCoord, stack), stack, 0.0F, 0.0F, (this.charger.getWorldObj()).rand, mc.renderEngine, RenderBlocks.getInstance(), 1)) {
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- if (stack.getItem() instanceof net.minecraft.item.ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- GL11.glTranslatef(1.0F, 1.1F, 0.0F);
- GL11.glPushMatrix();
- RenderBlocks.getInstance().renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1.0F);
- GL11.glPopMatrix();
- GL11.glTranslatef(-1.0F, -1.1F, 0.0F);
- GL11.glScalef(2.0F, 2.0F, 2.0F);
- } else {
- int renderPass = 0;
- do {
- IIcon icon = stack.getItem().getIcon(stack, renderPass);
- if (icon == null)
- continue;
- Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
- GL11.glColor3ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue());
- float f = icon.getMinU();
- float f1 = icon.getMaxU();
- float f2 = icon.getMinV();
- float f3 = icon.getMaxV();
- ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
- GL11.glColor3f(1.0F, 1.0F, 1.0F);
- ++renderPass;
- } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
- }
- }
- GL11.glScalef(1.0F / s, 1.0F / s, 1.0F / s);
- (Minecraft.getMinecraft()).renderEngine.bindTexture(texture);
- }
- }
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/manaCharger.png");
+ private static final ModelManaCharger model = new ModelManaCharger();
+ public TileManaCharger charger;
+
+ public void renderTileEntityAt(final TileEntity tile, final double x, final double y, final double z,
+ final float ticks) {
+ this.charger = (TileManaCharger) tile;
+ double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
+ if (tile != null) time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(x, y, z);
+ GL11.glTranslatef(0.5f, 1.65f, 0.5f);
+ GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ model.render(this, time);
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
+
+ public void renderItemStack(ItemStack stack) {
+ if (stack != null) {
+ Minecraft mc = Minecraft.getMinecraft();
+ mc.renderEngine.bindTexture(
+ (stack.getItem() instanceof net.minecraft.item.ItemBlock) ? TextureMap.locationBlocksTexture
+ : TextureMap.locationItemsTexture);
+ float s = 0.25F;
+ GL11.glScalef(s, s, s);
+ GL11.glScalef(2.0F, 2.0F, 2.0F);
+ if (!ForgeHooksClient.renderEntityItem(
+ new EntityItem(
+ this.charger.getWorldObj(),
+ this.charger.xCoord,
+ this.charger.yCoord,
+ this.charger.zCoord,
+ stack),
+ stack,
+ 0.0F,
+ 0.0F,
+ (this.charger.getWorldObj()).rand,
+ mc.renderEngine,
+ RenderBlocks.getInstance(),
+ 1)) {
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ if (stack.getItem() instanceof net.minecraft.item.ItemBlock
+ && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(1.0F, 1.1F, 0.0F);
+ GL11.glPushMatrix();
+ RenderBlocks.getInstance()
+ .renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1.0F);
+ GL11.glPopMatrix();
+ GL11.glTranslatef(-1.0F, -1.1F, 0.0F);
+ GL11.glScalef(2.0F, 2.0F, 2.0F);
+ } else {
+ int renderPass = 0;
+ do {
+ IIcon icon = stack.getItem().getIcon(stack, renderPass);
+ if (icon == null) continue;
+ Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
+ GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
+ float f = icon.getMinU();
+ float f1 = icon.getMaxU();
+ float f2 = icon.getMinV();
+ float f3 = icon.getMaxV();
+ ItemRenderer.renderItemIn2D(
+ Tessellator.instance,
+ f1,
+ f2,
+ f,
+ f3,
+ icon.getIconWidth(),
+ icon.getIconHeight(),
+ 0.0625F);
+ GL11.glColor3f(1.0F, 1.0F, 1.0F);
+ ++renderPass;
+ } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
+ }
+ }
+ GL11.glScalef(1.0F / s, 1.0F / s, 1.0F / s);
+ (Minecraft.getMinecraft()).renderEngine.bindTexture(texture);
+ }
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileManaContainer.java b/src/main/java/ab/client/render/tile/RenderTileManaContainer.java
index 8376464..34d0803 100644
--- a/src/main/java/ab/client/render/tile/RenderTileManaContainer.java
+++ b/src/main/java/ab/client/render/tile/RenderTileManaContainer.java
@@ -3,88 +3,86 @@ package ab.client.render.tile;
import java.awt.Color;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.core.ClientHelper;
-import ab.client.model.ModelManaContainer;
-import ab.common.block.tile.TileManaContainer;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.block.mana.BlockPool;
+import ab.client.core.ClientHelper;
+import ab.client.model.ModelManaContainer;
+import ab.common.block.tile.TileManaContainer;
public class RenderTileManaContainer extends TileEntitySpecialRenderer {
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/mana_container.png");
- private static final ResourceLocation texture1 = new ResourceLocation("ab:textures/model/mana_container1.png");
- private static final ModelManaContainer model = new ModelManaContainer();
-
- public static int metadata;
-
- public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float ticks) {
- TileManaContainer container = (TileManaContainer)tileentity;
- double worldTime = (tileentity.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
- if(tileentity != null)
- worldTime += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
- boolean dil = (tileentity.getWorldObj() == null) ? ((metadata == 1)) : ((tileentity.getBlockMetadata() == 1));
- boolean fab = (tileentity.getWorldObj() == null) ? ((metadata == 2)) : ((tileentity.getBlockMetadata() == 2));
- GL11.glPushMatrix();
- GL11.glEnable(32826);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(x, y, z);
- GL11.glTranslatef(0.5f, 1.075f, 0.5f);
- GL11.glScalef(0.7f, 0.7f, 0.7f);
- GL11.glRotatef((float)worldTime * 0.375F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslated(0.0D, Math.sin(worldTime / 80.0D) / 20.0D - 0.025D, 0.0D);
- GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
- if(fab) {
- float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
- if(tileentity != null)
- time += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(100000);
- Color color = Color.getHSBColor((float)(time * 0.005F), 0.6F, 1.0F);
- GL11.glColor4ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue(), (byte)-1);
- }
- Minecraft.getMinecraft().renderEngine.bindTexture(dil ? texture1 : texture);
- model.render();
- renderMana(tileentity.getWorldObj(), container);
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- metadata = 0;
- }
-
- public void renderMana(World world, TileManaContainer container) {
- if(world != null) {
- (Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- int mana = container.getCurrentMana();
- int cap = container.getMaxMana();
- float waterLevel = ((float)mana / (float)cap) * 0.8F;
- float v = 0.125F;
- float w = -v * 3.5F;
- if(waterLevel > 0.0F) {
- float s = 0.5f;
- GL11.glPushMatrix();
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glDisable(3008);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
- GL11.glScalef(s, s, s);
- GL11.glTranslatef(0.0f, 1.71F - waterLevel, -0.25f);
- GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
- ShaderHelper.useShader(ShaderHelper.manaPool);
- ClientHelper.renderIcon(BlockPool.manaIcon, 240);
- ShaderHelper.releaseShader();
- GL11.glEnable(3008);
- GL11.glDisable(3042);
- GL11.glPopMatrix();
- }
- }
- }
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/mana_container.png");
+ private static final ResourceLocation texture1 = new ResourceLocation("ab:textures/model/mana_container1.png");
+ private static final ModelManaContainer model = new ModelManaContainer();
+
+ public static int metadata;
+
+ public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float ticks) {
+ TileManaContainer container = (TileManaContainer) tileentity;
+ double worldTime = (tileentity.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
+ if (tileentity != null)
+ worldTime += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
+ boolean dil = (tileentity.getWorldObj() == null) ? ((metadata == 1)) : ((tileentity.getBlockMetadata() == 1));
+ boolean fab = (tileentity.getWorldObj() == null) ? ((metadata == 2)) : ((tileentity.getBlockMetadata() == 2));
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(x, y, z);
+ GL11.glTranslatef(0.5f, 1.075f, 0.5f);
+ GL11.glScalef(0.7f, 0.7f, 0.7f);
+ GL11.glRotatef((float) worldTime * 0.375F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslated(0.0D, Math.sin(worldTime / 80.0D) / 20.0D - 0.025D, 0.0D);
+ GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
+ if (fab) {
+ float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
+ if (tileentity != null)
+ time += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(100000);
+ Color color = Color.getHSBColor((float) (time * 0.005F), 0.6F, 1.0F);
+ GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) -1);
+ }
+ Minecraft.getMinecraft().renderEngine.bindTexture(dil ? texture1 : texture);
+ model.render();
+ renderMana(tileentity.getWorldObj(), container);
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ metadata = 0;
+ }
+
+ public void renderMana(World world, TileManaContainer container) {
+ if (world != null) {
+ (Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ int mana = container.getCurrentMana();
+ int cap = container.getMaxMana();
+ float waterLevel = ((float) mana / (float) cap) * 0.8F;
+ float v = 0.125F;
+ float w = -v * 3.5F;
+ if (waterLevel > 0.0F) {
+ float s = 0.5f;
+ GL11.glPushMatrix();
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glDisable(3008);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
+ GL11.glScalef(s, s, s);
+ GL11.glTranslatef(0.0f, 1.71F - waterLevel, -0.25f);
+ GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
+ ShaderHelper.useShader(ShaderHelper.manaPool);
+ ClientHelper.renderIcon(BlockPool.manaIcon, 240);
+ ShaderHelper.releaseShader();
+ GL11.glEnable(3008);
+ GL11.glDisable(3042);
+ GL11.glPopMatrix();
+ }
+ }
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileManaCrystalCube.java b/src/main/java/ab/client/render/tile/RenderTileManaCrystalCube.java
index 90e5ff5..de92525 100644
--- a/src/main/java/ab/client/render/tile/RenderTileManaCrystalCube.java
+++ b/src/main/java/ab/client/render/tile/RenderTileManaCrystalCube.java
@@ -1,7 +1,5 @@
package ab.client.render.tile;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
@@ -11,49 +9,57 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.model.ModelCrystalCube;
import vazkii.botania.common.item.ModItems;
public class RenderTileManaCrystalCube extends TileEntitySpecialRenderer {
-
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/crystalCube.png");
- private static final ModelCrystalCube model = new ModelCrystalCube();
- private EntityItem entity = null;
-
- public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float f) {
- if(this.entity == null)
- this.entity = new EntityItem(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, new ItemStack(ModItems.twigWand));
- this.entity.age = ClientTickHandler.ticksInGame;
- double time = (ClientTickHandler.ticksInGame + f);
- double worldTicks = (tile.getWorldObj() == null) ? 0.0D : time;
- Minecraft mc = Minecraft.getMinecraft();
- GL11.glPushMatrix();
- GL11.glEnable(32826);
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(d0, d1, d2);
- mc.renderEngine.bindTexture(texture);
- GL11.glTranslatef(0.5F, 1.5F, 0.5F);
- GL11.glScalef(1.0F, -1.0F, -1.0F);
- this.model.renderBase();
- GL11.glTranslatef(0.0F, (float)Math.sin(worldTicks / 20.0D) * 0.05F, 0.0F);
- if(tile.getWorldObj() != null) {
- GL11.glPushMatrix();
- float s = 0.5F;
- GL11.glTranslatef(0.0F, 0.8F, 0.0F);
- GL11.glScalef(s, s, s);
- GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
- ((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)this.entity, 0.0D, 0.0D, 0.0D, 1.0F, f);
- GL11.glPopMatrix();
- mc.renderEngine.bindTexture(texture);
- }
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
- this.model.renderCube();
- GL11.glColor3f(1.0F, 1.0F, 1.0F);
- GL11.glScalef(1.0F, -1.0F, -1.0F);
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- }
+
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/crystalCube.png");
+ private static final ModelCrystalCube model = new ModelCrystalCube();
+ private EntityItem entity = null;
+
+ public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float f) {
+ if (this.entity == null) this.entity = new EntityItem(
+ tile.getWorldObj(),
+ tile.xCoord,
+ tile.yCoord,
+ tile.zCoord,
+ new ItemStack(ModItems.twigWand));
+ this.entity.age = ClientTickHandler.ticksInGame;
+ double time = (ClientTickHandler.ticksInGame + f);
+ double worldTicks = (tile.getWorldObj() == null) ? 0.0D : time;
+ Minecraft mc = Minecraft.getMinecraft();
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(d0, d1, d2);
+ mc.renderEngine.bindTexture(texture);
+ GL11.glTranslatef(0.5F, 1.5F, 0.5F);
+ GL11.glScalef(1.0F, -1.0F, -1.0F);
+ this.model.renderBase();
+ GL11.glTranslatef(0.0F, (float) Math.sin(worldTicks / 20.0D) * 0.05F, 0.0F);
+ if (tile.getWorldObj() != null) {
+ GL11.glPushMatrix();
+ float s = 0.5F;
+ GL11.glTranslatef(0.0F, 0.8F, 0.0F);
+ GL11.glScalef(s, s, s);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ ((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class))
+ .doRender((Entity) this.entity, 0.0D, 0.0D, 0.0D, 1.0F, f);
+ GL11.glPopMatrix();
+ mc.renderEngine.bindTexture(texture);
+ }
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
+ this.model.renderCube();
+ GL11.glColor3f(1.0F, 1.0F, 1.0F);
+ GL11.glScalef(1.0F, -1.0F, -1.0F);
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/ab/client/render/tile/RenderTileNidavellirForge.java b/src/main/java/ab/client/render/tile/RenderTileNidavellirForge.java
index eca35bb..df8aef3 100644
--- a/src/main/java/ab/client/render/tile/RenderTileNidavellirForge.java
+++ b/src/main/java/ab/client/render/tile/RenderTileNidavellirForge.java
@@ -4,98 +4,94 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.model.ModelNidavellirForge;
-import ab.common.block.tile.TileNidavellirForge;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
-import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.client.core.handler.ClientTickHandler;
-import vazkii.botania.client.core.helper.ShaderHelper;
-import vazkii.botania.common.block.mana.BlockTerraPlate;
+import ab.client.model.ModelNidavellirForge;
+import ab.common.block.tile.TileNidavellirForge;
public class RenderTileNidavellirForge extends TileEntitySpecialRenderer {
-
- private List entityList = null;
- private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/nidavellirForge.png");
- private static final ModelNidavellirForge model = new ModelNidavellirForge();
-
- public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
- TileNidavellirForge tile = (TileNidavellirForge)tileentity;
- double worldTime = 0.0D;
- int meta = 2;
- float invRender = 0.0f;
- if(tileentity != null && tileentity.getWorldObj() != null) {
- worldTime = ClientTickHandler.ticksInGame + f + (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
- meta = tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
- } else
- invRender = 0.0875f;
- float indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
- GL11.glPushMatrix();
- GL11.glEnable(32826);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(x - invRender, y, z);
- GL11.glTranslatef(0.5f, 1.5f, 0.5f);
- GL11.glRotatef(180.0f, 1.0f, 0.0f, 1.0f);
- GL11.glRotatef(90.0f * meta, 0.0f, 1.0f, 0.0f);
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- model.renderBottom();
- GL11.glTranslatef(0.0f, indetY, 0.0f);
- model.renderTop();
- GL11.glEnable(32826);
- GL11.glPopMatrix();
- if(entityList == null) {
- List list = new ArrayList();
- for(int i = 0; i < tile.getSizeInventory(); i++) {
- list.add(new EntityItem(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord));
- }
- entityList = list;
- }
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5f, y + 0.675f - indetY, z + 0.5f);
- GL11.glScalef(0.2F, 0.225F, 0.225F);
- for(int i = 1; i < entityList.size(); i++) {
- GL11.glPushMatrix();
- ItemStack stack = tile.getStackInSlot(i);
- if(stack != null) {
- switch(i) {
- case 1:
- GL11.glTranslated(0.15f, 0.0f, 0.0f);
- break;
- case 2:
- GL11.glTranslated(-0.15f, 0.0f, -0.15f);
- break;
- case 3:
- GL11.glTranslated(-0.15f, 0.0f, 0.15f);
- break;
- }
- entityList.get(i).setEntityItemStack(stack);
- entityList.get(i).age = ClientTickHandler.ticksInGame;
- ((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)entityList.get(i), 0.0D, 0.0D, 0.0D, 1.0F, f);
- }
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- if(tile.getStackInSlot(0) != null) {
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5, y + 0.915f - indetY, z + 0.5);
- GL11.glScalef(0.45f, 0.45f, 0.45f);
- entityList.get(0).setEntityItemStack(tile.getStackInSlot(0));
- entityList.get(0).age = ClientTickHandler.ticksInGame;
- ((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)entityList.get(0), 0.0D, 0.0D, 0.0D, 1.0F, f);
- GL11.glPopMatrix();
- }
- }
-}
\ No newline at end of file
+
+ private List entityList = null;
+ private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/nidavellirForge.png");
+ private static final ModelNidavellirForge model = new ModelNidavellirForge();
+
+ public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
+ TileNidavellirForge tile = (TileNidavellirForge) tileentity;
+ double worldTime = 0.0D;
+ int meta = 2;
+ float invRender = 0.0f;
+ if (tileentity != null && tileentity.getWorldObj() != null) {
+ worldTime = ClientTickHandler.ticksInGame + f
+ + (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
+ meta = tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
+ } else invRender = 0.0875f;
+ float indetY = (float) (Math.sin(worldTime / 18.0D) / 24.0D);
+ GL11.glPushMatrix();
+ GL11.glEnable(32826);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(x - invRender, y, z);
+ GL11.glTranslatef(0.5f, 1.5f, 0.5f);
+ GL11.glRotatef(180.0f, 1.0f, 0.0f, 1.0f);
+ GL11.glRotatef(90.0f * meta, 0.0f, 1.0f, 0.0f);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ model.renderBottom();
+ GL11.glTranslatef(0.0f, indetY, 0.0f);
+ model.renderTop();
+ GL11.glEnable(32826);
+ GL11.glPopMatrix();
+ if (entityList == null) {
+ List list = new ArrayList();
+ for (int i = 0; i < tile.getSizeInventory(); i++) {
+ list.add(new EntityItem(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord));
+ }
+ entityList = list;
+ }
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.5f, y + 0.675f - indetY, z + 0.5f);
+ GL11.glScalef(0.2F, 0.225F, 0.225F);
+ for (int i = 1; i < entityList.size(); i++) {
+ GL11.glPushMatrix();
+ ItemStack stack = tile.getStackInSlot(i);
+ if (stack != null) {
+ switch (i) {
+ case 1:
+ GL11.glTranslated(0.15f, 0.0f, 0.0f);
+ break;
+ case 2:
+ GL11.glTranslated(-0.15f, 0.0f, -0.15f);
+ break;
+ case 3:
+ GL11.glTranslated(-0.15f, 0.0f, 0.15f);
+ break;
+ }
+ entityList.get(i).setEntityItemStack(stack);
+ entityList.get(i).age = ClientTickHandler.ticksInGame;
+ ((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class))
+ .doRender((Entity) entityList.get(i), 0.0D, 0.0D, 0.0D, 1.0F, f);
+ }
+ GL11.glPopMatrix();
+ }
+ GL11.glPopMatrix();
+ if (tile.getStackInSlot(0) != null) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + 0.5, y + 0.915f - indetY, z + 0.5);
+ GL11.glScalef(0.45f, 0.45f, 0.45f);
+ entityList.get(0).setEntityItemStack(tile.getStackInSlot(0));
+ entityList.get(0).age = ClientTickHandler.ticksInGame;
+ ((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class))
+ .doRender((Entity) entityList.get(0), 0.0D, 0.0D, 0.0D, 1.0F, f);
+ GL11.glPopMatrix();
+ }
+ }
+}
diff --git a/src/main/java/ab/client/render/tile/TileRenderer.java b/src/main/java/ab/client/render/tile/TileRenderer.java
index 7d15b21..8e88169 100644
--- a/src/main/java/ab/client/render/tile/TileRenderer.java
+++ b/src/main/java/ab/client/render/tile/TileRenderer.java
@@ -4,108 +4,115 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
public class TileRenderer {
-
- public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
- renderCube(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
- }
-
- public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
- renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
- }
-
- public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
- renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
- }
-
- public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
- renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
- }
-
- public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
- renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
-
- renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
-
- renderDownside(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
-
- }
+ public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
+ renderCube(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
+ }
- public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
-
- float maxU = icon.getMaxU();
- float maxV = icon.getMaxV();
- float minU = icon.getMinU();
- float minV = icon.getMinV();
+ public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t) {
+ renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
+ }
- double minX = xCenter - r;
- double minY = yCenter - r;
- double minZ = zCenter - r;
- double maxX = xCenter + r;
- double maxY = yCenter + r;
- double maxZ = zCenter + r;
+ public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t) {
+ renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
+ }
- t.addVertexWithUV(maxX, minY, maxZ + sideOffset, maxU, maxV);
- t.addVertexWithUV(maxX, maxY, maxZ + sideOffset, maxU, minV);
- t.addVertexWithUV(minX, maxY, maxZ + sideOffset, minU, minV);
- t.addVertexWithUV(minX, minY, maxZ + sideOffset, minU, maxV);
+ public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t) {
+ renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
+ }
- t.addVertexWithUV(minX, minY, minZ - sideOffset, maxU, maxV);
- t.addVertexWithUV(minX, maxY, minZ - sideOffset, maxU, minV);
- t.addVertexWithUV(maxX, maxY, minZ - sideOffset, minU, minV);
- t.addVertexWithUV(maxX, minY, minZ - sideOffset, minU, maxV);
+ public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t,
+ float sideOffset) {
- t.addVertexWithUV(minX - sideOffset, minY, maxZ, maxU, maxV);
- t.addVertexWithUV(minX - sideOffset, maxY, maxZ, maxU, minV);
- t.addVertexWithUV(minX - sideOffset, maxY, minZ, minU, minV);
- t.addVertexWithUV(minX - sideOffset, minY, minZ, minU, maxV);
+ renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
- t.addVertexWithUV(maxX + sideOffset, minY, minZ, maxU, maxV);
- t.addVertexWithUV(maxX + sideOffset, maxY, minZ, maxU, minV);
- t.addVertexWithUV(maxX + sideOffset, maxY, maxZ, minU, minV);
- t.addVertexWithUV(maxX + sideOffset, minY, maxZ, minU, maxV);
+ renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
- }
+ renderDownside(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
- public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
+ }
- float maxU = icon.getMaxU();
- float maxV = icon.getMaxV();
- float minU = icon.getMinU();
- float minV = icon.getMinV();
+ public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t, float sideOffset) {
- double minX = xCenter - r;
- double minY = yCenter - r;
- double minZ = zCenter - r;
- double maxX = xCenter + r;
- double maxY = yCenter + r;
- double maxZ = zCenter + r;
+ float maxU = icon.getMaxU();
+ float maxV = icon.getMaxV();
+ float minU = icon.getMinU();
+ float minV = icon.getMinV();
- t.addVertexWithUV(maxX, maxY + sideOffset, maxZ, maxU, maxV);
- t.addVertexWithUV(maxX, maxY + sideOffset, minZ, maxU, minV);
- t.addVertexWithUV(minX, maxY + sideOffset, minZ, minU, minV);
- t.addVertexWithUV(minX, maxY + sideOffset, maxZ, minU, maxV);
+ double minX = xCenter - r;
+ double minY = yCenter - r;
+ double minZ = zCenter - r;
+ double maxX = xCenter + r;
+ double maxY = yCenter + r;
+ double maxZ = zCenter + r;
- }
+ t.addVertexWithUV(maxX, minY, maxZ + sideOffset, maxU, maxV);
+ t.addVertexWithUV(maxX, maxY, maxZ + sideOffset, maxU, minV);
+ t.addVertexWithUV(minX, maxY, maxZ + sideOffset, minU, minV);
+ t.addVertexWithUV(minX, minY, maxZ + sideOffset, minU, maxV);
- public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
+ t.addVertexWithUV(minX, minY, minZ - sideOffset, maxU, maxV);
+ t.addVertexWithUV(minX, maxY, minZ - sideOffset, maxU, minV);
+ t.addVertexWithUV(maxX, maxY, minZ - sideOffset, minU, minV);
+ t.addVertexWithUV(maxX, minY, minZ - sideOffset, minU, maxV);
- float maxU = icon.getMaxU();
- float maxV = icon.getMaxV();
- float minU = icon.getMinU();
- float minV = icon.getMinV();
+ t.addVertexWithUV(minX - sideOffset, minY, maxZ, maxU, maxV);
+ t.addVertexWithUV(minX - sideOffset, maxY, maxZ, maxU, minV);
+ t.addVertexWithUV(minX - sideOffset, maxY, minZ, minU, minV);
+ t.addVertexWithUV(minX - sideOffset, minY, minZ, minU, maxV);
- double minX = xCenter - r;
- double minY = yCenter - r;
- double minZ = zCenter - r;
- double maxX = xCenter + r;
- double maxY = yCenter + r;
- double maxZ = zCenter + r;
+ t.addVertexWithUV(maxX + sideOffset, minY, minZ, maxU, maxV);
+ t.addVertexWithUV(maxX + sideOffset, maxY, minZ, maxU, minV);
+ t.addVertexWithUV(maxX + sideOffset, maxY, maxZ, minU, minV);
+ t.addVertexWithUV(maxX + sideOffset, minY, maxZ, minU, maxV);
- t.addVertexWithUV(minX, minY - sideOffset, minZ, maxU, maxV);
- t.addVertexWithUV(maxX, minY - sideOffset, minZ, maxU, minV);
- t.addVertexWithUV(maxX, minY - sideOffset, maxZ, minU, minV);
- t.addVertexWithUV(minX, minY - sideOffset, maxZ, minU, maxV);
+ }
- }
-}
\ No newline at end of file
+ public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t, float sideOffset) {
+
+ float maxU = icon.getMaxU();
+ float maxV = icon.getMaxV();
+ float minU = icon.getMinU();
+ float minV = icon.getMinV();
+
+ double minX = xCenter - r;
+ double minY = yCenter - r;
+ double minZ = zCenter - r;
+ double maxX = xCenter + r;
+ double maxY = yCenter + r;
+ double maxZ = zCenter + r;
+
+ t.addVertexWithUV(maxX, maxY + sideOffset, maxZ, maxU, maxV);
+ t.addVertexWithUV(maxX, maxY + sideOffset, minZ, maxU, minV);
+ t.addVertexWithUV(minX, maxY + sideOffset, minZ, minU, minV);
+ t.addVertexWithUV(minX, maxY + sideOffset, maxZ, minU, maxV);
+
+ }
+
+ public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
+ Tessellator t, float sideOffset) {
+
+ float maxU = icon.getMaxU();
+ float maxV = icon.getMaxV();
+ float minU = icon.getMinU();
+ float minV = icon.getMinV();
+
+ double minX = xCenter - r;
+ double minY = yCenter - r;
+ double minZ = zCenter - r;
+ double maxX = xCenter + r;
+ double maxY = yCenter + r;
+ double maxZ = zCenter + r;
+
+ t.addVertexWithUV(minX, minY - sideOffset, minZ, maxU, maxV);
+ t.addVertexWithUV(maxX, minY - sideOffset, minZ, maxU, minV);
+ t.addVertexWithUV(maxX, minY - sideOffset, maxZ, minU, minV);
+ t.addVertexWithUV(minX, minY - sideOffset, maxZ, minU, maxV);
+
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockABSpreader.java b/src/main/java/ab/common/block/BlockABSpreader.java
index 51b646f..864c21a 100644
--- a/src/main/java/ab/common/block/BlockABSpreader.java
+++ b/src/main/java/ab/common/block/BlockABSpreader.java
@@ -1,19 +1,11 @@
package ab.common.block;
-import java.util.List;
-
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileABSpreader;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
@@ -27,146 +19,149 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.common.item.ModItems;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileABSpreader;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
-public class BlockABSpreader extends BlockContainer implements IWandable, IWandHUD, IWireframeAABBProvider, ILexiconable {
-
- public BlockABSpreader() {
- super(Material.wood);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(7.0F);
- this.setStepSound(soundTypeWood);
- this.setBlockName("advancedSpreader");
- }
-
- public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
- int orientation = BlockPistonBase.determineOrientation(world, x, y, z, liv);
- TileABSpreader spreader = (TileABSpreader)world.getTileEntity(x, y, z);
- world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
- switch (orientation) {
- case 0:
- spreader.rotationY = -90.0F;
- case 1:
- spreader.rotationY = 90.0F;
- case 2:
- spreader.rotationX = 270.0F;
- case 3:
- spreader.rotationX = 90.0F;
- case 4:
- return;
- }
- spreader.rotationX = 180.0F;
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
- TileEntity tile = world.getTileEntity(x, y, z);
- if (!(tile instanceof TileABSpreader))
- return false;
- TileABSpreader spreader = (TileABSpreader)tile;
- ItemStack lens = spreader.getStackInSlot(0);
- ItemStack heldItem = player.getCurrentEquippedItem();
- boolean isHeldItemLens = (heldItem != null && heldItem.getItem() instanceof vazkii.botania.api.mana.ILens);
- boolean wool = (heldItem != null && heldItem.getItem() == Item.getItemFromBlock(Blocks.wool));
- if (heldItem != null && heldItem.getItem() == ModItems.twigWand)
- return false;
- if (lens == null && isHeldItemLens) {
- if (!player.capabilities.isCreativeMode)
- player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
- spreader.setInventorySlotContents(0, heldItem.copy());
- spreader.markDirty();
- } else if (lens != null && !wool) {
- ItemStack add = lens.copy();
- if (!player.inventory.addItemStackToInventory(add))
- player.dropPlayerItemWithRandomChoice(add, false);
- spreader.setInventorySlotContents(0, null);
- spreader.markDirty();
- }
- if (wool && spreader.paddingColor == -1) {
- spreader.paddingColor = heldItem.getItemDamage();
- heldItem.stackSize--;
- if (heldItem.stackSize == 0)
- player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
- } else if (heldItem == null && spreader.paddingColor != -1 && lens == null) {
- ItemStack pad = new ItemStack(Blocks.wool, 1, spreader.paddingColor);
- if (!player.inventory.addItemStackToInventory(pad))
- player.dropPlayerItemWithRandomChoice(pad, false);
- spreader.paddingColor = -1;
- spreader.markDirty();
- }
- return true;
- }
-
- public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
- TileEntity tile = world.getTileEntity(x, y, z);
- if (!(tile instanceof TileABSpreader))
- return;
- TileABSpreader inv = (TileABSpreader)tile;
- if (inv != null) {
- for (int i = 0; i < inv.getSizeInventory() + 1; i++) {
- ItemStack stack = (i >= inv.getSizeInventory()) ? ((inv.paddingColor == -1) ? null : new ItemStack(Blocks.wool, 1, inv.paddingColor)) : inv.getStackInSlot(i);
- if(stack != null) {
- float spawnX = x + world.rand.nextFloat();
- float spawnY = y + world.rand.nextFloat();
- float spawnZ = z + world.rand.nextFloat();
- EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
- float mult = 0.05F;
- droppedItem.motionX = ((-0.5F + world.rand.nextFloat()) * mult);
- droppedItem.motionY = ((4.0F + world.rand.nextFloat()) * mult);
- droppedItem.motionZ = ((-0.5F + world.rand.nextFloat()) * mult);
- if (stack.hasTagCompound())
- droppedItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld((Entity)droppedItem);
- }
- }
- world.func_147453_f(x, y, z, par5);
- }
- super.breakBlock(world, x, y, z, par5, par6);
- }
-
- public IIcon getIcon(int par1, int par2) {
- return BlockListAB.blockLebethron.getIcon(par1, 0);
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public int getRenderType() {
+public class BlockABSpreader extends BlockContainer
+ implements IWandable, IWandHUD, IWireframeAABBProvider, ILexiconable {
+
+ public BlockABSpreader() {
+ super(Material.wood);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(7.0F);
+ this.setStepSound(soundTypeWood);
+ this.setBlockName("advancedSpreader");
+ }
+
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
+ int orientation = BlockPistonBase.determineOrientation(world, x, y, z, liv);
+ TileABSpreader spreader = (TileABSpreader) world.getTileEntity(x, y, z);
+ world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
+ switch (orientation) {
+ case 0:
+ spreader.rotationY = -90.0F;
+ case 1:
+ spreader.rotationY = 90.0F;
+ case 2:
+ spreader.rotationX = 270.0F;
+ case 3:
+ spreader.rotationX = 90.0F;
+ case 4:
+ return;
+ }
+ spreader.rotationX = 180.0F;
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
+ float par8, float par9) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (!(tile instanceof TileABSpreader)) return false;
+ TileABSpreader spreader = (TileABSpreader) tile;
+ ItemStack lens = spreader.getStackInSlot(0);
+ ItemStack heldItem = player.getCurrentEquippedItem();
+ boolean isHeldItemLens = (heldItem != null && heldItem.getItem() instanceof vazkii.botania.api.mana.ILens);
+ boolean wool = (heldItem != null && heldItem.getItem() == Item.getItemFromBlock(Blocks.wool));
+ if (heldItem != null && heldItem.getItem() == ModItems.twigWand) return false;
+ if (lens == null && isHeldItemLens) {
+ if (!player.capabilities.isCreativeMode)
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ spreader.setInventorySlotContents(0, heldItem.copy());
+ spreader.markDirty();
+ } else if (lens != null && !wool) {
+ ItemStack add = lens.copy();
+ if (!player.inventory.addItemStackToInventory(add)) player.dropPlayerItemWithRandomChoice(add, false);
+ spreader.setInventorySlotContents(0, null);
+ spreader.markDirty();
+ }
+ if (wool && spreader.paddingColor == -1) {
+ spreader.paddingColor = heldItem.getItemDamage();
+ heldItem.stackSize--;
+ if (heldItem.stackSize == 0) player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ } else if (heldItem == null && spreader.paddingColor != -1 && lens == null) {
+ ItemStack pad = new ItemStack(Blocks.wool, 1, spreader.paddingColor);
+ if (!player.inventory.addItemStackToInventory(pad)) player.dropPlayerItemWithRandomChoice(pad, false);
+ spreader.paddingColor = -1;
+ spreader.markDirty();
+ }
+ return true;
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (!(tile instanceof TileABSpreader)) return;
+ TileABSpreader inv = (TileABSpreader) tile;
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory() + 1; i++) {
+ ItemStack stack = (i >= inv.getSizeInventory())
+ ? ((inv.paddingColor == -1) ? null : new ItemStack(Blocks.wool, 1, inv.paddingColor))
+ : inv.getStackInSlot(i);
+ if (stack != null) {
+ float spawnX = x + world.rand.nextFloat();
+ float spawnY = y + world.rand.nextFloat();
+ float spawnZ = z + world.rand.nextFloat();
+ EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
+ float mult = 0.05F;
+ droppedItem.motionX = ((-0.5F + world.rand.nextFloat()) * mult);
+ droppedItem.motionY = ((4.0F + world.rand.nextFloat()) * mult);
+ droppedItem.motionZ = ((-0.5F + world.rand.nextFloat()) * mult);
+ if (stack.hasTagCompound())
+ droppedItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld((Entity) droppedItem);
+ }
+ }
+ world.func_147453_f(x, y, z, par5);
+ }
+ super.breakBlock(world, x, y, z, par5, par6);
+ }
+
+ public IIcon getIcon(int par1, int par2) {
+ return BlockListAB.blockLebethron.getIcon(par1, 0);
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public int getRenderType() {
return BlockListAB.blockABSpreaderRI;
}
-
- public int getLightValue(IBlockAccess world, int x, int y, int z) {
- return 12;
- }
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileABSpreader();
- }
-
- public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
- ((TileABSpreader)world.getTileEntity(x, y, z)).onWanded(player, stack);
- return true;
- }
-
- public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z) {
- float f = 0.0625F;
- return AxisAlignedBB.getBoundingBox((x + f), (y + f), (z + f), ((x + 1) - f), ((y + 1) - f), ((z + 1) - f));
- }
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ return 12;
+ }
- public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
- ((TileABSpreader)world.getTileEntity(x, y, z)).renderHUD(mc, res);
- }
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileABSpreader();
+ }
- public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
- return RecipeListAB.lebethronSpreader;
- }
-}
\ No newline at end of file
+ public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
+ ((TileABSpreader) world.getTileEntity(x, y, z)).onWanded(player, stack);
+ return true;
+ }
+
+ public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z) {
+ float f = 0.0625F;
+ return AxisAlignedBB.getBoundingBox((x + f), (y + f), (z + f), ((x + 1) - f), ((y + 1) - f), ((z + 1) - f));
+ }
+
+ public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
+ ((TileABSpreader) world.getTileEntity(x, y, z)).renderHUD(mc, res);
+ }
+
+ public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
+ return RecipeListAB.lebethronSpreader;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockABStorage.java b/src/main/java/ab/common/block/BlockABStorage.java
index f9caacf..a401c64 100644
--- a/src/main/java/ab/common/block/BlockABStorage.java
+++ b/src/main/java/ab/common/block/BlockABStorage.java
@@ -2,9 +2,6 @@ package ab.common.block;
import java.util.List;
-import ab.AdvancedBotany;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -14,41 +11,44 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
+import ab.AdvancedBotany;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
public class BlockABStorage extends Block {
-private static IIcon[] icon = new IIcon[1];
-
- public BlockABStorage() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(3.0F);
- this.setResistance(10.0F);
- this.setStepSound(soundTypeMetal);
- this.setBlockName("abStorage");
- }
-
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
- for(int i = 0; i < icon.length; i++) {
- list.add(new ItemStack(par1, 1, i));
- }
- }
-
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister ir) {
- for (int i = 0; i < icon.length; i++)
- icon[i] = ir.registerIcon("ab:abStorage_" + i);
- }
-
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int side, int meta) {
- return this.icon[meta];
- }
-
- public int damageDropped(int par1) {
- return par1;
- }
-
- public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
- return true;
- }
+ private static IIcon[] icon = new IIcon[1];
+
+ public BlockABStorage() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(3.0F);
+ this.setResistance(10.0F);
+ this.setStepSound(soundTypeMetal);
+ this.setBlockName("abStorage");
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
+ for (int i = 0; i < icon.length; i++) {
+ list.add(new ItemStack(par1, 1, i));
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister ir) {
+ for (int i = 0; i < icon.length; i++) icon[i] = ir.registerIcon("ab:abStorage_" + i);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ return this.icon[meta];
+ }
+
+ public int damageDropped(int par1) {
+ return par1;
+ }
+
+ public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
+ return true;
+ }
}
diff --git a/src/main/java/ab/common/block/BlockAntigravitation.java b/src/main/java/ab/common/block/BlockAntigravitation.java
index ae33bab..3b6650f 100644
--- a/src/main/java/ab/common/block/BlockAntigravitation.java
+++ b/src/main/java/ab/common/block/BlockAntigravitation.java
@@ -2,61 +2,74 @@ package ab.common.block;
import java.util.Random;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
import vazkii.botania.common.Botania;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class BlockAntigravitation extends Block {
- public BlockAntigravitation() {
- super(Material.ground);
- this.setHardness(-1.0f);
- this.setTickRandomly(true);
- this.useNeighborBrightness = false;
- }
- public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
+ public BlockAntigravitation() {
+ super(Material.ground);
+ this.setHardness(-1.0f);
+ this.setTickRandomly(true);
+ this.useNeighborBrightness = false;
+ }
+
+ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
return true;
}
-
+
public int getRenderType() {
return -1;
}
-
+
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
-
+
public boolean renderAsNormalBlock() {
return false;
}
-
+
public boolean isOpaqueCube() {
return false;
}
-
+
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) {
return false;
}
-
- public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {}
+
+ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_,
+ int p_149690_5_, float p_149690_6_, int p_149690_7_) {}
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
- if(world.isAirBlock(x, y + 1, z))
- world.setBlockToAir(x, y, z);
+ if (world.isAirBlock(x, y + 1, z)) world.setBlockToAir(x, y, z);
}
-
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, int x, int y, int z, Random random) {
- if(random.nextBoolean()) {
- float r = random.nextInt(128) / 255.0f;
- float g = (random.nextInt(128) + 70) / 255.0f;
- float b = 200.0f / 255.0f;
- Botania.proxy.wispFX(world, x + 0.1f + Math.random() * 0.8f, y - 0.18f + 1.0f, z + 0.1 + Math.random() * 0.8, r, g, b, 0.24F * (float)(Math.random() - 0.5D), 0.0f, (float)(0.001f + Math.random() * 0.01f), 0.0f);
- }
- }
-}
\ No newline at end of file
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random random) {
+ if (random.nextBoolean()) {
+ float r = random.nextInt(128) / 255.0f;
+ float g = (random.nextInt(128) + 70) / 255.0f;
+ float b = 200.0f / 255.0f;
+ Botania.proxy.wispFX(
+ world,
+ x + 0.1f + Math.random() * 0.8f,
+ y - 0.18f + 1.0f,
+ z + 0.1 + Math.random() * 0.8,
+ r,
+ g,
+ b,
+ 0.24F * (float) (Math.random() - 0.5D),
+ 0.0f,
+ (float) (0.001f + Math.random() * 0.01f),
+ 0.0f);
+ }
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockBoardFate.java b/src/main/java/ab/common/block/BlockBoardFate.java
index 1ecc1cf..f3f1645 100644
--- a/src/main/java/ab/common/block/BlockBoardFate.java
+++ b/src/main/java/ab/common/block/BlockBoardFate.java
@@ -2,12 +2,6 @@ package ab.common.block;
import java.util.List;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileBoardFate;
-import ab.common.block.tile.TileGameBoard;
-import ab.common.block.tile.TileInventory;
-import ab.common.lib.register.AchievementRegister;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -23,143 +17,142 @@ import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
-import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.achievement.IPickupAchievement;
-import vazkii.botania.common.core.handler.ConfigHandler;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileBoardFate;
+import ab.common.block.tile.TileGameBoard;
+import ab.common.block.tile.TileInventory;
+import ab.common.lib.register.AchievementRegister;
+import ab.common.lib.register.RecipeListAB;
public class BlockBoardFate extends BlockContainer implements IPickupAchievement, ILexiconable {
-
- protected IIcon[] iconsFate;
- protected IIcon[] iconsBoard;
- public BlockBoardFate() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1875F, 1.0F);
- this.setHardness(3.0F);
- this.setResistance(10.0F);
- this.setStepSound(soundTypeMetal);
- this.setBlockName("boardFate");
- }
-
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
- for(int i = 0; i < 2; i++)
- list.add(new ItemStack(par1, 1, i));
- }
-
- public void registerBlockIcons(IIconRegister ir) {
- this.iconsFate = new IIcon[3];
- this.iconsBoard = new IIcon[3];
- for(int i = 0; i < iconsFate.length; i++)
- this.iconsFate[i] = ir.registerIcon("ab:boardFate_" + i);
- for(int i = 0; i < iconsBoard.length; i++)
- this.iconsBoard[i] = ir.registerIcon("ab:gameBoard_" + i);
- }
-
- public IIcon getIcon(int side, int meta) {
- if(meta == 0)
- return this.iconsBoard[Math.min(2, side)];
- else
- return this.iconsFate[Math.min(2, side)];
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public int damageDropped(int par1) {
- return par1;
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
- int meta = world.getBlockMetadata(x, y, z);
- if(meta == 0) {
- TileGameBoard tile = (TileGameBoard)world.getTileEntity(x, y, z);
- if(player.isSneaking() && !tile.hasGame()) {
- tile.isSingleGame = !tile.isSingleGame;
- if(!world.isRemote)
- world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 0.8F);
- return true;
- }
- if(!tile.hasGame())
- tile.setPlayer(player);
- else if(!tile.isSingleGame && tile.playersName[1].isEmpty() && !tile.playersName[0].equals(player.getCommandSenderName()))
- tile.setPlayer(player);
- else {
- return tile.dropDice(player);
- }
- return false;
- } else {
- if(!player.isSneaking()) {
- ItemStack heldItem = player.getCurrentEquippedItem();
- TileBoardFate tile = (TileBoardFate)world.getTileEntity(x, y, z);
- if(heldItem != null && tile != null && tile.isDice(heldItem)) {
- for(int i = 0; i < tile.getSizeInventory(); i++) {
- ItemStack slotStack = tile.getStackInSlot(i);
- if(slotStack != null)
- continue;
- heldItem.stackSize--;
- if(heldItem.stackSize == 0)
- player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
- if(!world.isRemote) {
- ItemStack copy = heldItem.copy();
- copy.stackSize = 1;
- tile.setInventorySlotContents(i, copy);
- tile.slotChance[i] = (byte)(world.rand.nextInt(6) + 1);
- tile.requestUpdate = true;
- world.playSoundEffect(x, y, z, "ab:boardCube", 0.6F, 1.0F);
- }
- return true;
- }
- }
- return false;
- } else {
- TileBoardFate tile = (TileBoardFate)world.getTileEntity(x, y, z);
- return tile.spawnRelic(player);
- }
- }
- }
-
- public TileEntity createNewTileEntity(World world, int meta) {
- return meta == 0 ? new TileGameBoard() : new TileBoardFate();
- }
-
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote && meta == 1) {
- TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
- if (inv != null) {
- for (int i = 0; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if (stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
+ protected IIcon[] iconsFate;
+ protected IIcon[] iconsBoard;
- public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) {
- return stack.getItemDamage() == 1 ? AchievementRegister.fateBoard : null;
- }
+ public BlockBoardFate() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1875F, 1.0F);
+ this.setHardness(3.0F);
+ this.setResistance(10.0F);
+ this.setStepSound(soundTypeMetal);
+ this.setBlockName("boardFate");
+ }
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack stack) {
- return world.getBlockMetadata(x, y, z) == 0 ? RecipeListAB.gameBoard : RecipeListAB.fateBoard;
- }
-}
\ No newline at end of file
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
+ for (int i = 0; i < 2; i++) list.add(new ItemStack(par1, 1, i));
+ }
+
+ public void registerBlockIcons(IIconRegister ir) {
+ this.iconsFate = new IIcon[3];
+ this.iconsBoard = new IIcon[3];
+ for (int i = 0; i < iconsFate.length; i++) this.iconsFate[i] = ir.registerIcon("ab:boardFate_" + i);
+ for (int i = 0; i < iconsBoard.length; i++) this.iconsBoard[i] = ir.registerIcon("ab:gameBoard_" + i);
+ }
+
+ public IIcon getIcon(int side, int meta) {
+ if (meta == 0) return this.iconsBoard[Math.min(2, side)];
+ else return this.iconsFate[Math.min(2, side)];
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public int damageDropped(int par1) {
+ return par1;
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7,
+ float par8, float par9) {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (meta == 0) {
+ TileGameBoard tile = (TileGameBoard) world.getTileEntity(x, y, z);
+ if (player.isSneaking() && !tile.hasGame()) {
+ tile.isSingleGame = !tile.isSingleGame;
+ if (!world.isRemote) world.playSoundAtEntity((Entity) player, "botania:ding", 0.11F, 0.8F);
+ return true;
+ }
+ if (!tile.hasGame()) tile.setPlayer(player);
+ else if (!tile.isSingleGame && tile.playersName[1].isEmpty()
+ && !tile.playersName[0].equals(player.getCommandSenderName()))
+ tile.setPlayer(player);
+ else {
+ return tile.dropDice(player);
+ }
+ return false;
+ } else {
+ if (!player.isSneaking()) {
+ ItemStack heldItem = player.getCurrentEquippedItem();
+ TileBoardFate tile = (TileBoardFate) world.getTileEntity(x, y, z);
+ if (heldItem != null && tile != null && tile.isDice(heldItem)) {
+ for (int i = 0; i < tile.getSizeInventory(); i++) {
+ ItemStack slotStack = tile.getStackInSlot(i);
+ if (slotStack != null) continue;
+ heldItem.stackSize--;
+ if (heldItem.stackSize == 0)
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ if (!world.isRemote) {
+ ItemStack copy = heldItem.copy();
+ copy.stackSize = 1;
+ tile.setInventorySlotContents(i, copy);
+ tile.slotChance[i] = (byte) (world.rand.nextInt(6) + 1);
+ tile.requestUpdate = true;
+ world.playSoundEffect(x, y, z, "ab:boardCube", 0.6F, 1.0F);
+ }
+ return true;
+ }
+ }
+ return false;
+ } else {
+ TileBoardFate tile = (TileBoardFate) world.getTileEntity(x, y, z);
+ return tile.spawnRelic(player);
+ }
+ }
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return meta == 0 ? new TileGameBoard() : new TileBoardFate();
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote && meta == 1) {
+ TileInventory inv = (TileInventory) world.getTileEntity(x, y, z);
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) {
+ return stack.getItemDamage() == 1 ? AchievementRegister.fateBoard : null;
+ }
+
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack stack) {
+ return world.getBlockMetadata(x, y, z) == 0 ? RecipeListAB.gameBoard : RecipeListAB.fateBoard;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockEngineerHopper.java b/src/main/java/ab/common/block/BlockEngineerHopper.java
index f633e91..c943e93 100644
--- a/src/main/java/ab/common/block/BlockEngineerHopper.java
+++ b/src/main/java/ab/common/block/BlockEngineerHopper.java
@@ -1,110 +1,101 @@
package ab.common.block;
-import java.util.List;
-
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileEngineerHopper;
-import ab.common.block.tile.TileInventory;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
-import net.minecraft.block.BlockHopper;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileEngineerHopper;
+import ab.common.block.tile.TileInventory;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockEngineerHopper extends BlockContainer implements IWandable, IWandHUD, ILexiconable {
-
- private static IIcon[] icons = new IIcon[3];
- public BlockEngineerHopper() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setBlockName("engineerHopper");
- float offset = 0.125F;
- this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
- }
-
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.engineerHopper;
- }
-
- public IIcon getIcon(int par1, int par2) {
- return ModBlocks.blazeBlock.getIcon(0, 0);
- }
+ private static IIcon[] icons = new IIcon[3];
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote) {
- TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
- if (inv != null) {
- for (int i = 0; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if (stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
-
- public TileEntity createNewTileEntity(World world, int meta) {
+ public BlockEngineerHopper() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setBlockName("engineerHopper");
+ float offset = 0.125F;
+ this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
+ }
+
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
+ return RecipeListAB.engineerHopper;
+ }
+
+ public IIcon getIcon(int par1, int par2) {
+ return ModBlocks.blazeBlock.getIcon(0, 0);
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote) {
+ TileInventory inv = (TileInventory) world.getTileEntity(x, y, z);
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
return new TileEngineerHopper();
}
-
- public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
- ((TileEngineerHopper)world.getTileEntity(x, y, z)).renderHUD(mc, res);
- }
-
- public int getRenderType() {
- return BlockListAB.blockEngineerHopperRI;
- }
-
- public boolean isOpaqueCube() {
+
+ public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
+ ((TileEngineerHopper) world.getTileEntity(x, y, z)).renderHUD(mc, res);
+ }
+
+ public int getRenderType() {
+ return BlockListAB.blockEngineerHopperRI;
+ }
+
+ public boolean isOpaqueCube() {
return false;
}
-
- public boolean renderAsNormalBlock() {
+
+ public boolean renderAsNormalBlock() {
return false;
}
-
- public boolean onUsedByWand(EntityPlayer player, ItemStack wand, World world, int x, int y, int z, int meta) {
- if(!player.isSneaking()) {
- TileEngineerHopper tile = (TileEngineerHopper)world.getTileEntity(x, y, z);
- tile.changeBindType();
- if(!world.isRemote)
- world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
- }
- return true;
- }
-}
\ No newline at end of file
+
+ public boolean onUsedByWand(EntityPlayer player, ItemStack wand, World world, int x, int y, int z, int meta) {
+ if (!player.isSneaking()) {
+ TileEngineerHopper tile = (TileEngineerHopper) world.getTileEntity(x, y, z);
+ tile.changeBindType();
+ if (!world.isRemote) world.playSoundAtEntity((Entity) player, "botania:ding", 0.11F, 1.0F);
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockFreyrLiana.java b/src/main/java/ab/common/block/BlockFreyrLiana.java
index fac4cfa..e349907 100644
--- a/src/main/java/ab/common/block/BlockFreyrLiana.java
+++ b/src/main/java/ab/common/block/BlockFreyrLiana.java
@@ -2,9 +2,6 @@ package ab.common.block;
import java.util.Random;
-import ab.common.core.CommonHelper;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
@@ -15,66 +12,72 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
+import ab.common.core.CommonHelper;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockFreyrLiana extends BlockBush implements ILexiconable {
- public BlockFreyrLiana() {
- super(Material.plants);
- this.setBlockName("BlockFreyrLiana");
- this.setStepSound(soundTypeGrass);
- this.setBlockTextureName("ab:freyrLiana");
- }
-
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.freyrSlingshot;
- }
+ public BlockFreyrLiana() {
+ super(Material.plants);
+ this.setBlockName("BlockFreyrLiana");
+ this.setStepSound(soundTypeGrass);
+ this.setBlockTextureName("ab:freyrLiana");
+ }
- public boolean canPlaceBlockAt(World world, int x, int y, int z) {
- return world.getBlock(x, y + 1, z).getMaterial() == Material.leaves
- || world.getBlock(x, y + 1, z).getMaterial() == Material.wood
- || world.getBlock(x, y + 1, z).getMaterial() == Material.ground
- || world.getBlock(x, y + 1, z).getMaterial() == Material.rock
- || world.getBlock(x, y + 1, z).getMaterial() == Material.sand
- || world.getBlock(x, y + 1, z).getMaterial() == Material.grass
- || world.getBlock(x, y + 1, z) instanceof BlockFreyrLiana;
- }
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
+ return RecipeListAB.freyrSlingshot;
+ }
- public void updateTick(World world, int x, int y, int z, Random rand) {
- this.checkAndDropBlock(world, x, y, z);
- world.markBlockForUpdate(x, y, z);
- for(int i1 = 1; i1 < 5; i1++) {
- Block block = world.getBlock(x, y - i1, z);
- if(block instanceof IGrowable) {
- CommonHelper.fertilizer(world, block, x, y - i1, z, 18, null);
- if(world.getBlock(x, y - i1 - 1, z) == BlockListAB.blockTerraFarmland)
- world.getBlock(x, y - i1 - 1, z).updateTick(world, x, y - i1 - 1, z, rand);
- break;
- }
- }
- }
+ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
+ return world.getBlock(x, y + 1, z).getMaterial() == Material.leaves
+ || world.getBlock(x, y + 1, z).getMaterial() == Material.wood
+ || world.getBlock(x, y + 1, z).getMaterial() == Material.ground
+ || world.getBlock(x, y + 1, z).getMaterial() == Material.rock
+ || world.getBlock(x, y + 1, z).getMaterial() == Material.sand
+ || world.getBlock(x, y + 1, z).getMaterial() == Material.grass
+ || world.getBlock(x, y + 1, z) instanceof BlockFreyrLiana;
+ }
- protected void checkAndDropBlock(World world, int x, int y, int z) {
- if (!this.canBlockStay(world, x, y, z)) {
- this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
- world.setBlock(x, y, z, getBlockById(0), 0, 3);
- }
- }
+ public void updateTick(World world, int x, int y, int z, Random rand) {
+ this.checkAndDropBlock(world, x, y, z);
+ world.markBlockForUpdate(x, y, z);
+ for (int i1 = 1; i1 < 5; i1++) {
+ Block block = world.getBlock(x, y - i1, z);
+ if (block instanceof IGrowable) {
+ CommonHelper.fertilizer(world, block, x, y - i1, z, 18, null);
+ if (world.getBlock(x, y - i1 - 1, z) == BlockListAB.blockTerraFarmland)
+ world.getBlock(x, y - i1 - 1, z).updateTick(world, x, y - i1 - 1, z, rand);
+ break;
+ }
+ }
+ }
- public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
- return null;
- }
+ protected void checkAndDropBlock(World world, int x, int y, int z) {
+ if (!this.canBlockStay(world, x, y, z)) {
+ this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
+ world.setBlock(x, y, z, getBlockById(0), 0, 3);
+ }
+ }
- public boolean canBlockStay(World world, int x, int y, int z) {
- return this.canPlaceBlockAt(world, x, y, z);
- }
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
+ return null;
+ }
- public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
- return 100;
- }
+ public boolean canBlockStay(World world, int x, int y, int z) {
+ return this.canPlaceBlockAt(world, x, y, z);
+ }
- public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
- return 60;
- }
-}
\ No newline at end of file
+ public int getFlammability(final IBlockAccess world, final int x, final int y, final int z,
+ final ForgeDirection face) {
+ return 100;
+ }
+
+ public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z,
+ final ForgeDirection face) {
+ return 60;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockLebethronWood.java b/src/main/java/ab/common/block/BlockLebethronWood.java
index 30946ba..1566eb3 100644
--- a/src/main/java/ab/common/block/BlockLebethronWood.java
+++ b/src/main/java/ab/common/block/BlockLebethronWood.java
@@ -2,11 +2,6 @@ package ab.common.block;
import java.util.List;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileLebethronCore;
-import ab.common.lib.register.RecipeListAB;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
@@ -14,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -23,113 +17,117 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
-import vazkii.botania.common.item.ModItems;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileLebethronCore;
+import ab.common.lib.register.RecipeListAB;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class BlockLebethronWood extends Block implements ILexiconable, ITileEntityProvider {
-
- private static IIcon[] icon = new IIcon[5];
- public static IIcon iconPortal;
-
- public BlockLebethronWood() {
- super(Material.wood);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(6.0F);
- this.setStepSound(soundTypeWood);
- this.setBlockName("lebethronWood");
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
- int meta = world.getBlockMetadata(x, y, z);
- if(meta == 4) {
- TileLebethronCore core = (TileLebethronCore)world.getTileEntity(x, y, z);
- ItemStack heldItem = player.getCurrentEquippedItem();
- if(heldItem == null)
- return false;
- Block block = Block.getBlockFromItem(heldItem.getItem());
- if(block.getMaterial() == Material.leaves && !heldItem.hasTagCompound()) {
- if(!world.isRemote) {
- core.updateStructure();
- if(core.getValidTree()) {
- if(core.setBlock(player, block, heldItem.getItemDamage())) {
- heldItem.stackSize--;
- if(heldItem.stackSize == 0)
- player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, x, y, z);
- }
- }
- }
- return true;
- }
- }
- return false;
- }
-
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote && meta == 4) {
- TileLebethronCore tile = (TileLebethronCore)world.getTileEntity(x, y, z);
- if(tile != null) {
- ItemStack stack = new ItemStack(tile.getBlock(), 1, tile.getMeta());
- if (stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
-
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
- for(int i = 0; i < icon.length; i++) {
- list.add(new ItemStack(par1, 1, i));
- }
- }
-
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister ir) {
- for (int i = 0; i < icon.length; i++)
- icon[i] = ir.registerIcon("ab:lebethronWood_" + i);
- iconPortal = ir.registerIcon("ab:portalAlphirine");
- }
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int side, int meta) {
- return this.icon[meta];
- }
-
- public int damageDropped(int par1) {
- return par1;
- }
-
- public int getLightValue(IBlockAccess world, int x, int y, int z) {
- return (world.getBlockMetadata(x, y, z) == 3) ? 12 : 0;
- }
-
- public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
- return (world.getBlockMetadata(x, y, z) == 0);
- }
-
- public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
- int meta = world.getBlockMetadata(x, y, z);
- return new ItemStack(this, 1, meta);
- }
-
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.lebethronWood;
- }
+ private static IIcon[] icon = new IIcon[5];
+ public static IIcon iconPortal;
- public TileEntity createNewTileEntity(World world, int meta) {
- return meta == 4 ? new TileLebethronCore() : null;
- }
-}
\ No newline at end of file
+ public BlockLebethronWood() {
+ super(Material.wood);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(6.0F);
+ this.setStepSound(soundTypeWood);
+ this.setBlockName("lebethronWood");
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
+ float par8, float par9) {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (meta == 4) {
+ TileLebethronCore core = (TileLebethronCore) world.getTileEntity(x, y, z);
+ ItemStack heldItem = player.getCurrentEquippedItem();
+ if (heldItem == null) return false;
+ Block block = Block.getBlockFromItem(heldItem.getItem());
+ if (block.getMaterial() == Material.leaves && !heldItem.hasTagCompound()) {
+ if (!world.isRemote) {
+ core.updateStructure();
+ if (core.getValidTree()) {
+ if (core.setBlock(player, block, heldItem.getItemDamage())) {
+ heldItem.stackSize--;
+ if (heldItem.stackSize == 0)
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, x, y, z);
+ }
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote && meta == 4) {
+ TileLebethronCore tile = (TileLebethronCore) world.getTileEntity(x, y, z);
+ if (tile != null) {
+ ItemStack stack = new ItemStack(tile.getBlock(), 1, tile.getMeta());
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
+ for (int i = 0; i < icon.length; i++) {
+ list.add(new ItemStack(par1, 1, i));
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister ir) {
+ for (int i = 0; i < icon.length; i++) icon[i] = ir.registerIcon("ab:lebethronWood_" + i);
+ iconPortal = ir.registerIcon("ab:portalAlphirine");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ return this.icon[meta];
+ }
+
+ public int damageDropped(int par1) {
+ return par1;
+ }
+
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ return (world.getBlockMetadata(x, y, z) == 3) ? 12 : 0;
+ }
+
+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
+ return (world.getBlockMetadata(x, y, z) == 0);
+ }
+
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
+ int meta = world.getBlockMetadata(x, y, z);
+ return new ItemStack(this, 1, meta);
+ }
+
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
+ return RecipeListAB.lebethronWood;
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return meta == 4 ? new TileLebethronCore() : null;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockLuminousFreyrLiana.java b/src/main/java/ab/common/block/BlockLuminousFreyrLiana.java
index 846c9e0..4f27cec 100644
--- a/src/main/java/ab/common/block/BlockLuminousFreyrLiana.java
+++ b/src/main/java/ab/common/block/BlockLuminousFreyrLiana.java
@@ -2,48 +2,57 @@ package ab.common.block;
import java.util.Random;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+
import vazkii.botania.common.Botania;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class BlockLuminousFreyrLiana extends BlockFreyrLiana {
- public BlockLuminousFreyrLiana() {
- this.setBlockName("BlockLuminousFreyrLiana");
- this.setBlockTextureName("ab:freyrLuminousLiana");
- this.setTickRandomly(true);
- }
+ public BlockLuminousFreyrLiana() {
+ this.setBlockName("BlockLuminousFreyrLiana");
+ this.setBlockTextureName("ab:freyrLuminousLiana");
+ this.setTickRandomly(true);
+ }
- public int getLightValue() {
- return 11;
- }
+ public int getLightValue() {
+ return 11;
+ }
- public void updateTick(World world, int x, int y, int z, Random rand) {
- super.updateTick(world, x, y, z, rand);
- if(rand.nextInt(11) == 0)
- world.setBlockMetadataWithNotify(x, y, z, 1, 3);
- }
+ public void updateTick(World world, int x, int y, int z, Random rand) {
+ super.updateTick(world, x, y, z, rand);
+ if (rand.nextInt(11) == 0) world.setBlockMetadataWithNotify(x, y, z, 1, 3);
+ }
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
- if(world.getBlockMetadata(x, y, z) == 1)
- if(rand.nextInt(3) == 0)
- Botania.proxy.wispFX(world, x + 0.1 + Math.random() * 0.8, y + Math.random() * 0.5, z + 0.1 + Math.random() * 0.8, 249 / 255f, 230 / 255f, 3 / 255f, 0.14f, -0.04f, 2);
- }
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
+ if (world.getBlockMetadata(x, y, z) == 1) if (rand.nextInt(3) == 0) Botania.proxy.wispFX(
+ world,
+ x + 0.1 + Math.random() * 0.8,
+ y + Math.random() * 0.5,
+ z + 0.1 + Math.random() * 0.8,
+ 249 / 255f,
+ 230 / 255f,
+ 3 / 255f,
+ 0.14f,
+ -0.04f,
+ 2);
+ }
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
- Random rand = new Random();
- if(world.getBlockMetadata(x, y, z) == 1) {
- if (!world.isRemote)
- (new EntityItem(world, x + 0.5, y, z + 0.5)).entityDropItem(new ItemStack(Items.gold_nugget, 1 + rand.nextInt(3)), 0.75f);
- world.setBlockMetadataWithNotify(x, y, z, 0, 3);
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
+ float hitY, float hitZ) {
+ Random rand = new Random();
+ if (world.getBlockMetadata(x, y, z) == 1) {
+ if (!world.isRemote) (new EntityItem(world, x + 0.5, y, z + 0.5))
+ .entityDropItem(new ItemStack(Items.gold_nugget, 1 + rand.nextInt(3)), 0.75f);
+ world.setBlockMetadataWithNotify(x, y, z, 0, 3);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockMagicCraftCrate.java b/src/main/java/ab/common/block/BlockMagicCraftCrate.java
index 9e8d9dd..1ceee93 100644
--- a/src/main/java/ab/common/block/BlockMagicCraftCrate.java
+++ b/src/main/java/ab/common/block/BlockMagicCraftCrate.java
@@ -1,12 +1,5 @@
package ab.common.block;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL12;
-
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileMagicCraftCrate;
-import ab.common.item.ItemCraftingPattern;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -25,6 +18,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.client.lib.UtilsFX;
@@ -35,241 +32,280 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.BlockModContainer;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileMagicCraftCrate;
+import ab.common.item.ItemCraftingPattern;
+import ab.common.lib.register.RecipeListAB;
public class BlockMagicCraftCrate extends BlockModContainer implements IWandable, IWandHUD, ILexiconable {
- public static final Aspect[] primals = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.FIRE, Aspect.ORDER, Aspect.ENTROPY };
+ public static final Aspect[] primals = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.FIRE,
+ Aspect.ORDER, Aspect.ENTROPY };
- IIcon iconSide;
- IIcon iconBottom;
- IIcon iconTop;
- public IIcon nothing;
+ IIcon iconSide;
+ IIcon iconBottom;
+ IIcon iconTop;
+ public IIcon nothing;
- public BlockMagicCraftCrate() {
- super(Material.wood);
- this.setHardness(2.0F);
- this.setStepSound(soundTypeWood);
- this.setBlockName("magicThaumCrafter");
- this.setCreativeTab(AdvancedBotany.tabAB);
- }
-
- public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
- return RecipeListAB.thaumAutoCraft;
- }
+ public BlockMagicCraftCrate() {
+ super(Material.wood);
+ this.setHardness(2.0F);
+ this.setStepSound(soundTypeWood);
+ this.setBlockName("magicThaumCrafter");
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ }
- public void registerBlockIcons(IIconRegister ir) {
- iconSide = ir.registerIcon("ab:magicCrateSide");
- iconTop = ir.registerIcon("ab:magicCrateTop");
- iconBottom = ir.registerIcon("ab:magicCrateBottom");
- nothing = ir.registerIcon("ab:nothing");
- }
+ public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
+ return RecipeListAB.thaumAutoCraft;
+ }
- public boolean hasComparatorInputOverride() {
- return true;
- }
+ public void registerBlockIcons(IIconRegister ir) {
+ iconSide = ir.registerIcon("ab:magicCrateSide");
+ iconTop = ir.registerIcon("ab:magicCrateTop");
+ iconBottom = ir.registerIcon("ab:magicCrateBottom");
+ nothing = ir.registerIcon("ab:nothing");
+ }
- public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
- TileMagicCraftCrate crate = (TileMagicCraftCrate) par1World.getTileEntity(par2, par3, par4);
- return crate.getSignal();
- }
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
- TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
- ItemStack stack = player.getHeldItem();
- for(int i = 10; i < 12; i++) {
- ItemStack item = crate.getStackInSlot(i);
- if(player.isSneaking()) {
- if(item == null)
- continue;
- if(!world.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + vec3.yCoord + 0.5f, player.posZ + vec3.zCoord, item.copy());
- world.spawnEntityInWorld(entityitem);
- }
- crate.setInventorySlotContents(i, null);
- world.playSoundEffect((double) x, (double) y, (double) z, "random.pop", 0.2f, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
- crate.markDirty();
- return true;
- } else if(stack != null && crate.isItemValidForSlot(i, stack)) {
- if(item != null) {
- if(!world.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + vec3.yCoord + 0.5f, player.posZ + vec3.zCoord, item.copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- crate.setInventorySlotContents(i, stack.copy());
- if(i == 11)
- crate.setPlayer(player);
- stack.splitStack(1);
- world.playSoundEffect((double) x, (double) y, (double) z, "random.pop", 0.2f, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
- crate.markDirty();
- return true;
- }
- }
- if(stack != null && stack.getItem() instanceof ItemCraftingPattern && stack.getItemDamage() != 0) {
- boolean[][] pattern = ((ItemCraftingPattern) stack.getItem()).getPattern(stack.getItemDamage());
- crate.setPattern(pattern);
- stack.splitStack(1);
- return true;
- }
- return false;
- }
+ public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
+ TileMagicCraftCrate crate = (TileMagicCraftCrate) par1World.getTileEntity(par2, par3, par4);
+ return crate.getSignal();
+ }
- public IIcon getIcon(int side, int meta) {
- switch (side) {
- case 0:
- return iconBottom;
- case 1:
- return iconTop;
- default:
- return iconSide;
- }
- }
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
+ float hitY, float hitZ) {
+ TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
+ ItemStack stack = player.getHeldItem();
+ for (int i = 10; i < 12; i++) {
+ ItemStack item = crate.getStackInSlot(i);
+ if (player.isSneaking()) {
+ if (item == null) continue;
+ if (!world.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ world,
+ player.posX + vec3.xCoord,
+ player.posY + vec3.yCoord + 0.5f,
+ player.posZ + vec3.zCoord,
+ item.copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ crate.setInventorySlotContents(i, null);
+ world.playSoundEffect(
+ (double) x,
+ (double) y,
+ (double) z,
+ "random.pop",
+ 0.2f,
+ ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
+ crate.markDirty();
+ return true;
+ } else if (stack != null && crate.isItemValidForSlot(i, stack)) {
+ if (item != null) {
+ if (!world.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ world,
+ player.posX + vec3.xCoord,
+ player.posY + vec3.yCoord + 0.5f,
+ player.posZ + vec3.zCoord,
+ item.copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ crate.setInventorySlotContents(i, stack.copy());
+ if (i == 11) crate.setPlayer(player);
+ stack.splitStack(1);
+ world.playSoundEffect(
+ (double) x,
+ (double) y,
+ (double) z,
+ "random.pop",
+ 0.2f,
+ ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
+ crate.markDirty();
+ return true;
+ }
+ }
+ if (stack != null && stack.getItem() instanceof ItemCraftingPattern && stack.getItemDamage() != 0) {
+ boolean[][] pattern = ((ItemCraftingPattern) stack.getItem()).getPattern(stack.getItemDamage());
+ crate.setPattern(pattern);
+ stack.splitStack(1);
+ return true;
+ }
+ return false;
+ }
- public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
- switch (side) {
- case 0:
- return iconBottom;
- case 1:
- return iconTop;
- default:
- return iconSide;
- }
- }
+ public IIcon getIcon(int side, int meta) {
+ switch (side) {
+ case 0:
+ return iconBottom;
+ case 1:
+ return iconTop;
+ default:
+ return iconSide;
+ }
+ }
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileMagicCraftCrate();
- }
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
+ switch (side) {
+ case 0:
+ return iconBottom;
+ case 1:
+ return iconTop;
+ default:
+ return iconSide;
+ }
+ }
- public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
- TileEntity tile = world.getTileEntity(x, y, z);
- if(tile instanceof TileMagicCraftCrate) {
- TileMagicCraftCrate craft = (TileMagicCraftCrate) tile;
- int width = 52;
- int height = 52;
- int xc = res.getScaledWidth() / 2 + 20;
- int yc = res.getScaledHeight() / 2 - height / 2;
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileMagicCraftCrate();
+ }
- Gui.drawRect(xc - 6 - 3, yc - 6, xc + width + 3, yc + height + 6, 0x2294178a);
- Gui.drawRect(xc - 4 - 3, yc - 4, xc + width + 1, yc + height + 4, 0x2294178a);
+ public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (tile instanceof TileMagicCraftCrate) {
+ TileMagicCraftCrate craft = (TileMagicCraftCrate) tile;
+ int width = 52;
+ int height = 52;
+ int xc = res.getScaledWidth() / 2 + 20;
+ int yc = res.getScaledHeight() / 2 - height / 2;
- Gui.drawRect(xc + 60 - 3, yc + 18 - 3, xc + 60 + 16 + 3, yc + 18 + 16 + 3, 0x2294178a);
- Gui.drawRect(xc + 60 - 2, yc + 18 - 2, xc + 60 + 16 + 2, yc + 18 + 16 + 2, 0x2294178a);
- Gui.drawRect(xc + 60, yc + 18, xc + 60 + 16, yc + 18 + 16, 0x22efd3f4);
+ Gui.drawRect(xc - 6 - 3, yc - 6, xc + width + 3, yc + height + 6, 0x2294178a);
+ Gui.drawRect(xc - 4 - 3, yc - 4, xc + width + 1, yc + height + 4, 0x2294178a);
- AspectList waitingAspects = null;
-
- if(craft.getWaitingStack() != null && craft.getPlayer() != null) {
- GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.7f);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, craft.getWaitingStack(), xc + 60, yc + 18);
- net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
- GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- waitingAspects = ThaumcraftCraftingManager.findMatchingArcaneRecipeAspects((IInventory) craft, craft.getPlayer());
- }
- if(craft.getStackInSlot(10) != null) {
- GL11.glEnable(GL11.GL_BLEND);
- ItemStack wand = craft.getStackInSlot(10);
- ItemWandCasting itemWand = ((ItemWandCasting) wand.getItem());
- AspectList aspects = itemWand.getAllVis(wand);
- int n = 0;
- for (Aspect a : primals) {
- float alpha = 1.0f;
- if (waitingAspects != null) {
- float amt = (float) waitingAspects.getAmount(a);
- if (amt > 0) {
- amt *= itemWand.getConsumptionModifier(wand, craft.getPlayer(), a, true);
- if (amt * 100.0f > itemWand.getVis(wand, a)) {
- alpha = 0.5f + (MathHelper.sin((craft.getPlayer().ticksExisted + n * 10) / 2.0f) * 0.2f
- - 0.2f);
- }
- }
- }
- int xa = (int) (xc - 45 + Math.cos(0.2f * Math.PI * n + Math.PI / 2) * 45);
- int ya = (int) (yc + 16 + Math.sin(0.2f * Math.PI * n + Math.PI / 2) * 45);
- float amout = aspects.getAmount(a) + 0.000001f;
- UtilsFX.drawTag(xa, ya, a, amout / 100f, 0, 0, 771, alpha, false);
- n++;
- }
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
- }
+ Gui.drawRect(xc + 60 - 3, yc + 18 - 3, xc + 60 + 16 + 3, yc + 18 + 16 + 3, 0x2294178a);
+ Gui.drawRect(xc + 60 - 2, yc + 18 - 2, xc + 60 + 16 + 2, yc + 18 + 16 + 2, 0x2294178a);
+ Gui.drawRect(xc + 60, yc + 18, xc + 60 + 16, yc + 18 + 16, 0x22efd3f4);
- Gui.drawRect(xc - 28 - 20 - 3, yc + 7 - 3, xc - 28 - 20 + 16 + 3, yc + 7 + 16 + 3, 0x2294178a);
- Gui.drawRect(xc - 28 - 20 - 2, yc + 7 - 2, xc - 28 - 20 + 16 + 2, yc + 7 + 16 + 2, 0x2294178a);
- Gui.drawRect(xc - 28 - 20, yc + 7, xc - 28 - 20 + 16, yc + 7 + 16, 0x22efd3f4);
- net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine,
- craft.getStackInSlot(10), xc - 28 - 20, yc + 8);
- net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
+ AspectList waitingAspects = null;
- Gui.drawRect(xc - 28 - 20 - 3, yc + 29 - 3, xc - 28 - 20 + 16 - 3, yc + 29 + 16 + 3, 0x2294178a);
- Gui.drawRect(xc - 28 - 20 - 2, yc + 29 - 2, xc - 28 - 20 + 16 + 2, yc + 29 + 16 + 2, 0x2294178a);
- Gui.drawRect(xc - 28 - 20, yc + 29, xc - 28 - 20 + 16, yc + 29 + 16, 0x22efd3f4);
- net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine,
- craft.getStackInSlot(11), xc - 28 - 20, yc + 29);
- net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
+ if (craft.getWaitingStack() != null && craft.getPlayer() != null) {
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.7f);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ craft.getWaitingStack(),
+ xc + 60,
+ yc + 18);
+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ waitingAspects = ThaumcraftCraftingManager
+ .findMatchingArcaneRecipeAspects((IInventory) craft, craft.getPlayer());
+ }
+ if (craft.getStackInSlot(10) != null) {
+ GL11.glEnable(GL11.GL_BLEND);
+ ItemStack wand = craft.getStackInSlot(10);
+ ItemWandCasting itemWand = ((ItemWandCasting) wand.getItem());
+ AspectList aspects = itemWand.getAllVis(wand);
+ int n = 0;
+ for (Aspect a : primals) {
+ float alpha = 1.0f;
+ if (waitingAspects != null) {
+ float amt = (float) waitingAspects.getAmount(a);
+ if (amt > 0) {
+ amt *= itemWand.getConsumptionModifier(wand, craft.getPlayer(), a, true);
+ if (amt * 100.0f > itemWand.getVis(wand, a)) {
+ alpha = 0.5f + (MathHelper.sin((craft.getPlayer().ticksExisted + n * 10) / 2.0f) * 0.2f
+ - 0.2f);
+ }
+ }
+ }
+ int xa = (int) (xc - 45 + Math.cos(0.2f * Math.PI * n + Math.PI / 2) * 45);
+ int ya = (int) (yc + 16 + Math.sin(0.2f * Math.PI * n + Math.PI / 2) * 45);
+ float amout = aspects.getAmount(a) + 0.000001f;
+ UtilsFX.drawTag(xa, ya, a, amout / 100f, 0, 0, 771, alpha, false);
+ n++;
+ }
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
+ }
- for (int i = 0; i < 3; i++)
- for (int j = 0; j < 3; j++) {
- int index = i * 3 + j;
- int xp = xc + j * 18 - 3;
- int yp = yc + i * 18;
+ Gui.drawRect(xc - 28 - 20 - 3, yc + 7 - 3, xc - 28 - 20 + 16 + 3, yc + 7 + 16 + 3, 0x2294178a);
+ Gui.drawRect(xc - 28 - 20 - 2, yc + 7 - 2, xc - 28 - 20 + 16 + 2, yc + 7 + 16 + 2, 0x2294178a);
+ Gui.drawRect(xc - 28 - 20, yc + 7, xc - 28 - 20 + 16, yc + 7 + 16, 0x22efd3f4);
+ net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ craft.getStackInSlot(10),
+ xc - 28 - 20,
+ yc + 8);
+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
- boolean enabled = craft.getPattern()[i][j];
+ Gui.drawRect(xc - 28 - 20 - 3, yc + 29 - 3, xc - 28 - 20 + 16 - 3, yc + 29 + 16 + 3, 0x2294178a);
+ Gui.drawRect(xc - 28 - 20 - 2, yc + 29 - 2, xc - 28 - 20 + 16 + 2, yc + 29 + 16 + 2, 0x2294178a);
+ Gui.drawRect(xc - 28 - 20, yc + 29, xc - 28 - 20 + 16, yc + 29 + 16, 0x22efd3f4);
+ net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ craft.getStackInSlot(11),
+ xc - 28 - 20,
+ yc + 29);
+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
- Gui.drawRect(xp, yp, xp + 16, yp + 16, enabled ? 0x22efd3f4 : 0x22fb02a6);
+ for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) {
+ int index = i * 3 + j;
+ int xp = xc + j * 18 - 3;
+ int yp = yc + i * 18;
- ItemStack item = craft.getStackInSlot(index);
- net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, item, xp, yp);
- net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
- }
- }
- }
-
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote) {
- TileMagicCraftCrate inv = (TileMagicCraftCrate)world.getTileEntity(x, y, z);
- if(inv != null) {
- for(int i = 0; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if(stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if(stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
+ boolean enabled = craft.getPattern()[i][j];
- public boolean renderAsNormalBlock() {
- return false;
- }
+ Gui.drawRect(xp, yp, xp + 16, yp + 16, enabled ? 0x22efd3f4 : 0x22fb02a6);
- public boolean isOpaqueCube() {
- return false;
- }
+ ItemStack item = craft.getStackInSlot(index);
+ net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, item, xp, yp);
+ net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
+ }
+ }
+ }
- public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
- TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
- crate.ejectAll();
- return true;
- }
-}
\ No newline at end of file
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote) {
+ TileMagicCraftCrate inv = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
+ TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
+ crate.ejectAll();
+ return true;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockManaCharger.java b/src/main/java/ab/common/block/BlockManaCharger.java
index 25bafe5..c999739 100644
--- a/src/main/java/ab/common/block/BlockManaCharger.java
+++ b/src/main/java/ab/common/block/BlockManaCharger.java
@@ -1,10 +1,5 @@
package ab.common.block;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileInventory;
-import ab.common.block.tile.TileManaCharger;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -18,120 +13,132 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
-import vazkii.botania.api.internal.VanillaPacketDispatcher;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileInventory;
+import ab.common.block.tile.TileManaCharger;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockManaCharger extends BlockContainer implements IWandHUD, IWandable, ILexiconable {
- public BlockManaCharger() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(6.0F);
- float f = 0.0625f;
- this.setBlockBounds(f * 3, f * 3, f * 3, 1.0f - f * 3, 1.0f - f * 4 + f * 3, 1.0f - f * 3);
- this.setBlockName("ABManaCharger");
- }
-
- public IIcon getIcon(int par1, int par2) {
- return ModBlocks.livingrock.getIcon(0, 0);
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
- TileManaCharger tile = (TileManaCharger)world.getTileEntity(x, y, z);
- if(tile != null) {
- int slotSide = side - 1;
- if(slotSide < 0)
- return false;
- ItemStack heldItem = player.getCurrentEquippedItem();
- ItemStack stackInSlot = tile.getStackInSlot(slotSide);
- if(player.isSneaking()) {
- if(stackInSlot != null) {
- ItemStack copy = stackInSlot.copy();
- tile.setInventorySlotContents(slotSide, null);
- if(!world.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
- world.spawnEntityInWorld(entityitem);
- tile.requestUpdate = true;
- }
- world.func_147453_f(x, y, z, (Block)this);
- return true;
- }
- } else {
- if(heldItem != null && heldItem.getItem() instanceof IManaItem && stackInSlot == null && heldItem.getMaxStackSize() == 1) {
- ItemStack copy = heldItem.copy();
- copy.stackSize = 1;
- heldItem.stackSize--;
- if(heldItem.stackSize == 0)
- player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
- player.inventory.markDirty();
- if(!world.isRemote) {
- tile.setInventorySlotContents(slotSide, copy);
- tile.requestUpdate = true;
- }
- return true;
- }
- }
- }
- return false;
- }
-
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote) {
- TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
- if (inv != null) {
- for (int i = 0; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if (stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public int getRenderType() {
+ public BlockManaCharger() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(6.0F);
+ float f = 0.0625f;
+ this.setBlockBounds(f * 3, f * 3, f * 3, 1.0f - f * 3, 1.0f - f * 4 + f * 3, 1.0f - f * 3);
+ this.setBlockName("ABManaCharger");
+ }
+
+ public IIcon getIcon(int par1, int par2) {
+ return ModBlocks.livingrock.getIcon(0, 0);
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7,
+ float par8, float par9) {
+ TileManaCharger tile = (TileManaCharger) world.getTileEntity(x, y, z);
+ if (tile != null) {
+ int slotSide = side - 1;
+ if (slotSide < 0) return false;
+ ItemStack heldItem = player.getCurrentEquippedItem();
+ ItemStack stackInSlot = tile.getStackInSlot(slotSide);
+ if (player.isSneaking()) {
+ if (stackInSlot != null) {
+ ItemStack copy = stackInSlot.copy();
+ tile.setInventorySlotContents(slotSide, null);
+ if (!world.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ world,
+ player.posX + vec3.xCoord,
+ player.posY + 1.2f,
+ player.posZ + vec3.zCoord,
+ copy);
+ world.spawnEntityInWorld(entityitem);
+ tile.requestUpdate = true;
+ }
+ world.func_147453_f(x, y, z, (Block) this);
+ return true;
+ }
+ } else {
+ if (heldItem != null && heldItem.getItem() instanceof IManaItem
+ && stackInSlot == null
+ && heldItem.getMaxStackSize() == 1) {
+ ItemStack copy = heldItem.copy();
+ copy.stackSize = 1;
+ heldItem.stackSize--;
+ if (heldItem.stackSize == 0)
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ player.inventory.markDirty();
+ if (!world.isRemote) {
+ tile.setInventorySlotContents(slotSide, copy);
+ tile.requestUpdate = true;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote) {
+ TileInventory inv = (TileInventory) world.getTileEntity(x, y, z);
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public int getRenderType() {
return BlockListAB.blockManaChargerRI;
}
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileManaCharger();
- }
-
- public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
- ((TileManaCharger)world.getTileEntity(x, y, z)).renderHUD(mc, res);
- }
-
- public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
- ((TileManaCharger)world.getTileEntity(x, y, z)).onWanded(player, stack);
- return true;
- }
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileManaCharger();
+ }
- public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
- return RecipeListAB.manaCharger;
- }
+ public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
+ ((TileManaCharger) world.getTileEntity(x, y, z)).renderHUD(mc, res);
+ }
+
+ public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
+ ((TileManaCharger) world.getTileEntity(x, y, z)).onWanded(player, stack);
+ return true;
+ }
+
+ public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
+ return RecipeListAB.manaCharger;
+ }
}
diff --git a/src/main/java/ab/common/block/BlockManaContainer.java b/src/main/java/ab/common/block/BlockManaContainer.java
index 52ffc41..248b2bd 100644
--- a/src/main/java/ab/common/block/BlockManaContainer.java
+++ b/src/main/java/ab/common/block/BlockManaContainer.java
@@ -1,13 +1,7 @@
package ab.common.block;
import java.util.List;
-import java.util.Random;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileABSpreader;
-import ab.common.block.tile.TileManaContainer;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -18,66 +12,69 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
-import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
-import vazkii.botania.common.block.BlockLivingrock;
import vazkii.botania.common.block.ModBlocks;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileManaContainer;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockManaContainer extends BlockContainer implements IWandHUD, IWandable, ILexiconable {
- public BlockManaContainer() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(9.0F);
- this.setBlockName("ABManaContainer");
- float offset = 0.08F;
- this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
- }
-
- public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
- par3.add(new ItemStack(par1, 1, 0));
- par3.add(new ItemStack(par1, 1, 1));
- par3.add(new ItemStack(par1, 1, 2));
- }
-
- public int damageDropped(int meta) {
- return meta;
- }
-
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileManaContainer();
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public int getRenderType() {
+ public BlockManaContainer() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(9.0F);
+ this.setBlockName("ABManaContainer");
+ float offset = 0.08F;
+ this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
+ par3.add(new ItemStack(par1, 1, 0));
+ par3.add(new ItemStack(par1, 1, 1));
+ par3.add(new ItemStack(par1, 1, 2));
+ }
+
+ public int damageDropped(int meta) {
+ return meta;
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileManaContainer();
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public int getRenderType() {
return BlockListAB.blockManaContainerRI;
}
-
- public IIcon getIcon(int par1, int par2) {
- return ModBlocks.livingrock.getIcon(0, 0);
- }
-
- public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
- ((TileManaContainer)world.getTileEntity(x, y, z)).renderHUD(mc, res);
- }
-
- public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
- ((TileManaContainer)world.getTileEntity(x, y, z)).onWanded(player, stack);
- return true;
- }
-
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.manaContainer;
- }
+
+ public IIcon getIcon(int par1, int par2) {
+ return ModBlocks.livingrock.getIcon(0, 0);
+ }
+
+ public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
+ ((TileManaContainer) world.getTileEntity(x, y, z)).renderHUD(mc, res);
+ }
+
+ public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
+ ((TileManaContainer) world.getTileEntity(x, y, z)).onWanded(player, stack);
+ return true;
+ }
+
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
+ return RecipeListAB.manaContainer;
+ }
}
diff --git a/src/main/java/ab/common/block/BlockManaCrystalCube.java b/src/main/java/ab/common/block/BlockManaCrystalCube.java
index b501953..0956fad 100644
--- a/src/main/java/ab/common/block/BlockManaCrystalCube.java
+++ b/src/main/java/ab/common/block/BlockManaCrystalCube.java
@@ -1,81 +1,77 @@
package ab.common.block;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileManaCrystalCube;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
-import vazkii.botania.api.wand.IWandHUD;
-import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ItemTwigWand;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileManaCrystalCube;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockManaCrystalCube extends BlockContainer implements ILexiconable {
- public BlockManaCrystalCube() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- float f = 0.1875F;
- this.setBlockBounds(f, 0.0F, f, 1.0F - f, 1.0F, 1.0F - f);
- this.setHardness(5.5F);
- this.setStepSound(soundTypeMetal);
- this.setBlockName("ABManaCrystalCube");
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
- boolean isWand = player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTwigWand;
- if(isWand)
- return false;
- TileManaCrystalCube tile = (TileManaCrystalCube)world.getTileEntity(x, y, z);
- if(tile != null && !world.isRemote) {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- tile.writeCustomNBT(nbttagcompound);
- int[] mana = tile.getManaAround();
- nbttagcompound.setInteger("knownMana", mana[0]);
- nbttagcompound.setInteger("knownMaxMana", mana[1]);
- if(player instanceof EntityPlayerMP)
- ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, -999, nbttagcompound));
- }
- world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
- return true;
- }
-
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileManaCrystalCube();
- }
-
- public IIcon getIcon(int par1, int par2) {
- return ModBlocks.dreamwood.getIcon(0, 0);
- }
-
- public int getRenderType() {
+ public BlockManaCrystalCube() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ float f = 0.1875F;
+ this.setBlockBounds(f, 0.0F, f, 1.0F - f, 1.0F, 1.0F - f);
+ this.setHardness(5.5F);
+ this.setStepSound(soundTypeMetal);
+ this.setBlockName("ABManaCrystalCube");
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7,
+ float par8, float par9) {
+ boolean isWand = player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTwigWand;
+ if (isWand) return false;
+ TileManaCrystalCube tile = (TileManaCrystalCube) world.getTileEntity(x, y, z);
+ if (tile != null && !world.isRemote) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ tile.writeCustomNBT(nbttagcompound);
+ int[] mana = tile.getManaAround();
+ nbttagcompound.setInteger("knownMana", mana[0]);
+ nbttagcompound.setInteger("knownMaxMana", mana[1]);
+ if (player instanceof EntityPlayerMP) ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(
+ new S35PacketUpdateTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, -999, nbttagcompound));
+ }
+ world.playSoundAtEntity((Entity) player, "botania:ding", 0.11F, 1.0F);
+ return true;
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileManaCrystalCube();
+ }
+
+ public IIcon getIcon(int par1, int par2) {
+ return ModBlocks.dreamwood.getIcon(0, 0);
+ }
+
+ public int getRenderType() {
return BlockListAB.blockManaCrystalCubeRI;
}
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.manaCrystalCube;
- }
-}
\ No newline at end of file
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
+ return RecipeListAB.manaCrystalCube;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockNidavellirForge.java b/src/main/java/ab/common/block/BlockNidavellirForge.java
index 25409be..34e06f3 100644
--- a/src/main/java/ab/common/block/BlockNidavellirForge.java
+++ b/src/main/java/ab/common/block/BlockNidavellirForge.java
@@ -1,15 +1,8 @@
package ab.common.block;
-import ab.AdvancedBotany;
-import ab.common.block.tile.TileNidavellirForge;
-import ab.common.block.tile.TileInventory;
-import ab.common.lib.register.BlockListAB;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -21,127 +14,148 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import vazkii.botania.api.BotaniaAPI;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.ModBlocks;
+import ab.AdvancedBotany;
+import ab.common.block.tile.TileInventory;
+import ab.common.block.tile.TileNidavellirForge;
+import ab.common.lib.register.BlockListAB;
+import ab.common.lib.register.RecipeListAB;
public class BlockNidavellirForge extends BlockContainer implements ILexiconable {
-
- public BlockNidavellirForge() {
- super(Material.iron);
- this.setCreativeTab(AdvancedBotany.tabAB);
- this.setHardness(3.0F);
- this.setResistance(10.0F);
- this.setStepSound(soundTypeMetal);
- this.setBlockName("ABPlate");
- }
-
- public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
- float f = 0.1875F;
- float f1 = 0.0625F;
- switch(world.getBlockMetadata(x, y, z)) {
- case 0: this.setBlockBounds(f, 0.0F, f1, 1.0F - f, 0.75F, 1.0F);
- break;
- case 1: this.setBlockBounds(0.0F, 0.0F, f, 1.0F - f1, 0.75F, 1.0F - f);
- break;
- case 2: this.setBlockBounds(f, 0.0F, 0.0F, 1.0F - f, 0.75F, 1.0F - f1);
- break;
- case 3: this.setBlockBounds(f1, 0.0F, f, 1.0F, 0.75F, 1.0F - f);
- break;
- default: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- }
- }
-
- public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
- int meta = MathHelper.floor_double((double)(liv.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
- world.setBlockMetadataWithNotify(x, y, z, meta, 3);
- }
-
- public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
- TileNidavellirForge tile = (TileNidavellirForge)world.getTileEntity(x, y, z);
- if(player.isSneaking()) {
- if(tile.getStackInSlot(0) != null) {
- ItemStack copy = tile.getStackInSlot(0).copy();
- if(!world.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
- world.spawnEntityInWorld(entityitem);
- tile.requestUpdate = true;
- }
- tile.setInventorySlotContents(0, null);
- world.func_147453_f(x, y, z, (Block)this);
- return true;
- }
- for(int i = tile.getSizeInventory() - 1; i > 0; i--) {
- ItemStack stack = tile.getStackInSlot(i);
- if(stack != null) {
- ItemStack copy = stack.copy();
- if(!world.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
- world.spawnEntityInWorld(entityitem);
- tile.requestUpdate = true;
- }
- tile.setInventorySlotContents(i, null);
- world.func_147453_f(x, y, z, (Block)this);
- return true;
- }
- }
- }
- return false;
- }
-
- public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
- if(!world.isRemote) {
- TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
- if (inv != null) {
- for (int i = 0; i < inv.getSizeInventory(); i++) {
- ItemStack stack = inv.getStackInSlot(i);
- if (stack != null) {
- float f = world.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
- EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
- float f3 = 0.05F;
- entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
- entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
- if (stack.hasTagCompound())
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- world.spawnEntityInWorld(entityitem);
- }
- }
- }
- }
- super.breakBlock(world, x, y, z, block, meta);
- }
-
- public int getRenderType() {
- return BlockListAB.blockABPlateRI;
- }
-
- public IIcon getIcon(int par1, int par2) {
- return ModBlocks.storage.getIcon(0, 0);
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) {
- return false;
- }
- public TileEntity createNewTileEntity(World world, int meta) {
- return new TileNidavellirForge();
- }
+ public BlockNidavellirForge() {
+ super(Material.iron);
+ this.setCreativeTab(AdvancedBotany.tabAB);
+ this.setHardness(3.0F);
+ this.setResistance(10.0F);
+ this.setStepSound(soundTypeMetal);
+ this.setBlockName("ABPlate");
+ }
- public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
- return RecipeListAB.advandedAgglomerationPlate;
- }
-}
\ No newline at end of file
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
+ float f = 0.1875F;
+ float f1 = 0.0625F;
+ switch (world.getBlockMetadata(x, y, z)) {
+ case 0:
+ this.setBlockBounds(f, 0.0F, f1, 1.0F - f, 0.75F, 1.0F);
+ break;
+ case 1:
+ this.setBlockBounds(0.0F, 0.0F, f, 1.0F - f1, 0.75F, 1.0F - f);
+ break;
+ case 2:
+ this.setBlockBounds(f, 0.0F, 0.0F, 1.0F - f, 0.75F, 1.0F - f1);
+ break;
+ case 3:
+ this.setBlockBounds(f1, 0.0F, f, 1.0F, 0.75F, 1.0F - f);
+ break;
+ default:
+ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ }
+ }
+
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
+ int meta = MathHelper.floor_double((double) (liv.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(x, y, z, meta, 3);
+ }
+
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
+ float par8, float par9) {
+ TileNidavellirForge tile = (TileNidavellirForge) world.getTileEntity(x, y, z);
+ if (player.isSneaking()) {
+ if (tile.getStackInSlot(0) != null) {
+ ItemStack copy = tile.getStackInSlot(0).copy();
+ if (!world.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ world,
+ player.posX + vec3.xCoord,
+ player.posY + 1.2f,
+ player.posZ + vec3.zCoord,
+ copy);
+ world.spawnEntityInWorld(entityitem);
+ tile.requestUpdate = true;
+ }
+ tile.setInventorySlotContents(0, null);
+ world.func_147453_f(x, y, z, (Block) this);
+ return true;
+ }
+ for (int i = tile.getSizeInventory() - 1; i > 0; i--) {
+ ItemStack stack = tile.getStackInSlot(i);
+ if (stack != null) {
+ ItemStack copy = stack.copy();
+ if (!world.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ world,
+ player.posX + vec3.xCoord,
+ player.posY + 1.2f,
+ player.posZ + vec3.zCoord,
+ copy);
+ world.spawnEntityInWorld(entityitem);
+ tile.requestUpdate = true;
+ }
+ tile.setInventorySlotContents(i, null);
+ world.func_147453_f(x, y, z, (Block) this);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
+ if (!world.isRemote) {
+ TileInventory inv = (TileInventory) world.getTileEntity(x, y, z);
+ if (inv != null) {
+ for (int i = 0; i < inv.getSizeInventory(); i++) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null) {
+ float f = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
+ float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
+ EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
+ float f3 = 0.05F;
+ entityitem.motionX = ((float) world.rand.nextGaussian() * f3);
+ entityitem.motionY = ((float) world.rand.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = ((float) world.rand.nextGaussian() * f3);
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+ }
+ }
+ super.breakBlock(world, x, y, z, block, meta);
+ }
+
+ public int getRenderType() {
+ return BlockListAB.blockABPlateRI;
+ }
+
+ public IIcon getIcon(int par1, int par2) {
+ return ModBlocks.storage.getIcon(0, 0);
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) {
+ return false;
+ }
+
+ public TileEntity createNewTileEntity(World world, int meta) {
+ return new TileNidavellirForge();
+ }
+
+ public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
+ return RecipeListAB.advandedAgglomerationPlate;
+ }
+}
diff --git a/src/main/java/ab/common/block/BlockTerraFarmland.java b/src/main/java/ab/common/block/BlockTerraFarmland.java
index 996486a..ffe1e25 100644
--- a/src/main/java/ab/common/block/BlockTerraFarmland.java
+++ b/src/main/java/ab/common/block/BlockTerraFarmland.java
@@ -1,22 +1,12 @@
package ab.common.block;
-import static net.minecraftforge.common.util.ForgeDirection.UP;
-
import java.util.List;
import java.util.Random;
-import ab.api.AdvancedBotanyAPI;
-import ab.api.TerraFarmlandList;
-import ab.common.lib.register.RecipeListAB;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
+
import net.minecraft.block.Block;
-import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockCrops;
-import net.minecraft.block.BlockFarmland;
-import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -26,16 +16,21 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
+
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
+import ab.api.AdvancedBotanyAPI;
+import ab.api.TerraFarmlandList;
+import ab.common.lib.register.RecipeListAB;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class BlockTerraFarmland extends Block implements ILexiconable {
-
- private IIcon icon;
-
+
+ private IIcon icon;
+
public BlockTerraFarmland() {
super(Material.ground);
this.setTickRandomly(true);
@@ -44,94 +39,97 @@ public class BlockTerraFarmland extends Block implements ILexiconable {
this.setLightOpacity(255);
this.setStepSound(soundTypeGravel);
}
-
- public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
- Block plant = plantable.getPlant(world, x, y + 1, z);
- return plant != Blocks.cactus && plant != Blocks.reeds;
- }
-
- public void updateTick(World world, int x, int y, int z, Random rand) {
- if(world.isRemote)
- return;
- Block block = world.getBlock(x, y + 1, z);
- int meta = world.getBlockMetadata(x, y + 1, z);
- if(block instanceof BlockCrops) {
- if(meta == 7) {
- refreshSeed(world, x, y, z, block, meta);
- return;
- }
- } else if(block instanceof IPlantable) {
- for(TerraFarmlandList fSeed : AdvancedBotanyAPI.farmlandList) {
- int meta1 = fSeed.getMeta();
- Block block1 = fSeed.getBlock();
- if(block != block1)
- continue;
- if(meta == meta1) {
- refreshSeed(world, x, y, z, block1, meta1);
- return;
- }
- }
- } else {
- world.setBlock(x, y, z, Blocks.dirt);
- }
- }
-
- private void refreshSeed(World world, int x, int y, int z, Block block, int meta) {
- List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 4, y - 4, z - 4, x + 4, y + 4, z + 4));
- if(!items.isEmpty() && items.size() > 7)
- return;
- IPlantable seed = (IPlantable)block;
- List list = block.getDrops(world, x, y + 1, z, meta, 0);
- for(ItemStack stack : list) {
- if(stack == null)
- continue;
- else if(stack.getItem() == seed) {
- if(stack.stackSize > 1)
- stack.stackSize -= 1;
- } else
- stack.stackSize = Math.min(64, (int)(stack.stackSize * 2.5f));
- }
- for(ItemStack stack : list) {
- if(stack == null)
- continue;
- EntityItem itemEnt = new EntityItem(world, x + 0.5f, y + 1, z + 0.5f, stack);
- world.spawnEntityInWorld(itemEnt);
- }
- world.setBlock(x, y + 1, z, block, 0, 3);
- }
-
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
- return AxisAlignedBB.getBoundingBox((double)(p_149668_2_ + 0), (double)(p_149668_3_ + 0), (double)(p_149668_4_ + 0), (double)(p_149668_2_ + 1), (double)(p_149668_3_ + 1), (double)(p_149668_4_ + 1));
+
+ public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction,
+ IPlantable plantable) {
+ Block plant = plantable.getPlant(world, x, y + 1, z);
+ return plant != Blocks.cactus && plant != Blocks.reeds;
}
-
+
+ public void updateTick(World world, int x, int y, int z, Random rand) {
+ if (world.isRemote) return;
+ Block block = world.getBlock(x, y + 1, z);
+ int meta = world.getBlockMetadata(x, y + 1, z);
+ if (block instanceof BlockCrops) {
+ if (meta == 7) {
+ refreshSeed(world, x, y, z, block, meta);
+ return;
+ }
+ } else if (block instanceof IPlantable) {
+ for (TerraFarmlandList fSeed : AdvancedBotanyAPI.farmlandList) {
+ int meta1 = fSeed.getMeta();
+ Block block1 = fSeed.getBlock();
+ if (block != block1) continue;
+ if (meta == meta1) {
+ refreshSeed(world, x, y, z, block1, meta1);
+ return;
+ }
+ }
+ } else {
+ world.setBlock(x, y, z, Blocks.dirt);
+ }
+ }
+
+ private void refreshSeed(World world, int x, int y, int z, Block block, int meta) {
+ List items = world.getEntitiesWithinAABB(
+ EntityItem.class,
+ AxisAlignedBB.getBoundingBox(x - 4, y - 4, z - 4, x + 4, y + 4, z + 4));
+ if (!items.isEmpty() && items.size() > 7) return;
+ IPlantable seed = (IPlantable) block;
+ List list = block.getDrops(world, x, y + 1, z, meta, 0);
+ for (ItemStack stack : list) {
+ if (stack == null) continue;
+ else if (stack.getItem() == seed) {
+ if (stack.stackSize > 1) stack.stackSize -= 1;
+ } else stack.stackSize = Math.min(64, (int) (stack.stackSize * 2.5f));
+ }
+ for (ItemStack stack : list) {
+ if (stack == null) continue;
+ EntityItem itemEnt = new EntityItem(world, x + 0.5f, y + 1, z + 0.5f, stack);
+ world.spawnEntityInWorld(itemEnt);
+ }
+ world.setBlock(x, y + 1, z, block, 0, 3);
+ }
+
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_,
+ int p_149668_4_) {
+ return AxisAlignedBB.getBoundingBox(
+ (double) (p_149668_2_ + 0),
+ (double) (p_149668_3_ + 0),
+ (double) (p_149668_4_ + 0),
+ (double) (p_149668_2_ + 1),
+ (double) (p_149668_3_ + 1),
+ (double) (p_149668_4_ + 1));
+ }
+
public boolean isOpaqueCube() {
return false;
}
-
+
public boolean renderAsNormalBlock() {
return false;
}
-
+
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
- return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
+ return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
}
-
+
@SideOnly(Side.CLIENT)
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
- return Item.getItemFromBlock(Blocks.dirt);
+ return Item.getItemFromBlock(Blocks.dirt);
}
-
+
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
return p_149691_1_ == 1 ? icon : Blocks.dirt.getIcon(0, 0);
}
-
+
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
- icon = reg.registerIcon("ab:terraFarmland");
+ icon = reg.registerIcon("ab:terraFarmland");
}
-
+
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
- return RecipeListAB.terraHoe;
- }
-}
\ No newline at end of file
+ return RecipeListAB.terraHoe;
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/ABSubTileSignature.java b/src/main/java/ab/common/block/subtile/ABSubTileSignature.java
index b266601..3b7e04a 100644
--- a/src/main/java/ab/common/block/subtile/ABSubTileSignature.java
+++ b/src/main/java/ab/common/block/subtile/ABSubTileSignature.java
@@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
+
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.subtile.SubTileFunctional;
@@ -18,48 +19,44 @@ import vazkii.botania.common.block.BlockSpecialFlower;
public class ABSubTileSignature extends SubTileSignature {
- String name;
- IIcon icon;
-
- public ABSubTileSignature(String name) {
- this.name = name;
- }
-
- public void registerIcons(IIconRegister reg) {
- this.icon = reg.registerIcon("ab:flower_" + this.name);
- BlockSpecialFlower.icons.put(name, icon);
- }
-
- public IIcon getIconForStack(ItemStack item) {
- return this.icon;
- }
-
- public String getUnlocalizedNameForStack(ItemStack item) {
- return unlocalizedName("");
- }
-
- private String unlocalizedName(String end) {
- return "ab.flower." + this.name + end;
- }
-
- public String getUnlocalizedLoreTextForStack(ItemStack stack) {
- return unlocalizedName(".reference");
- }
-
- public String getType() {
- Class extends SubTileEntity> clazz = BotaniaAPI.getSubTileMapping(this.name);
- if(clazz == null)
- return "uwotm8";
- if(clazz.getAnnotation(PassiveFlower.class) != null)
- return "botania.flowerType.passiveGenerating";
- if(SubTileGenerating.class.isAssignableFrom(clazz))
- return "botania.flowerType.generating";
- if(SubTileFunctional.class.isAssignableFrom(clazz))
- return "botania.flowerType.functional";
- return "botania.flowerType.misc";
- }
-
- public void addTooltip(ItemStack stack, EntityPlayer player, List tooltip) {
- tooltip.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal(getType()));
- }
-}
\ No newline at end of file
+ String name;
+ IIcon icon;
+
+ public ABSubTileSignature(String name) {
+ this.name = name;
+ }
+
+ public void registerIcons(IIconRegister reg) {
+ this.icon = reg.registerIcon("ab:flower_" + this.name);
+ BlockSpecialFlower.icons.put(name, icon);
+ }
+
+ public IIcon getIconForStack(ItemStack item) {
+ return this.icon;
+ }
+
+ public String getUnlocalizedNameForStack(ItemStack item) {
+ return unlocalizedName("");
+ }
+
+ private String unlocalizedName(String end) {
+ return "ab.flower." + this.name + end;
+ }
+
+ public String getUnlocalizedLoreTextForStack(ItemStack stack) {
+ return unlocalizedName(".reference");
+ }
+
+ public String getType() {
+ Class extends SubTileEntity> clazz = BotaniaAPI.getSubTileMapping(this.name);
+ if (clazz == null) return "uwotm8";
+ if (clazz.getAnnotation(PassiveFlower.class) != null) return "botania.flowerType.passiveGenerating";
+ if (SubTileGenerating.class.isAssignableFrom(clazz)) return "botania.flowerType.generating";
+ if (SubTileFunctional.class.isAssignableFrom(clazz)) return "botania.flowerType.functional";
+ return "botania.flowerType.misc";
+ }
+
+ public void addTooltip(ItemStack stack, EntityPlayer player, List tooltip) {
+ tooltip.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal(getType()));
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/SubTileAncientAlphirine.java b/src/main/java/ab/common/block/subtile/SubTileAncientAlphirine.java
index bf5e2b8..46f50e9 100644
--- a/src/main/java/ab/common/block/subtile/SubTileAncientAlphirine.java
+++ b/src/main/java/ab/common/block/subtile/SubTileAncientAlphirine.java
@@ -2,130 +2,127 @@ package ab.common.block.subtile;
import java.util.List;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.World;
+
+import vazkii.botania.api.lexicon.LexiconEntry;
+import vazkii.botania.api.subtile.RadiusDescriptor;
+import vazkii.botania.api.subtile.SubTileFunctional;
+import vazkii.botania.common.item.ItemLexicon;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.common.entity.EntityAlphirinePortal;
-import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
-import net.minecraft.block.Block;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTBase;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
-import vazkii.botania.api.lexicon.LexiconEntry;
-import vazkii.botania.api.lexicon.multiblock.Multiblock;
-import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
-import vazkii.botania.api.subtile.RadiusDescriptor;
-import vazkii.botania.api.subtile.SubTileEntity;
-import vazkii.botania.api.subtile.SubTileFunctional;
-import vazkii.botania.common.Botania;
-import vazkii.botania.common.block.ModBlocks;
-import vazkii.botania.common.block.ModFluffBlocks;
-import vazkii.botania.common.item.ItemLexicon;
public class SubTileAncientAlphirine extends SubTileFunctional {
-
- protected static int manaRequare = 4500;
- public void onUpdate() {
- super.onUpdate();
- float posX = this.supertile.xCoord + 0.5f;
- float posY = this.supertile.yCoord;
- float posZ = this.supertile.zCoord + 0.5f;
- World world = this.supertile.getWorldObj();
- List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(1, 0, 1));
- if(this.ticksExisted % 10 == 0 && this.mana >= manaRequare) {
- label666: for(EntityItem item : items) {
- if(item.isDead || !(item.getEntityItem().stackSize >= 1))
- continue;
- for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
- if(recipe.matches(item.getEntityItem())) {
- if(world.isRemote) {
- spawnParticle(world, item);
- } else {
- if(item.getEntityItem().stackSize > 1)
- item.getEntityItem().stackSize -= 1;
- else
- item.setDead();
- if(world.rand.nextInt(111) <= recipe.getChance()) {
- spawnPortal(world, recipe.getOutput().copy(), posX, posY, posZ);
- this.mana -= manaRequare;
- } else {
- this.mana -= manaRequare / 10;
- }
- this.sync();
- }
- break label666;
- }
- }
- if(item.getEntityItem().getItem() instanceof ItemLexicon) {
- if(!((ItemLexicon)item.getEntityItem().getItem()).isKnowledgeUnlocked(item.getEntityItem(), RecipeListAB.forgotten)) {
- if(world.isRemote)
- spawnParticle(world, item);
- else {
- if(item.getEntityItem().stackSize > 1)
- item.getEntityItem().stackSize -= 1;
- else
- item.setDead();
- ItemStack lexicon = item.getEntityItem().copy();
- ((ItemLexicon)lexicon.getItem()).unlockKnowledge(lexicon, RecipeListAB.forgotten);
- this.mana -= manaRequare;
- spawnPortal(world, lexicon, posX, posY, posZ);
- this.sync();
- }
- break label666;
- }
- }
- }
- }
- }
-
- public RadiusDescriptor getRadius() {
- return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
- }
-
- private void spawnPortal(World world, ItemStack stack, float posX, float posY, float posZ) {
- EntityAlphirinePortal portal = new EntityAlphirinePortal(world);
- float itemX = (float)(posX + (Math.random() * 2.0f - 1.0f));
- float itemY = (float)(posY + 1.2f + (Math.random() - 0.5f));
- float itemZ = (float)(posZ + (Math.random() * 2.0f - 1.0f));
- portal.setPosition(itemX, itemY, itemZ);
- portal.setStack(stack);
- world.spawnEntityInWorld(portal);
- }
-
- private void spawnParticle(World world, EntityItem item) {
- ItemStack stack = item.getEntityItem();
- if(world.isRemote)
- for (int i = 0; i < 10; i++) {
- float m = 0.2F;
- float mx = (float)(Math.random() - 0.5D) * m;
- float my = (float)(Math.random() - 0.5D) * m;
- float mz = (float)(Math.random() - 0.5D) * m;
- if(stack.getItem() instanceof net.minecraft.item.ItemBlock) {
- world.spawnParticle("blockcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(), item.posX, item.posY, item.posZ, mx, my, mz);
- } else {
- world.spawnParticle("iconcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(), item.posX, item.posY, item.posZ, mx, my, mz);
- }
- }
- }
-
- public int getMaxMana() {
- return 180000;
- }
-
- public int getColor() {
- return 0xd0bf58;
- }
-
- public LexiconEntry getEntry() {
- return RecipeListAB.ancientAlphirine;
- }
-}
\ No newline at end of file
+ protected static int manaRequare = 4500;
+
+ public void onUpdate() {
+ super.onUpdate();
+ float posX = this.supertile.xCoord + 0.5f;
+ float posY = this.supertile.yCoord;
+ float posZ = this.supertile.zCoord + 0.5f;
+ World world = this.supertile.getWorldObj();
+ List items = world.getEntitiesWithinAABB(
+ EntityItem.class,
+ AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(1, 0, 1));
+ if (this.ticksExisted % 10 == 0 && this.mana >= manaRequare) {
+ label666: for (EntityItem item : items) {
+ if (item.isDead || !(item.getEntityItem().stackSize >= 1)) continue;
+ for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
+ if (recipe.matches(item.getEntityItem())) {
+ if (world.isRemote) {
+ spawnParticle(world, item);
+ } else {
+ if (item.getEntityItem().stackSize > 1) item.getEntityItem().stackSize -= 1;
+ else item.setDead();
+ if (world.rand.nextInt(111) <= recipe.getChance()) {
+ spawnPortal(world, recipe.getOutput().copy(), posX, posY, posZ);
+ this.mana -= manaRequare;
+ } else {
+ this.mana -= manaRequare / 10;
+ }
+ this.sync();
+ }
+ break label666;
+ }
+ }
+ if (item.getEntityItem().getItem() instanceof ItemLexicon) {
+ if (!((ItemLexicon) item.getEntityItem().getItem())
+ .isKnowledgeUnlocked(item.getEntityItem(), RecipeListAB.forgotten)) {
+ if (world.isRemote) spawnParticle(world, item);
+ else {
+ if (item.getEntityItem().stackSize > 1) item.getEntityItem().stackSize -= 1;
+ else item.setDead();
+ ItemStack lexicon = item.getEntityItem().copy();
+ ((ItemLexicon) lexicon.getItem()).unlockKnowledge(lexicon, RecipeListAB.forgotten);
+ this.mana -= manaRequare;
+ spawnPortal(world, lexicon, posX, posY, posZ);
+ this.sync();
+ }
+ break label666;
+ }
+ }
+ }
+ }
+ }
+
+ public RadiusDescriptor getRadius() {
+ return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
+ }
+
+ private void spawnPortal(World world, ItemStack stack, float posX, float posY, float posZ) {
+ EntityAlphirinePortal portal = new EntityAlphirinePortal(world);
+ float itemX = (float) (posX + (Math.random() * 2.0f - 1.0f));
+ float itemY = (float) (posY + 1.2f + (Math.random() - 0.5f));
+ float itemZ = (float) (posZ + (Math.random() * 2.0f - 1.0f));
+ portal.setPosition(itemX, itemY, itemZ);
+ portal.setStack(stack);
+ world.spawnEntityInWorld(portal);
+ }
+
+ private void spawnParticle(World world, EntityItem item) {
+ ItemStack stack = item.getEntityItem();
+ if (world.isRemote) for (int i = 0; i < 10; i++) {
+ float m = 0.2F;
+ float mx = (float) (Math.random() - 0.5D) * m;
+ float my = (float) (Math.random() - 0.5D) * m;
+ float mz = (float) (Math.random() - 0.5D) * m;
+ if (stack.getItem() instanceof net.minecraft.item.ItemBlock) {
+ world.spawnParticle(
+ "blockcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(),
+ item.posX,
+ item.posY,
+ item.posZ,
+ mx,
+ my,
+ mz);
+ } else {
+ world.spawnParticle(
+ "iconcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(),
+ item.posX,
+ item.posY,
+ item.posZ,
+ mx,
+ my,
+ mz);
+ }
+ }
+ }
+
+ public int getMaxMana() {
+ return 180000;
+ }
+
+ public int getColor() {
+ return 0xd0bf58;
+ }
+
+ public LexiconEntry getEntry() {
+ return RecipeListAB.ancientAlphirine;
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/SubTileArdentAzarcissus.java b/src/main/java/ab/common/block/subtile/SubTileArdentAzarcissus.java
index 7a1d48e..d28b895 100644
--- a/src/main/java/ab/common/block/subtile/SubTileArdentAzarcissus.java
+++ b/src/main/java/ab/common/block/subtile/SubTileArdentAzarcissus.java
@@ -1,96 +1,91 @@
package ab.common.block.subtile;
-import ab.common.block.tile.TileGameBoard;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
+import ab.common.block.tile.TileGameBoard;
+import ab.common.lib.register.RecipeListAB;
public class SubTileArdentAzarcissus extends SubTileGenerating {
-
- public static final String playerName = "ArdentAzarcissus#21sda2gaj91*21df#111sfq3jrns@#";
- public static final ItemStack flowerStack = ItemBlockSpecialFlower.ofType("ardentAzarcissus");
-
- int cooldown;
- int workMana = 320;
- public void onUpdate() {
- super.onUpdate();
- World world = this.supertile.getWorldObj();
- int posX = this.supertile.xCoord;
- int posY = this.supertile.yCoord;
- int posZ = this.supertile.zCoord;
- if(world.isRemote)
- return;
- if(cooldown > 0) {
- cooldown--;
- return;
- } else if(this.mana == this.getMaxMana())
- return;
- boolean needSync = false;
- for(int i = -1; i <= 1; i++)
- for(int j = -1; j <= 1; j++) {
- int x = posX + i;
- int z = posZ + j;
- TileEntity tile = world.getTileEntity(x, posY, z);
- if(tile != null && tile instanceof TileGameBoard) {
- TileGameBoard board = (TileGameBoard)tile;
- if(board.isSingleGame) {
- if(!board.hasGame()) {
- board.setPlayer(playerName, true);
- cooldown = 120;
- } else {
- if(!board.playersName[0].equals(playerName))
- board.playersName[0] = playerName;
- if(!board.isCustomGame)
- board.isCustomGame = true;
- if(board.endGameTick == 0) {
- int winCount = (board.slotChance[0] + board.slotChance[1]) - (board.slotChance[2] + board.slotChance[3]);
- if(winCount > 0) {
- mana = Math.min(this.getMaxMana(), this.mana + (workMana * winCount));
- needSync = true;
- }
- board.finishGame(false);
- } else
- board.dropDice(playerName);
- cooldown = 120;
- }
- board.changeCustomStack(flowerStack);
- }
- }
- }
- if(needSync)
- sync();
- }
-
- public RadiusDescriptor getRadius() {
- return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
- }
-
- public int getMaxMana() {
- return 16000;
- }
-
- public int getColor() {
- return 0xdf3596;
- }
-
- public LexiconEntry getEntry() {
- return RecipeListAB.azartFlower;
- }
-
- public void writeToPacketNBT(NBTTagCompound cmp) {
- super.writeToPacketNBT(cmp);
- cmp.setInteger("cooldown", this.cooldown);
- }
-
- public void readFromPacketNBT(NBTTagCompound cmp) {
- super.readFromPacketNBT(cmp);
- this.cooldown = cmp.getInteger("cooldown");
- }
-}
\ No newline at end of file
+ public static final String playerName = "ArdentAzarcissus#21sda2gaj91*21df#111sfq3jrns@#";
+ public static final ItemStack flowerStack = ItemBlockSpecialFlower.ofType("ardentAzarcissus");
+
+ int cooldown;
+ int workMana = 320;
+
+ public void onUpdate() {
+ super.onUpdate();
+ World world = this.supertile.getWorldObj();
+ int posX = this.supertile.xCoord;
+ int posY = this.supertile.yCoord;
+ int posZ = this.supertile.zCoord;
+ if (world.isRemote) return;
+ if (cooldown > 0) {
+ cooldown--;
+ return;
+ } else if (this.mana == this.getMaxMana()) return;
+ boolean needSync = false;
+ for (int i = -1; i <= 1; i++) for (int j = -1; j <= 1; j++) {
+ int x = posX + i;
+ int z = posZ + j;
+ TileEntity tile = world.getTileEntity(x, posY, z);
+ if (tile != null && tile instanceof TileGameBoard) {
+ TileGameBoard board = (TileGameBoard) tile;
+ if (board.isSingleGame) {
+ if (!board.hasGame()) {
+ board.setPlayer(playerName, true);
+ cooldown = 120;
+ } else {
+ if (!board.playersName[0].equals(playerName)) board.playersName[0] = playerName;
+ if (!board.isCustomGame) board.isCustomGame = true;
+ if (board.endGameTick == 0) {
+ int winCount = (board.slotChance[0] + board.slotChance[1])
+ - (board.slotChance[2] + board.slotChance[3]);
+ if (winCount > 0) {
+ mana = Math.min(this.getMaxMana(), this.mana + (workMana * winCount));
+ needSync = true;
+ }
+ board.finishGame(false);
+ } else board.dropDice(playerName);
+ cooldown = 120;
+ }
+ board.changeCustomStack(flowerStack);
+ }
+ }
+ }
+ if (needSync) sync();
+ }
+
+ public RadiusDescriptor getRadius() {
+ return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
+ }
+
+ public int getMaxMana() {
+ return 16000;
+ }
+
+ public int getColor() {
+ return 0xdf3596;
+ }
+
+ public LexiconEntry getEntry() {
+ return RecipeListAB.azartFlower;
+ }
+
+ public void writeToPacketNBT(NBTTagCompound cmp) {
+ super.writeToPacketNBT(cmp);
+ cmp.setInteger("cooldown", this.cooldown);
+ }
+
+ public void readFromPacketNBT(NBTTagCompound cmp) {
+ super.readFromPacketNBT(cmp);
+ this.cooldown = cmp.getInteger("cooldown");
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/SubTileAspecolus.java b/src/main/java/ab/common/block/subtile/SubTileAspecolus.java
index a6148d8..4762c60 100644
--- a/src/main/java/ab/common/block/subtile/SubTileAspecolus.java
+++ b/src/main/java/ab/common/block/subtile/SubTileAspecolus.java
@@ -2,99 +2,98 @@ package ab.common.block.subtile;
import java.util.ArrayList;
import java.util.List;
-import java.util.Random;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
+
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
-import thaumcraft.common.lib.network.playerdata.PacketSyncAspects;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
+import ab.common.lib.register.RecipeListAB;
public class SubTileAspecolus extends SubTileFunctional {
- protected static int manaRequare = 1250;
- int cooldown = 0;
-
- public void onUpdate() {
- super.onUpdate();
- World world = this.supertile.getWorldObj();
- if(world.isRemote)
- return;
- if(this.cooldown > 0)
- this.cooldown -= 1;
- int posX = this.supertile.xCoord;
- int posY = this.supertile.yCoord;
- int posZ = this.supertile.zCoord;
- List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)));
- int countPlayer = 0;
- for(EntityPlayer p : players) {
- if(!(this.mana >= this.manaRequare))
- break;
- else if(this.cooldown > 0)
- break;
- AspectList aspList = Thaumcraft.proxy.playerKnowledge.getAspectsDiscovered(p.getDisplayName());
- ArrayList aspects = new ArrayList();
- for(Aspect a : aspList.getAspects()) {
- if(!Aspect.getPrimalAspects().contains(a) && Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0)
- aspects.add(a);
- }
- if(aspects.isEmpty())
- continue;
- for(int i = 0; i < 8; i++) {
- Aspect a = aspects.get(world.rand.nextInt(aspects.size()));
- if(!(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0))
- continue;
- Aspect[] components = a.getComponents();
- aspList.reduce(a, 1);
- for(int r = 0; r < components.length; r++) {
- if(world.rand.nextInt(100) < 70)
- continue;
- Thaumcraft.proxy.playerKnowledge.addAspectPool(p.getDisplayName(), components[r], (short) 1);
- PacketHandler.INSTANCE.sendTo(new PacketAspectPool(components[r].getTag(), (short) 1, Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), components[r])),
- (EntityPlayerMP) p);
- }
- }
- this.mana -= this.manaRequare;
- this.sync();
- ++countPlayer;
- }
- if(countPlayer > 0)
- this.cooldown = 75 * countPlayer;
- }
-
- public RadiusDescriptor getRadius() {
- return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
- }
-
- public int getMaxMana() {
- return 15000;
- }
-
- public int getColor() {
- return 0x8a20dc;
- }
-
- public LexiconEntry getEntry() {
- return RecipeListAB.aspecolus;
- }
-
- public void writeToPacketNBT(NBTTagCompound cmp) {
- super.writeToPacketNBT(cmp);
- cmp.setInteger("cooldown", this.cooldown);
- }
-
- public void readFromPacketNBT(NBTTagCompound cmp) {
- super.readFromPacketNBT(cmp);
- this.cooldown = cmp.getInteger("cooldown");
- }
-}
\ No newline at end of file
+ protected static int manaRequare = 1250;
+ int cooldown = 0;
+
+ public void onUpdate() {
+ super.onUpdate();
+ World world = this.supertile.getWorldObj();
+ if (world.isRemote) return;
+ if (this.cooldown > 0) this.cooldown -= 1;
+ int posX = this.supertile.xCoord;
+ int posY = this.supertile.yCoord;
+ int posZ = this.supertile.zCoord;
+ List players = world.getEntitiesWithinAABB(
+ EntityPlayer.class,
+ AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)));
+ int countPlayer = 0;
+ for (EntityPlayer p : players) {
+ if (!(this.mana >= this.manaRequare)) break;
+ else if (this.cooldown > 0) break;
+ AspectList aspList = Thaumcraft.proxy.playerKnowledge.getAspectsDiscovered(p.getDisplayName());
+ ArrayList aspects = new ArrayList();
+ for (Aspect a : aspList.getAspects()) {
+ if (!Aspect.getPrimalAspects().contains(a)
+ && Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0)
+ aspects.add(a);
+ }
+ if (aspects.isEmpty()) continue;
+ for (int i = 0; i < 8; i++) {
+ Aspect a = aspects.get(world.rand.nextInt(aspects.size()));
+ if (!(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0)) continue;
+ Aspect[] components = a.getComponents();
+ aspList.reduce(a, 1);
+ for (int r = 0; r < components.length; r++) {
+ if (world.rand.nextInt(100) < 70) continue;
+ Thaumcraft.proxy.playerKnowledge.addAspectPool(p.getDisplayName(), components[r], (short) 1);
+ PacketHandler.INSTANCE.sendTo(
+ new PacketAspectPool(
+ components[r].getTag(),
+ (short) 1,
+ Thaumcraft.proxy.playerKnowledge
+ .getAspectPoolFor(p.getCommandSenderName(), components[r])),
+ (EntityPlayerMP) p);
+ }
+ }
+ this.mana -= this.manaRequare;
+ this.sync();
+ ++countPlayer;
+ }
+ if (countPlayer > 0) this.cooldown = 75 * countPlayer;
+ }
+
+ public RadiusDescriptor getRadius() {
+ return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
+ }
+
+ public int getMaxMana() {
+ return 15000;
+ }
+
+ public int getColor() {
+ return 0x8a20dc;
+ }
+
+ public LexiconEntry getEntry() {
+ return RecipeListAB.aspecolus;
+ }
+
+ public void writeToPacketNBT(NBTTagCompound cmp) {
+ super.writeToPacketNBT(cmp);
+ cmp.setInteger("cooldown", this.cooldown);
+ }
+
+ public void readFromPacketNBT(NBTTagCompound cmp) {
+ super.readFromPacketNBT(cmp);
+ this.cooldown = cmp.getInteger("cooldown");
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/SubTileDictarius.java b/src/main/java/ab/common/block/subtile/SubTileDictarius.java
index 764ac26..604c048 100644
--- a/src/main/java/ab/common/block/subtile/SubTileDictarius.java
+++ b/src/main/java/ab/common/block/subtile/SubTileDictarius.java
@@ -2,10 +2,7 @@ package ab.common.block.subtile;
import java.util.List;
-import ab.common.core.handler.ConfigABHandler;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,105 +13,126 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.block.tile.TileSpecialFlower;
+import ab.common.core.handler.ConfigABHandler;
+import ab.common.lib.register.RecipeListAB;
public class SubTileDictarius extends SubTileGenerating {
-
- private static final int workMana = 480;
- int cooldown;
-
- public void onUpdate() {
- super.onUpdate();
- if(this.supertile.getWorldObj().isRemote)
- return;
- int posX = this.supertile.xCoord;
- int posY = this.supertile.yCoord;
- int posZ = this.supertile.zCoord;
- World world = this.supertile.getWorldObj();
- if(world.getTotalWorldTime() % 1200 == 0)
- checkNearDictarius();
- if(this.mana != this.getMaxMana() && cooldown == 0) {
- List livs = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(2, 1, 2));
- int workMana = 0;
- int villagers = 0;
- if(!livs.isEmpty()) {
- for(int i = 0; i < Math.min(livs.size(), 16); i++) {
- EntityLivingBase liv = livs.get(i);
- if(liv instanceof EntityPlayer)
- workMana += SubTileDictarius.workMana;
- else if(!world.isRemote && liv instanceof EntityVillager) {
- workMana += (int)(SubTileDictarius.workMana / 6);
- if(villagers > 15 && world.rand.nextInt(100) <= 4)
- liv.setDead();
- villagers++;
- }
- }
- }
- if(workMana > 0) {
- this.cooldown = 200;
- workMana *= Math.random();
- this.mana = Math.min(this.getMaxMana(), this.mana + workMana);
- sync();
- }
- }
- if(cooldown > 0)
- cooldown -= 1;
- }
-
- public RadiusDescriptor getRadius() {
- return new RadiusDescriptor.Square(toChunkCoordinates(), 2);
- }
-
- public void checkNearDictarius() {
- int findedFlower = 0;
- for(int z = -4; z < 4; z++) {
- for(int x = -4; x < 4; x++) {
- for(int y = -4; y < 4; y++) {
- int posX = this.supertile.xCoord + x;
- int posY = this.supertile.yCoord + y;
- int posZ = this.supertile.zCoord + z;
- TileEntity tile = this.supertile.getWorldObj().getTileEntity(posX, posY, posZ);
- if(tile != null && tile instanceof TileSpecialFlower) {
- TileSpecialFlower tileFlower = (TileSpecialFlower)tile;
- if(tileFlower.subTileName.equals("dictarius")) {
- if(findedFlower >= ConfigABHandler.maxDictariusCount) {
- this.supertile.getWorldObj().playAuxSFX(2001, this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord, Block.getIdFromBlock(this.supertile.getBlockType()));
- if(this.supertile.getWorldObj().getBlock(this.supertile.xCoord, this.supertile.yCoord - 1, this.supertile.zCoord).isSideSolid((IBlockAccess)this.supertile.getWorldObj(), this.supertile.xCoord, this.supertile.yCoord - 1, this.supertile.zCoord, ForgeDirection.UP))
- this.supertile.getWorldObj().setBlock(this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord, (Block)Blocks.deadbush);
- else
- this.supertile.getWorldObj().setBlockToAir(this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord);
- return;
- }
- findedFlower++;
- }
- }
- }
- }
- }
- }
-
- public int getMaxMana() {
- return 8000;
- }
-
- public int getColor() {
- return 0xd2cdb2;
- }
-
- public LexiconEntry getEntry() {
- return RecipeListAB.dictarius;
- }
-
- public void writeToPacketNBT(NBTTagCompound cmp) {
- super.writeToPacketNBT(cmp);
- cmp.setInteger("cooldown", this.cooldown);
- }
-
- public void readFromPacketNBT(NBTTagCompound cmp) {
- super.readFromPacketNBT(cmp);
- this.cooldown = cmp.getInteger("cooldown");
- }
-}
\ No newline at end of file
+
+ private static final int workMana = 480;
+ int cooldown;
+
+ public void onUpdate() {
+ super.onUpdate();
+ if (this.supertile.getWorldObj().isRemote) return;
+ int posX = this.supertile.xCoord;
+ int posY = this.supertile.yCoord;
+ int posZ = this.supertile.zCoord;
+ World world = this.supertile.getWorldObj();
+ if (world.getTotalWorldTime() % 1200 == 0) checkNearDictarius();
+ if (this.mana != this.getMaxMana() && cooldown == 0) {
+ List livs = world.getEntitiesWithinAABB(
+ EntityLivingBase.class,
+ AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(2, 1, 2));
+ int workMana = 0;
+ int villagers = 0;
+ if (!livs.isEmpty()) {
+ for (int i = 0; i < Math.min(livs.size(), 16); i++) {
+ EntityLivingBase liv = livs.get(i);
+ if (liv instanceof EntityPlayer) workMana += SubTileDictarius.workMana;
+ else if (!world.isRemote && liv instanceof EntityVillager) {
+ workMana += (int) (SubTileDictarius.workMana / 6);
+ if (villagers > 15 && world.rand.nextInt(100) <= 4) liv.setDead();
+ villagers++;
+ }
+ }
+ }
+ if (workMana > 0) {
+ this.cooldown = 200;
+ workMana *= Math.random();
+ this.mana = Math.min(this.getMaxMana(), this.mana + workMana);
+ sync();
+ }
+ }
+ if (cooldown > 0) cooldown -= 1;
+ }
+
+ public RadiusDescriptor getRadius() {
+ return new RadiusDescriptor.Square(toChunkCoordinates(), 2);
+ }
+
+ public void checkNearDictarius() {
+ int findedFlower = 0;
+ for (int z = -4; z < 4; z++) {
+ for (int x = -4; x < 4; x++) {
+ for (int y = -4; y < 4; y++) {
+ int posX = this.supertile.xCoord + x;
+ int posY = this.supertile.yCoord + y;
+ int posZ = this.supertile.zCoord + z;
+ TileEntity tile = this.supertile.getWorldObj().getTileEntity(posX, posY, posZ);
+ if (tile != null && tile instanceof TileSpecialFlower) {
+ TileSpecialFlower tileFlower = (TileSpecialFlower) tile;
+ if (tileFlower.subTileName.equals("dictarius")) {
+ if (findedFlower >= ConfigABHandler.maxDictariusCount) {
+ this.supertile.getWorldObj().playAuxSFX(
+ 2001,
+ this.supertile.xCoord,
+ this.supertile.yCoord,
+ this.supertile.zCoord,
+ Block.getIdFromBlock(this.supertile.getBlockType()));
+ if (this.supertile.getWorldObj()
+ .getBlock(
+ this.supertile.xCoord,
+ this.supertile.yCoord - 1,
+ this.supertile.zCoord)
+ .isSideSolid(
+ (IBlockAccess) this.supertile.getWorldObj(),
+ this.supertile.xCoord,
+ this.supertile.yCoord - 1,
+ this.supertile.zCoord,
+ ForgeDirection.UP))
+ this.supertile.getWorldObj().setBlock(
+ this.supertile.xCoord,
+ this.supertile.yCoord,
+ this.supertile.zCoord,
+ (Block) Blocks.deadbush);
+ else this.supertile.getWorldObj().setBlockToAir(
+ this.supertile.xCoord,
+ this.supertile.yCoord,
+ this.supertile.zCoord);
+ return;
+ }
+ findedFlower++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public int getMaxMana() {
+ return 8000;
+ }
+
+ public int getColor() {
+ return 0xd2cdb2;
+ }
+
+ public LexiconEntry getEntry() {
+ return RecipeListAB.dictarius;
+ }
+
+ public void writeToPacketNBT(NBTTagCompound cmp) {
+ super.writeToPacketNBT(cmp);
+ cmp.setInteger("cooldown", this.cooldown);
+ }
+
+ public void readFromPacketNBT(NBTTagCompound cmp) {
+ super.readFromPacketNBT(cmp);
+ this.cooldown = cmp.getInteger("cooldown");
+ }
+}
diff --git a/src/main/java/ab/common/block/subtile/SubTilePureGladiolus.java b/src/main/java/ab/common/block/subtile/SubTilePureGladiolus.java
index cfee5ae..43691bd 100644
--- a/src/main/java/ab/common/block/subtile/SubTilePureGladiolus.java
+++ b/src/main/java/ab/common/block/subtile/SubTilePureGladiolus.java
@@ -2,88 +2,93 @@ package ab.common.block.subtile;
import java.util.List;
-import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
+
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.entities.EntityAspectOrb;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
-import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
+import ab.common.lib.register.RecipeListAB;
public class SubTilePureGladiolus extends SubTileFunctional {
- private static final int MAX_MANA = 10000;
- private static final String COOLDOWN_TAG = "Cooldown";
- private static final Aspect[] PRIMALS = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE };
+ private static final int MAX_MANA = 10000;
+ private static final String COOLDOWN_TAG = "Cooldown";
+ private static final Aspect[] PRIMALS = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.ENTROPY,
+ Aspect.ORDER, Aspect.FIRE };
- private int cooldown = 180;
- protected static int manaRequare = 1000;
+ private int cooldown = 180;
+ protected static int manaRequare = 1000;
- public void onUpdate() {
- super.onUpdate();
- int tick = 1;
- World world = this.supertile.getWorldObj();
- int x = this.supertile.xCoord;
- int y = this.supertile.yCoord;
- int z = this.supertile.zCoord;
- List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1)).expand(1.9f, 1.2f, 1.9f));
- if(world.getBlock(x, y + 1, z).getMaterial() != Material.air)
- return;
- else if(world.getBlock(x, y - 1, z) == ModBlocks.enchantedSoil)
- tick = 2;
- if(players.isEmpty())
- return;
- if(cooldown > 0)
- cooldown -= tick;
- else if(mana >= manaRequare && cooldown <= 0) {
- mana -= manaRequare;
- cooldown = 180;
- spawnAspectOrbs(world, x + 0.5, y + 1.0, z + 0.5);
- }
- }
-
- public RadiusDescriptor getRadius() {
- return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
- }
-
- public LexiconEntry getEntry() {
- return RecipeListAB.gladious;
- }
+ public void onUpdate() {
+ super.onUpdate();
+ int tick = 1;
+ World world = this.supertile.getWorldObj();
+ int x = this.supertile.xCoord;
+ int y = this.supertile.yCoord;
+ int z = this.supertile.zCoord;
+ List players = world.getEntitiesWithinAABB(
+ EntityPlayer.class,
+ AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1)).expand(1.9f, 1.2f, 1.9f));
+ if (world.getBlock(x, y + 1, z).getMaterial() != Material.air) return;
+ else if (world.getBlock(x, y - 1, z) == ModBlocks.enchantedSoil) tick = 2;
+ if (players.isEmpty()) return;
+ if (cooldown > 0) cooldown -= tick;
+ else if (mana >= manaRequare && cooldown <= 0) {
+ mana -= manaRequare;
+ cooldown = 180;
+ spawnAspectOrbs(world, x + 0.5, y + 1.0, z + 0.5);
+ }
+ }
- public void spawnAspectOrbs(World world, double x, double y, double z) {
- if(!world.isRemote) {
- for (int i = 0; i < 3 + world.rand.nextInt(3); i++) {
- EntityAspectOrb orb = new EntityAspectOrb(world, x, y, z, PRIMALS[world.rand.nextInt(6)], 2 + world.rand.nextInt(3));
- orb.motionX = 0.05 - Math.random() * 0.1;
- orb.motionY = 0.07;
- orb.motionZ = 0.05 - Math.random() * 0.1;
- world.spawnEntityInWorld(orb);
- }
- this.sync();
- }
- }
+ public RadiusDescriptor getRadius() {
+ return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
+ }
- public int getColor() {
- return 0xFF00FF;
- }
+ public LexiconEntry getEntry() {
+ return RecipeListAB.gladious;
+ }
- public int getMaxMana() {
- return MAX_MANA;
- }
+ public void spawnAspectOrbs(World world, double x, double y, double z) {
+ if (!world.isRemote) {
+ for (int i = 0; i < 3 + world.rand.nextInt(3); i++) {
+ EntityAspectOrb orb = new EntityAspectOrb(
+ world,
+ x,
+ y,
+ z,
+ PRIMALS[world.rand.nextInt(6)],
+ 2 + world.rand.nextInt(3));
+ orb.motionX = 0.05 - Math.random() * 0.1;
+ orb.motionY = 0.07;
+ orb.motionZ = 0.05 - Math.random() * 0.1;
+ world.spawnEntityInWorld(orb);
+ }
+ this.sync();
+ }
+ }
- public void writeToPacketNBT(NBTTagCompound cmp) {
- super.writeToPacketNBT(cmp);
- cmp.setInteger(COOLDOWN_TAG, this.cooldown);
- }
+ public int getColor() {
+ return 0xFF00FF;
+ }
- public void readFromPacketNBT(NBTTagCompound cmp) {
- super.readFromPacketNBT(cmp);
- this.cooldown = cmp.getInteger(COOLDOWN_TAG);
- }
-}
\ No newline at end of file
+ public int getMaxMana() {
+ return MAX_MANA;
+ }
+
+ public void writeToPacketNBT(NBTTagCompound cmp) {
+ super.writeToPacketNBT(cmp);
+ cmp.setInteger(COOLDOWN_TAG, this.cooldown);
+ }
+
+ public void readFromPacketNBT(NBTTagCompound cmp) {
+ super.readFromPacketNBT(cmp);
+ this.cooldown = cmp.getInteger(COOLDOWN_TAG);
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileABSpreader.java b/src/main/java/ab/common/block/tile/TileABSpreader.java
index 103a888..b98d16e 100644
--- a/src/main/java/ab/common/block/tile/TileABSpreader.java
+++ b/src/main/java/ab/common/block/tile/TileABSpreader.java
@@ -1,122 +1,130 @@
package ab.common.block.tile;
-import java.util.UUID;
-
-import org.lwjgl.opengl.GL11;
-
-import ab.common.core.handler.ConfigABHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
-import vazkii.botania.api.internal.IManaBurst;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILensEffect;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import vazkii.botania.common.entity.EntityManaBurst;
+import ab.common.core.handler.ConfigABHandler;
public class TileABSpreader extends TileSpreader {
-
- protected boolean requestsClientUpdate = false;
- protected int knownMana = -1;
- protected IManaReceiver receiver = null;
-
- public void readCustomNBT(NBTTagCompound cmp) {
- super.readCustomNBT(cmp);
- this.requestsClientUpdate = cmp.getBoolean("requestUpdate");
- if(cmp.hasKey("knownMana"))
- this.knownMana = cmp.getInteger("knownMana");
- if(this.requestsClientUpdate && this.worldObj != null) {
- int x = cmp.getInteger("forceClientBindingX");
- int y = cmp.getInteger("forceClientBindingY");
- int z = cmp.getInteger("forceClientBindingZ");
- if(y != -1) {
- TileEntity tile = this.worldObj.getTileEntity(x, y, z);
- if(tile instanceof IManaReceiver) {
- this.receiver = (IManaReceiver)tile;
- } else {
- this.receiver = null;
- }
- } else {
- this.receiver = null;
- }
- }
- }
-
- public EntityManaBurst getBurst(boolean fake) {
- EntityManaBurst burst = new EntityManaBurst(this, fake);
- int maxMana = ConfigABHandler.spreaderBurstMana;
- int color = 0xcdd419;
- int ticksBeforeManaLoss = 35;
- float manaLossPerTick = ConfigABHandler.spreaderBurstMana / 4.5f;
- float motionModifier = 2.5f;
- float gravity = 0.0F;
- BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
- ItemStack lens = getStackInSlot(0);
- if(lens != null && lens.getItem() instanceof ILensEffect)
- ((ILensEffect)lens.getItem()).apply(lens, props);
- burst.setSourceLens(lens);
- if(getCurrentMana() >= props.maxMana || fake) {
- burst.setColor(props.color);
- burst.setMana(props.maxMana);
- burst.setStartingMana(props.maxMana);
- burst.setMinManaLoss(props.ticksBeforeManaLoss);
- burst.setManaLossPerTick(props.manaLossPerTick);
- burst.setGravity(props.gravity);
- burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
- return burst;
- }
- return null;
- }
-
+
+ protected boolean requestsClientUpdate = false;
+ protected int knownMana = -1;
+ protected IManaReceiver receiver = null;
+
+ public void readCustomNBT(NBTTagCompound cmp) {
+ super.readCustomNBT(cmp);
+ this.requestsClientUpdate = cmp.getBoolean("requestUpdate");
+ if (cmp.hasKey("knownMana")) this.knownMana = cmp.getInteger("knownMana");
+ if (this.requestsClientUpdate && this.worldObj != null) {
+ int x = cmp.getInteger("forceClientBindingX");
+ int y = cmp.getInteger("forceClientBindingY");
+ int z = cmp.getInteger("forceClientBindingZ");
+ if (y != -1) {
+ TileEntity tile = this.worldObj.getTileEntity(x, y, z);
+ if (tile instanceof IManaReceiver) {
+ this.receiver = (IManaReceiver) tile;
+ } else {
+ this.receiver = null;
+ }
+ } else {
+ this.receiver = null;
+ }
+ }
+ }
+
+ public EntityManaBurst getBurst(boolean fake) {
+ EntityManaBurst burst = new EntityManaBurst(this, fake);
+ int maxMana = ConfigABHandler.spreaderBurstMana;
+ int color = 0xcdd419;
+ int ticksBeforeManaLoss = 35;
+ float manaLossPerTick = ConfigABHandler.spreaderBurstMana / 4.5f;
+ float motionModifier = 2.5f;
+ float gravity = 0.0F;
+ BurstProperties props = new BurstProperties(
+ maxMana,
+ ticksBeforeManaLoss,
+ manaLossPerTick,
+ gravity,
+ motionModifier,
+ color);
+ ItemStack lens = getStackInSlot(0);
+ if (lens != null && lens.getItem() instanceof ILensEffect) ((ILensEffect) lens.getItem()).apply(lens, props);
+ burst.setSourceLens(lens);
+ if (getCurrentMana() >= props.maxMana || fake) {
+ burst.setColor(props.color);
+ burst.setMana(props.maxMana);
+ burst.setStartingMana(props.maxMana);
+ burst.setMinManaLoss(props.ticksBeforeManaLoss);
+ burst.setManaLossPerTick(props.manaLossPerTick);
+ burst.setGravity(props.gravity);
+ burst.setMotion(
+ burst.motionX * props.motionModifier,
+ burst.motionY * props.motionModifier,
+ burst.motionZ * props.motionModifier);
+ return burst;
+ }
+ return null;
+ }
+
public void renderHUD(Minecraft mc, ScaledResolution res) {
- String name = StatCollector.translateToLocal("tile.advancedSpreader.name");
+ String name = StatCollector.translateToLocal("tile.advancedSpreader.name");
int color = 0xcdd419;
HUDHandler.drawSimpleManaHUD(color, this.knownMana, getMaxMana(), name, res);
ItemStack lens = getStackInSlot(0);
- if(lens != null) {
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- String lensName = lens.getDisplayName();
- int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2;
- int x = res.getScaledWidth() / 2 - width;
- int y = res.getScaledHeight() / 2 + 50;
- mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, lens, x, y);
- RenderHelper.disableStandardItemLighting();
- GL11.glDisable(2896);
- GL11.glDisable(3042);
- }
- if(this.receiver != null) {
- TileEntity receiverTile = (TileEntity)this.receiver;
- ItemStack recieverStack = new ItemStack(this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata());
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- if(recieverStack != null && recieverStack.getItem() != null) {
- String stackName = recieverStack.getDisplayName();
- int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
- int x = res.getScaledWidth() / 2 - width;
- int y = res.getScaledHeight() / 2 + 30;
- mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
- RenderHelper.disableStandardItemLighting();
- }
- GL11.glDisable(2896);
- GL11.glDisable(3042);
- }
+ if (lens != null) {
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ String lensName = lens.getDisplayName();
+ int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2;
+ int x = res.getScaledWidth() / 2 - width;
+ int y = res.getScaledHeight() / 2 + 50;
+ mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, lens, x, y);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(2896);
+ GL11.glDisable(3042);
+ }
+ if (this.receiver != null) {
+ TileEntity receiverTile = (TileEntity) this.receiver;
+ ItemStack recieverStack = new ItemStack(
+ this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord),
+ 1,
+ receiverTile.getBlockMetadata());
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ if (recieverStack != null && recieverStack.getItem() != null) {
+ String stackName = recieverStack.getDisplayName();
+ int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
+ int x = res.getScaledWidth() / 2 - width;
+ int y = res.getScaledHeight() / 2 + 30;
+ mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance()
+ .renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
+ RenderHelper.disableStandardItemLighting();
+ }
+ GL11.glDisable(2896);
+ GL11.glDisable(3042);
+ }
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
-
- public int getMaxMana() {
+
+ public int getMaxMana() {
return ConfigABHandler.spreaderMaxMana;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ab/common/block/tile/TileBoardFate.java b/src/main/java/ab/common/block/tile/TileBoardFate.java
index 48fcc04..09d7439 100644
--- a/src/main/java/ab/common/block/tile/TileBoardFate.java
+++ b/src/main/java/ab/common/block/tile/TileBoardFate.java
@@ -2,8 +2,6 @@ package ab.common.block.tile;
import java.util.List;
-import ab.api.AdvancedBotanyAPI;
-import ab.common.core.handler.ConfigABHandler;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -14,156 +12,164 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Vec3;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IRelic;
-import vazkii.botania.common.item.relic.ItemDice;
import vazkii.botania.common.item.relic.ItemRelic;
+import ab.api.AdvancedBotanyAPI;
+import ab.common.core.handler.ConfigABHandler;
public class TileBoardFate extends TileInventory {
-
- public byte[] slotChance = new byte[getSizeInventory()];
- public int clientTick[] = new int[] { 0, 0, 0, 0 };
- public boolean requestUpdate;
-
- public void updateEntity() {
- if(!worldObj.isRemote)
- updateServer();
- else
- updateAnimationTicks();
- }
-
- public void updateAnimationTicks() {
- for(int i = 0; i < getSizeInventory(); i++)
- if(getStackInSlot(i) != null)
- clientTick[i]++;
- else
- clientTick[i] = 0;
- }
-
- protected void updateServer() {
- if(requestUpdate)
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- boolean hasUpdate = false;
- if(hasFreeSlot())
- hasUpdate = setDiceFate();
- requestUpdate = hasUpdate;
- }
-
- public boolean spawnRelic(EntityPlayer player) {
- int relicCount = 0;
- for(int i = 0; i < getSizeInventory(); i++) {
- if(getStackInSlot(i) == null)
- slotChance[i] = 0;
- else if(!ItemRelic.isRightPlayer(player, getStackInSlot(i))) {
- if(!worldObj.isRemote)
- dropRelic(player, i);
- return true;
- }
- else
- setInventorySlotContents(i, null);
- relicCount += slotChance[i];
- }
- if(relicCount < 1)
- return false;
- else if(!worldObj.isRemote) {
- ItemStack relic = AdvancedBotanyAPI.relicList.get(Math.min(relicCount - 1, AdvancedBotanyAPI.relicList.size() - 1)).copy();
- worldObj.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
- if(hasRelicAchievement(player, relic) || !ConfigABHandler.fateBoardRelicEnables[relicCount - 1]) {
- player.addChatMessage((new ChatComponentTranslation("botaniamisc.dudDiceRoll", new Object[] { Integer.valueOf(relicCount) })).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
- } else {
- ItemRelic.updateRelic(relic, player);
- EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, relic);
- player.addChatMessage((new ChatComponentTranslation("botaniamisc.diceRoll", new Object[] { Integer.valueOf(relicCount) })).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
- worldObj.spawnEntityInWorld(entityItem);
- }
- requestUpdate = true;
- }
- return true;
- }
-
- private void dropRelic(EntityPlayer player, int slot) {
- EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5f, yCoord + 0.8f, zCoord + 0.5f, getStackInSlot(slot).copy());
- float f3 = 0.15F;
- Vec3 vec = player.getLookVec();
- entityItem.motionX = vec.xCoord * f3;
- entityItem.motionY = 0.25F;
- entityItem.motionZ = vec.zCoord * f3;
- setInventorySlotContents(slot, null);
- worldObj.spawnEntityInWorld(entityItem);
- }
-
- public static boolean hasRelicAchievement(EntityPlayer player, ItemStack rStack) {
- EntityPlayerMP mpPlayer = (EntityPlayerMP)player;
- IRelic irelic = (IRelic)rStack.getItem();
- if(irelic.getBindAchievement() == null)
- return false;
- return mpPlayer.func_147099_x().hasAchievementUnlocked(irelic.getBindAchievement());
- }
-
- protected boolean hasFreeSlot() {
- for(int i = 0; i < getSizeInventory(); i++)
- if(getStackInSlot(i) == null)
- return true;
- return false;
- }
-
- protected boolean setDiceFate() {
- boolean hasUpdate = false;
- List items = this.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 0.7f), (this.zCoord + 1)));
- label666: for(EntityItem item : items) {
- if(!item.isDead && item.getEntityItem() != null) {
- ItemStack stack = item.getEntityItem();
- if(!isDice(stack))
- continue;
- for(int s = 0; s < getSizeInventory(); s++) {
- ItemStack slotStack = getStackInSlot(s);
- if(slotStack != null)
- continue;
- ItemStack copy = stack.copy();
- copy.stackSize = 1;
- setInventorySlotContents(s, copy);
- slotChance[s] = (byte)(worldObj.rand.nextInt(6) + 1);
- stack.stackSize--;
- if(stack.stackSize == 0)
- item.setDead();
- hasUpdate = true;
- worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
- break label666;
- }
- }
- }
- return hasUpdate;
- }
-
- public static boolean isDice(ItemStack stack) {
- for(ItemStack dice : AdvancedBotanyAPI.diceList) {
- if(dice.getItem() == stack.getItem() && (dice.getItemDamage() == stack.getItemDamage() || dice.getItemDamage() == 32767))
- return true;
- }
- return false;
- }
-
- public void writeCustomNBT(NBTTagCompound cmp) {
- super.writeCustomNBT(cmp);
- cmp.setByteArray("slotChance", slotChance);
- cmp.setBoolean("requestUpdate", requestUpdate);
- }
-
- public void readCustomNBT(NBTTagCompound cmp) {
- super.readCustomNBT(cmp);
- slotChance = cmp.getByteArray("slotChance");
- requestUpdate = cmp.getBoolean("requestUpdate");
- }
- public int getInventoryStackLimit() {
- return 1;
- }
+ public byte[] slotChance = new byte[getSizeInventory()];
+ public int clientTick[] = new int[] { 0, 0, 0, 0 };
+ public boolean requestUpdate;
- public String getInventoryName() {
- return "inv.boardFate";
- }
+ public void updateEntity() {
+ if (!worldObj.isRemote) updateServer();
+ else updateAnimationTicks();
+ }
- public int getSizeInventory() {
- return 2;
- }
-}
\ No newline at end of file
+ public void updateAnimationTicks() {
+ for (int i = 0; i < getSizeInventory(); i++) if (getStackInSlot(i) != null) clientTick[i]++;
+ else clientTick[i] = 0;
+ }
+
+ protected void updateServer() {
+ if (requestUpdate)
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ boolean hasUpdate = false;
+ if (hasFreeSlot()) hasUpdate = setDiceFate();
+ requestUpdate = hasUpdate;
+ }
+
+ public boolean spawnRelic(EntityPlayer player) {
+ int relicCount = 0;
+ for (int i = 0; i < getSizeInventory(); i++) {
+ if (getStackInSlot(i) == null) slotChance[i] = 0;
+ else if (!ItemRelic.isRightPlayer(player, getStackInSlot(i))) {
+ if (!worldObj.isRemote) dropRelic(player, i);
+ return true;
+ } else setInventorySlotContents(i, null);
+ relicCount += slotChance[i];
+ }
+ if (relicCount < 1) return false;
+ else if (!worldObj.isRemote) {
+ ItemStack relic = AdvancedBotanyAPI.relicList
+ .get(Math.min(relicCount - 1, AdvancedBotanyAPI.relicList.size() - 1)).copy();
+ worldObj.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
+ if (hasRelicAchievement(player, relic) || !ConfigABHandler.fateBoardRelicEnables[relicCount - 1]) {
+ player.addChatMessage(
+ (new ChatComponentTranslation(
+ "botaniamisc.dudDiceRoll",
+ new Object[] { Integer.valueOf(relicCount) }))
+ .setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
+ } else {
+ ItemRelic.updateRelic(relic, player);
+ EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, relic);
+ player.addChatMessage(
+ (new ChatComponentTranslation(
+ "botaniamisc.diceRoll",
+ new Object[] { Integer.valueOf(relicCount) }))
+ .setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
+ worldObj.spawnEntityInWorld(entityItem);
+ }
+ requestUpdate = true;
+ }
+ return true;
+ }
+
+ private void dropRelic(EntityPlayer player, int slot) {
+ EntityItem entityItem = new EntityItem(
+ worldObj,
+ xCoord + 0.5f,
+ yCoord + 0.8f,
+ zCoord + 0.5f,
+ getStackInSlot(slot).copy());
+ float f3 = 0.15F;
+ Vec3 vec = player.getLookVec();
+ entityItem.motionX = vec.xCoord * f3;
+ entityItem.motionY = 0.25F;
+ entityItem.motionZ = vec.zCoord * f3;
+ setInventorySlotContents(slot, null);
+ worldObj.spawnEntityInWorld(entityItem);
+ }
+
+ public static boolean hasRelicAchievement(EntityPlayer player, ItemStack rStack) {
+ EntityPlayerMP mpPlayer = (EntityPlayerMP) player;
+ IRelic irelic = (IRelic) rStack.getItem();
+ if (irelic.getBindAchievement() == null) return false;
+ return mpPlayer.func_147099_x().hasAchievementUnlocked(irelic.getBindAchievement());
+ }
+
+ protected boolean hasFreeSlot() {
+ for (int i = 0; i < getSizeInventory(); i++) if (getStackInSlot(i) == null) return true;
+ return false;
+ }
+
+ protected boolean setDiceFate() {
+ boolean hasUpdate = false;
+ List items = this.worldObj.getEntitiesWithinAABB(
+ EntityItem.class,
+ AxisAlignedBB.getBoundingBox(
+ this.xCoord,
+ this.yCoord,
+ this.zCoord,
+ (this.xCoord + 1),
+ (this.yCoord + 0.7f),
+ (this.zCoord + 1)));
+ label666: for (EntityItem item : items) {
+ if (!item.isDead && item.getEntityItem() != null) {
+ ItemStack stack = item.getEntityItem();
+ if (!isDice(stack)) continue;
+ for (int s = 0; s < getSizeInventory(); s++) {
+ ItemStack slotStack = getStackInSlot(s);
+ if (slotStack != null) continue;
+ ItemStack copy = stack.copy();
+ copy.stackSize = 1;
+ setInventorySlotContents(s, copy);
+ slotChance[s] = (byte) (worldObj.rand.nextInt(6) + 1);
+ stack.stackSize--;
+ if (stack.stackSize == 0) item.setDead();
+ hasUpdate = true;
+ worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
+ break label666;
+ }
+ }
+ }
+ return hasUpdate;
+ }
+
+ public static boolean isDice(ItemStack stack) {
+ for (ItemStack dice : AdvancedBotanyAPI.diceList) {
+ if (dice.getItem() == stack.getItem()
+ && (dice.getItemDamage() == stack.getItemDamage() || dice.getItemDamage() == 32767))
+ return true;
+ }
+ return false;
+ }
+
+ public void writeCustomNBT(NBTTagCompound cmp) {
+ super.writeCustomNBT(cmp);
+ cmp.setByteArray("slotChance", slotChance);
+ cmp.setBoolean("requestUpdate", requestUpdate);
+ }
+
+ public void readCustomNBT(NBTTagCompound cmp) {
+ super.readCustomNBT(cmp);
+ slotChance = cmp.getByteArray("slotChance");
+ requestUpdate = cmp.getBoolean("requestUpdate");
+ }
+
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ public String getInventoryName() {
+ return "inv.boardFate";
+ }
+
+ public int getSizeInventory() {
+ return 2;
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileEngineerHopper.java b/src/main/java/ab/common/block/tile/TileEngineerHopper.java
index dcc18b5..8079b6b 100644
--- a/src/main/java/ab/common/block/tile/TileEngineerHopper.java
+++ b/src/main/java/ab/common/block/tile/TileEngineerHopper.java
@@ -1,333 +1,320 @@
package ab.common.block.tile;
-import java.util.List;
-
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IBoundRender;
-import ab.client.core.ClientHelper;
import net.minecraft.block.Block;
-import net.minecraft.block.BlockChest;
-import net.minecraft.block.BlockHopper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.command.IEntitySelector;
-import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.IHopper;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityHopper;
-import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
-import net.minecraft.util.Facing;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.MovingObjectPosition;
-import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import vazkii.botania.api.wand.IWandBindable;
-import vazkii.botania.client.core.handler.HUDHandler;
-import vazkii.botania.common.core.helper.Vector3;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.common.item.ModItems;
+import ab.api.IBoundRender;
+import ab.client.core.ClientHelper;
public class TileEngineerHopper extends TileInventory implements IHopper, IBoundRender {
- private int cooldown;
- private int[] invPosX = new int[] {0, 0};
- private int[] invPosY = new int[] {-1, -1};
- private int[] invPosZ = new int[] {0, 0};
- private int[] invSide = new int[] {-1, -1};
- private boolean bindType;
- public int redstoneSignal = 0;
-
- public void updateEntity() {
+ private int cooldown;
+ private int[] invPosX = new int[] { 0, 0 };
+ private int[] invPosY = new int[] { -1, -1 };
+ private int[] invPosZ = new int[] { 0, 0 };
+ private int[] invSide = new int[] { -1, -1 };
+ private boolean bindType;
+ public int redstoneSignal = 0;
+
+ public void updateEntity() {
this.redstoneSignal = 0;
- for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
- int redstoneSide = getWorldObj().getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
- this.redstoneSignal = Math.max(this.redstoneSignal, redstoneSide);
- }
- if(redstoneSignal > 0)
- return;
- else if(this.worldObj != null) {
- if(!this.worldObj.isRemote) {
- if(cooldown > 0)
- --cooldown;
- else if(cooldown == 0) {
- if(worldObj != null && !worldObj.isRemote) {
- boolean hasUpdate = false;
- ItemStack stack = getStackInSlot(0);
- if(stack != null)
- hasUpdate = canExtractStack();
- if(stack == null || stack.stackSize != stack.getMaxStackSize())
- hasUpdate = canInsertStack() || hasUpdate;
- if(hasUpdate)
- this.cooldown = 8;
- this.markDirty();
+ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
+ int redstoneSide = getWorldObj().getIndirectPowerLevelTo(
+ xCoord + dir.offsetX,
+ yCoord + dir.offsetY,
+ zCoord + dir.offsetZ,
+ dir.ordinal());
+ this.redstoneSignal = Math.max(this.redstoneSignal, redstoneSide);
+ }
+ if (redstoneSignal > 0) return;
+ else if (this.worldObj != null) {
+ if (!this.worldObj.isRemote) {
+ if (cooldown > 0) --cooldown;
+ else if (cooldown == 0) {
+ if (worldObj != null && !worldObj.isRemote) {
+ boolean hasUpdate = false;
+ ItemStack stack = getStackInSlot(0);
+ if (stack != null) hasUpdate = canExtractStack();
+ if (stack == null || stack.stackSize != stack.getMaxStackSize())
+ hasUpdate = canInsertStack() || hasUpdate;
+ if (hasUpdate) this.cooldown = 8;
+ this.markDirty();
}
}
- }
+ }
}
- }
-
- public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
- TileEntity tile = player.getEntityWorld().getTileEntity(x, y, z);
- boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10 || Math.abs(this.zCoord - z) >= 10;
- if(isFar)
- return false;
- int invCount = bindType ? 0 : 1;
- if(tile instanceof TileEngineerHopper)
- return false;
- else if(tile != null && tile instanceof IInventory) {
- setDistantInventory(invCount, x, y, z);
- invSide[invCount] = side;
- return true;
- } else {
- setDistantInventory(invCount, 0, -1, 0);
- invSide[invCount] = -1;
- return false;
- }
- }
-
- public void changeBindType() {
- bindType = !bindType;
- }
-
- public void setDistantInventory(int count, int posX, int posY, int posZ) {
- invPosX[count] = posX;
- invPosY[count] = posY;
- invPosZ[count] = posZ;
- }
-
- public IInventory getDistantInventory(int count) {
- IInventory inv = TileEntityHopper.func_145893_b(this.getWorldObj(), invPosX[count], invPosY[count], invPosZ[count]);
- if(inv == null)
- setDistantInventory(count, 0, -1, 0);
- return inv;
- }
-
- public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
- return true;
- }
-
- public ChunkCoordinates[] getBlocksCoord() {
- return new ChunkCoordinates[] { new ChunkCoordinates(invPosX[0], invPosY[0], invPosZ[0]), new ChunkCoordinates(invPosX[1], invPosY[1], invPosZ[1]) };
- }
-
- public ChunkCoordinates getBinding() {
- return null;
- }
-
- public void renderHUD(Minecraft mc, ScaledResolution res) {
- int x = res.getScaledWidth() / 2 - 7;
- int y = res.getScaledHeight() / 2 + 16;
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- ClientHelper.drawArrow(x - 2, y, false);
- for(int i = 0; i < 2; i++) {
- ItemStack stack = null;
- boolean hasInv = false;
- int posX = x + (i == 0 ? 32 : -32);
- if(getDistantInventory(i) != null && (TileEntity)getDistantInventory(i) != null) {
- TileEntity tile = (TileEntity)getDistantInventory(i);
- Block block = tile.getWorldObj().getBlock(tile.xCoord, tile.yCoord, tile.zCoord);
- int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
- stack = new ItemStack(block, 1, meta);
- hasInv = true;
- }
- Gui.drawRect(posX - 4, y - 4, posX + 20, y + 20, 1140850688);
- Gui.drawRect(posX - 2, y - 2, posX + 18, y + 18, 1140850688);
- if(stack != null) {
- RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(32826);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, posX, y);
- RenderHelper.disableStandardItemLighting();
- GL11.glDisable(2929);
- }
- int invCount = bindType ? 0 : 1;
- if(invCount == i) {
- GL11.glTranslatef(0.0f, 0.0f, 300.0f);
- RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(32826);
- RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.twigWand), posX + 10, y + 7);
- RenderHelper.disableStandardItemLighting();
- GL11.glDisable(2929);
- GL11.glTranslatef(0.0f, 0.0f, -300.0f);
- }
- boolean unicode = mc.fontRenderer.getUnicodeFlag();
- mc.fontRenderer.setUnicodeFlag(true);
- if(!hasInv) {
- mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 6, 4980736);
- mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 5, 13764621);
- }
- mc.fontRenderer.setUnicodeFlag(unicode);
- GL11.glEnable(2929);
- }
- GL11.glDisable(3042);
- }
-
- public void writeCustomNBT(NBTTagCompound nbtt) {
- super.writeCustomNBT(nbtt);
- nbtt.setInteger("cooldown", this.cooldown);
- nbtt.setBoolean("bindType", this.bindType);
- nbtt.setIntArray("bindingX", this.invPosX);
- nbtt.setIntArray("bindingY", this.invPosY);
- nbtt.setIntArray("bindingZ", this.invPosZ);
- nbtt.setIntArray("bindingSide", this.invSide);
- }
-
- public void readCustomNBT(NBTTagCompound nbtt) {
- super.readCustomNBT(nbtt);
- this.cooldown = nbtt.getInteger("cooldown");
- this.bindType = nbtt.getBoolean("bindType");
- this.invPosX = nbtt.getIntArray("bindingX");
- this.invPosY = nbtt.getIntArray("bindingY");
- this.invPosZ = nbtt.getIntArray("bindingZ");
- this.invSide = nbtt.getIntArray("bindingSide");
- }
-
- private boolean canExtractStack() {
- IInventory inv = getDistantInventory(0);
- if(inv == null)
- return false;
- else {
- int side = invSide[0];
- int pullCount = getPullCount(inv, side);
- System.out.println("canExtractStack " + pullCount);
- if(pullCount <= 0)
- return false;
- else {
- if(getStackInSlot(0) != null) {
- ItemStack itemstack = getStackInSlot(0).copy();
- ItemStack itemstack1 = TileEntityHopper.func_145889_a(inv, decrStackSize(0, pullCount), side);
- if(itemstack1 == null || itemstack1.stackSize == 0) {
- inv.markDirty();
- return true;
- }
- setInventorySlotContents(0, itemstack);
- }
- return false;
- }
- }
- }
+ }
- private int getPullCount(IInventory inv, int side) {
- if(inv instanceof ISidedInventory && side > -1) {
- ISidedInventory sideInv = (ISidedInventory)inv;
- int[] slots = sideInv.getAccessibleSlotsFromSide(side);
- for(int i = 0; i < slots.length; ++i) {
- ItemStack stack = sideInv.getStackInSlot(slots[i]);
- if(stack == null)
- return inv.getInventoryStackLimit();
- else if(inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
- return inv.getInventoryStackLimit() - stack.stackSize;
- }
- } else {
- int size = inv.getSizeInventory();
- for(int i = 0; i < size; ++i) {
- ItemStack stack = inv.getStackInSlot(i);
- if(stack == null)
- return inv.getInventoryStackLimit();
- else if(inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
- return inv.getInventoryStackLimit() - stack.stackSize;
- }
- }
- return 0;
- }
+ public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
+ TileEntity tile = player.getEntityWorld().getTileEntity(x, y, z);
+ boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10
+ || Math.abs(this.zCoord - z) >= 10;
+ if (isFar) return false;
+ int invCount = bindType ? 0 : 1;
+ if (tile instanceof TileEngineerHopper) return false;
+ else if (tile != null && tile instanceof IInventory) {
+ setDistantInventory(invCount, x, y, z);
+ invSide[invCount] = side;
+ return true;
+ } else {
+ setDistantInventory(invCount, 0, -1, 0);
+ invSide[invCount] = -1;
+ return false;
+ }
+ }
- private boolean canInsertStack() {
- IInventory inv = getDistantInventory(1);
- if(inv != null) {
- int side = invSide[1];
- int takeCount = getTakeCount(inv, side);
- System.out.println("canInsertStack " + takeCount);
- if(takeCount <= 0)
- return false;
- if(inv instanceof ISidedInventory && side > -1) {
- ISidedInventory sidedInv = (ISidedInventory)inv;
- int[] slots = sidedInv.getAccessibleSlotsFromSide(side);
- for(int k = 0; k < slots.length; ++k) {
- if(func_145892_a(inv, slots[k], side, takeCount))
- return true;
- }
- } else {
- int i = inv.getSizeInventory();
- for(int j = 0; j < i; ++j) {
- if(func_145892_a(inv, j, side, takeCount))
- return true;
- }
- }
- }
- return false;
- }
+ public void changeBindType() {
+ bindType = !bindType;
+ }
- private int getTakeCount(IInventory inv, int side) {
- if(inv instanceof ISidedInventory && side > -1) {
- ISidedInventory sideInv = (ISidedInventory)inv;
- int[] slots = sideInv.getAccessibleSlotsFromSide(side);
- for(int i = 0; i < slots.length; ++i) {
- ItemStack stack = sideInv.getStackInSlot(slots[i]);
- if(stack != null)
- if(getStackInSlot(0) == null)
- return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
- else if(getInventoryStackLimit() != getStackInSlot(0).stackSize && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
- return getInventoryStackLimit() - getStackInSlot(0).stackSize;
- }
- } else {
- for(int i = 0; i < inv.getSizeInventory(); ++i) {
- ItemStack stack = inv.getStackInSlot(i);
- if(stack != null)
- if(getStackInSlot(0) == null)
- return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
- else if(getInventoryStackLimit() != getStackInSlot(0).stackSize && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
- return getInventoryStackLimit() - getStackInSlot(0).stackSize;
- }
- }
- return 0;
- }
+ public void setDistantInventory(int count, int posX, int posY, int posZ) {
+ invPosX[count] = posX;
+ invPosY[count] = posY;
+ invPosZ[count] = posZ;
+ }
- private boolean func_145892_a(IInventory inv, int slot, int side, int takeCount) {
- ItemStack itemstack = inv.getStackInSlot(slot);
- if(itemstack != null && func_145890_b(inv, itemstack, slot, side)) {
- ItemStack itemstack1 = itemstack.copy();
- ItemStack itemstack2 = TileEntityHopper.func_145889_a(this, inv.decrStackSize(slot, takeCount), side);
- if(itemstack2 == null || itemstack2.stackSize == 0) {
- inv.markDirty();
- return true;
- }
- inv.setInventorySlotContents(slot, itemstack1);
- }
- return false;
- }
-
- private static boolean func_145890_b(IInventory inv, ItemStack stack, int slot, int side) {
- return !(inv instanceof ISidedInventory) || ((ISidedInventory)inv).canExtractItem(slot, stack, side);
- }
-
- public int getSizeInventory() {
- return 1;
- }
+ public IInventory getDistantInventory(int count) {
+ IInventory inv = TileEntityHopper
+ .func_145893_b(this.getWorldObj(), invPosX[count], invPosY[count], invPosZ[count]);
+ if (inv == null) setDistantInventory(count, 0, -1, 0);
+ return inv;
+ }
- public String getInventoryName() {
- return "engineerHopper";
- }
+ public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
+ return true;
+ }
- public double getXPos() {
- return this.xCoord;
- }
+ public ChunkCoordinates[] getBlocksCoord() {
+ return new ChunkCoordinates[] { new ChunkCoordinates(invPosX[0], invPosY[0], invPosZ[0]),
+ new ChunkCoordinates(invPosX[1], invPosY[1], invPosZ[1]) };
+ }
- public double getYPos() {
- return this.yCoord;
- }
+ public ChunkCoordinates getBinding() {
+ return null;
+ }
- public double getZPos() {
- return this.zCoord;
- }
-}
\ No newline at end of file
+ public void renderHUD(Minecraft mc, ScaledResolution res) {
+ int x = res.getScaledWidth() / 2 - 7;
+ int y = res.getScaledHeight() / 2 + 16;
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ ClientHelper.drawArrow(x - 2, y, false);
+ for (int i = 0; i < 2; i++) {
+ ItemStack stack = null;
+ boolean hasInv = false;
+ int posX = x + (i == 0 ? 32 : -32);
+ if (getDistantInventory(i) != null && (TileEntity) getDistantInventory(i) != null) {
+ TileEntity tile = (TileEntity) getDistantInventory(i);
+ Block block = tile.getWorldObj().getBlock(tile.xCoord, tile.yCoord, tile.zCoord);
+ int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
+ stack = new ItemStack(block, 1, meta);
+ hasInv = true;
+ }
+ Gui.drawRect(posX - 4, y - 4, posX + 20, y + 20, 1140850688);
+ Gui.drawRect(posX - 2, y - 2, posX + 18, y + 18, 1140850688);
+ if (stack != null) {
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(32826);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, posX, y);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(2929);
+ }
+ int invCount = bindType ? 0 : 1;
+ if (invCount == i) {
+ GL11.glTranslatef(0.0f, 0.0f, 300.0f);
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(32826);
+ RenderItem.getInstance().renderItemIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ new ItemStack(ModItems.twigWand),
+ posX + 10,
+ y + 7);
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(2929);
+ GL11.glTranslatef(0.0f, 0.0f, -300.0f);
+ }
+ boolean unicode = mc.fontRenderer.getUnicodeFlag();
+ mc.fontRenderer.setUnicodeFlag(true);
+ if (!hasInv) {
+ mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 6, 4980736);
+ mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 5, 13764621);
+ }
+ mc.fontRenderer.setUnicodeFlag(unicode);
+ GL11.glEnable(2929);
+ }
+ GL11.glDisable(3042);
+ }
+
+ public void writeCustomNBT(NBTTagCompound nbtt) {
+ super.writeCustomNBT(nbtt);
+ nbtt.setInteger("cooldown", this.cooldown);
+ nbtt.setBoolean("bindType", this.bindType);
+ nbtt.setIntArray("bindingX", this.invPosX);
+ nbtt.setIntArray("bindingY", this.invPosY);
+ nbtt.setIntArray("bindingZ", this.invPosZ);
+ nbtt.setIntArray("bindingSide", this.invSide);
+ }
+
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ super.readCustomNBT(nbtt);
+ this.cooldown = nbtt.getInteger("cooldown");
+ this.bindType = nbtt.getBoolean("bindType");
+ this.invPosX = nbtt.getIntArray("bindingX");
+ this.invPosY = nbtt.getIntArray("bindingY");
+ this.invPosZ = nbtt.getIntArray("bindingZ");
+ this.invSide = nbtt.getIntArray("bindingSide");
+ }
+
+ private boolean canExtractStack() {
+ IInventory inv = getDistantInventory(0);
+ if (inv == null) return false;
+ else {
+ int side = invSide[0];
+ int pullCount = getPullCount(inv, side);
+ System.out.println("canExtractStack " + pullCount);
+ if (pullCount <= 0) return false;
+ else {
+ if (getStackInSlot(0) != null) {
+ ItemStack itemstack = getStackInSlot(0).copy();
+ ItemStack itemstack1 = TileEntityHopper.func_145889_a(inv, decrStackSize(0, pullCount), side);
+ if (itemstack1 == null || itemstack1.stackSize == 0) {
+ inv.markDirty();
+ return true;
+ }
+ setInventorySlotContents(0, itemstack);
+ }
+ return false;
+ }
+ }
+ }
+
+ private int getPullCount(IInventory inv, int side) {
+ if (inv instanceof ISidedInventory && side > -1) {
+ ISidedInventory sideInv = (ISidedInventory) inv;
+ int[] slots = sideInv.getAccessibleSlotsFromSide(side);
+ for (int i = 0; i < slots.length; ++i) {
+ ItemStack stack = sideInv.getStackInSlot(slots[i]);
+ if (stack == null) return inv.getInventoryStackLimit();
+ else if (inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize()
+ && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
+ return inv.getInventoryStackLimit() - stack.stackSize;
+ }
+ } else {
+ int size = inv.getSizeInventory();
+ for (int i = 0; i < size; ++i) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack == null) return inv.getInventoryStackLimit();
+ else if (inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize()
+ && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
+ return inv.getInventoryStackLimit() - stack.stackSize;
+ }
+ }
+ return 0;
+ }
+
+ private boolean canInsertStack() {
+ IInventory inv = getDistantInventory(1);
+ if (inv != null) {
+ int side = invSide[1];
+ int takeCount = getTakeCount(inv, side);
+ System.out.println("canInsertStack " + takeCount);
+ if (takeCount <= 0) return false;
+ if (inv instanceof ISidedInventory && side > -1) {
+ ISidedInventory sidedInv = (ISidedInventory) inv;
+ int[] slots = sidedInv.getAccessibleSlotsFromSide(side);
+ for (int k = 0; k < slots.length; ++k) {
+ if (func_145892_a(inv, slots[k], side, takeCount)) return true;
+ }
+ } else {
+ int i = inv.getSizeInventory();
+ for (int j = 0; j < i; ++j) {
+ if (func_145892_a(inv, j, side, takeCount)) return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private int getTakeCount(IInventory inv, int side) {
+ if (inv instanceof ISidedInventory && side > -1) {
+ ISidedInventory sideInv = (ISidedInventory) inv;
+ int[] slots = sideInv.getAccessibleSlotsFromSide(side);
+ for (int i = 0; i < slots.length; ++i) {
+ ItemStack stack = sideInv.getStackInSlot(slots[i]);
+ if (stack != null)
+ if (getStackInSlot(0) == null) return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
+ else if (getInventoryStackLimit() != getStackInSlot(0).stackSize
+ && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize()
+ && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
+ return getInventoryStackLimit() - getStackInSlot(0).stackSize;
+ }
+ } else {
+ for (int i = 0; i < inv.getSizeInventory(); ++i) {
+ ItemStack stack = inv.getStackInSlot(i);
+ if (stack != null)
+ if (getStackInSlot(0) == null) return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
+ else if (getInventoryStackLimit() != getStackInSlot(0).stackSize
+ && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize()
+ && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
+ return getInventoryStackLimit() - getStackInSlot(0).stackSize;
+ }
+ }
+ return 0;
+ }
+
+ private boolean func_145892_a(IInventory inv, int slot, int side, int takeCount) {
+ ItemStack itemstack = inv.getStackInSlot(slot);
+ if (itemstack != null && func_145890_b(inv, itemstack, slot, side)) {
+ ItemStack itemstack1 = itemstack.copy();
+ ItemStack itemstack2 = TileEntityHopper.func_145889_a(this, inv.decrStackSize(slot, takeCount), side);
+ if (itemstack2 == null || itemstack2.stackSize == 0) {
+ inv.markDirty();
+ return true;
+ }
+ inv.setInventorySlotContents(slot, itemstack1);
+ }
+ return false;
+ }
+
+ private static boolean func_145890_b(IInventory inv, ItemStack stack, int slot, int side) {
+ return !(inv instanceof ISidedInventory) || ((ISidedInventory) inv).canExtractItem(slot, stack, side);
+ }
+
+ public int getSizeInventory() {
+ return 1;
+ }
+
+ public String getInventoryName() {
+ return "engineerHopper";
+ }
+
+ public double getXPos() {
+ return this.xCoord;
+ }
+
+ public double getYPos() {
+ return this.yCoord;
+ }
+
+ public double getZPos() {
+ return this.zCoord;
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileGameBoard.java b/src/main/java/ab/common/block/tile/TileGameBoard.java
index 9df1715..65976c5 100644
--- a/src/main/java/ab/common/block/tile/TileGameBoard.java
+++ b/src/main/java/ab/common/block/tile/TileGameBoard.java
@@ -2,258 +2,251 @@ package ab.common.block.tile;
import java.util.List;
-import ab.api.IRenderHud;
-import ab.common.block.subtile.SubTileArdentAzarcissus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.block.tile.TileMod;
+import ab.api.IRenderHud;
public class TileGameBoard extends TileMod implements IRenderHud {
-
- public String[] playersName = new String[] { "", "" };
- public byte[] slotChance = new byte[] { 0, 0, 0, 0 };
- protected int botTick = -1;
- public int endGameTick = -1;
- protected boolean requestUpdate;
- public boolean isSingleGame = true;
- public boolean isCustomGame = false;
- public int clientTick[] = new int[] { 0, 0, 0, 0 };
- public static final ItemStack headRender = new ItemStack(Items.skull, 1, 3);
- private ItemStack customStack;
- public void updateEntity() {
- if(botTick > 0)
- botTick--;
- if(endGameTick > 0)
- endGameTick--;
- if(!worldObj.isRemote)
- updateServer();
- else
- updateAnimationTicks();
- }
-
- public void updateAnimationTicks() {
- for(int i = 0; i < slotChance.length; i++)
- if(slotChance[i] > 0)
- clientTick[i]++;
- else
- clientTick[i] = 0;
- }
-
- protected void updateServer() {
- if(hasGame() && endGameTick == 0 && !isCustomGame)
- finishGame();
- if(requestUpdate)
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- if(worldObj.getTotalWorldTime() % 20 == 0 && hasFullDice() && endGameTick == -1)
- endGameTick = 28;
- boolean hasUpdate = false;
- if(isSingleGame) {
- if(botTick == 0 && hasGame()) {
- for(int i = 2; i < 4; i++) {
- if(slotChance[i] == 0) {
- slotChance[i] = (byte)(worldObj.rand.nextInt(6) + 1);
- botTick = -1;
- hasUpdate = true;
- worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
- break;
- }
- }
- }
- } else {
- if(botTick == 0 && hasGame())
- endGameTick = 0;
- }
- requestUpdate = hasUpdate;
- }
-
- public void setPlayer(String name, boolean isCustomGame) {
- this.isCustomGame = isCustomGame;
- if(isSingleGame) {
- playersName[0] = name;
- playersName[1] = "";
- requestUpdate = true;
- botTick = 8;
- } else {
- if(playersName[0].isEmpty())
- playersName[0] = name;
- else if(!playersName[0].equals(name))
- playersName[1] = name;
- requestUpdate = true;
- }
- }
-
- public void setPlayer(EntityPlayer player) {
- setPlayer(player.getCommandSenderName(), false);
- }
-
- public boolean dropDice(String name) {
- if(isSingleGame) {
- if(name.equals(playersName[0]) && botTick == -1) {
- boolean hasDrop = false;
- for(int i = 0; i < 2; i++) {
- if(slotChance[i] == 0) {
- hasDrop = true;
- if(!worldObj.isRemote) {
- slotChance[i] = (byte)(worldObj.rand.nextInt(6) + 1);
- botTick = 18;
- worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
- requestUpdate = true;
- }
- break;
- }
- }
- return hasDrop;
- }
- } else {
- for(int i = 0; i < playersName.length; i++) {
- if(name.equals(playersName[i])) {
- boolean hasDrop = false;
- for(int j = i * 2; j < (i + 1) * 2; j++) {
- if(slotChance[j] == 0) {
- hasDrop = true;
- if(!worldObj.isRemote) {
- slotChance[j] = (byte)(worldObj.rand.nextInt(6) + 1);
- botTick = playersName[1].isEmpty() ? 240 : 1200;
- worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
- requestUpdate = true;
- }
- break;
- }
- }
- return hasDrop;
- }
- }
- }
- return false;
- }
-
- public boolean dropDice(EntityPlayer player) {
- return dropDice(player.getCommandSenderName());
- }
-
- public boolean hasFullDice() {
- boolean hasFull = false;
- for(int i = 0; i < slotChance.length; i++) {
- if(!(slotChance[i] > 0))
- return false;
- hasFull = slotChance[i] > 0;
- }
- return hasFull;
- }
-
- public boolean hasGame() {
- if(isSingleGame)
- return !playersName[0].isEmpty();
- else
- for(int i = 0; i < playersName.length; i++)
- if(!playersName[i].isEmpty())
- return true;
- return false;
- }
-
- public void finishGame(boolean hasChatMessage) {
- if(worldObj.isRemote)
- return;
- else if(!hasChatMessage) {
- resetGame();
- return;
- } else if(!hasFullDice()) {
- sendNearMessage("ab.gameBoard.misc.notPlayer", new Object[] {});
- resetGame();
- return;
- }
- String str = isSingleGame ? "" : ".mult";
- if((slotChance[0] + slotChance[1]) > (slotChance[2] + slotChance[3]))
- sendNearMessage("ab.gameBoard.misc.0" + str, new Object[] { playersName[0] });
- else if((slotChance[0] + slotChance[1]) == (slotChance[2] + slotChance[3]))
- sendNearMessage("ab.gameBoard.misc.1" + str, new Object[] {});
- else
- sendNearMessage("ab.gameBoard.misc.2" + str, new Object[] { playersName[isSingleGame ? 0 : 1] });
- resetGame();
- }
-
- public void finishGame() {
- finishGame(true);
- }
-
- public void sendNearMessage(String text, Object[] obj) {
- List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 1), (this.zCoord + 1)).expand(3.5f, 3.5f, 3.5f));
- for(EntityPlayer player : players) {
- if(player != null)
- player.addChatMessage((new ChatComponentTranslation(text, obj)).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
- }
- }
-
- public boolean changeCustomStack(ItemStack stack) {
- if(!isCustomGame)
- return false;
- else if(customStack == null || !ItemStack.areItemStacksEqual(customStack, stack)) {
- customStack = stack;
- requestUpdate = true;
- return true;
- } else
- return false;
- }
-
- public void resetGame() {
- playersName[0] = "";
- playersName[1] = "";
- for(int i = 0; i < slotChance.length; i++)
- slotChance[i] = 0;
- botTick = -1;
- endGameTick = -1;
- isCustomGame = false;
- requestUpdate = true;
- }
-
- public void renderHud(Minecraft mc, ScaledResolution res) {
- int x = res.getScaledWidth() / 2 - 7;
- int y = res.getScaledHeight() / 2 + 12;
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, isCustomGame ? (customStack == null ? headRender : customStack) : headRender, x - (!isSingleGame ? 1 : 0), y - (!isSingleGame ? 1 : 0));
- if(!isSingleGame)
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, headRender, x + 3, y + 3);
- RenderHelper.disableStandardItemLighting();
- }
-
- public void writeCustomNBT(NBTTagCompound cmp) {
- super.writeCustomNBT(cmp);
- for(int i = 0; i < playersName.length; i++)
- cmp.setString("playerName" + i, playersName[i]);
- cmp.setByteArray("slotChance", slotChance);
- cmp.setInteger("botTick", botTick);
- cmp.setInteger("endGameTick", endGameTick);
- cmp.setBoolean("requestUpdate", requestUpdate);
- cmp.setBoolean("isSingleGame", isSingleGame);
- cmp.setBoolean("isAnonimGame", isCustomGame);
- if(customStack != null)
- customStack.writeToNBT(cmp);
- }
-
- public void readCustomNBT(NBTTagCompound cmp) {
- super.readCustomNBT(cmp);
- for(int i = 0; i < playersName.length; i++)
- playersName[i] = cmp.getString("playerName" + i);
- botTick = cmp.getInteger("botTick");
- endGameTick = cmp.getInteger("endGameTick");
- slotChance = cmp.getByteArray("slotChance");
- requestUpdate = cmp.getBoolean("requestUpdate");
- isSingleGame = cmp.getBoolean("isSingleGame");
- isCustomGame = cmp.getBoolean("isAnonimGame");
- customStack = ItemStack.loadItemStackFromNBT(cmp);
- }
-}
\ No newline at end of file
+ public String[] playersName = new String[] { "", "" };
+ public byte[] slotChance = new byte[] { 0, 0, 0, 0 };
+ protected int botTick = -1;
+ public int endGameTick = -1;
+ protected boolean requestUpdate;
+ public boolean isSingleGame = true;
+ public boolean isCustomGame = false;
+ public int clientTick[] = new int[] { 0, 0, 0, 0 };
+ public static final ItemStack headRender = new ItemStack(Items.skull, 1, 3);
+ private ItemStack customStack;
+
+ public void updateEntity() {
+ if (botTick > 0) botTick--;
+ if (endGameTick > 0) endGameTick--;
+ if (!worldObj.isRemote) updateServer();
+ else updateAnimationTicks();
+ }
+
+ public void updateAnimationTicks() {
+ for (int i = 0; i < slotChance.length; i++) if (slotChance[i] > 0) clientTick[i]++;
+ else clientTick[i] = 0;
+ }
+
+ protected void updateServer() {
+ if (hasGame() && endGameTick == 0 && !isCustomGame) finishGame();
+ if (requestUpdate)
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ if (worldObj.getTotalWorldTime() % 20 == 0 && hasFullDice() && endGameTick == -1) endGameTick = 28;
+ boolean hasUpdate = false;
+ if (isSingleGame) {
+ if (botTick == 0 && hasGame()) {
+ for (int i = 2; i < 4; i++) {
+ if (slotChance[i] == 0) {
+ slotChance[i] = (byte) (worldObj.rand.nextInt(6) + 1);
+ botTick = -1;
+ hasUpdate = true;
+ worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
+ break;
+ }
+ }
+ }
+ } else {
+ if (botTick == 0 && hasGame()) endGameTick = 0;
+ }
+ requestUpdate = hasUpdate;
+ }
+
+ public void setPlayer(String name, boolean isCustomGame) {
+ this.isCustomGame = isCustomGame;
+ if (isSingleGame) {
+ playersName[0] = name;
+ playersName[1] = "";
+ requestUpdate = true;
+ botTick = 8;
+ } else {
+ if (playersName[0].isEmpty()) playersName[0] = name;
+ else if (!playersName[0].equals(name)) playersName[1] = name;
+ requestUpdate = true;
+ }
+ }
+
+ public void setPlayer(EntityPlayer player) {
+ setPlayer(player.getCommandSenderName(), false);
+ }
+
+ public boolean dropDice(String name) {
+ if (isSingleGame) {
+ if (name.equals(playersName[0]) && botTick == -1) {
+ boolean hasDrop = false;
+ for (int i = 0; i < 2; i++) {
+ if (slotChance[i] == 0) {
+ hasDrop = true;
+ if (!worldObj.isRemote) {
+ slotChance[i] = (byte) (worldObj.rand.nextInt(6) + 1);
+ botTick = 18;
+ worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
+ requestUpdate = true;
+ }
+ break;
+ }
+ }
+ return hasDrop;
+ }
+ } else {
+ for (int i = 0; i < playersName.length; i++) {
+ if (name.equals(playersName[i])) {
+ boolean hasDrop = false;
+ for (int j = i * 2; j < (i + 1) * 2; j++) {
+ if (slotChance[j] == 0) {
+ hasDrop = true;
+ if (!worldObj.isRemote) {
+ slotChance[j] = (byte) (worldObj.rand.nextInt(6) + 1);
+ botTick = playersName[1].isEmpty() ? 240 : 1200;
+ worldObj.playSoundEffect(
+ this.xCoord,
+ this.yCoord,
+ this.zCoord,
+ "ab:boardCube",
+ 0.6F,
+ 1.0F);
+ requestUpdate = true;
+ }
+ break;
+ }
+ }
+ return hasDrop;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean dropDice(EntityPlayer player) {
+ return dropDice(player.getCommandSenderName());
+ }
+
+ public boolean hasFullDice() {
+ boolean hasFull = false;
+ for (int i = 0; i < slotChance.length; i++) {
+ if (!(slotChance[i] > 0)) return false;
+ hasFull = slotChance[i] > 0;
+ }
+ return hasFull;
+ }
+
+ public boolean hasGame() {
+ if (isSingleGame) return !playersName[0].isEmpty();
+ else for (int i = 0; i < playersName.length; i++) if (!playersName[i].isEmpty()) return true;
+ return false;
+ }
+
+ public void finishGame(boolean hasChatMessage) {
+ if (worldObj.isRemote) return;
+ else if (!hasChatMessage) {
+ resetGame();
+ return;
+ } else if (!hasFullDice()) {
+ sendNearMessage("ab.gameBoard.misc.notPlayer", new Object[] {});
+ resetGame();
+ return;
+ }
+ String str = isSingleGame ? "" : ".mult";
+ if ((slotChance[0] + slotChance[1]) > (slotChance[2] + slotChance[3]))
+ sendNearMessage("ab.gameBoard.misc.0" + str, new Object[] { playersName[0] });
+ else if ((slotChance[0] + slotChance[1]) == (slotChance[2] + slotChance[3]))
+ sendNearMessage("ab.gameBoard.misc.1" + str, new Object[] {});
+ else sendNearMessage("ab.gameBoard.misc.2" + str, new Object[] { playersName[isSingleGame ? 0 : 1] });
+ resetGame();
+ }
+
+ public void finishGame() {
+ finishGame(true);
+ }
+
+ public void sendNearMessage(String text, Object[] obj) {
+ List players = this.worldObj.getEntitiesWithinAABB(
+ EntityPlayer.class,
+ AxisAlignedBB.getBoundingBox(
+ this.xCoord,
+ this.yCoord,
+ this.zCoord,
+ (this.xCoord + 1),
+ (this.yCoord + 1),
+ (this.zCoord + 1)).expand(3.5f, 3.5f, 3.5f));
+ for (EntityPlayer player : players) {
+ if (player != null) player.addChatMessage(
+ (new ChatComponentTranslation(text, obj))
+ .setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
+ }
+ }
+
+ public boolean changeCustomStack(ItemStack stack) {
+ if (!isCustomGame) return false;
+ else if (customStack == null || !ItemStack.areItemStacksEqual(customStack, stack)) {
+ customStack = stack;
+ requestUpdate = true;
+ return true;
+ } else return false;
+ }
+
+ public void resetGame() {
+ playersName[0] = "";
+ playersName[1] = "";
+ for (int i = 0; i < slotChance.length; i++) slotChance[i] = 0;
+ botTick = -1;
+ endGameTick = -1;
+ isCustomGame = false;
+ requestUpdate = true;
+ }
+
+ public void renderHud(Minecraft mc, ScaledResolution res) {
+ int x = res.getScaledWidth() / 2 - 7;
+ int y = res.getScaledHeight() / 2 + 12;
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ isCustomGame ? (customStack == null ? headRender : customStack) : headRender,
+ x - (!isSingleGame ? 1 : 0),
+ y - (!isSingleGame ? 1 : 0));
+ if (!isSingleGame) RenderItem.getInstance()
+ .renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, headRender, x + 3, y + 3);
+ RenderHelper.disableStandardItemLighting();
+ }
+
+ public void writeCustomNBT(NBTTagCompound cmp) {
+ super.writeCustomNBT(cmp);
+ for (int i = 0; i < playersName.length; i++) cmp.setString("playerName" + i, playersName[i]);
+ cmp.setByteArray("slotChance", slotChance);
+ cmp.setInteger("botTick", botTick);
+ cmp.setInteger("endGameTick", endGameTick);
+ cmp.setBoolean("requestUpdate", requestUpdate);
+ cmp.setBoolean("isSingleGame", isSingleGame);
+ cmp.setBoolean("isAnonimGame", isCustomGame);
+ if (customStack != null) customStack.writeToNBT(cmp);
+ }
+
+ public void readCustomNBT(NBTTagCompound cmp) {
+ super.readCustomNBT(cmp);
+ for (int i = 0; i < playersName.length; i++) playersName[i] = cmp.getString("playerName" + i);
+ botTick = cmp.getInteger("botTick");
+ endGameTick = cmp.getInteger("endGameTick");
+ slotChance = cmp.getByteArray("slotChance");
+ requestUpdate = cmp.getBoolean("requestUpdate");
+ isSingleGame = cmp.getBoolean("isSingleGame");
+ isCustomGame = cmp.getBoolean("isAnonimGame");
+ customStack = ItemStack.loadItemStackFromNBT(cmp);
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileInventory.java b/src/main/java/ab/common/block/tile/TileInventory.java
index 8e8cb82..c0d2702 100644
--- a/src/main/java/ab/common/block/tile/TileInventory.java
+++ b/src/main/java/ab/common/block/tile/TileInventory.java
@@ -6,87 +6,86 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
+
import vazkii.botania.common.block.tile.TileMod;
public abstract class TileInventory extends TileMod implements IInventory {
- ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
-
- public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
- NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10);
- this.inventorySlots = new ItemStack[getSizeInventory()];
- for(int var3 = 0; var3 < var2.tagCount(); var3++) {
- NBTTagCompound var4 = var2.getCompoundTagAt(var3);
- byte var5 = var4.getByte("Slot");
- if(var5 >= 0 && var5 < this.inventorySlots.length)
- this.inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
- }
- }
-
- public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
- NBTTagList var2 = new NBTTagList();
- for(int var3 = 0; var3 < this.inventorySlots.length; var3++) {
- if (this.inventorySlots[var3] != null) {
- NBTTagCompound var4 = new NBTTagCompound();
- var4.setByte("Slot", (byte)var3);
- this.inventorySlots[var3].writeToNBT(var4);
- var2.appendTag((NBTBase)var4);
- }
- }
- par1NBTTagCompound.setTag("Items", (NBTBase)var2);
- }
-
- public ItemStack getStackInSlot(int i) {
- return this.inventorySlots[i];
- }
-
- public ItemStack decrStackSize(int i, int j) {
- if(this.inventorySlots[i] != null) {
- if(!this.worldObj.isRemote)
- this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
- if((this.inventorySlots[i]).stackSize <= j) {
- ItemStack itemStack = this.inventorySlots[i];
- this.inventorySlots[i] = null;
- markDirty();
- return itemStack;
- }
- ItemStack stackAt = this.inventorySlots[i].splitStack(j);
- if((this.inventorySlots[i]).stackSize == 0)
- this.inventorySlots[i] = null;
- markDirty();
- return stackAt;
- }
- return null;
- }
-
- public ItemStack getStackInSlotOnClosing(int i) {
- return getStackInSlot(i);
- }
-
- public void setInventorySlotContents(int i, ItemStack itemstack) {
- this.inventorySlots[i] = itemstack;
- markDirty();
- if (!this.worldObj.isRemote)
- this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
- }
-
- public int getInventoryStackLimit() {
- return 64;
- }
-
- public boolean isUseableByPlayer(EntityPlayer entityplayer) {
- return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) ? false : ((entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D));
- }
-
- public boolean isItemValidForSlot(int i, ItemStack itemstack) {
- return true;
- }
-
- public boolean hasCustomInventoryName() {
- return false;
- }
-
- public void openInventory() {}
-
- public void closeInventory() {}
-}
\ No newline at end of file
+ ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
+
+ public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
+ NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10);
+ this.inventorySlots = new ItemStack[getSizeInventory()];
+ for (int var3 = 0; var3 < var2.tagCount(); var3++) {
+ NBTTagCompound var4 = var2.getCompoundTagAt(var3);
+ byte var5 = var4.getByte("Slot");
+ if (var5 >= 0 && var5 < this.inventorySlots.length)
+ this.inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
+ }
+ }
+
+ public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
+ NBTTagList var2 = new NBTTagList();
+ for (int var3 = 0; var3 < this.inventorySlots.length; var3++) {
+ if (this.inventorySlots[var3] != null) {
+ NBTTagCompound var4 = new NBTTagCompound();
+ var4.setByte("Slot", (byte) var3);
+ this.inventorySlots[var3].writeToNBT(var4);
+ var2.appendTag((NBTBase) var4);
+ }
+ }
+ par1NBTTagCompound.setTag("Items", (NBTBase) var2);
+ }
+
+ public ItemStack getStackInSlot(int i) {
+ return this.inventorySlots[i];
+ }
+
+ public ItemStack decrStackSize(int i, int j) {
+ if (this.inventorySlots[i] != null) {
+ if (!this.worldObj.isRemote) this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ if ((this.inventorySlots[i]).stackSize <= j) {
+ ItemStack itemStack = this.inventorySlots[i];
+ this.inventorySlots[i] = null;
+ markDirty();
+ return itemStack;
+ }
+ ItemStack stackAt = this.inventorySlots[i].splitStack(j);
+ if ((this.inventorySlots[i]).stackSize == 0) this.inventorySlots[i] = null;
+ markDirty();
+ return stackAt;
+ }
+ return null;
+ }
+
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return getStackInSlot(i);
+ }
+
+ public void setInventorySlotContents(int i, ItemStack itemstack) {
+ this.inventorySlots[i] = itemstack;
+ markDirty();
+ if (!this.worldObj.isRemote) this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ }
+
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) ? false
+ : ((entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D));
+ }
+
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ return true;
+ }
+
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+}
diff --git a/src/main/java/ab/common/block/tile/TileLebethronCore.java b/src/main/java/ab/common/block/tile/TileLebethronCore.java
index 2f9d88a..c91e37a 100644
--- a/src/main/java/ab/common/block/tile/TileLebethronCore.java
+++ b/src/main/java/ab/common/block/tile/TileLebethronCore.java
@@ -1,9 +1,5 @@
package ab.common.block.tile;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IRenderHud;
-import ab.common.lib.register.BlockListAB;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -14,201 +10,212 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.common.Botania;
-import vazkii.botania.common.block.ModBlocks;
-import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.tile.TileMod;
-import vazkii.botania.common.core.handler.ConfigHandler;
+import ab.api.IRenderHud;
+import ab.common.lib.register.BlockListAB;
public class TileLebethronCore extends TileMod implements IRenderHud {
-
- protected int tick;
- protected Block block;
- protected int meta;
- protected boolean validTree;
- public static MultiblockSet makeMultiblockSet() {
- Multiblock mb = new Multiblock();
- mb.addComponent(0, 1, 0, BlockListAB.blockLebethron, 4);
- mb.addComponent(0, 0, 0, BlockListAB.blockLebethron, 0);
- mb.addComponent(0, 2, 0, BlockListAB.blockLebethron, 0);
- mb.addComponent(0, 3, 0, BlockListAB.blockLebethron, 0);
- mb.addComponent(0, 4, 0, BlockListAB.blockLebethron, 0);
- mb.addComponent(0, 5, 0, BlockListAB.blockLebethron, 0);
- mb.setRenderOffset(0, 1, 0);
- return mb.makeSet();
- }
-
- public void updateEntity() {
- if(!worldObj.isRemote) {
- if(tick <= 0) {
- updateStructure();
- if(validTree && getBlock() != null) {
- spawnLeaves();
- tick = 40;
- }
- } else
- tick--;
- } else if(worldObj.rand.nextBoolean())
- Botania.proxy.sparkleFX(this.worldObj, this.xCoord + Math.random(), this.yCoord + Math.random(), this.zCoord + Math.random(), 0.5F, 1.0F, 0.5F, (float)Math.random() * 2, 2);
- }
-
- public boolean getValidTree() {
- return this.validTree;
- }
-
- public void updateStructure() {
- boolean oldValidTree = validTree;
- validTree = hasValidTree();
- if(oldValidTree != validTree)
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- }
-
- public void writeCustomNBT(NBTTagCompound nbtt) {
- nbtt.setInteger("blockID", Block.getIdFromBlock(block));
- nbtt.setInteger("blockMeta", this.meta);
- nbtt.setInteger("tick", this.tick);
- nbtt.setBoolean("validTree", validTree);
- }
-
- public void readCustomNBT(NBTTagCompound nbtt) {
- this.block = Block.getBlockById(nbtt.getInteger("blockID"));
- this.meta = nbtt.getInteger("blockMeta");
- this.tick = nbtt.getInteger("tick");
- this.validTree = nbtt.getBoolean("validTree");
- }
-
- public boolean setBlock(EntityPlayer player, Block block, int meta) {
- if(this.block == null) {
- this.block = block;
- this.meta = meta;
- return true;
- } else {
- if(Block.isEqualTo(this.block, block) && this.meta == meta)
- return false;
- else if(!worldObj.isRemote) {
- Vec3 vec3 = player.getLook(1.0F).normalize();
- EntityItem entityitem = new EntityItem(worldObj, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, new ItemStack(this.block, 1, this.meta));
- worldObj.spawnEntityInWorld(entityitem);
- }
- this.block = block;
- this.meta = meta;
- return true;
- }
- }
-
- public Block getBlock() {
- if(!Block.isEqualTo(block, Blocks.air) && block != null)
- return this.block;
- return null;
- }
-
- public int getMeta() {
- return this.meta;
- }
-
- public boolean hasValidTree() {
- if(!checkBlock(this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord), this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord))) {
- return false;
- }
- for(int i = 1; i <= 4; i++) {
- if(!checkBlock(this.worldObj.getBlock(this.xCoord, this.yCoord + i, this.zCoord), this.worldObj.getBlockMetadata(this.xCoord, this.yCoord + i, this.zCoord))) {
- return false;
- }
- }
- return true;
- }
-
- boolean checkBlock(Block block, int meta) {
- return block == BlockListAB.blockLebethron && meta == 0;
- }
-
- private void spawnLeaves() {
- for(int x = -1; x <= 1; x++) {
- for(int z = -1; z <= 1; z++) {
- for(int y = 0; y < 5; y++) {
- this.setBlock(worldObj, this.xCoord + x, this.yCoord + y + 2, this.zCoord + z);
- }
- }
- }
- this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 1, this.zCoord);
- this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 1, this.zCoord);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord + 1);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord - 1);
- this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 7, this.zCoord);
- this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 7, this.zCoord);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord + 1);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord - 1);
- for(int i = 0; i <= 3; i++)
- this.setBlock(worldObj, this.xCoord, this.yCoord + 6 + i, this.zCoord);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord - 2);
- for(int i = -1; i <= 1; i++) {
- this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord - 2);
- this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord - 2);
- }
- this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord - 2);
- this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord + 2);
- for(int i = -1; i <= 1; i++) {
- this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord + 2);
- this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord + 2);
- }
- this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord + 2);
- this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 2, this.zCoord);
- for(int i = -1; i <= 1; i++) {
- this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 3, this.zCoord + i);
- this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 4, this.zCoord + i);
- }
- this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 5, this.zCoord);
- this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 2, this.zCoord);
- for(int i = -1; i <= 1; i++) {
- this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 3, this.zCoord + i);
- this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 4, this.zCoord + i);
- }
- this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 5, this.zCoord);
- }
-
- private void setBlock(World world, int x, int y, int z) {
- if(world.rand.nextInt(10) <= 8)
- return;
- else if(world.getBlock(x, y, z).getMaterial() == Material.air && y < 256)
- world.setBlock(x, y, z, this.block, this.meta, 3);
- }
+ protected int tick;
+ protected Block block;
+ protected int meta;
+ protected boolean validTree;
- public void renderHud(Minecraft mc, ScaledResolution res) {
- if(!validTree)
- return;
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- ItemStack stack = getBlock() != null ? new ItemStack(block, 1, meta) : new ItemStack(Blocks.leaves);
- int x = res.getScaledWidth() / 2 - 7;
- int y = res.getScaledHeight() / 2 + 12;
- Gui.drawRect(x - 2, y - 2, x + 18, y + 18, 1140850688);
- Gui.drawRect(x, y, x + 16, y + 16, 1140850688);
- RenderHelper.enableGUIStandardItemLighting();
- GL11.glEnable(32826);
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
- RenderHelper.disableStandardItemLighting();
+ public static MultiblockSet makeMultiblockSet() {
+ Multiblock mb = new Multiblock();
+ mb.addComponent(0, 1, 0, BlockListAB.blockLebethron, 4);
+ mb.addComponent(0, 0, 0, BlockListAB.blockLebethron, 0);
+ mb.addComponent(0, 2, 0, BlockListAB.blockLebethron, 0);
+ mb.addComponent(0, 3, 0, BlockListAB.blockLebethron, 0);
+ mb.addComponent(0, 4, 0, BlockListAB.blockLebethron, 0);
+ mb.addComponent(0, 5, 0, BlockListAB.blockLebethron, 0);
+ mb.setRenderOffset(0, 1, 0);
+ return mb.makeSet();
+ }
+
+ public void updateEntity() {
+ if (!worldObj.isRemote) {
+ if (tick <= 0) {
+ updateStructure();
+ if (validTree && getBlock() != null) {
+ spawnLeaves();
+ tick = 40;
+ }
+ } else tick--;
+ } else if (worldObj.rand.nextBoolean()) Botania.proxy.sparkleFX(
+ this.worldObj,
+ this.xCoord + Math.random(),
+ this.yCoord + Math.random(),
+ this.zCoord + Math.random(),
+ 0.5F,
+ 1.0F,
+ 0.5F,
+ (float) Math.random() * 2,
+ 2);
+ }
+
+ public boolean getValidTree() {
+ return this.validTree;
+ }
+
+ public void updateStructure() {
+ boolean oldValidTree = validTree;
+ validTree = hasValidTree();
+ if (oldValidTree != validTree)
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ }
+
+ public void writeCustomNBT(NBTTagCompound nbtt) {
+ nbtt.setInteger("blockID", Block.getIdFromBlock(block));
+ nbtt.setInteger("blockMeta", this.meta);
+ nbtt.setInteger("tick", this.tick);
+ nbtt.setBoolean("validTree", validTree);
+ }
+
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ this.block = Block.getBlockById(nbtt.getInteger("blockID"));
+ this.meta = nbtt.getInteger("blockMeta");
+ this.tick = nbtt.getInteger("tick");
+ this.validTree = nbtt.getBoolean("validTree");
+ }
+
+ public boolean setBlock(EntityPlayer player, Block block, int meta) {
+ if (this.block == null) {
+ this.block = block;
+ this.meta = meta;
+ return true;
+ } else {
+ if (Block.isEqualTo(this.block, block) && this.meta == meta) return false;
+ else if (!worldObj.isRemote) {
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ EntityItem entityitem = new EntityItem(
+ worldObj,
+ player.posX + vec3.xCoord,
+ player.posY + 1.2f,
+ player.posZ + vec3.zCoord,
+ new ItemStack(this.block, 1, this.meta));
+ worldObj.spawnEntityInWorld(entityitem);
+ }
+ this.block = block;
+ this.meta = meta;
+ return true;
+ }
+ }
+
+ public Block getBlock() {
+ if (!Block.isEqualTo(block, Blocks.air) && block != null) return this.block;
+ return null;
+ }
+
+ public int getMeta() {
+ return this.meta;
+ }
+
+ public boolean hasValidTree() {
+ if (!checkBlock(
+ this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord),
+ this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord))) {
+ return false;
+ }
+ for (int i = 1; i <= 4; i++) {
+ if (!checkBlock(
+ this.worldObj.getBlock(this.xCoord, this.yCoord + i, this.zCoord),
+ this.worldObj.getBlockMetadata(this.xCoord, this.yCoord + i, this.zCoord))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ boolean checkBlock(Block block, int meta) {
+ return block == BlockListAB.blockLebethron && meta == 0;
+ }
+
+ private void spawnLeaves() {
+ for (int x = -1; x <= 1; x++) {
+ for (int z = -1; z <= 1; z++) {
+ for (int y = 0; y < 5; y++) {
+ this.setBlock(worldObj, this.xCoord + x, this.yCoord + y + 2, this.zCoord + z);
+ }
+ }
+ }
+ this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 1, this.zCoord);
+ this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 1, this.zCoord);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord + 1);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord - 1);
+ this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 7, this.zCoord);
+ this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 7, this.zCoord);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord + 1);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord - 1);
+ for (int i = 0; i <= 3; i++) this.setBlock(worldObj, this.xCoord, this.yCoord + 6 + i, this.zCoord);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord - 2);
+ for (int i = -1; i <= 1; i++) {
+ this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord - 2);
+ this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord - 2);
+ }
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord - 2);
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord + 2);
+ for (int i = -1; i <= 1; i++) {
+ this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord + 2);
+ this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord + 2);
+ }
+ this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord + 2);
+ this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 2, this.zCoord);
+ for (int i = -1; i <= 1; i++) {
+ this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 3, this.zCoord + i);
+ this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 4, this.zCoord + i);
+ }
+ this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 5, this.zCoord);
+ this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 2, this.zCoord);
+ for (int i = -1; i <= 1; i++) {
+ this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 3, this.zCoord + i);
+ this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 4, this.zCoord + i);
+ }
+ this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 5, this.zCoord);
+ }
+
+ private void setBlock(World world, int x, int y, int z) {
+ if (world.rand.nextInt(10) <= 8) return;
+ else if (world.getBlock(x, y, z).getMaterial() == Material.air && y < 256)
+ world.setBlock(x, y, z, this.block, this.meta, 3);
+ }
+
+ public void renderHud(Minecraft mc, ScaledResolution res) {
+ if (!validTree) return;
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ ItemStack stack = getBlock() != null ? new ItemStack(block, 1, meta) : new ItemStack(Blocks.leaves);
+ int x = res.getScaledWidth() / 2 - 7;
+ int y = res.getScaledHeight() / 2 + 12;
+ Gui.drawRect(x - 2, y - 2, x + 18, y + 18, 1140850688);
+ Gui.drawRect(x, y, x + 16, y + 16, 1140850688);
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glEnable(32826);
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
+ RenderHelper.disableStandardItemLighting();
GL11.glDisable(2929);
boolean unicode = mc.fontRenderer.getUnicodeFlag();
mc.fontRenderer.setUnicodeFlag(true);
- if(getBlock() != null) {
- mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 9, 19456);
- mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 8, 774669);
- } else {
- mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 9, 4980736);
- mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 8, 13764621);
- }
- mc.fontRenderer.setUnicodeFlag(unicode);
- GL11.glEnable(2929);
- GL11.glDisable(3042);
- }
-}
\ No newline at end of file
+ if (getBlock() != null) {
+ mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 9, 19456);
+ mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 8, 774669);
+ } else {
+ mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 9, 4980736);
+ mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 8, 13764621);
+ }
+ mc.fontRenderer.setUnicodeFlag(unicode);
+ GL11.glEnable(2929);
+ GL11.glDisable(3042);
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileMagicCraftCrate.java b/src/main/java/ab/common/block/tile/TileMagicCraftCrate.java
index d6e998b..2b5fc48 100644
--- a/src/main/java/ab/common/block/tile/TileMagicCraftCrate.java
+++ b/src/main/java/ab/common/block/tile/TileMagicCraftCrate.java
@@ -1,6 +1,5 @@
package ab.common.block.tile;
-import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -14,7 +13,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
-import thaumcraft.api.aspects.Aspect;
+
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.items.relics.ItemThaumonomicon;
import thaumcraft.common.items.wands.ItemWandCasting;
@@ -22,312 +21,295 @@ import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
import thaumcraft.common.tiles.TileMagicWorkbench;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.item.ModItems;
+import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
public class TileMagicCraftCrate extends TileMagicWorkbench implements ISidedInventory, IInventory {
- private static final String WAITING_TAG = "waitingStack";
- private static final String PATTERN_TAG = "pattern";
- private static final int[] ACCESSIBLE_SLOTS = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ private static final String WAITING_TAG = "waitingStack";
+ private static final String PATTERN_TAG = "pattern";
+ private static final int[] ACCESSIBLE_SLOTS = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- private boolean[][] pattern;
- private EntityPlayer player;
- int signal = 0;
- private ItemStack waitingStack;
+ private boolean[][] pattern;
+ private EntityPlayer player;
+ int signal = 0;
+ private ItemStack waitingStack;
- public TileMagicCraftCrate() {
- pattern = new boolean[][] { new boolean[] { true, true, true }, new boolean[] { true, true, true }, new boolean[] { true, true, true } };
- }
+ public TileMagicCraftCrate() {
+ pattern = new boolean[][] { new boolean[] { true, true, true }, new boolean[] { true, true, true },
+ new boolean[] { true, true, true } };
+ }
- public void updateEntity() {
- if(!worldObj.isRemote && (craft(true) && canEject() || isFull() && !isWaiting()))
- ejectAll();
- int newSignal = 0;
- for(; newSignal < 9; newSignal++)
- if(!isLocked(newSignal) && getStackInSlot(newSignal) == null)
- break;
- if(isWaiting())
- newSignal = 14;
- if(newSignal != signal) {
- signal = newSignal;
- worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
- }
- }
+ public void updateEntity() {
+ if (!worldObj.isRemote && (craft(true) && canEject() || isFull() && !isWaiting())) ejectAll();
+ int newSignal = 0;
+ for (; newSignal < 9; newSignal++) if (!isLocked(newSignal) && getStackInSlot(newSignal) == null) break;
+ if (isWaiting()) newSignal = 14;
+ if (newSignal != signal) {
+ signal = newSignal;
+ worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
+ }
+ }
- boolean craft(boolean fullCheck) {
- if(fullCheck && !isFull())
- return false;
- if(player == null)
- return false;
- TileMagicWorkbench craft = new TileMagicWorkbench() {
-
- public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
- this.stackList[par1] = par2ItemStack;
- }
+ boolean craft(boolean fullCheck) {
+ if (fullCheck && !isFull()) return false;
+ if (player == null) return false;
+ TileMagicWorkbench craft = new TileMagicWorkbench() {
- public ItemStack decrStackSize(int par1, int par2) {
- if(this.stackList[par1] == null) {
- return null;
- }
- if(this.stackList[par1].stackSize <= par2) {
- final ItemStack var3 = this.stackList[par1];
- this.stackList[par1] = null;
- return var3;
- }
- final ItemStack var3 = this.stackList[par1].splitStack(par2);
- if(this.stackList[par1].stackSize == 0) {
- this.stackList[par1] = null;
- }
- return var3;
- }
- };
- for(int i = 0; i < 10; i++) {
- ItemStack stack = getStackInSlot(i);
- if(stack == null || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
- continue;
- craft.setInventorySlotContents(i, stack.copy());
- }
- ItemStack result = ThaumcraftCraftingManager.findMatchingArcaneRecipe(craft, player);
- if(result != null) {
- final AspectList aspects = ThaumcraftCraftingManager.findMatchingArcaneRecipeAspects(craft, player);
- if(aspects.size() > 0 && this.getStackInSlot(10) != null) {
- final ItemWandCasting wand = (ItemWandCasting) this.getStackInSlot(10).getItem();
- if (wand.consumeAllVisCrafting(this.getStackInSlot(10), player, aspects, true)) {
- for(int var2 = 0; var2 < 9; ++var2) {
- final ItemStack var3 = craft.getStackInSlot(var2);
- if(var3 != null)
- craft.decrStackSize(var2, 1);
- }
- for(int i = 0; i < 9; i++)
- setInventorySlotContents(i, craft.getStackInSlot(i));
- setInventorySlotContents(9, result);
- MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(player, result, craft));
- waitingStack = null;
- return true;
- } else {
- waitingStack = result;
- markDirty();
- }
- }
- } else
- waitingStack = null;
- return false;
- }
+ public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
+ this.stackList[par1] = par2ItemStack;
+ }
- boolean isFull() {
- for (int i = 0; i < 9; i++)
- if (!isLocked(i) && getStackInSlot(i) == null)
- return false;
+ public ItemStack decrStackSize(int par1, int par2) {
+ if (this.stackList[par1] == null) {
+ return null;
+ }
+ if (this.stackList[par1].stackSize <= par2) {
+ final ItemStack var3 = this.stackList[par1];
+ this.stackList[par1] = null;
+ return var3;
+ }
+ final ItemStack var3 = this.stackList[par1].splitStack(par2);
+ if (this.stackList[par1].stackSize == 0) {
+ this.stackList[par1] = null;
+ }
+ return var3;
+ }
+ };
+ for (int i = 0; i < 10; i++) {
+ ItemStack stack = getStackInSlot(i);
+ if (stack == null || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
+ continue;
+ craft.setInventorySlotContents(i, stack.copy());
+ }
+ ItemStack result = ThaumcraftCraftingManager.findMatchingArcaneRecipe(craft, player);
+ if (result != null) {
+ final AspectList aspects = ThaumcraftCraftingManager.findMatchingArcaneRecipeAspects(craft, player);
+ if (aspects.size() > 0 && this.getStackInSlot(10) != null) {
+ final ItemWandCasting wand = (ItemWandCasting) this.getStackInSlot(10).getItem();
+ if (wand.consumeAllVisCrafting(this.getStackInSlot(10), player, aspects, true)) {
+ for (int var2 = 0; var2 < 9; ++var2) {
+ final ItemStack var3 = craft.getStackInSlot(var2);
+ if (var3 != null) craft.decrStackSize(var2, 1);
+ }
+ for (int i = 0; i < 9; i++) setInventorySlotContents(i, craft.getStackInSlot(i));
+ setInventorySlotContents(9, result);
+ MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(player, result, craft));
+ waitingStack = null;
+ return true;
+ } else {
+ waitingStack = result;
+ markDirty();
+ }
+ }
+ } else waitingStack = null;
+ return false;
+ }
- return true;
- }
+ boolean isFull() {
+ for (int i = 0; i < 9; i++) if (!isLocked(i) && getStackInSlot(i) == null) return false;
- public boolean[][] getPattern() {
- return pattern;
- }
+ return true;
+ }
- public void setPattern(boolean[][] pattern) {
- this.pattern = pattern;
- }
+ public boolean[][] getPattern() {
+ return pattern;
+ }
- public int getSizeInventory() {
- return 12;
- }
+ public void setPattern(boolean[][] pattern) {
+ this.pattern = pattern;
+ }
- public EntityPlayer getPlayer() {
- return player;
- }
+ public int getSizeInventory() {
+ return 12;
+ }
- public void setPlayer(EntityPlayer player) {
- this.player = player;
- }
+ public EntityPlayer getPlayer() {
+ return player;
+ }
- public int getSignal() {
- return signal;
- }
+ public void setPlayer(EntityPlayer player) {
+ this.player = player;
+ }
- public ItemStack getWaitingStack() {
- return waitingStack;
- }
+ public int getSignal() {
+ return signal;
+ }
- private boolean isWaiting() {
- return waitingStack != null;
- }
+ public ItemStack getWaitingStack() {
+ return waitingStack;
+ }
- public boolean isItemValidForSlot(int i, ItemStack itemstack) {
- if (i < 9 && !isLocked(i))
- return true;
- if (i == 9)
- return false;
- if (i == 10) {
- if (!(itemstack.getItem() instanceof ItemWandCasting)) {
- return false;
- }
- final ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
- return !wand.isStaff(itemstack);
- }
- return itemstack.getItem() instanceof ItemThaumonomicon;
- }
+ private boolean isWaiting() {
+ return waitingStack != null;
+ }
- private boolean isLocked(int slot) {
- return pattern != null && !pattern[slot / 3][slot % 3];
- }
+ public boolean isItemValidForSlot(int i, ItemStack itemstack) {
+ if (i < 9 && !isLocked(i)) return true;
+ if (i == 9) return false;
+ if (i == 10) {
+ if (!(itemstack.getItem() instanceof ItemWandCasting)) {
+ return false;
+ }
+ final ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
+ return !wand.isStaff(itemstack);
+ }
+ return itemstack.getItem() instanceof ItemThaumonomicon;
+ }
- public void readCustomNBT(NBTTagCompound nbtt) {
- super.readCustomNBT(nbtt);
- NBTTagList var2 = nbtt.getTagList("Items", 10);
- inventorySlots = new ItemStack[getSizeInventory()];
- for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
- NBTTagCompound var4 = var2.getCompoundTagAt(var3);
- byte var5 = var4.getByte("Slot");
- if(var5 >= 0 && var5 < inventorySlots.length)
- inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
- }
- for(int i = 0; i < 3; i++)
- for(int j = 0; j < 3; j++)
- pattern[i][j] = nbtt.getBoolean(PATTERN_TAG + i * 3 + j);
- NBTTagCompound nbtt1 = nbtt.getCompoundTag(WAITING_TAG);
- if(nbtt1 != null)
- waitingStack = ItemStack.loadItemStackFromNBT(nbtt1);
- }
+ private boolean isLocked(int slot) {
+ return pattern != null && !pattern[slot / 3][slot % 3];
+ }
- public void writeCustomNBT(NBTTagCompound nbtt) {
- super.writeCustomNBT(nbtt);
- NBTTagList var2 = new NBTTagList();
- for(int var3 = 0; var3 < inventorySlots.length; ++var3) {
- if(inventorySlots[var3] != null) {
- NBTTagCompound var4 = new NBTTagCompound();
- var4.setByte("Slot", (byte) var3);
- inventorySlots[var3].writeToNBT(var4);
- var2.appendTag(var4);
- }
- }
- nbtt.setTag("Items", var2);
- for(int i = 0; i < 3; i++)
- for(int j = 0; j < 3; j++)
- nbtt.setBoolean(PATTERN_TAG + i * 3 + j, pattern[i][j]);
- NBTTagCompound nbtt1 = new NBTTagCompound();
- if(waitingStack != null) {
- waitingStack.writeToNBT(nbtt1);
- nbtt.setTag(WAITING_TAG, nbtt1);
- }
- }
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ super.readCustomNBT(nbtt);
+ NBTTagList var2 = nbtt.getTagList("Items", 10);
+ inventorySlots = new ItemStack[getSizeInventory()];
+ for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
+ NBTTagCompound var4 = var2.getCompoundTagAt(var3);
+ byte var5 = var4.getByte("Slot");
+ if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
+ }
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++) pattern[i][j] = nbtt.getBoolean(PATTERN_TAG + i * 3 + j);
+ NBTTagCompound nbtt1 = nbtt.getCompoundTag(WAITING_TAG);
+ if (nbtt1 != null) waitingStack = ItemStack.loadItemStackFromNBT(nbtt1);
+ }
- public void markDirty() {
- super.markDirty();
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
- }
+ public void writeCustomNBT(NBTTagCompound nbtt) {
+ super.writeCustomNBT(nbtt);
+ NBTTagList var2 = new NBTTagList();
+ for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
+ if (inventorySlots[var3] != null) {
+ NBTTagCompound var4 = new NBTTagCompound();
+ var4.setByte("Slot", (byte) var3);
+ inventorySlots[var3].writeToNBT(var4);
+ var2.appendTag(var4);
+ }
+ }
+ nbtt.setTag("Items", var2);
+ for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) nbtt.setBoolean(PATTERN_TAG + i * 3 + j, pattern[i][j]);
+ NBTTagCompound nbtt1 = new NBTTagCompound();
+ if (waitingStack != null) {
+ waitingStack.writeToNBT(nbtt1);
+ nbtt.setTag(WAITING_TAG, nbtt1);
+ }
+ }
- public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
- super.onDataPacket(manager, packet);
- worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
- }
+ public void markDirty() {
+ super.markDirty();
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
+ }
- public Packet getDescriptionPacket() {
- final NBTTagCompound compound = new NBTTagCompound();
- this.writeToNBT(compound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
- }
+ public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
+ super.onDataPacket(manager, packet);
+ worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
+ }
- public boolean canExtractItem(int i, ItemStack itemstack, int j) {
- return i == 9;
- }
+ public Packet getDescriptionPacket() {
+ final NBTTagCompound compound = new NBTTagCompound();
+ this.writeToNBT(compound);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
+ }
- public int[] getAccessibleSlotsFromSide(int side) {
- return ACCESSIBLE_SLOTS;
- }
+ public boolean canExtractItem(int i, ItemStack itemstack, int j) {
+ return i == 9;
+ }
- public boolean canInsertItem(int i, ItemStack stack, int j) {
- return i < 9;
- }
+ public int[] getAccessibleSlotsFromSide(int side) {
+ return ACCESSIBLE_SLOTS;
+ }
- public int getInventoryStackLimit() {
- return 1;
- }
+ public boolean canInsertItem(int i, ItemStack stack, int j) {
+ return i < 9;
+ }
- public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) {
- return 0;
- }
+ public int getInventoryStackLimit() {
+ return 1;
+ }
- public ItemStack onWandRightClick(final World world, final ItemStack wandstack, final EntityPlayer player) {
- this.player = player;
- return wandstack;
- }
+ public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side,
+ int md) {
+ return 0;
+ }
- public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {}
+ public ItemStack onWandRightClick(final World world, final ItemStack wandstack, final EntityPlayer player) {
+ this.player = player;
+ return wandstack;
+ }
- public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {}
+ public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {}
- public void ejectAll() {
- for(int i = 0; i < 10; ++i) {
- ItemStack stack = getStackInSlot(i);
- if(stack != null)
- eject(stack, false);
- setInventorySlotContents(i, null);
- }
- this.waitingStack = null;
- markDirty();
- }
+ public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {}
- public void eject(ItemStack stack, boolean redstone) {
- EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.5, zCoord + 0.5, stack);
- item.motionX = 0;
- item.motionY = 0;
- item.motionZ = 0;
- if(redstone)
- item.age = -200;
- setInventorySlotContents(0, null);
- if(!worldObj.isRemote)
- worldObj.spawnEntityInWorld(item);
- }
+ public void ejectAll() {
+ for (int i = 0; i < 10; ++i) {
+ ItemStack stack = getStackInSlot(i);
+ if (stack != null) eject(stack, false);
+ setInventorySlotContents(i, null);
+ }
+ this.waitingStack = null;
+ markDirty();
+ }
- public boolean canEject() {
- Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
- return blockBelow.isAir(worldObj, xCoord, yCoord - 1, zCoord) || blockBelow.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord - 1, zCoord) == null;
- }
+ public void eject(ItemStack stack, boolean redstone) {
+ EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.5, zCoord + 0.5, stack);
+ item.motionX = 0;
+ item.motionY = 0;
+ item.motionZ = 0;
+ if (redstone) item.age = -200;
+ setInventorySlotContents(0, null);
+ if (!worldObj.isRemote) worldObj.spawnEntityInWorld(item);
+ }
- ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
+ public boolean canEject() {
+ Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
+ return blockBelow.isAir(worldObj, xCoord, yCoord - 1, zCoord)
+ || blockBelow.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord - 1, zCoord) == null;
+ }
- @Override
- public ItemStack getStackInSlot(int i) {
- return inventorySlots[i];
- }
+ ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
- public ItemStack decrStackSize(int i, int j) {
- if(inventorySlots[i] != null) {
- ItemStack stackAt;
- if (inventorySlots[i].stackSize <= j) {
- stackAt = inventorySlots[i];
- inventorySlots[i] = null;
- return stackAt;
- } else {
- stackAt = inventorySlots[i].splitStack(j);
- if(inventorySlots[i].stackSize == 0)
- inventorySlots[i] = null;
- return stackAt;
- }
- }
- return null;
- }
+ @Override
+ public ItemStack getStackInSlot(int i) {
+ return inventorySlots[i];
+ }
- // Copied from vazkii.botania.common.block.tile.TileSimpleInventory
+ public ItemStack decrStackSize(int i, int j) {
+ if (inventorySlots[i] != null) {
+ ItemStack stackAt;
+ if (inventorySlots[i].stackSize <= j) {
+ stackAt = inventorySlots[i];
+ inventorySlots[i] = null;
+ return stackAt;
+ } else {
+ stackAt = inventorySlots[i].splitStack(j);
+ if (inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
+ return stackAt;
+ }
+ }
+ return null;
+ }
- public ItemStack getStackInSlotOnClosing(int i) {
- return getStackInSlot(i);
- }
+ // Copied from vazkii.botania.common.block.tile.TileSimpleInventory
- public void setInventorySlotContents(int i, ItemStack itemstack) {
- inventorySlots[i] = itemstack;
- }
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return getStackInSlot(i);
+ }
- public boolean isUseableByPlayer(EntityPlayer entityplayer) {
- return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
- }
+ public void setInventorySlotContents(int i, ItemStack itemstack) {
+ inventorySlots[i] = itemstack;
+ }
- public boolean hasCustomInventoryName() {
- return false;
- }
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false
+ : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
+ }
- public void openInventory() {}
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
- public void closeInventory() {}
-}
\ No newline at end of file
+ public void openInventory() {}
+
+ public void closeInventory() {}
+}
diff --git a/src/main/java/ab/common/block/tile/TileManaCharger.java b/src/main/java/ab/common/block/tile/TileManaCharger.java
index 680a4f8..2399485 100644
--- a/src/main/java/ab/common/block/tile/TileManaCharger.java
+++ b/src/main/java/ab/common/block/tile/TileManaCharger.java
@@ -1,279 +1,274 @@
package ab.common.block.tile;
-import java.awt.Color;
-import java.util.List;
-import java.util.Random;
-
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IRenderHud;
-import ab.client.core.ClientHelper;
-import ab.common.core.handler.ConfigABHandler;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.StatCollector;
+
+import org.lwjgl.opengl.GL11;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.spark.ISparkAttachable;
-import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.wand.IWandBindable;
-import vazkii.botania.client.core.handler.ClientTickHandler;
-import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
-import vazkii.botania.common.block.tile.TileSimpleInventory;
-import vazkii.botania.common.core.helper.Vector3;
+import ab.api.IRenderHud;
+import ab.client.core.ClientHelper;
+import ab.common.core.handler.ConfigABHandler;
public class TileManaCharger extends TileInventory implements ISidedInventory, IRenderHud, IWandBindable {
- private static final int MANA_SPEED = 11240;
-
- public boolean requestUpdate;
- int clientMana = -1;
- int receiverPosX = -1;
- int receiverPosY = -1;
- int receiverPosZ = -1;
- public int clientTick[] = new int[] {0, 0, 3, 12, 6};
-
- public void updateEntity() {
- boolean hasUpdate = false;
- if(!this.worldObj.isRemote && requestUpdate)
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- ISparkAttachable receiver = this.getReceiver();
- if(receiver == null)
- return;
- for(int i = 0; i < this.getSizeInventory(); i++) {
- ItemStack stack = this.getStackInSlot(i);
- if(stack == null)
- continue;
- else if(stack.getItem() instanceof IManaItem) {
- IManaItem mana = (IManaItem)stack.getItem();
- if(i == 0) {
- if(mana.getMana(stack) > 0 && !receiver.isFull() && mana.canExportManaToPool(stack, (TileEntity)receiver)) {
- int availableMana = ((ISparkAttachable)receiver).getAvailableSpaceForMana();
- int manaVal = Math.min(Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED) * 3, Math.min(availableMana, mana.getMana(stack)));
- if(!this.worldObj.isRemote) {
- mana.addMana(stack, -manaVal);
- if(this.worldObj.getTotalWorldTime() % 15 == 0)
- hasUpdate = true;
- } else {
- clientTick[i]++;
- }
- receiver.recieveMana(manaVal);
- }
- continue;
- } else if(receiver.getCurrentMana() > 0 && mana.getMana(stack) < mana.getMaxMana(stack) && mana.canReceiveManaFromPool(stack, (TileEntity)receiver)) {
- int manaVal = Math.min(Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED), Math.min(receiver.getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
- if(!this.worldObj.isRemote) {
- mana.addMana(stack, manaVal);
- if(this.worldObj.getTotalWorldTime() % 15 == 0)
- hasUpdate = true;
- } else {
- if(ConfigABHandler.useManaChargerAnimation)
- clientTick[i]++;
- }
- receiver.recieveMana(-manaVal);
- }
- }
- }
- requestUpdate = hasUpdate;
- }
-
- public ISparkAttachable getReceiver() {
- ISparkAttachable receiver = null;
- if(this.worldObj != null && this.receiverPosY != -1) {
- TileEntity tile = this.worldObj.getTileEntity(receiverPosX, receiverPosY, receiverPosZ);
- if(tile != null && tile instanceof ISparkAttachable) {
- receiver = (ISparkAttachable)tile;
- }
- }
- if(receiver == null) {
- receiverPosX = -1;
- receiverPosY = -1;
- receiverPosZ = -1;
- }
- return receiver;
- }
-
- public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
- return true;
- }
-
- public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
- TileEntity tile = this.worldObj.getTileEntity(x, y, z);
- boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10 || Math.abs(this.zCoord - z) >= 10;
- if(isFar)
- return false;
- else if(tile instanceof ISparkAttachable && ((ISparkAttachable)tile).canRecieveManaFromBursts()) {
- if(!this.worldObj.isRemote) {
- this.receiverPosX = tile.xCoord;
- this.receiverPosY = tile.yCoord;
- this.receiverPosZ = tile.zCoord;
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- }
- return true;
- }
- return false;
- }
-
- public ChunkCoordinates getBinding() {
- IManaReceiver receiver = this.getReceiver();
- if(receiver == null)
- return null;
- TileEntity tile = (TileEntity)receiver;
- return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord);
- }
-
- public static float getManaPercent(ItemStack stack) {
- if(!(stack.getItem() instanceof IManaItem))
- return 0.0f;
- IManaItem mana = (IManaItem)stack.getItem();
- return (float)mana.getMana(stack) / (mana.getMaxMana(stack) / 100.0f);
- }
-
- public void renderHud(Minecraft mc, ScaledResolution res) {
- int xc = res.getScaledWidth() / 2;
- int yc = res.getScaledHeight() / 2;
- int radius = 42;
- int amt = 0;
- for(int i = 0; i < getSizeInventory(); i++)
- if(getStackInSlot(i) != null)
- amt++;
- float angle = -90.0f;
- if(amt >= 0) {
- for (int i = 0; i < getSizeInventory(); i++) {
- ItemStack stack = getStackInSlot(i);
- if(stack == null)
- continue;
- float anglePer = 360.0F / amt;
- double xPos = xc + Math.cos(angle * Math.PI / 180.0D) * radius - 8.0D;
- double yPos = yc + Math.sin(angle * Math.PI / 180.0D) * radius - 8.0D;
- RenderHelper.enableGUIStandardItemLighting();
- GL11.glPushMatrix();
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glTranslated(xPos, yPos, 0.0D);
- vazkii.botania.client.core.helper.RenderHelper.renderProgressPie(0, 0, getManaPercent(stack) / 100.0f, stack);
- if(i == 0) {
- GL11.glScalef(0.75f, 0.75f, 0.75f);
- GL11.glTranslated(11.0D, 10.0D, 0.0D);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
- }
- GL11.glDisable(2896);
- GL11.glDisable(3042);
- GL11.glPopMatrix();
- RenderHelper.disableStandardItemLighting();
- angle += anglePer;
- }
- }
- }
-
- public void onWanded(EntityPlayer player, ItemStack wand) {
- ISparkAttachable reciever = getReceiver();
- if(player == null)
- return;
- if(this.worldObj.isRemote && reciever != null)
- clientMana = reciever.getCurrentMana();
- this.worldObj.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
- }
-
- public void renderHUD(Minecraft mc, ScaledResolution res) {
- ISparkAttachable reciever = getReceiver();
- if(reciever != null) {
- String name = StatCollector.translateToLocal("ab.manaCharger.wandHud");
- TileEntity receiverTile = (TileEntity)reciever;
- ItemStack recieverStack = new ItemStack(this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata());
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- if(recieverStack != null && recieverStack.getItem() != null) {
- String stackName = recieverStack.getDisplayName();
- int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
- int x = res.getScaledWidth() / 2 - width;
- int y = res.getScaledHeight() / 2 + 48;
- mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, 0xf4f4f4);
- RenderHelper.enableGUIStandardItemLighting();
- RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
- RenderHelper.disableStandardItemLighting();
- }
- GL11.glDisable(2896);
- GL11.glDisable(3042);
- ClientHelper.drawPoolManaHUD(res, name, clientMana, reciever.getAvailableSpaceForMana() + reciever.getCurrentMana(), 0xb9bbae);
- }
- }
-
- public int getSizeInventory() {
- return 5;
- }
-
- public int getInventoryStackLimit() {
- return 1;
- }
+ private static final int MANA_SPEED = 11240;
- public String getInventoryName() {
- return "ab.manaCharger";
- }
-
- public void writeCustomNBT(NBTTagCompound nbtt) {
- super.writeCustomNBT(nbtt);
- nbtt.setInteger("bindingX", this.receiverPosX);
- nbtt.setInteger("bindingY", this.receiverPosY);
- nbtt.setInteger("bindingZ", this.receiverPosZ);
- nbtt.setBoolean("requestUpdate", this.requestUpdate);
- }
-
- public void readFromNBT(NBTTagCompound nbtt) {
- super.readFromNBT(nbtt);
- this.requestUpdate = nbtt.getBoolean("requestUpdate");
- }
-
- public void readCustomNBT(NBTTagCompound nbtt) {
- super.readCustomNBT(nbtt);
- this.receiverPosX = nbtt.getInteger("bindingX");
- this.receiverPosY = nbtt.getInteger("bindingY");
- this.receiverPosZ = nbtt.getInteger("bindingZ");
- }
+ public boolean requestUpdate;
+ int clientMana = -1;
+ int receiverPosX = -1;
+ int receiverPosY = -1;
+ int receiverPosZ = -1;
+ public int clientTick[] = new int[] { 0, 0, 3, 12, 6 };
- public int[] getAccessibleSlotsFromSide(int side) {
- return new int[] {1, 2, 3, 4};
- }
+ public void updateEntity() {
+ boolean hasUpdate = false;
+ if (!this.worldObj.isRemote && requestUpdate)
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ ISparkAttachable receiver = this.getReceiver();
+ if (receiver == null) return;
+ for (int i = 0; i < this.getSizeInventory(); i++) {
+ ItemStack stack = this.getStackInSlot(i);
+ if (stack == null) continue;
+ else if (stack.getItem() instanceof IManaItem) {
+ IManaItem mana = (IManaItem) stack.getItem();
+ if (i == 0) {
+ if (mana.getMana(stack) > 0 && !receiver.isFull()
+ && mana.canExportManaToPool(stack, (TileEntity) receiver)) {
+ int availableMana = ((ISparkAttachable) receiver).getAvailableSpaceForMana();
+ int manaVal = Math.min(
+ Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED) * 3,
+ Math.min(availableMana, mana.getMana(stack)));
+ if (!this.worldObj.isRemote) {
+ mana.addMana(stack, -manaVal);
+ if (this.worldObj.getTotalWorldTime() % 15 == 0) hasUpdate = true;
+ } else {
+ clientTick[i]++;
+ }
+ receiver.recieveMana(manaVal);
+ }
+ continue;
+ } else if (receiver.getCurrentMana() > 0 && mana.getMana(stack) < mana.getMaxMana(stack)
+ && mana.canReceiveManaFromPool(stack, (TileEntity) receiver)) {
+ int manaVal = Math.min(
+ Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED),
+ Math.min(receiver.getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
+ if (!this.worldObj.isRemote) {
+ mana.addMana(stack, manaVal);
+ if (this.worldObj.getTotalWorldTime() % 15 == 0) hasUpdate = true;
+ } else {
+ if (ConfigABHandler.useManaChargerAnimation) clientTick[i]++;
+ }
+ receiver.recieveMana(-manaVal);
+ }
+ }
+ }
+ requestUpdate = hasUpdate;
+ }
- public boolean canInsertItem(int slot, ItemStack stack, int side) {
- boolean isManaItem = false;
- if(stack != null && stack.getItem() instanceof IManaItem) {
- IManaItem mana = (IManaItem)stack.getItem();
- ISparkAttachable receiver = this.getReceiver();
- if(receiver == null)
- return false;
- isManaItem = mana.getMana(stack) < mana.getMaxMana(stack) && mana.canReceiveManaFromPool(stack, (TileEntity)receiver);
- }
- return side == 1 && slot != 0 && isManaItem;
- }
+ public ISparkAttachable getReceiver() {
+ ISparkAttachable receiver = null;
+ if (this.worldObj != null && this.receiverPosY != -1) {
+ TileEntity tile = this.worldObj.getTileEntity(receiverPosX, receiverPosY, receiverPosZ);
+ if (tile != null && tile instanceof ISparkAttachable) {
+ receiver = (ISparkAttachable) tile;
+ }
+ }
+ if (receiver == null) {
+ receiverPosX = -1;
+ receiverPosY = -1;
+ receiverPosZ = -1;
+ }
+ return receiver;
+ }
- public boolean canExtractItem(int slot, ItemStack stack, int side) {
- boolean isManaItem = false;
- if(stack != null && stack.getItem() instanceof IManaItem) {
- IManaItem mana = (IManaItem)stack.getItem();
- ISparkAttachable receiver = this.getReceiver();
- if(receiver == null)
- return false;
- isManaItem = mana.getMana(stack) == mana.getMaxMana(stack);
- }
- return side == 0 && slot != 0 && isManaItem;
- }
-}
\ No newline at end of file
+ public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
+ return true;
+ }
+
+ public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
+ TileEntity tile = this.worldObj.getTileEntity(x, y, z);
+ boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10
+ || Math.abs(this.zCoord - z) >= 10;
+ if (isFar) return false;
+ else if (tile instanceof ISparkAttachable && ((ISparkAttachable) tile).canRecieveManaFromBursts()) {
+ if (!this.worldObj.isRemote) {
+ this.receiverPosX = tile.xCoord;
+ this.receiverPosY = tile.yCoord;
+ this.receiverPosZ = tile.zCoord;
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public ChunkCoordinates getBinding() {
+ IManaReceiver receiver = this.getReceiver();
+ if (receiver == null) return null;
+ TileEntity tile = (TileEntity) receiver;
+ return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord);
+ }
+
+ public static float getManaPercent(ItemStack stack) {
+ if (!(stack.getItem() instanceof IManaItem)) return 0.0f;
+ IManaItem mana = (IManaItem) stack.getItem();
+ return (float) mana.getMana(stack) / (mana.getMaxMana(stack) / 100.0f);
+ }
+
+ public void renderHud(Minecraft mc, ScaledResolution res) {
+ int xc = res.getScaledWidth() / 2;
+ int yc = res.getScaledHeight() / 2;
+ int radius = 42;
+ int amt = 0;
+ for (int i = 0; i < getSizeInventory(); i++) if (getStackInSlot(i) != null) amt++;
+ float angle = -90.0f;
+ if (amt >= 0) {
+ for (int i = 0; i < getSizeInventory(); i++) {
+ ItemStack stack = getStackInSlot(i);
+ if (stack == null) continue;
+ float anglePer = 360.0F / amt;
+ double xPos = xc + Math.cos(angle * Math.PI / 180.0D) * radius - 8.0D;
+ double yPos = yc + Math.sin(angle * Math.PI / 180.0D) * radius - 8.0D;
+ RenderHelper.enableGUIStandardItemLighting();
+ GL11.glPushMatrix();
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glTranslated(xPos, yPos, 0.0D);
+ vazkii.botania.client.core.helper.RenderHelper
+ .renderProgressPie(0, 0, getManaPercent(stack) / 100.0f, stack);
+ if (i == 0) {
+ GL11.glScalef(0.75f, 0.75f, 0.75f);
+ GL11.glTranslated(11.0D, 10.0D, 0.0D);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance().renderItemAndEffectIntoGUI(
+ mc.fontRenderer,
+ mc.renderEngine,
+ new ItemStack(ModBlocks.pool),
+ 0,
+ 0);
+ }
+ GL11.glDisable(2896);
+ GL11.glDisable(3042);
+ GL11.glPopMatrix();
+ RenderHelper.disableStandardItemLighting();
+ angle += anglePer;
+ }
+ }
+ }
+
+ public void onWanded(EntityPlayer player, ItemStack wand) {
+ ISparkAttachable reciever = getReceiver();
+ if (player == null) return;
+ if (this.worldObj.isRemote && reciever != null) clientMana = reciever.getCurrentMana();
+ this.worldObj.playSoundAtEntity((Entity) player, "botania:ding", 0.11F, 1.0F);
+ }
+
+ public void renderHUD(Minecraft mc, ScaledResolution res) {
+ ISparkAttachable reciever = getReceiver();
+ if (reciever != null) {
+ String name = StatCollector.translateToLocal("ab.manaCharger.wandHud");
+ TileEntity receiverTile = (TileEntity) reciever;
+ ItemStack recieverStack = new ItemStack(
+ this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord),
+ 1,
+ receiverTile.getBlockMetadata());
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+ if (recieverStack != null && recieverStack.getItem() != null) {
+ String stackName = recieverStack.getDisplayName();
+ int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
+ int x = res.getScaledWidth() / 2 - width;
+ int y = res.getScaledHeight() / 2 + 48;
+ mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, 0xf4f4f4);
+ RenderHelper.enableGUIStandardItemLighting();
+ RenderItem.getInstance()
+ .renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
+ RenderHelper.disableStandardItemLighting();
+ }
+ GL11.glDisable(2896);
+ GL11.glDisable(3042);
+ ClientHelper.drawPoolManaHUD(
+ res,
+ name,
+ clientMana,
+ reciever.getAvailableSpaceForMana() + reciever.getCurrentMana(),
+ 0xb9bbae);
+ }
+ }
+
+ public int getSizeInventory() {
+ return 5;
+ }
+
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ public String getInventoryName() {
+ return "ab.manaCharger";
+ }
+
+ public void writeCustomNBT(NBTTagCompound nbtt) {
+ super.writeCustomNBT(nbtt);
+ nbtt.setInteger("bindingX", this.receiverPosX);
+ nbtt.setInteger("bindingY", this.receiverPosY);
+ nbtt.setInteger("bindingZ", this.receiverPosZ);
+ nbtt.setBoolean("requestUpdate", this.requestUpdate);
+ }
+
+ public void readFromNBT(NBTTagCompound nbtt) {
+ super.readFromNBT(nbtt);
+ this.requestUpdate = nbtt.getBoolean("requestUpdate");
+ }
+
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ super.readCustomNBT(nbtt);
+ this.receiverPosX = nbtt.getInteger("bindingX");
+ this.receiverPosY = nbtt.getInteger("bindingY");
+ this.receiverPosZ = nbtt.getInteger("bindingZ");
+ }
+
+ public int[] getAccessibleSlotsFromSide(int side) {
+ return new int[] { 1, 2, 3, 4 };
+ }
+
+ public boolean canInsertItem(int slot, ItemStack stack, int side) {
+ boolean isManaItem = false;
+ if (stack != null && stack.getItem() instanceof IManaItem) {
+ IManaItem mana = (IManaItem) stack.getItem();
+ ISparkAttachable receiver = this.getReceiver();
+ if (receiver == null) return false;
+ isManaItem = mana.getMana(stack) < mana.getMaxMana(stack)
+ && mana.canReceiveManaFromPool(stack, (TileEntity) receiver);
+ }
+ return side == 1 && slot != 0 && isManaItem;
+ }
+
+ public boolean canExtractItem(int slot, ItemStack stack, int side) {
+ boolean isManaItem = false;
+ if (stack != null && stack.getItem() instanceof IManaItem) {
+ IManaItem mana = (IManaItem) stack.getItem();
+ ISparkAttachable receiver = this.getReceiver();
+ if (receiver == null) return false;
+ isManaItem = mana.getMana(stack) == mana.getMaxMana(stack);
+ }
+ return side == 0 && slot != 0 && isManaItem;
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileManaContainer.java b/src/main/java/ab/common/block/tile/TileManaContainer.java
index 58aca85..2e056df 100644
--- a/src/main/java/ab/common/block/tile/TileManaContainer.java
+++ b/src/main/java/ab/common/block/tile/TileManaContainer.java
@@ -3,128 +3,139 @@ package ab.common.block.tile;
import java.awt.Color;
import java.util.List;
-import org.lwjgl.opengl.GL11;
-
-import ab.client.core.ClientHelper;
-import ab.common.core.handler.ConfigABHandler;
-import ab.common.lib.register.BlockListAB;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
-import vazkii.botania.api.internal.VanillaPacketDispatcher;
+
import vazkii.botania.api.mana.IManaPool;
-import vazkii.botania.api.mana.IManaReceiver;
-import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
-import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileMod;
+import ab.client.core.ClientHelper;
+import ab.common.core.handler.ConfigABHandler;
public class TileManaContainer extends TileMod implements IManaPool, ISparkAttachable {
-
- protected int mana = 0;
- int knownMana = -1;
-
+
+ protected int mana = 0;
+ int knownMana = -1;
+
public boolean canUpdate() {
return true;
}
-
- public void updateEntity() {
- if(this.worldObj.isRemote) {
- double particleChance = 1.0D - getCurrentMana() / getMaxMana() * 0.1D;
- Color color = new Color(50943);
- if(Math.random() > particleChance)
- Botania.proxy.wispFX(this.worldObj, this.xCoord + 0.5f + (Math.random() - 0.5) * 0.4f, this.yCoord + 0.81D + (Math.random() * 0.05D), this.zCoord + 0.5f + (Math.random() - 0.5) * 0.4f, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F, (float)Math.random() / 4.2F, (float)-Math.random() / 50.0F, 2.0F);
- }
- }
-
- public void onWanded(EntityPlayer player, ItemStack wand) {
- if(player == null)
- return;
- if(!this.worldObj.isRemote) {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeCustomNBT(nbttagcompound);
- nbttagcompound.setInteger("knownMana", getCurrentMana());
- if (player instanceof EntityPlayerMP)
- ((EntityPlayerMP)player).playerNetServerHandler.sendPacket((Packet)new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound));
- }
- this.worldObj.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
- }
-
- public void renderHUD(Minecraft mc, ScaledResolution res) {
- String name = StatCollector.translateToLocal("ab.manaContainer." + worldObj.getBlockMetadata(xCoord, yCoord, zCoord) + ".hud");
- int color = 0x30ead1;
- ClientHelper.drawPoolManaHUD(res, name, this.knownMana, getMaxMana(), color);
- }
-
- public int getCurrentMana() {
- return this.mana;
- }
-
- public boolean canRecieveManaFromBursts() {
- return true;
- }
-
- public int getMaxMana() {
- int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
- return ConfigABHandler.maxContainerMana[Math.min(Math.max(meta, 0), ConfigABHandler.maxContainerMana.length)];
- }
- public boolean isFull() {
- return this.mana == getMaxMana();
- }
+ public void updateEntity() {
+ if (this.worldObj.isRemote) {
+ double particleChance = 1.0D - getCurrentMana() / getMaxMana() * 0.1D;
+ Color color = new Color(50943);
+ if (Math.random() > particleChance) Botania.proxy.wispFX(
+ this.worldObj,
+ this.xCoord + 0.5f + (Math.random() - 0.5) * 0.4f,
+ this.yCoord + 0.81D + (Math.random() * 0.05D),
+ this.zCoord + 0.5f + (Math.random() - 0.5) * 0.4f,
+ color.getRed() / 255.0F,
+ color.getGreen() / 255.0F,
+ color.getBlue() / 255.0F,
+ (float) Math.random() / 4.2F,
+ (float) -Math.random() / 50.0F,
+ 2.0F);
+ }
+ }
- public void recieveMana(int mana) {
- this.mana = Math.max(0, Math.min(getCurrentMana() + mana, getMaxMana()));
- }
-
- public void writeCustomNBT(NBTTagCompound nbtt) {
- nbtt.setInteger("mana", this.mana);
- }
-
- public void readCustomNBT(NBTTagCompound nbtt) {
- this.mana = nbtt.getInteger("mana");
- if (nbtt.hasKey("knownMana"))
- this.knownMana = nbtt.getInteger("knownMana");
- }
+ public void onWanded(EntityPlayer player, ItemStack wand) {
+ if (player == null) return;
+ if (!this.worldObj.isRemote) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeCustomNBT(nbttagcompound);
+ nbttagcompound.setInteger("knownMana", getCurrentMana());
+ if (player instanceof EntityPlayerMP) ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(
+ (Packet) new S35PacketUpdateTileEntity(
+ this.xCoord,
+ this.yCoord,
+ this.zCoord,
+ -999,
+ nbttagcompound));
+ }
+ this.worldObj.playSoundAtEntity((Entity) player, "botania:ding", 0.11F, 1.0F);
+ }
- public boolean areIncomingTranfersDone() {
- return false;
- }
+ public void renderHUD(Minecraft mc, ScaledResolution res) {
+ String name = StatCollector
+ .translateToLocal("ab.manaContainer." + worldObj.getBlockMetadata(xCoord, yCoord, zCoord) + ".hud");
+ int color = 0x30ead1;
+ ClientHelper.drawPoolManaHUD(res, name, this.knownMana, getMaxMana(), color);
+ }
- public void attachSpark(ISparkEntity entity) {}
+ public int getCurrentMana() {
+ return this.mana;
+ }
- public boolean canAttachSpark(ItemStack arg0) {
- return true;
- }
+ public boolean canRecieveManaFromBursts() {
+ return true;
+ }
- public ISparkEntity getAttachedSpark() {
- List sparks = this.worldObj.getEntitiesWithinAABB(ISparkEntity.class, AxisAlignedBB.getBoundingBox(this.xCoord, (this.yCoord + 1), this.zCoord, (this.xCoord + 1), (this.yCoord + 2), (this.zCoord + 1)));
- if (sparks.size() == 1) {
- Entity e = (Entity)sparks.get(0);
- return (ISparkEntity)e;
- }
- return null;
- }
+ public int getMaxMana() {
+ int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
+ return ConfigABHandler.maxContainerMana[Math.min(Math.max(meta, 0), ConfigABHandler.maxContainerMana.length)];
+ }
- public int getAvailableSpaceForMana() {
- return Math.max(0, getMaxMana() - getCurrentMana());
- }
-
- public boolean isOutputtingPower() {
- return false;
- }
-}
\ No newline at end of file
+ public boolean isFull() {
+ return this.mana == getMaxMana();
+ }
+
+ public void recieveMana(int mana) {
+ this.mana = Math.max(0, Math.min(getCurrentMana() + mana, getMaxMana()));
+ }
+
+ public void writeCustomNBT(NBTTagCompound nbtt) {
+ nbtt.setInteger("mana", this.mana);
+ }
+
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ this.mana = nbtt.getInteger("mana");
+ if (nbtt.hasKey("knownMana")) this.knownMana = nbtt.getInteger("knownMana");
+ }
+
+ public boolean areIncomingTranfersDone() {
+ return false;
+ }
+
+ public void attachSpark(ISparkEntity entity) {}
+
+ public boolean canAttachSpark(ItemStack arg0) {
+ return true;
+ }
+
+ public ISparkEntity getAttachedSpark() {
+ List sparks = this.worldObj.getEntitiesWithinAABB(
+ ISparkEntity.class,
+ AxisAlignedBB.getBoundingBox(
+ this.xCoord,
+ (this.yCoord + 1),
+ this.zCoord,
+ (this.xCoord + 1),
+ (this.yCoord + 2),
+ (this.zCoord + 1)));
+ if (sparks.size() == 1) {
+ Entity e = (Entity) sparks.get(0);
+ return (ISparkEntity) e;
+ }
+ return null;
+ }
+
+ public int getAvailableSpaceForMana() {
+ return Math.max(0, getMaxMana() - getCurrentMana());
+ }
+
+ public boolean isOutputtingPower() {
+ return false;
+ }
+}
diff --git a/src/main/java/ab/common/block/tile/TileManaCrystalCube.java b/src/main/java/ab/common/block/tile/TileManaCrystalCube.java
index bb215e2..5330950 100644
--- a/src/main/java/ab/common/block/tile/TileManaCrystalCube.java
+++ b/src/main/java/ab/common/block/tile/TileManaCrystalCube.java
@@ -1,64 +1,49 @@
package ab.common.block.tile;
-import java.util.ArrayList;
import java.util.List;
-import org.lwjgl.opengl.GL11;
-
-import ab.api.IRenderHud;
-import ab.client.core.ClientHelper;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.StatCollector;
+
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
-import vazkii.botania.client.core.handler.HUDHandler;
-import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileMod;
+import ab.api.IRenderHud;
+import ab.client.core.ClientHelper;
public class TileManaCrystalCube extends TileMod implements IRenderHud {
- int knownMana = -1;
- int knownMaxMana = -1;
-
- public boolean canUpdate() {
+ int knownMana = -1;
+ int knownMaxMana = -1;
+
+ public boolean canUpdate() {
return false;
}
-
- public void updateEntity() {}
-
- public void renderHud(Minecraft mc, ScaledResolution res) {
- String name = StatCollector.translateToLocal("ab.manaCrystalCube.hud");
- int color = 0x30ead1;
- ClientHelper.drawPoolManaHUD(res, name, this.knownMana, this.knownMaxMana, color);
- }
-
- public int[] getManaAround() {
- int[] mana = new int[] { 0, 0 };
- List allSparks = SparkHelper.getSparksAround(worldObj, xCoord, yCoord, zCoord);
- for(ISparkEntity spark : allSparks) {
- ISparkAttachable tileMana = spark.getAttachedTile();
- mana[1] += tileMana.getCurrentMana() + tileMana.getAvailableSpaceForMana();
- mana[0] += tileMana.getCurrentMana();
- }
- return mana;
- }
-
- public void readCustomNBT(NBTTagCompound nbtt) {
- if (nbtt.hasKey("knownMana"))
- this.knownMana = nbtt.getInteger("knownMana");
- if (nbtt.hasKey("knownMaxMana"))
- this.knownMaxMana = nbtt.getInteger("knownMaxMana");
- }
+
+ public void updateEntity() {}
+
+ public void renderHud(Minecraft mc, ScaledResolution res) {
+ String name = StatCollector.translateToLocal("ab.manaCrystalCube.hud");
+ int color = 0x30ead1;
+ ClientHelper.drawPoolManaHUD(res, name, this.knownMana, this.knownMaxMana, color);
+ }
+
+ public int[] getManaAround() {
+ int[] mana = new int[] { 0, 0 };
+ List allSparks = SparkHelper.getSparksAround(worldObj, xCoord, yCoord, zCoord);
+ for (ISparkEntity spark : allSparks) {
+ ISparkAttachable tileMana = spark.getAttachedTile();
+ mana[1] += tileMana.getCurrentMana() + tileMana.getAvailableSpaceForMana();
+ mana[0] += tileMana.getCurrentMana();
+ }
+ return mana;
+ }
+
+ public void readCustomNBT(NBTTagCompound nbtt) {
+ if (nbtt.hasKey("knownMana")) this.knownMana = nbtt.getInteger("knownMana");
+ if (nbtt.hasKey("knownMaxMana")) this.knownMaxMana = nbtt.getInteger("knownMaxMana");
+ }
}
diff --git a/src/main/java/ab/common/block/tile/TileNidavellirForge.java b/src/main/java/ab/common/block/tile/TileNidavellirForge.java
index efad430..41ae6e5 100644
--- a/src/main/java/ab/common/block/tile/TileNidavellirForge.java
+++ b/src/main/java/ab/common/block/tile/TileNidavellirForge.java
@@ -4,261 +4,288 @@ import java.awt.Color;
import java.util.List;
import java.util.Random;
-import ab.api.AdvancedBotanyAPI;
-import ab.api.recipe.RecipeAdvancedPlate;
-import ab.common.lib.register.BlockListAB;
-import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
-import net.minecraft.init.Blocks;
-import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
-import scala.reflect.internal.Trees.This;
+
import vazkii.botania.api.internal.VanillaPacketDispatcher;
-import vazkii.botania.api.lexicon.multiblock.Multiblock;
-import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.mana.IManaPool;
-import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.Botania;
-import vazkii.botania.common.block.ModBlocks;
-import vazkii.botania.common.block.ModFluffBlocks;
-import vazkii.botania.common.block.tile.TileMod;
-import vazkii.botania.common.block.tile.TileSimpleInventory;
-import vazkii.botania.common.item.ModItems;
+import ab.api.AdvancedBotanyAPI;
+import ab.api.recipe.RecipeAdvancedPlate;
public class TileNidavellirForge extends TileInventory implements ISparkAttachable, ISidedInventory {
- private int mana;
- public int manaToGet;
- private RecipeAdvancedPlate currentRecipe;
- private int recipeID;
- public boolean requestUpdate;
-
- public void updateEntity() {
- if(!this.worldObj.isRemote)
- updateServer();
- else
- updateClient();
- ISparkEntity spark = getAttachedSpark();
- if (spark != null) {
- List sparkEntities = SparkHelper.getSparksAround(this.worldObj, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D);
- for (ISparkEntity otherSpark : sparkEntities) {
- if(spark == otherSpark)
- continue;
- else if(otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof IManaPool)
- otherSpark.registerTransfer(spark);
- }
- }
- }
-
- private void updateServer() {
- if(requestUpdate)
- VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
- boolean hasUpdate = false;
- List items = this.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 1), (this.zCoord + 1)));
- for(EntityItem item : items) {
- if(item.getEntityItem() != null && !item.isDead) {
- ItemStack stack = item.getEntityItem();
- int splitCount = addItemStack(stack);
- stack.stackSize -= splitCount;
- if(stack.stackSize <= 0)
- item.setDead();
- if(splitCount > 0)
- hasUpdate = true;
- break;
- }
- }
- int wasManaToGet = this.manaToGet;
- boolean hasCraft = false;
- int recipeID = 0;
- for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
- if(recipe.matches(this)) {
- this.recipeID = recipeID;
- if(this.mana > 0 && this.isFull()) {
- ItemStack output = recipe.getOutput().copy();
- this.recieveMana(-recipe.getManaUsage());
- this.manaToGet = 0;
- for(int i = 1; i < this.getSizeInventory(); i++) {
- if(this.getStackInSlot(i).stackSize > 1)
- --this.getStackInSlot(i).stackSize;
- else
- this.setInventorySlotContents(i, null);
- }
- if(this.getStackInSlot(0) != null)
- ++this.getStackInSlot(0).stackSize;
- else
- this.setInventorySlotContents(0, output);
- hasUpdate = true;
- worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:terrasteelCraft", 1.0F, 2.0F);
- break;
- } else {
- if(this.getStackInSlot(0) == null) {
- this.manaToGet = recipe.getManaUsage();
- currentRecipe = recipe;
- hasCraft = true;
- break;
- } else if(isItemEqual(recipe.getOutput(), getStackInSlot(0)) && getStackInSlot(0).stackSize < recipe.getOutput().getMaxStackSize()) {
- this.manaToGet = recipe.getManaUsage();
- currentRecipe = recipe;
- hasCraft = true;
- break;
- }
- }
- }
- recipeID++;
- }
- if(!hasCraft) {
- currentRecipe = null;
- this.mana = 0;
- this.manaToGet = 0;
- }
- if(this.manaToGet != wasManaToGet)
- hasUpdate = true;
- requestUpdate = hasUpdate;
- }
-
- private void updateClient() {
- if(this.mana > 0) {
- double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
- worldTime += (new Random((this.xCoord ^ this.yCoord ^ this.zCoord))).nextInt(360);
- float indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
- float ticks = 100.0F * getCurrentMana() / this.manaToGet;
- int totalSpiritCount = 3;
- double tickIncrement = 360.0D / totalSpiritCount;
- int speed = 5;
- double wticks = (ticks * speed) - tickIncrement;
- double r = Math.sin((ticks - 100) / 10.0D) * 0.5D;
- double g = Math.sin(wticks * Math.PI / 180.0D * 0.55D);
- float size = 0.4f;
- for(int i = 0; i < totalSpiritCount; i++) {
- double x = this.xCoord + Math.sin(wticks * Math.PI / 180.0D) * r + 0.5D;
- double y = this.yCoord - indetY + 0.85D + Math.abs(r) * 0.7D;
- double z = this.zCoord + Math.cos(wticks * Math.PI / 180.0D) * r + 0.5D;
- wticks += tickIncrement;
- int color = 0x24cce0;
- if(currentRecipe != null)
- color = currentRecipe.getColor();
- float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
- int color1 = Color.HSBtoRGB(hsb[0], hsb[1], ticks / 100.0F);
- float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f, (color1 >> 16 & 255) / 255.0f };
- Botania.proxy.wispFX(this.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F * size, (float)g * 0.05F, 0.25F);
- Botania.proxy.wispFX(this.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.1F + 0.1F * size, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, 0.9F);
- if(ticks == 100)
- for(int j = 0; j < 12; j++)
- Botania.proxy.wispFX(this.worldObj, this.xCoord + 0.5D, this.yCoord + 1.1D - indetY, this.zCoord + 0.5D, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.15F + 0.15F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, 0.8f);
- }
- }
- }
-
- public static boolean isItemEqual(ItemStack stack, ItemStack stack1) {
- return stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
- }
-
- private int addItemStack(ItemStack stack) {
- for (int i = 1; i < getSizeInventory(); i++) {
- if(getStackInSlot(i) == null) {
- ItemStack stackToAdd = stack.copy();
- setInventorySlotContents(i, stackToAdd);
- return stack.stackSize;
- } else if(isItemEqual(stack, getStackInSlot(i))) {
- if(getStackInSlot(i).stackSize < stack.getMaxStackSize()) {
- int count = Math.min(stack.stackSize, stack.getMaxStackSize() - getStackInSlot(i).stackSize);
- getStackInSlot(i).stackSize += count;
- return count;
- }
- }
- }
- return 0;
- }
-
- public void writeCustomNBT(NBTTagCompound cmp) {
- super.writeCustomNBT(cmp);
- cmp.setInteger("mana", mana);
- cmp.setInteger("manaToGet", manaToGet);
- cmp.setBoolean("requestUpdate", requestUpdate);
- cmp.setInteger("recipeID", currentRecipe == null ? -1 : recipeID);
- }
-
- public void readCustomNBT(NBTTagCompound cmp) {
- super.readCustomNBT(cmp);
- this.mana = cmp.getInteger("mana");
- this.manaToGet = cmp.getInteger("manaToGet");
- this.requestUpdate = cmp.getBoolean("requestUpdate");
- int recipeID = cmp.getInteger("recipeID");
- if(recipeID == -1)
- this.currentRecipe = null;
- else
- this.currentRecipe = AdvancedBotanyAPI.advancedPlateRecipes.get(recipeID);
- }
+ private int mana;
+ public int manaToGet;
+ private RecipeAdvancedPlate currentRecipe;
+ private int recipeID;
+ public boolean requestUpdate;
- public int getSizeInventory() {
- return 4;
- }
+ public void updateEntity() {
+ if (!this.worldObj.isRemote) updateServer();
+ else updateClient();
+ ISparkEntity spark = getAttachedSpark();
+ if (spark != null) {
+ List sparkEntities = SparkHelper
+ .getSparksAround(this.worldObj, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D);
+ for (ISparkEntity otherSpark : sparkEntities) {
+ if (spark == otherSpark) continue;
+ else if (otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof IManaPool)
+ otherSpark.registerTransfer(spark);
+ }
+ }
+ }
- public String getInventoryName() {
- return "tileAdvancedPlate";
- }
+ private void updateServer() {
+ if (requestUpdate)
+ VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
+ boolean hasUpdate = false;
+ List items = this.worldObj.getEntitiesWithinAABB(
+ EntityItem.class,
+ AxisAlignedBB.getBoundingBox(
+ this.xCoord,
+ this.yCoord,
+ this.zCoord,
+ (this.xCoord + 1),
+ (this.yCoord + 1),
+ (this.zCoord + 1)));
+ for (EntityItem item : items) {
+ if (item.getEntityItem() != null && !item.isDead) {
+ ItemStack stack = item.getEntityItem();
+ int splitCount = addItemStack(stack);
+ stack.stackSize -= splitCount;
+ if (stack.stackSize <= 0) item.setDead();
+ if (splitCount > 0) hasUpdate = true;
+ break;
+ }
+ }
+ int wasManaToGet = this.manaToGet;
+ boolean hasCraft = false;
+ int recipeID = 0;
+ for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
+ if (recipe.matches(this)) {
+ this.recipeID = recipeID;
+ if (this.mana > 0 && this.isFull()) {
+ ItemStack output = recipe.getOutput().copy();
+ this.recieveMana(-recipe.getManaUsage());
+ this.manaToGet = 0;
+ for (int i = 1; i < this.getSizeInventory(); i++) {
+ if (this.getStackInSlot(i).stackSize > 1) --this.getStackInSlot(i).stackSize;
+ else this.setInventorySlotContents(i, null);
+ }
+ if (this.getStackInSlot(0) != null) ++this.getStackInSlot(0).stackSize;
+ else this.setInventorySlotContents(0, output);
+ hasUpdate = true;
+ worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:terrasteelCraft", 1.0F, 2.0F);
+ break;
+ } else {
+ if (this.getStackInSlot(0) == null) {
+ this.manaToGet = recipe.getManaUsage();
+ currentRecipe = recipe;
+ hasCraft = true;
+ break;
+ } else if (isItemEqual(recipe.getOutput(), getStackInSlot(0))
+ && getStackInSlot(0).stackSize < recipe.getOutput().getMaxStackSize()) {
+ this.manaToGet = recipe.getManaUsage();
+ currentRecipe = recipe;
+ hasCraft = true;
+ break;
+ }
+ }
+ }
+ recipeID++;
+ }
+ if (!hasCraft) {
+ currentRecipe = null;
+ this.mana = 0;
+ this.manaToGet = 0;
+ }
+ if (this.manaToGet != wasManaToGet) hasUpdate = true;
+ requestUpdate = hasUpdate;
+ }
- public int getCurrentMana() {
- return this.mana;
- }
+ private void updateClient() {
+ if (this.mana > 0) {
+ double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
+ worldTime += (new Random((this.xCoord ^ this.yCoord ^ this.zCoord))).nextInt(360);
+ float indetY = (float) (Math.sin(worldTime / 18.0D) / 24.0D);
+ float ticks = 100.0F * getCurrentMana() / this.manaToGet;
+ int totalSpiritCount = 3;
+ double tickIncrement = 360.0D / totalSpiritCount;
+ int speed = 5;
+ double wticks = (ticks * speed) - tickIncrement;
+ double r = Math.sin((ticks - 100) / 10.0D) * 0.5D;
+ double g = Math.sin(wticks * Math.PI / 180.0D * 0.55D);
+ float size = 0.4f;
+ for (int i = 0; i < totalSpiritCount; i++) {
+ double x = this.xCoord + Math.sin(wticks * Math.PI / 180.0D) * r + 0.5D;
+ double y = this.yCoord - indetY + 0.85D + Math.abs(r) * 0.7D;
+ double z = this.zCoord + Math.cos(wticks * Math.PI / 180.0D) * r + 0.5D;
+ wticks += tickIncrement;
+ int color = 0x24cce0;
+ if (currentRecipe != null) color = currentRecipe.getColor();
+ float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
+ int color1 = Color.HSBtoRGB(hsb[0], hsb[1], ticks / 100.0F);
+ float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f,
+ (color1 >> 16 & 255) / 255.0f };
+ Botania.proxy.wispFX(
+ this.worldObj,
+ x,
+ y,
+ z,
+ colorsfx[0],
+ colorsfx[1],
+ colorsfx[2],
+ 0.85F * size,
+ (float) g * 0.05F,
+ 0.25F);
+ Botania.proxy.wispFX(
+ this.worldObj,
+ x,
+ y,
+ z,
+ colorsfx[0],
+ colorsfx[1],
+ colorsfx[2],
+ (float) Math.random() * 0.1F + 0.1F * size,
+ (float) (Math.random() - 0.5D) * 0.05F,
+ (float) (Math.random() - 0.5D) * 0.05F,
+ (float) (Math.random() - 0.5D) * 0.05F,
+ 0.9F);
+ if (ticks == 100) for (int j = 0; j < 12; j++) Botania.proxy.wispFX(
+ this.worldObj,
+ this.xCoord + 0.5D,
+ this.yCoord + 1.1D - indetY,
+ this.zCoord + 0.5D,
+ colorsfx[0],
+ colorsfx[1],
+ colorsfx[2],
+ (float) Math.random() * 0.15F + 0.15F * size,
+ (float) (Math.random() - 0.5D) * 0.125F * size,
+ (float) (Math.random() - 0.5D) * 0.125F * size,
+ (float) (Math.random() - 0.5D) * 0.125F * size,
+ 0.8f);
+ }
+ }
+ }
- public boolean isFull() {
- return this.mana >= this.manaToGet;
- }
+ public static boolean isItemEqual(ItemStack stack, ItemStack stack1) {
+ return stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
+ }
- public void recieveMana(final int mana) {
- this.mana = Math.min(this.mana + mana, this.manaToGet);
- }
-
- public boolean canRecieveManaFromBursts() {
- return !this.isFull();
- }
-
- public boolean canAttachSpark(ItemStack stack) {
- return true;
- }
-
- public void attachSpark(ISparkEntity entity) {}
-
- public ISparkEntity getAttachedSpark() {
- List sparks = this.worldObj.getEntitiesWithinAABB(ISparkEntity.class, AxisAlignedBB.getBoundingBox(this.xCoord, (this.yCoord + 1), this.zCoord, (this.xCoord + 1), (this.yCoord + 2), (this.zCoord + 1)));
- if (sparks.size() == 1) {
- Entity e = (Entity)sparks.get(0);
- return (ISparkEntity)e;
- }
- return null;
- }
-
- public boolean areIncomingTranfersDone() {
- return this.isFull();
- }
-
- public int getAvailableSpaceForMana() {
- return Math.max(0, this.manaToGet - getCurrentMana());
- }
-
- public int[] getAccessibleSlotsFromSide(int side) {
- return new int[]{0, 1, 2, 3};
- }
+ private int addItemStack(ItemStack stack) {
+ for (int i = 1; i < getSizeInventory(); i++) {
+ if (getStackInSlot(i) == null) {
+ ItemStack stackToAdd = stack.copy();
+ setInventorySlotContents(i, stackToAdd);
+ return stack.stackSize;
+ } else if (isItemEqual(stack, getStackInSlot(i))) {
+ if (getStackInSlot(i).stackSize < stack.getMaxStackSize()) {
+ int count = Math.min(stack.stackSize, stack.getMaxStackSize() - getStackInSlot(i).stackSize);
+ getStackInSlot(i).stackSize += count;
+ return count;
+ }
+ }
+ }
+ return 0;
+ }
- public boolean canInsertItem(int slot, ItemStack stack, int side) {
- for(int i = 1; i < getSizeInventory(); i++) {
- ItemStack slotStack = getStackInSlot(i);
- if(slotStack != null && slotStack.stackSize == slotStack.getMaxStackSize() && isItemEqual(stack, slotStack))
- return false;
- }
- return side == 1 && slot != 0;
- }
+ public void writeCustomNBT(NBTTagCompound cmp) {
+ super.writeCustomNBT(cmp);
+ cmp.setInteger("mana", mana);
+ cmp.setInteger("manaToGet", manaToGet);
+ cmp.setBoolean("requestUpdate", requestUpdate);
+ cmp.setInteger("recipeID", currentRecipe == null ? -1 : recipeID);
+ }
- public boolean canExtractItem(int slot, ItemStack stack, int side) {
- return (side == 0 && slot == 0) || (side != 0 && side != 1 && slot != 0);
- }
-}
\ No newline at end of file
+ public void readCustomNBT(NBTTagCompound cmp) {
+ super.readCustomNBT(cmp);
+ this.mana = cmp.getInteger("mana");
+ this.manaToGet = cmp.getInteger("manaToGet");
+ this.requestUpdate = cmp.getBoolean("requestUpdate");
+ int recipeID = cmp.getInteger("recipeID");
+ if (recipeID == -1) this.currentRecipe = null;
+ else this.currentRecipe = AdvancedBotanyAPI.advancedPlateRecipes.get(recipeID);
+ }
+
+ public int getSizeInventory() {
+ return 4;
+ }
+
+ public String getInventoryName() {
+ return "tileAdvancedPlate";
+ }
+
+ public int getCurrentMana() {
+ return this.mana;
+ }
+
+ public boolean isFull() {
+ return this.mana >= this.manaToGet;
+ }
+
+ public void recieveMana(final int mana) {
+ this.mana = Math.min(this.mana + mana, this.manaToGet);
+ }
+
+ public boolean canRecieveManaFromBursts() {
+ return !this.isFull();
+ }
+
+ public boolean canAttachSpark(ItemStack stack) {
+ return true;
+ }
+
+ public void attachSpark(ISparkEntity entity) {}
+
+ public ISparkEntity getAttachedSpark() {
+ List sparks = this.worldObj.getEntitiesWithinAABB(
+ ISparkEntity.class,
+ AxisAlignedBB.getBoundingBox(
+ this.xCoord,
+ (this.yCoord + 1),
+ this.zCoord,
+ (this.xCoord + 1),
+ (this.yCoord + 2),
+ (this.zCoord + 1)));
+ if (sparks.size() == 1) {
+ Entity e = (Entity) sparks.get(0);
+ return (ISparkEntity) e;
+ }
+ return null;
+ }
+
+ public boolean areIncomingTranfersDone() {
+ return this.isFull();
+ }
+
+ public int getAvailableSpaceForMana() {
+ return Math.max(0, this.manaToGet - getCurrentMana());
+ }
+
+ public int[] getAccessibleSlotsFromSide(int side) {
+ return new int[] { 0, 1, 2, 3 };
+ }
+
+ public boolean canInsertItem(int slot, ItemStack stack, int side) {
+ for (int i = 1; i < getSizeInventory(); i++) {
+ ItemStack slotStack = getStackInSlot(i);
+ if (slotStack != null && slotStack.stackSize == slotStack.getMaxStackSize()
+ && isItemEqual(stack, slotStack))
+ return false;
+ }
+ return side == 1 && slot != 0;
+ }
+
+ public boolean canExtractItem(int slot, ItemStack stack, int side) {
+ return (side == 0 && slot == 0) || (side != 0 && side != 1 && slot != 0);
+ }
+}
diff --git a/src/main/java/ab/common/core/CommonHelper.java b/src/main/java/ab/common/core/CommonHelper.java
index 597af42..233f199 100644
--- a/src/main/java/ab/common/core/CommonHelper.java
+++ b/src/main/java/ab/common/core/CommonHelper.java
@@ -6,53 +6,64 @@ import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
-import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
public class CommonHelper {
- public static void fertilizer(World world, Block block, int xCoord, int yCoord, int zCoord, int count, EntityPlayer player) {
- if(world.isRemote || !(block instanceof IGrowable) || block instanceof BlockSapling || world.getTileEntity(xCoord, yCoord, zCoord) != null)
- return;
-
- if(player != null) {
- BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(xCoord, yCoord, zCoord, world, world.getBlock(xCoord, yCoord, zCoord), world.getBlockMetadata(xCoord, yCoord, zCoord), player);
- MinecraftForge.EVENT_BUS.post(event);
- if(event.isCanceled())
- return;
- }
-
- IGrowable igrowable = (IGrowable)block;
- if(igrowable.func_149851_a(world, xCoord, yCoord, zCoord, world.isRemote))
- if(igrowable.func_149852_a(world, world.rand, xCoord, yCoord, zCoord)) {
- int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
- for(int i = 0; i < count; i++) {
- if(meta != world.getBlockMetadata(xCoord, yCoord, zCoord))
- return;
- igrowable.func_149853_b(world, world.rand, xCoord, yCoord, zCoord);
- }
- }
- }
-
- public static boolean setBlock(World world, Block block, int meta, int x, int y, int z, EntityPlayer player, boolean checkAir) {
- if(!world.isRemote) {
- if(checkAir && !(world.getBlock(x, y, z).getMaterial() == Material.air))
- return false;
- BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z), player);
- MinecraftForge.EVENT_BUS.post(event);
- if(event.isCanceled())
- return false;
- return setBlockWithY(world, block, meta, x, y, z);
- }
- return false;
- }
-
- private static boolean setBlockWithY(World world, Block block, int meta, int x, int y, int z) {
- if(y < 256)
- world.setBlock(x, y, z, block, meta, 3);
- else
- return false;
- return true;
- }
+ public static void fertilizer(World world, Block block, int xCoord, int yCoord, int zCoord, int count,
+ EntityPlayer player) {
+ if (world.isRemote || !(block instanceof IGrowable)
+ || block instanceof BlockSapling
+ || world.getTileEntity(xCoord, yCoord, zCoord) != null)
+ return;
+
+ if (player != null) {
+ BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(
+ xCoord,
+ yCoord,
+ zCoord,
+ world,
+ world.getBlock(xCoord, yCoord, zCoord),
+ world.getBlockMetadata(xCoord, yCoord, zCoord),
+ player);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.isCanceled()) return;
+ }
+
+ IGrowable igrowable = (IGrowable) block;
+ if (igrowable.func_149851_a(world, xCoord, yCoord, zCoord, world.isRemote))
+ if (igrowable.func_149852_a(world, world.rand, xCoord, yCoord, zCoord)) {
+ int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
+ for (int i = 0; i < count; i++) {
+ if (meta != world.getBlockMetadata(xCoord, yCoord, zCoord)) return;
+ igrowable.func_149853_b(world, world.rand, xCoord, yCoord, zCoord);
+ }
+ }
+ }
+
+ public static boolean setBlock(World world, Block block, int meta, int x, int y, int z, EntityPlayer player,
+ boolean checkAir) {
+ if (!world.isRemote) {
+ if (checkAir && !(world.getBlock(x, y, z).getMaterial() == Material.air)) return false;
+ BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(
+ x,
+ y,
+ z,
+ world,
+ world.getBlock(x, y, z),
+ world.getBlockMetadata(x, y, z),
+ player);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.isCanceled()) return false;
+ return setBlockWithY(world, block, meta, x, y, z);
+ }
+ return false;
+ }
+
+ private static boolean setBlockWithY(World world, Block block, int meta, int x, int y, int z) {
+ if (y < 256) world.setBlock(x, y, z, block, meta, 3);
+ else return false;
+ return true;
+ }
}
diff --git a/src/main/java/ab/common/core/handler/ConfigABHandler.java b/src/main/java/ab/common/core/handler/ConfigABHandler.java
index 6eaf555..c8b27f5 100644
--- a/src/main/java/ab/common/core/handler/ConfigABHandler.java
+++ b/src/main/java/ab/common/core/handler/ConfigABHandler.java
@@ -2,184 +2,246 @@ package ab.common.core.handler;
import java.io.File;
-import ab.AdvancedBotany;
-import ab.api.AdvancedBotanyAPI;
-import cpw.mods.fml.client.event.ConfigChangedEvent;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
+import ab.AdvancedBotany;
+import cpw.mods.fml.client.event.ConfigChangedEvent;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+
public class ConfigABHandler {
- public static Configuration config;
-
- public static final String CATEGORY_BALANCE = "general." + "balance";
- public static final String CATEGORY_BALANCE_MANA_COST = "general." + "balance.manacost";
- public static final String CATEGORY_RELICS = "general." + "relics";
- public static final String CATEGORY_INTEGRATION = "general." + "integration";
-
- //Balance
-
- public static int[] maxContainerMana = new int[] { 64000000, 8000000, 64000000 };
- public static double protectionFactorNebula = 1.0f;
- public static double damageFactorSpaceSword = 1.0f;
- public static int nebulaWandCooldownTick = 18;
- public static int spreaderMaxMana = 128000;
- public static int spreaderBurstMana = 32000;
- public static String[] lockWorldNameNebulaRod = new String[] {};
- public static int limitXZCoords = 30000000;
- public static int maxDictariusCount = 64;
- public static int sprawlRodMaxArea = 64;
-
- //Balance - mana cost
-
- public static int nebulaRodManaCost = 180;
- public static int sphereNavigationManaCost = 2500;
-
- //Relics
-
- public static String[] lockEntityListToHorn = new String[] {};
- public static String[] relicNames = new String[] { "infiniteFruit", "kingKey", "flugelEye", "thorRing", "odinRing", "lokiRing",
- "freyrSlingshot", "keyHiddenRiches", "pocketWardrobe", "sphereNavigation", "hornPlenty" };
- public static boolean[] fateBoardRelicEnables = new boolean[relicNames.length];
-
-
- //Integration
-
- public static boolean hasAutoThaum = true;
-
- //Misc
-
- public static boolean useManaChargerAnimation = true;
- public static boolean hasManaCharger = true;
-
- static {
- for(int i = 0; i < fateBoardRelicEnables.length; i++)
- fateBoardRelicEnables[i] = true;
- }
-
- public static void loadConfig(File configFile) {
- config = new Configuration(configFile);
- config.load();
- loadCategories();
- load();
- FMLCommonHandler.instance().bus().register(new ChangeListener());
- }
-
- public static void load() {
-
- //Balance Settings
-
- String desc = "Maximum mana capacity for Mana Container";
- maxContainerMana[0] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity", desc, false, maxContainerMana[0]);
- desc = "Maximum mana capacity for Diluted Mana Container";
- maxContainerMana[1] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity (Diluted)", desc, false, maxContainerMana[1]);
- desc = "Maximum mana capacity for Fabulous Mana Container";
- maxContainerMana[2] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity (Fabulous)", desc, false, maxContainerMana[2]);
- desc = "Protection factor for nebula armour";
- protectionFactorNebula = loadPropDouble(CATEGORY_BALANCE, "Nebula Armor Protection Factor", desc, false, protectionFactorNebula);
- desc = "Damage factor for Space Blade";
- damageFactorSpaceSword = loadPropDouble(CATEGORY_BALANCE, "Space Sword Damage Factor", desc, false, damageFactorSpaceSword);
- desc = "The number of ticks needed to restore 1 unit of the Rod of Nebula strength.";
- nebulaWandCooldownTick = loadPropInt(CATEGORY_BALANCE, "Rod of Nebula Cooldown", desc, false, nebulaWandCooldownTick);
- desc = "Maximum amount of mana held in a mana spreader";
- spreaderMaxMana = loadPropInt(CATEGORY_BALANCE, "Spreader Max Mana", desc, false, spreaderMaxMana);
- desc = "Amount of Mana in a Mana Burst";
- spreaderBurstMana = loadPropInt(CATEGORY_BALANCE, "Spreader Burst Mana", desc, false, spreaderBurstMana);
- desc = "To block a creature, type it's class name";
- lockWorldNameNebulaRod = loadPropString(CATEGORY_BALANCE, "Locking Worlds for Teleportation with Nebula Rod", desc, false, lockWorldNameNebulaRod);
- desc = "Limitation on X Z coordinates for teleportation, do not increase the default value";
- limitXZCoords = loadPropInt(CATEGORY_BALANCE, "Restriction on X Z coordinates for Rod of Nebula", desc, false, limitXZCoords);
- desc = "Limit the number of flowers next to each other";
- maxDictariusCount = loadPropInt(CATEGORY_BALANCE, "Max Dictarius Count", desc, false, maxDictariusCount);
- desc = "Changes the area of effect of a projectile created with Rod of Sprawl";
- sprawlRodMaxArea = loadPropInt(CATEGORY_BALANCE, "Rod of Sprawl Max Area", desc, false, sprawlRodMaxArea);
-
- //Balance Settings - mana cost
-
- desc = "Mana cost to restore one unit of strength";
- nebulaRodManaCost = loadPropInt(CATEGORY_BALANCE_MANA_COST, "Rod of Nebula repair Mana cost", desc, false, nebulaRodManaCost);
-
- desc = "Mana cost to try to find the specified block";
- sphereNavigationManaCost = loadPropInt(CATEGORY_BALANCE_MANA_COST, "Sphere of Navigation Mana cost", desc, false, sphereNavigationManaCost);
-
- //Relics Settings
-
- lockEntityListToHorn = loadPropString(CATEGORY_RELICS, "Blocked creatures for double drop", desc, false, lockEntityListToHorn);
- desc = "Enter the name of the World you want to add to the blacklist";
-
- desc = "Enable or disable relic drop on the Fate Playing Board";
- for(int i = 0; i < fateBoardRelicEnables.length; i++)
- fateBoardRelicEnables[i] = loadPropBool(CATEGORY_RELICS, "Enable relic: " + relicNames[i], desc, false, fateBoardRelicEnables[i]);
-
- //Misc Settings
-
- desc = "Activating the charging animation for the Mana Charger";
- useManaChargerAnimation = loadPropBool("general", "Mana Charger lighting", desc, false, useManaChargerAnimation);
- desc = "Switching the Mana Charger on or off in the game";
- hasManaCharger = loadPropBool("general", "Enable Mana Charger", desc, true, hasManaCharger);
-
- // Integration Settings
-
- desc = "Switching the Thaumim Crafty Crate on or off in the game";
- hasAutoThaum = loadPropBool(CATEGORY_INTEGRATION, "Enable Thaumim Crafty Crate", desc, true, hasAutoThaum);
-
- if(config.hasChanged())
- config.save();
- }
-
- public static void loadCategories() {
- addCategory(CATEGORY_BALANCE, "Advanced Botany: balance settings");
- addCategory(CATEGORY_BALANCE_MANA_COST, "Advanced Botany: balance settings (mana cost)");
- addCategory(CATEGORY_RELICS, "Advanced Botany: relics settings");
- addCategory(CATEGORY_INTEGRATION, "Advanced Botany: integration settings");
- }
-
- public static void addCategory(String name, String comment) {
- config.addCustomCategoryComment(name, comment);
- config.getCategory(name).setLanguageKey(name);
- }
-
- public static void loadPostInit() {
- if(config.hasChanged())
- config.save();
- }
-
- public static String[] loadPropString(String category, String propName, String desc, boolean hasRestart, String[] default_) {
- Property prop = config.get(category, propName, default_);
- prop.comment = desc;
- prop.setRequiresMcRestart(hasRestart);
- return prop.getStringList();
- }
-
- public static boolean loadPropBool(String category, String propName, String desc, boolean hasRestart, boolean default_) {
- Property prop = config.get(category, propName, default_);
- prop.comment = desc;
- prop.setRequiresMcRestart(hasRestart);
- return prop.getBoolean(default_);
- }
-
- public static int loadPropInt(String category, String propName, String desc, boolean hasRestart, int default_) {
- Property prop = config.get(category, propName, default_);
- prop.comment = desc;
- prop.setRequiresMcRestart(hasRestart);
- return prop.getInt(default_);
- }
-
- public static double loadPropDouble(String category, String propName, String desc, boolean hasRestart, double default_) {
- Property prop = config.get(category, propName, default_);
- prop.comment = desc;
- prop.setRequiresMcRestart(hasRestart);
- return prop.getDouble(default_);
- }
-
- public static class ChangeListener {
- @SubscribeEvent
- public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
- if(eventArgs.modID.equals(AdvancedBotany.modid))
- ConfigABHandler.load();
- }
- }
-}
\ No newline at end of file
+ public static Configuration config;
+
+ public static final String CATEGORY_BALANCE = "general." + "balance";
+ public static final String CATEGORY_BALANCE_MANA_COST = "general." + "balance.manacost";
+ public static final String CATEGORY_RELICS = "general." + "relics";
+ public static final String CATEGORY_INTEGRATION = "general." + "integration";
+
+ // Balance
+
+ public static int[] maxContainerMana = new int[] { 64000000, 8000000, 64000000 };
+ public static double protectionFactorNebula = 1.0f;
+ public static double damageFactorSpaceSword = 1.0f;
+ public static int nebulaWandCooldownTick = 18;
+ public static int spreaderMaxMana = 128000;
+ public static int spreaderBurstMana = 32000;
+ public static String[] lockWorldNameNebulaRod = new String[] {};
+ public static int limitXZCoords = 30000000;
+ public static int maxDictariusCount = 64;
+ public static int sprawlRodMaxArea = 64;
+
+ // Balance - mana cost
+
+ public static int nebulaRodManaCost = 180;
+ public static int sphereNavigationManaCost = 2500;
+
+ // Relics
+
+ public static String[] lockEntityListToHorn = new String[] {};
+ public static String[] relicNames = new String[] { "infiniteFruit", "kingKey", "flugelEye", "thorRing", "odinRing",
+ "lokiRing", "freyrSlingshot", "keyHiddenRiches", "pocketWardrobe", "sphereNavigation", "hornPlenty" };
+ public static boolean[] fateBoardRelicEnables = new boolean[relicNames.length];
+
+ // Integration
+
+ public static boolean hasAutoThaum = true;
+
+ // Misc
+
+ public static boolean useManaChargerAnimation = true;
+ public static boolean hasManaCharger = true;
+
+ static {
+ for (int i = 0; i < fateBoardRelicEnables.length; i++) fateBoardRelicEnables[i] = true;
+ }
+
+ public static void loadConfig(File configFile) {
+ config = new Configuration(configFile);
+ config.load();
+ loadCategories();
+ load();
+ FMLCommonHandler.instance().bus().register(new ChangeListener());
+ }
+
+ public static void load() {
+
+ // Balance Settings
+
+ String desc = "Maximum mana capacity for Mana Container";
+ maxContainerMana[0] = loadPropInt(
+ CATEGORY_BALANCE,
+ "Mana Container Capacity",
+ desc,
+ false,
+ maxContainerMana[0]);
+ desc = "Maximum mana capacity for Diluted Mana Container";
+ maxContainerMana[1] = loadPropInt(
+ CATEGORY_BALANCE,
+ "Mana Container Capacity (Diluted)",
+ desc,
+ false,
+ maxContainerMana[1]);
+ desc = "Maximum mana capacity for Fabulous Mana Container";
+ maxContainerMana[2] = loadPropInt(
+ CATEGORY_BALANCE,
+ "Mana Container Capacity (Fabulous)",
+ desc,
+ false,
+ maxContainerMana[2]);
+ desc = "Protection factor for nebula armour";
+ protectionFactorNebula = loadPropDouble(
+ CATEGORY_BALANCE,
+ "Nebula Armor Protection Factor",
+ desc,
+ false,
+ protectionFactorNebula);
+ desc = "Damage factor for Space Blade";
+ damageFactorSpaceSword = loadPropDouble(
+ CATEGORY_BALANCE,
+ "Space Sword Damage Factor",
+ desc,
+ false,
+ damageFactorSpaceSword);
+ desc = "The number of ticks needed to restore 1 unit of the Rod of Nebula strength.";
+ nebulaWandCooldownTick = loadPropInt(
+ CATEGORY_BALANCE,
+ "Rod of Nebula Cooldown",
+ desc,
+ false,
+ nebulaWandCooldownTick);
+ desc = "Maximum amount of mana held in a mana spreader";
+ spreaderMaxMana = loadPropInt(CATEGORY_BALANCE, "Spreader Max Mana", desc, false, spreaderMaxMana);
+ desc = "Amount of Mana in a Mana Burst";
+ spreaderBurstMana = loadPropInt(CATEGORY_BALANCE, "Spreader Burst Mana", desc, false, spreaderBurstMana);
+ desc = "To block a creature, type it's class name";
+ lockWorldNameNebulaRod = loadPropString(
+ CATEGORY_BALANCE,
+ "Locking Worlds for Teleportation with Nebula Rod",
+ desc,
+ false,
+ lockWorldNameNebulaRod);
+ desc = "Limitation on X Z coordinates for teleportation, do not increase the default value";
+ limitXZCoords = loadPropInt(
+ CATEGORY_BALANCE,
+ "Restriction on X Z coordinates for Rod of Nebula",
+ desc,
+ false,
+ limitXZCoords);
+ desc = "Limit the number of flowers next to each other";
+ maxDictariusCount = loadPropInt(CATEGORY_BALANCE, "Max Dictarius Count", desc, false, maxDictariusCount);
+ desc = "Changes the area of effect of a projectile created with Rod of Sprawl";
+ sprawlRodMaxArea = loadPropInt(CATEGORY_BALANCE, "Rod of Sprawl Max Area", desc, false, sprawlRodMaxArea);
+
+ // Balance Settings - mana cost
+
+ desc = "Mana cost to restore one unit of strength";
+ nebulaRodManaCost = loadPropInt(
+ CATEGORY_BALANCE_MANA_COST,
+ "Rod of Nebula repair Mana cost",
+ desc,
+ false,
+ nebulaRodManaCost);
+
+ desc = "Mana cost to try to find the specified block";
+ sphereNavigationManaCost = loadPropInt(
+ CATEGORY_BALANCE_MANA_COST,
+ "Sphere of Navigation Mana cost",
+ desc,
+ false,
+ sphereNavigationManaCost);
+
+ // Relics Settings
+
+ lockEntityListToHorn = loadPropString(
+ CATEGORY_RELICS,
+ "Blocked creatures for double drop",
+ desc,
+ false,
+ lockEntityListToHorn);
+ desc = "Enter the name of the World you want to add to the blacklist";
+
+ desc = "Enable or disable relic drop on the Fate Playing Board";
+ for (int i = 0; i < fateBoardRelicEnables.length; i++) fateBoardRelicEnables[i] = loadPropBool(
+ CATEGORY_RELICS,
+ "Enable relic: " + relicNames[i],
+ desc,
+ false,
+ fateBoardRelicEnables[i]);
+
+ // Misc Settings
+
+ desc = "Activating the charging animation for the Mana Charger";
+ useManaChargerAnimation = loadPropBool(
+ "general",
+ "Mana Charger lighting",
+ desc,
+ false,
+ useManaChargerAnimation);
+ desc = "Switching the Mana Charger on or off in the game";
+ hasManaCharger = loadPropBool("general", "Enable Mana Charger", desc, true, hasManaCharger);
+
+ // Integration Settings
+
+ desc = "Switching the Thaumim Crafty Crate on or off in the game";
+ hasAutoThaum = loadPropBool(CATEGORY_INTEGRATION, "Enable Thaumim Crafty Crate", desc, true, hasAutoThaum);
+
+ if (config.hasChanged()) config.save();
+ }
+
+ public static void loadCategories() {
+ addCategory(CATEGORY_BALANCE, "Advanced Botany: balance settings");
+ addCategory(CATEGORY_BALANCE_MANA_COST, "Advanced Botany: balance settings (mana cost)");
+ addCategory(CATEGORY_RELICS, "Advanced Botany: relics settings");
+ addCategory(CATEGORY_INTEGRATION, "Advanced Botany: integration settings");
+ }
+
+ public static void addCategory(String name, String comment) {
+ config.addCustomCategoryComment(name, comment);
+ config.getCategory(name).setLanguageKey(name);
+ }
+
+ public static void loadPostInit() {
+ if (config.hasChanged()) config.save();
+ }
+
+ public static String[] loadPropString(String category, String propName, String desc, boolean hasRestart,
+ String[] default_) {
+ Property prop = config.get(category, propName, default_);
+ prop.comment = desc;
+ prop.setRequiresMcRestart(hasRestart);
+ return prop.getStringList();
+ }
+
+ public static boolean loadPropBool(String category, String propName, String desc, boolean hasRestart,
+ boolean default_) {
+ Property prop = config.get(category, propName, default_);
+ prop.comment = desc;
+ prop.setRequiresMcRestart(hasRestart);
+ return prop.getBoolean(default_);
+ }
+
+ public static int loadPropInt(String category, String propName, String desc, boolean hasRestart, int default_) {
+ Property prop = config.get(category, propName, default_);
+ prop.comment = desc;
+ prop.setRequiresMcRestart(hasRestart);
+ return prop.getInt(default_);
+ }
+
+ public static double loadPropDouble(String category, String propName, String desc, boolean hasRestart,
+ double default_) {
+ Property prop = config.get(category, propName, default_);
+ prop.comment = desc;
+ prop.setRequiresMcRestart(hasRestart);
+ return prop.getDouble(default_);
+ }
+
+ public static class ChangeListener {
+
+ @SubscribeEvent
+ public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
+ if (eventArgs.modID.equals(AdvancedBotany.modid)) ConfigABHandler.load();
+ }
+ }
+}
diff --git a/src/main/java/ab/common/core/handler/GuiHandler.java b/src/main/java/ab/common/core/handler/GuiHandler.java
index c1c0dec..5ab70ed 100644
--- a/src/main/java/ab/common/core/handler/GuiHandler.java
+++ b/src/main/java/ab/common/core/handler/GuiHandler.java
@@ -1,26 +1,27 @@
package ab.common.core.handler;
-import ab.client.gui.GuiItemChest;
-import ab.client.gui.ContainerItemChest;
-import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
+import ab.client.gui.ContainerItemChest;
+import ab.client.gui.GuiItemChest;
+import cpw.mods.fml.common.network.IGuiHandler;
+
public class GuiHandler implements IGuiHandler {
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
- switch (ID) {
- case 0:
- return new ContainerItemChest(player);
- }
- return null;
- }
-
- public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
- switch (ID) {
- case 0:
- return new GuiItemChest(player);
- }
- return null;
- }
-}
\ No newline at end of file
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ switch (ID) {
+ case 0:
+ return new ContainerItemChest(player);
+ }
+ return null;
+ }
+
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ switch (ID) {
+ case 0:
+ return new GuiItemChest(player);
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/ab/common/core/handler/NetworkHandler.java b/src/main/java/ab/common/core/handler/NetworkHandler.java
index 49207b5..9cac4e8 100644
--- a/src/main/java/ab/common/core/handler/NetworkHandler.java
+++ b/src/main/java/ab/common/core/handler/NetworkHandler.java
@@ -1,35 +1,36 @@
package ab.common.core.handler;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayerMP;
+
import ab.common.core.proxy.packet.S00PacketHornChargeHud;
import ab.common.core.proxy.packet.S01PacketFindNearBlocks;
import ab.common.core.proxy.packet.S02PacketSpaceBladeDash;
import cpw.mods.fml.common.network.NetworkRegistry;
-import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayerMP;
public class NetworkHandler {
-
- public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel("advancedBotanyChanel");
- public static void registerPackets() {
- int id = 0;
- NETWORK.registerMessage(S00PacketHornChargeHud.class, S00PacketHornChargeHud.class, id++, Side.CLIENT);
- NETWORK.registerMessage(S01PacketFindNearBlocks.class, S01PacketFindNearBlocks.class, id++, Side.CLIENT);
- NETWORK.registerMessage(S02PacketSpaceBladeDash.class, S02PacketSpaceBladeDash.class, id++, Side.CLIENT);
- }
-
- public static void sendPacketToSpaceDash(EntityPlayerMP playerMP) {
- NETWORK.sendTo(new S02PacketSpaceBladeDash(), playerMP);
- }
-
- public static void sendPacketToFindBlocks(EntityPlayerMP playerMP, Block block, int meta) {
- NETWORK.sendTo(new S01PacketFindNearBlocks(block, meta), playerMP);
- }
-
- public static void sendPacketToHornHud(EntityPlayerMP playerMP, short chargeLoot) {
- NETWORK.sendTo(new S00PacketHornChargeHud(chargeLoot), playerMP);
- }
-}
\ No newline at end of file
+ public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE
+ .newSimpleChannel("advancedBotanyChanel");
+
+ public static void registerPackets() {
+ int id = 0;
+ NETWORK.registerMessage(S00PacketHornChargeHud.class, S00PacketHornChargeHud.class, id++, Side.CLIENT);
+ NETWORK.registerMessage(S01PacketFindNearBlocks.class, S01PacketFindNearBlocks.class, id++, Side.CLIENT);
+ NETWORK.registerMessage(S02PacketSpaceBladeDash.class, S02PacketSpaceBladeDash.class, id++, Side.CLIENT);
+ }
+
+ public static void sendPacketToSpaceDash(EntityPlayerMP playerMP) {
+ NETWORK.sendTo(new S02PacketSpaceBladeDash(), playerMP);
+ }
+
+ public static void sendPacketToFindBlocks(EntityPlayerMP playerMP, Block block, int meta) {
+ NETWORK.sendTo(new S01PacketFindNearBlocks(block, meta), playerMP);
+ }
+
+ public static void sendPacketToHornHud(EntityPlayerMP playerMP, short chargeLoot) {
+ NETWORK.sendTo(new S00PacketHornChargeHud(chargeLoot), playerMP);
+ }
+}
diff --git a/src/main/java/ab/common/core/proxy/CommonProxy.java b/src/main/java/ab/common/core/proxy/CommonProxy.java
index c462680..dbabc11 100644
--- a/src/main/java/ab/common/core/proxy/CommonProxy.java
+++ b/src/main/java/ab/common/core/proxy/CommonProxy.java
@@ -1,7 +1,6 @@
package ab.common.core.proxy;
import ab.AdvancedBotany;
-import ab.api.AdvancedBotanyAPI;
import ab.common.core.handler.ConfigABHandler;
import ab.common.core.handler.GuiHandler;
import ab.common.core.handler.NetworkHandler;
@@ -17,30 +16,26 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.MinecraftForge;
-import vazkii.botania.common.item.ModItems;
public class CommonProxy {
- public void preInit(FMLPreInitializationEvent event) {
- BlockListAB.init();
- ItemListAB.init();
- AchievementRegister.init();
- EntityListAB.init();
- FlowerRegister.init();
- ConfigABHandler.loadConfig(event.getSuggestedConfigurationFile());
- }
-
- public void init(FMLInitializationEvent event) {
- NetworkRegistry.INSTANCE.registerGuiHandler(AdvancedBotany.instance, new GuiHandler());
- RecipeListAB.init();
- NetworkHandler.registerPackets();
- }
-
- public void postInit(FMLPostInitializationEvent event) {
- ConfigABHandler.loadPostInit();
- if(Loader.isModLoaded("MineTweaker3"))
- MineTweakerConfig.registerMT();
- }
-}
\ No newline at end of file
+ public void preInit(FMLPreInitializationEvent event) {
+ BlockListAB.init();
+ ItemListAB.init();
+ AchievementRegister.init();
+ EntityListAB.init();
+ FlowerRegister.init();
+ ConfigABHandler.loadConfig(event.getSuggestedConfigurationFile());
+ }
+
+ public void init(FMLInitializationEvent event) {
+ NetworkRegistry.INSTANCE.registerGuiHandler(AdvancedBotany.instance, new GuiHandler());
+ RecipeListAB.init();
+ NetworkHandler.registerPackets();
+ }
+
+ public void postInit(FMLPostInitializationEvent event) {
+ ConfigABHandler.loadPostInit();
+ if (Loader.isModLoaded("MineTweaker3")) MineTweakerConfig.registerMT();
+ }
+}
diff --git a/src/main/java/ab/common/core/proxy/packet/S00PacketHornChargeHud.java b/src/main/java/ab/common/core/proxy/packet/S00PacketHornChargeHud.java
index 9293f76..0d86bae 100644
--- a/src/main/java/ab/common/core/proxy/packet/S00PacketHornChargeHud.java
+++ b/src/main/java/ab/common/core/proxy/packet/S00PacketHornChargeHud.java
@@ -1,5 +1,7 @@
package ab.common.core.proxy.packet;
+import net.minecraft.item.ItemStack;
+
import ab.client.core.handler.ItemsRemainingRender;
import ab.common.lib.register.ItemListAB;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
@@ -8,30 +10,29 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
-import net.minecraft.item.ItemStack;
public class S00PacketHornChargeHud implements IMessage, IMessageHandler {
-
- private static final ItemStack horn = new ItemStack(ItemListAB.itemHornPlenty);
- private short chargeLoot;
-
- public S00PacketHornChargeHud() {};
-
- public S00PacketHornChargeHud(short chargeLoot) {
- this.chargeLoot = chargeLoot;
- }
- public void toBytes(ByteBuf buf) {
- buf.writeShort(chargeLoot);
- }
-
- public void fromBytes(ByteBuf buf) {
- this.chargeLoot = buf.readShort();
- }
-
- @SideOnly(Side.CLIENT)
- public IMessage onMessage(S00PacketHornChargeHud message, MessageContext ctx) {
- ItemsRemainingRender.set(horn, "" + message.chargeLoot);
- return null;
- }
-}
\ No newline at end of file
+ private static final ItemStack horn = new ItemStack(ItemListAB.itemHornPlenty);
+ private short chargeLoot;
+
+ public S00PacketHornChargeHud() {};
+
+ public S00PacketHornChargeHud(short chargeLoot) {
+ this.chargeLoot = chargeLoot;
+ }
+
+ public void toBytes(ByteBuf buf) {
+ buf.writeShort(chargeLoot);
+ }
+
+ public void fromBytes(ByteBuf buf) {
+ this.chargeLoot = buf.readShort();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IMessage onMessage(S00PacketHornChargeHud message, MessageContext ctx) {
+ ItemsRemainingRender.set(horn, "" + message.chargeLoot);
+ return null;
+ }
+}
diff --git a/src/main/java/ab/common/core/proxy/packet/S01PacketFindNearBlocks.java b/src/main/java/ab/common/core/proxy/packet/S01PacketFindNearBlocks.java
index 7f62a83..345ef2d 100644
--- a/src/main/java/ab/common/core/proxy/packet/S01PacketFindNearBlocks.java
+++ b/src/main/java/ab/common/core/proxy/packet/S01PacketFindNearBlocks.java
@@ -1,45 +1,45 @@
package ab.common.core.proxy.packet;
-import ab.client.core.handler.ItemsRemainingRender;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+
import ab.common.item.relic.ItemSphereNavigation;
-import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.world.WorldServer;
-import net.minecraftforge.common.DimensionManager;
public class S01PacketFindNearBlocks implements IMessage, IMessageHandler {
-
- private int blockID;
- private int meta;
-
- public S01PacketFindNearBlocks() {};
-
- public S01PacketFindNearBlocks(Block block, int meta) {
- this.blockID = Block.getIdFromBlock(block);
- this.meta = meta;
- }
- public void toBytes(ByteBuf buf) {
- buf.writeInt(this.blockID);
- buf.writeInt(this.meta);
- }
-
- public void fromBytes(ByteBuf buf) {
- this.blockID = buf.readInt();
- this.meta = buf.readInt();
- }
-
- @SideOnly(Side.CLIENT)
- public IMessage onMessage(S01PacketFindNearBlocks message, MessageContext ctx) {
- ItemSphereNavigation.findBlocks(Minecraft.getMinecraft().theWorld, Block.getBlockById(message.blockID), message.meta, Minecraft.getMinecraft().thePlayer);
- return null;
- }
+ private int blockID;
+ private int meta;
+
+ public S01PacketFindNearBlocks() {};
+
+ public S01PacketFindNearBlocks(Block block, int meta) {
+ this.blockID = Block.getIdFromBlock(block);
+ this.meta = meta;
+ }
+
+ public void toBytes(ByteBuf buf) {
+ buf.writeInt(this.blockID);
+ buf.writeInt(this.meta);
+ }
+
+ public void fromBytes(ByteBuf buf) {
+ this.blockID = buf.readInt();
+ this.meta = buf.readInt();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IMessage onMessage(S01PacketFindNearBlocks message, MessageContext ctx) {
+ ItemSphereNavigation.findBlocks(
+ Minecraft.getMinecraft().theWorld,
+ Block.getBlockById(message.blockID),
+ message.meta,
+ Minecraft.getMinecraft().thePlayer);
+ return null;
+ }
}
diff --git a/src/main/java/ab/common/core/proxy/packet/S02PacketSpaceBladeDash.java b/src/main/java/ab/common/core/proxy/packet/S02PacketSpaceBladeDash.java
index 79023e5..b4452bf 100644
--- a/src/main/java/ab/common/core/proxy/packet/S02PacketSpaceBladeDash.java
+++ b/src/main/java/ab/common/core/proxy/packet/S02PacketSpaceBladeDash.java
@@ -1,5 +1,7 @@
package ab.common.core.proxy.packet;
+import net.minecraft.client.Minecraft;
+
import ab.common.item.equipment.ItemSpaceBlade;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@@ -7,17 +9,16 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
-import net.minecraft.client.Minecraft;
public class S02PacketSpaceBladeDash implements IMessage, IMessageHandler {
- public void fromBytes(ByteBuf buf) {}
+ public void fromBytes(ByteBuf buf) {}
- public void toBytes(ByteBuf buf) {}
+ public void toBytes(ByteBuf buf) {}
- @SideOnly(Side.CLIENT)
- public IMessage onMessage(S02PacketSpaceBladeDash message, MessageContext ctx) {
- ItemSpaceBlade.onPlayerSpaceDash(Minecraft.getMinecraft().thePlayer);
- return null;
- }
-}
\ No newline at end of file
+ @SideOnly(Side.CLIENT)
+ public IMessage onMessage(S02PacketSpaceBladeDash message, MessageContext ctx) {
+ ItemSpaceBlade.onPlayerSpaceDash(Minecraft.getMinecraft().thePlayer);
+ return null;
+ }
+}
diff --git a/src/main/java/ab/common/entity/EntityAdvancedSpark.java b/src/main/java/ab/common/entity/EntityAdvancedSpark.java
index f8f638a..243151d 100644
--- a/src/main/java/ab/common/entity/EntityAdvancedSpark.java
+++ b/src/main/java/ab/common/entity/EntityAdvancedSpark.java
@@ -10,8 +10,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
-import ab.common.lib.register.ItemListAB;
-import baubles.common.lib.PlayerHandler;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -19,306 +18,309 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
-import vazkii.botania.common.entity.EntitySpark;
import vazkii.botania.common.item.ModItems;
+import ab.common.lib.register.ItemListAB;
+import baubles.common.lib.PlayerHandler;
public class EntityAdvancedSpark extends Entity implements ISparkEntity {
-
- Set transfers = Collections.newSetFromMap(new WeakHashMap());
- public int transferSpeed = 48000;
- public int removeTransferants = 2;
- public boolean firstTick = false;
-
- public EntityAdvancedSpark(World world) {
- super(world);
- this.isImmuneToFire = true;
- }
- protected void entityInit() {
- setSize(0.1F, 0.5F);
- this.dataWatcher.addObject(27, Integer.valueOf(0));
- this.dataWatcher.addObject(28, Integer.valueOf(0));
- this.dataWatcher.setObjectWatched(27);
- this.dataWatcher.setObjectWatched(28);
- }
+ Set transfers = Collections.newSetFromMap(new WeakHashMap());
+ public int transferSpeed = 48000;
+ public int removeTransferants = 2;
+ public boolean firstTick = false;
- public void onUpdate() {
- super.onUpdate();
- ISparkAttachable tile = getAttachedTile();
- if (tile == null) {
- if (!this.worldObj.isRemote)
- setDead();
- return;
- }
- boolean first = (this.worldObj.isRemote && !this.firstTick);
- int upgrade = getUpgrade();
- List allSparks = null;
- if (first || upgrade == 2 || upgrade == 3)
- allSparks = SparkHelper.getSparksAround(this.worldObj, this.posX, this.posY, this.posZ);
- if (first)
- first = true;
- Collection transfers = getTransfers();
- if (upgrade != 0) {
- List players;
- List validSparks;
- Map> receivingPlayers;
- ItemStack input;
- switch (upgrade) {
- case 1:
- players = SparkHelper.getEntitiesAround(EntityPlayer.class, this.worldObj, this.posX, this.posY, this.posZ);
- receivingPlayers = new HashMap>();
- input = new ItemStack(ModItems.spark);
- for (EntityPlayer player : players) {
- List stacks = new ArrayList();
- stacks.addAll(Arrays.asList(player.inventory.mainInventory));
- stacks.addAll(Arrays.asList(player.inventory.armorInventory));
- stacks.addAll(Arrays.asList((PlayerHandler.getPlayerBaubles(player)).stackList));
- for (ItemStack stack : stacks) {
- if (stack == null || !(stack.getItem() instanceof IManaItem))
- continue;
- IManaItem manaItem = (IManaItem) stack.getItem();
- if (manaItem.canReceiveManaFromItem(stack, input)) {
- Map receivingStacks;
- boolean add = false;
- if (!receivingPlayers.containsKey(player)) {
- add = true;
- receivingStacks = (Map) new HashMap