mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-14 17:14:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5669e3000 | ||
|
|
f998f9ebfe | ||
|
|
6d0f162453 | ||
|
|
9e3ef39e30 | ||
|
|
452fbfa47c | ||
|
|
d8477007c9 | ||
|
|
bd5905dfc0 | ||
|
|
80e761d83f | ||
|
|
ef0f8b5329 | ||
|
|
65e4a773d0 | ||
|
|
30717912fb | ||
|
|
1421b83a5b | ||
|
|
2de1ec4235 | ||
|
|
91f8019410 | ||
|
|
59157ec1e3 | ||
|
|
b612897ddb | ||
|
|
a5607eda00 | ||
|
|
f242cf77a9 | ||
|
|
9d1840dabc | ||
|
|
677a74dad7 | ||
|
|
10219fd204 | ||
|
|
d14044c92e | ||
|
|
5c115d9af3 | ||
|
|
c0a119902a | ||
|
|
93485e1525 | ||
|
|
ceb94e3e2c | ||
|
|
8ea26bf073 | ||
|
|
2aabfdb64c | ||
|
|
a34460c159 | ||
|
|
1f3fd64a38 | ||
|
|
191a916896 | ||
|
|
ee1ed27a3a | ||
|
|
07b9d1bf92 | ||
|
|
e82729a113 | ||
|
|
c938ccf542 | ||
|
|
c2e8b44f2b | ||
|
|
c4e3537957 | ||
|
|
9bc1e79f64 | ||
|
|
bdebd737d6 | ||
|
|
9f04d3d029 | ||
|
|
ef3c4a9774 | ||
|
|
3b64d21335 | ||
|
|
72c91a3700 | ||
|
|
bf6d309038 | ||
|
|
5bb7f7221a | ||
|
|
6278e4d575 | ||
|
|
7a46d914db | ||
|
|
d30d8ba100 | ||
|
|
490a176446 | ||
|
|
453a8f50a7 | ||
|
|
d946500c0d | ||
|
|
487829a16e | ||
|
|
f153502858 | ||
|
|
095ea9e3c4 | ||
|
|
c6d48b32f7 | ||
|
|
4fb3d1edaa | ||
|
|
678bb6dd44 | ||
|
|
5333808d65 | ||
|
|
4750486375 | ||
|
|
0f9710a9f9 | ||
|
|
0c0ac4fcfa | ||
|
|
a189446cac | ||
|
|
6279ef2b09 | ||
|
|
6cf6dafb53 | ||
|
|
2f738bc728 | ||
|
|
8329a4f186 | ||
|
|
e5ab6193a5 | ||
|
|
18560992cd | ||
|
|
a767b0f922 | ||
|
|
61f8fbe1ce | ||
|
|
a8a49f2b6e | ||
|
|
bf7cc86247 | ||
|
|
d6650f6cc4 | ||
|
|
bc46b8840d | ||
|
|
7d72e0680e |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -27,3 +27,5 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
layout.json
|
||||
.DS_Store
|
||||
@@ -0,0 +1,13 @@
|
||||
# Waila
|
||||
|
||||
## Contribution
|
||||
|
||||
When forking this repository, make sure to uncheck the `Copy the master branch only` option.
|
||||
This will copy all tags to your fork, so the build system can detect the latest mod version.
|
||||
If you leave it checked, you won't be able to enter the world in a local client run because Waila [will think the mod is outdated](https://github.com/GTNewHorizons/waila/blob/master/src/main/java/mcp/mobius/waila/Waila.java#L133).
|
||||
|
||||
If you already forked the repository without tags, you can fetch them manually:
|
||||
```
|
||||
git remote add upstream https://github.com/GTNewHorizons/waila
|
||||
git fetch upstream --tags
|
||||
```
|
||||
+2
-1620
File diff suppressed because it is too large.
Load diff
+18
-1
@@ -1,7 +1,24 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev')
|
||||
|
||||
shadowImplementation('au.com.bytecode:opencsv:2.4')
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.463:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'waila'
|
||||
}
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.12:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:BuildCraft:7.1.57:dev")
|
||||
runtimeOnlyNonPublishable(deobfCurse("cofh-lib-220333:2388748"))
|
||||
runtimeOnlyNonPublishable(deobfCurse("extrautils-225561:2264383"))
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:OpenBlocks:1.12.12-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.17.26:dev")
|
||||
runtimeOnlyNonPublishable(deobfCurse('thermal-foundation-222880:2388753'))
|
||||
runtimeOnlyNonPublishable(deobfCurse('thermal-expansion-69163:2388759'))
|
||||
runtimeOnlyNonPublishable(deobfCurse('thermal-dynamics-227443:2388756'))
|
||||
implementation(deobfCurse('cofh-core-69162:2388751'))
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.37:dev")
|
||||
}
|
||||
+200
-25
@@ -1,63 +1,238 @@
|
||||
# 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.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
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 modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# 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
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile =
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# 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!
|
||||
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this 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
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
|
||||
# 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 CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# 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: UniMixins 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 customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# 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
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainVersion=25
|
||||
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-8.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,10 +85,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 -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -133,10 +132,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 +146,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 +154,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
|
||||
@@ -169,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -197,16 +198,19 @@ 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, 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" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+13
-12
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,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,22 +59,21 @@ 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
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+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 '2.0.24'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
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.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;
|
||||
@@ -23,6 +19,9 @@ 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.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.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
@@ -39,15 +38,10 @@ import mcp.mobius.waila.utils.ModIdentification;
|
||||
@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)
|
||||
*/
|
||||
|
||||
acceptableRemoteVersions = "*",
|
||||
guiFactory = "mcp.mobius.waila.client.WailaGuiFactory")
|
||||
public class Waila {
|
||||
|
||||
// The instance of your mod that Forge uses.
|
||||
@@ -58,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
|
||||
@@ -70,18 +65,10 @@ public class Waila {
|
||||
|
||||
@EventHandler
|
||||
public void initialize(FMLInitializationEvent event) {
|
||||
try {
|
||||
Field eBus = FMLModContainer.class.getDeclaredField("eventBus");
|
||||
eBus.setAccessible(true);
|
||||
EventBus FMLbus = (EventBus) eBus.get(FMLCommonHandler.instance().findContainerFor(this));
|
||||
FMLbus.register(this);
|
||||
} catch (Throwable t) {}
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
|
||||
FMLCommonHandler.instance().bus().register(new KeyEvent());
|
||||
FMLCommonHandler.instance().bus().register(WailaTickHandler.instance());
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new WailaTickHandler());
|
||||
}
|
||||
FMLCommonHandler.instance().bus().register(new NetworkHandler());
|
||||
}
|
||||
@@ -90,29 +77,12 @@ public class Waila {
|
||||
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); } }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@EventHandler
|
||||
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
|
||||
@@ -153,4 +123,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;
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -8,35 +8,34 @@ import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
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() {
|
||||
if (LoadedMods.WAILA_PLUGINS) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
TileTank = Class.forName("buildcraft.factory.TileTank");
|
||||
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
|
||||
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
|
||||
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);
|
||||
Waila.log.log(Level.INFO, "Buildcraft mod found.");
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Waila.log.log(Level.INFO, "[BC] Buildcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
|
||||
|
||||
TankFluidHandler tankFluidHandler = new TankFluidHandler();
|
||||
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileTank);
|
||||
}
|
||||
|
||||
}
|
||||
+22
-13
@@ -1,5 +1,8 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -20,7 +23,7 @@ import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
public class TankFluidHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -30,28 +33,36 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
|
||||
if (!ConfigHandler.instance().getConfig("bc.tanktype")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
FluidTankInfo tank = this.getTank(accessor);
|
||||
FluidStack stack = tank != null ? tank.fluid : null;
|
||||
|
||||
String name = currenttip.get(0);
|
||||
if (stack != null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " (" + stack.getFluid().getName() + ")";
|
||||
else if (stack == null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " " + LangUtil.translateG("hud.msg.empty");
|
||||
currenttip.set(0, name);
|
||||
String fluidName = stack == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: stack.getFluid().getLocalizedName(stack);
|
||||
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
|
||||
if (!ConfigHandler.instance().getConfig("bc.tankamount")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
FluidTankInfo tank = this.getTank(accessor);
|
||||
FluidStack stack = tank != null ? tank.fluid : null;
|
||||
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");
|
||||
currenttip.add(String.format("%s / %s", formatNumber(liquidAmount), formatFluid(capacity)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -63,14 +74,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() {}
|
||||
|
||||
}
|
||||
@@ -16,15 +16,6 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
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;
|
||||
|
||||
public class EnderIOModule {
|
||||
|
||||
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 void register() {
|
||||
try {
|
||||
Class ModClass = 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.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
TileCapacitorBank = Class.forName("crazypants.enderio.machine.power.TileCapacitorBank");
|
||||
TCB_getEnergyStored = TileCapacitorBank.getMethod("getEnergyStored");
|
||||
TCB_getMaxInput = TileCapacitorBank.getMethod("getMaxInput");
|
||||
TCB_getMaxOutput = TileCapacitorBank.getMethod("getMaxOutput");
|
||||
TCB_getMaxEnergyStored = TileCapacitorBank.getMethod("getMaxEnergyStored");
|
||||
TCB_getMaxIO = TileCapacitorBank.getMethod("getMaxIO");
|
||||
|
||||
TileTesseract = Class.forName("crazypants.enderio.machine.hypercube.TileHyperCube");
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
} 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;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.inout");
|
||||
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.storage");
|
||||
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.owner");
|
||||
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.channel");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.RESET;
|
||||
import static mcp.mobius.waila.api.SpecialChars.TAB;
|
||||
import static mcp.mobius.waila.api.SpecialChars.WHITE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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
|
||||
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 (accessor.getPlayer().isSneaking()) {
|
||||
try {
|
||||
|
||||
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
|
||||
String inputStr = LangUtil.translateG("hud.msg.input");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
if (config.getConfig("enderio.storage")) {
|
||||
Integer maxEnergyStored = (Integer) EnderIOModule.TCB_getMaxEnergyStored
|
||||
.invoke(accessor.getTileEntity());
|
||||
Double energyStored = (Double) EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s%.1f%s / %s%d%s RF",
|
||||
WHITE,
|
||||
energyStored * 10,
|
||||
RESET,
|
||||
WHITE,
|
||||
maxEnergyStored * 10,
|
||||
RESET));
|
||||
}
|
||||
|
||||
if (config.getConfig("enderio.inout")) {
|
||||
Integer maxIO = (Integer) EnderIOModule.TCB_getMaxIO.invoke(accessor.getTileEntity());
|
||||
Integer maxInput = (Integer) EnderIOModule.TCB_getMaxInput.invoke(accessor.getTileEntity());
|
||||
Integer maxOutput = (Integer) EnderIOModule.TCB_getMaxOutput.invoke(accessor.getTileEntity());
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s%d%sRF/t ",
|
||||
maxIOStr,
|
||||
TAB + ALIGNRIGHT + WHITE,
|
||||
maxIO * 10,
|
||||
TAB + ALIGNRIGHT));
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s%d%sRF/t ",
|
||||
inputStr,
|
||||
TAB + ALIGNRIGHT + WHITE,
|
||||
maxInput * 10,
|
||||
TAB + ALIGNRIGHT));
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s%d%sRF/t ",
|
||||
outputStr,
|
||||
TAB + ALIGNRIGHT + WHITE,
|
||||
maxOutput * 10,
|
||||
TAB + ALIGNRIGHT));
|
||||
}
|
||||
|
||||
} 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(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.RESET;
|
||||
import static mcp.mobius.waila.api.SpecialChars.TAB;
|
||||
import static mcp.mobius.waila.api.SpecialChars.WHITE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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
|
||||
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 (accessor.getPlayer().isSneaking()) {
|
||||
|
||||
String channel = "%s : %s%s%s %s";
|
||||
String freq;
|
||||
String frequser;
|
||||
String owner;
|
||||
|
||||
if (config.getConfig("enderio.channel")) {
|
||||
|
||||
if (accessor.getNBTData().hasKey("channelName")) {
|
||||
freq = accessor.getNBTData().getString("channelName");
|
||||
|
||||
if (accessor.getNBTData().hasKey("channelUser"))
|
||||
frequser = "[ " + WHITE + accessor.getNBTData().getString("channelUser") + RESET + " ]";
|
||||
else frequser = "[ " + WHITE + LangUtil.translateG("hud.msg.public") + RESET + " ]";
|
||||
|
||||
} else {
|
||||
freq = LangUtil.translateG("hud.msg.none");
|
||||
frequser = "";
|
||||
}
|
||||
|
||||
currenttip.add(
|
||||
String.format(
|
||||
channel,
|
||||
LangUtil.translateG("hud.msg.frequency"),
|
||||
TAB + WHITE,
|
||||
freq,
|
||||
RESET,
|
||||
frequser));
|
||||
}
|
||||
|
||||
if (config.getConfig("enderio.owner")) {
|
||||
if (accessor.getNBTData().hasKey("owner")) currenttip.add(
|
||||
String.format(
|
||||
"%s : %s%s",
|
||||
LangUtil.translateG("hud.msg.owner"),
|
||||
TAB + WHITE,
|
||||
accessor.getNBTData().getString("owner")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,17 +10,17 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -9,18 +9,14 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-8
@@ -1,5 +1,8 @@
|
||||
package mcp.mobius.waila.addons.exu;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -15,7 +18,7 @@ import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerDrum implements IWailaDataProvider {
|
||||
public class DrumFluidHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -34,18 +37,14 @@ public class HUDHandlerDrum implements IWailaDataProvider {
|
||||
|
||||
if (!config.getConfig("extrautilities.fluidamount")) return currenttip;
|
||||
|
||||
int amount = 0;
|
||||
|
||||
NBTTagCompound subtag = accessor.getNBTData().getCompoundTag("tank");
|
||||
if (subtag.hasKey("Amount")) amount = accessor.getNBTInteger(subtag, "Amount");
|
||||
|
||||
IFluidHandler handler = (IFluidHandler) accessor.getTileEntity();
|
||||
if (handler == null) return currenttip;
|
||||
|
||||
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (tanks.length != 1) return currenttip;
|
||||
|
||||
currenttip.add(String.format("%d / %d mB", amount, tanks[0].capacity));
|
||||
int amount = tanks[0].fluid == null ? 0 : tanks[0].fluid.amount;
|
||||
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tanks[0].capacity)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -59,7 +58,6 @@ public class HUDHandlerDrum implements IWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -4,31 +4,26 @@ import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class ExtraUtilitiesModule {
|
||||
|
||||
public static Class ModExtraUtilities = null;
|
||||
public static Class TileEntityDrum = null;
|
||||
public static Class<?> TileEntityDrum = null;
|
||||
|
||||
public static void register() {
|
||||
if (LoadedMods.WAILA_PLUGINS) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Class ModExtraUtilities = Class.forName("com.rwtema.extrautils.ExtraUtils");
|
||||
TileEntityDrum = Class.forName("com.rwtema.extrautils.tileentity.TileEntityDrum");
|
||||
Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
TileEntityDrum = Class.forName("com.rwtema.extrautils.tileentity.TileEntityDrum");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[ExtraUtilities] Class not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("ExtraUtilities", "extrautilities.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerDrum(), TileEntityDrum);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerDrum(), TileEntityDrum);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new DrumFluidHandler(), TileEntityDrum);
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -7,11 +7,11 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -82,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);
|
||||
|
||||
@@ -9,27 +9,27 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,11 +7,11 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -4,31 +4,29 @@ import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class OpenBlocksModule {
|
||||
|
||||
public static Class ModOpenBlocks = null;
|
||||
public static Class TileEntityTank = null;
|
||||
public static Class<?> TileEntityTank = null;
|
||||
|
||||
public static void register() {
|
||||
if (LoadedMods.WAILA_PLUGINS) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Class ModOpenBlocks = Class.forName("openblocks.OpenBlocks");
|
||||
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
|
||||
Waila.log.log(Level.INFO, "OpenBlocks mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[OpenBlocks] Class not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("OpenBlocks", "openblocks.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileEntityTank);
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileEntityTank);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTank(), TileEntityTank);
|
||||
|
||||
TankFluidHandler tankFluidHandler = new TankFluidHandler();
|
||||
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileEntityTank);
|
||||
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileEntityTank);
|
||||
}
|
||||
}
|
||||
+9
-12
@@ -1,5 +1,8 @@
|
||||
package mcp.mobius.waila.addons.openblocks;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -17,7 +20,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
public class TankFluidHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -37,14 +40,10 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
FluidStack fluid = tanks[0].fluid;
|
||||
String name = currenttip.get(0);
|
||||
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: fluid.getFluid().getLocalizedName(fluid);
|
||||
|
||||
try {
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
|
||||
} catch (NullPointerException f) {
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -60,9 +59,8 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (tanks.length != 1) return currenttip;
|
||||
|
||||
if (tanks[0].fluid != null)
|
||||
currenttip.add(String.format("%d / %d mB", tanks[0].fluid.amount, tanks[0].capacity));
|
||||
else currenttip.add(String.format("0 / %d mB", tanks[0].capacity));
|
||||
int amount = tanks[0].fluid == null ? 0 : tanks[0].fluid.amount;
|
||||
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tanks[0].capacity)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -76,7 +74,6 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,59 @@
|
||||
package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
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 mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class RailcraftModule {
|
||||
|
||||
public static Class TileTankBase = null;
|
||||
public static Class ITankTile = null;
|
||||
public static Method ITankTile_getTank = null;
|
||||
// public static Class StandardTank = null;
|
||||
public static Class<?> TileTankBase = null;
|
||||
public static Method TileTankBase_getTank = null;
|
||||
|
||||
public static Class<?> StandardTank = null;
|
||||
public static Field StandardTank_capacity = null;
|
||||
public static Field StandardTank_renderData = null;
|
||||
|
||||
public static Field StandardTank_renderDataFluid = null;
|
||||
public static Field StandardTank_renderDataAmount = null;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
Class ModRailcraft = 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.");
|
||||
if (LoadedMods.WAILA_PLUGINS) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
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");
|
||||
TileTankBase_getTank = TileTankBase.getMethod("getTank");
|
||||
|
||||
StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
|
||||
StandardTank_capacity = StandardTank.getSuperclass().getDeclaredField("capacity");
|
||||
StandardTank_capacity.setAccessible(true);
|
||||
StandardTank_renderData = StandardTank.getField("renderData");
|
||||
|
||||
StandardTank_renderDataFluid = StandardTank_renderData.getType().getField("fluid");
|
||||
StandardTank_renderDataAmount = StandardTank_renderData.getType().getField("amount");
|
||||
|
||||
Waila.log.log(Level.INFO, "Railcraft mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Railcraft] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e) {
|
||||
Waila.log.log(Level.WARN, "[Railcraft] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e) {
|
||||
Waila.log.log(Level.WARN, "[Railcraft] Field not found." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Railcraft", "railcraft.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileTankBase);
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileTankBase);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTank(), TileTankBase);
|
||||
|
||||
TankFluidHandler tankFluidHandler = new TankFluidHandler();
|
||||
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileTankBase);
|
||||
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileTankBase);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
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 TankFluidHandler 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) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
|
||||
IFluidTank tank = this.getTank(accessor.getTileEntity());
|
||||
if (tank == null) return currenttip;
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
String name = currenttip.get(0);
|
||||
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: fluid.getFluid().getLocalizedName(fluid);
|
||||
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
|
||||
IFluidTank tank = this.getTank(accessor.getTileEntity());
|
||||
if (tank == null) return currenttip;
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
int amount = fluid == null ? 0 : fluid.amount;
|
||||
|
||||
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tank.getCapacity())));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
private FluidTank getTank(TileEntity tileEntity) {
|
||||
if (tileEntity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Object tank = RailcraftModule.TileTankBase_getTank.invoke(tileEntity);
|
||||
|
||||
int capacity = RailcraftModule.StandardTank_capacity.getInt(tank);
|
||||
Object renderData = RailcraftModule.StandardTank_renderData.get(tank);
|
||||
|
||||
Fluid fluid = (Fluid) RailcraftModule.StandardTank_renderDataFluid.get(renderData);
|
||||
int amount = RailcraftModule.StandardTank_renderDataAmount.getInt(renderData);
|
||||
|
||||
return new FluidTank(fluid, amount, capacity);
|
||||
} catch (Exception e) {
|
||||
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,15 +16,6 @@ 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() {}
|
||||
|
||||
}
|
||||
@@ -29,7 +29,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,
|
||||
@@ -38,7 +38,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 {
|
||||
@@ -50,12 +50,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mcp.mobius.waila.addons.stevescarts;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.GRAY;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
|
||||
@@ -22,8 +23,8 @@ 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) {
|
||||
@@ -73,15 +74,15 @@ 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));
|
||||
: formatNumber(this.getAmount(amount)) + " " + this.getAmountType(amount);
|
||||
|
||||
String selection = (String) StevesCartsModule.GetSelectionName
|
||||
.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
|
||||
@@ -112,40 +113,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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mcp.mobius.waila.addons.stevescarts;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.GRAY;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
|
||||
@@ -20,8 +21,8 @@ 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) {
|
||||
@@ -67,9 +68,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;
|
||||
@@ -78,16 +78,15 @@ public class HUDLiquidManager implements IWailaDataProvider {
|
||||
fluidAmount = tag.getCompoundTag("Fluid" + i).getInteger("Amount");
|
||||
}
|
||||
|
||||
String fluidString = fluidAmount == 0 ? "<Empty>" : String.format("%s mB of %s", fluidAmount, fluidName);
|
||||
String fluidString = fluidAmount == 0 ? "<Empty>"
|
||||
: String.format("%s of %s", formatFluid(fluidAmount), fluidName);
|
||||
|
||||
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.getMaxAmountBuckets(amount)) + " mB";
|
||||
String sAmount = amount == 0 ? "All" : formatFluid(this.getMaxAmountBuckets(amount));
|
||||
|
||||
// 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 ]",
|
||||
@@ -112,30 +111,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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mcp.mobius.waila.addons.stevescarts;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.GRAY;
|
||||
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
|
||||
@@ -47,7 +48,7 @@ public class HUDMinecartModular implements IWailaEntityProvider {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
Item ItemCartModule = null;
|
||||
Item ItemCartModule;
|
||||
try {
|
||||
ItemCartModule = (Item) StevesCartsModule.ItemCartModule.get(null);
|
||||
} catch (Exception e) {
|
||||
@@ -60,28 +61,27 @@ 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");
|
||||
currenttip.add(
|
||||
new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName() + TAB
|
||||
+ ALIGNRIGHT
|
||||
+ GRAY
|
||||
+ " [ "
|
||||
+ WHITE
|
||||
+ String.valueOf(amount)
|
||||
+ GRAY
|
||||
+ " mB of "
|
||||
+ WHITE
|
||||
+ formatNumber(amount)
|
||||
+ " of "
|
||||
+ fluid
|
||||
+ GRAY
|
||||
+ " ]");
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
|
||||
import static mcp.mobius.waila.api.SpecialChars.AQUA;
|
||||
import static mcp.mobius.waila.api.SpecialChars.TAB;
|
||||
import static mcp.mobius.waila.api.SpecialChars.WHITE;
|
||||
|
||||
@@ -19,6 +20,8 @@ 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.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
|
||||
@@ -43,17 +46,34 @@ 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<>();
|
||||
|
||||
int total = 0;
|
||||
|
||||
for (int i = 0; i < taglist.tagCount(); i++) {
|
||||
NBTTagCompound subtag = taglist.getCompoundTagAt(i);
|
||||
|
||||
String aspect = subtag.getString("key");
|
||||
String amount = String.valueOf(subtag.getInteger("value"));
|
||||
int value = subtag.getInteger("value");
|
||||
total += value;
|
||||
String amount = String.valueOf(value);
|
||||
|
||||
if (!aspect.equals("???"))
|
||||
currenttip.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
|
||||
else unknownAspects.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
|
||||
if (!aspect.equals("???")) currenttip.add(
|
||||
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
|
||||
else unknownAspects.add(
|
||||
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
|
||||
}
|
||||
|
||||
String id = tag.getString("WailaID");
|
||||
|
||||
if ((id.equals("TileNode") || id.equals("TileExtendedNode") || id.equals("TileJarNode"))
|
||||
&& (taglist.tagCount() > 10 || total > 300)) {
|
||||
currenttip.add(
|
||||
0,
|
||||
String.format(
|
||||
AQUA + "%s" + TAB + ALIGNRIGHT + WHITE + "%s",
|
||||
LangUtil.translateG("hud.msg.tcnodetotalsize"),
|
||||
total));
|
||||
}
|
||||
|
||||
currenttip.addAll(unknownAspects);
|
||||
@@ -79,7 +99,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
|
||||
ItemStack headSlot = player.inventory.armorInventory[3];
|
||||
if (headSlot == null) return tag;
|
||||
boolean hasReveal = ThaumcraftModule.IGoggles.isInstance(headSlot.getItem());
|
||||
boolean hasReveal = ThaumcraftModule.isGoggles.apply(headSlot);
|
||||
if (!hasReveal) return tag;
|
||||
|
||||
Map<String, ?> knownAspects = (Map<String, ?>) ThaumcraftModule.CommonProxy_getKnownAspects
|
||||
@@ -97,27 +117,22 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
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_getName.invoke(o));
|
||||
cmptag.setInteger("value", (Integer) tileAspects.get(o));
|
||||
cmptag.setString("key", (String) ThaumcraftModule.Aspect_tag.get(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) {
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
@@ -28,13 +32,18 @@ public class ThaumcraftModule {
|
||||
public static Class<?> Aspect = null;
|
||||
public static Field Aspect_tag = null;
|
||||
public static Method Aspect_getName = null;
|
||||
public static Method Aspect_getAspect = null;
|
||||
public static Method Aspect_getImage = null;
|
||||
public static Method Aspect_getColor = null;
|
||||
|
||||
public static Class<?> CommonProxy = null;
|
||||
public static Method CommonProxy_getKnownAspects = null;
|
||||
|
||||
public static Class<?> IGoggles = null;
|
||||
|
||||
// public static Class<?> TileAlchemyFurnace = null;
|
||||
public static ResourceLocation unknownAspectTexture = null;
|
||||
public static Color unknownAspectColor = null;
|
||||
public static Function<ItemStack, Boolean> isGoggles = stack -> IGoggles.isInstance(stack.getItem());
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
@@ -55,12 +64,18 @@ public class ThaumcraftModule {
|
||||
Aspect_tag = Aspect.getDeclaredField("tag");
|
||||
Aspect_tag.setAccessible(true);
|
||||
Aspect_getName = Aspect.getDeclaredMethod("getName");
|
||||
Aspect_getAspect = Aspect.getMethod("getAspect", java.lang.String.class);
|
||||
Aspect_getImage = Aspect.getDeclaredMethod("getImage");
|
||||
Aspect_getColor = Aspect.getDeclaredMethod("getColor");
|
||||
|
||||
CommonProxy = Class.forName("thaumcraft.common.CommonProxy");
|
||||
CommonProxy_getKnownAspects = CommonProxy.getDeclaredMethod("getKnownAspects");
|
||||
|
||||
IGoggles = Class.forName("thaumcraft.api.IGoggles");
|
||||
|
||||
unknownAspectTexture = new ResourceLocation("thaumcraft", "textures/aspects/_unknown.png");
|
||||
unknownAspectColor = new Color(0x654242);
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thaumcraft", "thaumcraft.aspects");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), IAspectContainer);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
|
||||
@@ -68,12 +83,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.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package mcp.mobius.waila.addons.thaumcraftGadomancy;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
|
||||
|
||||
public class GadomancyModule {
|
||||
|
||||
public static Class<?> RegisteredEnchantments = null;
|
||||
public static Field RegisteredEnchantments_revealer = null;
|
||||
|
||||
public static int revealerEffectId;
|
||||
|
||||
public static void register() {
|
||||
try {
|
||||
RegisteredEnchantments = Class.forName("makeo.gadomancy.common.registration.RegisteredEnchantments");
|
||||
RegisteredEnchantments_revealer = RegisteredEnchantments.getDeclaredField("revealer");
|
||||
Object revealer = RegisteredEnchantments_revealer.get(null);
|
||||
|
||||
revealerEffectId = ((Enchantment) revealer).effectId;
|
||||
|
||||
ThaumcraftModule.isGoggles = stack -> ThaumcraftModule.IGoggles.isInstance(stack.getItem())
|
||||
|| EnchantmentHelper.getEnchantmentLevel(revealerEffectId, stack) > 0;
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Thaumcraft Gadomancy] Gadomancy mod not found.");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft Gadomancy] Unhandled exception. {}", e);
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Gadomancy mod found.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package mcp.mobius.waila.addons.thermaldynamics;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 net.minecraftforge.common.util.ForgeDirection;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Lordmau5 on 28.02.2015.
|
||||
*/
|
||||
public class FluiductFluidHandler 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) {
|
||||
|
||||
if (!config.getConfig("thermaldynamics.fluiductsFluid")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("fluid"));
|
||||
int capacity = tag.getInteger("capacity");
|
||||
|
||||
if (capacity == 0) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
String name = currenttip.get(0);
|
||||
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: fluid.getFluid().getLocalizedName(fluid);
|
||||
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
|
||||
if (!config.getConfig("thermaldynamics.fluiductsAmount")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("fluid"));
|
||||
int amount = fluid == null ? 0 : fluid.amount;
|
||||
int capacity = tag.getInteger("capacity");
|
||||
|
||||
if (capacity == 0) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(capacity)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te instanceof IFluidHandler fluidHandler) {
|
||||
FluidTankInfo[] infos = fluidHandler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (infos.length != 1) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
FluidTankInfo info = infos[0];
|
||||
|
||||
if (info.fluid != null) {
|
||||
NBTTagCompound fluidNBT = info.fluid.writeToNBT(new NBTTagCompound());
|
||||
tag.setTag("fluid", fluidNBT);
|
||||
}
|
||||
|
||||
tag.setInteger("capacity", info.capacity);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,36 +4,35 @@ import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class ThermalDynamicsModule {
|
||||
|
||||
public static Class TileFluidDuct = null;
|
||||
public static Class<?> TileFluidDuct = null;
|
||||
|
||||
public static void register() {
|
||||
// XXX : We register the Fluiduct
|
||||
try {
|
||||
TileFluidDuct = Class.forName("cofh.thermaldynamics.ducts.fluid.TileFluidDuct");
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsFluid");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsAmount");
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerDuct(), TileFluidDuct);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerDuct(), TileFluidDuct);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerDuct(), TileFluidDuct);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks." + e);
|
||||
if (LoadedMods.WAILA_PLUGINS) {
|
||||
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); }
|
||||
*/
|
||||
try {
|
||||
TileFluidDuct = Class.forName("cofh.thermaldynamics.duct.fluid.TileFluidDuct");
|
||||
Waila.log.log(Level.INFO, "Thermal Dynamics mod found.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Dynamics] Thermal Dynamics mod not found.");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks. {}", e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsFluid");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsAmount");
|
||||
|
||||
FluiductFluidHandler fluiductFluidHandler = new FluiductFluidHandler();
|
||||
ModuleRegistrar.instance().registerHeadProvider(fluiductFluidHandler, TileFluidDuct);
|
||||
ModuleRegistrar.instance().registerBodyProvider(fluiductFluidHandler, TileFluidDuct);
|
||||
ModuleRegistrar.instance().registerNBTProvider(fluiductFluidHandler, TileFluidDuct);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,14 +40,17 @@ public class HUDHandlerCache implements IWailaDataProvider {
|
||||
if (storedItem != null) {
|
||||
String namex = GameData.getItemRegistry().getNameForObject(storedItem.getItem());
|
||||
name += String.format(
|
||||
" < " + SpecialChars.getRenderString(
|
||||
" < %s %s >",
|
||||
SpecialChars.getRenderString(
|
||||
"waila.stack",
|
||||
"1",
|
||||
namex,
|
||||
"0",
|
||||
String.valueOf(storedItem.getItemDamage())) + color + " %s >",
|
||||
String.valueOf(storedItem.getItemDamage())) + color,
|
||||
storedItem.getDisplayName());
|
||||
} else name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
} else {
|
||||
name += " < " + LangUtil.translateG("hud.msg.empty") + " >";
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
} catch (Exception e) {
|
||||
@@ -91,9 +94,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;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -36,11 +38,11 @@ public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s/%s : %d / %d RF/t",
|
||||
"%s/%s : %s / %s RF/t",
|
||||
LangUtil.translateG("hud.msg.in"),
|
||||
LangUtil.translateG("hud.msg.out"),
|
||||
energyReceive,
|
||||
energySend));
|
||||
formatNumber(energyReceive),
|
||||
formatNumber(energySend)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
+18
-8
@@ -1,5 +1,7 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -13,7 +15,7 @@ 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 mcp.mobius.waila.api.SpecialChars;
|
||||
|
||||
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
|
||||
@@ -34,15 +36,23 @@ public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
|
||||
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
|
||||
if (!accessor.getNBTData().hasKey("Energy")) return currenttip;
|
||||
if (!accessor.getNBTData().hasKey("MaxStorage")) return currenttip;
|
||||
|
||||
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
|
||||
int maxEnergy = accessor.getNBTInteger(accessor.getNBTData(), "MaxStorage");
|
||||
try {
|
||||
if ((maxEnergy != 0) && (((ITaggedList) currenttip).getEntries("RFEnergyStorage").size() == 0)) {
|
||||
((ITaggedList) currenttip).add(String.format("%d / %d RF", energy, maxEnergy), "RFEnergyStorage");
|
||||
if (currenttip instanceof ITaggedList taggedTips) {
|
||||
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
|
||||
int maxEnergy = accessor.getNBTInteger(accessor.getNBTData(), "MaxStorage");
|
||||
|
||||
if (maxEnergy > 0 && taggedTips.getEntries("RFEnergyStorage").isEmpty()) {
|
||||
if (config.getConfig("thermalexpansion.rfenergybar")) {
|
||||
taggedTips.add(
|
||||
SpecialChars.getRenderString("waila.rfenergy", energy + "", maxEnergy + ""),
|
||||
"RFEnergyStorage");
|
||||
} else {
|
||||
taggedTips.add(
|
||||
String.format("%s / %s RF", formatNumber(energy), formatNumber(maxEnergy)),
|
||||
"RFEnergyStorage");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 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
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
|
||||
|
||||
try {
|
||||
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid
|
||||
.invoke(accessor.getTileEntity());
|
||||
String name = currenttip.get(0);
|
||||
|
||||
try {
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
|
||||
} catch (NullPointerException f) {
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
try {
|
||||
if (config.getConfig("thermalexpansion.fluidamount")) {
|
||||
int amount = 0;
|
||||
if (accessor.getNBTData().hasKey("Amount"))
|
||||
amount = accessor.getNBTInteger(accessor.getNBTData(), "Amount");
|
||||
|
||||
Integer capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity
|
||||
.invoke(accessor.getTileEntity());
|
||||
|
||||
currenttip.add(String.format("%d / %d mB", amount, capacity));
|
||||
}
|
||||
|
||||
if (config.getConfig("thermalexpansion.tankmode")) {
|
||||
Byte mode = (Byte) ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
|
||||
if (mode == 0) currenttip.add(
|
||||
String.format(
|
||||
"%s : \u00a7a%s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
LangUtil.translateG("hud.msg.input")));
|
||||
else if (mode == 1) currenttip.add(
|
||||
String.format(
|
||||
"%s : \u00a7c%s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
LangUtil.translateG("hud.msg.output")));
|
||||
else currenttip.add(String.format("Mode : Unknown (%d)", mode));
|
||||
}
|
||||
|
||||
} 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(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
try {
|
||||
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(te);
|
||||
tag.setInteger("Amount", amount);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ 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.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
@@ -33,9 +34,9 @@ public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
if (config.getConfig("thermalexpansion.tesssendrecv")) {
|
||||
String send = String.format("%s : ", LangUtil.translateG("hud.msg.send"));
|
||||
String recv = String.format("%s : ", LangUtil.translateG("hud.msg.recv"));
|
||||
String item = String.format("\u00a7a%s ", LangUtil.translateG("hud.msg.item"));
|
||||
String fluid = String.format("\u00a79%s ", LangUtil.translateG("hud.msg.fluid"));
|
||||
String energ = String.format("\u00a7c%s ", LangUtil.translateG("hud.msg.energ"));
|
||||
String item = String.format("%s ", SpecialChars.GREEN + LangUtil.translateG("hud.msg.item"));
|
||||
String fluid = String.format("%s ", SpecialChars.BLUE + LangUtil.translateG("hud.msg.fluid"));
|
||||
String energ = String.format("%s ", SpecialChars.RED + LangUtil.translateG("hud.msg.energ"));
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")) {
|
||||
case 0:
|
||||
|
||||
+29
-27
@@ -1,4 +1,7 @@
|
||||
package mcp.mobius.waila.addons.railcraft;
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,7 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
@@ -16,7 +18,7 @@ import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
public class TankFluidHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -26,26 +28,24 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
|
||||
if (!config.getConfig("thermalexpansion.fluidtype")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = accessor.getTileEntity();
|
||||
if (tileEntity == null) return currenttip;
|
||||
|
||||
try {
|
||||
IFluidTank tank = (IFluidTank) RailcraftModule.ITankTile_getTank
|
||||
.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
|
||||
if (tank == null) return currenttip;
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
|
||||
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid.invoke(tileEntity);
|
||||
String name = currenttip.get(0);
|
||||
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: fluid.getFluid().getLocalizedName(fluid);
|
||||
|
||||
try {
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
|
||||
} catch (NullPointerException f) {
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
@@ -54,19 +54,22 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
|
||||
if (!config.getConfig("thermalexpansion.fluidamount")) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = accessor.getTileEntity();
|
||||
if (tileEntity == null) return currenttip;
|
||||
|
||||
try {
|
||||
IFluidTank tank = (IFluidTank) RailcraftModule.ITankTile_getTank
|
||||
.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
|
||||
if (tank == null) return currenttip;
|
||||
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(tileEntity);
|
||||
int capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity.invoke(tileEntity);
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
if (fluid != null) currenttip.add(String.format("%d / %d mB", fluid.amount, tank.getInfo().capacity));
|
||||
else currenttip.add(String.format("0 / %d mB", tank.getInfo().capacity));
|
||||
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(capacity)));
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
@@ -81,7 +84,6 @@ public class HUDHandlerTank implements IWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
+24
-27
@@ -1,4 +1,4 @@
|
||||
package mcp.mobius.waila.addons.thermaldynamics;
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,17 +7,15 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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.api.SpecialChars;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
/**
|
||||
* Created by Lordmau5 on 28.02.2015.
|
||||
*/
|
||||
public class HUDHandlerDuct implements IWailaDataProvider {
|
||||
public class TankModeHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@@ -27,33 +25,33 @@ public class HUDHandlerDuct implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("thermaldynamics.fluiductsFluid")) return currenttip;
|
||||
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(accessor.getNBTData());
|
||||
|
||||
String name = "";
|
||||
|
||||
try {
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
|
||||
} catch (NullPointerException f) {
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.add(name);
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (!config.getConfig("thermaldynamics.fluiductsAmount")) return currenttip;
|
||||
try {
|
||||
if (config.getConfig("thermalexpansion.tankmode")) {
|
||||
Byte mode = (Byte) ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
|
||||
if (mode == 0) {
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
SpecialChars.GREEN + LangUtil.translateG("hud.msg.input")));
|
||||
} else if (mode == 1) {
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
SpecialChars.RED + LangUtil.translateG("hud.msg.output")));
|
||||
}
|
||||
}
|
||||
|
||||
int amount = 0;
|
||||
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
if (tag.hasKey("Amount")) amount = accessor.getNBTInteger(tag, "Amount");
|
||||
|
||||
currenttip.add(String.format(" %d / 1000 mB", amount));
|
||||
} catch (Exception e) {
|
||||
WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -67,7 +65,6 @@ public class HUDHandlerDuct implements IWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
+63
-38
@@ -9,51 +9,50 @@ import org.apache.logging.log4j.Level;
|
||||
|
||||
import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
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");
|
||||
@@ -69,6 +68,7 @@ public class ThermalExpansionModule {
|
||||
IEnergyInfo_getCurStorage = IEnergyInfo.getMethod("getInfoEnergyStored");
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.rfenergybar");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyProvider);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIEnergyHandler(), IEnergyProvider);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyReceiver);
|
||||
@@ -76,8 +76,11 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyInfo);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIEnergyHandler(), IEnergyInfo);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
printedThermalExpansionNotFound = true;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks. {}", e);
|
||||
}
|
||||
|
||||
// XXX : We register the energy cell
|
||||
@@ -90,27 +93,43 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks. {}", e);
|
||||
}
|
||||
|
||||
// XXX : We register the Tank interface
|
||||
try {
|
||||
TileTank = Class.forName("cofh.thermalexpansion.block.tank.TileTank");
|
||||
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
|
||||
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
|
||||
TileTank_getTankAmount = TileTank.getMethod("getTankFluidAmount");
|
||||
TileTank_mode = TileTank.getField("mode");
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidtype");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount");
|
||||
ModuleRegistrar.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode");
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileTank);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTank(), TileTank);
|
||||
if (!LoadedMods.WAILA_PLUGINS) {
|
||||
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
|
||||
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
|
||||
TileTank_getTankAmount = TileTank.getMethod("getTankFluidAmount");
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidtype");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount");
|
||||
|
||||
TankFluidHandler tankFluidHandler = new TankFluidHandler();
|
||||
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileTank);
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new TankModeHandler(), TileTank);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks. {}", e);
|
||||
}
|
||||
|
||||
// XXX : We register the Tesseract interface
|
||||
@@ -125,8 +144,13 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
|
||||
// XXX : We register the ISecureTile interface
|
||||
@@ -138,11 +162,14 @@ 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 (ClassNotFoundException e) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks. {}", e);
|
||||
}
|
||||
|
||||
// XXX : We register the Cache interface
|
||||
@@ -157,20 +184,18 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCache(), TileCache);
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerCache(), TileCache);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
|
||||
// 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); }
|
||||
*/
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,14 +7,14 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
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.");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,21 +2,29 @@ package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
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.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderProgressBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderStack;
|
||||
import mcp.mobius.waila.utils.ColorUtils;
|
||||
|
||||
public class HUDHandlerFurnace implements IWailaDataProvider {
|
||||
|
||||
static Block furanace = Blocks.furnace;
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
@@ -31,45 +39,68 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
int cookTime = accessor.getNBTData().getShort("CookTime");
|
||||
NBTTagList tag = accessor.getNBTData().getTagList("Items", 10);
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
NBTTagList items = accessor.getNBTData().getTagList("Items", 10);
|
||||
String itemsText = "";
|
||||
ItemStack inputStack = null;
|
||||
ItemStack fuelStack = null;
|
||||
ItemStack outputStack = null;
|
||||
|
||||
String renderStr = "";
|
||||
{
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTagAt(0));
|
||||
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
|
||||
renderStr += SpecialChars.getRenderString(
|
||||
"waila.stack",
|
||||
"1",
|
||||
name,
|
||||
String.valueOf(stack.stackSize),
|
||||
String.valueOf(stack.getItemDamage()));
|
||||
}
|
||||
{
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTagAt(1));
|
||||
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
|
||||
renderStr += SpecialChars.getRenderString(
|
||||
"waila.stack",
|
||||
"1",
|
||||
name,
|
||||
String.valueOf(stack.stackSize),
|
||||
String.valueOf(stack.getItemDamage()));
|
||||
int smeltTime = tag.getInteger("Smelt");
|
||||
int fuelTime = tag.getInteger("Fuel");
|
||||
int maxFuelTime = tag.getInteger("MaxFuel");
|
||||
|
||||
double smeltProgress = (double) smeltTime / 200;
|
||||
double fuelProgress = (double) fuelTime / maxFuelTime;
|
||||
|
||||
for (int i = 0; i < items.tagCount(); i++) {
|
||||
NBTTagCompound itemTag = items.getCompoundTagAt(i);
|
||||
byte slot = itemTag.getByte("Slot");
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
|
||||
if (slot == 0) {
|
||||
inputStack = stack;
|
||||
} else if (slot == 1) {
|
||||
fuelStack = stack;
|
||||
} else if (slot == 2) {
|
||||
outputStack = stack;
|
||||
}
|
||||
}
|
||||
|
||||
renderStr += SpecialChars.getRenderString("waila.progress", String.valueOf(cookTime), String.valueOf(200));
|
||||
|
||||
{
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTagAt(2));
|
||||
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
|
||||
renderStr += SpecialChars.getRenderString(
|
||||
"waila.stack",
|
||||
"1",
|
||||
name,
|
||||
String.valueOf(stack.stackSize),
|
||||
String.valueOf(stack.getItemDamage()));
|
||||
if (fuelProgress > 0) {
|
||||
String fuelBar = TTRenderBar.create(
|
||||
String.format("Fuel %ds / %ds", (maxFuelTime - fuelTime) / 20, maxFuelTime / 20),
|
||||
ColorUtils.fuelFurnaceBarTop.getColor(),
|
||||
ColorUtils.fuelFurnaceBarBottom.getColor(),
|
||||
1.0 - fuelProgress);
|
||||
currenttip.add(fuelBar);
|
||||
}
|
||||
|
||||
currenttip.add(renderStr);
|
||||
if (smeltProgress > 0) {
|
||||
String cookBar = TTRenderBar.create(
|
||||
String.format("Smelt %ds / %ds", smeltTime / 20, 200 / 20),
|
||||
ColorUtils.progressBarTop.getColor(),
|
||||
ColorUtils.progressBarBottom.getColor(),
|
||||
smeltProgress);
|
||||
currenttip.add(cookBar);
|
||||
}
|
||||
|
||||
if (inputStack != null) {
|
||||
itemsText += TTRenderStack.create(inputStack, inputStack.stackSize);
|
||||
}
|
||||
|
||||
if (fuelStack != null) {
|
||||
itemsText += TTRenderStack.create(fuelStack, fuelStack.stackSize);
|
||||
}
|
||||
|
||||
if (outputStack != null) {
|
||||
if (inputStack != null || fuelStack != null) {
|
||||
itemsText += TTRenderProgressBar.create(0, 1);
|
||||
}
|
||||
itemsText += TTRenderStack.create(outputStack, outputStack.stackSize);
|
||||
}
|
||||
|
||||
currenttip.add(itemsText);
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
@@ -83,12 +114,19 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te != null) te.writeToNBT(tag);
|
||||
if (te instanceof TileEntityFurnace furnace) {
|
||||
tag.setInteger("Smelt", furnace.furnaceCookTime);
|
||||
tag.setInteger("Fuel", furnace.furnaceBurnTime);
|
||||
tag.setInteger("MaxFuel", furnace.currentItemBurnTime);
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
// ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
|
||||
// ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
|
||||
IWailaDataProvider provider = new HUDHandlerFurnace();
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, furanace.getClass());
|
||||
ModuleRegistrar.instance().registerNBTProvider(provider, furanace.getClass());
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import java.util.List;
|
||||
|
||||
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;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -62,6 +62,35 @@ public interface IWailaDataProvider {
|
||||
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config);
|
||||
|
||||
/**
|
||||
* Callback used to determine if there is extended information to display for the Body section. If this returns
|
||||
* true, Waila will either display the "Hold <KEY> for more info" prompt or call getWailaAdvancedBody if the key is
|
||||
* being held.
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return True if advanced body information is available, false otherwise.
|
||||
*/
|
||||
default boolean hasWailaAdvancedBody(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return false; // Default to false for backward compatibility
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback used to add the extended lines to the Body section of the tooltip. This method is ONLY called if
|
||||
* hasAdvancedBody returns true AND the player is holding the configured key for advanced tooltips.
|
||||
*
|
||||
* @param itemStack Current block scanned, in ItemStack form.
|
||||
* @param currenttip The current list of tooltip lines, including the normal body.
|
||||
* @param accessor Contains most of the relevant information about the current environment.
|
||||
* @param config Current configuration of Waila.
|
||||
* @return Modified input currenttip with advanced information appended.
|
||||
*/
|
||||
default List<String> getWailaAdvancedBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
return currenttip; // Default to returning the unmodified list
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).</br>
|
||||
* Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
/**
|
||||
* Interface for tooltip renderers that adjust their width depending on the width of the rest of the tooltip.
|
||||
* setMaxLineWidth is called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render to inform the
|
||||
* renderer of the width of the longest line in the tooltip.
|
||||
*/
|
||||
public interface IWailaVariableWidthTooltipRenderer extends IWailaTooltipRenderer {
|
||||
|
||||
/**
|
||||
* Return the size of the tooltip. for variable width renderers it is recommended to return the minimum width needed
|
||||
* for the line, then draw the actual width using getMaxLineWidth(). They do not need to actually match.
|
||||
*
|
||||
* @param params Array of string parameters as passed to the RENDER arg in the tooltip
|
||||
* ({rendername,param1,param2,...})
|
||||
* @param accessor A global accessor for TileEntities and Entities
|
||||
* @return Dimension of the reserved area
|
||||
*/
|
||||
Dimension getSize(String[] params, IWailaCommonAccessor accessor);
|
||||
|
||||
/**
|
||||
* Informs the renderer of what the length of the longest line is.</br>
|
||||
* Called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render.</br>
|
||||
*
|
||||
* @param width The width of the longest line in the tooltip.
|
||||
*
|
||||
*/
|
||||
void setMaxLineWidth(int width);
|
||||
|
||||
/**
|
||||
* Returns the width of the longest line in the current tooltip.</br>
|
||||
* With icons disabled the tooltip's background box is always 2 pixels wider to the right of the line than it is to
|
||||
* the left.</br>
|
||||
*
|
||||
* @return The width of the longest line in the tooltip
|
||||
*
|
||||
*/
|
||||
int getMaxLineWidth();
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class SpecialChars {
|
||||
public static String WailaStyle = "\u00A4";
|
||||
public static String WailaIcon = "\u00A5";
|
||||
public static String WailaRenderer = "\u00A6";
|
||||
public static String WailaRendererComma = "\u0082";
|
||||
public static String TAB = WailaStyle + WailaStyle + "a";
|
||||
public static String ALIGNRIGHT = WailaStyle + WailaStyle + "b";
|
||||
public static String ALIGNCENTER = WailaStyle + WailaStyle + "c";
|
||||
@@ -43,12 +44,19 @@ public class SpecialChars {
|
||||
|
||||
public static final Pattern patternMinecraft = Pattern.compile("(?i)" + MCStyle + "[0-9A-FK-OR]");
|
||||
public static final Pattern patternWaila = Pattern.compile("(?i)(" + WailaStyle + "(?<type>..))");
|
||||
public static final Pattern patternRender = Pattern
|
||||
.compile("(?i)(" + RENDER + "\\{(?<name>[^,}]*),?(?<args>[^}]*)\\})");
|
||||
// (?i)(¤¦a\{(?<name>[^U+0082}]*)U+0082?(?<args>[^}]*)\})
|
||||
public static final Pattern patternRender = Pattern.compile(
|
||||
"(?i)(" + RENDER
|
||||
+ "\\{(?<name>[^"
|
||||
+ WailaRendererComma
|
||||
+ "}]*)"
|
||||
+ WailaRendererComma
|
||||
+ "?(?<args>[^}]*)\\})");
|
||||
public static final Pattern patternTab = Pattern.compile("(?i)" + TAB);
|
||||
public static final Pattern patternRight = Pattern.compile("(?i)" + ALIGNRIGHT);
|
||||
public static final Pattern patternCenter = Pattern.compile("(?i)" + ALIGNCENTER);
|
||||
public static final Pattern patternIcon = Pattern.compile("(?i)(" + WailaStyle + WailaIcon + "(?<type>[0-9a-z]))");
|
||||
// (?i)(¤¤[^¤]+|¤¥[0-9A-Z]|¤¦a\{(?<name>[^U+0082}]*)U+0082?(?<args>[^}]*)\}|[^¤]+)
|
||||
public static final Pattern patternLineSplit = Pattern.compile(
|
||||
"(?i)(" + WailaStyle
|
||||
+ WailaStyle
|
||||
@@ -60,24 +68,24 @@ public class SpecialChars {
|
||||
+ "[0-9A-Z]|"
|
||||
+ WailaStyle
|
||||
+ WailaRenderer
|
||||
+ "a\\{([^,}]*),?([^}]*)\\}|[^"
|
||||
+ "a\\{(?<name>[^"
|
||||
+ WailaRendererComma
|
||||
+ "}]*)"
|
||||
+ WailaRendererComma
|
||||
+ "?(?<args>[^}]*)\\}|[^"
|
||||
+ WailaStyle
|
||||
+ "]+)");
|
||||
|
||||
/**
|
||||
* 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(WailaRendererComma).append(s);
|
||||
}
|
||||
result += "}";
|
||||
return result;
|
||||
result.append("}");
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ public class ConfigHandler implements IWailaConfigHandler {
|
||||
}
|
||||
/* === */
|
||||
|
||||
private LinkedHashMap<String, ConfigModule> modules = new LinkedHashMap<String, ConfigModule>();
|
||||
private ArrayList<String> serverconfigs = new ArrayList<String>();
|
||||
public HashMap<String, Boolean> forcedConfigs = new HashMap<String, Boolean>();
|
||||
private LinkedHashMap<String, ConfigModule> modules = new LinkedHashMap<>();
|
||||
private ArrayList<String> serverconfigs = new ArrayList<>();
|
||||
public HashMap<String, Boolean> forcedConfigs = new HashMap<>();
|
||||
public Configuration config = null;
|
||||
|
||||
public void addModule(String modName, HashMap<String, String> options) {
|
||||
@@ -134,6 +134,10 @@ public class ConfigHandler implements IWailaConfigHandler {
|
||||
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
|
||||
}
|
||||
|
||||
public boolean showIcon() {
|
||||
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
|
||||
}
|
||||
|
||||
/* Default config loading */
|
||||
|
||||
public void loadDefaultConfig(FMLPreInitializationEvent event) {
|
||||
@@ -145,6 +149,7 @@ public class ConfigHandler implements IWailaConfigHandler {
|
||||
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, false);
|
||||
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
|
||||
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true);
|
||||
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
|
||||
|
||||
OverlayConfig.posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
|
||||
OverlayConfig.posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ConfigModule {
|
||||
|
||||
public ConfigModule(String _modName) {
|
||||
this.modName = _modName;
|
||||
this.options = new HashMap<String, String>();
|
||||
this.options = new HashMap<>();
|
||||
}
|
||||
|
||||
public ConfigModule(String _modName, HashMap<String, String> _options) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
|
||||
try {
|
||||
this.stack = new ItemStack(this.block, 1, this.metadata);
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
} else if (this.mop.typeOfHit == MovingObjectType.ENTITY) {
|
||||
this.block = null;
|
||||
@@ -131,7 +131,7 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
try {
|
||||
this.tileEntity.writeToNBT(tag);
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception ignored) {}
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -212,5 +212,4 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
|
||||
public String getBlockQualifiedName() {
|
||||
return this.blockResource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,18 +12,18 @@ import mcp.mobius.waila.utils.NBTUtil;
|
||||
|
||||
public class DataAccessorFMP implements IWailaFMPAccessor {
|
||||
|
||||
String id;
|
||||
World world;
|
||||
EntityPlayer player;
|
||||
MovingObjectPosition mop;
|
||||
Vec3 renderingvec = null;
|
||||
TileEntity entity;
|
||||
NBTTagCompound partialNBT = null;
|
||||
NBTTagCompound remoteNBT = null;
|
||||
long timeLastUpdate = System.currentTimeMillis();
|
||||
double partialFrame;
|
||||
public static final DataAccessorFMP instance = new DataAccessorFMP();
|
||||
|
||||
public static DataAccessorFMP instance = new DataAccessorFMP();
|
||||
private String id;
|
||||
private World world;
|
||||
private EntityPlayer player;
|
||||
private MovingObjectPosition mop;
|
||||
private Vec3 renderingvec;
|
||||
private TileEntity tileEntity;
|
||||
private NBTTagCompound partialNBT;
|
||||
private double partialFrame;
|
||||
|
||||
private DataAccessorFMP() {}
|
||||
|
||||
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, NBTTagCompound _partialNBT,
|
||||
String id) {
|
||||
@@ -35,13 +35,24 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
|
||||
this.world = _world;
|
||||
this.player = _player;
|
||||
this.mop = _mop;
|
||||
this.entity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.partialNBT = _partialNBT;
|
||||
this.id = id;
|
||||
this.renderingvec = renderVec;
|
||||
this.partialFrame = partialTicks;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
id = null;
|
||||
world = null;
|
||||
player = null;
|
||||
mop = null;
|
||||
renderingvec = null;
|
||||
tileEntity = null;
|
||||
partialNBT = null;
|
||||
partialFrame = 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
@@ -54,7 +65,7 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return this.entity;
|
||||
return this.tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,12 +80,9 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFullNBTData() {
|
||||
if (this.entity == null) return null;
|
||||
|
||||
if (this.isTagCorrect(this.remoteNBT)) return this.remoteNBT;
|
||||
|
||||
if (this.tileEntity == null) return null;
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.entity.writeToNBT(tag);
|
||||
this.tileEntity.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -98,20 +106,4 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
private boolean isTagCorrect(NBTTagCompound tag) {
|
||||
if (tag == null) {
|
||||
this.timeLastUpdate = System.currentTimeMillis() - 250;
|
||||
return false;
|
||||
}
|
||||
|
||||
int x = tag.getInteger("x");
|
||||
int y = tag.getInteger("y");
|
||||
int z = tag.getInteger("z");
|
||||
|
||||
if (x == this.mop.blockX && y == this.mop.blockY && z == this.mop.blockZ) return true;
|
||||
else {
|
||||
this.timeLastUpdate = System.currentTimeMillis() - 250;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -18,7 +18,9 @@ import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.IWailaBlock;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.cbcore.Layout;
|
||||
import mcp.mobius.waila.client.KeyEvent;
|
||||
import mcp.mobius.waila.network.Message0x01TERequest;
|
||||
import mcp.mobius.waila.network.Message0x03EntRequest;
|
||||
import mcp.mobius.waila.network.WailaPacketHandler;
|
||||
@@ -26,23 +28,19 @@ import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
public class MetaDataProvider {
|
||||
|
||||
private Map<Integer, List<IWailaDataProvider>> headBlockProviders = new TreeMap<Integer, List<IWailaDataProvider>>();
|
||||
private Map<Integer, List<IWailaDataProvider>> bodyBlockProviders = new TreeMap<Integer, List<IWailaDataProvider>>();
|
||||
private Map<Integer, List<IWailaDataProvider>> tailBlockProviders = new TreeMap<Integer, List<IWailaDataProvider>>();
|
||||
private final Map<Integer, List<IWailaDataProvider>> headBlockProviders = new TreeMap<>();
|
||||
private final Map<Integer, List<IWailaDataProvider>> bodyBlockProviders = new TreeMap<>();
|
||||
private Map<Integer, List<IWailaDataProvider>> tailBlockProviders = new TreeMap<>();
|
||||
|
||||
private Map<Integer, List<IWailaEntityProvider>> headEntityProviders = new TreeMap<Integer, List<IWailaEntityProvider>>();
|
||||
private Map<Integer, List<IWailaEntityProvider>> bodyEntityProviders = new TreeMap<Integer, List<IWailaEntityProvider>>();
|
||||
private Map<Integer, List<IWailaEntityProvider>> tailEntityProviders = new TreeMap<Integer, List<IWailaEntityProvider>>();
|
||||
|
||||
private Class prevBlock = null;
|
||||
private Class prevTile = null;
|
||||
private final Map<Integer, List<IWailaEntityProvider>> headEntityProviders = new TreeMap<>();
|
||||
private final Map<Integer, List<IWailaEntityProvider>> bodyEntityProviders = new TreeMap<>();
|
||||
private final Map<Integer, List<IWailaEntityProvider>> tailEntityProviders = new TreeMap<>();
|
||||
|
||||
public ItemStack identifyBlockHighlight(World world, EntityPlayer player, MovingObjectPosition mop,
|
||||
DataAccessorCommon accessor) {
|
||||
Block block = accessor.getBlock();
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
if (IWailaBlock.class.isInstance(block)) {
|
||||
if (block instanceof IWailaBlock) {
|
||||
try {
|
||||
return ((IWailaBlock) block).getWailaStack(accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e) {
|
||||
@@ -73,7 +71,7 @@ public class MetaDataProvider {
|
||||
&& accessor.isTimeElapsed(250)
|
||||
&& ConfigHandler.instance().showTooltip()) {
|
||||
accessor.resetTimer();
|
||||
HashSet<String> keys = new HashSet<String>();
|
||||
HashSet<String> keys = new HashSet<>();
|
||||
|
||||
if (ModuleRegistrar.instance().hasSyncedNBTKeys(block))
|
||||
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(block));
|
||||
@@ -81,7 +79,7 @@ public class MetaDataProvider {
|
||||
if (ModuleRegistrar.instance().hasSyncedNBTKeys(accessor.getTileEntity()))
|
||||
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getTileEntity()));
|
||||
|
||||
if (keys.size() != 0 || ModuleRegistrar.instance().hasNBTProviders(block)
|
||||
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTProviders(block)
|
||||
|| ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity()))
|
||||
WailaPacketHandler.INSTANCE.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys));
|
||||
|
||||
@@ -99,8 +97,7 @@ public class MetaDataProvider {
|
||||
}
|
||||
|
||||
/* Interface IWailaBlock */
|
||||
if (IWailaBlock.class.isInstance(block)) {
|
||||
TileEntity entity = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||
if (block instanceof IWailaBlock) {
|
||||
if (layout == Layout.HEADER) try {
|
||||
return ((IWailaBlock) block).getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e) {
|
||||
@@ -152,11 +149,29 @@ public class MetaDataProvider {
|
||||
}
|
||||
|
||||
if (layout == Layout.BODY) for (List<IWailaDataProvider> providersList : bodyBlockProviders.values()) {
|
||||
boolean hasAdvancedBodyAvailable = false;
|
||||
final boolean isAdvancedKeyDown = KeyEvent.key_show_advanced.getIsKeyPressed();
|
||||
|
||||
for (IWailaDataProvider dataProvider : providersList) try {
|
||||
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
|
||||
if (dataProvider.hasWailaAdvancedBody(itemStack, accessor, ConfigHandler.instance())) {
|
||||
hasAdvancedBodyAvailable = true;
|
||||
|
||||
if (isAdvancedKeyDown) {
|
||||
currenttip = dataProvider
|
||||
.getWailaAdvancedBody(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
|
||||
}
|
||||
|
||||
if (hasAdvancedBodyAvailable && !isAdvancedKeyDown) {
|
||||
String keyName = GameSettings.getKeyDisplayString(KeyEvent.key_show_advanced.getKeyCode());
|
||||
currenttip.add(LangUtil.translateG("hud.msg.holdkeymoreinfo", keyName));
|
||||
}
|
||||
}
|
||||
if (layout == Layout.FOOTER) for (List<IWailaDataProvider> providersList : tailBlockProviders.values()) {
|
||||
for (IWailaDataProvider dataProvider : providersList) try {
|
||||
@@ -173,12 +188,12 @@ public class MetaDataProvider {
|
||||
|
||||
if (accessor.getEntity() != null && Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
|
||||
accessor.resetTimer();
|
||||
HashSet<String> keys = new HashSet<String>();
|
||||
HashSet<String> keys = new HashSet<>();
|
||||
|
||||
if (ModuleRegistrar.instance().hasSyncedNBTKeys(accessor.getEntity()))
|
||||
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getEntity()));
|
||||
|
||||
if (keys.size() != 0 || ModuleRegistrar.instance().hasNBTEntityProviders(accessor.getEntity()))
|
||||
if (!keys.isEmpty() || ModuleRegistrar.instance().hasNBTEntityProviders(accessor.getEntity()))
|
||||
WailaPacketHandler.INSTANCE.sendToServer(new Message0x03EntRequest(accessor.getEntity(), keys));
|
||||
|
||||
} else if (accessor.getEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
|
||||
|
||||
@@ -29,34 +29,34 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
|
||||
private static ModuleRegistrar instance = null;
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> headBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> bodyBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> NBTDataProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> headBlockProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> bodyBlockProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> NBTDataProviders = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>> blockClassDecorators = new LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>> blockClassDecorators = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> headEntityProviders = new LinkedHashMap<Class, ArrayList<IWailaEntityProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> bodyEntityProviders = new LinkedHashMap<Class, ArrayList<IWailaEntityProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> tailEntityProviders = new LinkedHashMap<Class, ArrayList<IWailaEntityProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> overrideEntityProviders = new LinkedHashMap<Class, ArrayList<IWailaEntityProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> NBTEntityProviders = new LinkedHashMap<Class, ArrayList<IWailaEntityProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> headEntityProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> bodyEntityProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> tailEntityProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> overrideEntityProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaEntityProvider>> NBTEntityProviders = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> headFMPProviders = new LinkedHashMap<String, ArrayList<IWailaFMPProvider>>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> bodyFMPProviders = new LinkedHashMap<String, ArrayList<IWailaFMPProvider>>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> tailFMPProviders = new LinkedHashMap<String, ArrayList<IWailaFMPProvider>>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> headFMPProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> bodyFMPProviders = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> tailFMPProviders = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPDecorator>> FMPClassDecorators = new LinkedHashMap<String, ArrayList<IWailaFMPDecorator>>();
|
||||
public LinkedHashMap<String, ArrayList<IWailaFMPDecorator>> FMPClassDecorators = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<Class, HashSet<String>> syncedNBTKeys = new LinkedHashMap<Class, HashSet<String>>();
|
||||
public LinkedHashMap<Class, HashSet<String>> syncedNBTKeys = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<String, LinkedHashMap<String, LinkedHashMap<String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap<String, LinkedHashMap<String, String>>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
|
||||
public LinkedHashMap<String, LinkedHashMap<String, LinkedHashMap<String, String>>> wikiDescriptions = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<String, String> IMCRequests = new LinkedHashMap<String, String>();
|
||||
public LinkedHashMap<String, String> IMCRequests = new LinkedHashMap<>();
|
||||
|
||||
public LinkedHashMap<String, IWailaTooltipRenderer> tooltipRenderers = new LinkedHashMap<String, IWailaTooltipRenderer>();
|
||||
public LinkedHashMap<String, IWailaTooltipRenderer> tooltipRenderers = new LinkedHashMap<>();
|
||||
|
||||
private ModuleRegistrar() {
|
||||
instance = this;
|
||||
@@ -201,7 +201,7 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
dataProvider.getClass().getName(),
|
||||
clazz));
|
||||
|
||||
if (!target.containsKey(clazz)) target.put(clazz, new ArrayList<T>());
|
||||
if (!target.containsKey(clazz)) target.put(clazz, new ArrayList<>());
|
||||
|
||||
ArrayList<T> providers = target.get(clazz);
|
||||
if (providers.contains(dataProvider)) return;
|
||||
@@ -212,7 +212,7 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
@Deprecated
|
||||
@Override
|
||||
public void registerSyncedNBTKey(String key, Class target) {
|
||||
if (!this.syncedNBTKeys.containsKey(target)) this.syncedNBTKeys.put(target, new HashSet<String>());
|
||||
if (!this.syncedNBTKeys.containsKey(target)) this.syncedNBTKeys.put(target, new HashSet<>());
|
||||
|
||||
this.syncedNBTKeys.get(target).add(key);
|
||||
}
|
||||
@@ -298,7 +298,7 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
}
|
||||
|
||||
private <T> Map<Integer, List<T>> getProviders(Object obj, LinkedHashMap<Class, ArrayList<T>> target) {
|
||||
Map<Integer, List<T>> returnList = new TreeMap<Integer, List<T>>();
|
||||
Map<Integer, List<T>> returnList = new TreeMap<>();
|
||||
Integer index = 0;
|
||||
|
||||
for (Class clazz : target.keySet()) {
|
||||
@@ -311,14 +311,14 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
}
|
||||
|
||||
private <T> Map<Integer, List<T>> getProviders(String name, LinkedHashMap<String, ArrayList<T>> target) {
|
||||
Map<Integer, List<T>> returnList = new TreeMap<Integer, List<T>>();
|
||||
Map<Integer, List<T>> returnList = new TreeMap<>();
|
||||
returnList.put(0, target.get(name));
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public HashSet<String> getSyncedNBTKeys(Object target) {
|
||||
HashSet<String> returnList = new HashSet<String>();
|
||||
HashSet<String> returnList = new HashSet<>();
|
||||
for (Class clazz : this.syncedNBTKeys.keySet())
|
||||
if (clazz.isInstance(target)) returnList.addAll(this.syncedNBTKeys.get(clazz));
|
||||
|
||||
@@ -407,24 +407,6 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
}
|
||||
|
||||
/* ----------------- */
|
||||
/*
|
||||
* @Override public void registerDocTextFile(String filename) { List<String[]> docData = null; int nentries = 0;
|
||||
* try{ docData = this.readFileAsString(filename); } catch (IOException e){ Waila.log.log(Level.WARN,
|
||||
* String.format("Error while accessing file %s : %s", filename, e)); return; } for (String[] ss : docData){ String
|
||||
* modid = ss[0]; String name = ss[1]; String meta = ss[2]; String desc = ss[5].replace('$', '\n'); if
|
||||
* (!(desc.trim().equals(""))){ if (!this.wikiDescriptions.containsKey(modid)) this.wikiDescriptions.put(modid, new
|
||||
* LinkedHashMap <String, LinkedHashMap <String, String>>()); if
|
||||
* (!this.wikiDescriptions.get(modid).containsKey(name)) this.wikiDescriptions.get(modid).put(name, new
|
||||
* LinkedHashMap<String, String>()); this.wikiDescriptions.get(modid).get(name).put(meta, desc);
|
||||
* System.out.printf("Registered %s %s %s\n", modid, name, meta); nentries += 1; } } // String[] sections =
|
||||
* docData.split(">>>>"); // for (String s : sections){ // s.trim(); // if (!s.equals("")){ // try{ // String name =
|
||||
* s.split("\r?\n",2)[0].trim(); // String desc = s.split("\r?\n",2)[1].trim(); // if
|
||||
* (!this.wikiDescriptions.containsKey(modid)) // this.wikiDescriptions.put(modid, new LinkedHashMap <String,
|
||||
* String>()); // this.wikiDescriptions.get(modid).put(name, desc); // nentries += 1; // }catch (Exception e){ //
|
||||
* System.out.printf("%s\n", e); // } // } // } Waila.log.log(Level.INFO,
|
||||
* String.format("Registered %s entries from %s", nentries, filename)); }
|
||||
*/
|
||||
|
||||
public boolean hasDocTextModID(String modid) {
|
||||
return this.wikiDescriptions.containsKey(modid);
|
||||
}
|
||||
@@ -465,10 +447,6 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
}
|
||||
|
||||
private List<String[]> readFileAsString(String filePath) throws IOException {
|
||||
// URL fileURL = this.getClass().getResource(filePath);
|
||||
// File filedata = new File(fileURL);
|
||||
// Reader paramReader = new InputStreamReader(this.getClass().getResourceAsStream(filePath));
|
||||
|
||||
InputStream in = getClass().getResourceAsStream(filePath);
|
||||
BufferedReader input = new BufferedReader(new InputStreamReader(in));
|
||||
CSVReader reader = new CSVReader(input);
|
||||
@@ -477,10 +455,5 @@ public class ModuleRegistrar implements IWailaRegistrar {
|
||||
reader.close();
|
||||
|
||||
return myEntries;
|
||||
/*
|
||||
* StringBuffer fileData = new StringBuffer(); //BufferedReader reader = new BufferedReader(paramReader); char[]
|
||||
* buf = new char[1024]; int numRead=0; while((numRead=input.read(buf)) != -1){ String readData =
|
||||
* String.valueOf(buf, 0, numRead); fileData.append(readData); } input.close(); return fileData.toString();
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,18 @@ import mcp.mobius.waila.api.ITaggedList;
|
||||
|
||||
public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
|
||||
Map<E, Set<T>> tags = new HashMap();
|
||||
Map<E, Set<T>> tags = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean add(E e, T tag) {
|
||||
if (!tags.containsKey(e)) tags.put(e, new HashSet<T>());
|
||||
if (!tags.containsKey(e)) tags.put(e, new HashSet<>());
|
||||
tags.get(e).add(tag);
|
||||
return super.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E e, Collection<? extends T> taglst) {
|
||||
if (!tags.containsKey(e)) tags.put(e, new HashSet<T>());
|
||||
if (!tags.containsKey(e)) tags.put(e, new HashSet<>());
|
||||
tags.get(e).addAll(taglst);
|
||||
|
||||
return super.add(e);
|
||||
@@ -33,7 +33,7 @@ public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
public Set<T> getTags(E e) {
|
||||
Set<T> ret = tags.get(e);
|
||||
if (ret == null && this.contains(e)) {
|
||||
tags.put(e, new HashSet<T>());
|
||||
tags.put(e, new HashSet<>());
|
||||
ret = tags.get(e);
|
||||
}
|
||||
return ret;
|
||||
@@ -46,7 +46,7 @@ public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
|
||||
@Override
|
||||
public void addTag(E e, T tag) {
|
||||
if (this.contains(e) && !tags.containsKey(e)) tags.put(e, new HashSet<T>());
|
||||
if (this.contains(e) && !tags.containsKey(e)) tags.put(e, new HashSet<>());
|
||||
|
||||
tags.get(e).add(tag);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
|
||||
@Override
|
||||
public void removeTag(E e, T tag) {
|
||||
if (this.contains(e) && !tags.containsKey(e)) tags.put(e, new HashSet<T>());
|
||||
if (this.contains(e) && !tags.containsKey(e)) tags.put(e, new HashSet<>());
|
||||
|
||||
tags.get(e).remove(tag);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
|
||||
@Override
|
||||
public Set<E> getEntries(T tag) {
|
||||
Set<E> ret = new HashSet();
|
||||
Set<E> ret = new HashSet<>();
|
||||
for (Entry<E, Set<T>> s : tags.entrySet()) {
|
||||
if (s.getValue().contains(tag)) ret.add(s.getKey());
|
||||
}
|
||||
@@ -84,12 +84,13 @@ public class TipList<E, T> extends ArrayList<E> implements ITaggedList<E, T> {
|
||||
|
||||
@Override
|
||||
public String getTagsAsString(E e) {
|
||||
String ret = "";
|
||||
for (T s : tags.get(e)) ret += s.toString() + ",";
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (T s : tags.get(e)) ret.append(s.toString()).append(",");
|
||||
|
||||
if (ret.length() > 0) ret = ret.substring(0, ret.length() - 1);
|
||||
// noinspection SizeReplaceableByIsEmpty
|
||||
if (ret.length() > 0) ret = new StringBuilder(ret.substring(0, ret.length() - 1));
|
||||
|
||||
return ret;
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.SortedSet;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
@@ -37,16 +37,16 @@ public class LangUtil {
|
||||
public String translate(String s, Object... format) {
|
||||
if (prefix != null && !s.startsWith(prefix + ".")) s = prefix + "." + s;
|
||||
String ret = LanguageRegistry.instance().getStringLocalization(s);
|
||||
if (ret.length() == 0) ret = LanguageRegistry.instance().getStringLocalization(s, "en_US");
|
||||
if (ret.length() == 0) ret = StatCollector.translateToLocal(s);
|
||||
if (ret.length() == 0) return s;
|
||||
if (ret.isEmpty()) ret = LanguageRegistry.instance().getStringLocalization(s, "en_US");
|
||||
if (ret.isEmpty()) ret = StatCollector.translateToLocal(s);
|
||||
if (ret.isEmpty()) return s;
|
||||
if (format.length > 0) ret = String.format(ret, format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void addLangFile(InputStream resource, String lang) throws IOException {
|
||||
LanguageRegistry reg = LanguageRegistry.instance();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(resource, "UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8));
|
||||
while (true) {
|
||||
String read = reader.readLine();
|
||||
if (read == null) break;
|
||||
@@ -68,7 +68,7 @@ public class LangUtil {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public LangUtil addLangDir(ResourceLocation dir) {
|
||||
IResourceManager resManager = Minecraft.getMinecraft().getResourceManager();
|
||||
for (Language lang : (SortedSet<Language>) Minecraft.getMinecraft().getLanguageManager().getLanguages()) {
|
||||
for (Language lang : Minecraft.getMinecraft().getLanguageManager().getLanguages()) {
|
||||
String langID = lang.getLanguageCode();
|
||||
IResource langRes;
|
||||
try {
|
||||
|
||||
@@ -7,12 +7,14 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
|
||||
import mcp.mobius.waila.handlers.nei.NEIHandler;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class KeyEvent {
|
||||
|
||||
@@ -21,6 +23,7 @@ public class KeyEvent {
|
||||
public static KeyBinding key_liquid;
|
||||
public static KeyBinding key_recipe;
|
||||
public static KeyBinding key_usage;
|
||||
public static KeyBinding key_show_advanced;
|
||||
|
||||
public KeyEvent() {
|
||||
ClientRegistry
|
||||
@@ -33,47 +36,49 @@ public class KeyEvent {
|
||||
key_recipe = new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3, "Waila"));
|
||||
ClientRegistry.registerKeyBinding(
|
||||
key_usage = new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4, "Waila"));
|
||||
ClientRegistry.registerKeyBinding(
|
||||
key_show_advanced = new KeyBinding(Constants.BIND_WAILA_SHOW_ADVANCED, Keyboard.KEY_LSHIFT, "Waila"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyEvent(KeyInputEvent event) {
|
||||
boolean showKey = key_show.isPressed();
|
||||
if (key_cfg.isPressed()) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.currentScreen == null) {
|
||||
mc.displayGuiScreen(new ScreenConfig(null));
|
||||
}
|
||||
} else if (key_show.isPressed() && ConfigHandler.instance()
|
||||
return;
|
||||
}
|
||||
if (showKey && ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
|
||||
boolean status = ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
|
||||
ConfigHandler.instance()
|
||||
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, !status);
|
||||
boolean status = ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
|
||||
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, !status);
|
||||
} else if (showKey && !ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
|
||||
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
|
||||
} else
|
||||
if (key_show.isPressed() && !ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)) {
|
||||
ConfigHandler.instance()
|
||||
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
|
||||
} else
|
||||
if (key_liquid.isPressed()) {
|
||||
boolean status = ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true);
|
||||
ConfigHandler.instance()
|
||||
.setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, !status);
|
||||
} else if (key_recipe.isPressed()) {
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
try {
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler")
|
||||
.getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, true);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
} else if (key_usage.isPressed()) {
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
try {
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler")
|
||||
.getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, false);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
if (key_liquid.isPressed()) {
|
||||
boolean status = ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, true);
|
||||
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, !status);
|
||||
} else if (LoadedMods.NEI && key_recipe.isPressed()) {
|
||||
NEIHandler.openRecipeGUI(true);
|
||||
} else if (LoadedMods.NEI && key_usage.isPressed()) {
|
||||
NEIHandler.openRecipeGUI(false);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickClient(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.START) return;
|
||||
if (!KeyEvent.key_show.getIsKeyPressed()
|
||||
&& !ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)
|
||||
&& ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false)) {
|
||||
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,9 +4,10 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import mcp.mobius.waila.Waila;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import mcp.mobius.waila.api.impl.DataAccessorCommon;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.gui.truetyper.FontLoader;
|
||||
@@ -14,17 +15,21 @@ import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerEntities;
|
||||
import mcp.mobius.waila.handlers.VanillaTooltipHandler;
|
||||
import mcp.mobius.waila.handlers.nei.NEIHandler;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderAspectString;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderFluidBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderHealth;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderProgressBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderRFBar;
|
||||
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderStack;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
import mcp.mobius.waila.utils.LoadedMods;
|
||||
|
||||
public class ProxyClient extends ProxyServer {
|
||||
|
||||
TrueTypeFont minecraftiaFont;
|
||||
|
||||
// public static LangUtil lang = LangUtil.loadLangDir("waila");
|
||||
|
||||
public ProxyClient() {}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +37,8 @@ public class ProxyClient extends ProxyServer {
|
||||
|
||||
LangUtil.loadLangDir("waila");
|
||||
|
||||
// TickRegistry.registerTickHandler(WailaTickHandler.instance(), Side.CLIENT);
|
||||
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
try {
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("register").invoke(null);
|
||||
} catch (Exception e) {
|
||||
Waila.log.error("Failed to hook into NEI properly. Reverting to Vanilla tooltip handler");
|
||||
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
|
||||
}
|
||||
if (LoadedMods.NEI) {
|
||||
NEIHandler.register();
|
||||
} else {
|
||||
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
|
||||
}
|
||||
@@ -52,15 +50,20 @@ public class ProxyClient extends ProxyServer {
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerEntities(), Entity.class);
|
||||
ModuleRegistrar.instance().registerTailProvider(new HUDHandlerEntities(), Entity.class);
|
||||
|
||||
// ModuleRegistrar.instance().registerShortDataProvider(new SummaryProviderDefault(), Item.class);
|
||||
|
||||
ModuleRegistrar.instance().addConfig("General", "general.showents");
|
||||
ModuleRegistrar.instance().addConfig("General", "general.showhp");
|
||||
ModuleRegistrar.instance().addConfig("General", "general.showcrop");
|
||||
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.health", new TTRenderHealth());
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.stack", new TTRenderStack());
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.bar", new TTRenderBar());
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.progress", new TTRenderProgressBar());
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.fluid", new TTRenderFluidBar());
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.rfenergy", new TTRenderRFBar());
|
||||
|
||||
ModuleRegistrar.instance().registerTooltipRenderer("waila.tcaspect", new TTRenderAspectString());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new WorldUnloadEventHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,4 +73,13 @@ public class ProxyClient extends ProxyServer {
|
||||
return this.minecraftiaFont;
|
||||
}
|
||||
|
||||
public static class WorldUnloadEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldUnload(WorldEvent.Unload event) {
|
||||
if (event.world.isRemote) {
|
||||
DataAccessorCommon.instance = new DataAccessorCommon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package mcp.mobius.waila.client;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
|
||||
|
||||
public class WailaGuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return ScreenConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -15,83 +15,83 @@ public class CommandDumpHandlers extends CommandBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender p_71518_1_) {
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/dumphandlers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
|
||||
System.out.printf("\n\n== HEAD BLOCK PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().headBlockProviders.keySet()) {
|
||||
System.out.print("\n\n== HEAD BLOCK PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().headBlockProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaDataProvider provider : ModuleRegistrar.instance().headBlockProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== BODY BLOCK PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().bodyBlockProviders.keySet()) {
|
||||
System.out.print("\n\n== BODY BLOCK PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().bodyBlockProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaDataProvider provider : ModuleRegistrar.instance().bodyBlockProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== TAIL BLOCK PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().tailBlockProviders.keySet()) {
|
||||
System.out.print("\n\n== TAIL BLOCK PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().tailBlockProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaDataProvider provider : ModuleRegistrar.instance().tailBlockProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== STACK BLOCK PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().stackBlockProviders.keySet()) {
|
||||
System.out.print("\n\n== STACK BLOCK PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().stackBlockProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaDataProvider provider : ModuleRegistrar.instance().stackBlockProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== HEAD ENTITY PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().headEntityProviders.keySet()) {
|
||||
System.out.print("\n\n== HEAD ENTITY PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().headEntityProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaEntityProvider provider : ModuleRegistrar.instance().headEntityProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== BODY ENTITY PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().bodyEntityProviders.keySet()) {
|
||||
System.out.print("\n\n== BODY ENTITY PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().bodyEntityProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaEntityProvider provider : ModuleRegistrar.instance().bodyEntityProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== TAIL ENTITY PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().tailEntityProviders.keySet()) {
|
||||
System.out.print("\n\n== TAIL ENTITY PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().tailEntityProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaEntityProvider provider : ModuleRegistrar.instance().tailEntityProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
System.out.printf("\n\n== STACK ENTITY PROVIDERS ==\n");
|
||||
for (Class clazz : ModuleRegistrar.instance().overrideEntityProviders.keySet()) {
|
||||
System.out.print("\n\n== STACK ENTITY PROVIDERS ==\n");
|
||||
for (Class<?> clazz : ModuleRegistrar.instance().overrideEntityProviders.keySet()) {
|
||||
System.out.printf("+ %s +\n", clazz.getName());
|
||||
for (IWailaEntityProvider provider : ModuleRegistrar.instance().overrideEntityProviders.get(clazz)) {
|
||||
System.out.printf(" - %s\n", provider.getClass().getName());
|
||||
}
|
||||
System.out.printf("\n");
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,8 +103,6 @@ public class CommandDumpHandlers extends CommandBase {
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
// if ((sender instanceof EntityPlayerMP) && ((EntityPlayerMP)sender).playerNetServerHandler.netManager
|
||||
// instanceof MemoryConnection) return true;
|
||||
return super.canCommandSenderUseCommand(sender);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class MouseEvent {
|
||||
WHEEL,
|
||||
ENTER,
|
||||
LEAVE
|
||||
};
|
||||
}
|
||||
|
||||
public long timestamp;
|
||||
public Minecraft mc;
|
||||
@@ -41,12 +41,6 @@ public class MouseEvent {
|
||||
- (double) Mouse.getEventY() * (double) this.srcwidget.getSize().getY() / (double) this.mc.displayHeight
|
||||
- 1.0;
|
||||
|
||||
// this.x = Mouse.getEventX();
|
||||
// this.y = Mouse.getEventY();
|
||||
|
||||
// System.out.printf("%s %s\n", this.x, this.y);
|
||||
|
||||
// this.z = Mouse.getEventDWheel();
|
||||
this.z = Mouse.getDWheel();
|
||||
|
||||
for (int i = 0; i < buttonCount; i++) buttonState[i] = Mouse.isButtonDown(i);
|
||||
@@ -55,16 +49,22 @@ public class MouseEvent {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String retstring = String
|
||||
.format("MOUSE %s : [%s] [ %.2f %.2f %d ] [", this.type, this.timestamp, this.x, this.y, this.z);
|
||||
if (this.buttonCount < 5)
|
||||
for (int i = 0; i < this.buttonCount; i++) retstring += String.format(" %s ", this.buttonState[i]);
|
||||
else for (int i = 0; i < 5; i++) retstring += String.format(" %s ", this.buttonState[i]);
|
||||
retstring += "]";
|
||||
StringBuilder retstring = new StringBuilder(
|
||||
String.format(
|
||||
"MOUSE %s : [%s] [ %.2f %.2f %d ] [",
|
||||
this.type,
|
||||
this.timestamp,
|
||||
this.x,
|
||||
this.y,
|
||||
this.z));
|
||||
if (buttonCount < 5)
|
||||
for (int i = 0; i < buttonCount; i++) retstring.append(String.format(" %s ", this.buttonState[i]));
|
||||
else for (int i = 0; i < 5; i++) retstring.append(String.format(" %s ", this.buttonState[i]));
|
||||
retstring.append("]");
|
||||
|
||||
if (this.button != -1) retstring += String.format(" Button %s", this.button);
|
||||
if (this.button != -1) retstring.append(String.format(" Button %s", this.button));
|
||||
|
||||
return retstring;
|
||||
return retstring.toString();
|
||||
}
|
||||
|
||||
// Returns the event type based on the previous mouse event.
|
||||
@@ -82,9 +82,9 @@ public class MouseEvent {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.buttonCount; i++) {
|
||||
for (int i = 0; i < buttonCount; i++) {
|
||||
if (this.buttonState[i] != me.buttonState[i]) {
|
||||
if (this.buttonState[i] == true) this.type = EventType.CLICK;
|
||||
if (this.buttonState[i]) this.type = EventType.CLICK;
|
||||
else this.type = EventType.RELEASED;
|
||||
this.button = i;
|
||||
return this.type;
|
||||
@@ -93,7 +93,7 @@ public class MouseEvent {
|
||||
|
||||
// MOVE & DRAG EVENTS (we moved the mouse and button 0 was clicked or not)
|
||||
if ((this.x != me.x) || (this.y != me.y)) {
|
||||
if (this.buttonState[0] == true) this.type = EventType.DRAG;
|
||||
if (this.buttonState[0]) this.type = EventType.DRAG;
|
||||
else this.type = EventType.MOVE;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import com.google.common.collect.Lists;
|
||||
|
||||
public class ReverseIterator<T> implements Iterable<T> {
|
||||
|
||||
private ListIterator<T> listIterator;
|
||||
private final ListIterator<T> listIterator;
|
||||
|
||||
public ReverseIterator(Collection<T> wrappedList) {
|
||||
List list = Lists.newArrayList(wrappedList);
|
||||
List<T> list = Lists.newArrayList(wrappedList);
|
||||
this.listIterator = list.listIterator(wrappedList.size());
|
||||
}
|
||||
|
||||
public Iterator<T> iterator() {
|
||||
return new Iterator<T>() {
|
||||
return new Iterator<>() {
|
||||
|
||||
public boolean hasNext() {
|
||||
return listIterator.hasPrevious();
|
||||
|
||||
@@ -21,25 +21,10 @@ public class UIHelper {
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(
|
||||
(double) (posX + 0),
|
||||
(double) (posY + sizeY),
|
||||
(double) zLevel,
|
||||
texU * f,
|
||||
(texV + texSizeV) * f);
|
||||
tess.addVertexWithUV(
|
||||
(double) (posX + sizeX),
|
||||
(double) (posY + sizeY),
|
||||
(double) zLevel,
|
||||
(texU + texSizeU) * f,
|
||||
(texV + texSizeV) * f);
|
||||
tess.addVertexWithUV(
|
||||
(double) (posX + sizeX),
|
||||
(double) (posY + 0),
|
||||
(double) zLevel,
|
||||
(texU + texSizeU) * f,
|
||||
texV * f);
|
||||
tess.addVertexWithUV((double) (posX + 0), (double) (posY + 0), (double) zLevel, texU * f, texV * f);
|
||||
tess.addVertexWithUV(posX, posY + sizeY, zLevel, texU * f, (texV + texSizeV) * f);
|
||||
tess.addVertexWithUV(posX + sizeX, posY + sizeY, zLevel, (texU + texSizeU) * f, (texV + texSizeV) * f);
|
||||
tess.addVertexWithUV(posX + sizeX, posY, zLevel, (texU + texSizeU) * f, texV * f);
|
||||
tess.addVertexWithUV(posX, posY, zLevel, texU * f, texV * f);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@@ -60,11 +45,11 @@ public class UIHelper {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(red1, green1, blue1, alpha1);
|
||||
tessellator.addVertex((double) maxx, (double) miny, (double) zlevel);
|
||||
tessellator.addVertex((double) minx, (double) miny, (double) zlevel);
|
||||
tessellator.addVertex(maxx, miny, zlevel);
|
||||
tessellator.addVertex(minx, miny, zlevel);
|
||||
tessellator.setColorRGBA_F(red2, green2, blue2, alpha2);
|
||||
tessellator.addVertex((double) minx, (double) maxy, (double) zlevel);
|
||||
tessellator.addVertex((double) maxx, (double) maxy, (double) zlevel);
|
||||
tessellator.addVertex(minx, maxy, zlevel);
|
||||
tessellator.addVertex(maxx, maxy, zlevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
@@ -123,7 +108,6 @@ public class UIHelper {
|
||||
public static void drawBillboard(float posX, float posY, float posZ, float offX, float offY, float offZ, float rotX,
|
||||
float rotY, float rotZ, double x1, double y1, double x2, double y2, int r, int g, int b, int a) {
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef(posX + offX, posY + offY, posZ + offZ);
|
||||
@@ -133,14 +117,12 @@ public class UIHelper {
|
||||
GL11.glRotatef(rotX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(rotZ, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
// GL11.glScalef(-f1, -f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
drawRectangle(x1, y1, 0, x2, y2, 0, r, g, b, a);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
@@ -196,16 +178,12 @@ public class UIHelper {
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// GL11.glTranslatef((float)accessor.getPosition().blockX + 0.0F, (float)accessor.getPosition().blockY + 0.5F,
|
||||
// (float)accessor.getPosition().blockZ);
|
||||
GL11.glTranslatef(posX + offX, posY + offY, posZ + offZ);
|
||||
|
||||
// GL11.glTranslatef(posX, posY, posZ);
|
||||
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(rotY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(rotX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(rotZ, 0.0F, 0.0F, 1.0F);
|
||||
// GL11.glTranslatef(offX, offY, offZ);
|
||||
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -217,26 +195,14 @@ public class UIHelper {
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
int j = fontrenderer.getStringWidth(text) / 2;
|
||||
drawRectangle(
|
||||
(double) (-j - 1),
|
||||
(double) (8 + b0),
|
||||
0.0,
|
||||
(double) (j + 1),
|
||||
(double) (-1 + b0),
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
64);
|
||||
drawRectangle(-j - 1, 8 + b0, 0.0, j + 1, -1 + b0, 0.0, 0, 0, 0, 64);
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, 553648127);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, -1);
|
||||
// GL11.glEnable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ public enum CType {
|
||||
REL_X,
|
||||
REL_Y,
|
||||
RELXY,
|
||||
ABSXY;
|
||||
ABSXY
|
||||
}
|
||||
@@ -84,9 +84,4 @@ public interface IWidget {
|
||||
void emit(Signal signal, Object... params);
|
||||
|
||||
void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params);
|
||||
|
||||
// boolean onMouseEnter();
|
||||
// boolean onMouseMoved();
|
||||
// boolean onMouseLeave();
|
||||
|
||||
}
|
||||
@@ -3,5 +3,5 @@ package mcp.mobius.waila.gui.interfaces;
|
||||
public enum RenderPriority {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH;
|
||||
HIGH
|
||||
}
|
||||
@@ -4,5 +4,5 @@ public enum Signal {
|
||||
DRAGGED,
|
||||
CLICKED,
|
||||
VALUE_CHANGED,
|
||||
GEOM_CHANGED;
|
||||
GEOM_CHANGED
|
||||
}
|
||||
@@ -5,5 +5,5 @@ public enum WAlign {
|
||||
CENTER,
|
||||
RIGHT,
|
||||
TOP,
|
||||
BOTTOM;
|
||||
BOTTOM
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public abstract class ScreenBase extends GuiScreen {
|
||||
public ScreenBase(GuiScreen parent) {
|
||||
this.parent = parent;
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.widgets = new HashMap<String, IWidget>();
|
||||
this.widgets = new HashMap<>();
|
||||
|
||||
this.addWidget("canvas", new LayoutCanvas());
|
||||
|
||||
@@ -41,9 +41,7 @@ public abstract class ScreenBase extends GuiScreen {
|
||||
}
|
||||
|
||||
public IWidget delWidget(String name) {
|
||||
IWidget widget = this.getWidget(name);
|
||||
this.widgets.remove(widget);
|
||||
return widget;
|
||||
return this.widgets.remove(name);
|
||||
}
|
||||
|
||||
public IWidget getRoot() {
|
||||
@@ -75,7 +73,7 @@ public abstract class ScreenBase extends GuiScreen {
|
||||
@Override
|
||||
public void keyTyped(char keyChar, int keyID) {
|
||||
if (keyID == 1) if (this.parent == null) {
|
||||
this.mc.displayGuiScreen((GuiScreen) null);
|
||||
this.mc.displayGuiScreen(null);
|
||||
this.mc.setIngameFocus();
|
||||
} else this.mc.displayGuiScreen(this.parent);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import mcp.mobius.waila.utils.Constants;
|
||||
|
||||
public class ScreenHUDConfig extends ScreenBase {
|
||||
|
||||
private class EventCanvas extends LayoutBase {
|
||||
private static class EventCanvas extends LayoutBase {
|
||||
|
||||
IWidget draggedWidget = null;
|
||||
|
||||
@@ -33,28 +33,6 @@ public class ScreenHUDConfig extends ScreenBase {
|
||||
super(parent);
|
||||
this.setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 100.0, CType.RELXY, CType.RELXY));
|
||||
|
||||
/*
|
||||
* IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this)); layoutX.setGeometry(new
|
||||
* WidgetGeometry(40.0,50.0,20,60, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
* layoutX.addWidget("ButtonXAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0,
|
||||
* 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP)); layoutX.addWidget("ButtonXSub", new
|
||||
* ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY,
|
||||
* WAlign.LEFT, WAlign.BOTTOM)); layoutX.addWidget("ValueDisplayX", new LabelFixedFont(null,
|
||||
* "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER,
|
||||
* WAlign.CENTER));
|
||||
*/
|
||||
|
||||
/*
|
||||
* IWidget layoutY = this.addWidget("LayoutY", new LayoutBase(this)); layoutY.setGeometry(new
|
||||
* WidgetGeometry(50.0,50.0,20,60,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
* layoutY.addWidget("ButtonYAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0,
|
||||
* 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP)); layoutY.addWidget("ButtonYSub", new
|
||||
* ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY,
|
||||
* WAlign.LEFT, WAlign.BOTTOM)); layoutY.addWidget("ValueDisplayY", new LabelFixedFont(null,
|
||||
* "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER,
|
||||
* WAlign.CENTER));
|
||||
*/
|
||||
|
||||
double picX = ConfigHandler.instance()
|
||||
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 0) / 100.0;
|
||||
double picY = ConfigHandler.instance()
|
||||
@@ -81,7 +59,7 @@ public class ScreenHUDConfig extends ScreenBase {
|
||||
WAlign.CENTER));
|
||||
|
||||
this.addWidget("TextTuto1", new LabelFixedFont(null, "screen.label.dragtuto")).setGeometry(
|
||||
new WidgetGeometry(50.0, 30.0, 20, 20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));;
|
||||
new WidgetGeometry(50.0, 30.0, 20, 20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
|
||||
layoutX.setGeometry(
|
||||
@@ -169,8 +147,6 @@ public class ScreenHUDConfig extends ScreenBase {
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event) {
|
||||
// System.out.println(this.getWidgetAtCoordinates(event.x, event.y));
|
||||
|
||||
if ((event.button == 0)
|
||||
&& (this.getWidget("Layout").getWidget("Picture").isWidgetAtCoordinates(event.x, event.y))) {
|
||||
this.getWidget("Layout").getWidget("Picture").onMouseClick(event);
|
||||
@@ -180,8 +156,6 @@ public class ScreenHUDConfig extends ScreenBase {
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event) {
|
||||
|
||||
// if ((this.getWidgetAtCoordinates(event.x, event.y) == this) && (this.draggedWidget != null)){
|
||||
if (this.draggedWidget != null) {
|
||||
this.draggedWidget.onMouseDrag(event);
|
||||
} else {
|
||||
@@ -276,7 +250,6 @@ public class ScreenHUDConfig extends ScreenBase {
|
||||
((LayoutMargin) this.getWidget("Layout")).setMargins(picSX / 2, picSX / 2, picSY / 2, picSY / 2);
|
||||
}
|
||||
|
||||
// picture.emit(Signal.DRAGGED, picture.getPos());
|
||||
this.updateData();
|
||||
|
||||
}
|
||||
|
||||
@@ -16,20 +16,16 @@ import mcp.mobius.waila.utils.Constants;
|
||||
|
||||
public class ScreenModuleConfig extends ScreenBase {
|
||||
|
||||
private String modName;
|
||||
|
||||
public ScreenModuleConfig(GuiScreen parent, String modname) {
|
||||
super(parent);
|
||||
|
||||
this.modName = modname;
|
||||
|
||||
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
|
||||
this.getRoot().getWidget("ButtonContainer").setGeometry(
|
||||
new WidgetGeometry(0.0, 20.0, 100.0, 60.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel) this.getRoot().getWidget("ButtonContainer"));
|
||||
|
||||
for (String key : ConfigHandler.instance().getConfigKeys(this.modName).keySet()) {
|
||||
for (String key : ConfigHandler.instance().getConfigKeys(modname).keySet()) {
|
||||
if (ConfigHandler.instance().isServerRequired(key)) buttonContainer.addButton(
|
||||
new ButtonBooleanConfigRemote(
|
||||
this.getRoot(),
|
||||
@@ -37,7 +33,7 @@ public class ScreenModuleConfig extends ScreenBase {
|
||||
key,
|
||||
"screen.button.no",
|
||||
"screen.button.yes"),
|
||||
ConfigHandler.instance().getConfigKeys(this.modName).get(key));
|
||||
ConfigHandler.instance().getConfigKeys(modname).get(key));
|
||||
else buttonContainer.addButton(
|
||||
new ButtonBooleanConfig(
|
||||
this.getRoot(),
|
||||
@@ -45,12 +41,7 @@ public class ScreenModuleConfig extends ScreenBase {
|
||||
key,
|
||||
"screen.button.no",
|
||||
"screen.button.yes"),
|
||||
ConfigHandler.instance().getConfigKeys(this.modName).get(key));
|
||||
// buttonContainer.addButton(new ButtonConfigRemote(-1, "No", "Yes",
|
||||
// ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
|
||||
// else
|
||||
// buttonContainer.addButton(new ButtonConfigOption(-1, "No", "Yes",
|
||||
// ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
|
||||
ConfigHandler.instance().getConfigKeys(modname).get(key));
|
||||
}
|
||||
|
||||
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
|
||||
|
||||
@@ -84,6 +84,16 @@ public class ScreenWailaConfig extends ScreenBase {
|
||||
"screen.button.no",
|
||||
"screen.button.yes"),
|
||||
"choice.shifttoggledents");
|
||||
buttonContainer.addButton(
|
||||
new ButtonBooleanConfig(
|
||||
this.getRoot(),
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
Constants.CFG_WAILA_SHOWICON,
|
||||
true,
|
||||
false,
|
||||
"screen.button.no",
|
||||
"screen.button.yes"),
|
||||
"choice.showicon");
|
||||
|
||||
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutConfigPos")
|
||||
|
||||
@@ -43,9 +43,9 @@ public class ScreenEnchants extends ScreenBase {
|
||||
new WidgetGeometry(50.0, 50.0, 90.0, 80.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
|
||||
|
||||
String columnName = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.name");
|
||||
String columnMinLvl = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.minlvl");;
|
||||
String columnMaxLvl = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.maxlvl");;
|
||||
String columnWeight = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.weight");;
|
||||
String columnMinLvl = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.minlvl");
|
||||
String columnMaxLvl = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.maxlvl");
|
||||
String columnWeight = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.weight");
|
||||
|
||||
((ViewTable) this.getRoot().getWidget("Table"))
|
||||
.setColumnsTitle(columnName, columnMinLvl, columnMaxLvl, columnWeight, "\u00a7a\u00a7oMod")
|
||||
@@ -80,9 +80,4 @@ public class ScreenEnchants extends ScreenBase {
|
||||
this.getRoot().getWidget("Layout_Title").adjustSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
* public ScreenEnchants setStack(ItemStack stack){
|
||||
* ((ItemStackDisplay)this.getRoot().getWidget("ItemStack")).setStack(stack); return this; }
|
||||
*/
|
||||
}
|
||||
@@ -21,23 +21,5 @@ public class ScreenTest extends ScreenBase {
|
||||
.addRow("test1", "test2", "test3").addRow("test1", "test2", "test3").addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3").addRow("test1", "test2", "test3").addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3");
|
||||
|
||||
/*
|
||||
* this.getRoot().addWidget("Test", new Row(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 20.0,
|
||||
* CType.RELXY, CType.REL_X, WAlign.CENTER, WAlign.CENTER));
|
||||
* ((Row)this.getRoot().getWidget("Test")).setColumnsText("aabbbbbbbbbbbbbbbbbbbbbbbbb","bb","cc");
|
||||
* ((Row)this.getRoot().getWidget("Test")).setColumnsWidth(30.0,30.0,30.0);
|
||||
* ((Row)this.getRoot().getWidget("Test")).setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER);
|
||||
*/
|
||||
|
||||
// this.getRoot().addWidget("TestLayout", new LayoutBase(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0,
|
||||
// 90.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
// ((LayoutBase)this.getRoot().getWidget("TestLayout")).setBackgroundColors(0xff505050, 0xff505050);
|
||||
|
||||
// this.getRoot().addWidget("Layout", new ViewportScrollable(null)).setGeometry(new
|
||||
// WidgetGeometry(50.0,50.0,75.0,75.0,CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
// ((ViewportScrollable)this.getRoot().getWidget("Layout")).attachWidget(new PictureSwitch(this.getRoot(),
|
||||
// "waila:textures/test.png", "waila:textures/test_solar.png")).setSize(900, 900);
|
||||
|
||||
}
|
||||
}
|
||||
Loaded 100 of 185 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user