mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-16 10:24:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d757a64025 | ||
|
|
508bcb3b35 | ||
|
|
a70f256a6b | ||
|
|
4b1223a137 | ||
|
|
152d446d87 | ||
|
|
6bdc0776d6 | ||
|
|
051a7a3154 | ||
|
|
2089056dd8 | ||
|
|
408f47115d | ||
|
|
df80d81c2b | ||
|
|
9af4543135 | ||
|
|
4384079fe2 | ||
|
|
6589f1abc0 | ||
|
|
a585652bab | ||
|
|
123e0eb902 | ||
|
|
0de14a79a4 | ||
|
|
b3c662ee3a | ||
|
|
fff19357bc | ||
|
|
07e733b548 | ||
|
|
320561c7bf | ||
|
|
2f738bc728 | ||
|
|
8329a4f186 | ||
|
|
e5ab6193a5 | ||
|
|
18560992cd | ||
|
|
a767b0f922 | ||
|
|
61f8fbe1ce | ||
|
|
a8a49f2b6e | ||
|
|
bf7cc86247 | ||
|
|
d6650f6cc4 | ||
|
|
bc46b8840d | ||
|
|
7d72e0680e | ||
|
|
ee237c3a44 | ||
|
|
4c4cb95782 | ||
|
|
9698692020 | ||
|
|
e7524e80f1 | ||
|
|
d682f65320 | ||
|
|
3801124648 | ||
|
|
2b73a517e8 | ||
|
|
50221c750b |
No files matched your search
@@ -26,3 +26,4 @@ whitelist.json
|
||||
*.ipr
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
+2
-1421
File diff suppressed because it is too large.
Load diff
+1
-2
@@ -1,8 +1,7 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
|
||||
|
||||
shadowImplementation('au.com.bytecode:opencsv:2.4')
|
||||
}
|
||||
+156
-24
@@ -1,60 +1,192 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Waila
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = Waila
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = mcp.mobius.waila
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = Waila.java
|
||||
gradleTokenModId =
|
||||
gradleTokenModName =
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = mcp.mobius.waila.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = Waila_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = true
|
||||
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -83,10 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,10 +131,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
// Add any additional repositiroes for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "GTNH Maven"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
+5
-10
@@ -4,10 +4,10 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,12 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.network.NetworkCheckHandler;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.waila.addons.harvestability.MissingHarvestInfo;
|
||||
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
|
||||
import mcp.mobius.waila.addons.vanillamc.TestRegistrar;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
|
||||
import mcp.mobius.waila.client.KeyEvent;
|
||||
import mcp.mobius.waila.commands.CommandDumpHandlers;
|
||||
import mcp.mobius.waila.network.NetworkHandler;
|
||||
@@ -14,41 +36,12 @@ import mcp.mobius.waila.overlay.WailaTickHandler;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
import mcp.mobius.waila.utils.ModIdentification;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLModContainer;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@Mod(
|
||||
modid = "Waila",
|
||||
name = "Waila",
|
||||
version = "GRADLETOKEN_VERSION",
|
||||
version = Tags.GRADLETOKEN_VERSION,
|
||||
dependencies = "after:NotEnoughItems@[1.0.4.0,)",
|
||||
acceptableRemoteVersions = "*")
|
||||
/*
|
||||
* @NetworkMod(channels = {"Waila"},clientSideRequired=false, serverSideRequired=false, connectionHandler =
|
||||
* WailaConnectionHandler.class, packetHandler = WailaPacketHandler.class, versionBounds="[1.5.0,)") //packetHandler =
|
||||
* WailaPacketHandler.class)
|
||||
*/
|
||||
|
||||
public class Waila {
|
||||
|
||||
// The instance of your mod that Forge uses.
|
||||
@@ -59,6 +52,7 @@ public class Waila {
|
||||
public static ProxyServer proxy;
|
||||
public static Logger log = LogManager.getLogger("Waila");
|
||||
public boolean serverPresent = false;
|
||||
private final ArtifactVersion minimumClientJoinVersion = new DefaultArtifactVersion("1.7.3");
|
||||
|
||||
/* INIT SEQUENCE */
|
||||
@EventHandler
|
||||
@@ -76,7 +70,7 @@ public class Waila {
|
||||
eBus.setAccessible(true);
|
||||
EventBus FMLbus = (EventBus) eBus.get(FMLCommonHandler.instance().findContainerFor(this));
|
||||
FMLbus.register(this);
|
||||
} catch (Throwable t) {}
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
|
||||
@@ -85,35 +79,25 @@ public class Waila {
|
||||
|
||||
}
|
||||
FMLCommonHandler.instance().bus().register(new NetworkHandler());
|
||||
|
||||
MissingHarvestInfo.init();
|
||||
TestRegistrar.init();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.registerHandlers();
|
||||
ModIdentification.init();
|
||||
|
||||
/*
|
||||
* if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true)){
|
||||
* for (String key: ModIdentification.keyhandlerStrings.keySet()){ String orig = I18n.getString(key); if
|
||||
* (orig.equals(key)) orig = LanguageRegistry.instance().getStringLocalization(key); if (orig.equals(key)) orig
|
||||
* = LangUtil.translateG(key); if (orig.isEmpty()) orig = key; String modif; if (orig.startsWith("[") ||
|
||||
* orig.contains(":")) modif = orig; else{ String id = ModIdentification.keyhandlerStrings.get(key); if
|
||||
* (id.contains(".")) id = id.split("\\.")[0]; if (id.length() > 10) id = id.substring(0, 11); if (id.isEmpty())
|
||||
* id = "????"; modif = String.format("[%s] %s", id, orig); }
|
||||
* LanguageRegistry.instance().addStringLocalization(key, modif); } }
|
||||
*/
|
||||
|
||||
if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
|
||||
ProxyIguanaTweaks.init();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void loadComplete(FMLLoadCompleteEvent event) {
|
||||
proxy.registerMods();
|
||||
proxy.registerIMCs();
|
||||
|
||||
/*
|
||||
* String[] ores = OreDictionary.getOreNames(); for (String s : ores) for (ItemStack stack :
|
||||
* OreDictionary.getOres(s)) System.out.printf("%s : %s\n", s, stack);
|
||||
*/
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -147,6 +131,15 @@ public class Waila {
|
||||
imcMessage.getStringValue()));
|
||||
ModuleRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
|
||||
}
|
||||
|
||||
if (imcMessage.key.equalsIgnoreCase("elementregister")) {
|
||||
Waila.log.info(
|
||||
String.format(
|
||||
"Receiving registration request from [ %s ] for method %s",
|
||||
imcMessage.getSender(),
|
||||
imcMessage.getStringValue()));
|
||||
ModuleProbeRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,4 +147,16 @@ public class Waila {
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new CommandDumpHandlers());
|
||||
}
|
||||
|
||||
/**
|
||||
* Block any clients older than 1.7.3 to ensure the vanilla.show_invisible_players property is respected
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@NetworkCheckHandler
|
||||
public boolean checkModList(Map<String, String> versions, Side side) {
|
||||
if (side == Side.CLIENT && versions.containsKey("Waila")) {
|
||||
return minimumClientJoinVersion.compareTo(new DefaultArtifactVersion(versions.get("Waila"))) <= 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package mcp.mobius.waila.addons;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.elements.IProbeInfo;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
|
||||
import mcp.mobius.waila.utils.ModIdentification;
|
||||
|
||||
public class DefaultProbeInfoProvider {
|
||||
|
||||
public static void addStandardBlockInfo(ItemStack itemStack, IProbeInfo probeInfo, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
|
||||
// TODO: item icon, horizontal layout
|
||||
// if (!itemStack.isEmpty()) {
|
||||
// if (Tools.show(mode, config.getShowModName())) {
|
||||
// probeInfo.horizontal().item(pickBlock).vertical().itemLabel(pickBlock).text(TextStyleClass.MODNAME + modid);
|
||||
// } else {
|
||||
// probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).item(pickBlock).itemLabel(pickBlock);
|
||||
// }
|
||||
// } else if (Tools.show(mode, config.getShowModName())) {
|
||||
// probeInfo.vertical().text(TextStyleClass.NAME + getBlockUnlocalizedName(block)).text(TextStyleClass.MODNAME +
|
||||
// modid);
|
||||
// } else {
|
||||
// probeInfo.vertical().text(TextStyleClass.NAME + getBlockUnlocalizedName(block));
|
||||
// }
|
||||
|
||||
HUDHandlerBlocks hudHandlerBlocks = new HUDHandlerBlocks();
|
||||
IProbeInfo row = probeInfo.horizontal();
|
||||
row.item(itemStack);
|
||||
IProbeInfo row_vertical = row.vertical();
|
||||
row_vertical.text(hudHandlerBlocks.getWailaHead(itemStack, new ArrayList<>(), accessor, config).get(0));
|
||||
String modName = ModIdentification.nameFromStack(itemStack);
|
||||
if (modName != null && !modName.isEmpty()) {
|
||||
row_vertical.text(BLUE + ITALIC + modName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package mcp.mobius.waila.addons.agriculture;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class AgricultureModule {
|
||||
|
||||
public static Class BlockCrop = null;
|
||||
public static Class<?> BlockCrop = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class Agriculture = Class.forName("com.teammetallurgy.agriculture.Agriculture");
|
||||
Class.forName("com.teammetallurgy.agriculture.Agriculture");
|
||||
Waila.log.log(Level.INFO, "Agriculture mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Agriculture] Agriculture mod not found.");
|
||||
|
||||
@@ -2,17 +2,17 @@ package mcp.mobius.waila.addons.agriculture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerCrop implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,23 +2,18 @@ package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class BCModule {
|
||||
|
||||
public static Class TileTank = null;
|
||||
public static Class<?> TileTank = null;
|
||||
public static Method TileTank_getTankInfo = null;
|
||||
|
||||
// public static Class IPowerReceptor = null;
|
||||
// public static Class PipeTransportPower = null;
|
||||
// public static Class TileGenericPipe = null;
|
||||
// public static Class TileEngine = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
TileTank = Class.forName("buildcraft.factory.TileTank");
|
||||
@@ -29,13 +24,11 @@ public class BCModule {
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[BC] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e) {
|
||||
Waila.log.log(Level.WARN, "[BC] Method not found." + e);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Waila.log.log(Level.INFO, "[BC] Buildcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Buildcraft mod found.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,6 @@ package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -20,6 +13,13 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -50,8 +50,7 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
int liquidAmount = stack != null ? stack.amount : 0;
|
||||
int capacity = tank != null ? tank.capacity : 0;
|
||||
|
||||
if (ConfigHandler.instance().getConfig("bc.tankamount"))
|
||||
currenttip.add(String.valueOf(liquidAmount) + "/" + String.valueOf(capacity) + " mB");
|
||||
if (ConfigHandler.instance().getConfig("bc.tankamount")) currenttip.add(liquidAmount + "/" + capacity + " mB");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -63,14 +62,12 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
public FluidTankInfo getTank(IWailaDataAccessor accessor) {
|
||||
FluidTankInfo tank = null;
|
||||
FluidTankInfo tank;
|
||||
try {
|
||||
tank = ((FluidTankInfo[]) BCModule.TileTank_getTankInfo
|
||||
.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN))[0];
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(
|
||||
Level.ERROR,
|
||||
"[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
|
||||
Waila.log.log(Level.ERROR, "[BC] Unhandled exception trying to access a tank for display !.\n" + e);
|
||||
return null;
|
||||
}
|
||||
return tank;
|
||||
|
||||
@@ -2,26 +2,6 @@ package mcp.mobius.waila.addons.carpenters;
|
||||
|
||||
public class CarpentersModule {
|
||||
|
||||
public static Class TEBase = null;
|
||||
public static Class BlockCarpentersDoor = null;
|
||||
public static Class BlockCarpentersHatch = null;
|
||||
|
||||
public static void register() {
|
||||
/*
|
||||
* try{ Class CarpentersBlocks = Class.forName("carpentersblocks.CarpentersBlocks"); Waila.log.log(Level.INFO,
|
||||
* "CarpentersBlocks mod found."); } catch (ClassNotFoundException e){ Waila.log.log(Level.INFO,
|
||||
* "[CarpentersBlocks] CarpentersBlocks mod not found."); return; } try{ TEBase =
|
||||
* Class.forName("carpentersblocks.tileentity.TEBase"); BlockCarpentersDoor =
|
||||
* Class.forName("carpentersblocks.block.BlockCarpentersDoor"); BlockCarpentersHatch =
|
||||
* Class.forName("carpentersblocks.block.BlockCarpentersHatch"); } catch (ClassNotFoundException e){
|
||||
* Waila.log.log(Level.WARNING, "[CarpentersBlocks] Class not found. " + e); return; } catch (Exception e) {
|
||||
* Waila.log.log(Level.WARNING, "[CarpentersBlocks] Error while loading module. " + e); return; }
|
||||
* ModuleRegistrar.instance().addConfig("Carpenter's Blocks", "carpenters.hide");
|
||||
* ModuleRegistrar.instance().registerStackProvider(new HUDCarpentersBlocksTE(), BlockCarpentersDoor);
|
||||
* ModuleRegistrar.instance().registerStackProvider(new HUDCarpentersBlocksTE(), BlockCarpentersHatch);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("data", TEBase);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("cover_6", TEBase);
|
||||
*/
|
||||
}
|
||||
public static void register() {}
|
||||
|
||||
}
|
||||
@@ -2,29 +2,20 @@ package mcp.mobius.waila.addons.carpenters;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDCarpentersBlocksTE implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
/*
|
||||
* if (!config.getConfig("carpenters.hide")) return null; NBTTagCompound tag = accessor.getNBTData(); short data
|
||||
* = tag.getShort("data"); short cover = tag.getShort("cover_6");
|
||||
* if(CarpentersModule.BlockCarpentersDoor.isInstance(accessor.getBlock())){ int type = data & 0x7; if (type !=
|
||||
* 5) return null; if (cover == 0) return null; return new ItemStack(cover & 0xfff, 0, (cover & 0xf000) >>> 12);
|
||||
* } else if (CarpentersModule.BlockCarpentersHatch.isInstance(accessor.getBlock())){ int type = data & 0x7; if
|
||||
* (type != 0) return null; if (cover == 0) return null; return new ItemStack(cover & 0xfff, 0, (cover & 0xf000)
|
||||
* >>> 12); }
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,25 +2,25 @@ package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class EnderIOModule {
|
||||
|
||||
public static Class TileCapacitorBank = null;
|
||||
public static Class<?> TileCapacitorBank = null;
|
||||
public static Method TCB_getMaxInput = null;
|
||||
public static Method TCB_getMaxOutput = null;
|
||||
public static Method TCB_getEnergyStored = null;
|
||||
public static Method TCB_getMaxEnergyStored = null;
|
||||
public static Method TCB_getMaxIO = null;
|
||||
|
||||
public static Class TileTesseract = null;
|
||||
public static Class<?> TileTesseract = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModClass = Class.forName("crazypants.enderio.EnderIO");
|
||||
Class.forName("crazypants.enderio.EnderIO");
|
||||
Waila.log.log(Level.INFO, "EnderIO mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[EnderIO] EnderIO mod not found.");
|
||||
@@ -44,9 +44,6 @@ public class EnderIOModule {
|
||||
} catch (NoSuchMethodException e) {
|
||||
Waila.log.log(Level.WARN, "[EnderStorage] Method not found." + e);
|
||||
return;
|
||||
// } catch (NoSuchFieldException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
// return;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
|
||||
@@ -4,18 +4,18 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerCapacitor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,17 +4,17 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -37,7 +37,6 @@ public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
String channel = "%s : %s%s%s %s";
|
||||
String freq;
|
||||
String frequser;
|
||||
String owner;
|
||||
|
||||
if (config.getConfig("enderio.channel")) {
|
||||
|
||||
|
||||
@@ -3,24 +3,24 @@ package mcp.mobius.waila.addons.enderstorage;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class EnderStorageModule {
|
||||
|
||||
public static Class TileFrequencyOwner = null;
|
||||
public static Class<?> TileFrequencyOwner = null;
|
||||
public static Field TileFrequencyOwner_Freq = null;
|
||||
|
||||
public static Class EnderStorageManager = null;
|
||||
public static Class<?> EnderStorageManager = null;
|
||||
public static Method GetColourFromFreq = null;
|
||||
|
||||
public static Class TileEnderTank = null;
|
||||
public static Class<?> TileEnderTank = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class EnderStorage = Class.forName("codechicken.enderstorage.EnderStorage");
|
||||
Class.forName("codechicken.enderstorage.EnderStorage");
|
||||
Waila.log.log(Level.INFO, "EnderStorage mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[EnderStorage] EnderStorage mod not found.");
|
||||
|
||||
@@ -2,18 +2,18 @@ package mcp.mobius.waila.addons.enderstorage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerStorage implements IWailaDataProvider {
|
||||
|
||||
private static String[] colors = { LangUtil.translateG("hud.msg.white"), LangUtil.translateG("hud.msg.orange"),
|
||||
|
||||
@@ -2,25 +2,21 @@ package mcp.mobius.waila.addons.etb;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class ETBModule {
|
||||
|
||||
public static Class TileSocket = null;
|
||||
public static Class<?> TileSocket = null;
|
||||
public static Field Socket_sides = null;
|
||||
public static Field Socket_configs = null;
|
||||
// public static Field Socket_sideID = null;
|
||||
// public static Field Socket_sideMeta = null;
|
||||
// public static Field Socket_facID = null;
|
||||
// public static Field Socket_facMeta = null;
|
||||
|
||||
public static Class SocketsMod = null;
|
||||
public static Class<?> SocketsMod = null;
|
||||
public static Field module = null;
|
||||
|
||||
public static Class SideConfig = null;
|
||||
public static Class<?> SideConfig = null;
|
||||
public static Field SC_tank = null;
|
||||
public static Field SC_inventory = null;
|
||||
public static Field SC_rsControl = null;
|
||||
@@ -28,7 +24,7 @@ public class ETBModule {
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModClass = Class.forName("emasher.sockets.TileSocket");
|
||||
Class.forName("emasher.sockets.TileSocket");
|
||||
Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Engineer Toolbox] Engineer Toolbox mod not found.");
|
||||
@@ -40,18 +36,9 @@ public class ETBModule {
|
||||
TileSocket = Class.forName("emasher.sockets.TileSocket");
|
||||
Socket_sides = TileSocket.getField("sides");
|
||||
Socket_configs = TileSocket.getField("configs");
|
||||
// Socket_sideID = TileSocket.getField("sideID");
|
||||
// Socket_sideMeta = TileSocket.getField("sideMeta");
|
||||
// Socket_facID = TileSocket.getField("facID");
|
||||
// Socket_facMeta = TileSocket.getField("facMeta");
|
||||
|
||||
SocketsMod = Class.forName("emasher.sockets.SocketsMod");
|
||||
module = SocketsMod.getField("module");
|
||||
// module = (Item)SocketsMod.getField("module").get(null);
|
||||
/*
|
||||
* if (module == null){ mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] module field is null !");
|
||||
* return; }
|
||||
*/
|
||||
|
||||
SideConfig = Class.forName("emasher.api.SideConfig");
|
||||
SC_tank = SideConfig.getField("tank");
|
||||
@@ -62,9 +49,6 @@ public class ETBModule {
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Engineer Toolbox] Class not found. " + e);
|
||||
return;
|
||||
// } catch (NoSuchMethodException e){
|
||||
// Waila.log.log(Level.WARN, "[Engineer Toolbox] Method not found." + e);
|
||||
// return;
|
||||
} catch (NoSuchFieldException e) {
|
||||
Waila.log.log(Level.WARN, "[Engineer Toolbox] Field not found." + e);
|
||||
return;
|
||||
|
||||
@@ -2,11 +2,6 @@ package mcp.mobius.waila.addons.etb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +10,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerSocket implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -52,9 +52,9 @@ public class HUDHandlerSocket implements IWailaDataProvider {
|
||||
|
||||
String configstr = "[ ";
|
||||
|
||||
if (tank != -1) configstr += "\u00a79" + String.valueOf(tank) + " ";
|
||||
if (tank != -1) configstr += "\u00a79" + tank + " ";
|
||||
|
||||
if (inventory != -1) configstr += "\u00a7a" + String.valueOf(inventory) + " ";
|
||||
if (inventory != -1) configstr += "\u00a7a" + inventory + " ";
|
||||
|
||||
if (rsControl[0] || rsControl[1] || rsControl[2]) {
|
||||
configstr += "\u00a7c";
|
||||
@@ -76,12 +76,6 @@ public class HUDHandlerSocket implements IWailaDataProvider {
|
||||
|
||||
if (!configstr.equals("[ \u00a7r]")) tipstr += " " + configstr;
|
||||
|
||||
/*
|
||||
* if ((tank != -1) && (inventory != -1)) tipstr += String.format("[ \u00a79%d \u00a7a%d \u00a7r]",
|
||||
* tank, inventory); else if (tank != -1) tipstr += String.format("[ \u00a79%d \u00a7r]", tank);
|
||||
* else if (inventory != -1) tipstr += String.format("[ \u00a7a%d \u00a7r]", inventory);
|
||||
*/
|
||||
|
||||
currenttip.add(tipstr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package mcp.mobius.waila.addons.exu;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class ExtraUtilitiesModule {
|
||||
|
||||
public static Class ModExtraUtilities = null;
|
||||
public static Class TileEntityDrum = null;
|
||||
public static Class<?> TileEntityDrum = null;
|
||||
|
||||
public static void register() {
|
||||
|
||||
try {
|
||||
Class ModExtraUtilities = Class.forName("com.rwtema.extrautils.ExtraUtils");
|
||||
Class.forName("com.rwtema.extrautils.ExtraUtils");
|
||||
Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
|
||||
|
||||
@@ -2,10 +2,6 @@ package mcp.mobius.waila.addons.exu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -15,6 +11,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerDrum implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class GravestoneModule {
|
||||
|
||||
public static Class BlockGraveStone = null;
|
||||
public static Class<?> BlockGraveStone = null;
|
||||
|
||||
public static void register() {
|
||||
|
||||
try {
|
||||
Class ModGravestone = Class.forName("GraveStone.ModGraveStone");
|
||||
Class.forName("GraveStone.ModGraveStone");
|
||||
Waila.log.log(Level.INFO, "GraveStone mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
|
||||
|
||||
@@ -2,16 +2,16 @@ package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerGravestone implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package mcp.mobius.waila.addons.harvestability;
|
||||
|
||||
public class Config {
|
||||
|
||||
public static final String MINIMAL_SEPARATOR_STRING = " : ";
|
||||
|
||||
public static final String CURRENTLY_HARVESTABLE_STRING = "\u2714";
|
||||
|
||||
public static final String NOT_CURRENTLY_HARVESTABLE_STRING = "\u2718";
|
||||
|
||||
public static final String SHEARABILITY_STRING = "\u2702";
|
||||
|
||||
public static final String SILK_TOUCHABILITY_STRING = "\u2712";
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
package mcp.mobius.waila.addons.harvestability;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import mcp.mobius.waila.addons.harvestability.helpers.*;
|
||||
import mcp.mobius.waila.addons.harvestability.proxy.ProxyCreativeBlocks;
|
||||
import mcp.mobius.waila.addons.harvestability.proxy.ProxyGregTech;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.ProbeMode;
|
||||
import mcp.mobius.waila.api.elements.IProbeDataProvider;
|
||||
import mcp.mobius.waila.api.elements.IProbeInfo;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
|
||||
public class HUDHandlerHarvestability implements IWailaDataProvider, IProbeDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
Block block = accessor.getBlock();
|
||||
int meta = accessor.getMetadata();
|
||||
|
||||
if (ProxyCreativeBlocks.isCreativeBlock(block, meta)) return toolTip;
|
||||
|
||||
EntityPlayer player = accessor.getPlayer();
|
||||
|
||||
// for disguised blocks
|
||||
if (itemStack.getItem() instanceof ItemBlock && !ProxyGregTech.isOreBlock(block)
|
||||
&& !ProxyGregTech.isCasing(block)
|
||||
&& !ProxyGregTech.isMachine(block)) {
|
||||
block = Block.getBlockFromItem(itemStack.getItem());
|
||||
meta = itemStack.getItemDamage();
|
||||
}
|
||||
|
||||
boolean minimalLayout = config.getConfig("harvestability.minimal", false);
|
||||
|
||||
List<String> stringParts = new ArrayList<String>();
|
||||
getHarvestability(stringParts, player, block, meta, accessor.getPosition(), config, minimalLayout);
|
||||
|
||||
if (!stringParts.isEmpty()) {
|
||||
if (minimalLayout) toolTip.add(
|
||||
StringHelper.concatenateStringList(
|
||||
stringParts,
|
||||
EnumChatFormatting.RESET + Config.MINIMAL_SEPARATOR_STRING));
|
||||
else toolTip.addAll(stringParts);
|
||||
}
|
||||
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
public void getHarvestability(List<String> stringList, EntityPlayer player, Block block, int meta,
|
||||
MovingObjectPosition position, IWailaConfigHandler config, boolean minimalLayout) {
|
||||
boolean isSneaking = player.isSneaking();
|
||||
boolean showHarvestLevel = config.getConfig("harvestability.harvestlevel")
|
||||
&& (!config.getConfig("harvestability.harvestlevel.sneakingonly") || isSneaking);
|
||||
boolean showHarvestLevelNum = config.getConfig("harvestability.harvestlevelnum")
|
||||
&& (!config.getConfig("harvestability.harvestlevelnum.sneakingonly") || isSneaking);
|
||||
boolean showEffectiveTool = config.getConfig("harvestability.effectivetool")
|
||||
&& (!config.getConfig("harvestability.effectivetool.sneakingonly") || isSneaking);
|
||||
boolean showCurrentlyHarvestable = config.getConfig("harvestability.currentlyharvestable")
|
||||
&& (!config.getConfig("harvestability.currentlyharvestable.sneakingonly") || isSneaking);
|
||||
boolean hideWhileHarvestable = config.getConfig("harvestability.unharvestableonly", false);
|
||||
boolean showOresOnly = config.getConfig("harvestability.oresonly", false);
|
||||
boolean toolRequiredOnly = config.getConfig("harvestability.toolrequiredonly");
|
||||
|
||||
if (showHarvestLevel || showEffectiveTool || showCurrentlyHarvestable) {
|
||||
if (showOresOnly && !OreHelper.isBlockAnOre(block, meta)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isCurrentToolAdventureModeExempt(position.blockX, position.blockY, position.blockZ)
|
||||
|| BlockHelper.isBlockUnbreakable(
|
||||
block,
|
||||
player.worldObj,
|
||||
position.blockX,
|
||||
position.blockY,
|
||||
position.blockZ)) {
|
||||
String unbreakableString = ColorHelper.getBooleanColor(false) + Config.NOT_CURRENTLY_HARVESTABLE_STRING
|
||||
+ (!minimalLayout
|
||||
? EnumChatFormatting.RESET
|
||||
+ StatCollector.translateToLocal("wailaharvestability.harvestable")
|
||||
: "");
|
||||
stringList.add(unbreakableString);
|
||||
return;
|
||||
}
|
||||
|
||||
// needed to stop array index out of bounds exceptions on mob spawners
|
||||
// block.getHarvestLevel/getHarvestTool are only 16 elements big
|
||||
if (meta >= 16) meta = 0;
|
||||
|
||||
int harvestLevel = block.getHarvestLevel(meta);
|
||||
String effectiveTool = BlockHelper.getEffectiveToolOf(
|
||||
player.worldObj,
|
||||
position.blockX,
|
||||
position.blockY,
|
||||
position.blockZ,
|
||||
block,
|
||||
meta);
|
||||
if (effectiveTool != null && harvestLevel < 0) harvestLevel = 0;
|
||||
boolean blockHasEffectiveTools = harvestLevel >= 0 && effectiveTool != null;
|
||||
|
||||
String shearability = getShearabilityString(player, block, meta, position, config);
|
||||
String silkTouchability = getSilkTouchabilityString(player, block, meta, position, config);
|
||||
|
||||
if (toolRequiredOnly && block.getMaterial().isToolNotRequired()
|
||||
&& !blockHasEffectiveTools
|
||||
&& shearability.isEmpty()
|
||||
&& silkTouchability.isEmpty())
|
||||
return;
|
||||
|
||||
boolean canHarvest = false;
|
||||
boolean isEffective = false;
|
||||
boolean isAboveMinHarvestLevel = false;
|
||||
boolean isHoldingTinkersTool = false;
|
||||
boolean isHoldingGTTool = false;
|
||||
|
||||
ItemStack itemHeld = player.getHeldItem();
|
||||
if (itemHeld != null) {
|
||||
isHoldingTinkersTool = ToolHelper.hasToolTag(itemHeld);
|
||||
isHoldingGTTool = ProxyGregTech.isGTTool(itemHeld);
|
||||
isAboveMinHarvestLevel = (showCurrentlyHarvestable || showHarvestLevel)
|
||||
&& ToolHelper.canToolHarvestLevel(itemHeld, block, meta, harvestLevel);
|
||||
isEffective = showEffectiveTool
|
||||
&& ToolHelper.isToolEffectiveAgainst(itemHeld, block, meta, effectiveTool);
|
||||
if (isHoldingGTTool) {
|
||||
// GT tool don't care net.minecraft.block.material.Material#isToolNotRequired
|
||||
canHarvest = itemHeld.func_150998_b(block);
|
||||
} else {
|
||||
canHarvest = ToolHelper.canToolHarvestBlock(itemHeld, block, meta)
|
||||
|| (!isHoldingTinkersTool && block.canHarvestBlock(player, meta));
|
||||
}
|
||||
}
|
||||
|
||||
boolean isCurrentlyHarvestable = (canHarvest && isAboveMinHarvestLevel)
|
||||
|| (!isHoldingTinkersTool && ForgeHooks.canHarvestBlock(block, player, meta));
|
||||
|
||||
if (hideWhileHarvestable && isCurrentlyHarvestable) return;
|
||||
|
||||
String currentlyHarvestable = showCurrentlyHarvestable
|
||||
? ColorHelper.getBooleanColor(isCurrentlyHarvestable)
|
||||
+ (isCurrentlyHarvestable ? Config.CURRENTLY_HARVESTABLE_STRING
|
||||
: Config.NOT_CURRENTLY_HARVESTABLE_STRING)
|
||||
+ (!minimalLayout
|
||||
? EnumChatFormatting.RESET
|
||||
+ StatCollector.translateToLocal("wailaharvestability.currentlyharvestable")
|
||||
: "")
|
||||
: "";
|
||||
|
||||
if (!currentlyHarvestable.isEmpty() || !shearability.isEmpty() || !silkTouchability.isEmpty()) {
|
||||
String separator = (!shearability.isEmpty() || !silkTouchability.isEmpty() ? " " : "");
|
||||
stringList.add(
|
||||
currentlyHarvestable + separator
|
||||
+ silkTouchability
|
||||
+ (!silkTouchability.isEmpty() ? separator : "")
|
||||
+ shearability);
|
||||
}
|
||||
if (harvestLevel != -1 && showEffectiveTool && effectiveTool != null) {
|
||||
String effectiveToolString;
|
||||
if (StatCollector.canTranslate("wailaharvestability.toolclass." + effectiveTool))
|
||||
effectiveToolString = StatCollector
|
||||
.translateToLocal("wailaharvestability.toolclass." + effectiveTool);
|
||||
else effectiveToolString = effectiveTool.substring(0, 1).toUpperCase() + effectiveTool.substring(1);
|
||||
stringList.add(
|
||||
(!minimalLayout ? StatCollector.translateToLocal("wailaharvestability.effectivetool") : "")
|
||||
+ ColorHelper.getBooleanColor(
|
||||
isEffective && (!isHoldingTinkersTool || canHarvest),
|
||||
isHoldingTinkersTool && isEffective && !canHarvest)
|
||||
+ effectiveToolString);
|
||||
}
|
||||
if (harvestLevel >= 1 && (showHarvestLevel || showHarvestLevelNum)) {
|
||||
String harvestLevelString = "";
|
||||
String harvestLevelName = StringHelper.stripFormatting(StringHelper.getHarvestLevelName(harvestLevel));
|
||||
String harvestLevelNum = String.valueOf(harvestLevel);
|
||||
|
||||
// only show harvest level number and name if they are different
|
||||
showHarvestLevelNum = showHarvestLevelNum
|
||||
&& (!showHarvestLevel || !harvestLevelName.equals(harvestLevelNum));
|
||||
|
||||
if (showHarvestLevel) harvestLevelString = harvestLevelName
|
||||
+ (showHarvestLevelNum ? String.format(" (%d)", harvestLevel) : "");
|
||||
else if (showHarvestLevelNum) harvestLevelString = harvestLevelNum;
|
||||
|
||||
stringList.add(
|
||||
(!minimalLayout ? StatCollector.translateToLocal("wailaharvestability.harvestlevel") : "")
|
||||
+ ColorHelper.getBooleanColor(isAboveMinHarvestLevel && canHarvest)
|
||||
+ harvestLevelString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getShearabilityString(EntityPlayer player, Block block, int meta, MovingObjectPosition position,
|
||||
IWailaConfigHandler config) {
|
||||
boolean isSneaking = player.isSneaking();
|
||||
boolean showShearability = config.getConfig("harvestability.shearability")
|
||||
&& (!config.getConfig("harvestability.shearability.sneakingonly") || isSneaking);
|
||||
|
||||
if (showShearability && (block instanceof IShearable || block == Blocks.deadbush
|
||||
|| (block == Blocks.double_plant && block.getItemDropped(meta, new Random(), 0) == null))) {
|
||||
ItemStack itemHeld = player.getHeldItem();
|
||||
boolean isHoldingShears = itemHeld != null && itemHeld.getItem() instanceof ItemShears;
|
||||
boolean isShearable = isHoldingShears && ((IShearable) block)
|
||||
.isShearable(itemHeld, player.worldObj, position.blockX, position.blockY, position.blockZ);
|
||||
return ColorHelper.getBooleanColor(isShearable, !isShearable && isHoldingShears)
|
||||
+ Config.SHEARABILITY_STRING;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getSilkTouchabilityString(EntityPlayer player, Block block, int meta, MovingObjectPosition position,
|
||||
IWailaConfigHandler config) {
|
||||
boolean isSneaking = player.isSneaking();
|
||||
boolean showSilkTouchability = config.getConfig("harvestability.silktouchability")
|
||||
&& (!config.getConfig("harvestability.silktouchability.sneakingonly") || isSneaking);
|
||||
|
||||
if (showSilkTouchability && block
|
||||
.canSilkHarvest(player.worldObj, player, position.blockX, position.blockY, position.blockZ, meta)) {
|
||||
Item itemDropped = block.getItemDropped(meta, new Random(), 0);
|
||||
boolean silkTouchMatters = (itemDropped instanceof ItemBlock && itemDropped != Item.getItemFromBlock(block))
|
||||
|| block.quantityDropped(new Random()) <= 0;
|
||||
if (silkTouchMatters) {
|
||||
boolean hasSilkTouch = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
return ColorHelper.getBooleanColor(hasSilkTouch) + Config.SILK_TOUCHABILITY_STRING;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
public static HashMap<String, Boolean> configOptions = new HashMap<String, Boolean>();
|
||||
|
||||
static {
|
||||
configOptions.put("harvestability.harvestlevel", true);
|
||||
configOptions.put("harvestability.harvestlevelnum", false);
|
||||
configOptions.put("harvestability.effectivetool", true);
|
||||
configOptions.put("harvestability.currentlyharvestable", true);
|
||||
configOptions.put("harvestability.harvestlevel.sneakingonly", false);
|
||||
configOptions.put("harvestability.harvestlevelnum.sneakingonly", false);
|
||||
configOptions.put("harvestability.effectivetool.sneakingonly", false);
|
||||
configOptions.put("harvestability.currentlyharvestable.sneakingonly", false);
|
||||
configOptions.put("harvestability.oresonly", false);
|
||||
configOptions.put("harvestability.minimal", false);
|
||||
configOptions.put("harvestability.unharvestableonly", false);
|
||||
configOptions.put("harvestability.toolrequiredonly", true);
|
||||
configOptions.put("harvestability.shearability", true);
|
||||
configOptions.put("harvestability.shearability.sneakingonly", false);
|
||||
configOptions.put("harvestability.silktouchability", true);
|
||||
configOptions.put("harvestability.silktouchability.sneakingonly", false);
|
||||
}
|
||||
|
||||
public void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo,
|
||||
IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
Block block = accessor.getBlock();
|
||||
int meta = accessor.getMetadata();
|
||||
|
||||
if (ProxyCreativeBlocks.isCreativeBlock(block, meta)) return;
|
||||
|
||||
EntityPlayer player = accessor.getPlayer();
|
||||
|
||||
// for disguised blocks
|
||||
if (itemStack.getItem() instanceof ItemBlock && !ProxyGregTech.isOreBlock(block)
|
||||
&& !ProxyGregTech.isCasing(block)
|
||||
&& !ProxyGregTech.isMachine(block)) {
|
||||
block = Block.getBlockFromItem(itemStack.getItem());
|
||||
meta = itemStack.getItemDamage();
|
||||
}
|
||||
|
||||
List<String> stringParts = new ArrayList<String>();
|
||||
getHarvestability(stringParts, player, block, meta, accessor.getPosition(), config, true);
|
||||
|
||||
if (!stringParts.isEmpty()) {
|
||||
probeInfo.text(
|
||||
StringHelper.concatenateStringList(
|
||||
stringParts,
|
||||
EnumChatFormatting.RESET + Config.MINIMAL_SEPARATOR_STRING));
|
||||
}
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
for (Map.Entry<String, Boolean> entry : configOptions.entrySet()) {
|
||||
// hacky way to set default values to anything but true
|
||||
ConfigHandler.instance().getConfig(entry.getKey(), entry.getValue());
|
||||
ModuleRegistrar.instance().addConfig("Harvestability", entry.getKey(), "option." + entry.getKey());
|
||||
}
|
||||
|
||||
ModuleProbeRegistrar.instance().registerProbeProvider(new HUDHandlerHarvestability(), Block.class);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerHarvestability(), Block.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package mcp.mobius.waila.addons.harvestability;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class MissingHarvestInfo {
|
||||
|
||||
public static void init() {
|
||||
vanilla();
|
||||
}
|
||||
|
||||
public static void vanilla() {
|
||||
Blocks.web.setHarvestLevel("sword", 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHelper {
|
||||
|
||||
private static final HashMap<String, ItemStack> testTools = new HashMap<String, ItemStack>();
|
||||
static {
|
||||
testTools.put("pickaxe", new ItemStack(Items.wooden_pickaxe));
|
||||
testTools.put("shovel", new ItemStack(Items.wooden_shovel));
|
||||
testTools.put("axe", new ItemStack(Items.wooden_axe));
|
||||
}
|
||||
|
||||
public static String getEffectiveToolOf(World world, int x, int y, int z, Block block, int metadata) {
|
||||
String effectiveTool = block.getHarvestTool(metadata);
|
||||
if (effectiveTool == null) {
|
||||
float hardness = block.getBlockHardness(world, x, y, z);
|
||||
if (hardness > 0f) {
|
||||
for (Map.Entry<String, ItemStack> testToolEntry : testTools.entrySet()) {
|
||||
ItemStack testTool = testToolEntry.getValue();
|
||||
if (testTool != null && testTool.getItem() instanceof ItemTool
|
||||
&& testTool.func_150997_a(block) >= ((ItemTool) testTool.getItem()).func_150913_i()
|
||||
.getEfficiencyOnProperMaterial()) {
|
||||
effectiveTool = testToolEntry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return effectiveTool;
|
||||
}
|
||||
|
||||
public static boolean isBlockUnbreakable(Block block, World world, int x, int y, int z) {
|
||||
return block.getBlockHardness(world, x, y, z) == -1.0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ColorHelper {
|
||||
|
||||
private static final EnumChatFormatting colorRange[] = { EnumChatFormatting.DARK_RED, EnumChatFormatting.RED,
|
||||
EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.DARK_GREEN, EnumChatFormatting.GREEN,
|
||||
EnumChatFormatting.AQUA };
|
||||
|
||||
private static final EnumChatFormatting booleanColorRange[] = { EnumChatFormatting.DARK_RED, EnumChatFormatting.RED,
|
||||
EnumChatFormatting.DARK_GREEN, EnumChatFormatting.GREEN };
|
||||
|
||||
public static String getRelativeColor(double val, double min, double max) {
|
||||
if (min == max) return EnumChatFormatting.RESET.toString();
|
||||
else if ((max > min && val > max) || (min > max && val < max))
|
||||
return EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD;
|
||||
else if ((max > min && val < min) || (min > max && val > min))
|
||||
return colorRange[0].toString() + EnumChatFormatting.BOLD;
|
||||
|
||||
int index = (int) (((val - min) / (max - min)) * (colorRange.length - 1));
|
||||
return colorRange[Math.max(0, Math.min(colorRange.length - 1, index))].toString();
|
||||
}
|
||||
|
||||
public static String getBooleanColor(boolean val) {
|
||||
return getBooleanColor(val, false);
|
||||
}
|
||||
|
||||
public static String getBooleanColor(boolean val, boolean modified) {
|
||||
return booleanColorRange[(val ? 2 : 0) + (modified ? 1 : 0)].toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class KeyHelper {
|
||||
|
||||
public static boolean isCtrlKeyDown() {
|
||||
// prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the
|
||||
// OPTION key on Mac)
|
||||
boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||
if (!isCtrlKeyDown && Minecraft.isRunningOnMac)
|
||||
isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA);
|
||||
|
||||
return isCtrlKeyDown;
|
||||
}
|
||||
|
||||
public static boolean isShiftKeyDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class OreHelper {
|
||||
|
||||
public static boolean isBlockAnOre(Block block) {
|
||||
return isBlockAnOre(block, 0);
|
||||
}
|
||||
|
||||
public static boolean isBlockAnOre(Block block, int metadata) {
|
||||
return isItemAnOre(new ItemStack(block, 1, metadata));
|
||||
}
|
||||
|
||||
public static boolean isItemAnOre(ItemStack itemStack) {
|
||||
// check the ore dictionary to see if it starts with "ore"
|
||||
int[] oreIDs = OreDictionary.getOreIDs(itemStack);
|
||||
for (int oreID : oreIDs) {
|
||||
if (OreDictionary.getOreName(oreID).startsWith("ore")) return true;
|
||||
}
|
||||
|
||||
// ore in the display name (but not part of another word)
|
||||
if (itemStack.getDisplayName().matches(".*(^|\\s)([oO]re)($|\\s).*")) return true;
|
||||
|
||||
// ore as the start of the unlocalized name
|
||||
if (itemStack.getUnlocalizedName().startsWith("ore")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
|
||||
|
||||
public class StringHelper {
|
||||
|
||||
public static Class<?> HarvestLevels = null;
|
||||
public static Method getHarvestLevelName = null;
|
||||
static {
|
||||
try {
|
||||
HarvestLevels = Class.forName("tconstruct.library.util.HarvestLevels");
|
||||
getHarvestLevelName = HarvestLevels.getDeclaredMethod("getHarvestLevelName", int.class);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
public static String getHarvestLevelName(int num) {
|
||||
if (getHarvestLevelName != null) {
|
||||
try {
|
||||
return (String) getHarvestLevelName.invoke(null, num);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("IguanaTweaksTConstruct")) return ProxyIguanaTweaks.getHarvestLevelName(num);
|
||||
|
||||
String unlocalized = "wailaharvestability.harvestlevel" + (num + 1);
|
||||
|
||||
if (StatCollector.canTranslate(unlocalized)) return StatCollector.translateToLocal(unlocalized);
|
||||
|
||||
return String.valueOf(num);
|
||||
}
|
||||
|
||||
public static String concatenateStringList(List<String> strings, String separator) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String sep = "";
|
||||
for (String s : strings) {
|
||||
sb.append(sep).append(s);
|
||||
sep = separator;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String stripFormatting(String str) {
|
||||
return EnumChatFormatting.getTextWithoutFormattingCodes(str);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package mcp.mobius.waila.addons.harvestability.helpers;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class ToolHelper {
|
||||
|
||||
// tinkers construct
|
||||
private static Class<?> HarvestTool = null;
|
||||
private static Class<?> DualHarvestTool = null;
|
||||
private static Method getHarvestType = null;
|
||||
private static Method getSecondHarvestType = null;
|
||||
public static boolean tinkersConstructLoaded = false;
|
||||
|
||||
public static void init() {
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
try {
|
||||
HarvestTool = Class.forName("tconstruct.library.tools.HarvestTool");
|
||||
DualHarvestTool = Class.forName("tconstruct.library.tools.DualHarvestTool");
|
||||
getHarvestType = HarvestTool.getDeclaredMethod("getHarvestType");
|
||||
getSecondHarvestType = DualHarvestTool.getDeclaredMethod("getSecondHarvestType");
|
||||
getHarvestType.setAccessible(true);
|
||||
getSecondHarvestType.setAccessible(true);
|
||||
tinkersConstructLoaded = true;
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasToolTag(ItemStack itemStack) {
|
||||
return itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("InfiTool");
|
||||
}
|
||||
|
||||
public static NBTTagCompound getToolTag(ItemStack tool) {
|
||||
NBTTagCompound tag = null;
|
||||
if (tool.hasTagCompound()) tag = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static int getPrimaryHarvestLevel(NBTTagCompound toolTag) {
|
||||
return toolTag.getInteger("HarvestLevel");
|
||||
}
|
||||
|
||||
public static int getSecondaryHarvestLevel(NBTTagCompound toolTag) {
|
||||
return toolTag.getInteger("HarvestLevel2");
|
||||
}
|
||||
|
||||
public static Set<String> getToolClassesOf(ItemStack tool) {
|
||||
return tool.getItem().getToolClasses(tool);
|
||||
}
|
||||
|
||||
public static boolean isToolOfClass(ItemStack tool, String toolClass) {
|
||||
return getToolClassesOf(tool).contains(toolClass);
|
||||
}
|
||||
|
||||
public static boolean toolHasAnyToolClass(ItemStack tool) {
|
||||
return !getToolClassesOf(tool).isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isToolEffectiveAgainst(ItemStack tool, Block block, int metadata, String effectiveToolClass) {
|
||||
if (tinkersConstructLoaded && HarvestTool.isInstance(tool.getItem())) {
|
||||
Item item = tool.getItem();
|
||||
List<String> harvestTypes = new ArrayList<String>();
|
||||
try {
|
||||
harvestTypes.add((String) getHarvestType.invoke(item));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tinkersConstructLoaded = false;
|
||||
}
|
||||
|
||||
if (DualHarvestTool.isInstance(item)) {
|
||||
try {
|
||||
harvestTypes.add((String) getSecondHarvestType.invoke(item));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tinkersConstructLoaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
return harvestTypes.contains(effectiveToolClass);
|
||||
}
|
||||
return ForgeHooks.isToolEffective(tool, block, metadata)
|
||||
|| (toolHasAnyToolClass(tool) ? isToolOfClass(tool, effectiveToolClass)
|
||||
: tool.getItem().getDigSpeed(tool, block, metadata) > 1.5f);
|
||||
}
|
||||
|
||||
public static boolean canToolHarvestLevel(ItemStack tool, Block block, int metadata, int harvestLevel) {
|
||||
boolean canTinkersToolHarvestBlock = false;
|
||||
|
||||
NBTTagCompound toolTag = ToolHelper.getToolTag(tool);
|
||||
if (toolTag != null) {
|
||||
int toolHarvestLevel = Math
|
||||
.max(ToolHelper.getPrimaryHarvestLevel(toolTag), ToolHelper.getSecondaryHarvestLevel(toolTag));
|
||||
canTinkersToolHarvestBlock = toolHarvestLevel >= harvestLevel;
|
||||
}
|
||||
|
||||
return canTinkersToolHarvestBlock || ForgeHooks.canToolHarvestBlock(block, metadata, tool);
|
||||
}
|
||||
|
||||
public static boolean canToolHarvestBlock(ItemStack tool, Block block, int metadata) {
|
||||
return block.getMaterial().isToolNotRequired() || tool.func_150998_b(block); // func_150998_b = canHarvestBlock
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package mcp.mobius.waila.addons.harvestability.proxy;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class ProxyCreativeBlocks {
|
||||
|
||||
private static Class<?> CreativeBlocks = null;
|
||||
private static Method isCreativeBlock = null;
|
||||
|
||||
static {
|
||||
if (Loader.isModLoaded("CreativeBlocks")) {
|
||||
try {
|
||||
CreativeBlocks = Class.forName("squeek.creativeblocks.CreativeBlocks");
|
||||
isCreativeBlock = CreativeBlocks.getDeclaredMethod("isCreativeBlock", Block.class, int.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCreativeBlock(Block block, int meta) {
|
||||
if (isCreativeBlock != null) {
|
||||
try {
|
||||
return (Boolean) isCreativeBlock.invoke(null, block, meta);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package mcp.mobius.waila.addons.harvestability.proxy;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ProxyGregTech {
|
||||
|
||||
public static final String modID = "gregtech";
|
||||
public static final String oreBlockID = "gt.blockores";
|
||||
public static final String oreBlockUniqueIdentifier = modID + ":" + oreBlockID;
|
||||
public static final String casingID = "gt.blockcasings";
|
||||
public static final String casingUniqueIdentifier = modID + ":" + casingID;
|
||||
public static final String machineID = "gt.blockmachines";
|
||||
public static final String machineUniqueIdentifier = modID + ":" + machineID;
|
||||
public static boolean isModLoaded = Loader.isModLoaded(modID);
|
||||
|
||||
public static boolean isOreBlock(Block block) {
|
||||
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(oreBlockUniqueIdentifier);
|
||||
}
|
||||
|
||||
public static boolean isCasing(Block block) {
|
||||
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(casingUniqueIdentifier);
|
||||
}
|
||||
|
||||
public static boolean isMachine(Block block) {
|
||||
return isModLoaded && GameRegistry.findUniqueIdentifierFor(block).toString().equals(machineUniqueIdentifier);
|
||||
}
|
||||
|
||||
public static boolean isGTTool(ItemStack itemStack) {
|
||||
return isModLoaded && itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("GT.ToolStats");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package mcp.mobius.waila.addons.harvestability.proxy;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ProxyIguanaTweaks {
|
||||
|
||||
private static Class<?> HarvestLevels = null;
|
||||
private static Method proxyGetHarvestLevelName;
|
||||
|
||||
public static void init() {
|
||||
try {
|
||||
HarvestLevels = Class.forName("iguanaman.iguanatweakstconstruct.util.HarvestLevels");
|
||||
proxyGetHarvestLevelName = HarvestLevels.getDeclaredMethod("getHarvestLevelName", int.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getHarvestLevelName(int num) {
|
||||
String harvestLevelName = "<Unknown>";
|
||||
|
||||
try {
|
||||
harvestLevelName = (String) proxyGetHarvestLevelName.invoke(null, num);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return harvestLevelName;
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,18 @@ package mcp.mobius.waila.addons.harvestcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
public class HUDHandlerPamCrop implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package mcp.mobius.waila.addons.harvestcraft;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class HarvestcraftModule {
|
||||
|
||||
public static Class TileEntityPamCrop = null;
|
||||
public static Class<?> TileEntityPamCrop = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class PamHarvestCraft = Class.forName("assets.pamharvestcraft.PamHarvestCraft");
|
||||
Class.forName("assets.pamharvestcraft.PamHarvestCraft");
|
||||
Waila.log.log(Level.INFO, "PamHarvestCraft mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[PamHarvestCraft] PamHarvestCraft mod not found.");
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
public class HUDHandlerTEBaseGenerator implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
int storage = -1;
|
||||
int production = -1;
|
||||
|
||||
if (IC2Module.TileEntityBaseGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TEBG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = IC2Module.TEBG_Production.getInt(accessor.getTileEntity());
|
||||
}
|
||||
else if (IC2Module.TileEntityGeoGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TEGG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = IC2Module.TEGG_Production.getInt(accessor.getTileEntity());
|
||||
}
|
||||
else if (IC2Module.TileEntitySemifluidGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TESG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = (int)IC2Module.TESG_Production.getDouble(accessor.getTileEntity());
|
||||
}
|
||||
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
|
||||
if ( stored >= 0.0 && storage > 0)
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, Math.round(Math.min(stored,storage)), storage));
|
||||
|
||||
//else if (stored >= 0.0)
|
||||
// currenttip.add(String.format("Stored : %d EU", stored));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
|
||||
if ( production > 0)
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, production));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
if (te != null)
|
||||
te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
public class HUDHandlerTEElectricBlock implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
int storage = IC2Module.TEEB_MaxStorage.getInt(accessor.getTileEntity());
|
||||
|
||||
if ( stored >= 0.0 )
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, Math.round(Math.min(stored,storage)), storage));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
|
||||
int production = IC2Module.TEEB_Output.getInt(accessor.getTileEntity());
|
||||
if ( production > 0)
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, production));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
if (te != null)
|
||||
te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.TAB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -18,6 +12,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerTEGenerator implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -81,32 +82,32 @@ public class HUDHandlerTEGenerator implements IWailaDataProvider {
|
||||
|
||||
if (IC2Module.TileBaseGenerator.isInstance(te)) {
|
||||
storage = IC2Module.TileBaseGenerator_storage.getDouble(te);
|
||||
production = (long) IC2Module.TileBaseGenerator_production.getInt(te);
|
||||
maxStorage = (long) IC2Module.TileBaseGenerator_maxStorage.getShort(te);
|
||||
production = IC2Module.TileBaseGenerator_production.getInt(te);
|
||||
maxStorage = IC2Module.TileBaseGenerator_maxStorage.getShort(te);
|
||||
}
|
||||
|
||||
else if (IC2Module.TileGeoGenerator.isInstance(te)) {
|
||||
storage = IC2Module.TileGeoGenerator_storage.getDouble(te);
|
||||
production = (long) IC2Module.TileGeoGenerator_production.getInt(te);
|
||||
maxStorage = (long) IC2Module.TileGeoGenerator_maxStorage.getShort(te);
|
||||
production = IC2Module.TileGeoGenerator_production.getInt(te);
|
||||
maxStorage = IC2Module.TileGeoGenerator_maxStorage.getShort(te);
|
||||
}
|
||||
|
||||
else if (IC2Module.TileKineticGenerator.isInstance(te)) {
|
||||
storage = IC2Module.TileKineticGenerator_storage.getDouble(te);
|
||||
production = MathHelper.floor_double_long(IC2Module.TileKineticGenerator_production.getDouble(te));
|
||||
maxStorage = (long) IC2Module.TileKineticGenerator_maxStorage.getInt(te);
|
||||
maxStorage = IC2Module.TileKineticGenerator_maxStorage.getInt(te);
|
||||
}
|
||||
|
||||
else if (IC2Module.TileSemifluidGenerator.isInstance(te)) {
|
||||
storage = IC2Module.TileSemifluidGenerator_storage.getDouble(te);
|
||||
production = MathHelper.floor_double_long(IC2Module.TileSemifluidGenerator_production.getDouble(te));
|
||||
maxStorage = (long) IC2Module.TileSemifluidGenerator_maxStorage.getShort(te);
|
||||
maxStorage = IC2Module.TileSemifluidGenerator_maxStorage.getShort(te);
|
||||
}
|
||||
|
||||
else if (IC2Module.TileStirlingGenerator.isInstance(te)) {
|
||||
storage = IC2Module.TileStirlingGenerator_storage.getDouble(te);
|
||||
production = MathHelper.floor_double_long(IC2Module.TileStirlingGenerator_production.getDouble(te));
|
||||
maxStorage = (long) IC2Module.TileStirlingGenerator_maxStorage.getShort(te);
|
||||
maxStorage = IC2Module.TileStirlingGenerator_maxStorage.getShort(te);
|
||||
}
|
||||
|
||||
tag.setDouble("storage", storage);
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
public class HUDHandlerTEStandardMachine implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
|
||||
IC2Upgrades upgrades = IC2Module.getUpgrades(accessor);
|
||||
int baseConsumption = IC2Module.TESM_DefaultEnergyConsume.getInt(accessor.getTileEntity());
|
||||
int baseOpTime = IC2Module.TESM_DefaultOperationLength.getInt(accessor.getTileEntity());
|
||||
int baseStorage = IC2Module.TESM_DefaultEnergyStorage.getInt(accessor.getTileEntity());
|
||||
|
||||
long consumption = Math.round(Math.min(baseConsumption * Math.pow(1.6D, upgrades.overclocker), 2147483647));
|
||||
|
||||
double stackOpLen = baseOpTime * 64.0D * Math.pow(0.7D, upgrades.overclocker);
|
||||
int opPerTick = ((int)Math.min(Math.ceil(64.0D / stackOpLen), 2147483647.0D));
|
||||
int opTime = ((int)Math.round(stackOpLen * opPerTick / 64.0D));
|
||||
|
||||
int storage = Math.round(Math.min(baseStorage + 10000 * upgrades.storage + opTime * consumption, 2147483647));;
|
||||
|
||||
|
||||
int maxinput = (Integer)IC2Module.IES_GetMaxSafeInput.invoke(accessor.getTileEntity()) * (int)Math.pow(4.0D, Math.min(4, upgrades.transform));
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String powerStr = LangUtil.translateG("hud.msg.power");
|
||||
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
if ( stored >= 0.0 )
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, Math.round(Math.min(stored,storage)), storage));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.consump")){
|
||||
if ( consumption > 0)
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", powerStr, TAB + ALIGNRIGHT, consumption ));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.inputeu")){
|
||||
if ( maxinput > 0)
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", maxPowerStr, TAB + ALIGNRIGHT, maxinput ));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
if (te != null)
|
||||
te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
public class HUDHandlerTETradeOMat implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack,List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
/*
|
||||
if (!ConfigHandler.instance().getConfig("ic2.tradeomat")) return currenttip;
|
||||
|
||||
NBTTagCompound slots = accessor.getNBTData().getCompoundTag("InvSlots");
|
||||
NBTTagList offer = slots.getCompoundTag("offer").getTagList("Contents");
|
||||
NBTTagList demand = slots.getCompoundTag("demand").getTagList("Contents");
|
||||
String offersStr = LangUtil.translateG("hud.msg.offers");
|
||||
String demandsStr = LangUtil.translateG("hud.msg.demands");
|
||||
|
||||
|
||||
if (offer.tagCount() == 1){
|
||||
NBTTagCompound subtag = (NBTTagCompound)offer.tagAt(0);
|
||||
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r x \u00a7f%s\u00a7r", offersStr, TAB + ALIGNRIGHT, is.stackSize, is.getDisplayName()));
|
||||
}
|
||||
|
||||
if (demand.tagCount() == 1){
|
||||
NBTTagCompound subtag = (NBTTagCompound)demand.tagAt(0);
|
||||
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
|
||||
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r x \u00a7f%s\u00a7r", demandsStr, TAB + ALIGNRIGHT, is.stackSize, is.getDisplayName()));
|
||||
}
|
||||
*/
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
|
||||
if (te != null)
|
||||
te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,34 +2,34 @@ package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class IC2Module {
|
||||
|
||||
public static Class TileBaseGenerator = null;
|
||||
public static Class<?> TileBaseGenerator = null;
|
||||
public static Field TileBaseGenerator_storage = null;
|
||||
public static Field TileBaseGenerator_maxStorage = null;
|
||||
public static Field TileBaseGenerator_production = null;
|
||||
|
||||
public static Class TileGeoGenerator = null;
|
||||
public static Class<?> TileGeoGenerator = null;
|
||||
public static Field TileGeoGenerator_storage = null;
|
||||
public static Field TileGeoGenerator_maxStorage = null;
|
||||
public static Field TileGeoGenerator_production = null;
|
||||
|
||||
public static Class TileKineticGenerator = null;
|
||||
public static Class<?> TileKineticGenerator = null;
|
||||
public static Field TileKineticGenerator_storage = null;
|
||||
public static Field TileKineticGenerator_maxStorage = null;
|
||||
public static Field TileKineticGenerator_production = null;
|
||||
|
||||
public static Class TileSemifluidGenerator = null;
|
||||
public static Class<?> TileSemifluidGenerator = null;
|
||||
public static Field TileSemifluidGenerator_storage = null;
|
||||
public static Field TileSemifluidGenerator_maxStorage = null;
|
||||
public static Field TileSemifluidGenerator_production = null;
|
||||
|
||||
public static Class TileStirlingGenerator = null;
|
||||
public static Class<?> TileStirlingGenerator = null;
|
||||
public static Field TileStirlingGenerator_storage = null;
|
||||
public static Field TileStirlingGenerator_maxStorage = null;
|
||||
public static Field TileStirlingGenerator_production = null;
|
||||
@@ -68,7 +68,6 @@ public class IC2Module {
|
||||
TileStirlingGenerator_maxStorage = TileStirlingGenerator.getDeclaredField("maxEUStorage");
|
||||
TileStirlingGenerator_production = TileStirlingGenerator.getDeclaredField("production");
|
||||
|
||||
// ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileBaseGenerator);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileGeoGenerator);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileKineticGenerator);
|
||||
@@ -85,8 +84,14 @@ public class IC2Module {
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.outputeu");
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
Waila.log.log(Level.INFO, "[IndustrialCraft 2] IndustrialCraft 2 mod not found.");
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "IndustrialCraft 2 mod found.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.AccessHelper;
|
||||
|
||||
public class IC2Module {
|
||||
|
||||
public static Class TileEntityStandardMachine = null;
|
||||
public static Field TESM_DefaultEnergyStorage = null;
|
||||
public static Field TESM_DefaultEnergyConsume = null;
|
||||
public static Field TESM_DefaultOperationLength = null;
|
||||
public static Field TESM_MaxEnergy = null;
|
||||
|
||||
public static Class TileEntityBaseGenerator = null;
|
||||
public static Field TEBG_MaxStorage = null;
|
||||
public static Field TEBG_Production = null;
|
||||
|
||||
public static Class TileEntitySemifluidGenerator = null;
|
||||
public static Field TESG_MaxStorage = null;
|
||||
public static Field TESG_Production = null;
|
||||
|
||||
public static Class TileEntityGeoGenerator = null;
|
||||
public static Field TEGG_MaxStorage = null;
|
||||
public static Field TEGG_Production = null;
|
||||
|
||||
public static Class TileEntityElectricBlock = null;
|
||||
public static Field TEEB_MaxStorage = null;
|
||||
public static Field TEEB_Output = null;
|
||||
|
||||
public static Class IEnergySink = null;
|
||||
public static Method IES_GetMaxSafeInput = null;
|
||||
|
||||
public static Class TileEntityTradeOMat = null;
|
||||
|
||||
/* Some required items */
|
||||
public static Class IC2Items = null;
|
||||
public static Field TransformerUpgrade = null;
|
||||
public static ItemStack TransformerUpgradeStack = null;
|
||||
public static Field EnergyStorageUpgrade = null;
|
||||
public static ItemStack EnergyStorageUpgradeStack = null;
|
||||
public static Field OverclockerUpgrade = null;
|
||||
public static ItemStack OverclockerUpgradeStack = null;
|
||||
|
||||
public static void register(){
|
||||
/*
|
||||
|
||||
try{
|
||||
TileEntityStandardMachine = Class.forName("ic2.core.block.machine.tileentity.TileEntityStandardMachine");
|
||||
TESM_DefaultEnergyStorage = TileEntityStandardMachine.getField("defaultEnergyStorage");
|
||||
TESM_DefaultEnergyConsume = TileEntityStandardMachine.getField("defaultEnergyConsume");
|
||||
TESM_DefaultOperationLength = TileEntityStandardMachine.getField("defaultOperationLength");
|
||||
TESM_MaxEnergy = TileEntityStandardMachine.getField("maxEnergy");
|
||||
|
||||
TileEntityBaseGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityBaseGenerator");
|
||||
TEBG_MaxStorage = TileEntityBaseGenerator.getField("maxStorage");
|
||||
TEBG_Production = TileEntityBaseGenerator.getField("production");
|
||||
|
||||
TileEntitySemifluidGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntitySemifluidGenerator");
|
||||
TESG_MaxStorage = TileEntitySemifluidGenerator.getDeclaredField("maxStorage");
|
||||
TESG_Production = TileEntitySemifluidGenerator.getDeclaredField("production");
|
||||
TESG_MaxStorage.setAccessible(true);
|
||||
TESG_Production.setAccessible(true);
|
||||
|
||||
TileEntityGeoGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityGeoGenerator");
|
||||
TEGG_MaxStorage = TileEntityGeoGenerator.getField("maxStorage");
|
||||
TEGG_Production = TileEntityGeoGenerator.getField("production");
|
||||
|
||||
TileEntityElectricBlock = Class.forName("ic2.core.block.wiring.TileEntityElectricBlock");
|
||||
TEEB_MaxStorage = TileEntityElectricBlock.getField("maxStorage");
|
||||
TEEB_Output = TileEntityElectricBlock.getField("output");
|
||||
|
||||
IEnergySink = Class.forName("ic2.api.energy.tile.IEnergySink");
|
||||
IES_GetMaxSafeInput = IEnergySink.getMethod("getMaxSafeInput");
|
||||
|
||||
IC2Items = Class.forName("ic2.core.Ic2Items");
|
||||
TransformerUpgrade = IC2Items.getField("transformerUpgrade");
|
||||
EnergyStorageUpgrade = IC2Items.getField("energyStorageUpgrade");
|
||||
OverclockerUpgrade = IC2Items.getField("overclockerUpgrade");
|
||||
|
||||
TransformerUpgradeStack = (ItemStack)TransformerUpgrade.get(null);
|
||||
EnergyStorageUpgradeStack = (ItemStack)EnergyStorageUpgrade.get(null);
|
||||
OverclockerUpgradeStack = (ItemStack)OverclockerUpgrade.get(null);
|
||||
|
||||
TileEntityTradeOMat = Class.forName("ic2.core.block.personal.TileEntityTradeOMat");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
//e.printStackTrace();
|
||||
Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
//e.printStackTrace();
|
||||
Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
//e.printStackTrace();
|
||||
Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
//e.printStackTrace();
|
||||
Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
|
||||
ModuleRegistrar.instance().addConfig("IndustrialCraft2", "ic2.outputeu");
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeu");
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.consump");
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.tradeomat");
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEStandardMachine(), TileEntityStandardMachine);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityBaseGenerator);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntitySemifluidGenerator);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityGeoGenerator);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEElectricBlock(), TileEntityElectricBlock);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTETradeOMat(), TileEntityTradeOMat);
|
||||
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityStandardMachine);
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityBaseGenerator);
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntitySemifluidGenerator);
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityGeoGenerator);
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityElectricBlock);
|
||||
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityTradeOMat);
|
||||
*/
|
||||
}
|
||||
|
||||
/* Retuns the current stored energy if available in the nbt and config is true */
|
||||
public static double getStoredEnergy(IWailaDataAccessor accessor){
|
||||
/*
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
if (accessor.getNBTData().hasKey("energy"))
|
||||
return accessor.getNBTData().getDouble("energy");
|
||||
else if (accessor.getNBTData().hasKey("storage"))
|
||||
return accessor.getNBTData().getDouble("storage");
|
||||
}
|
||||
*/
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
public static IC2Upgrades getUpgrades(IWailaDataAccessor accessor){
|
||||
|
||||
NBTTagCompound nbt = accessor.getNBTData();
|
||||
IC2Upgrades upgrades = new IC2Upgrades();
|
||||
|
||||
/*
|
||||
if (!nbt.hasKey("InvSlots")) return null;
|
||||
|
||||
NBTTagCompound inventory = nbt.getCompoundTag("InvSlots");
|
||||
if (!inventory.hasKey("upgrade")) return null;
|
||||
|
||||
NBTTagList nbtupgrades = inventory.getCompoundTag("upgrade").getTagList("Contents");
|
||||
|
||||
//List tagList = (List)AccessHelper.getField("net.minecraft.nbt.NBTTagList", "tagList", nbtupgrades);
|
||||
List tagList = ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, nbtupgrades, "field_74747_a");
|
||||
|
||||
for (Object subobj : tagList){
|
||||
NBTTagCompound subtag = (NBTTagCompound)subobj;
|
||||
int id = subtag.getShort("id");
|
||||
int meta = subtag.getShort("Damage");
|
||||
int count = subtag.getByte("Count");
|
||||
|
||||
//ItemStack is = new ItemStack(id, 1, count);
|
||||
if (TransformerUpgradeStack.getItemDamage() == meta && TransformerUpgradeStack.itemID == id)
|
||||
upgrades.transform += count;
|
||||
if (EnergyStorageUpgradeStack.getItemDamage() == meta && EnergyStorageUpgradeStack.itemID == id)
|
||||
upgrades.storage += count;
|
||||
if (OverclockerUpgradeStack.getItemDamage() == meta && OverclockerUpgradeStack.itemID == id)
|
||||
upgrades.overclocker += count;
|
||||
}
|
||||
*/
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
public class IC2Upgrades {
|
||||
public int transform = 0;
|
||||
public int storage = 0;
|
||||
public int overclocker = 0;
|
||||
}
|
||||
@@ -2,17 +2,17 @@ package mcp.mobius.waila.addons.magicalcrops;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerMagicalCrops implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package mcp.mobius.waila.addons.magicalcrops;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class MagicalCropsModule {
|
||||
|
||||
public static Class BlockMagicalCrops = null;
|
||||
public static Class<?> BlockMagicalCrops = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class MagicalCrops = Class.forName("magicalcrops.mod_sCrops");
|
||||
Class.forName("magicalcrops.mod_sCrops");
|
||||
Waila.log.log(Level.INFO, "MagicalCrops mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[MagicalCrops] MagicalCrops mod not found.");
|
||||
|
||||
@@ -2,11 +2,6 @@ package mcp.mobius.waila.addons.openblocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -17,6 +12,11 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package mcp.mobius.waila.addons.openblocks;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class OpenBlocksModule {
|
||||
|
||||
public static Class ModOpenBlocks = null;
|
||||
public static Class TileEntityTank = null;
|
||||
public static Class<?> TileEntityTank = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModOpenBlocks = Class.forName("openblocks.OpenBlocks");
|
||||
Class.forName("openblocks.OpenBlocks");
|
||||
Waila.log.log(Level.INFO, "OpenBlocks mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaFMPAccessor;
|
||||
import mcp.mobius.waila.api.IWailaFMPDecorator;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class HUDDecoratorRsGateLogic implements IWailaFMPDecorator {
|
||||
|
||||
static byte[][] IOARRAY = { { 1, 1, 2, 1 } /* OR */, { 1, 1, 2, 1 } /* NOR */, { 1, 2, 2, 2 } /* NOT */,
|
||||
@@ -41,12 +41,9 @@ public class HUDDecoratorRsGateLogic implements IWailaFMPDecorator {
|
||||
subID = NBTUtil.getNBTInteger(accessor.getNBTData(), "subID");
|
||||
shape = NBTUtil.getNBTInteger(accessor.getNBTData(), "shape");
|
||||
|
||||
// orient = orient - ((orient & 0x10) + (orient & 0x8) + (orient & 0x4));
|
||||
int hOrient = orient & 0x3;
|
||||
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
|
||||
|
||||
// System.out.printf("%s\n", ForgeDirection.getOrientation(vOrient));
|
||||
|
||||
if (vOrient == ForgeDirection.EAST) hOrient -= 1;
|
||||
|
||||
if (vOrient == ForgeDirection.WEST) hOrient += 1;
|
||||
|
||||
@@ -4,13 +4,13 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaFMPAccessor;
|
||||
import mcp.mobius.waila.api.IWailaFMPProvider;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDFMPGateLogic implements IWailaFMPProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.ITaggedList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaFMPAccessor;
|
||||
import mcp.mobius.waila.api.IWailaFMPProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
public class HUDFMPWires implements IWailaFMPProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("pr.showsignal")) return currenttip;
|
||||
|
||||
ITaggedList<String, String> tagList = (ITaggedList<String, String>) currenttip;
|
||||
int signal = ((NBTUtil.getNBTInteger(accessor.getNBTData(), "signal") & 0xff) + 16) / 17;
|
||||
if (tagList.getEntries("signal").isEmpty()) {
|
||||
tagList.add(String.format("%s : %s", LangUtil.translateG("hud.msg.power"), signal), "signal");
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class ProjectRedModule {
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModClass = Class.forName("mrtjp.projectred.ProjectRedIntegration");
|
||||
Class.forName("mrtjp.projectred.ProjectRedIntegration");
|
||||
Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
|
||||
@@ -18,6 +18,7 @@ public class ProjectRedModule {
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showio");
|
||||
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showdata");
|
||||
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showsignal");
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_sgate");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_igate");
|
||||
@@ -25,6 +26,10 @@ public class ProjectRedModule {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_bgate");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_agate");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_rgate");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_redwire");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_insulated");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_fredwire");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_finsulated");
|
||||
|
||||
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_sgate");
|
||||
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_igate");
|
||||
@@ -32,10 +37,6 @@ public class ProjectRedModule {
|
||||
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_bgate");
|
||||
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_agate");
|
||||
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_rgate");
|
||||
|
||||
// ModuleRegistrar.instance().registerBlockDecorator(new HUDDecoratorRsGateLogic(), BlockMultipart);
|
||||
// ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerRsGateLogic(), BlockMultipart);
|
||||
// ModuleRegistrar.instance().registerSyncedNBTKey("*", BlockMultipart);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,6 @@ package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -16,6 +10,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,21 +2,20 @@ package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class RailcraftModule {
|
||||
|
||||
public static Class TileTankBase = null;
|
||||
public static Class ITankTile = null;
|
||||
public static Class<?> TileTankBase = null;
|
||||
public static Class<?> ITankTile = null;
|
||||
public static Method ITankTile_getTank = null;
|
||||
// public static Class StandardTank = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModRailcraft = Class.forName("mods.railcraft.common.core.Railcraft");
|
||||
Class.forName("mods.railcraft.common.core.Railcraft");
|
||||
Waila.log.log(Level.INFO, "Railcraft mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Railcraft] Railcraft mod not found.");
|
||||
@@ -27,7 +26,6 @@ public class RailcraftModule {
|
||||
TileTankBase = Class.forName("mods.railcraft.common.blocks.machine.beta.TileTankBase");
|
||||
ITankTile = Class.forName("mods.railcraft.common.blocks.machine.ITankTile");
|
||||
ITankTile_getTank = ITankTile.getMethod("getTank");
|
||||
// StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Railcraft] Class not found. " + e);
|
||||
|
||||
@@ -2,29 +2,20 @@ package mcp.mobius.waila.addons.secretrooms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDTileEntityCamo implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
/*
|
||||
* if (!config.getConfig("secretrooms.hide")) return null; if (
|
||||
* SecretRoomsModule.BlockCamoTrapDoor.isInstance(accessor.getBlock()) ){ return
|
||||
* this.getTrapDoorBlock(accessor); } else if (
|
||||
* SecretRoomsModule.BlockTorchLever.isInstance(accessor.getBlock()) ){ return new ItemStack(Blocks.torch); }
|
||||
* else if (accessor.getNBTData() != null){ NBTTagCompound tag = accessor.getNBTData(); if (tag.hasKey("copyID")
|
||||
* && tag.hasKey("copyMeta")){ int copyID = accessor.getNBTInteger(tag, "copyID"); int copyMeta =
|
||||
* accessor.getNBTInteger(tag, "copyMeta"); return new ItemStack(copyID, 1, copyMeta); } }
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,14 +38,6 @@ public class HUDTileEntityCamo implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
private ItemStack getTrapDoorBlock(IWailaDataAccessor accessor) {
|
||||
// modify coordinates to get hinge Block.
|
||||
/*
|
||||
* int i = accessor.getMetadata(); int j = accessor.getPosition().blockX; int k = accessor.getPosition().blockZ;
|
||||
* if ((i & 3) == 0) { k++; } if ((i & 3) == 1) { k--; } if ((i & 3) == 2) { j++; } if ((i & 3) == 3) { j--; }
|
||||
* int blockID = accessor.getWorld().getBlockId(j, accessor.getPosition().blockY, k); int blockMeta =
|
||||
* accessor.getWorld().getBlockMetadata(j, accessor.getPosition().blockY, k); return new ItemStack(blockID, 1,
|
||||
* blockMeta);
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,27 +2,6 @@ package mcp.mobius.waila.addons.secretrooms;
|
||||
|
||||
public class SecretRoomsModule {
|
||||
|
||||
public static Class TileEntityCamo = null;
|
||||
public static Class BlockTorchLever = null;
|
||||
public static Class BlockCamoTrapDoor = null;
|
||||
|
||||
public static void register() {
|
||||
/*
|
||||
* try{ Class SecretRooms = Class.forName("com.github.AbrarSyed.secretroomsmod.common.SecretRooms");
|
||||
* Waila.log.log(Level.INFO, "SecretRooms mod found."); } catch (ClassNotFoundException e){
|
||||
* Waila.log.log(Level.INFO, "[SecretRooms] SecretRooms mod not found."); return; } try{ TileEntityCamo =
|
||||
* Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.TileEntityCamo"); BlockTorchLever =
|
||||
* Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.BlockTorchLever"); BlockCamoTrapDoor =
|
||||
* Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.BlockCamoTrapDoor"); } catch
|
||||
* (ClassNotFoundException e){ Waila.log.log(Level.WARNING, "[SecretRooms] Class not found. " + e); return; }
|
||||
* catch (Exception e) { Waila.log.log(Level.WARNING, "[SecretRooms] Error while loading module. " + e); return;
|
||||
* } ModuleRegistrar.instance().addConfig("SecretRooms", "secretrooms.hide");
|
||||
* ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), TileEntityCamo);
|
||||
* ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), BlockTorchLever);
|
||||
* ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), BlockCamoTrapDoor);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("copyID", TileEntityCamo);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("copyMeta", TileEntityCamo);
|
||||
*/
|
||||
}
|
||||
public static void register() {}
|
||||
|
||||
}
|
||||
@@ -4,17 +4,17 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerStatues implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -27,7 +27,7 @@ public class HUDHandlerStatues implements IWailaDataProvider {
|
||||
IWailaConfigHandler config) {
|
||||
try {
|
||||
String skinName = (String) StatuesModule.skinName.get(accessor.getTileEntity());
|
||||
if (skinName.equals("")) {
|
||||
if (skinName.isEmpty()) {
|
||||
TileEntity belowEnt = accessor.getWorld().getTileEntity(
|
||||
accessor.getPosition().blockX,
|
||||
accessor.getPosition().blockY - 1,
|
||||
@@ -36,7 +36,7 @@ public class HUDHandlerStatues implements IWailaDataProvider {
|
||||
skinName = (String) StatuesModule.skinName.get(belowEnt);
|
||||
}
|
||||
|
||||
if (skinName.equals("")) {
|
||||
if (skinName.isEmpty()) {
|
||||
currenttip.clear();
|
||||
currenttip.add(WHITE + "Statue : Unknown");
|
||||
} else {
|
||||
@@ -48,12 +48,6 @@ public class HUDHandlerStatues implements IWailaDataProvider {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
/*
|
||||
* String skinName = accessor.getNBTData().getString("skin"); if (skinName.equals("")){ if
|
||||
* (accessor.getWorld().getBlockTileEntity(accessor.getPosition().blockX, accessor.getPosition().blockY - 1,
|
||||
* accessor.getPosition().blockZ) != null){ } }
|
||||
*/
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@ package mcp.mobius.waila.addons.statues;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class StatuesModule {
|
||||
|
||||
public static Class TileEntityStatue = null;
|
||||
public static Class<?> TileEntityStatue = null;
|
||||
public static Field skinName = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class Statues = Class.forName("info.jbcs.minecraft.statues.Statues");
|
||||
Class.forName("info.jbcs.minecraft.statues.Statues");
|
||||
Waila.log.log(Level.INFO, "Statues mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Statues] Statues mod not found.");
|
||||
@@ -24,10 +24,7 @@ public class StatuesModule {
|
||||
try {
|
||||
TileEntityStatue = Class.forName("info.jbcs.minecraft.statues.TileEntityStatue");
|
||||
skinName = TileEntityStatue.getDeclaredField("skinName");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Statues] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException e) {
|
||||
Waila.log.log(Level.WARN, "[Statues] Class not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,21 +5,21 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDCargoManager implements IWailaDataProvider {
|
||||
|
||||
private static String colors[] = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
|
||||
private static String sides[] = { "Yellow", "Blue", "Green", "Red" };
|
||||
private static String[] colors = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
|
||||
private static String[] sides = { "Yellow", "Blue", "Green", "Red" };
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -69,15 +69,14 @@ public class HUDCargoManager implements IWailaDataProvider {
|
||||
int doReturn = accessor.getNBTInteger(tag, "doReturn");
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int target = accessor.getNBTInteger(tag, "target" + String.valueOf(i));
|
||||
int color = accessor.getNBTInteger(tag, "color" + String.valueOf(i));
|
||||
int amount = accessor.getNBTInteger(tag, "amount" + String.valueOf(i));
|
||||
int target = accessor.getNBTInteger(tag, "target" + i);
|
||||
int color = accessor.getNBTInteger(tag, "color" + i);
|
||||
int amount = accessor.getNBTInteger(tag, "amount" + i);
|
||||
if (color == 5) continue;
|
||||
|
||||
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
|
||||
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
|
||||
String sAmount = amount == 0 ? "All"
|
||||
: String.valueOf(this.getAmount(amount) + " " + this.getAmountType(amount));
|
||||
String sAmount = amount == 0 ? "All" : this.getAmount(amount) + " " + this.getAmountType(amount);
|
||||
|
||||
String selection = (String) StevesCartsModule.GetSelectionName
|
||||
.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
|
||||
@@ -108,40 +107,17 @@ public class HUDCargoManager implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
public int getAmount(int id) {
|
||||
switch (id) {
|
||||
case 1:
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
return 3;
|
||||
|
||||
case 3:
|
||||
return 8;
|
||||
|
||||
case 4:
|
||||
return 16;
|
||||
|
||||
case 5:
|
||||
return 32;
|
||||
|
||||
case 6:
|
||||
return 64;
|
||||
|
||||
case 7:
|
||||
return 1;
|
||||
|
||||
case 8:
|
||||
return 2;
|
||||
|
||||
case 9:
|
||||
return 3;
|
||||
|
||||
case 10:
|
||||
return 5;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return switch (id) {
|
||||
case 1, 7 -> 1;
|
||||
case 2, 9 -> 3;
|
||||
case 3 -> 8;
|
||||
case 4 -> 16;
|
||||
case 5 -> 32;
|
||||
case 6 -> 64;
|
||||
case 8 -> 2;
|
||||
case 10 -> 5;
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
// 0 - MAX
|
||||
|
||||
@@ -2,16 +2,16 @@ package mcp.mobius.waila.addons.stevescarts;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDCartAssembler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -28,25 +28,6 @@ public class HUDCartAssembler implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
/*
|
||||
* if (!config.getConfig("stevescarts.showall")) return currenttip; if
|
||||
* (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()){ currenttip.add(ITALIC +
|
||||
* "Press shift for more data"); return currenttip; } int currTime =
|
||||
* accessor.getNBTInteger(accessor.getNBTData(), "currentTime"); int maxTime =
|
||||
* accessor.getNBTInteger(accessor.getNBTData(), "maxTime"); int isAssembling =
|
||||
* accessor.getNBTInteger(accessor.getNBTData(), "isAssembling"); NBTTagList slots =
|
||||
* accessor.getNBTData().getTagList("Items"); boolean hasOutput = false; Item ItemCartModule = null; try {
|
||||
* ItemCartModule = (Item)StevesCartsModule.ItemCartModule.get(null); } catch (Exception e) { currenttip =
|
||||
* WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip); return
|
||||
* currenttip; } for (int i = 0; i < slots.tagCount(); i++){ NBTTagCompound subtag =
|
||||
* (NBTTagCompound)(slots.tagAt(i)); byte slot = subtag.getByte("Slot"); if (slot == 30) hasOutput = true; } if
|
||||
* (isAssembling == 1){ currenttip.add(String.format("Time remaining : %.1f sec", (maxTime - currTime) /
|
||||
* 20.0f)); NBTTagCompound output = accessor.getNBTData().getCompoundTag("Output"); short outID =
|
||||
* output.getShort("id"); byte[] metas = output.getCompoundTag("tag").getByteArray("Modules"); for (byte b :
|
||||
* metas){ currenttip.add(new ItemStack(ItemCartModule, 1, b).getDisplayName()); } } else if (hasOutput)
|
||||
* currenttip.add(String.format("Time remaining : <Done>")); else
|
||||
* currenttip.add(String.format("Time remaining : <Idle>"));
|
||||
*/
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDLiquidManager implements IWailaDataProvider {
|
||||
|
||||
private static String colors[] = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
|
||||
private static String sides[] = { "Yellow", "Blue", "Green", "Red" };
|
||||
private static String[] colors = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
|
||||
private static String[] sides = { "Yellow", "Blue", "Green", "Red" };
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -63,9 +63,8 @@ public class HUDLiquidManager implements IWailaDataProvider {
|
||||
int doReturn = accessor.getNBTInteger(tag, "doReturn");
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int target = accessor.getNBTInteger(tag, "target" + String.valueOf(i));
|
||||
int color = accessor.getNBTInteger(tag, "color" + String.valueOf(i));
|
||||
int amount = accessor.getNBTInteger(tag, "amount" + String.valueOf(i));
|
||||
int color = accessor.getNBTInteger(tag, "color" + i);
|
||||
int amount = accessor.getNBTInteger(tag, "amount" + i);
|
||||
|
||||
String fluidName = "<Empty>";
|
||||
int fluidAmount = 0;
|
||||
@@ -80,10 +79,8 @@ public class HUDLiquidManager implements IWailaDataProvider {
|
||||
|
||||
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
|
||||
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
|
||||
String sAmount = amount == 0 ? "All" : String.valueOf(this.getMaxAmountBuckets(amount)) + " mB";
|
||||
String sAmount = amount == 0 ? "All" : this.getMaxAmountBuckets(amount) + " mB";
|
||||
|
||||
// String selection = (String)
|
||||
// StevesCartsModule.GetSelectionName.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"Side %s %s[ %s ]%s[ %s , %s]%s[ %s ]",
|
||||
@@ -108,30 +105,19 @@ public class HUDLiquidManager implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
public int getMaxAmountBuckets(int id) {
|
||||
switch (id) {
|
||||
case 1:
|
||||
return 250;
|
||||
case 2:
|
||||
return 500;
|
||||
case 3:
|
||||
return 750;
|
||||
case 4:
|
||||
return 1000;
|
||||
case 5:
|
||||
return 2000;
|
||||
case 6:
|
||||
return 3000;
|
||||
case 7:
|
||||
return 5000;
|
||||
case 8:
|
||||
return 7500;
|
||||
case 9:
|
||||
return 10000;
|
||||
case 10:
|
||||
return 15000;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return switch (id) {
|
||||
case 1 -> 250;
|
||||
case 2 -> 500;
|
||||
case 3 -> 750;
|
||||
case 4 -> 1000;
|
||||
case 5 -> 2000;
|
||||
case 6 -> 3000;
|
||||
case 7 -> 5000;
|
||||
case 8 -> 7500;
|
||||
case 9 -> 10000;
|
||||
case 10 -> 15000;
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,11 +4,6 @@ import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaEntityAccessor;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,6 +11,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaEntityAccessor;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDMinecartModular implements IWailaEntityProvider {
|
||||
|
||||
@Override
|
||||
@@ -56,16 +56,16 @@ public class HUDMinecartModular implements IWailaEntityProvider {
|
||||
byte[] metas = tag.getByteArray("Modules");
|
||||
|
||||
for (int i = 0; i < metas.length; i++) {
|
||||
if (tag.hasKey("module" + String.valueOf(i) + "Fuel")) {
|
||||
if (tag.hasKey("module" + i + "Fuel")) {
|
||||
|
||||
int fuel = accessor.getNBTInteger(tag, "module" + String.valueOf(i) + "Fuel");
|
||||
int fuel = accessor.getNBTInteger(tag, "module" + i + "Fuel");
|
||||
currenttip.add(
|
||||
new ItemStack(ItemCartModule, 1, metas[i])
|
||||
.getDisplayName() + TAB + ALIGNRIGHT + " [ " + WHITE + fuel + GRAY + " POW ]");
|
||||
|
||||
} else if (tag.hasKey("module" + String.valueOf(i) + "Fluid")) {
|
||||
} else if (tag.hasKey("module" + i + "Fluid")) {
|
||||
|
||||
NBTTagCompound subtag = tag.getCompoundTag("module" + String.valueOf(i) + "Fluid");
|
||||
NBTTagCompound subtag = tag.getCompoundTag("module" + i + "Fluid");
|
||||
if (subtag.hasKey("Amount")) {
|
||||
int amount = accessor.getNBTInteger(subtag, "Amount");
|
||||
String fluid = subtag.getString("FluidName");
|
||||
@@ -74,7 +74,7 @@ public class HUDMinecartModular implements IWailaEntityProvider {
|
||||
+ ALIGNRIGHT
|
||||
+ " [ "
|
||||
+ WHITE
|
||||
+ String.valueOf(amount)
|
||||
+ amount
|
||||
+ GRAY
|
||||
+ " mB of "
|
||||
+ WHITE
|
||||
|
||||
@@ -5,50 +5,13 @@ import java.lang.reflect.Method;
|
||||
|
||||
public class StevesCartsModule {
|
||||
|
||||
public static Class TileEntityCartAssembler = null;
|
||||
public static Class TileEntityCargo = null;
|
||||
public static Class TileEntityLiquid = null;
|
||||
public static Class MinecartModular = null;
|
||||
public static Class StevesItems = null;
|
||||
public static Class CargoItemSelection = null;
|
||||
public static Class<?> CargoItemSelection = null;
|
||||
|
||||
public static Field ItemCartComponent = null; // Items.component
|
||||
public static Field ItemCartModule = null; // Items.modules
|
||||
public static Field ItemSelections = null; // TileEntityCargo.itemSelections
|
||||
|
||||
public static Method GetSelectionName = null; // CargoItemSelection.getName
|
||||
|
||||
public static void register() {
|
||||
/*
|
||||
* try{ Class ModStevesCarts = Class.forName("vswe.stevescarts.StevesCarts"); Waila.log.log(Level.INFO,
|
||||
* "StevesCarts mod found."); } catch (ClassNotFoundException e){ Waila.log.log(Level.INFO,
|
||||
* "[StevesCarts] StevesCarts mod not found."); return; } try{ TileEntityCartAssembler =
|
||||
* Class.forName("vswe.stevescarts.TileEntities.TileEntityCartAssembler"); TileEntityCargo =
|
||||
* Class.forName("vswe.stevescarts.TileEntities.TileEntityCargo"); TileEntityLiquid =
|
||||
* Class.forName("vswe.stevescarts.TileEntities.TileEntityLiquid"); MinecartModular =
|
||||
* Class.forName("vswe.stevescarts.Carts.MinecartModular"); StevesItems =
|
||||
* Class.forName("vswe.stevescarts.Items.Items"); CargoItemSelection =
|
||||
* Class.forName("vswe.stevescarts.Helpers.CargoItemSelection"); ItemCartComponent =
|
||||
* StevesItems.getDeclaredField("component"); ItemCartModule = StevesItems.getDeclaredField("modules");
|
||||
* ItemSelections = TileEntityCargo.getDeclaredField("itemSelections"); GetSelectionName =
|
||||
* CargoItemSelection.getDeclaredMethod("getName"); } catch (ClassNotFoundException e){
|
||||
* Waila.log.log(Level.WARNING, "[StevesCarts] Class not found. " + e); return; } catch (NoSuchFieldException e)
|
||||
* { Waila.log.log(Level.WARNING, "[StevesCarts] Field not found. " + e); return; } catch (NoSuchMethodException
|
||||
* e) { Waila.log.log(Level.WARNING, "[StevesCarts] Method not found. " + e); return; } catch (Exception e) {
|
||||
* Waila.log.log(Level.WARNING, "[StevesCarts] Error while loading module. " + e); return; }
|
||||
* ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.showall");
|
||||
* ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.colorblind");
|
||||
* ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.shifttoggle");
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDCartAssembler(), TileEntityCartAssembler);
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDCargoManager(), TileEntityCargo);
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDLiquidManager(), TileEntityLiquid);
|
||||
* ModuleRegistrar.instance().registerHeadProvider(new HUDMinecartModular(), MinecartModular);
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDMinecartModular(), MinecartModular);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityCartAssembler);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("*", MinecartModular);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityCargo);
|
||||
* ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityLiquid);
|
||||
*/
|
||||
}
|
||||
public static void register() {}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,9 @@ package mcp.mobius.waila.addons.thaumcraft;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,6 +14,10 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -41,13 +41,12 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
if (tag.hasKey("Aspects")) {
|
||||
NBTTagList taglist = tag.getTagList("Aspects", 10);
|
||||
|
||||
List<String> unknownAspects = new ArrayList<String>();
|
||||
List<String> unknownAspects = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < taglist.tagCount(); i++) {
|
||||
NBTTagCompound subtag = taglist.getCompoundTagAt(i);
|
||||
|
||||
String aspect = Character.toUpperCase(subtag.getString("key").charAt(0))
|
||||
+ subtag.getString("key").substring(1);
|
||||
String aspect = subtag.getString("key");
|
||||
String amount = String.valueOf(subtag.getInteger("value"));
|
||||
|
||||
if (!aspect.equals("???"))
|
||||
@@ -67,6 +66,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
@@ -80,41 +80,36 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
boolean hasReveal = ThaumcraftModule.IGoggles.isInstance(headSlot.getItem());
|
||||
if (!hasReveal) return tag;
|
||||
|
||||
HashMap knownAspects = (HashMap) ThaumcraftModule.CommonProxy_getKnownAspects
|
||||
Map<String, ?> knownAspects = (Map<String, ?>) ThaumcraftModule.CommonProxy_getKnownAspects
|
||||
.invoke(ThaumcraftModule.Thaumcraft_proxy.get(null));
|
||||
LinkedHashMap playerAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects
|
||||
Map<?, Integer> playerAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
|
||||
.get(knownAspects.get(player.getCommandSenderName()));
|
||||
LinkedHashMap tileAspects = new LinkedHashMap();
|
||||
Map<?, Integer> tileAspects = new LinkedHashMap<>();
|
||||
|
||||
if (ThaumcraftModule.IAspectContainer.isInstance(te)) {
|
||||
tileAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects
|
||||
tileAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
|
||||
.get(ThaumcraftModule.IAspectContainer_getAspects.invoke(te));
|
||||
} else if (ThaumcraftModule.TileAlchemyFurnace.isInstance(te)) {
|
||||
tileAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects
|
||||
tileAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
|
||||
.get(ThaumcraftModule.TileAlchemyFurnace_aspects.get(te));
|
||||
}
|
||||
|
||||
for (Object o : tileAspects.keySet()) {
|
||||
if ((Integer) tileAspects.get(o) > 0) {
|
||||
if (tileAspects.get(o) > 0) {
|
||||
if (playerAspects.containsKey(o)) {
|
||||
NBTTagCompound cmptag = new NBTTagCompound();
|
||||
cmptag.setString("key", (String) ThaumcraftModule.Aspect_tag.get(o));
|
||||
cmptag.setInteger("value", (Integer) tileAspects.get(o));
|
||||
cmptag.setString("key", (String) ThaumcraftModule.Aspect_getName.invoke(o));
|
||||
cmptag.setInteger("value", tileAspects.get(o));
|
||||
aspects.appendTag(cmptag);
|
||||
} else {
|
||||
NBTTagCompound cmptag = new NBTTagCompound();
|
||||
cmptag.setString("key", "???");
|
||||
cmptag.setInteger("value", (Integer) tileAspects.get(o));
|
||||
cmptag.setInteger("value", tileAspects.get(o));
|
||||
aspects.appendTag(cmptag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < aspects.tagCount(); i++){
|
||||
// System.out.printf("%s : %s\n", aspects.getCompoundTagAt(i).getString("key"),
|
||||
// aspects.getCompoundTagAt(i).getString("value"));
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -3,37 +3,36 @@ package mcp.mobius.waila.addons.thaumcraft;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ThaumcraftModule {
|
||||
|
||||
public static Class Thaumcraft = null;
|
||||
public static Class<?> Thaumcraft = null;
|
||||
public static Field Thaumcraft_proxy = null;
|
||||
|
||||
public static Class IAspectContainer = null;
|
||||
public static Class<?> IAspectContainer = null;
|
||||
public static Method IAspectContainer_getAspects = null;
|
||||
|
||||
public static Class AspectList = null;
|
||||
public static Class<?> AspectList = null;
|
||||
public static Method AspectList_writeToNBT = null;
|
||||
public static Field AspectList_aspects = null;
|
||||
|
||||
public static Class TileAlchemyFurnace = null;
|
||||
public static Class<?> TileAlchemyFurnace = null;
|
||||
public static Field TileAlchemyFurnace_aspects = null;
|
||||
|
||||
public static Class Aspect = null;
|
||||
public static Class<?> Aspect = null;
|
||||
public static Field Aspect_tag = null;
|
||||
public static Method Aspect_getName = null;
|
||||
|
||||
public static Class CommonProxy = null;
|
||||
public static Class<?> CommonProxy = null;
|
||||
public static Method CommonProxy_getKnownAspects = null;
|
||||
|
||||
public static Class IGoggles = null;
|
||||
|
||||
// public static Class TileAlchemyFurnace = null;
|
||||
public static Class<?> IGoggles = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
@@ -53,6 +52,7 @@ public class ThaumcraftModule {
|
||||
Aspect = Class.forName("thaumcraft.api.aspects.Aspect");
|
||||
Aspect_tag = Aspect.getDeclaredField("tag");
|
||||
Aspect_tag.setAccessible(true);
|
||||
Aspect_getName = Aspect.getDeclaredMethod("getName");
|
||||
|
||||
CommonProxy = Class.forName("thaumcraft.common.CommonProxy");
|
||||
CommonProxy_getKnownAspects = CommonProxy.getDeclaredMethod("getKnownAspects");
|
||||
@@ -66,12 +66,13 @@ public class ThaumcraftModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Class not found. " + e);
|
||||
Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception." + e);
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception. {}", e);
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Thaumcraft mod found.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,6 @@ package mcp.mobius.waila.addons.thermaldynamics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -14,6 +9,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
/**
|
||||
* Created by Lordmau5 on 28.02.2015.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package mcp.mobius.waila.addons.thermaldynamics;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class ThermalDynamicsModule {
|
||||
|
||||
public static Class TileFluidDuct = null;
|
||||
public static Class<?> TileFluidDuct = null;
|
||||
|
||||
public static void register() {
|
||||
// XXX : We register the Fluiduct
|
||||
@@ -21,19 +21,14 @@ public class ThermalDynamicsModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerDuct(), TileFluidDuct);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Dynamics] Thermal Dynamics mod not found.");
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks. {}", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX : We register the IBlockInfo interface
|
||||
/*
|
||||
* try{ IBlockInfo = Class.forName("cofh.api.block.IBlockInfo"); IBlockInfo_getBlockInfo =
|
||||
* IBlockInfo.getMethod("getBlockInfo", IBlockAccess.class, int.class, int.class, int.class,
|
||||
* ForgeDirection.class, EntityPlayer.class, List.class, boolean.class);
|
||||
* //ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIBlockInfo(), IBlockInfo);
|
||||
* ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerIBlockInfo(), IBlockInfo); } catch (Exception
|
||||
* e){ Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading IBlockInfo hooks." + e); }
|
||||
*/
|
||||
Waila.log.log(Level.INFO, "Thermal Dynamics mod found.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,12 +3,6 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -17,6 +11,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerCache implements IWailaDataProvider {
|
||||
|
||||
@@ -92,9 +91,7 @@ public class HUDHandlerCache implements IWailaDataProvider {
|
||||
try {
|
||||
tag.setInteger("MaxStored", (Integer) ThermalExpansionModule.TileCache_getMaxStored.invoke(te));
|
||||
tag.setInteger("Stored", (Integer) ThermalExpansionModule.TileCache_getStored.invoke(te));
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tag;
|
||||
|
||||
@@ -2,17 +2,17 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,6 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +11,10 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerIBlockInfo implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -44,7 +44,7 @@ public class HUDHandlerIBlockInfo implements IWailaDataProvider {
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
try {
|
||||
List info = new ArrayList();
|
||||
List<Object> info = new ArrayList<>();
|
||||
Block block = world.getBlock(x, y, z);
|
||||
ThermalExpansionModule.IBlockInfo_getBlockInfo
|
||||
.invoke(block, world, x, y, z, ForgeDirection.UNKNOWN, player, info, false);
|
||||
|
||||
+6
-6
@@ -2,12 +2,6 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.ITaggedList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -15,6 +9,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import mcp.mobius.waila.api.ITaggedList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,17 +2,17 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerISecureTile implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
@@ -37,18 +37,12 @@ public class HUDHandlerISecureTile implements IWailaDataProvider {
|
||||
|
||||
if (owner.equals("[None]")) return currenttip;
|
||||
|
||||
String access = "INVALID";
|
||||
switch (iaccess) {
|
||||
case 0:
|
||||
access = LangUtil.translateG("hud.msg.public");
|
||||
break;
|
||||
case 1:
|
||||
access = LangUtil.translateG("hud.msg.restricted");
|
||||
break;
|
||||
case 2:
|
||||
access = LangUtil.translateG("hud.msg.private");
|
||||
break;
|
||||
}
|
||||
String access = switch (iaccess) {
|
||||
case 0 -> LangUtil.translateG("hud.msg.public");
|
||||
case 1 -> LangUtil.translateG("hud.msg.restricted");
|
||||
case 2 -> LangUtil.translateG("hud.msg.private");
|
||||
default -> "INVALID";
|
||||
};
|
||||
|
||||
currenttip.add(
|
||||
String.format("%s : \u00a7f%s\u00a7r [ %s ]", LangUtil.translateG("hud.msg.owner"), owner, access));
|
||||
@@ -69,7 +63,7 @@ public class HUDHandlerISecureTile implements IWailaDataProvider {
|
||||
int y, int z) {
|
||||
try {
|
||||
String owner = (String) ThermalExpansionModule.ISecureTile_getOwnerName.invoke(te);
|
||||
int access = ((Enum) ThermalExpansionModule.ISecureTile_getAccess.invoke(te)).ordinal();
|
||||
int access = ((Enum<?>) ThermalExpansionModule.ISecureTile_getAccess.invoke(te)).ordinal();
|
||||
|
||||
tag.setString("Owner", owner);
|
||||
tag.setInteger("Access", access);
|
||||
|
||||
@@ -2,12 +2,6 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -15,6 +9,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,17 +2,17 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
+61
-33
@@ -3,57 +3,55 @@ package mcp.mobius.waila.addons.thermalexpansion;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ThermalExpansionModule {
|
||||
|
||||
public static Class IEnergyProvider = null;
|
||||
public static Class<?> IEnergyProvider = null;
|
||||
public static Method IEnergyProvider_getMaxStorage = null;
|
||||
public static Method IEnergyProvider_getCurStorage = null;
|
||||
|
||||
public static Class IEnergyReceiver = null;
|
||||
public static Class<?> IEnergyReceiver = null;
|
||||
public static Method IEnergyReceiver_getMaxStorage = null;
|
||||
public static Method IEnergyReceiver_getCurStorage = null;
|
||||
|
||||
public static Class IEnergyInfo = null;
|
||||
public static Class<?> IEnergyInfo = null;
|
||||
public static Method IEnergyInfo_getMaxStorage = null;
|
||||
public static Method IEnergyInfo_getCurStorage = null;
|
||||
|
||||
public static Class TileEnergyCell = null;
|
||||
public static Class<?> TileEnergyCell = null;
|
||||
public static Field TileEnergyCell_Recv = null;
|
||||
public static Field TileEnergyCell_Send = null;
|
||||
|
||||
public static Class TileTank = null;
|
||||
public static Class<?> TileTank = null;
|
||||
public static Method TileTank_getTankFluid = null;
|
||||
public static Method TileTank_getTankCapacity = null;
|
||||
public static Method TileTank_getTankAmount = null;
|
||||
public static Field TileTank_mode = null;
|
||||
|
||||
public static Class TileTesseract = null;
|
||||
public static Class<?> TileTesseract = null;
|
||||
public static Field TileTesseract_Item = null;
|
||||
public static Field TileTesseract_Fluid = null;
|
||||
public static Field TileTesseract_Energy = null;
|
||||
|
||||
public static Class ISecureTile = null;
|
||||
public static Class<?> ISecureTile = null;
|
||||
public static Method ISecureTile_getAccess = null;
|
||||
public static Method ISecureTile_getOwnerName = null;
|
||||
|
||||
public static Class TileCache = null;
|
||||
public static Class<?> TileCache = null;
|
||||
public static Method TileCache_getItemStack = null;
|
||||
public static Method TileCache_getMaxStored = null;
|
||||
public static Method TileCache_getStored = null;
|
||||
|
||||
public static Class BlockMultipart = null;
|
||||
|
||||
public static Class IBlockInfo = null;
|
||||
public static Method IBlockInfo_getBlockInfo = null;
|
||||
|
||||
public static void register() {
|
||||
boolean printedThermalExpansionNotFound = false;
|
||||
// XXX : We register the Energy interface first
|
||||
try {
|
||||
IEnergyProvider = Class.forName("cofh.api.energy.IEnergyProvider");
|
||||
@@ -77,7 +75,12 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIEnergyHandler(), IEnergyInfo);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
printedThermalExpansionNotFound = true;
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the energy cell
|
||||
@@ -91,7 +94,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Tank interface
|
||||
@@ -110,7 +120,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTank(), TileTank);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Tesseract interface
|
||||
@@ -126,7 +143,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the ISecureTile interface
|
||||
@@ -138,11 +162,16 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerISecureTile(), ISecureTile);
|
||||
// ModuleRegistrar.instance().registerSyncedNBTKey("Owner", ISecureTile);
|
||||
// ModuleRegistrar.instance().registerSyncedNBTKey("Access", ISecureTile);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Cache interface
|
||||
@@ -158,19 +187,18 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerCache(), TileCache);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
}
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
|
||||
}
|
||||
|
||||
// XXX : We register the IBlockInfo interface
|
||||
/*
|
||||
* try{ IBlockInfo = Class.forName("cofh.api.block.IBlockInfo"); IBlockInfo_getBlockInfo =
|
||||
* IBlockInfo.getMethod("getBlockInfo", IBlockAccess.class, int.class, int.class, int.class,
|
||||
* ForgeDirection.class, EntityPlayer.class, List.class, boolean.class);
|
||||
* //ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
|
||||
* ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIBlockInfo(), IBlockInfo);
|
||||
* ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerIBlockInfo(), IBlockInfo); } catch (Exception
|
||||
* e){ Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading IBlockInfo hooks." + e); }
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -2,16 +2,16 @@ package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class TwilightForestGenericOverride implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class TwilightForestModule {
|
||||
|
||||
public static Class BlockTFRoots = null;
|
||||
public static Class BlockTFPlant = null;
|
||||
public static Class BlockTFSapling = null;
|
||||
public static Class<?> BlockTFRoots = null;
|
||||
public static Class<?> BlockTFPlant = null;
|
||||
public static Class<?> BlockTFSapling = null;
|
||||
|
||||
public static void register() {
|
||||
|
||||
try {
|
||||
Class TwilightForestMod = Class.forName("twilightforest.TwilightForestMod");
|
||||
Class.forName("twilightforest.TwilightForestMod");
|
||||
Waila.log.log(Level.INFO, "TwilightForestMod mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[TwilightForestMod] TwilightForestMod mod not found.");
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaBlockDecorator;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDDecoratorVanilla implements IWailaBlockDecorator {
|
||||
|
||||
@Override
|
||||
@@ -15,8 +15,6 @@ public class HUDDecoratorVanilla implements IWailaBlockDecorator {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// UIHelper.drawBillboardText(itemStack.getDisplayName(), accessor.getRenderingPosition(), 0.5F, 1.5F, 0.5F,
|
||||
// accessor.getPartialFrame());
|
||||
UIHelper.drawFloatingText("IN", accessor.getRenderingPosition(), 0.5F, 0.2F, -0.2F, 90F, 0F, 0F);
|
||||
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), -0.2F, 0.2F, 0.5F, 90F, 90F, 0F);
|
||||
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 1.2F, 0.2F, 0.5F, 90F, -90F, 0F);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.NumberFormat;
|
||||
import mcp.mobius.waila.api.ProbeMode;
|
||||
import mcp.mobius.waila.api.elements.IProbeDataProvider;
|
||||
import mcp.mobius.waila.api.elements.IProbeInfo;
|
||||
import mcp.mobius.waila.api.elements.ITextStyle;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
|
||||
/**
|
||||
* Example class for testing various elements
|
||||
*/
|
||||
public class HUDElementHandlerFurnace implements IProbeDataProvider {
|
||||
|
||||
@Override
|
||||
public void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo, IWailaDataAccessor data,
|
||||
IWailaConfigHandler config) {
|
||||
int cookTime = data.getNBTData().getShort("CookTime");
|
||||
if (cookTime != 0) {
|
||||
cookTime = Math.round(cookTime / 20.0f);
|
||||
|
||||
probeInfo.vertical().progress(
|
||||
cookTime,
|
||||
10,
|
||||
probeInfo.defaultProgressStyle().text("Smelting: " + cookTime + " / 10 s").filledColor(0xFF4CBB17)
|
||||
.alternateFilledColor(0xFF4CBB17).borderColor(0xFF555555)
|
||||
.numberFormat(NumberFormat.COMMAS));
|
||||
}
|
||||
|
||||
if (probeMode != ProbeMode.EXTENDED) {
|
||||
return;
|
||||
}
|
||||
|
||||
int burnTime = data.getNBTData().getInteger("BurnTime") / 20;
|
||||
if (burnTime > 0) {
|
||||
probeInfo.horizontal().text("Burn")
|
||||
.item(new ItemStack(Blocks.fire), probeInfo.defaultItemStyle().width(8).height(8))
|
||||
.text(": " + burnTime + " " + "Seconds Remaining");
|
||||
}
|
||||
|
||||
ItemStack[] items = new ItemStack[3];
|
||||
NBTTagList itemsTag = data.getNBTData().getTagList("Items", 10);
|
||||
|
||||
for (int i = 0; i < itemsTag.tagCount(); i++) {
|
||||
NBTTagCompound itemTag = itemsTag.getCompoundTagAt(i);
|
||||
byte slot = itemTag.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot < items.length) {
|
||||
items[slot] = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
}
|
||||
}
|
||||
|
||||
ITextStyle itemPaddedStyle = probeInfo.defaultTextStyle().vPadding(2);
|
||||
IProbeInfo itemSection = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xff00ffff));
|
||||
if (items[0] != null) {
|
||||
itemSection.horizontal().text("In: ", itemPaddedStyle)
|
||||
.item(items[0], probeInfo.defaultItemStyle().width(10).height(10)).text(
|
||||
" " + DisplayUtil.itemDisplayNameShort(items[0]) + " x" + items[0].stackSize,
|
||||
itemPaddedStyle);
|
||||
}
|
||||
|
||||
if (items[2] != null) {
|
||||
itemSection.horizontal().text("Out: ", itemPaddedStyle)
|
||||
.item(items[2], probeInfo.defaultItemStyle().width(10).height(10)).text(
|
||||
" " + DisplayUtil.itemDisplayNameShort(items[2]) + " x" + items[2].stackSize,
|
||||
itemPaddedStyle);
|
||||
}
|
||||
|
||||
if (items[1] != null) {
|
||||
itemSection.horizontal().text("Fuel: ", itemPaddedStyle)
|
||||
.item(items[1], probeInfo.defaultItemStyle().width(10).height(10)).text(
|
||||
" " + DisplayUtil.itemDisplayNameShort(items[1]) + " x" + items[1].stackSize,
|
||||
itemPaddedStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,6 @@ package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -15,6 +10,10 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
|
||||
public class HUDHandlerFurnace implements IWailaDataProvider {
|
||||
|
||||
@@ -88,8 +87,5 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
// ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
|
||||
// ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
|
||||
}
|
||||
public static void register() {}
|
||||
}
|
||||
@@ -2,15 +2,10 @@ package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRedstoneOre;
|
||||
import net.minecraft.block.BlockStoneSlab;
|
||||
import net.minecraft.block.BlockWoodSlab;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -20,6 +15,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
|
||||
static Block mobSpawner = Blocks.mob_spawner;
|
||||
@@ -44,6 +46,8 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
static Block log = Blocks.log;
|
||||
static Block log2 = Blocks.log2;
|
||||
static Block quartz = Blocks.quartz_block;
|
||||
static Block anvil = Blocks.anvil;
|
||||
static Block sapling = Blocks.sapling;
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -51,16 +55,12 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
|
||||
if (block == silverfish && config.getConfig("vanilla.silverfish")) {
|
||||
int metadata = accessor.getMetadata();
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new ItemStack(Blocks.stone);
|
||||
case 1:
|
||||
return new ItemStack(Blocks.cobblestone);
|
||||
case 2:
|
||||
return new ItemStack(Blocks.brick_block);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return switch (metadata) {
|
||||
case 0 -> new ItemStack(Blocks.stone);
|
||||
case 1 -> new ItemStack(Blocks.cobblestone);
|
||||
case 2 -> new ItemStack(Blocks.brick_block);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
if (block == redstone) {
|
||||
@@ -96,6 +96,18 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
return new ItemStack(block, 1, 2);
|
||||
}
|
||||
|
||||
if (block == anvil) {
|
||||
return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata()));
|
||||
}
|
||||
|
||||
if (block == sapling) {
|
||||
return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata()));
|
||||
}
|
||||
|
||||
if (block instanceof BlockStoneSlab || block instanceof BlockWoodSlab) {
|
||||
return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata()));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -190,9 +202,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
if (config.getConfig("vanilla.comparator")) if ((block == comparatorIdl) || (block == comparatorAct)) {
|
||||
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? LangUtil.translateG("hud.msg.comparator")
|
||||
: LangUtil.translateG("hud.msg.substractor");
|
||||
// int outputSignal = ((TileEntityComparator)entity).func_96100_a();
|
||||
currenttip.add("Mode : " + mode);
|
||||
// currenttip.add(String.format("Out : %s", outputSignal));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@@ -201,13 +211,6 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
/*
|
||||
* if (config.getConfig("vanilla.jukebox")) if (block == jukebox){ NBTTagCompound tag = accessor.getNBTData();
|
||||
* Item record = null; if (tag.hasKey("Record")){ record = Item.itemsList[accessor.getNBTInteger(tag,
|
||||
* "Record")]; currenttip.add(((ItemRecord)record).getRecordTitle()); } else {
|
||||
* currenttip.add(LangUtil.translateG("hud.msg.empty")); } }
|
||||
*/
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@@ -232,6 +235,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.redstone");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.silverfish");
|
||||
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
|
||||
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.show_invisible_players");
|
||||
|
||||
IWailaDataProvider provider = new HUDHandlerVanilla();
|
||||
|
||||
@@ -245,8 +249,11 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, log.getClass());
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, log2.getClass());
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, quartz.getClass());
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, anvil.getClass());
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, sapling.getClass());
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, BlockStoneSlab.class);
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, BlockWoodSlab.class);
|
||||
|
||||
// ModuleRegistrar.instance().registerStackProvider(provider, Block.class);
|
||||
ModuleRegistrar.instance().registerHeadProvider(provider, mobSpawner.getClass());
|
||||
ModuleRegistrar.instance().registerHeadProvider(provider, melonStem.getClass());
|
||||
ModuleRegistrar.instance().registerHeadProvider(provider, pumpkinStem.getClass());
|
||||
@@ -254,8 +261,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, crops.getClass());
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, melonStem.getClass());
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, pumpkinStem.getClass());
|
||||
// ModuleRegistrar.instance().registerBodyProvider(provider, carrot.getClass());
|
||||
// ModuleRegistrar.instance().registerBodyProvider(provider, potato.getClass());
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, lever.getClass());
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, repeaterIdle.getClass());
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, repeaterActv.getClass());
|
||||
@@ -283,10 +289,6 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
ModuleRegistrar.instance().registerNBTProvider(provider, cocoa.getClass());
|
||||
ModuleRegistrar.instance().registerNBTProvider(provider, netherwart.getClass());
|
||||
ModuleRegistrar.instance().registerNBTProvider(provider, silverfish.getClass());
|
||||
|
||||
// ModuleRegistrar.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
|
||||
|
||||
// ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorVanilla(), repeaterIdle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import mcp.mobius.waila.api.elements.IProbeRegistrar;
|
||||
|
||||
// example class for registering IMC
|
||||
public class TestRegistrar {
|
||||
|
||||
public static void callbackRegister(IProbeRegistrar register) {
|
||||
register.registerProbeProvider(new HUDElementHandlerFurnace(), BlockFurnace.class);
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
FMLInterModComms.sendMessage("Waila", "elementregister", TestRegistrar.class.getName() + ".callbackRegister");
|
||||
}
|
||||
}
|
||||
@@ -6,25 +6,25 @@ import java.util.Set;
|
||||
|
||||
public interface ITaggedList<E, T> extends List<E> {
|
||||
|
||||
public boolean add(E e, T tag);
|
||||
boolean add(E e, T tag);
|
||||
|
||||
public boolean add(E e, Collection<? extends T> taglst);
|
||||
boolean add(E e, Collection<? extends T> taglst);
|
||||
|
||||
public Set<T> getTags(E e);
|
||||
Set<T> getTags(E e);
|
||||
|
||||
public Set<T> getTags(int index);
|
||||
Set<T> getTags(int index);
|
||||
|
||||
public void addTag(E e, T tag);
|
||||
void addTag(E e, T tag);
|
||||
|
||||
public void addTag(int index, T tag);
|
||||
void addTag(int index, T tag);
|
||||
|
||||
public void removeTag(E e, T tag);
|
||||
void removeTag(E e, T tag);
|
||||
|
||||
public void removeTag(int index, T tag);
|
||||
void removeTag(int index, T tag);
|
||||
|
||||
public Set<E> getEntries(T tag);
|
||||
Set<E> getEntries(T tag);
|
||||
|
||||
public void removeEntries(T tag);
|
||||
void removeEntries(T tag);
|
||||
|
||||
public String getTagsAsString(E e);
|
||||
String getTagsAsString(E e);
|
||||
}
|
||||
@@ -15,18 +15,15 @@ public interface IWailaConfigHandler {
|
||||
|
||||
/**
|
||||
* Returns a set of all the currently loaded modules in the config handler.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Set<String> getModuleNames();
|
||||
Set<String> getModuleNames();
|
||||
|
||||
/**
|
||||
* Returns all the currently available options for a given module
|
||||
*
|
||||
* @param modName Module name
|
||||
* @return
|
||||
*/
|
||||
public HashMap<String, String> getConfigKeys(String modName);
|
||||
HashMap<String, String> getConfigKeys(String modName);
|
||||
|
||||
/**
|
||||
* Returns the current value of an option (true/false) with a default value if not set.
|
||||
@@ -35,7 +32,7 @@ public interface IWailaConfigHandler {
|
||||
* @param defvalue Default values
|
||||
* @return Value of the option or defvalue if not set.
|
||||
*/
|
||||
public boolean getConfig(String key, boolean defvalue);
|
||||
boolean getConfig(String key, boolean defvalue);
|
||||
|
||||
/**
|
||||
* Returns the current value of an option (true/false) with a default value true if not set
|
||||
@@ -43,5 +40,5 @@ public interface IWailaConfigHandler {
|
||||
* @param key Option to lookup
|
||||
* @return Value of the option or true if not set.
|
||||
*/
|
||||
public boolean getConfig(String key);
|
||||
boolean getConfig(String key);
|
||||
}
|
||||
@@ -49,4 +49,6 @@ public interface IWailaDataAccessor {
|
||||
ForgeDirection getSide();
|
||||
|
||||
ItemStack getStack();
|
||||
|
||||
float getBlockBreakDamage();
|
||||
}
|
||||
@@ -23,58 +23,58 @@ package mcp.mobius.waila.api;
|
||||
public interface IWailaRegistrar {
|
||||
|
||||
/* Add a config option in the section modname with displayed text configtext and access key keyname */
|
||||
public void addConfig(String modname, String keyname, String configtext);
|
||||
void addConfig(String modname, String keyname, String configtext);
|
||||
|
||||
public void addConfig(String modname, String keyname, String configtext, boolean defvalue);
|
||||
void addConfig(String modname, String keyname, String configtext, boolean defvalue);
|
||||
|
||||
public void addConfigRemote(String modname, String keyname, String configtext);
|
||||
void addConfigRemote(String modname, String keyname, String configtext);
|
||||
|
||||
public void addConfigRemote(String modname, String keyname, String configtext, boolean defvalue);
|
||||
void addConfigRemote(String modname, String keyname, String configtext, boolean defvalue);
|
||||
|
||||
public void addConfig(String modname, String keyname);
|
||||
void addConfig(String modname, String keyname);
|
||||
|
||||
public void addConfig(String modname, String keyname, boolean defvalue);
|
||||
void addConfig(String modname, String keyname, boolean defvalue);
|
||||
|
||||
public void addConfigRemote(String modname, String keyname);
|
||||
void addConfigRemote(String modname, String keyname);
|
||||
|
||||
public void addConfigRemote(String modname, String keyname, boolean defvalue);
|
||||
void addConfigRemote(String modname, String keyname, boolean defvalue);
|
||||
|
||||
/* Register a stack overrider for the given blockID */
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, Class block);
|
||||
void registerStackProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Same thing, but works on a class hierarchy instead */
|
||||
public void registerHeadProvider(IWailaDataProvider dataProvider, Class block);
|
||||
void registerHeadProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
public void registerBodyProvider(IWailaDataProvider dataProvider, Class block);
|
||||
void registerBodyProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
public void registerTailProvider(IWailaDataProvider dataProvider, Class block);
|
||||
void registerTailProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */
|
||||
public void registerNBTProvider(IWailaDataProvider dataProvider, Class block);
|
||||
void registerNBTProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Entity text registration methods */
|
||||
public void registerHeadProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
void registerHeadProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
public void registerBodyProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
void registerBodyProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
public void registerTailProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
void registerTailProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
public void registerOverrideEntityProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
void registerOverrideEntityProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
/* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */
|
||||
public void registerNBTProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
void registerNBTProvider(IWailaEntityProvider dataProvider, Class entity);
|
||||
|
||||
/* FMP Providers */
|
||||
public void registerHeadProvider(IWailaFMPProvider dataProvider, String name);
|
||||
void registerHeadProvider(IWailaFMPProvider dataProvider, String name);
|
||||
|
||||
public void registerBodyProvider(IWailaFMPProvider dataProvider, String name);
|
||||
void registerBodyProvider(IWailaFMPProvider dataProvider, String name);
|
||||
|
||||
public void registerTailProvider(IWailaFMPProvider dataProvider, String name);
|
||||
void registerTailProvider(IWailaFMPProvider dataProvider, String name);
|
||||
|
||||
/* The block decorators */
|
||||
public void registerDecorator(IWailaBlockDecorator decorator, Class block);
|
||||
void registerDecorator(IWailaBlockDecorator decorator, Class block);
|
||||
|
||||
public void registerDecorator(IWailaFMPDecorator decorator, String name);
|
||||
void registerDecorator(IWailaFMPDecorator decorator, String name);
|
||||
|
||||
/*
|
||||
* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent).
|
||||
@@ -83,11 +83,7 @@ public interface IWailaRegistrar {
|
||||
* is deprecated in favor to registerNBTProvider. It will be removed in MC 1.8 !!!
|
||||
*/
|
||||
@Deprecated
|
||||
public void registerSyncedNBTKey(String key, Class target);
|
||||
void registerSyncedNBTKey(String key, Class target);
|
||||
|
||||
public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer);
|
||||
|
||||
/* UNUSED FOR NOW (Will be used for the ingame wiki */
|
||||
// public void registerDocTextFile (String filename);
|
||||
// public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
|
||||
void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer);
|
||||
}
|
||||
@@ -5,18 +5,8 @@ import java.util.LinkedHashMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWailaSummaryProvider {
|
||||
|
||||
/* This interface is used to control the display data in the description screen */
|
||||
|
||||
/* BASIC TOOLS & ITEMS DATA */
|
||||
// EnumToolMaterial getMaterial(ItemStack stack);
|
||||
// String getMaterialName(ItemStack stack);
|
||||
// String getEffectiveBlock(ItemStack stack);
|
||||
// int getHarvestLevel(ItemStack stack);
|
||||
// float getEfficiencyOnProperMaterial(ItemStack stack);
|
||||
// int getEnchantability(ItemStack stack);
|
||||
// int getDamageVsEntity(ItemStack stack);
|
||||
// int getDurability(ItemStack stack);
|
||||
|
||||
LinkedHashMap<String, String> getSummary(ItemStack stack, LinkedHashMap<String, String> currentSummary,
|
||||
IWailaConfigHandler config);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.*;
|
||||
|
||||
public interface IWailaTooltipRenderer {
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
public enum NumberFormat {
|
||||
|
||||
FULL,
|
||||
COMPACT,
|
||||
COMMAS,
|
||||
NONE;
|
||||
|
||||
private NumberFormat() {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
public enum ProbeMode {
|
||||
NORMAL, // Normal display. What a user expects to see
|
||||
EXTENDED, // Extended. This is used when the player is sneaking
|
||||
DEBUG // Creative only. This is used when the player holds a creative probe
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.RENDER;
|
||||
import static mcp.mobius.waila.api.SpecialChars.WailaStyle;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SpecialChars {
|
||||
@@ -70,17 +67,13 @@ public class SpecialChars {
|
||||
/**
|
||||
* Helper method to get a proper RENDER string. Just put the name of the renderer and the params in, and it will
|
||||
* give back a directly usable String for the tooltip.
|
||||
*
|
||||
* @param name
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public static String getRenderString(String name, String... params) {
|
||||
String result = RENDER + "{" + name;
|
||||
StringBuilder result = new StringBuilder(RENDER + "{" + name);
|
||||
for (String s : params) {
|
||||
result += "," + s;
|
||||
result.append(",").append(s);
|
||||
}
|
||||
result += "}";
|
||||
return result;
|
||||
result.append("}");
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package mcp.mobius.waila.api.elements;
|
||||
|
||||
public enum ElementAlignment {
|
||||
ALIGN_TOPLEFT,
|
||||
ALIGN_CENTER,
|
||||
ALIGN_BOTTOMRIGHT
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package mcp.mobius.waila.api.elements;
|
||||
|
||||
public interface IElement {
|
||||
|
||||
void render(int var1, int var2);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
}
|
||||
Loaded 100 of 240 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user