Compare commits

...
2 Commits
Author SHA1 Message Date
miozune 417561cd76 Check null stack 2022-12-09 22:38:33 +09:00
miozune c41a54f110 Rewrite GUIs with ModularUI 2022-12-09 09:08:30 +09:00
38 changed files with 686 additions and 793 deletions

No files matched your search

+200 -54
View File
@@ -1,13 +1,17 @@
//version: 1661114848 //version: 1670512927
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates.
*/ */
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseRelation
import com.modrinth.minotaur.dependencies.ModDependency
import com.modrinth.minotaur.dependencies.VersionDependency
import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.internal.logging.text.StyledTextOutputFactory
@@ -41,7 +45,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.9' classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11'
} }
} }
plugins { plugins {
@@ -59,6 +63,8 @@ plugins {
id 'de.undercouch.download' version '5.0.1' id 'de.undercouch.download' version '5.0.1'
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.diffplug.spotless' version '6.7.2' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
} }
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
@@ -127,26 +133,35 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies") checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName") checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false propertyDefaultIfUnset("noPublishedSources", false)
boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false propertyDefaultIfUnset("forceEnableMixins", false)
String channel = project.hasProperty('channel') ? project.channel : 'stable' propertyDefaultIfUnset("channel", "stable")
String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12' propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
String javaSourceDir = "src/main/java/" String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/" String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/" String kotlinSourceDir = "src/main/kotlin/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") final String modGroupPath = modGroup.toString().replaceAll("\\.", "/")
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") final String apiPackagePath = apiPackage.toString().replaceAll("\\.", "/")
String targetPackageJava = javaSourceDir + modGroupPath
String targetPackageScala = scalaSourceDir + modGroupPath
String targetPackageKotlin = kotlinSourceDir + modGroupPath
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 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) throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
} }
if (apiPackage) { if (apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 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) throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
} }
@@ -160,31 +175,36 @@ if (accessTransformersFile) {
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
if (mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { if (mixinsPackage.isEmpty()) {
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!")
} }
final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/")
final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/")
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { 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) throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
} }
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" if (!mixinPlugin.isEmpty()) {
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java"
if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt"
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) 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) { if (coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" final String coreModPath = coreModClass.toString().replaceAll("\\.", "/")
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" 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())) { 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) throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
} }
@@ -240,7 +260,7 @@ if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
def arguments = [] def arguments = []
def jvmArguments = [] def jvmArguments = []
if (usesMixins.toBoolean() || forceEnableMixins) { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
arguments += [ arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker" "--tweakClass org.spongepowered.asm.launch.MixinTweaker"
] ]
@@ -305,13 +325,10 @@ repositories {
name 'Overmind forge repo mirror' name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/' url 'https://gregtech.overminddl1.com/'
} }
if (usesMixins.toBoolean() || forceEnableMixins) { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
maven { maven {
name 'sponge' name = "GTNH Maven"
url 'https://repo.spongepowered.org/repository/maven-public' url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url 'https://jitpack.io'
} }
} }
} }
@@ -321,19 +338,10 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.2:processor')
} }
if (usesMixins.toBoolean() || forceEnableMixins) { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
// using 0.8 to workaround a issue in 0.7 which fails mixin application compile('com.gtnewhorizon:gtnhmixins:2.1.2')
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
} }
} }
@@ -345,13 +353,18 @@ def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets { task generateAssets {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json")
if (!mixinConfigFile.exists()) { 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 = """{ mixinConfigFile.text = """{
"required": true, "required": true,
"minVersion": "0.7.11", "minVersion": "0.8.5-GTNH",
"package": "${modGroup}.${mixinsPackage}", "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine}
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}", "refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)", "target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_8",
@@ -563,11 +576,11 @@ task devJar(type: Jar) {
task apiJar(type: Jar) { task apiJar(type: Jar) {
from(sourceSets.main.allSource) { from(sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' include modGroupPath + "/" + apiPackagePath + '/**'
} }
from(sourceSets.main.output) { from(sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' include modGroupPath + "/" + apiPackagePath + '/**'
} }
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
@@ -651,6 +664,124 @@ publishing {
} }
} }
if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
apply plugin: 'com.modrinth.minotaur'
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = modrinthProjectId
versionNumber = identifiedVersion
versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release"
changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : ""
uploadFile = jar
additionalFiles = getSecondaryArtifacts()
gameVersions = [minecraftVersion]
loaders = ["forge"]
debugMode = false
}
if (modrinthRelations.size() != 0) {
String[] deps = modrinthRelations.split(";")
deps.each { dep ->
if (dep.size() == 0) {
return
}
String[] parts = dep.split(":")
String[] qual = parts[0].split("-")
addModrinthDep(qual[0], qual[1], parts[1])
}
}
if (usesMixins.toBoolean()) {
addModrinthDep("required", "version", "gtnhmixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
}
if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) {
apply plugin: 'com.matthewprenger.cursegradle'
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN")
project {
id = curseForgeProjectId
if (changelogFile.exists()) {
changelogType = "markdown"
changelog = changelogFile
}
releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release"
addGameVersion minecraftVersion
addGameVersion "Forge"
mainArtifact jar
for (artifact in getSecondaryArtifacts()) addArtifact artifact
}
options {
javaIntegration = false
forgeGradleIntegration = false
debug = false
}
}
if (curseForgeRelations.size() != 0) {
String[] deps = curseForgeRelations.split(";")
deps.each { dep ->
if (dep.size() == 0) {
return
}
String[] parts = dep.split(":")
addCurseForgeRelation(parts[0], parts[1])
}
}
if (usesMixins.toBoolean()) {
addCurseForgeRelation("requiredDependency", "gtnhmixins")
}
tasks.curseforge.dependsOn(build)
tasks.publish.dependsOn(tasks.curseforge)
}
def addModrinthDep(scope, type, name) {
com.modrinth.minotaur.dependencies.Dependency dep;
if (!(scope in [
"required",
"optional",
"incompatible",
"embedded"
])) {
throw new Exception("Invalid modrinth dependency scope: " + scope)
}
switch (type) {
case "project":
dep = new ModDependency(name, scope)
break
case "version":
dep = new VersionDependency(name, scope)
break
default:
throw new Exception("Invalid modrinth dependency type: " + type)
}
project.modrinth.dependencies.add(dep)
}
def addCurseForgeRelation(type, name) {
if (!(type in [
"requiredDependency",
"embeddedLibrary",
"optionalDependency",
"tool",
"incompatible"
])) {
throw new Exception("Invalid CurseForge relation type: " + type)
}
CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact
CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation()))
rel."$type"(name)
}
// Updating // Updating
task updateBuildScript { task updateBuildScript {
doLast { doLast {
@@ -963,6 +1094,21 @@ if (!project.hasProperty(propertyName)) {
} }
} }
def propertyDefaultIfUnset(String propertyName, defaultValue) {
if (!project.hasProperty(propertyName) || project.property(propertyName) == "") {
project.ext.setProperty(propertyName, defaultValue)
}
}
def getFile(String relativePath) { def getFile(String relativePath) {
return new File(projectDir, relativePath) return new File(projectDir, relativePath)
} }
def getSecondaryArtifacts() {
// Because noPublishedSources from the beginning of the script is somehow not visible here...
boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
def secondaryArtifacts = [devJar]
if (!noPublishedSources) secondaryArtifacts += [sourcesJar]
if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.05:dev' compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.161:dev'
compile 'com.github.GTNewHorizons:Baubles:1.0.1.14:dev' compile 'com.github.GTNewHorizons:Baubles:1.0.1.14:dev'
compile 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev' compile 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev'
-1
View File
@@ -82,7 +82,6 @@ public class EMT {
} }
EMTDungeonChestGenerator.generateLoot(); EMTDungeonChestGenerator.generateLoot();
EMTEntities.registerEMTEntities(); EMTEntities.registerEMTEntities();
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
NEI_Config.Init(); NEI_Config.Init();
} }
@@ -1,5 +1,6 @@
package emt.block; package emt.block;
import com.gtnewhorizons.modularui.api.UIInfos;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT; import emt.EMT;
@@ -45,6 +46,7 @@ public class BlockEssentiaGenerators extends BlockBaseContainer {
iconSets[5].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront"); iconSets[5].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item id, CreativeTabs tab, List list) { public void getSubBlocks(Item id, CreativeTabs tab, List list) {
list.add(new ItemStack(id, 1, 0)); list.add(new ItemStack(id, 1, 0));
@@ -60,6 +62,7 @@ public class BlockEssentiaGenerators extends BlockBaseContainer {
return new TileEntityBaseGenerator(meta); return new TileEntityBaseGenerator(meta);
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random) { public void randomDisplayTick(World world, int x, int y, int z, Random random) {
TileEntityBaseGenerator te = (TileEntityBaseGenerator) world.getTileEntity(x, y, z); TileEntityBaseGenerator te = (TileEntityBaseGenerator) world.getTileEntity(x, y, z);
@@ -75,6 +78,7 @@ public class BlockEssentiaGenerators extends BlockBaseContainer {
} }
} }
@Override
public boolean onBlockActivated( public boolean onBlockActivated(
World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3) { World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3) {
if (player.isSneaking()) { if (player.isSneaking()) {
@@ -85,7 +89,7 @@ public class BlockEssentiaGenerators extends BlockBaseContainer {
} }
TileEntity tileentity = world.getTileEntity(i, j, k); TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null) { if (tileentity != null) {
player.openGui(emt.EMT.instance, 1, world, i, j, k); UIInfos.TILE_MODULAR_UI.open(player, world, i, j, k);
} }
return true; return true;
} }
+6 -4
View File
@@ -1,5 +1,6 @@
package emt.block; package emt.block;
import com.gtnewhorizons.modularui.api.UIInfos;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT; import emt.EMT;
@@ -78,10 +79,11 @@ public class BlockMachines extends BlockBaseContainer {
@Override @Override
public boolean onBlockActivated( public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityIndustrialWandRecharge) { if (!world.isRemote) {
player.openGui(EMT.instance, 0, world, x, y, z); TileEntity te = world.getTileEntity(x, y, z);
} else if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityEtherealMacerator) { if (te instanceof TileEntityIndustrialWandRecharge || te instanceof TileEntityEtherealMacerator) {
player.openGui(EMT.instance, 1, world, x, y, z); UIInfos.TILE_MODULAR_UI.open(player, world, x, y, z);
}
} }
return true; return true;
} }
+2 -1
View File
@@ -1,5 +1,6 @@
package emt.block; package emt.block;
import com.gtnewhorizons.modularui.api.UIInfos;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT; import emt.EMT;
@@ -145,7 +146,7 @@ public class BlockSolars extends BlockBaseContainer {
} }
TileEntity tileentity = world.getTileEntity(i, j, k); TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null) { if (tileentity != null) {
player.openGui(emt.EMT.instance, 1, world, i, j, k); UIInfos.TILE_MODULAR_UI.open(player, world, i, j, k);
} }
return true; return true;
} }
@@ -0,0 +1,22 @@
package emt.client.gui;
import static emt.EMT.TEXTURE_PATH;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
public class EMT_UITextures {
public static final UITexture OVERLAY_SLOT_FUSION_CRAFTING =
UITexture.fullImage(TEXTURE_PATH, "guis/overlay_slot/fusion_crafter");
public static final UITexture OVERLAY_SLOT_WAND = UITexture.fullImage(TEXTURE_PATH, "guis/overlay_slot/wand");
public static final UITexture PICTURE_GAUGE_EMPTY_25 =
UITexture.fullImage(TEXTURE_PATH, "guis/picture/gauge_empty_25");
public static final UITexture PICTURE_GAUGE_GENERATOR =
UITexture.fullImage(TEXTURE_PATH, "guis/picture/gauge_generator");
public static final UITexture PICTURE_GAUGE_SOLAR = UITexture.fullImage(TEXTURE_PATH, "guis/picture/gauge_solar");
public static final UITexture PICTURE_GAUGE_EMPTY_11 =
UITexture.fullImage(TEXTURE_PATH, "guis/picture/gauge_empty_11");
public static final UITexture PICTURE_SOLAR_INDICATOR =
UITexture.fullImage(TEXTURE_PATH, "guis/picture/solar_indicator");
}
@@ -1,35 +0,0 @@
package emt.client.gui;
import emt.EMT;
import emt.client.gui.container.ContainerEtheralMacerator;
import emt.tile.TileEntityEtherealMacerator;
import emt.util.EMTTextHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiEtherealMacerator extends GuiContainer {
public static final ResourceLocation texture =
new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/etherealmacerator.png");
public GuiEtherealMacerator(InventoryPlayer inventory, TileEntityEtherealMacerator te) {
super(new ContainerEtheralMacerator(inventory, te));
xSize = 176;
ySize = 165;
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.etherealMacerator.title"), 6, 6, 4210752);
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
}
@@ -1,91 +0,0 @@
package emt.client.gui;
import emt.EMT;
import emt.client.gui.container.ConainerGenerator;
import emt.tile.generator.TileEntityBaseGenerator;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GuiGenerator extends GuiContainer {
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/generator.png");
TileEntityBaseGenerator tileentity;
private int xSize;
private int ySize;
public GuiGenerator(InventoryPlayer invPlayer, TileEntityBaseGenerator entity) {
super(new ConainerGenerator(invPlayer, entity));
this.tileentity = entity;
this.allowUserInput = false;
this.xSize = 194;
this.ySize = 168;
}
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String formatPanelName = I18n.format(this.tileentity.getInventoryName());
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
this.fontRendererObj.drawStringWithShadow(formatPanelName, nmPos, 7, 6618118);
String storageString = I18n.format("emt.Storage");
String fuel = I18n.format("emt.Fuel");
if (this.tileentity.maxstorage < 1000)
this.fontRendererObj.drawString(
storageString + this.tileentity.mpshownstroage * 1000 + "/" + this.tileentity.maxstorage + "EU",
36,
22,
0);
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mpshownstroage) + "/" + (this.tileentity.maxstorage / 1000)
+ "kEU",
36,
22,
0);
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mpshownstroage / 1000) + "/"
+ (this.tileentity.maxstorage / 1000000) + "MEU",
36,
22,
0);
else if (1000000000 <= this.tileentity.maxstorage)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mpshownstroage / 1000000) + "/"
+ (this.tileentity.maxstorage / 1000000000) + "GEU",
36,
22,
0);
if (this.tileentity.isActive)
this.fontRendererObj.drawString(
I18n.format("emt.Generating") + Double.toString(this.tileentity.generating / 20 / 20) + " EU/t",
36,
35,
0);
else this.fontRendererObj.drawString(I18n.format("emt.Generating") + "0 EU/t", 36, 35, 0);
this.fontRendererObj.drawString(fuel + ": " + Integer.toString(this.tileentity.fuel), 36, 48, 0);
this.fontRendererObj.drawString(
fuel + "/t: " + Integer.toString((this.tileentity.fuel * 20 * 20) - this.tileentity.tick), 36, 63, 0);
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(tex);
int h = (this.width - this.xSize) / 2;
int k = (this.height - this.ySize) / 2;
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
if (this.tileentity.mpshownstroage > 0) {
int l = this.tileentity.gaugeEnergyScaled(33);
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
}
if (this.tileentity.fuel > 0) {
int l = this.tileentity.gaugeFuelScaled(33);
drawTexturedModalRect(h + 18, k + 42, 195, 0, l, 14);
}
}
}
@@ -1,35 +0,0 @@
package emt.client.gui;
import emt.EMT;
import emt.client.gui.container.ContainerIndustrialWandRecharge;
import emt.tile.TileEntityIndustrialWandRecharge;
import emt.util.EMTTextHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiIndustrialWandRecharger extends GuiContainer {
public static final ResourceLocation texture =
new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/wandcharger.png");
public GuiIndustrialWandRecharger(InventoryPlayer inventory, TileEntityIndustrialWandRecharge te) {
super(new ContainerIndustrialWandRecharge(inventory, te));
xSize = 176;
ySize = 165;
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.wandRecharge.title"), 6, 6, 4210752);
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
}
-132
View File
@@ -1,132 +0,0 @@
package emt.client.gui;
import emt.EMT;
import emt.client.gui.container.ContainerSolars;
import emt.tile.solar.TileEntitySolarBase;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiSolar extends GuiContainer {
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/solar.png");
TileEntitySolarBase tileentity;
private boolean allowUserInput;
private int xSize;
private int ySize;
private String color;
private int cColor;
public GuiSolar(InventoryPlayer invPlayer, TileEntitySolarBase entity) {
super(new ContainerSolars(invPlayer, entity));
this.tileentity = entity;
this.allowUserInput = false;
this.xSize = 194;
this.ySize = 168;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
color = this.tileentity
.getInventoryName()
.replaceAll("Solar", "")
.replaceAll("Compressed", "")
.replaceAll("Triple", "")
.replaceAll("Double", "")
.trim();
if (color != null)
switch (color) {
case "Aer": {
GL11.glColor4f(1.0f, 0.86f, 0.0f, 1.0f);
break;
}
case "Terra": {
GL11.glColor4f(0.0f, 0.66f, 0.08f, 1.0f);
cColor = 8224255;
break;
}
case "Ordo": {
GL11.glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
break;
}
case "Perditio": {
GL11.glColor4f(0.33F, 0.33F, 0.33F, 1.0F);
break;
}
case "Ignis": {
GL11.glColor4f(0.82f, 0.11f, 0.11f, 1.0f);
break;
}
case "Aqua": {
GL11.glColor4f(0.27f, 0.65f, 1.0f, 1.0f);
break;
}
default: {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
break;
}
}
else GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(tex);
int h = (this.width - this.xSize) / 2;
int k = (this.height - this.ySize) / 2;
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
if (this.tileentity.mp_storage > 0) {
int l = this.tileentity.gaugeEnergyScaled(33);
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
}
if (this.tileentity.generating > 9) drawTexturedModalRect(h + 18, k + 42, 195, 20, 11, 14);
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
if (!color.equals("Terra")) this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, 6618118);
else this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, cColor);
String storageString = I18n.format("emt.Storage", new Object[0]);
if (this.tileentity.maxstorage < 1000)
this.fontRendererObj.drawString(
storageString + this.tileentity.storage + "/" + this.tileentity.maxstorage + "EU", 36, 22, 0);
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mp_storage) + "/" + (this.tileentity.maxstorage / 1000) + "kEU",
36,
22,
0);
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mp_storage / 1000) + "/" + (this.tileentity.maxstorage / 1000000)
+ "MEU",
36,
22,
0);
else if (1000000000 <= this.tileentity.maxstorage)
this.fontRendererObj.drawString(
storageString + (this.tileentity.mp_storage / 1000000) + "/"
+ (this.tileentity.maxstorage / 1000000000) + "GEU",
36,
22,
0);
if (this.tileentity.isActive)
// if (Double.toString(this.tileentity.generating).length()>5)
// this.fontRendererObj.drawString(I18n.format("emt.Generating",new
// Object[0])+Double.toString(this.tileentity.generating).substring(0, 4)+" EU/t", 36, 35, 0);
// else
this.fontRendererObj.drawString(
I18n.format("emt.Generating", new Object[0]) + Double.toString(this.tileentity.generating)
+ " EU/t",
36,
35,
0);
else this.fontRendererObj.drawString(I18n.format("emt.Generating", new Object[0]) + "0 EU/t", 36, 35, 0);
}
}
@@ -1,91 +0,0 @@
package emt.client.gui.container;
import emt.tile.generator.TileEntityBaseGenerator;
import java.util.Locale;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.ItemStack;
import thaumcraft.api.aspects.Aspect;
public class ConainerGenerator extends Container {
private TileEntityBaseGenerator tileentity;
public ConainerGenerator(InventoryPlayer inventoryplayer, TileEntityBaseGenerator tileentity) {
this.tileentity = tileentity;
}
public void detectAndSendChanges() {
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating / 400));
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
icrafting.sendProgressBarUpdate(this, 2, (short) (this.tileentity.storage / 1000));
icrafting.sendProgressBarUpdate(this, 3, (byte) encryptAspect(this.tileentity.aspect));
icrafting.sendProgressBarUpdate(this, 4, (byte) (this.tileentity.isActive ? 1 : 0));
}
}
private byte encryptAspect(Aspect aspect) {
switch (aspect.getTag().toUpperCase(Locale.US)) {
case "POTENTIA":
return 0;
case "IGNIS":
return 1;
case "AURAM":
return 2;
case "ARBOR":
return 3;
case "AER":
return 4;
case "LUCRUM":
return 5;
}
return 0;
}
public void updateProgressBar(int i, int j) {
if (i == 0) {
this.tileentity.generating = (((int) j) * 400);
} else if (i == 1) {
if (j == 0 || this.tileentity.fuel != j) this.tileentity.tick = 0;
this.tileentity.fuel = ((byte) j);
} else if (i == 2) {
this.tileentity.mpshownstroage = (short) j;
} else if (i == 3 && this.tileentity.aspect == null)
switch (j) {
case 0:
this.tileentity.aspect = Aspect.ENERGY;
break;
case 1:
this.tileentity.aspect = Aspect.FIRE;
break;
case 2:
this.tileentity.aspect = Aspect.AURA;
break;
case 3:
this.tileentity.aspect = Aspect.TREE;
break;
case 4:
this.tileentity.aspect = Aspect.AIR;
break;
case 5:
this.tileentity.aspect = Aspect.GREED;
break;
}
else if (i == 4) {
this.tileentity.isActive = ((byte) j) == ((byte) 1);
}
}
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
return null;
}
public boolean canInteractWith(EntityPlayer entityplayer) {
this.detectAndSendChanges();
return this.tileentity.isUseableByPlayer(entityplayer);
}
}
@@ -1,83 +0,0 @@
package emt.client.gui.container;
import emt.tile.TileEntityEtherealMacerator;
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 net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.common.container.SlotOutput;
public class ContainerEtheralMacerator extends Container {
TileEntityEtherealMacerator te;
public ContainerEtheralMacerator(InventoryPlayer inventory, TileEntity te) {
this.te = ((TileEntityEtherealMacerator) te);
addSlotToContainer(new Slot(this.te, 0, 56, 26));
addSlotToContainer(new SlotOutput(this.te, 2, 116, 26));
addSlotToContainer(new SlotOutput(this.te, 1, 116, 53));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return this.te.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 == 1) {
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
return null;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (par2 != 0) {
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return null;
}
} else if (par2 >= 2 && par2 < 29) {
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
return null;
}
} else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
return null;
}
} else if (!this.mergeItemStack(itemstack1, 3, 38, false)) {
return null;
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return itemstack;
}
}
@@ -1,69 +0,0 @@
package emt.client.gui.container;
import emt.tile.TileEntityIndustrialWandRecharge;
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;
public class ContainerIndustrialWandRecharge extends Container {
TileEntityIndustrialWandRecharge charger;
public ContainerIndustrialWandRecharge(InventoryPlayer invPlayer, TileEntityIndustrialWandRecharge entity) {
this.charger = entity;
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(new Slot(invPlayer, x, 8 + x * 18, 142));
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(new Slot(invPlayer, 9 + x + y * 9, 8 + x * 18, 84 + y * 18));
}
}
this.addSlotToContainer(new Slot(charger, 0, 80, 35));
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return charger.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 == 36) {
if (!this.mergeItemStack(itemstack1, 0, 35, false)) {
return null;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (!charger.isItemValidForSlot(0, itemstack1) || !this.mergeItemStack(itemstack1, 36, 37, false)) {
return null;
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return itemstack;
}
}
@@ -1,59 +0,0 @@
package emt.client.gui.container;
import emt.tile.solar.TileEntitySolarBase;
import java.nio.ByteBuffer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.ItemStack;
public class ContainerSolars extends Container {
byte[] generating = new byte[8];
byte[] mpStorage = new byte[8];
private TileEntitySolarBase tileentity;
public ContainerSolars(InventoryPlayer inventoryplayer, TileEntitySolarBase tileentity) {
this.tileentity = tileentity;
}
public void detectAndSendChanges() {
byte[] generating =
ByteBuffer.allocate(8).putDouble(this.tileentity.generating).array();
byte[] mpStorage = ByteBuffer.allocate(8)
.putDouble(this.tileentity.getSourceStored() / 1000)
.array();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
for (int j = 0; j < generating.length; j++) {
icrafting.sendProgressBarUpdate(this, j, generating[j]);
}
for (int j = 0; j < mpStorage.length; j++) {
icrafting.sendProgressBarUpdate(this, 8 + j, mpStorage[j]);
}
}
}
public void updateProgressBar(int i, int j) {
if (i < 8) {
generating[i] = (byte) j;
if (i == 7) this.tileentity.generating = ByteBuffer.wrap(generating).getDouble();
}
if (i > 7 && i < 16) {
mpStorage[i - 8] = (byte) j;
if (i == 15)
this.tileentity.mp_storage = (long) ByteBuffer.wrap(mpStorage).getDouble();
}
}
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
return null;
}
public boolean canInteractWith(EntityPlayer entityplayer) {
this.detectAndSendChanges();
return this.tileentity.isUseableByPlayer(entityplayer);
}
}
@@ -6,7 +6,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
@@ -47,21 +47,15 @@ public class EssentiaHatch extends GT_MetaTileEntity_Hatch_Input {
return current; return current;
} }
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new EssentiaHatch( return new EssentiaHatch(
"Essentia Hatch " + GT_Values.VN[this.mTier], this.mTier, this.getDescription(), this.mTextures); "Essentia Hatch " + GT_Values.VN[this.mTier], this.mTier, this.getDescription(), this.mTextures);
} }
@Override @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
// TODO: new GUI. return false;
return null;
}
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
// TODO: new contanier GUI.
return null;
} }
@Override @Override
@@ -146,18 +140,22 @@ public class EssentiaHatch extends GT_MetaTileEntity_Hatch_Input {
return ret; return ret;
} }
@Override
public boolean isFluidInputAllowed(FluidStack aFluid) { public boolean isFluidInputAllowed(FluidStack aFluid) {
return false; return false;
} }
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return false;
} }
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return false;
} }
@Override
public int getCapacity() { public int getCapacity() {
return 0; return 0;
} }
@@ -4,6 +4,7 @@ import static gregtech.api.enums.GT_Values.E;
import static gregtech.api.enums.GT_Values.RES_PATH_GUI; import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import emt.client.gui.EMT_UITextures;
import emt.init.EMTItems; import emt.init.EMTItems;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList; import gregtech.api.enums.ItemList;
@@ -20,21 +21,22 @@ import net.minecraftforge.fluids.FluidStack;
public class EMT_RecipeAdder { public class EMT_RecipeAdder {
public static final GT_Recipe.GT_Recipe_Map sFusionCraftingRecipes = new GT_Recipe.GT_Recipe_Map( public static final GT_Recipe.GT_Recipe_Map sFusionCraftingRecipes = new GT_Recipe.GT_Recipe_Map(
new HashSet<>(4), new HashSet<>(16),
"emt.recipe.fusioncrafting", "emt.recipe.fusioncrafting",
"Draconic Evolution Fusion Crafter", "Draconic Evolution Fusion Crafter",
null, null,
RES_PATH_GUI + "basicmachines/FusionCrafter", RES_PATH_GUI + "basicmachines/FusionCrafter",
9, 9,
1, 1,
1, 1,
0, 0,
1, 1,
"Tier Casing: ", "Tier Casing: ",
1, 1,
E, E,
false, false,
false); false)
.setSlotOverlay(false, false, EMT_UITextures.OVERLAY_SLOT_FUSION_CRAFTING);
public static void addFusionCraftingRecipe( public static void addFusionCraftingRecipe(
ItemStack[] inputs, ItemStack[] inputs,
+1 -63
View File
@@ -1,23 +1,6 @@
package emt.proxy; package emt.proxy;
import cpw.mods.fml.common.network.IGuiHandler; public class CommonProxy {
import emt.client.gui.GuiEtherealMacerator;
import emt.client.gui.GuiGenerator;
import emt.client.gui.GuiIndustrialWandRecharger;
import emt.client.gui.GuiSolar;
import emt.client.gui.container.ConainerGenerator;
import emt.client.gui.container.ContainerEtheralMacerator;
import emt.client.gui.container.ContainerIndustrialWandRecharge;
import emt.client.gui.container.ContainerSolars;
import emt.tile.TileEntityEtherealMacerator;
import emt.tile.TileEntityIndustrialWandRecharge;
import emt.tile.generator.TileEntityBaseGenerator;
import emt.tile.solar.TileEntitySolarBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class CommonProxy implements IGuiHandler {
public void load() { public void load() {
registerRenders(); registerRenders();
@@ -26,49 +9,4 @@ public class CommonProxy implements IGuiHandler {
public void registerRenders() { public void registerRenders() {
/* Empty in base proxy */ /* Empty in base proxy */
} }
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new ContainerIndustrialWandRecharge(
player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new ContainerEtheralMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
} else if (entity != null && entity instanceof TileEntityBaseGenerator) {
return new ConainerGenerator(player.inventory, (TileEntityBaseGenerator) entity);
} else if (entity != null && entity instanceof TileEntitySolarBase) {
return new ContainerSolars(player.inventory, (TileEntitySolarBase) entity);
}
default:
return null;
}
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new GuiIndustrialWandRecharger(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new GuiEtherealMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
} else if (entity != null && entity instanceof TileEntityBaseGenerator) {
return new GuiGenerator(player.inventory, (TileEntityBaseGenerator) entity);
} else if (entity != null && entity instanceof TileEntitySolarBase) {
return new GuiSolar(player.inventory, (TileEntitySolarBase) entity);
}
default:
return null;
}
}
} }
@@ -1,7 +1,17 @@
package emt.tile; package emt.tile;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.forge.InvWrapper;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import emt.init.EMTBlocks; import emt.init.EMTBlocks;
import emt.util.EMTConfigHandler; import emt.util.EMTConfigHandler;
import emt.util.EMTTextHelper;
import gregtech.api.gui.modularui.GT_UITextures;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
@@ -12,7 +22,8 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.common.config.ConfigItems; import thaumcraft.common.config.ConfigItems;
public class TileEntityEtherealMacerator extends TileEntityEMT implements ISidedInventory, IWrenchable { public class TileEntityEtherealMacerator extends TileEntityEMT
implements ISidedInventory, IWrenchable, ITileWithModularUI {
private static final int[] slots_top = new int[] {0}; private static final int[] slots_top = new int[] {0};
private static final int[] slots_bottom = new int[] {2, 1}; private static final int[] slots_bottom = new int[] {2, 1};
@@ -21,14 +32,17 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
public int cookTime; public int cookTime;
private ItemStack[] slots = new ItemStack[3]; private ItemStack[] slots = new ItemStack[3];
@Override
public int getSizeInventory() { public int getSizeInventory() {
return this.slots.length; return this.slots.length;
} }
@Override
public ItemStack getStackInSlot(int par1) { public ItemStack getStackInSlot(int par1) {
return this.slots[par1]; return this.slots[par1];
} }
@Override
public ItemStack decrStackSize(int par1, int par2) { public ItemStack decrStackSize(int par1, int par2) {
if (this.slots[par1] != null) { if (this.slots[par1] != null) {
ItemStack itemstack; ItemStack itemstack;
@@ -51,6 +65,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
} }
} }
@Override
public ItemStack getStackInSlotOnClosing(int par1) { public ItemStack getStackInSlotOnClosing(int par1) {
if (this.slots[par1] != null) { if (this.slots[par1] != null) {
ItemStack itemstack = this.slots[par1]; ItemStack itemstack = this.slots[par1];
@@ -61,6 +76,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
} }
} }
@Override
public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
this.slots[par1] = par2ItemStack; this.slots[par1] = par2ItemStack;
@@ -69,14 +85,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
} }
} }
public String getInvName() { @Override
return "Ethereal Processor";
}
public boolean isInvNameLocalized() {
return false;
}
public void readFromNBT(NBTTagCompound tagCompound) { public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound); super.readFromNBT(tagCompound);
NBTTagList nbttaglist = tagCompound.getTagList("Items", 10); NBTTagList nbttaglist = tagCompound.getTagList("Items", 10);
@@ -93,6 +102,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
this.cookTime = tagCompound.getShort("CookTime"); this.cookTime = tagCompound.getShort("CookTime");
} }
@Override
public void writeToNBT(NBTTagCompound tagCompound) { public void writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound); super.writeToNBT(tagCompound);
tagCompound.setShort("CookTime", (short) this.cookTime); tagCompound.setShort("CookTime", (short) this.cookTime);
@@ -109,12 +119,14 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
tagCompound.setTag("Items", nbttaglist); tagCompound.setTag("Items", nbttaglist);
} }
@Override
public int getInventoryStackLimit() { public int getInventoryStackLimit() {
return 64; return 64;
} }
@Override
public void updateEntity() { public void updateEntity() {
if (this.canSmelt() && !isOverLimit(1) && !isOverLimit(2) && isAllowed()) { if (this.canSmelt() && !isOverLimit(1) && !isOverLimit(2) && isAllowed(this.slots[0])) {
++this.cookTime; ++this.cookTime;
this.isOn = true; this.isOn = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
@@ -177,6 +189,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
} }
} }
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
? false ? false
@@ -185,10 +198,6 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
<= 64.0D; <= 64.0D;
} }
public void openChest() {}
public void closeChest() {}
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack stack) { public boolean isItemValidForSlot(int slot, ItemStack stack) {
if (slot != 0) return false; if (slot != 0) return false;
@@ -196,14 +205,17 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
return false; return false;
} }
@Override
public int[] getAccessibleSlotsFromSide(int par1) { public int[] getAccessibleSlotsFromSide(int par1) {
return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides); return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides);
} }
@Override
public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) { public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) {
return this.isItemValidForSlot(par1, par2ItemStack); return this.isItemValidForSlot(par1, par2ItemStack);
} }
@Override
public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) { public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) {
return true; return true;
} }
@@ -218,9 +230,9 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
} }
} }
public boolean isAllowed() { public boolean isAllowed(ItemStack stack) {
if (stack == null) return false;
int[] oreDictIDs = OreDictionary.getOreIDs(this.slots[0]); int[] oreDictIDs = OreDictionary.getOreIDs(stack);
for (int oreDictID : oreDictIDs) { for (int oreDictID : oreDictIDs) {
String tName = OreDictionary.getOreName(oreDictID); String tName = OreDictionary.getOreName(oreDictID);
for (String allowed : EMTConfigHandler.etherealMaceratorWhiteList) { for (String allowed : EMTConfigHandler.etherealMaceratorWhiteList) {
@@ -273,4 +285,30 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
@Override @Override
public void closeInventory() {} public void closeInventory() {}
@Override
public ModularWindow createWindow(UIBuildContext buildContext) {
ModularWindow.Builder builder = ModularWindow.builder(176, 166);
builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
builder.bindPlayerInventory(buildContext.getPlayer());
InvWrapper invWrapper = new InvWrapper(this);
builder.widget(new SlotWidget(invWrapper, 0)
.setFilter(stack ->
isAllowed(stack) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null)
.setPos(55, 25))
.widget(new SlotWidget(invWrapper, 2)
.setAccess(true, false)
.setBackground(ModularUITextures.ITEM_SLOT.withFixedSize(26, 26, -4, -4))
.setPos(115, 25))
.widget(new SlotWidget(invWrapper, 1).setAccess(true, false).setPos(115, 52))
.widget(new ProgressBar()
.setTexture(GT_UITextures.PROGRESSBAR_MACERATE, 20)
.setProgress(() -> (float) cookTime / maceratingSpeed)
.setPos(81, 36)
.setSize(20, 18))
.widget(new TextWidget(EMTTextHelper.localize("gui.EMT.etherealMacerator.title")).setPos(6, 6));
return builder.build();
}
} }
@@ -1,8 +1,17 @@
package emt.tile; package emt.tile;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.forge.InvWrapper;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import emt.client.gui.EMT_UITextures;
import emt.init.EMTBlocks; import emt.init.EMTBlocks;
import emt.util.EMTConfigHandler; import emt.util.EMTConfigHandler;
import emt.util.EMTTextHelper;
import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySink;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -16,19 +25,23 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.items.wands.ItemWandCasting;
public class TileEntityIndustrialWandRecharge extends TileEntityEMT implements IInventory, IWrenchable, IEnergySink { public class TileEntityIndustrialWandRecharge extends TileEntityEMT
implements IInventory, IWrenchable, IEnergySink, ITileWithModularUI {
private static final int capacity = 1000000; private static final int capacity = 1000000;
private static final int tier = 4; private static final int tier = 4;
private double energyStored = 0; private double energyStored = 0;
@Override
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
return true; return true;
} }
@Override
public double getDemandedEnergy() { public double getDemandedEnergy() {
return Math.max(0.0D, (double) capacity - this.energyStored); return Math.max(0.0D, (double) capacity - this.energyStored);
} }
@Override
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
if (this.getDemandedEnergy() > 0) { if (this.getDemandedEnergy() > 0) {
this.energyStored += amount; this.energyStored += amount;
@@ -37,6 +50,7 @@ public class TileEntityIndustrialWandRecharge extends TileEntityEMT implements I
return amount; return amount;
} }
@Override
public int getSinkTier() { public int getSinkTier() {
return tier; return tier;
} }
@@ -135,6 +149,7 @@ public class TileEntityIndustrialWandRecharge extends TileEntityEMT implements I
} }
} }
@Override
public void readFromNBT(NBTTagCompound p_145839_1_) { public void readFromNBT(NBTTagCompound p_145839_1_) {
super.readFromNBT(p_145839_1_); super.readFromNBT(p_145839_1_);
NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10);
@@ -154,6 +169,7 @@ public class TileEntityIndustrialWandRecharge extends TileEntityEMT implements I
} }
} }
@Override
public void writeToNBT(NBTTagCompound p_145841_1_) { public void writeToNBT(NBTTagCompound p_145841_1_) {
super.writeToNBT(p_145841_1_); super.writeToNBT(p_145841_1_);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
@@ -233,4 +249,18 @@ public class TileEntityIndustrialWandRecharge extends TileEntityEMT implements I
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(EMTBlocks.emtMachines, 1, 0); return new ItemStack(EMTBlocks.emtMachines, 1, 0);
} }
@Override
public ModularWindow createWindow(UIBuildContext buildContext) {
ModularWindow.Builder builder = ModularWindow.builder(176, 166);
builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
builder.bindPlayerInventory(buildContext.getPlayer());
builder.widget(new SlotWidget(new InvWrapper(this), 0)
.setBackground(ModularUITextures.ITEM_SLOT, EMT_UITextures.OVERLAY_SLOT_WAND)
.setPos(79, 34))
.widget(new TextWidget(EMTTextHelper.localize("gui.EMT.wandRecharge.title")).setPos(6, 6));
return builder.build();
}
} }
@@ -1,10 +1,20 @@
package emt.tile.generator; package emt.tile.generator;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import emt.client.gui.EMT_UITextures;
import emt.tile.DefinitelyNotAIC2Source; import emt.tile.DefinitelyNotAIC2Source;
import emt.tile.TileEntityEMT; import emt.tile.TileEntityEMT;
import emt.util.EMTConfigHandler; import emt.util.EMTConfigHandler;
import emt.util.EMTEssentiasOutputs; import emt.util.EMTEssentiasOutputs;
import emt.util.EMTTextHelper;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; import gregtech.api.interfaces.tileentity.IBasicEnergyContainer;
import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IEnergyConnected;
@@ -34,7 +44,8 @@ public class TileEntityBaseGenerator extends TileEntityEMT
IEssentiaTransport, IEssentiaTransport,
IHasWorldObjectAndCoords, IHasWorldObjectAndCoords,
IEnergyConnected, IEnergyConnected,
IBasicEnergyContainer { IBasicEnergyContainer,
ITileWithModularUI {
public DefinitelyNotAIC2Source energySource = new DefinitelyNotAIC2Source(this, 100000L, 2); public DefinitelyNotAIC2Source energySource = new DefinitelyNotAIC2Source(this, 100000L, 2);
public Aspect aspect; public Aspect aspect;
public double generating; public double generating;
@@ -86,6 +97,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
this.color = -1; this.color = -1;
} }
@Override
public void updateEntity() { public void updateEntity() {
this.side = !this.worldObj.isRemote; this.side = !this.worldObj.isRemote;
this.dead = false; this.dead = false;
@@ -158,6 +170,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
} }
} }
@Override
public String getInventoryName() { public String getInventoryName() {
return StatCollector.translateToLocal("tile.EMT.essentia." + this.aspect.getTag() + ".name"); return StatCollector.translateToLocal("tile.EMT.essentia." + this.aspect.getTag() + ".name");
} }
@@ -188,6 +201,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
} }
} }
@Override
public void readFromNBT(NBTTagCompound tag) { public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag); super.readFromNBT(tag);
this.energySource.setEnergyStored(tag.getLong("estore")); this.energySource.setEnergyStored(tag.getLong("estore"));
@@ -200,6 +214,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
} }
} }
@Override
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag); super.writeToNBT(tag);
tag.setInteger("fuel", this.fuel); tag.setInteger("fuel", this.fuel);
@@ -207,38 +222,48 @@ public class TileEntityBaseGenerator extends TileEntityEMT
if (aspect != null) tag.setString("aspect", this.aspect.getTag()); if (aspect != null) tag.setString("aspect", this.aspect.getTag());
} }
@Override
public int getSizeInventory() { public int getSizeInventory() {
return 5; return 5;
} }
@Override
public ItemStack getStackInSlot(int i) { public ItemStack getStackInSlot(int i) {
return null; return null;
} }
@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
return null; return null;
} }
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_) { public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
return null; return null;
} }
@Override
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {} public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {}
@Override
public boolean hasCustomInventoryName() { public boolean hasCustomInventoryName() {
return false; return false;
} }
@Override
public int getInventoryStackLimit() { public int getInventoryStackLimit() {
return 0; return 0;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return true; return true;
} }
@Override
public void openInventory() {} public void openInventory() {}
@Override
public void closeInventory() {} public void closeInventory() {}
public int gaugeEnergyScaled(int i) { public int gaugeEnergyScaled(int i) {
@@ -249,20 +274,25 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return this.fuel * i / this.maxfuel; return this.fuel * i / this.maxfuel;
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack Stack) { public boolean isItemValidForSlot(int i, ItemStack Stack) {
return false; return false;
} }
@Override
public AspectList getAspects() { public AspectList getAspects() {
return new AspectList().add(this.aspect, this.fuel); return new AspectList().add(this.aspect, this.fuel);
} }
@Override
public void setAspects(AspectList aspects) {} public void setAspects(AspectList aspects) {}
@Override
public boolean doesContainerAccept(Aspect tag) { public boolean doesContainerAccept(Aspect tag) {
return tag.equals(this.aspect); return tag.equals(this.aspect);
} }
@Override
public int addToContainer(Aspect tag, int amount) { public int addToContainer(Aspect tag, int amount) {
if ((!tag.equals(this.aspect)) || (amount < 0)) { if ((!tag.equals(this.aspect)) || (amount < 0)) {
return amount; return amount;
@@ -275,52 +305,65 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return amount - (this.maxfuel - this.fuel); return amount - (this.maxfuel - this.fuel);
} }
@Override
public boolean takeFromContainer(Aspect tag, int amount) { public boolean takeFromContainer(Aspect tag, int amount) {
return false; return false;
} }
@Override
public boolean takeFromContainer(AspectList ot) { public boolean takeFromContainer(AspectList ot) {
return false; return false;
} }
@Override
public boolean doesContainerContainAmount(Aspect tag, int amount) { public boolean doesContainerContainAmount(Aspect tag, int amount) {
return (tag.equals(this.aspect)) && (amount <= this.fuel); return (tag.equals(this.aspect)) && (amount <= this.fuel);
} }
@Override
public boolean doesContainerContain(AspectList ot) { public boolean doesContainerContain(AspectList ot) {
return ot.aspects.containsKey(this.aspect) && ot.aspects.get(this.aspect) == this.fuel; return ot.aspects.containsKey(this.aspect) && ot.aspects.get(this.aspect) == this.fuel;
} }
@Override
public int containerContains(Aspect tag) { public int containerContains(Aspect tag) {
return tag == this.aspect ? this.fuel : 0; return tag == this.aspect ? this.fuel : 0;
} }
@Override
public boolean isConnectable(ForgeDirection face) { public boolean isConnectable(ForgeDirection face) {
return true; return true;
} }
@Override
public boolean canInputFrom(ForgeDirection face) { public boolean canInputFrom(ForgeDirection face) {
return true; return true;
} }
@Override
public boolean canOutputTo(ForgeDirection face) { public boolean canOutputTo(ForgeDirection face) {
return false; return false;
} }
@Override
public void setSuction(Aspect aspect, int amount) {} public void setSuction(Aspect aspect, int amount) {}
@Override
public Aspect getSuctionType(ForgeDirection face) { public Aspect getSuctionType(ForgeDirection face) {
return this.aspect; return this.aspect;
} }
@Override
public int getSuctionAmount(ForgeDirection face) { public int getSuctionAmount(ForgeDirection face) {
return this.fuel == this.maxfuel ? 0 : 128; return this.fuel == this.maxfuel ? 0 : 128;
} }
@Override
public int takeEssentia(Aspect aspect, int amount, ForgeDirection face) { public int takeEssentia(Aspect aspect, int amount, ForgeDirection face) {
return 0; return 0;
} }
@Override
public int addEssentia(Aspect aspect, int amount, ForgeDirection face) { public int addEssentia(Aspect aspect, int amount, ForgeDirection face) {
if (amount < this.maxfuel - this.fuel) { if (amount < this.maxfuel - this.fuel) {
return amount; return amount;
@@ -328,18 +371,22 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return this.maxfuel - addToContainer(aspect, amount); return this.maxfuel - addToContainer(aspect, amount);
} }
@Override
public Aspect getEssentiaType(ForgeDirection face) { public Aspect getEssentiaType(ForgeDirection face) {
return this.aspect; return this.aspect;
} }
@Override
public int getEssentiaAmount(ForgeDirection face) { public int getEssentiaAmount(ForgeDirection face) {
return this.fuel; return this.fuel;
} }
@Override
public int getMinimumSuction() { public int getMinimumSuction() {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
@Override
public boolean renderExtendedTube() { public boolean renderExtendedTube() {
return true; return true;
} }
@@ -353,27 +400,33 @@ public class TileEntityBaseGenerator extends TileEntityEMT
} }
} }
@Override
public byte getColorization() { public byte getColorization() {
return this.color; return this.color;
} }
@Override
public byte setColorization(byte aColor) { public byte setColorization(byte aColor) {
this.color = aColor; this.color = aColor;
return this.color; return this.color;
} }
@Override
public boolean isUniversalEnergyStored(long aEnergyAmount) { public boolean isUniversalEnergyStored(long aEnergyAmount) {
return aEnergyAmount < this.energySource.getEnergyStored(); return aEnergyAmount < this.energySource.getEnergyStored();
} }
@Override
public long getUniversalEnergyStored() { public long getUniversalEnergyStored() {
return (long) this.energySource.getEnergyStored(); return (long) this.energySource.getEnergyStored();
} }
@Override
public long getUniversalEnergyCapacity() { public long getUniversalEnergyCapacity() {
return (long) this.energySource.getCapacity(); return (long) this.energySource.getCapacity();
} }
@Override
public long getOutputAmperage() { public long getOutputAmperage() {
if (this.generating / 20.0D / 20.0D <= GT_Values.V[this.energySource.getSourceTier()]) { if (this.generating / 20.0D / 20.0D <= GT_Values.V[this.energySource.getSourceTier()]) {
return 1L; return 1L;
@@ -384,18 +437,22 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return (long) (1L + (this.generating / 20.0D / 20.0D / GT_Values.V[this.energySource.getSourceTier()])); return (long) (1L + (this.generating / 20.0D / 20.0D / GT_Values.V[this.energySource.getSourceTier()]));
} }
@Override
public long getOutputVoltage() { public long getOutputVoltage() {
return GT_Values.V[this.energySource.getSourceTier()]; return GT_Values.V[this.energySource.getSourceTier()];
} }
@Override
public long getInputAmperage() { public long getInputAmperage() {
return 0L; return 0L;
} }
@Override
public long getInputVoltage() { public long getInputVoltage() {
return 0L; return 0L;
} }
@Override
public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
if (this.energySource.getEnergyStored() > aEnergy) { if (this.energySource.getEnergyStored() > aEnergy) {
this.energySource.drawEnergy(aEnergy); this.energySource.drawEnergy(aEnergy);
@@ -405,51 +462,63 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return false; return false;
} }
@Override
public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) {
return false; return false;
} }
@Override
public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
return decreaseStoredEnergyUnits( return decreaseStoredEnergyUnits(
aVoltage * aAmperage, this.energySource.getEnergyStored() > aVoltage * aAmperage); aVoltage * aAmperage, this.energySource.getEnergyStored() > aVoltage * aAmperage);
} }
@Override
public long getAverageElectricInput() { public long getAverageElectricInput() {
return 0L; return 0L;
} }
@Override
public long getAverageElectricOutput() { public long getAverageElectricOutput() {
return 0L; return 0L;
} }
@Override
public long getStoredEU() { public long getStoredEU() {
return (long) this.energySource.getEnergyStored(); return (long) this.energySource.getEnergyStored();
} }
@Override
public long getEUCapacity() { public long getEUCapacity() {
return (long) this.energySource.getCapacity(); return (long) this.energySource.getCapacity();
} }
@Override
public long getStoredSteam() { public long getStoredSteam() {
return 0L; return 0L;
} }
@Override
public long getSteamCapacity() { public long getSteamCapacity() {
return 0L; return 0L;
} }
@Override
public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
return false; return false;
} }
@Override
public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
return 0L; return 0L;
} }
@Override
public boolean inputEnergyFrom(byte aSide) { public boolean inputEnergyFrom(byte aSide) {
return false; return false;
} }
@Override
public boolean outputsEnergyTo(byte aSide) { public boolean outputsEnergyTo(byte aSide) {
return true; return true;
} }
@@ -458,42 +527,52 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return true; return true;
} }
@Override
public World getWorld() { public World getWorld() {
return this.worldObj; return this.worldObj;
} }
@Override
public int getXCoord() { public int getXCoord() {
return this.xCoord; return this.xCoord;
} }
@Override
public short getYCoord() { public short getYCoord() {
return (short) this.yCoord; return (short) this.yCoord;
} }
@Override
public int getZCoord() { public int getZCoord() {
return this.zCoord; return this.zCoord;
} }
@Override
public boolean isServerSide() { public boolean isServerSide() {
return !worldObj.isRemote; return !worldObj.isRemote;
} }
@Override
public boolean isClientSide() { public boolean isClientSide() {
return worldObj.isRemote; return worldObj.isRemote;
} }
@Override
public int getRandomNumber(int aRange) { public int getRandomNumber(int aRange) {
return this.worldObj.rand.nextInt(aRange); return this.worldObj.rand.nextInt(aRange);
} }
@Override
public TileEntity getTileEntity(int aX, int aY, int aZ) { public TileEntity getTileEntity(int aX, int aY, int aZ) {
return this.worldObj.getTileEntity(aX, aY, aZ); return this.worldObj.getTileEntity(aX, aY, aZ);
} }
@Override
public TileEntity getTileEntityOffset(int aX, int aY, int aZ) { public TileEntity getTileEntityOffset(int aX, int aY, int aZ) {
return this.worldObj.getTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return this.worldObj.getTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public TileEntity getTileEntityAtSide(byte aSide) { public TileEntity getTileEntityAtSide(byte aSide) {
if ((aSide < 0) || (aSide >= 6)) { if ((aSide < 0) || (aSide >= 6)) {
return null; return null;
@@ -504,6 +583,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return this.worldObj.getTileEntity(tX, tY, tZ); return this.worldObj.getTileEntity(tX, tY, tZ);
} }
@Override
public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) { public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getTileEntityAtSide(aSide); return getTileEntityAtSide(aSide);
@@ -511,38 +591,47 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return getTileEntity(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getTileEntity(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public IInventory getIInventory(int aX, int aY, int aZ) { public IInventory getIInventory(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IInventory getIInventoryOffset(int aX, int aY, int aZ) { public IInventory getIInventoryOffset(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IInventory getIInventoryAtSide(byte aSide) { public IInventory getIInventoryAtSide(byte aSide) {
return null; return null;
} }
@Override
public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) { public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainer(int aX, int aY, int aZ) { public IFluidHandler getITankContainer(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) { public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerAtSide(byte aSide) { public IFluidHandler getITankContainerAtSide(byte aSide) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) { public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) {
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) { public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) {
TileEntity tTileEntity = getTileEntity(aX, aY, aZ); TileEntity tTileEntity = getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -551,10 +640,12 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) { public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) {
return getIGregTechTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return getIGregTechTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) { public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) {
TileEntity tTileEntity = getTileEntityAtSide(aSide); TileEntity tTileEntity = getTileEntityAtSide(aSide);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -563,6 +654,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) { public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) {
TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, aDistance); TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, aDistance);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -571,14 +663,17 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return null; return null;
} }
@Override
public Block getBlock(int aX, int aY, int aZ) { public Block getBlock(int aX, int aY, int aZ) {
return this.worldObj.getBlock(aX, aY, aZ); return this.worldObj.getBlock(aX, aY, aZ);
} }
@Override
public Block getBlockOffset(int aX, int aY, int aZ) { public Block getBlockOffset(int aX, int aY, int aZ) {
return getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public Block getBlockAtSide(byte aSide) { public Block getBlockAtSide(byte aSide) {
if ((aSide < 0) || (aSide >= 6)) { if ((aSide < 0) || (aSide >= 6)) {
return null; return null;
@@ -589,6 +684,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return this.worldObj.getBlock(tX, tY, tZ); return this.worldObj.getBlock(tX, tY, tZ);
} }
@Override
public Block getBlockAtSideAndDistance(byte aSide, int aDistance) { public Block getBlockAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getBlockAtSide(aSide); return getBlockAtSide(aSide);
@@ -596,14 +692,17 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return getBlock(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getBlock(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public byte getMetaID(int aX, int aY, int aZ) { public byte getMetaID(int aX, int aY, int aZ) {
return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ); return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ);
} }
@Override
public byte getMetaIDOffset(int aX, int aY, int aZ) { public byte getMetaIDOffset(int aX, int aY, int aZ) {
return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public byte getMetaIDAtSide(byte aSide) { public byte getMetaIDAtSide(byte aSide) {
int tX = getOffsetX(aSide, 1); int tX = getOffsetX(aSide, 1);
int tY = getOffsetY(aSide, 1); int tY = getOffsetY(aSide, 1);
@@ -611,6 +710,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return (byte) this.worldObj.getBlockMetadata(tX, tY, tZ); return (byte) this.worldObj.getBlockMetadata(tX, tY, tZ);
} }
@Override
public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) { public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getMetaIDAtSide(aSide); return getMetaIDAtSide(aSide);
@@ -618,38 +718,47 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return getMetaID(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getMetaID(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public byte getLightLevel(int aX, int aY, int aZ) { public byte getLightLevel(int aX, int aY, int aZ) {
return 0; return 0;
} }
@Override
public byte getLightLevelOffset(int aX, int aY, int aZ) { public byte getLightLevelOffset(int aX, int aY, int aZ) {
return 0; return 0;
} }
@Override
public byte getLightLevelAtSide(byte aSide) { public byte getLightLevelAtSide(byte aSide) {
return 0; return 0;
} }
@Override
public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) { public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) {
return 0; return 0;
} }
@Override
public boolean getOpacity(int aX, int aY, int aZ) { public boolean getOpacity(int aX, int aY, int aZ) {
return false; return false;
} }
@Override
public boolean getOpacityOffset(int aX, int aY, int aZ) { public boolean getOpacityOffset(int aX, int aY, int aZ) {
return false; return false;
} }
@Override
public boolean getOpacityAtSide(byte aSide) { public boolean getOpacityAtSide(byte aSide) {
return false; return false;
} }
@Override
public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) { public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) {
return false; return false;
} }
@Override
public boolean getSky(int aX, int aY, int aZ) { public boolean getSky(int aX, int aY, int aZ) {
boolean sky = true; boolean sky = true;
do { do {
@@ -660,58 +769,72 @@ public class TileEntityBaseGenerator extends TileEntityEMT
return sky; return sky;
} }
@Override
public boolean getSkyOffset(int aX, int aY, int aZ) { public boolean getSkyOffset(int aX, int aY, int aZ) {
return getSky(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return getSky(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public boolean getSkyAtSide(byte aSide) { public boolean getSkyAtSide(byte aSide) {
return false; return false;
} }
@Override
public boolean getSkyAtSideAndDistance(byte aSide, int aDistance) { public boolean getSkyAtSideAndDistance(byte aSide, int aDistance) {
return false; return false;
} }
@Override
public boolean getAir(int aX, int aY, int aZ) { public boolean getAir(int aX, int aY, int aZ) {
return this.worldObj.getBlock(aX, aY, aZ).equals(Blocks.air); return this.worldObj.getBlock(aX, aY, aZ).equals(Blocks.air);
} }
@Override
public boolean getAirOffset(int aX, int aY, int aZ) { public boolean getAirOffset(int aX, int aY, int aZ) {
return getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public boolean getAirAtSide(byte aSide) { public boolean getAirAtSide(byte aSide) {
return getAirAtSideAndDistance(aSide, 1); return getAirAtSideAndDistance(aSide, 1);
} }
@Override
public boolean getAirAtSideAndDistance(byte aSide, int aDistance) { public boolean getAirAtSideAndDistance(byte aSide, int aDistance) {
return getAir(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getAir(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public BiomeGenBase getBiome() { public BiomeGenBase getBiome() {
return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord); return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord);
} }
@Override
public BiomeGenBase getBiome(int aX, int aZ) { public BiomeGenBase getBiome(int aX, int aZ) {
return this.worldObj.getBiomeGenForCoords(aX, aZ); return this.worldObj.getBiomeGenForCoords(aX, aZ);
} }
@Override
public int getOffsetX(byte aSide, int aMultiplier) { public int getOffsetX(byte aSide, int aMultiplier) {
return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier; return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier;
} }
@Override
public short getOffsetY(byte aSide, int aMultiplier) { public short getOffsetY(byte aSide, int aMultiplier) {
return (short) (this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier); return (short) (this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier);
} }
@Override
public int getOffsetZ(byte aSide, int aMultiplier) { public int getOffsetZ(byte aSide, int aMultiplier) {
return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier; return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier;
} }
@Override
public boolean isDead() { public boolean isDead() {
return this.dead; return this.dead;
} }
@Override
public void sendBlockEvent(byte aID, byte aValue) { public void sendBlockEvent(byte aID, byte aValue) {
GT_Values.NW.sendPacketToAllPlayersInRange( GT_Values.NW.sendPacketToAllPlayersInRange(
this.worldObj, this.worldObj,
@@ -720,29 +843,75 @@ public class TileEntityBaseGenerator extends TileEntityEMT
this.zCoord); this.zCoord);
} }
@Override
public long getTimer() { public long getTimer() {
return this.timer; return this.timer;
} }
@Override
public void setLightValue(byte aLightValue) {} public void setLightValue(byte aLightValue) {}
@Override
public boolean isInvalidTileEntity() { public boolean isInvalidTileEntity() {
return this.tileEntityInvalid; return this.tileEntityInvalid;
} }
public boolean openGUI(EntityPlayer aPlayer, int aID) { @Override
return false;
}
public boolean openGUI(EntityPlayer aPlayer) {
return false;
}
public boolean outputsEnergyTo(byte b, boolean b1) { public boolean outputsEnergyTo(byte b, boolean b1) {
return true; return true;
} }
@Override
public boolean inputEnergyFrom(byte b, boolean b1) { public boolean inputEnergyFrom(byte b, boolean b1) {
return false; return false;
} }
@Override
public ModularWindow createWindow(UIBuildContext buildContext) {
ModularWindow.Builder builder = ModularWindow.builder(176, 107);
builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
builder.widget(new TextWidget(
new Text(getInventoryName()).color(0x64fc06).shadow())
.setPos(9, 9))
.widget(new ProgressBar()
.setTexture(EMT_UITextures.PICTURE_GAUGE_EMPTY_25, EMT_UITextures.PICTURE_GAUGE_GENERATOR, 25)
.setProgress(() -> (float) storage / this.maxstorage)
.setSynced(false, false)
.setPos(9, 24)
.setSize(25, 11))
.widget(new ProgressBar()
.setTexture(EMT_UITextures.PICTURE_GAUGE_EMPTY_25, EMT_UITextures.PICTURE_GAUGE_GENERATOR, 25)
.setProgress(() -> (float) fuel / this.maxfuel)
.setSynced(false, false)
.setPos(9, 43)
.setSize(25, 11))
.widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("emt.Storage")
+ EMTTextHelper.formatNumber(storage) + "/"
+ EMTTextHelper.formatNumber(maxstorage) + "EU")
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 22))
.widget(new FakeSyncWidget.IntegerSyncer(() -> storage, val -> storage = val))
.widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("emt.Generating")
+ (isActive ? generating / 20 / 20 : 0) + " EU/t")
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 35))
.widget(new FakeSyncWidget.DoubleSyncer(() -> generating, val -> generating = val))
.widget(new FakeSyncWidget.BooleanSyncer(() -> isActive, val -> isActive = val))
.widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("emt.Fuel") + ": " + fuel)
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 48))
.widget(new FakeSyncWidget.ByteSyncer(() -> fuel, val -> fuel = val))
.widget(TextWidget.dynamicString(() ->
StatCollector.translateToLocal("emt.remaining_second") + ((fuel * 20 * 20) - tick) / 20)
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 63))
.widget(new FakeSyncWidget.IntegerSyncer(() -> tick, val -> tick = val));
return builder.build();
}
} }
@@ -1,9 +1,19 @@
package emt.tile.solar; package emt.tile.solar;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import emt.client.gui.EMT_UITextures;
import emt.init.EMTBlocks; import emt.init.EMTBlocks;
import emt.tile.DefinitelyNotAIC2Source; import emt.tile.DefinitelyNotAIC2Source;
import emt.tile.TileEntityEMT; import emt.tile.TileEntityEMT;
import emt.util.EMTTextHelper;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; import gregtech.api.interfaces.tileentity.IBasicEnergyContainer;
import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IEnergyConnected;
@@ -19,6 +29,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@@ -27,7 +38,12 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.visnet.VisNetHandler; import thaumcraft.api.visnet.VisNetHandler;
public class TileEntitySolarBase extends TileEntityEMT public class TileEntitySolarBase extends TileEntityEMT
implements IInventory, IWrenchable, IHasWorldObjectAndCoords, IEnergyConnected, IBasicEnergyContainer { implements IInventory,
IWrenchable,
IHasWorldObjectAndCoords,
IEnergyConnected,
IBasicEnergyContainer,
ITileWithModularUI {
private static final byte NOTHING = 0; private static final byte NOTHING = 0;
private static final byte ORDO = 1; private static final byte ORDO = 1;
@@ -98,6 +114,7 @@ public class TileEntitySolarBase extends TileEntityEMT
this.side = !this.worldObj.isRemote this.side = !this.worldObj.isRemote
? FMLCommonHandler.instance().getEffectiveSide().isServer() ? FMLCommonHandler.instance().getEffectiveSide().isServer()
: FMLCommonHandler.instance().getSide().isServer(); : FMLCommonHandler.instance().getSide().isServer();
if (!side) return;
this.dead = false; this.dead = false;
this.timer = +1L; this.timer = +1L;
inputintoGTnet(); inputintoGTnet();
@@ -284,42 +301,53 @@ public class TileEntitySolarBase extends TileEntityEMT
this.mp_storage = this.storage / 1000; this.mp_storage = this.storage / 1000;
} }
@Override
public int getSizeInventory() { public int getSizeInventory() {
return 0; return 0;
} }
@Override
public ItemStack getStackInSlot(int i) { public ItemStack getStackInSlot(int i) {
return null; return null;
} }
@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
return null; return null;
} }
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_) { public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
return null; return null;
} }
@Override
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {} public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {}
@Override
public boolean hasCustomInventoryName() { public boolean hasCustomInventoryName() {
return true; return true;
} }
@Override
public String getInventoryName() { public String getInventoryName() {
return guiname; return guiname;
} }
@Override
public int getInventoryStackLimit() { public int getInventoryStackLimit() {
return 0; return 0;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return true; return true;
} }
@Override
public void openInventory() {} public void openInventory() {}
@Override
public void closeInventory() {} public void closeInventory() {}
public int gaugeEnergyScaled(long i) { public int gaugeEnergyScaled(long i) {
@@ -368,23 +396,28 @@ public class TileEntitySolarBase extends TileEntityEMT
} }
} }
@Override
public byte getColorization() { public byte getColorization() {
return this.color; return this.color;
} }
@Override
public byte setColorization(byte aColor) { public byte setColorization(byte aColor) {
this.color = aColor; this.color = aColor;
return this.color; return this.color;
} }
@Override
public boolean isUniversalEnergyStored(long aEnergyAmount) { public boolean isUniversalEnergyStored(long aEnergyAmount) {
return aEnergyAmount < this.energySource.getEnergyStored(); return aEnergyAmount < this.energySource.getEnergyStored();
} }
@Override
public long getUniversalEnergyStored() { public long getUniversalEnergyStored() {
return (long) this.energySource.getEnergyStored(); return (long) this.energySource.getEnergyStored();
} }
@Override
public long getUniversalEnergyCapacity() { public long getUniversalEnergyCapacity() {
return (long) this.energySource.getCapacity(); return (long) this.energySource.getCapacity();
} }
@@ -401,6 +434,7 @@ public class TileEntitySolarBase extends TileEntityEMT
return voltAmp; return voltAmp;
} }
@Override
public long getOutputAmperage() { public long getOutputAmperage() {
return calculateMaxVoltAmp()[1]; return calculateMaxVoltAmp()[1];
// long ret; // long ret;
@@ -424,18 +458,22 @@ public class TileEntitySolarBase extends TileEntityEMT
// return ret; // return ret;
} }
@Override
public long getOutputVoltage() { public long getOutputVoltage() {
return GT_Values.V[this.energySource.getSourceTier()]; return GT_Values.V[this.energySource.getSourceTier()];
} }
@Override
public long getInputAmperage() { public long getInputAmperage() {
return 0L; return 0L;
} }
@Override
public long getInputVoltage() { public long getInputVoltage() {
return 0L; return 0L;
} }
@Override
public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
if (this.energySource.getEnergyStored() > aEnergy) { if (this.energySource.getEnergyStored() > aEnergy) {
this.energySource.drawEnergy(aEnergy); this.energySource.drawEnergy(aEnergy);
@@ -445,51 +483,63 @@ public class TileEntitySolarBase extends TileEntityEMT
return false; return false;
} }
@Override
public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) {
return false; return false;
} }
@Override
public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
return decreaseStoredEnergyUnits( return decreaseStoredEnergyUnits(
aVoltage * aAmperage, this.energySource.getEnergyStored() > aVoltage * aAmperage); aVoltage * aAmperage, this.energySource.getEnergyStored() > aVoltage * aAmperage);
} }
@Override
public long getAverageElectricInput() { public long getAverageElectricInput() {
return 0L; return 0L;
} }
@Override
public long getAverageElectricOutput() { public long getAverageElectricOutput() {
return 0L; return 0L;
} }
@Override
public long getStoredEU() { public long getStoredEU() {
return (long) this.energySource.getEnergyStored(); return (long) this.energySource.getEnergyStored();
} }
@Override
public long getEUCapacity() { public long getEUCapacity() {
return (long) this.energySource.getCapacity(); return (long) this.energySource.getCapacity();
} }
@Override
public long getStoredSteam() { public long getStoredSteam() {
return 0L; return 0L;
} }
@Override
public long getSteamCapacity() { public long getSteamCapacity() {
return 0L; return 0L;
} }
@Override
public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
return false; return false;
} }
@Override
public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
return 0L; return 0L;
} }
@Override
public boolean inputEnergyFrom(byte aSide) { public boolean inputEnergyFrom(byte aSide) {
return false; return false;
} }
@Override
public boolean outputsEnergyTo(byte aSide) { public boolean outputsEnergyTo(byte aSide) {
return true; return true;
} }
@@ -498,42 +548,52 @@ public class TileEntitySolarBase extends TileEntityEMT
return false; return false;
} }
@Override
public World getWorld() { public World getWorld() {
return this.worldObj; return this.worldObj;
} }
@Override
public int getXCoord() { public int getXCoord() {
return this.xCoord; return this.xCoord;
} }
@Override
public short getYCoord() { public short getYCoord() {
return (short) this.yCoord; return (short) this.yCoord;
} }
@Override
public int getZCoord() { public int getZCoord() {
return this.zCoord; return this.zCoord;
} }
@Override
public boolean isServerSide() { public boolean isServerSide() {
return side; return side;
} }
@Override
public boolean isClientSide() { public boolean isClientSide() {
return side; return side;
} }
@Override
public int getRandomNumber(int aRange) { public int getRandomNumber(int aRange) {
return this.worldObj.rand.nextInt(aRange); return this.worldObj.rand.nextInt(aRange);
} }
@Override
public TileEntity getTileEntity(int aX, int aY, int aZ) { public TileEntity getTileEntity(int aX, int aY, int aZ) {
return this.worldObj.getTileEntity(aX, aY, aZ); return this.worldObj.getTileEntity(aX, aY, aZ);
} }
@Override
public TileEntity getTileEntityOffset(int aX, int aY, int aZ) { public TileEntity getTileEntityOffset(int aX, int aY, int aZ) {
return this.worldObj.getTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return this.worldObj.getTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public TileEntity getTileEntityAtSide(byte aSide) { public TileEntity getTileEntityAtSide(byte aSide) {
if ((aSide < 0) || (aSide >= 6)) { if ((aSide < 0) || (aSide >= 6)) {
return null; return null;
@@ -544,6 +604,7 @@ public class TileEntitySolarBase extends TileEntityEMT
return this.worldObj.getTileEntity(tX, tY, tZ); return this.worldObj.getTileEntity(tX, tY, tZ);
} }
@Override
public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) { public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getTileEntityAtSide(aSide); return getTileEntityAtSide(aSide);
@@ -551,38 +612,47 @@ public class TileEntitySolarBase extends TileEntityEMT
return getTileEntity(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getTileEntity(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public IInventory getIInventory(int aX, int aY, int aZ) { public IInventory getIInventory(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IInventory getIInventoryOffset(int aX, int aY, int aZ) { public IInventory getIInventoryOffset(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IInventory getIInventoryAtSide(byte aSide) { public IInventory getIInventoryAtSide(byte aSide) {
return null; return null;
} }
@Override
public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) { public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainer(int aX, int aY, int aZ) { public IFluidHandler getITankContainer(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) { public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerAtSide(byte aSide) { public IFluidHandler getITankContainerAtSide(byte aSide) {
return null; return null;
} }
@Override
public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) { public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) {
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) { public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) {
TileEntity tTileEntity = getTileEntity(aX, aY, aZ); TileEntity tTileEntity = getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -591,10 +661,12 @@ public class TileEntitySolarBase extends TileEntityEMT
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) { public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) {
return getIGregTechTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return getIGregTechTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) { public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) {
TileEntity tTileEntity = getTileEntityAtSide(aSide); TileEntity tTileEntity = getTileEntityAtSide(aSide);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -603,6 +675,7 @@ public class TileEntitySolarBase extends TileEntityEMT
return null; return null;
} }
@Override
public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) { public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) {
TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, aDistance); TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, aDistance);
if ((tTileEntity instanceof IGregTechTileEntity)) { if ((tTileEntity instanceof IGregTechTileEntity)) {
@@ -611,14 +684,17 @@ public class TileEntitySolarBase extends TileEntityEMT
return null; return null;
} }
@Override
public Block getBlock(int aX, int aY, int aZ) { public Block getBlock(int aX, int aY, int aZ) {
return this.worldObj.getBlock(aX, aY, aZ); return this.worldObj.getBlock(aX, aY, aZ);
} }
@Override
public Block getBlockOffset(int aX, int aY, int aZ) { public Block getBlockOffset(int aX, int aY, int aZ) {
return getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public Block getBlockAtSide(byte aSide) { public Block getBlockAtSide(byte aSide) {
if ((aSide < 0) || (aSide >= 6)) { if ((aSide < 0) || (aSide >= 6)) {
return null; return null;
@@ -629,6 +705,7 @@ public class TileEntitySolarBase extends TileEntityEMT
return this.worldObj.getBlock(tX, tY, tZ); return this.worldObj.getBlock(tX, tY, tZ);
} }
@Override
public Block getBlockAtSideAndDistance(byte aSide, int aDistance) { public Block getBlockAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getBlockAtSide(aSide); return getBlockAtSide(aSide);
@@ -636,14 +713,17 @@ public class TileEntitySolarBase extends TileEntityEMT
return getBlock(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getBlock(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public byte getMetaID(int aX, int aY, int aZ) { public byte getMetaID(int aX, int aY, int aZ) {
return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ); return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ);
} }
@Override
public byte getMetaIDOffset(int aX, int aY, int aZ) { public byte getMetaIDOffset(int aX, int aY, int aZ) {
return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public byte getMetaIDAtSide(byte aSide) { public byte getMetaIDAtSide(byte aSide) {
int tX = getOffsetX(aSide, 1); int tX = getOffsetX(aSide, 1);
int tY = getOffsetY(aSide, 1); int tY = getOffsetY(aSide, 1);
@@ -651,6 +731,7 @@ public class TileEntitySolarBase extends TileEntityEMT
return (byte) this.worldObj.getBlockMetadata(tX, tY, tZ); return (byte) this.worldObj.getBlockMetadata(tX, tY, tZ);
} }
@Override
public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) { public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) {
if (aDistance == 1) { if (aDistance == 1) {
return getMetaIDAtSide(aSide); return getMetaIDAtSide(aSide);
@@ -658,38 +739,47 @@ public class TileEntitySolarBase extends TileEntityEMT
return getMetaID(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getMetaID(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public byte getLightLevel(int aX, int aY, int aZ) { public byte getLightLevel(int aX, int aY, int aZ) {
return 0; return 0;
} }
@Override
public byte getLightLevelOffset(int aX, int aY, int aZ) { public byte getLightLevelOffset(int aX, int aY, int aZ) {
return 0; return 0;
} }
@Override
public byte getLightLevelAtSide(byte aSide) { public byte getLightLevelAtSide(byte aSide) {
return 0; return 0;
} }
@Override
public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) { public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) {
return 0; return 0;
} }
@Override
public boolean getOpacity(int aX, int aY, int aZ) { public boolean getOpacity(int aX, int aY, int aZ) {
return false; return false;
} }
@Override
public boolean getOpacityOffset(int aX, int aY, int aZ) { public boolean getOpacityOffset(int aX, int aY, int aZ) {
return false; return false;
} }
@Override
public boolean getOpacityAtSide(byte aSide) { public boolean getOpacityAtSide(byte aSide) {
return false; return false;
} }
@Override
public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) { public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) {
return false; return false;
} }
@Override
public boolean getSky(int aX, int aY, int aZ) { public boolean getSky(int aX, int aY, int aZ) {
boolean sky = true; boolean sky = true;
do { do {
@@ -700,58 +790,72 @@ public class TileEntitySolarBase extends TileEntityEMT
return sky; return sky;
} }
@Override
public boolean getSkyOffset(int aX, int aY, int aZ) { public boolean getSkyOffset(int aX, int aY, int aZ) {
return getSky(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); return getSky(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord);
} }
@Override
public boolean getSkyAtSide(byte aSide) { public boolean getSkyAtSide(byte aSide) {
return false; return false;
} }
@Override
public boolean getSkyAtSideAndDistance(byte aSide, int aDistance) { public boolean getSkyAtSideAndDistance(byte aSide, int aDistance) {
return false; return false;
} }
@Override
public boolean getAir(int aX, int aY, int aZ) { public boolean getAir(int aX, int aY, int aZ) {
return this.worldObj.getBlock(aX, aY, aZ).equals(Blocks.air); return this.worldObj.getBlock(aX, aY, aZ).equals(Blocks.air);
} }
@Override
public boolean getAirOffset(int aX, int aY, int aZ) { public boolean getAirOffset(int aX, int aY, int aZ) {
return getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); return getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
} }
@Override
public boolean getAirAtSide(byte aSide) { public boolean getAirAtSide(byte aSide) {
return getAirAtSideAndDistance(aSide, 1); return getAirAtSideAndDistance(aSide, 1);
} }
@Override
public boolean getAirAtSideAndDistance(byte aSide, int aDistance) { public boolean getAirAtSideAndDistance(byte aSide, int aDistance) {
return getAir(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); return getAir(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance));
} }
@Override
public BiomeGenBase getBiome() { public BiomeGenBase getBiome() {
return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord); return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord);
} }
@Override
public BiomeGenBase getBiome(int aX, int aZ) { public BiomeGenBase getBiome(int aX, int aZ) {
return this.worldObj.getBiomeGenForCoords(aX, aZ); return this.worldObj.getBiomeGenForCoords(aX, aZ);
} }
@Override
public int getOffsetX(byte aSide, int aMultiplier) { public int getOffsetX(byte aSide, int aMultiplier) {
return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier; return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier;
} }
@Override
public short getOffsetY(byte aSide, int aMultiplier) { public short getOffsetY(byte aSide, int aMultiplier) {
return (short) (this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier); return (short) (this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier);
} }
@Override
public int getOffsetZ(byte aSide, int aMultiplier) { public int getOffsetZ(byte aSide, int aMultiplier) {
return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier; return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier;
} }
@Override
public boolean isDead() { public boolean isDead() {
return this.dead; return this.dead;
} }
@Override
public void sendBlockEvent(byte aID, byte aValue) { public void sendBlockEvent(byte aID, byte aValue) {
GT_Values.NW.sendPacketToAllPlayersInRange( GT_Values.NW.sendPacketToAllPlayersInRange(
this.worldObj, this.worldObj,
@@ -760,29 +864,63 @@ public class TileEntitySolarBase extends TileEntityEMT
this.zCoord); this.zCoord);
} }
@Override
public long getTimer() { public long getTimer() {
return this.timer; return this.timer;
} }
@Override
public void setLightValue(byte aLightValue) {} public void setLightValue(byte aLightValue) {}
@Override
public boolean isInvalidTileEntity() { public boolean isInvalidTileEntity() {
return this.tileEntityInvalid; return this.tileEntityInvalid;
} }
public boolean openGUI(EntityPlayer aPlayer, int aID) { @Override
return false;
}
public boolean openGUI(EntityPlayer aPlayer) {
return false;
}
public boolean outputsEnergyTo(byte b, boolean b1) { public boolean outputsEnergyTo(byte b, boolean b1) {
return true; return true;
} }
@Override
public boolean inputEnergyFrom(byte b, boolean b1) { public boolean inputEnergyFrom(byte b, boolean b1) {
return false; return false;
} }
@Override
public ModularWindow createWindow(UIBuildContext buildContext) {
ModularWindow.Builder builder = ModularWindow.builder(176, 107);
builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
builder.widget(new TextWidget(
new Text(getInventoryName()).color(0x64fc06).shadow())
.setPos(9, 9))
.widget(new ProgressBar()
.setTexture(EMT_UITextures.PICTURE_GAUGE_EMPTY_25, EMT_UITextures.PICTURE_GAUGE_SOLAR, 25)
.setProgress(() -> (float) storage / this.maxstorage)
.setSynced(false, false)
.setPos(9, 24)
.setSize(25, 11))
.widget(new ProgressBar()
.setTexture(EMT_UITextures.PICTURE_GAUGE_EMPTY_11, EMT_UITextures.PICTURE_SOLAR_INDICATOR, 11)
.setProgress(() -> generating > 9 ? 1f : 0f)
.setSynced(false, false)
.setPos(9, 43)
.setSize(11, 11))
.widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("emt.Storage")
+ EMTTextHelper.formatNumber(storage) + "/"
+ EMTTextHelper.formatNumber(maxstorage) + "EU")
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 22))
.widget(new FakeSyncWidget.LongSyncer(() -> storage, val -> storage = val))
.widget(TextWidget.dynamicString(
() -> StatCollector.translateToLocal("emt.Generating") + generating + " EU/t")
.setSynced(false)
.setDefaultColor(0)
.setPos(36, 35))
.widget(new FakeSyncWidget.DoubleSyncer(() -> generating, val -> generating = val));
return builder.build();
}
} }
@@ -8,22 +8,10 @@ public class EMTCreativeTab extends CreativeTabs {
public EMTCreativeTab(String tabLabel) { public EMTCreativeTab(String tabLabel) {
super(tabLabel); super(tabLabel);
// setBackgroundImageName("emt.png");
} }
@Override @Override
public Item getTabIconItem() { public Item getTabIconItem() {
return EMTItems.electricThorHammer; return EMTItems.electricThorHammer;
} }
/*
@Override
public boolean hasSearchBar() {
return true;
}
@Override
public int getSearchbarWidth() {
return 60;
}*/
} }
+12
View File
@@ -42,4 +42,16 @@ public class EMTTextHelper {
public static String localize(String key) { public static String localize(String key) {
return StatCollector.translateToLocal(key); return StatCollector.translateToLocal(key);
} }
public static String formatNumber(long number) {
if (number < 10_000) {
return String.valueOf(number);
} else if (number < 10_000_000) {
return (number / 1000) + "k";
} else if (number < 1_000_000_000) {
return (number / 1_000_000) + "M";
} else {
return (number / 1_000_000_000) + "G";
}
}
} }
@@ -18,6 +18,7 @@ emt.PressShift=<Press SHIFT>
emt.Generating=Generating: emt.Generating=Generating:
emt.Fuel=Fuel emt.Fuel=Fuel
emt.OutputMax=Output at Max: emt.OutputMax=Output at Max:
emt.remaining_second=Remaining seconds:
#=============Tooltips============= #=============Tooltips=============
#This comes after a player name. The 's is depicting ownership. #This comes after a player name. The 's is depicting ownership.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB