Compare commits

..
36 Commits
Author SHA1 Message Date
Johann Bernhardt 66759201a1 Add missing api jar 2021-11-23 21:43:49 +01:00
Johann Bernhardt aa093a4174 Merge pull request #1 from GTNewHorizons/unified-build-script
Unified build script
2021-11-23 14:33:02 +01:00
Johann Bernhardt 2431509d41 Switch to NEI master 2021-11-22 18:51:24 +01:00
Johann Bernhardt 156c9f3905 Shade dependency to openCSV 2021-11-22 13:36:51 +01:00
Johann Bernhardt a1f4378fe7 Migrated to unified build script 2021-11-22 13:24:52 +01:00
Johann Bernhardt af42a25d2e Strip unused core plugin 2021-11-22 13:22:32 +01:00
Thomas Guimbretiere 07b0b83f4a Added localization for NEI keybind.
Fixes issue #185
2015-07-12 19:24:21 +02:00
Thomas Guimbretiere d932d91a77 Potential fix for issue #200
Stupid java 1.6 on macs...
2015-07-12 18:55:01 +02:00
Thomas Guimbretiere 87261267e1 Added tag v1.5.10_1.7.10 for changeset 02ba9c022a25 2015-07-12 18:42:20 +02:00
Thomas Guimbretiere 7af9692632 Added czech translation. Many thx to nalimleinad.
Closes issue #204
2015-07-12 18:33:03 +02:00
Thomas Guimbretiere 1eb78112eb Added a config option (in Modules/General) to turn on/off the display of entity tooltips.
It is located there so it can be enforced server side if required (for pvp, etc).

Fixes issue #196
2015-07-12 18:29:28 +02:00
Thomas Guimbretiere 4ed103dd25 NBT is synced only when the tooltip is visible to reduce ressource usage.
Fixes issue #179
2015-07-12 17:56:04 +02:00
Thomas Guimbretiere 118bab5a2b Updated to latest NEIs and forge 2015-07-12 16:43:29 +02:00
Thomas Guimbretiere ce6474fc29 Fixed case where config is written too many times in "press to show" mode. 2015-05-21 19:13:38 +02:00
Thomas Guimbretiere cbeb3b3628 Fixed derp with logs.
Still have a huge derp with CCC that need to be resolved...
2015-05-16 22:03:25 +02:00
Thomas Guimbretiere d27d6db57c Updated to latest CCC & Forge 2015-05-16 20:38:30 +02:00
Thomas Guimbretiere e60974ab20 Version bump 2015-03-18 16:09:14 +01:00
Thomas Guimbretiere f481e46fb2 Tabbing correction 2015-03-09 18:31:56 +01:00
Thomas Guimbretiere 7638322f7f Merge 2015-03-09 18:29:22 +01:00
Thomas Guimbretiere 0afbc6efb4 Added tag v1.5.9_1.7.10 for changeset 32b8eca2f373 2015-03-09 18:29:13 +01:00
Thomas Guimbretiere 6d97a3a595 Version bump 2015-03-09 18:28:43 +01:00
Lordmau5 737c4e2cbf Added support for Thermal Dynamics (Fluiducts showing content, so far) 2015-03-09 15:46:18 +01:00
Lordmau5 f4f5920d88 Fix for Thermal Expansion stuff - Also added HUD for Caches :) 2015-03-09 15:46:00 +01:00
Lordmau5 ea95fadb78 Fix for Extra Utilities Drums 2015-03-09 15:45:26 +01:00
Lordmau5 77277c6024 Fix for networking code (Fixes issues with data on dedicated servers) 2015-03-09 15:23:18 +01:00
Thomas Guimbretiere 0b85d18865 Reinstanciate the lists in TickHandler to make sure they are not of the wrong type.
All handler getters now return a TreeMap with an index integer to make sure handlers are used in the right order everywhere.
2015-02-10 22:23:22 +01:00
Thomas Guimbretiere 9d0b942667 Returning a stack with a null item from getWailaStack with desactivate the tooltip all together.
A good one to use if new ItemStack(Blocks.air)
2015-02-10 18:08:21 +01:00
Thomas Guimbretiere caf8cf7e7b Desactivated furnace progress display. 2015-02-10 17:34:41 +01:00
Thomas Guimbretiere 01546d40e9 Protected rendering from crashes.
Tried to use TrueTyper without success
Update to latest Gradle
2015-02-10 17:32:43 +01:00
Thomas Guimbretiere 6d6e7616e4 Stack & Progress bar for furnaces, just because I can. 2015-01-05 20:22:56 +01:00
Thomas Guimbretiere 1c2af8da33 Moved renderIcon() from OverlayRenderer to DisplayUtil 2015-01-05 15:52:00 +01:00
Thomas Guimbretiere 197305bf78 Display of text vs hearts is based on max health now, not current health. 2015-01-05 15:38:15 +01:00
Thomas Guimbretiere 8483573146 Added a custom renderer for health bars 2015-01-05 15:27:55 +01:00
Thomas Guimbretiere a05c6aa6d7 Added size hint for icon special char 2015-01-05 14:38:32 +01:00
Thomas Guimbretiere 28196d451e Added tag v1.5.8a_1.7.10 for changeset ef5c83a57257 2015-01-04 16:26:13 +01:00
Thomas Guimbretiere e83009414e Version bump 2015-01-04 16:19:56 +01:00
70 changed files with 2013 additions and 2027 deletions

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
directory="run/crash-reports"
if [ -d $directory ]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
else
echo "No crash reports detected"
exit 0
fi
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1 minute
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 10 ./gradlew runServer || true
- name: Test no crashes happend
run: |
chmod +x .github/scripts/test-no-crash-reports.sh
.github/scripts/test-no-crash-reports.sh
+44
View File
@@ -0,0 +1,44 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release latest build
on:
push:
branches: [ master, main ]
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Update latest tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Latest build"
files: build/libs/*.jar
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
+28
View File
@@ -0,0 +1,28 @@
.gradle
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
-2
View File
@@ -1,2 +0,0 @@
syntax: glob
*.orig
-25
View File
@@ -1,25 +0,0 @@
28ccc9a07b5421f7e529c417b9baf0cf0a384d9f v1.2.0
38f148ebeb8f6cfbdbaff0afc93612eb297188cd v1.3.1
4a92f4e3296c1b64557ecf30023c61badf598a3e 1.3.2
8ee781ebab6c82631601fee3dc1fb4d3a03f9351 1.3.3
2f6144f8e55ca2f0fa6ccbbee707ca58f5e75c80 1.3.4
45e01e7ee1a8e1587832e388584fd102672066ae 1.3.8_1.6.2
1e7cde94ccceb8c1425a03c90fe2523afbe20d53 1.3.9_1.6.2
02ebbb4aeebe23b3eaaded32bda20dad2fe14381 Nightly_131024
bc4937f3a7d4c8eef31b8273cab6e043a8b354ef Nightly_131025
246642120b36fb05ed2682ef79e7b48020edf21d Nightly_131116
9280666656c77770a35c2797129f9fb806ed6367 Nightly_13111
d2ec5e84d19f679d5b482112ed1fab4cb4d0b427 Nightly_131118
c7e3d16cb236195aaa6d978fe15706d63831a4e2 Nightly_131121a
e8b1906c3f51a14a12539850404b4622311b936b v1.4.0
f9daea609042db35e35989da99a1c4c8696eb8ab 1.4.1
1c391d52f3d955eebe3437d81dd8eca8ca142a8c 1.4.3
7ff010d0fad85eb59eca7f1bc6583a6dada6ef8d 1.4.5
5dd753fa7c80d22c3526714d48cf9c3a01918dec 1.4.5a
1066f782daede2a968ec282d4e3eba5a6ec74a53 Waila_1.5.0_dev2
ad46f8b41bbe08c95a6ae4a6c609be96196148ca Waila_1.5.0
<<<<<<< local
be89d97648acdc95afe1f7fea6a190641ae629d5 v1.5.2
=======
bb4fc720238a6545946c35de78e417141625a69c v1.4.5_1.7.2
>>>>>>> other
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

+460 -108
View File
@@ -1,153 +1,505 @@
//version: eb0b030ab9cb1d0f9a31f11e69e1ceed1dab2c89
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.util.concurrent.TimeUnit
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
}
}
plugins {
id 'idea'
id 'scala'
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
}
apply plugin: 'forge'
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
checkPropertyExists("autoUpdateBuildScript")
checkPropertyExists("minecraftVersion")
checkPropertyExists("forgeVersion")
checkPropertyExists("replaceGradleTokenInFile")
checkPropertyExists("gradleTokenModId")
checkPropertyExists("gradleTokenModName")
checkPropertyExists("gradleTokenVersion")
checkPropertyExists("gradleTokenGroupName")
checkPropertyExists("apiPackage")
checkPropertyExists("accessTransformersFile")
checkPropertyExists("usesMixins")
checkPropertyExists("mixinPlugin")
checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
}
if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(new File(targetFile).exists() == false) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
if(usesMixins.toBoolean()) {
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
}
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
// Make sure GregTech build won't time out
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
}
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute()
// Pulls version from git tag
version = minecraftVersion + "-" + gitVersion()
group = modGroup
archivesBaseName = modId
minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if(gradleTokenModId) {
replace gradleTokenModId, modId
}
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
}
if(gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
}
}
}
if(file("addon.gradle").exists()) {
apply from: "addon.gradle"
}
apply from: 'repositories.gradle'
configurations {
deployerJars
//packed
//compile.extendsFrom packed
implementation.extendsFrom(shadowImplementation)
}
//add dependency repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://jitpack.io"
}
}
}
apply plugin: 'java'
apply plugin: 'forge'
apply plugin: 'maven'
version = "1.5.8_1.7.10"
group= "mcp.mobius.waila" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Waila"
// Define properties file
ext.configFile = file "build.properties"
configFile.withReader {
// Load config. It shall from now be referenced as simply config or project.config
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
dependencies {
compile "codechicken:CodeChickenLib:${config.mc_version}-${config.ccl_version}:dev"
compile "codechicken:CodeChickenCore:${config.mc_version}-${config.ccc_version}:dev"
compile "codechicken:NotEnoughItems:${config.mc_version}-${config.nei_version}:dev"
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}
minecraft {
version = "1.7.10-10.13.2.1264"
runDir = "eclipse"
}
def root = project.projectDir.parentFile
sourceSets {
main {
java {
srcDir new File(root, "src")
if(usesMixins.toBoolean()) {
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
annotationProcessor("com.google.guava:guava:24.1.1-jre")
annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
exclude module: "gson"
exclude module: "commons-io"
exclude module: "log4j-core"
}
resources {
srcDir new File(root, "resources")
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
}
}
apply from: 'dependencies.gradle'
def mixinConfigJson = "mixins." + modId + ".json"
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
if(usesMixins.toBoolean()) {
new File(projectDir.toString() + "/src/main/resources/", mixinConfigJson).text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}
"""
}
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar {
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
dependsOn(relocateShadowJar)
}
jar {
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
reobf {
if(usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
afterEvaluate {
if(usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobf.srg}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
}
}
runClient {
def arguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
if(developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
}
args(arguments)
}
runServer {
def arguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
args(arguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
//def commonManifest = {
// attributes 'FMLCorePlugin': 'mcp.mobius.wailacore.asm.CoreDescription'
// attributes 'FMLCorePluginContainsFMLMod': 'mcp.mobius.waila.Waila'
//}
jar {
exclude "**/client/gui/inventory/GuiContainer.class"
exclude "**/client/gui/inventory/GuiContainer.java"
// manifest commonManifest
// from {
// configurations.packed.collect {
// it.isDirectory() ? it : zipTree(it).matching {
// exclude "META-INF", "META-INF/**", "*META-INF*", "meta-inf"
// exclude "**.jar", "**/*.jar", "*.jar"
// }
// }
// }
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task sourceJar(type: Jar) {
from sourceSets.main.java
from new File(root, "dev")
classifier = 'sources'
task shadowDevJar(type: ShadowJar) {
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
}
}
task apiJar(type: Jar) {
from (sourceSets.main.allJava) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
}
from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
}
from (sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
archives sourceJar, devJar
}
uploadArchives {
dependsOn 'reobf'
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "scp://mobiusstrip.eu/home/mobius/web/maven"){
authentication(userName: "mobius")
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Waila '
url 'http://mobiusstrip.eu'
}
}
archives sourcesJar
archives devJar
if(apiPackage) {
archives apiJar
}
}
// Updating
task updateBuildScript {
doLast {
if (updateBuildScript()) return
print("Build script already up-to-date!")
}
}
if (isNewBuildScriptVersionAvailable()) {
if (autoUpdateBuildScript.toBoolean()) {
updateBuildScript()
} else {
println("Build script update available! Run 'gradle updateBuildScript'")
}
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
}
static boolean updateBuildScript() {
if (isNewBuildScriptVersionAvailable()) {
def buildscriptFile = new File("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
}
static boolean isNewBuildScriptVersionAvailable() {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = new File("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
}
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if(versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
-7
View File
@@ -1,7 +0,0 @@
mc_version=1.7.10
forge_version=10.13.0.1187
ccl_version=1.1.1.106
ccc_version=1.0.4.+
nei_version=1.0.4.+
mod_version=1.0
waila_version=1.5.2a
+7
View File
@@ -0,0 +1,7 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
shadowImplementation("au.com.bytecode:opencsv:2.4")
}
+60
View File
@@ -0,0 +1,60 @@
modName = Waila
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = Waila
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/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer"
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods 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 =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# 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.
usesShadowedDependencies = true
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+188
View File
@@ -0,0 +1,188 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
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.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+100
View File
@@ -0,0 +1,100 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
: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 %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
+7
View File
@@ -0,0 +1,7 @@
// Add any additional repositiroes for your dependencies here
repositories {
maven {
url = "https://jitpack.io"
}
}
@@ -1,323 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV parser released under a commercial-friendly license.
* This just implements splitting a single line into fields.
*
* @author Glen Smith
* @author Rainer Pruy
*/
public class CSVParser {
private final char separator;
private final char quotechar;
private final char escape;
private final boolean strictQuotes;
private String pending;
private boolean inField = false;
private final boolean ignoreLeadingWhiteSpace;
/**
* The default separator to use if none is supplied to the constructor.
*/
public static final char DEFAULT_SEPARATOR = ',';
public static final int INITIAL_READ_SIZE = 128;
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/**
* The default escape character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_ESCAPE_CHARACTER = '\\';
/**
* The default strict quote behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_STRICT_QUOTES = false;
/**
* The default leading whitespace behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE = true;
/**
* This is the "null" character - if a value is set to this then it is ignored.
* I.E. if the quote character is set to null then there is no quote character.
*/
public static final char NULL_CHARACTER = '\0';
/**
* Constructs CSVParser using a comma for the separator.
*/
public CSVParser() {
this(DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator.
*
* @param separator the delimiter to use for separating entries.
*/
public CSVParser(char separator) {
this(separator, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator and quote char.
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
*/
public CSVParser(char separator, char quotechar) {
this(separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
*/
public CSVParser(char separator, char quotechar, char escape) {
this(separator, quotechar, escape, DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" flag
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
* @param strictQuotes if true, characters outside the quotes are ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes) {
this(separator, quotechar, escape, strictQuotes, DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" and "ignore leading whitespace" flags
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
* @param strictQuotes if true, characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace if true, white space in front of a quote in a field is ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
if (anyCharactersAreTheSame(separator, quotechar, escape)) {
throw new UnsupportedOperationException("The separator, quote, and escape characters must be different!");
}
if (separator == NULL_CHARACTER) {
throw new UnsupportedOperationException("The separator character must be defined!");
}
this.separator = separator;
this.quotechar = quotechar;
this.escape = escape;
this.strictQuotes = strictQuotes;
this.ignoreLeadingWhiteSpace = ignoreLeadingWhiteSpace;
}
private boolean anyCharactersAreTheSame(char separator, char quotechar, char escape) {
return isSameCharacter(separator, quotechar) || isSameCharacter(separator, escape) || isSameCharacter(quotechar, escape);
}
private boolean isSameCharacter(char c1, char c2) {
return c1 != NULL_CHARACTER && c1 == c2;
}
/**
* @return true if something was left over from last call(s)
*/
public boolean isPending() {
return pending != null;
}
public String[] parseLineMulti(String nextLine) throws IOException {
return parseLine(nextLine, true);
}
public String[] parseLine(String nextLine) throws IOException {
return parseLine(nextLine, false);
}
/**
* Parses an incoming String and returns an array of elements.
*
* @param nextLine the string to parse
* @param multi
* @return the comma-tokenized list of elements, or null if nextLine is null
* @throws IOException if bad things happen during the read
*/
private String[] parseLine(String nextLine, boolean multi) throws IOException {
if (!multi && pending != null) {
pending = null;
}
if (nextLine == null) {
if (pending != null) {
String s = pending;
pending = null;
return new String[]{s};
} else {
return null;
}
}
List<String> tokensOnThisLine = new ArrayList<String>();
StringBuilder sb = new StringBuilder(INITIAL_READ_SIZE);
boolean inQuotes = false;
if (pending != null) {
sb.append(pending);
pending = null;
inQuotes = true;
}
for (int i = 0; i < nextLine.length(); i++) {
char c = nextLine.charAt(i);
if (c == this.escape) {
if (isNextCharacterEscapable(nextLine, inQuotes || inField, i)) {
sb.append(nextLine.charAt(i + 1));
i++;
}
} else if (c == quotechar) {
if (isNextCharacterEscapedQuote(nextLine, inQuotes || inField, i)) {
sb.append(nextLine.charAt(i + 1));
i++;
} else {
//inQuotes = !inQuotes;
// the tricky case of an embedded quote in the middle: a,bc"d"ef,g
if (!strictQuotes) {
if (i > 2 //not on the beginning of the line
&& nextLine.charAt(i - 1) != this.separator //not at the beginning of an escape sequence
&& nextLine.length() > (i + 1) &&
nextLine.charAt(i + 1) != this.separator //not at the end of an escape sequence
) {
if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) {
sb.setLength(0); //discard white space leading up to quote
} else {
sb.append(c);
//continue;
}
}
}
inQuotes = !inQuotes;
}
inField = !inField;
} else if (c == separator && !inQuotes) {
tokensOnThisLine.add(sb.toString());
sb.setLength(0); // start work on next token
inField = false;
} else {
if (!strictQuotes || inQuotes) {
sb.append(c);
inField = true;
}
}
}
// line is done - check status
if (inQuotes) {
if (multi) {
// continuing a quoted section, re-append newline
sb.append("\n");
pending = sb.toString();
sb = null; // this partial content is not to be added to field list yet
} else {
throw new IOException("Un-terminated quoted field at end of CSV line");
}
}
if (sb != null) {
tokensOnThisLine.add(sb.toString());
}
return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]);
}
/**
* precondition: the current character is a quote or an escape
*
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i + 1) // there is indeed another character to check.
&& nextLine.charAt(i + 1) == quotechar;
}
/**
* precondition: the current character is an escape
*
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i + 1) // there is indeed another character to check.
&& (nextLine.charAt(i + 1) == quotechar || nextLine.charAt(i + 1) == this.escape);
}
/**
* precondition: sb.length() > 0
*
* @param sb A sequence of characters to examine
* @return true if every character in the sequence is whitespace
*/
protected boolean isAllWhiteSpace(CharSequence sb) {
boolean result = true;
for (int i = 0; i < sb.length(); i++) {
char c = sb.charAt(i);
if (!Character.isWhitespace(c)) {
return false;
}
}
return result;
}
}
@@ -1,282 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV reader released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVReader implements Closeable {
private BufferedReader br;
private boolean hasNext = true;
private CSVParser parser;
private int skipLines;
private boolean linesSkiped;
/**
* The default line to start reading.
*/
public static final int DEFAULT_SKIP_LINES = 0;
/**
* Constructs CSVReader using a comma for the separator.
*
* @param reader
* the reader to an underlying CSV source.
*/
public CSVReader(Reader reader) {
this(reader, CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVReader(Reader reader, char separator) {
this(reader, separator, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVReader(Reader reader, char separator, char quotechar) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator, quote char and quote handling
* behavior.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, boolean strictQuotes) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, strictQuotes);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
*/
public CSVReader(Reader reader, char separator,
char quotechar, char escape) {
this(reader, separator, quotechar, escape, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, int line) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line) {
this(reader, separator, quotechar, escape, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) {
this(reader, separator, quotechar, escape, line, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace
* it true, parser should ignore white space before a quote in a field
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
this.br = new BufferedReader(reader);
this.parser = new CSVParser(separator, quotechar, escape, strictQuotes, ignoreLeadingWhiteSpace);
this.skipLines = line;
}
/**
* Reads the entire file into a List with each element being a String[] of
* tokens.
*
* @return a List of String[], with each String[] representing a line of the
* file.
*
* @throws IOException
* if bad things happen during the read
*/
public List<String[]> readAll() throws IOException {
List<String[]> allElements = new ArrayList<String[]>();
while (hasNext) {
String[] nextLineAsTokens = readNext();
if (nextLineAsTokens != null)
allElements.add(nextLineAsTokens);
}
return allElements;
}
/**
* Reads the next line from the buffer and converts to a string array.
*
* @return a string array with each comma-separated element as a separate
* entry.
*
* @throws IOException
* if bad things happen during the read
*/
public String[] readNext() throws IOException {
String[] result = null;
do {
String nextLine = getNextLine();
if (!hasNext) {
return result; // should throw if still pending?
}
String[] r = parser.parseLineMulti(nextLine);
if (r.length > 0) {
if (result == null) {
result = r;
} else {
String[] t = new String[result.length+r.length];
System.arraycopy(result, 0, t, 0, result.length);
System.arraycopy(r, 0, t, result.length, r.length);
result = t;
}
}
} while (parser.isPending());
return result;
}
/**
* Reads the next line from the file.
*
* @return the next line from the file without trailing newline
* @throws IOException
* if bad things happen during the read
*/
private String getNextLine() throws IOException {
if (!this.linesSkiped) {
for (int i = 0; i < skipLines; i++) {
br.readLine();
}
this.linesSkiped = true;
}
String nextLine = br.readLine();
if (nextLine == null) {
hasNext = false;
}
return hasNext ? nextLine : null;
}
/**
* Closes the underlying reader.
*
* @throws IOException if the close fails
*/
public void close() throws IOException{
br.close();
}
}
@@ -1,302 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.Closeable;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* A very simple CSV writer released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVWriter implements Closeable {
public static final int INITIAL_STRING_SIZE = 128;
private Writer rawWriter;
private PrintWriter pw;
private char separator;
private char quotechar;
private char escapechar;
private String lineEnd;
/** The character used for escaping quotes. */
public static final char DEFAULT_ESCAPE_CHARACTER = '"';
/** The default separator to use if none is supplied to the constructor. */
public static final char DEFAULT_SEPARATOR = ',';
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/** The quote constant to use when you wish to suppress all quoting. */
public static final char NO_QUOTE_CHARACTER = '\u0000';
/** The escape constant to use when you wish to suppress all escaping. */
public static final char NO_ESCAPE_CHARACTER = '\u0000';
/** Default line terminator uses platform encoding. */
public static final String DEFAULT_LINE_END = "\n";
private ResultSetHelper resultService = new ResultSetHelperService();
/**
* Constructs CSVWriter using a comma for the separator.
*
* @param writer
* the writer to an underlying CSV source.
*/
public CSVWriter(Writer writer) {
this(writer, DEFAULT_SEPARATOR);
}
/**
* Constructs CSVWriter with supplied separator.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVWriter(Writer writer, char separator) {
this(writer, separator, DEFAULT_QUOTE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVWriter(Writer writer, char separator, char quotechar) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar) {
this(writer, separator, quotechar, escapechar, DEFAULT_LINE_END);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, String lineEnd) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER, lineEnd);
}
/**
* Constructs CSVWriter with supplied separator, quote char, escape char and line ending.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar, String lineEnd) {
this.rawWriter = writer;
this.pw = new PrintWriter(writer);
this.separator = separator;
this.quotechar = quotechar;
this.escapechar = escapechar;
this.lineEnd = lineEnd;
}
/**
* Writes the entire list to a CSV file. The list is assumed to be a
* String[]
*
* @param allLines
* a List of String[], with each String[] representing a line of
* the file.
*/
public void writeAll(List<String[]> allLines) {
for (String[] line : allLines) {
writeNext(line);
}
}
protected void writeColumnNames(ResultSet rs)
throws SQLException {
writeNext(resultService.getColumnNames(rs));
}
/**
* Writes the entire ResultSet to a CSV file.
*
* The caller is responsible for closing the ResultSet.
*
* @param rs the recordset to write
* @param includeColumnNames true if you want column names in the output, false otherwise
*
* @throws java.io.IOException thrown by getColumnValue
* @throws java.sql.SQLException thrown by getColumnValue
*/
public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames) throws SQLException, IOException {
if (includeColumnNames) {
writeColumnNames(rs);
}
while (rs.next())
{
writeNext(resultService.getColumnValues(rs));
}
}
/**
* Writes the next line to the file.
*
* @param nextLine
* a string array with each comma-separated element as a separate
* entry.
*/
public void writeNext(String[] nextLine) {
if (nextLine == null)
return;
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int i = 0; i < nextLine.length; i++) {
if (i != 0) {
sb.append(separator);
}
String nextElement = nextLine[i];
if (nextElement == null)
continue;
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
sb.append(stringContainsSpecialCharacters(nextElement) ? processLine(nextElement) : nextElement);
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
}
sb.append(lineEnd);
pw.write(sb.toString());
}
private boolean stringContainsSpecialCharacters(String line) {
return line.indexOf(quotechar) != -1 || line.indexOf(escapechar) != -1;
}
protected StringBuilder processLine(String nextElement)
{
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int j = 0; j < nextElement.length(); j++) {
char nextChar = nextElement.charAt(j);
if (escapechar != NO_ESCAPE_CHARACTER && nextChar == quotechar) {
sb.append(escapechar).append(nextChar);
} else if (escapechar != NO_ESCAPE_CHARACTER && nextChar == escapechar) {
sb.append(escapechar).append(nextChar);
} else {
sb.append(nextChar);
}
}
return sb;
}
/**
* Flush underlying stream to writer.
*
* @throws IOException if bad things happen
*/
public void flush() throws IOException {
pw.flush();
}
/**
* Close the underlying stream writer flushing any buffered content.
*
* @throws IOException if bad things happen
*
*/
public void close() throws IOException {
flush();
pw.close();
rawWriter.close();
}
/**
* Checks to see if the there has been an error in the printstream.
*/
public boolean checkError() {
return pw.checkError();
}
public void setResultService(ResultSetHelper resultService) {
this.resultService = resultService;
}
}
@@ -1,33 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
*
*
*
*
*/
public interface ResultSetHelper {
public String[] getColumnNames(ResultSet rs) throws SQLException;
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException;
}
@@ -1,183 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* helper class for processing JDBC ResultSet objects
*
*
*/
public class ResultSetHelperService implements ResultSetHelper {
public static final int CLOBBUFFERSIZE = 2048;
// note: we want to maintain compatibility with Java 5 VM's
// These types don't exist in Java 5
private static final int NVARCHAR = -9;
private static final int NCHAR = -15;
private static final int LONGNVARCHAR = -16;
private static final int NCLOB = 2011;
public String[] getColumnNames(ResultSet rs) throws SQLException {
List<String> names = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
names.add(metadata.getColumnName(i+1));
}
String[] nameArray = new String[names.size()];
return names.toArray(nameArray);
}
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException {
List<String> values = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
values.add(getColumnValue(rs, metadata.getColumnType(i + 1), i + 1));
}
String[] valueArray = new String[values.size()];
return values.toArray(valueArray);
}
private String handleObject(Object obj){
return obj == null ? "" : String.valueOf(obj);
}
private String handleBigDecimal(BigDecimal decimal) {
return decimal == null ? "" : decimal.toString();
}
private String handleLong(ResultSet rs, int columnIndex) throws SQLException {
long lv = rs.getLong(columnIndex);
return rs.wasNull() ? "" : Long.toString(lv);
}
private String handleInteger(ResultSet rs, int columnIndex) throws SQLException {
int i = rs.getInt(columnIndex);
return rs.wasNull() ? "" : Integer.toString(i);
}
private String handleDate(ResultSet rs, int columnIndex) throws SQLException {
java.sql.Date date = rs.getDate(columnIndex);
String value = null;
if (date != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
value = dateFormat.format(date);
}
return value;
}
private String handleTime(Time time) {
return time == null ? null : time.toString();
}
private String handleTimestamp(Timestamp timestamp) {
SimpleDateFormat timeFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
return timestamp == null ? null : timeFormat.format(timestamp);
}
private String getColumnValue(ResultSet rs, int colType, int colIndex)
throws SQLException, IOException {
String value = "";
switch (colType)
{
case Types.BIT:
case Types.JAVA_OBJECT:
value = handleObject(rs.getObject(colIndex));
break;
case Types.BOOLEAN:
boolean b = rs.getBoolean(colIndex);
value = Boolean.valueOf(b).toString();
break;
case NCLOB: // todo : use rs.getNClob
case Types.CLOB:
Clob c = rs.getClob(colIndex);
if (c != null) {
value = read(c);
}
break;
case Types.BIGINT:
value = handleLong(rs, colIndex);
break;
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
case Types.NUMERIC:
value = handleBigDecimal(rs.getBigDecimal(colIndex));
break;
case Types.INTEGER:
case Types.TINYINT:
case Types.SMALLINT:
value = handleInteger(rs, colIndex);
break;
case Types.DATE:
value = handleDate(rs, colIndex);
break;
case Types.TIME:
value = handleTime(rs.getTime(colIndex));
break;
case Types.TIMESTAMP:
value = handleTimestamp(rs.getTimestamp(colIndex));
break;
case NVARCHAR: // todo : use rs.getNString
case NCHAR: // todo : use rs.getNString
case LONGNVARCHAR: // todo : use rs.getNString
case Types.LONGVARCHAR:
case Types.VARCHAR:
case Types.CHAR:
value = rs.getString(colIndex);
break;
default:
value = "";
}
if (value == null)
{
value = "";
}
return value;
}
private static String read(Clob c) throws SQLException, IOException
{
StringBuilder sb = new StringBuilder( (int) c.length());
Reader r = c.getCharacterStream();
char[] cbuf = new char[CLOBBUFFERSIZE];
int n;
while ((n = r.read(cbuf, 0, cbuf.length)) != -1) {
sb.append(cbuf, 0, n);
}
return sb.toString();
}
}
@@ -1,37 +0,0 @@
package au.com.bytecode.opencsv.bean;
import au.com.bytecode.opencsv.CSVReader;
import java.io.IOException;
/**
Copyright 2007 Kyle Miller.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class ColumnPositionMappingStrategy<T> extends HeaderColumnNameMappingStrategy<T> {
private String[] columnMapping = new String[] {};
public void captureHeader(CSVReader reader) throws IOException {
//do nothing, first line is not header
}
protected String getColumnName(int col) {
return (null != columnMapping && col < columnMapping.length) ? columnMapping[col] : null ;
}
public String[] getColumnMapping() {
return columnMapping != null ? columnMapping.clone() : null;
}
public void setColumnMapping(String[] columnMapping) {
this.columnMapping = columnMapping != null ? columnMapping.clone() : null;
}
}
@@ -1,119 +0,0 @@
package au.com.bytecode.opencsv.bean;
/**
Copyright 2007 Kyle Miller.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import au.com.bytecode.opencsv.CSVReader;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CsvToBean<T> {
private Map<Class<?>, PropertyEditor> editorMap = null;
public CsvToBean() {
}
public List<T> parse(MappingStrategy<T> mapper, Reader reader) {
return parse(mapper, new CSVReader(reader));
}
public List<T> parse(MappingStrategy<T> mapper, CSVReader csv) {
try {
mapper.captureHeader(csv);
String[] line;
List<T> list = new ArrayList<T>();
while (null != (line = csv.readNext())) {
T obj = processLine(mapper, line);
list.add(obj); // TODO: (Kyle) null check object
}
return list;
} catch (Exception e) {
throw new RuntimeException("Error parsing CSV!", e);
}
}
protected T processLine(MappingStrategy<T> mapper, String[] line) throws IllegalAccessException, InvocationTargetException, InstantiationException, IntrospectionException {
T bean = mapper.createBean();
for (int col = 0; col < line.length; col++) {
PropertyDescriptor prop = mapper.findDescriptor(col);
if (null != prop) {
String value = checkForTrim(line[col], prop);
Object obj = convertValue(value, prop);
prop.getWriteMethod().invoke(bean, obj);
}
}
return bean;
}
private String checkForTrim(String s, PropertyDescriptor prop) {
return trimmableProperty(prop) ? s.trim() : s;
}
private boolean trimmableProperty(PropertyDescriptor prop) {
return !prop.getPropertyType().getName().contains("String");
}
protected Object convertValue(String value, PropertyDescriptor prop) throws InstantiationException, IllegalAccessException {
PropertyEditor editor = getPropertyEditor(prop);
Object obj = value;
if (null != editor) {
editor.setAsText(value);
obj = editor.getValue();
}
return obj;
}
private PropertyEditor getPropertyEditorValue(Class<?> cls) {
if (editorMap == null) {
editorMap = new HashMap<Class<?>, PropertyEditor>();
}
PropertyEditor editor = editorMap.get(cls);
if (editor == null) {
editor = PropertyEditorManager.findEditor(cls);
addEditorToMap(cls, editor);
}
return editor;
}
private void addEditorToMap(Class<?> cls, PropertyEditor editor) {
if (editor != null) {
editorMap.put(cls, editor);
}
}
/*
* Attempt to find custom property editor on descriptor first, else try the propery editor manager.
*/
protected PropertyEditor getPropertyEditor(PropertyDescriptor desc) throws InstantiationException, IllegalAccessException {
Class<?> cls = desc.getPropertyEditorClass();
if (null != cls) return (PropertyEditor) cls.newInstance();
return getPropertyEditorValue(desc.getPropertyType());
}
}
@@ -1,84 +0,0 @@
package au.com.bytecode.opencsv.bean;
import au.com.bytecode.opencsv.CSVReader;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Copyright 2007 Kyle Miller.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class HeaderColumnNameMappingStrategy<T> implements MappingStrategy<T> {
protected String[] header;
protected Map<String, PropertyDescriptor> descriptorMap = null;
protected Class<T> type;
public void captureHeader(CSVReader reader) throws IOException {
header = reader.readNext();
}
public PropertyDescriptor findDescriptor(int col) throws IntrospectionException {
String columnName = getColumnName(col);
return (null != columnName && columnName.trim().length() > 0) ? findDescriptor(columnName) : null;
}
protected String getColumnName(int col) {
return (null != header && col < header.length) ? header[col] : null;
}
protected PropertyDescriptor findDescriptor(String name) throws IntrospectionException {
if (null == descriptorMap) descriptorMap = loadDescriptorMap(getType()); //lazy load descriptors
return descriptorMap.get(name.toUpperCase().trim());
}
protected boolean matches(String name, PropertyDescriptor desc) {
return desc.getName().equals(name.trim());
}
protected Map<String, PropertyDescriptor> loadDescriptorMap(Class<T> cls) throws IntrospectionException {
Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>();
PropertyDescriptor[] descriptors;
descriptors = loadDescriptors(getType());
for (PropertyDescriptor descriptor : descriptors) {
map.put(descriptor.getName().toUpperCase().trim(), descriptor);
}
return map;
}
private PropertyDescriptor[] loadDescriptors(Class<T> cls) throws IntrospectionException {
BeanInfo beanInfo = Introspector.getBeanInfo(cls);
return beanInfo.getPropertyDescriptors();
}
public T createBean() throws InstantiationException, IllegalAccessException {
return type.newInstance();
}
public Class<T> getType() {
return type;
}
public void setType(Class<T> type) {
this.type = type;
}
}
@@ -1,34 +0,0 @@
package au.com.bytecode.opencsv.bean;
import java.util.HashMap;
import java.util.Map;
/**
Copyright 2007,2010 Kyle Miller.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class HeaderColumnNameTranslateMappingStrategy<T> extends HeaderColumnNameMappingStrategy<T> {
private Map<String, String> columnMapping = new HashMap<String, String>();
protected String getColumnName(int col) {
return col < header.length ? columnMapping.get(header[col].toUpperCase()) : null;
}
public Map<String, String> getColumnMapping() {
return columnMapping;
}
public void setColumnMapping(Map<String, String> columnMapping) {
for (String key : columnMapping.keySet()) {
this.columnMapping.put(key.toUpperCase(), columnMapping.get(key));
}
}
}
@@ -1,46 +0,0 @@
package au.com.bytecode.opencsv.bean;
/**
Copyright 2007 Kyle Miller.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import au.com.bytecode.opencsv.CSVReader;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.io.IOException;
public interface MappingStrategy<T> {
/**
* Implementation will have to return a property descriptor from a bean based on the current column.
* @param col the column to find the description for
* @throws java.beans.IntrospectionException
* @return the related PropertyDescriptor
*/
public abstract PropertyDescriptor findDescriptor(int col) throws IntrospectionException;
public abstract T createBean() throws InstantiationException, IllegalAccessException;
/**
* Implementation of this method can grab the header line before parsing begins to use to map columns
* to bean properties.
* @param reader the CSVReader to use for header parsing
* @throws java.io.IOException if parsing fails
*/
public void captureHeader(CSVReader reader) throws IOException;
}
@@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
<p>
A simple bean binding interface for use with opencsv.
</p>
<br>
<a href="http://opencsv.sourceforge.net/">opencsv.sourceforge.net</a>
</body>
</html>
@@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
<p>
A very simple CSV parser for Java released under a commercial-friendly license.
</p>
<br>
<a href="http://opencsv.sourceforge.net/">opencsv.sourceforge.net</a>
</body>
</html>
+1 -1
View File
@@ -44,7 +44,7 @@ import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.commands.CommandDumpHandlers;
@Mod(modid="Waila", name="Waila", version="1.5.8", dependencies="after:NotEnoughItems@[1.0.4.0,)", acceptableRemoteVersions="*")
@Mod(modid="Waila", name="Waila", version="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,)")
@@ -14,7 +14,7 @@ public class ExtraUtilitiesModule {
try{
Class ModExtraUtilities = Class.forName("extrautils.ExtraUtils");
Class ModExtraUtilities = Class.forName("com.rwtema.extrautils.ExtraUtils");
Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
@@ -22,7 +22,7 @@ public class ExtraUtilitiesModule {
}
try{
TileEntityDrum = Class.forName("extrautils.tileentity.TileEntityDrum");
TileEntityDrum = Class.forName("com.rwtema.extrautils.tileentity.TileEntityDrum");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[ExtraUtilities] Class not found. " + e);
return;
@@ -0,0 +1,71 @@
package mcp.mobius.waila.addons.thermaldynamics;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import java.util.List;
/**
* Created by Lordmau5 on 28.02.2015.
*/
public class HUDHandlerDuct 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;
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;
int amount = 0;
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Amount"))
amount = accessor.getNBTInteger(tag, "Amount");
currenttip.add(String.format(" %d / 1000 mB", amount));
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;
}
}
@@ -0,0 +1,44 @@
package mcp.mobius.waila.addons.thermaldynamics;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import org.apache.logging.log4j.Level;
public class ThermalDynamicsModule {
public static Class TileFluidDuct = null;
public static 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);
}
// 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);
}
*/
}
}
@@ -0,0 +1,111 @@
package mcp.mobius.waila.addons.thermalexpansion;
import cpw.mods.fml.common.registry.GameData;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class HUDHandlerCache 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.cache"))
return currenttip;
try {
ItemStack storedItem = null;
if(accessor.getNBTData().hasKey("Item"))
storedItem = readItemStack(accessor.getNBTData().getCompoundTag("Item"));
String name = currenttip.get(0);
String color = "";
if(name.startsWith("\u00a7"))
color = name.substring(0, 2);
if(storedItem != null) {
String namex = GameData.getItemRegistry().getNameForObject(storedItem.getItem());
name += String.format(" < " + SpecialChars.getRenderString("waila.stack", "1", namex, "0", String.valueOf(storedItem.getItemDamage())) + color + " %s >", storedItem.getDisplayName());
}
else
name += " " + LangUtil.translateG("hud.msg.empty");
currenttip.set(0, name);
} catch (Exception e) {
throw new RuntimeException(e);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.cache"))
return currenttip;
NBTTagCompound tag = accessor.getNBTData();
ItemStack storedItem = null;
if(tag.hasKey("Item"))
storedItem = readItemStack(tag.getCompoundTag("Item"));
int stored = 0;
int maxStored = 0;
if(tag.hasKey("Stored"))
stored = tag.getInteger("Stored");
if(tag.hasKey("MaxStored"))
maxStored = tag.getInteger("MaxStored");
if(storedItem != null) {
currenttip.add("Stored: " + stored + "/" + maxStored);
}
else
currenttip.add("Capacity: " + maxStored);
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);
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) {
e.printStackTrace();
}
return tag;
}
public ItemStack readItemStack(NBTTagCompound tag) {
ItemStack is = new ItemStack(Item.getItemById(tag.getShort("id")));
is.stackSize = tag.getInteger("Count");
is.setItemDamage(Math.max(0, tag.getShort("Damage")));
if (tag.hasKey("tag", 10)) {
is.stackTagCompound = tag.getCompoundTag("tag");
}
return is;
}
}
@@ -1,16 +1,12 @@
package mcp.mobius.waila.addons.thermalexpansion;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import net.minecraftforge.common.util.ForgeDirection;
import org.apache.logging.log4j.Level;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class ThermalExpansionModule {
@@ -44,6 +40,11 @@ public class ThermalExpansionModule {
public static Class ISecureTile = null;
public static Method ISecureTile_getAccess = null;
public static Method ISecureTile_getOwnerName = 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;
@@ -76,15 +77,15 @@ public class ThermalExpansionModule {
} catch (Exception e){
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks." + e);
}
}
// XXX : We register the energy cell
try{
TileEnergyCell = Class.forName("thermalexpansion.block.cell.TileCell");
TileEnergyCell = Class.forName("cofh.thermalexpansion.block.cell.TileCell");
TileEnergyCell_Recv = TileEnergyCell.getDeclaredField("energyReceive");
TileEnergyCell_Send = TileEnergyCell.getDeclaredField("energySend");
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell");
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerEnergyCell(), TileEnergyCell);
@@ -94,7 +95,7 @@ public class ThermalExpansionModule {
// XXX : We register the Tank interface
try{
TileTank = Class.forName("thermalexpansion.block.tank.TileTank");
TileTank = Class.forName("cofh.thermalexpansion.block.tank.TileTank");
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
TileTank_getTankAmount = TileTank.getMethod("getTankFluidAmount");
@@ -113,7 +114,7 @@ public class ThermalExpansionModule {
// XXX : We register the Tesseract interface
try{
TileTesseract = Class.forName("thermalexpansion.block.ender.TileTesseract");
TileTesseract = Class.forName("cofh.thermalexpansion.block.ender.TileTesseract");
TileTesseract_Item = TileTesseract.getDeclaredField("modeItem");
TileTesseract_Fluid = TileTesseract.getDeclaredField("modeFluid");
TileTesseract_Energy = TileTesseract.getDeclaredField("modeEnergy");
@@ -141,9 +142,25 @@ public class ThermalExpansionModule {
} catch (Exception e){
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks." + e);
}
// XXX : We register the IBlockInfo interface
}
// XXX : We register the Cache interface
try{
TileCache = Class.forName("cofh.thermalexpansion.block.cache.TileCache");
TileCache_getItemStack = TileCache.getDeclaredMethod("getStoredItemType");
TileCache_getMaxStored = TileCache.getDeclaredMethod("getMaxStoredCount");
TileCache_getStored = TileCache.getDeclaredMethod("getStoredCount");
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.cache");
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerCache(), TileCache);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCache(), TileCache);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerCache(), TileCache);
} catch (Exception 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");
@@ -0,0 +1,78 @@
package mcp.mobius.waila.addons.vanillamc;
import java.util.List;
import cpw.mods.fml.common.registry.GameData;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.ISidedInventory;
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 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;
public class HUDHandlerFurnace 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) {
int cookTime = accessor.getNBTData().getShort("CookTime");
NBTTagList tag = accessor.getNBTData().getTagList("Items", 10);
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()));
}
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()));
}
currenttip.add(renderStr);
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;
}
public static void register(){
//ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
//ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
}
}
@@ -40,6 +40,9 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
static Block doubleplant = Blocks.double_plant;
static Block leave = Blocks.leaves;
static Block leave2 = Blocks.leaves2;
static Block log = Blocks.log;
static Block log2 = Blocks.log2;
static Block quartz = Blocks.quartz_block;
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
@@ -84,6 +87,14 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
return new ItemStack(block, 1, accessor.getMetadata() - 4);
}
if (block == log || block == log2){
return new ItemStack(block, 1, accessor.getMetadata()%4);
}
if ((block == quartz) && (accessor.getMetadata() > 2)){
return new ItemStack(block, 1, 2);
}
return null;
}
@@ -228,6 +239,9 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
ModuleRegistrar.instance().registerStackProvider(provider, crops.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, leave.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, leave2.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, log.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, log2.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, quartz.getClass());
//ModuleRegistrar.instance().registerStackProvider(provider, Block.class);
ModuleRegistrar.instance().registerHeadProvider(provider, mobSpawner.getClass());
@@ -135,7 +135,10 @@ public class ConfigHandler implements IWailaConfigHandler {
}
/* Some accessor helpers */
public boolean showTooltip(){
return getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
}
@@ -3,6 +3,8 @@ package mcp.mobius.waila.api.impl;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaBlock;
@@ -12,6 +14,7 @@ import mcp.mobius.waila.cbcore.Layout;
import mcp.mobius.waila.network.Message0x01TERequest;
import mcp.mobius.waila.network.Message0x03EntRequest;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@@ -21,16 +24,17 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
public class MetaDataProvider{
private ArrayList<IWailaDataProvider> headBlockProviders = new ArrayList<IWailaDataProvider>();
private ArrayList<IWailaDataProvider> bodyBlockProviders = new ArrayList<IWailaDataProvider>();
private ArrayList<IWailaDataProvider> tailBlockProviders = new ArrayList<IWailaDataProvider>();
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 ArrayList<IWailaEntityProvider> headEntityProviders = new ArrayList<IWailaEntityProvider>();
private ArrayList<IWailaEntityProvider> bodyEntityProviders = new ArrayList<IWailaEntityProvider>();
private ArrayList<IWailaEntityProvider> tailEntityProviders = new ArrayList<IWailaEntityProvider>();
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;
@@ -48,14 +52,16 @@ public class MetaDataProvider{
}
if(ModuleRegistrar.instance().hasStackProviders(block)){
for (IWailaDataProvider dataProvider : ModuleRegistrar.instance().getStackProviders(block)){
try{
ItemStack retval = dataProvider.getWailaStack(accessor, ConfigHandler.instance());
if (retval != null)
return retval;
}catch (Throwable e){
WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), null);
}
for (List<IWailaDataProvider> providerList : ModuleRegistrar.instance().getStackProviders(block).values()){
for (IWailaDataProvider dataProvider : providerList){
try{
ItemStack retval = dataProvider.getWailaStack(accessor, ConfigHandler.instance());
if (retval != null)
return retval;
}catch (Throwable e){
WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), null);
}
}
}
}
return null;
@@ -64,7 +70,7 @@ public class MetaDataProvider{
public List<String> handleBlockTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, DataAccessorCommon accessor, List<String> currenttip, Layout layout) {
Block block = accessor.getBlock();
if (accessor.getTileEntity() != null && Waila.instance.serverPresent && accessor.isTimeElapsed(250)){
if (accessor.getTileEntity() != null && Waila.instance.serverPresent && accessor.isTimeElapsed(250) && ConfigHandler.instance().showTooltip()){
accessor.resetTimer();
HashSet<String> keys = new HashSet<String>();
@@ -77,7 +83,7 @@ public class MetaDataProvider{
if (keys.size() != 0 || ModuleRegistrar.instance().hasNBTProviders(block) || ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity()))
WailaPacketHandler.INSTANCE.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys));
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250) && ConfigHandler.instance().showTooltip()) {
try{
NBTTagCompound tag = new NBTTagCompound();
@@ -117,50 +123,54 @@ public class MetaDataProvider{
/* Lookup by class (for blocks)*/
if (layout == Layout.HEADER && ModuleRegistrar.instance().hasHeadProviders(block))
headBlockProviders.addAll(ModuleRegistrar.instance().getHeadProviders(block));
headBlockProviders.putAll(ModuleRegistrar.instance().getHeadProviders(block));
else if (layout == Layout.BODY && ModuleRegistrar.instance().hasBodyProviders(block))
bodyBlockProviders.addAll(ModuleRegistrar.instance().getBodyProviders(block));
bodyBlockProviders.putAll(ModuleRegistrar.instance().getBodyProviders(block));
else if (layout == Layout.FOOTER && ModuleRegistrar.instance().hasTailProviders(block))
tailBlockProviders.addAll(ModuleRegistrar.instance().getTailProviders(block));
tailBlockProviders.putAll(ModuleRegistrar.instance().getTailProviders(block));
/* Lookup by class (for tileentities)*/
if (layout == Layout.HEADER && ModuleRegistrar.instance().hasHeadProviders(accessor.getTileEntity()))
headBlockProviders.addAll(ModuleRegistrar.instance().getHeadProviders(accessor.getTileEntity()));
headBlockProviders.putAll(ModuleRegistrar.instance().getHeadProviders(accessor.getTileEntity()));
else if (layout == Layout.BODY && ModuleRegistrar.instance().hasBodyProviders(accessor.getTileEntity()))
bodyBlockProviders.addAll(ModuleRegistrar.instance().getBodyProviders(accessor.getTileEntity()));
bodyBlockProviders.putAll(ModuleRegistrar.instance().getBodyProviders(accessor.getTileEntity()));
else if (layout == Layout.FOOTER && ModuleRegistrar.instance().hasTailProviders(accessor.getTileEntity()))
tailBlockProviders.addAll(ModuleRegistrar.instance().getTailProviders(accessor.getTileEntity()));
tailBlockProviders.putAll(ModuleRegistrar.instance().getTailProviders(accessor.getTileEntity()));
/* Apply all collected providers */
if (layout == Layout.HEADER)
for (IWailaDataProvider dataProvider : headBlockProviders)
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (List<IWailaDataProvider> providersList : headBlockProviders.values()){
for (IWailaDataProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.BODY)
for (IWailaDataProvider dataProvider : bodyBlockProviders)
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
if (layout == Layout.BODY)
for (List<IWailaDataProvider> providersList : bodyBlockProviders.values()){
for (IWailaDataProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.FOOTER)
for (IWailaDataProvider dataProvider : tailBlockProviders)
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (List<IWailaDataProvider> providersList : tailBlockProviders.values()){
for (IWailaDataProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
return currenttip;
}
@@ -193,38 +203,44 @@ public class MetaDataProvider{
/* Lookup by class (for entities)*/
if (layout == Layout.HEADER && ModuleRegistrar.instance().hasHeadEntityProviders(entity))
headEntityProviders.addAll(ModuleRegistrar.instance().getHeadEntityProviders(entity));
headEntityProviders.putAll(ModuleRegistrar.instance().getHeadEntityProviders(entity));
else if (layout == Layout.BODY && ModuleRegistrar.instance().hasBodyEntityProviders(entity))
bodyEntityProviders.addAll(ModuleRegistrar.instance().getBodyEntityProviders(entity));
bodyEntityProviders.putAll(ModuleRegistrar.instance().getBodyEntityProviders(entity));
else if (layout == Layout.FOOTER && ModuleRegistrar.instance().hasTailEntityProviders(entity))
tailEntityProviders.addAll(ModuleRegistrar.instance().getTailEntityProviders(entity));
tailEntityProviders.putAll(ModuleRegistrar.instance().getTailEntityProviders(entity));
/* Apply all collected providers */
if (layout == Layout.HEADER)
for (IWailaEntityProvider dataProvider : headEntityProviders)
try{
currenttip = dataProvider.getWailaHead(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (List<IWailaEntityProvider> providersList : headEntityProviders.values()){
for (IWailaEntityProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaHead(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.BODY)
for (IWailaEntityProvider dataProvider : bodyEntityProviders)
try{
currenttip = dataProvider.getWailaBody(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (List<IWailaEntityProvider> providersList : bodyEntityProviders.values()){
for (IWailaEntityProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaBody(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.FOOTER)
for (IWailaEntityProvider dataProvider : tailEntityProviders)
try{
currenttip = dataProvider.getWailaTail(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (List<IWailaEntityProvider> providersList : tailEntityProviders.values()){
for (IWailaEntityProvider dataProvider : providersList)
try{
currenttip = dataProvider.getWailaTail(entity, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
return currenttip;
}
@@ -5,10 +5,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.logging.log4j.Level;
@@ -230,67 +233,67 @@ public class ModuleRegistrar implements IWailaRegistrar {
/* PROVIDER GETTERS */
public ArrayList<IWailaDataProvider> getHeadProviders(Object block) {
public Map<Integer, List<IWailaDataProvider>> getHeadProviders(Object block) {
return getProviders(block, this.headBlockProviders);
}
public ArrayList<IWailaDataProvider> getBodyProviders(Object block) {
public Map<Integer, List<IWailaDataProvider>> getBodyProviders(Object block) {
return getProviders(block, this.bodyBlockProviders);
}
public ArrayList<IWailaDataProvider> getTailProviders(Object block) {
public Map<Integer, List<IWailaDataProvider>> getTailProviders(Object block) {
return getProviders(block, this.tailBlockProviders);
}
public ArrayList<IWailaDataProvider> getStackProviders(Object block) {
public Map<Integer, List<IWailaDataProvider>> getStackProviders(Object block) {
return getProviders(block, this.stackBlockProviders);
}
public ArrayList<IWailaDataProvider> getNBTProviders(Object block) {
public Map<Integer, List<IWailaDataProvider>> getNBTProviders(Object block) {
return getProviders(block, this.NBTDataProviders);
}
public ArrayList<IWailaEntityProvider> getHeadEntityProviders(Object entity) {
public Map<Integer, List<IWailaEntityProvider>> getHeadEntityProviders(Object entity) {
return getProviders(entity, this.headEntityProviders);
}
public ArrayList<IWailaEntityProvider> getBodyEntityProviders(Object entity) {
public Map<Integer, List<IWailaEntityProvider>> getBodyEntityProviders(Object entity) {
return getProviders(entity, this.bodyEntityProviders);
}
public ArrayList<IWailaEntityProvider> getTailEntityProviders(Object entity) {
public Map<Integer, List<IWailaEntityProvider>> getTailEntityProviders(Object entity) {
return getProviders(entity, this.tailEntityProviders);
}
public ArrayList<IWailaEntityProvider> getOverrideEntityProviders(Object entity) {
public Map<Integer, List<IWailaEntityProvider>> getOverrideEntityProviders(Object entity) {
return getProviders(entity, this.overrideEntityProviders);
}
public ArrayList<IWailaEntityProvider> getNBTEntityProviders(Object entity) {
public Map<Integer, List<IWailaEntityProvider>> getNBTEntityProviders(Object entity) {
return getProviders(entity, this.NBTEntityProviders);
}
public ArrayList<IWailaFMPProvider> getHeadFMPProviders(String name) {
public Map<Integer, List<IWailaFMPProvider>> getHeadFMPProviders(String name) {
return getProviders(name, this.headFMPProviders);
}
public ArrayList<IWailaFMPProvider> getBodyFMPProviders(String name) {
public Map<Integer, List<IWailaFMPProvider>> getBodyFMPProviders(String name) {
return getProviders(name, this.bodyFMPProviders);
}
public ArrayList<IWailaFMPProvider> getTailFMPProviders(String name) {
public Map<Integer, List<IWailaFMPProvider>> getTailFMPProviders(String name) {
return getProviders(name, this.tailFMPProviders);
}
public ArrayList<IWailaSummaryProvider> getSummaryProvider(Object item){
public Map<Integer, List<IWailaSummaryProvider>> getSummaryProvider(Object item){
return getProviders(item, this.summaryProviders);
}
public ArrayList<IWailaBlockDecorator> getBlockDecorators(Object block){
public Map<Integer, List<IWailaBlockDecorator>> getBlockDecorators(Object block){
return getProviders(block, this.blockClassDecorators);
}
public ArrayList<IWailaFMPDecorator> getFMPDecorators(String name){
public Map<Integer, List<IWailaFMPDecorator>> getFMPDecorators(String name){
return getProviders(name, this.FMPClassDecorators);
}
@@ -298,17 +301,24 @@ public class ModuleRegistrar implements IWailaRegistrar {
return this.tooltipRenderers.get(name);
}
private <T> ArrayList<T> getProviders(Object obj, LinkedHashMap<Class, ArrayList<T>> target){
ArrayList<T> returnList = new ArrayList<T>();
for (Class clazz : target.keySet())
private <T> Map<Integer, List<T>> getProviders(Object obj, LinkedHashMap<Class, ArrayList<T>> target){
Map<Integer, List<T>> returnList = new TreeMap<Integer, List<T>>();
Integer index = 0;
for (Class clazz : target.keySet()){
if (clazz.isInstance(obj))
returnList.addAll(target.get(clazz));
returnList.put(index, target.get(clazz));
index++;
}
return returnList;
}
private <T> ArrayList<T> getProviders(String name, LinkedHashMap<String, ArrayList<T>> target){
return target.get(name);
private <T> Map<Integer, List<T>> getProviders(String name, LinkedHashMap<String, ArrayList<T>> target){
Map<Integer, List<T>> returnList = new TreeMap<Integer, List<T>>();
returnList.put(0, target.get(name));
return returnList;
}
@Deprecated
@@ -1,11 +1,15 @@
package mcp.mobius.waila.client;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.gui.truetyper.FontLoader;
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.overlay.tooltiprenderers.TTRenderHealth;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderProgressBar;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderStack;
//import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.server.ProxyServer;
import net.minecraft.block.Block;
@@ -37,7 +41,10 @@ public class ProxyClient extends ProxyServer {
if (Loader.isModLoaded("NotEnoughItems")){
try{
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("register").invoke(null);
} catch (Exception e){}
} catch (Exception e){
Waila.log.error("Failed to hook into NEI properly. Reverting to Vanilla tooltip handler");
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
}
} else {
MinecraftForge.EVENT_BUS.register(new VanillaTooltipHandler());
}
@@ -50,9 +57,14 @@ public class ProxyClient extends ProxyServer {
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().addConfig("General", "general.showcrop");
ModuleRegistrar.instance().registerTooltipRenderer("waila.health", new TTRenderHealth());
ModuleRegistrar.instance().registerTooltipRenderer("waila.stack", new TTRenderStack());
ModuleRegistrar.instance().registerTooltipRenderer("waila.progress", new TTRenderProgressBar());
}
@Override
@@ -35,10 +35,12 @@ public class FontHelper {
private static String formatEscape = "\u00A7";
/*
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float... rgba){
drawString(s,x,y,font,scaleX,scaleY,0,rgba);
}
*/
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float rotationZ, float... rgba){
Minecraft mc = Minecraft.getMinecraft();
@@ -1,5 +1,7 @@
package mcp.mobius.waila.handlers;
import java.util.List;
import org.apache.logging.log4j.Level;
import net.minecraft.item.ItemStack;
@@ -25,8 +27,9 @@ public class DecoratorFMP implements IWailaBlockDecorator {
if (ModuleRegistrar.instance().hasFMPDecorator(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id, accessor.getRenderingPosition(), accessor.getPartialFrame());
for (IWailaFMPDecorator provider : ModuleRegistrar.instance().getFMPDecorators(id))
provider.decorateBlock(itemStack, DataAccessorFMP.instance, config);
for (List<IWailaFMPDecorator> providersList : ModuleRegistrar.instance().getFMPDecorators(id).values())
for (IWailaFMPDecorator provider : providersList)
provider.decorateBlock(itemStack, DataAccessorFMP.instance, config);
}
}
}
@@ -48,36 +48,11 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
float health = ((EntityLivingBase)entity).getHealth() / 2.0f;
float maxhp = ((EntityLivingBase)entity).getMaxHealth() / 2.0f;
if (((EntityLivingBase)entity).getHealth() > maxhpfortext)
if (((EntityLivingBase)entity).getMaxHealth() > maxhpfortext)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", ((EntityLivingBase)entity).getHealth(), ((EntityLivingBase)entity).getMaxHealth()));
else{
for (int i = 0; i < MathHelper.floor_float(health); i++){
hptip += HEART;
if(hptip.length() % (nhearts * HEART.length()) == 0){
currenttip.add(hptip);
hptip = "";
}
}
if (((EntityLivingBase)entity).getHealth() > MathHelper.floor_float(health) * 2.0f){
hptip += HHEART;
if(hptip.length() % (nhearts * HEART.length()) == 0){
currenttip.add(hptip);
hptip = "";
}
}
for (int i = 0; i < MathHelper.floor_float(maxhp - health); i++){
hptip += EHEART;
if(hptip.length() % (nhearts * HEART.length()) == 0){
currenttip.add(hptip);
hptip = "";
}
}
if (!hptip.equals(""))
currenttip.add(hptip);
currenttip.add(getRenderString("waila.health", String.valueOf(nhearts), String.valueOf(health), String.valueOf(maxhp)));
}
}
@@ -36,8 +36,10 @@ public class HUDHandlerFMP implements IWailaDataProvider {
if (ModuleRegistrar.instance().hasHeadFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (IWailaFMPProvider provider : ModuleRegistrar.instance().getHeadFMPProviders(id))
currenttip = provider.getWailaHead(itemStack, currenttip, DataAccessorFMP.instance, config);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getHeadFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
currenttip = provider.getWailaHead(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
}
@@ -54,8 +56,10 @@ public class HUDHandlerFMP implements IWailaDataProvider {
if (ModuleRegistrar.instance().hasBodyFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (IWailaFMPProvider provider : ModuleRegistrar.instance().getBodyFMPProviders(id))
currenttip = provider.getWailaBody(itemStack, currenttip, DataAccessorFMP.instance, config);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getBodyFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
currenttip = provider.getWailaBody(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
}
@@ -72,8 +76,10 @@ public class HUDHandlerFMP implements IWailaDataProvider {
if (ModuleRegistrar.instance().hasTailFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (IWailaFMPProvider provider : ModuleRegistrar.instance().getTailFMPProviders(id))
currenttip = provider.getWailaTail(itemStack, currenttip, DataAccessorFMP.instance, config);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getTailFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
currenttip = provider.getWailaTail(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
}
@@ -1,11 +1,10 @@
package mcp.mobius.waila.network;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.HashSet;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.AccessHelper;
@@ -19,10 +18,11 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x01TERequest> implements IWailaMessage {
@@ -112,25 +112,30 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
EntityPlayerMP player = ((NetHandlerPlayServer) ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).playerEntity;
for (IWailaDataProvider provider : ModuleRegistrar.instance().getNBTProviders(block)){
try{
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (NoSuchMethodError nsm){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
for (List<IWailaDataProvider> providersList : ModuleRegistrar.instance().getNBTProviders(block).values()){
for (IWailaDataProvider provider : providersList){
try{
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (NoSuchMethodError nsm){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
}
for (IWailaDataProvider provider : ModuleRegistrar.instance().getNBTProviders(entity)){
try{
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (NoSuchMethodError nsm){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
for (List<IWailaDataProvider> providersList : ModuleRegistrar.instance().getNBTProviders(entity).values()){
for (IWailaDataProvider provider : providersList){
try{
tag = provider.getNBTData(player, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
} catch (NoSuchMethodError nsm){
tag = AccessHelper.getNBTData(provider, entity, tag, world, msg.posX, msg.posY, msg.posZ);
}
}
}
} else {
entity.writeToNBT(tag);
@@ -140,11 +145,10 @@ public class Message0x01TERequest extends SimpleChannelInboundHandler<Message0x0
tag.setInteger("WailaX", msg.posX);
tag.setInteger("WailaY", msg.posY);
tag.setInteger("WailaZ", msg.posZ);
tag.setString ("WailaID", (String)((HashMap)classToNameMap.get(null)).get(entity.getClass()));
ctx.writeAndFlush(new Message0x02TENBTData(tag)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
tag.setString ("WailaID", (String)((HashMap)classToNameMap.get(null)).get(entity.getClass()));
WailaPacketHandler.INSTANCE.sendTo(new Message0x02TENBTData(tag), WailaPacketHandler.getPlayer(ctx));
//ctx.writeAndFlush(new Message0x02TENBTData(tag)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}catch(Throwable e){
WailaExceptionHandler.handleErr(e, entity.getClass().toString(), null);
}
@@ -1,9 +1,10 @@
package mcp.mobius.waila.network;
import java.util.HashSet;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import mcp.mobius.waila.api.IWailaEntityProvider;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.AccessHelper;
@@ -16,10 +17,9 @@ import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.HashSet;
import java.util.List;
public class Message0x03EntRequest extends SimpleChannelInboundHandler<Message0x03EntRequest> implements IWailaMessage {
@@ -76,12 +76,14 @@ public class Message0x03EntRequest extends SimpleChannelInboundHandler<Message0x
EntityPlayerMP player = ((NetHandlerPlayServer) ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).playerEntity;
if (ModuleRegistrar.instance().hasNBTEntityProviders(entity)){
for (IWailaEntityProvider provider : ModuleRegistrar.instance().getNBTEntityProviders(entity)){
try{
tag = provider.getNBTData(player, entity, tag, world);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag);
}
for (List<IWailaEntityProvider> providersList : ModuleRegistrar.instance().getNBTEntityProviders(entity).values()){
for (IWailaEntityProvider provider : providersList){
try{
tag = provider.getNBTData(player, entity, tag, world);
} catch (AbstractMethodError ame){
tag = AccessHelper.getNBTData(provider, entity, tag);
}
}
}
} else {
@@ -91,7 +93,8 @@ public class Message0x03EntRequest extends SimpleChannelInboundHandler<Message0x
tag.setInteger("WailaEntityID", entity.getEntityId());
ctx.writeAndFlush(new Message0x04EntNBTData(tag)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
WailaPacketHandler.INSTANCE.sendTo(new Message0x04EntNBTData(tag), WailaPacketHandler.getPlayer(ctx));
//ctx.writeAndFlush(new Message0x04EntNBTData(tag)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}catch(Throwable e){
WailaExceptionHandler.handleErr(e, entity.getClass().toString(), null);
}
@@ -1,24 +1,23 @@
package mcp.mobius.waila.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import java.util.EnumMap;
import com.google.common.base.Charsets;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetHandlerPlayServer;
import java.io.IOException;
import java.util.EnumMap;
public enum WailaPacketHandler {
INSTANCE;
@@ -123,5 +122,9 @@ public enum WailaPacketHandler {
int j = buffer.readShort();
String s = new String(buffer.readBytes(j).array(), Charsets.UTF_8);
return s;
}
}
public static EntityPlayerMP getPlayer(ChannelHandlerContext ctx){
return ((NetHandlerPlayServer) ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).playerEntity;
}
}
@@ -1,5 +1,7 @@
package mcp.mobius.waila.overlay;
import java.util.List;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -46,15 +48,17 @@ public class DecoratorRenderer {
GL11.glDepthMask(false);
if (ModuleRegistrar.instance().hasBlockDecorator(block)){
for (IWailaBlockDecorator decorator : ModuleRegistrar.instance().getBlockDecorators(block))
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.instance().getTargetStack(), accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
for (List<IWailaBlockDecorator> decoratorsList : ModuleRegistrar.instance().getBlockDecorators(block).values()){
for (IWailaBlockDecorator decorator : decoratorsList)
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.instance().getTargetStack(), accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
}
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
@@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
@@ -42,6 +43,10 @@ public class DisplayUtil {
width += renderer.getSize(renderMatcher.group("args").split(","), DataAccessorCommon.instance).width;
}
Matcher iconMatcher = patternIcon.matcher(s);
while (iconMatcher.find())
width += 8;
width += fontRenderer.getStringWidth(stripSymbols(s));
return width;
}
@@ -67,8 +72,13 @@ public class DisplayUtil {
public static void renderStack(int x, int y, ItemStack stack){
enable3DRender();
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, stack, x, y);
renderItem.renderItemOverlayIntoGUI(fontRenderer, textureManager, stack, x, y);
try{
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, stack, x, y);
renderItem.renderItemOverlayIntoGUI(fontRenderer, textureManager, stack, x, y);
} catch (Exception e){
String stackStr = stack != null ? stack.toString() : "NullStack";
WailaExceptionHandler.handleErr(e, "renderStack | " + stackStr, null);
}
enable2DRender();
}
@@ -163,4 +173,15 @@ public class DisplayUtil {
return list.get(0);
}
public static void renderIcon(int x, int y, int sx, int sy, IconUI icon){
Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.icons);
if (icon == null)
return;
if (icon.bu != -1)
DisplayUtil.drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
DisplayUtil.drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
}
}
@@ -31,7 +31,7 @@ public class OverlayRenderer {
mc.theWorld != null &&
Minecraft.isGuiEnabled() &&
!mc.gameSettings.keyBindPlayerList.getIsKeyPressed() &&
ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true) &&
ConfigHandler.instance().showTooltip() &&
RayTracing.instance().getTarget() != null))
return;
@@ -40,7 +40,7 @@ public class OverlayRenderer {
renderOverlay(WailaTickHandler.instance().tooltip);
}
if (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)
if (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && ConfigHandler.instance().getConfig("general.showents"))
{
renderOverlay(WailaTickHandler.instance().tooltip);
}
@@ -125,15 +125,4 @@ public class OverlayRenderer {
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
DisplayUtil.drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
}
public static void renderIcon(int x, int y, int sx, int sy, IconUI icon){
Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.icons);
if (icon == null)
return;
if (icon.bu != -1)
DisplayUtil.drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
DisplayUtil.drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
}
}
@@ -3,7 +3,10 @@ package mcp.mobius.waila.overlay;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaEntityProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
@@ -13,7 +16,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
@@ -112,8 +117,13 @@ public class RayTracing {
if (this.target == null)
return null;
if (ModuleRegistrar.instance().hasOverrideEntityProviders(this.target.entityHit))
ents.add(ModuleRegistrar.instance().getOverrideEntityProviders(this.target.entityHit).get(0).getWailaOverride(DataAccessorCommon.instance, ConfigHandler.instance()));
if (ModuleRegistrar.instance().hasOverrideEntityProviders(this.target.entityHit)){
for (List<IWailaEntityProvider> listProviders : ModuleRegistrar.instance().getOverrideEntityProviders(this.target.entityHit).values()){
for (IWailaEntityProvider provider : listProviders){
ents.add(provider.getWailaOverride(DataAccessorCommon.instance, ConfigHandler.instance()));
}
}
}
if(ents.size() > 0)
return ents.get(0);
@@ -141,15 +151,34 @@ public class RayTracing {
if (mouseoverBlock == null) return items;
if (ModuleRegistrar.instance().hasStackProviders(mouseoverBlock)){
ItemStack providerStack = ModuleRegistrar.instance().getStackProviders(mouseoverBlock).get(0).getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
if (providerStack != null)
items.add(providerStack);
for (List<IWailaDataProvider> providersList : ModuleRegistrar.instance().getStackProviders(mouseoverBlock).values()){
for(IWailaDataProvider provider : providersList){
ItemStack providerStack = provider.getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
if (providerStack != null){
if (providerStack.getItem() == null)
return new ArrayList<ItemStack>();
items.add(providerStack);
}
}
}
}
if (tileEntity != null && ModuleRegistrar.instance().hasStackProviders(tileEntity)){
ItemStack providerStack = ModuleRegistrar.instance().getStackProviders(tileEntity).get(0).getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
if (providerStack != null)
items.add(providerStack);
for (List<IWailaDataProvider> providersList : ModuleRegistrar.instance().getStackProviders(tileEntity).values()){
for(IWailaDataProvider provider : providersList){
ItemStack providerStack = provider.getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
if (providerStack != null){
if (providerStack.getItem() == null)
return new ArrayList<ItemStack>();
items.add(providerStack);
}
}
}
}
if(items.size() > 0)
@@ -20,6 +20,7 @@ import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderIcon;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderString;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderTrueTyper;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
@@ -106,7 +107,7 @@ public class Tooltip {
for (String s : textData){
ArrayList<String> line = new ArrayList(Arrays.asList(patternTab.split(s)));
ArrayList<String> line = new ArrayList<String>(Arrays.asList(patternTab.split(s)));
ArrayList<Integer> size = new ArrayList<Integer>();
for (String ss : line)
size.add(DisplayUtil.getDisplayWidth(ss));
@@ -174,6 +175,7 @@ public class Tooltip {
offsetX += (columnsWidth.get(c) - DisplayUtil.getDisplayWidth(currentLine.substring(lineMatcher.start()))) / 2;
renderable = new Renderable(new TTRenderString(DisplayUtil.stripWailaSymbols(cs)), new Point(offsetX, offsetY));
//renderable = new Renderable(new TTRenderTrueTyper(DisplayUtil.stripWailaSymbols(cs)), new Point(offsetX, offsetY));
this.elements.add(renderable);
}
@@ -4,6 +4,7 @@ import java.util.List;
import org.lwjgl.input.Keyboard;
import mcp.mobius.waila.api.ITaggedList;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.MetaDataProvider;
@@ -58,8 +59,10 @@ public class WailaTickHandler{
@SideOnly(Side.CLIENT)
public void tickClient(TickEvent.ClientTickEvent event) {
if (!Keyboard.isKeyDown(KeyEvent.key_show.getKeyCode()) && !ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, false)){
ConfigHandler.instance().setConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, false);
if (!Keyboard.isKeyDown(KeyEvent.key_show.getKeyCode()) &&
!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);
}
@@ -75,10 +78,10 @@ public class WailaTickHandler{
ItemStack targetStack = RayTracing.instance().getTargetStack(); // Here we get either the proper stack or the override
if (targetStack != null){
this.currenttip.clear();
this.currenttipHead.clear();
this.currenttipBody.clear();
this.currenttipTail.clear();
this.currenttip = new TipList<String, String>();
this.currenttipHead = new TipList<String, String>();
this.currenttipBody = new TipList<String, String>();
this.currenttipTail = new TipList<String, String>();
//this.identifiedHighlight = handler.identifyHighlight(world, player, target);
@@ -105,10 +108,10 @@ public class WailaTickHandler{
Entity targetEnt = RayTracing.instance().getTargetEntity(); // This need to be replaced by the override check.
if (targetEnt != null){
this.currenttip.clear();
this.currenttipHead.clear();
this.currenttipBody.clear();
this.currenttipTail.clear();
this.currenttip = new TipList<String, String>();
this.currenttipHead = new TipList<String, String>();
this.currenttipBody = new TipList<String, String>();
this.currenttipTail = new TipList<String, String>();
this.currenttipHead = handler.handleEntityTextData(targetEnt, world, player, target, accessor, currenttipHead, Layout.HEADER);
this.currenttipBody = handler.handleEntityTextData(targetEnt, world, player, target, accessor, currenttipBody, Layout.BODY);
@@ -0,0 +1,71 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import static mcp.mobius.waila.api.SpecialChars.WailaIcon;
import static mcp.mobius.waila.api.SpecialChars.WailaStyle;
import java.awt.Dimension;
import net.minecraft.util.MathHelper;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.overlay.IconUI;
import mcp.mobius.waila.overlay.OverlayRenderer;
/**
* Custom renderer for health bars.
* Syntax : {waila.health, nheartperline, health, maxhealth}
*
*/
public class TTRenderHealth implements IWailaTooltipRenderer {
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
float maxhearts = Float.valueOf(params[0]);
float health = Float.valueOf(params[1]);
float maxhealth = Float.valueOf(params[2]);
int heartsPerLine = (int)(Math.min(maxhearts, Math.ceil(maxhealth)));
int nlines = (int)(Math.ceil(maxhealth/maxhearts));
return new Dimension(8 * heartsPerLine, 10 * nlines - 2);
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
float maxhearts = Float.valueOf(params[0]);
float health = Float.valueOf(params[1]);
float maxhealth = Float.valueOf(params[2]);
int nhearts = MathHelper.ceiling_float_int(maxhealth);
int heartsPerLine = (int)(Math.min(maxhearts, Math.ceil(maxhealth)));
int offsetX = 0;
int offsetY = 0;
for (int iheart = 1; iheart <= nhearts; iheart++){
if (iheart <= MathHelper.floor_float(health)){
DisplayUtil.renderIcon(offsetX, offsetY, 8, 8, IconUI.HEART);
offsetX += 8;
}
if ((iheart > health) && (iheart < health + 1)){
DisplayUtil.renderIcon(offsetX, offsetY, 8, 8, IconUI.HHEART);
offsetX += 8;
}
if (iheart >= health + 1){
DisplayUtil.renderIcon(offsetX, offsetY, 8, 8, IconUI.EHEART);
offsetX += 8;
}
if (iheart%heartsPerLine == 0){
offsetY += 10;
offsetX = 0;
}
}
}
}
@@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.overlay.OverlayRenderer;
import mcp.mobius.waila.overlay.IconUI;
@@ -29,7 +30,7 @@ public class TTRenderIcon implements IWailaTooltipRenderer {
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
OverlayRenderer.renderIcon(0, 0, IconSize, IconSize, IconUI.bySymbol(WailaStyle + WailaIcon + type));
DisplayUtil.renderIcon(0, 0, IconSize, IconSize, IconUI.bySymbol(WailaStyle + WailaIcon + type));
}
}
@@ -0,0 +1,35 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Dimension;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.overlay.DisplayUtil;
public class TTRenderProgressBar implements IWailaTooltipRenderer{
Minecraft mc = Minecraft.getMinecraft();
ResourceLocation texture = new ResourceLocation("waila", "textures/sprites.png");
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
return new Dimension(32,16);
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
int currentValue = Integer.valueOf(params[0]);
int maxValue = Integer.valueOf(params[1]);
int progress = (currentValue * 28) / maxValue;
this.mc.getTextureManager().bindTexture(texture);
DisplayUtil.drawTexturedModalRect(4, 0, 4, 16, 28, 16, 28, 16);
DisplayUtil.drawTexturedModalRect(4, 0, 4, 0, progress + 1, 16, progress + 1, 16);
}
}
@@ -0,0 +1,38 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Dimension;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.overlay.DisplayUtil;
public class TTRenderStack implements IWailaTooltipRenderer{
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
return new Dimension(16,16);
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
int type = Integer.valueOf(params[0]); //0 for block, 1 for item
String name = params[1]; //Fully qualified name
int amount = Integer.valueOf(params[2]);
int meta = Integer.valueOf(params[3]);
ItemStack stack = null;
if (type == 0)
stack = new ItemStack((Block)Block.blockRegistry.getObject(name), amount, meta);
if (type == 1)
stack = new ItemStack((Item)Item.itemRegistry.getObject(name), amount, meta);
RenderHelper.enableGUIStandardItemLighting();
DisplayUtil.renderStack(0, 0, stack);
RenderHelper.disableStandardItemLighting();
}
}
@@ -1,10 +1,13 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Dimension;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.gui.truetyper.FontHelper;
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.overlay.OverlayConfig;
@@ -25,7 +28,7 @@ public class TTRenderString implements IWailaTooltipRenderer{
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
DisplayUtil.drawString(data, 0, 0, OverlayConfig.fontcolor, true);
DisplayUtil.drawString(data, 0, 0, OverlayConfig.fontcolor, true);
}
}
@@ -0,0 +1,32 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Dimension;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.gui.truetyper.FontHelper;
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import mcp.mobius.waila.overlay.DisplayUtil;
public class TTRenderTrueTyper implements IWailaTooltipRenderer{
final String data;
final Dimension size;
public TTRenderTrueTyper(String data){
this.data = data;
this.size = new Dimension(DisplayUtil.getDisplayWidth(data), data.equals("") ? 0 : (int)((TrueTypeFont)Waila.proxy.getFont()).getHeight()/2);
}
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
return size;
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
FontHelper.drawString(data, 0f, 0f, (TrueTypeFont)Waila.proxy.getFont(), 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f);
}
}
@@ -1,6 +1,5 @@
package mcp.mobius.waila.server;
import java.lang.reflect.Method;
import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.addons.agriculture.AgricultureModule;
@@ -19,14 +18,18 @@ import mcp.mobius.waila.addons.railcraft.RailcraftModule;
import mcp.mobius.waila.addons.statues.StatuesModule;
import mcp.mobius.waila.addons.stevescarts.StevesCartsModule;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.thermaldynamics.ThermalDynamicsModule;
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerFurnace;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.handlers.DecoratorFMP;
import mcp.mobius.waila.handlers.HUDHandlerFMP;
import java.lang.reflect.Method;
public class ProxyServer {
public ProxyServer() {}
@@ -36,6 +39,7 @@ public class ProxyServer {
public void registerMods(){
HUDHandlerVanilla.register();
HUDHandlerFurnace.register();
/* BUILDCRAFT */
BCModule.register();
@@ -57,6 +61,9 @@ public class ProxyServer {
/* Thermal Expansion */
ThermalExpansionModule.register();
/* Thermal Dynamics */
ThermalDynamicsModule.register();
/* ETB */
ETBModule.register();
@@ -1,12 +0,0 @@
package mcp.mobius.wailacore.asm;
import java.io.IOException;
import cpw.mods.fml.common.asm.transformers.AccessTransformer;
public class CoreAccessTransformer extends AccessTransformer {
public CoreAccessTransformer() throws IOException {
//super("waila_at.cfg");
}
}
@@ -1,35 +0,0 @@
package mcp.mobius.wailacore.asm;
import java.util.Arrays;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.LoadController;
import cpw.mods.fml.common.ModMetadata;
public class CoreContainer extends DummyModContainer {
public CoreContainer()
{
super(new ModMetadata());
ModMetadata md = getMetadata();
md.modId = "WailaCore";
md.name = "WailaCore";
md.version = "1.0.0";
md.credits = "ProfMobius";
md.authorList = Arrays.asList("ProfMobius");
md.description = "Coremod associated with Waila to force backward compatibility with the API";
md.url = "profmobius.blogspot.com";
}
@Override
public boolean registerBus(EventBus bus, LoadController controller)
{
//bus.register(this);
// this needs to return true, otherwise the mod will be deactivated by FML
return true;
}
}
@@ -1,43 +0,0 @@
package mcp.mobius.wailacore.asm;
import java.io.File;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
@IFMLLoadingPlugin.TransformerExclusions("mcp.mobius.wailacore.asm")
public class CoreDescription implements IFMLLoadingPlugin {
public static final Logger log = LogManager.getLogger("WailaCore");
@Override
public String[] getASMTransformerClass() {
return new String[] { "mcp.mobius.wailacore.asm.CoreTransformer" };
}
@Override
public String getModContainerClass() {
return "mcp.mobius.wailacore.asm.CoreContainer";
}
@Override
public String getSetupClass() {
return null;
}
@Override
public void injectData(Map<String, Object> data) {
if(data.containsKey("coremodLocation"))
location = (File) data.get("coremodLocation");
}
public static File location;
@Override
public String getAccessTransformerClass() {
return "mcp.mobius.wailacore.asm.CoreAccessTransformer";
}
}
@@ -1,73 +0,0 @@
package mcp.mobius.wailacore.asm;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import net.minecraft.launchwrapper.IClassTransformer;
public class CoreTransformer implements IClassTransformer {
public CoreTransformer(){
super();
}
@Override
public byte[] transform(String name, String srgname, byte[] bytes) {
/*
boolean changed = false;
ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0);
for (MethodNode methodNode : classNode.methods){
if (methodNode.name.equals("getNBTData")
&& methodNode.desc.equals("(Lnet/minecraft/tileentity/TileEntity;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/World;III)Lnet/minecraft/nbt/NBTTagCompound;"))
{
methodNode.desc = "(Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/tileentity/TileEntity;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/World;III)Lnet/minecraft/nbt/NBTTagCompound;";
changed = true;
CoreDescription.log.info(String.format("Class %s implements outdated getNBTData signature. Updating signature to most recent API.", name));
}
}
if (changed){
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
classNode.accept(writer);
return writer.toByteArray();
}
*/
/*
if (classNode.interfaces.contains("mcp/mobius/waila/api/IWailaDataProvider")){
CoreDescription.log.info(String.format("Identified Waila plugin class : %s", name));
for (MethodNode methodNode : classNode.methods){
CoreDescription.log.info(String.format(" %s - %s | %s | %s | %s", name, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature));
if (methodNode.name.equals("getNBTData")
&& methodNode.desc.equals("(Lnet/minecraft/tileentity/TileEntity;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/World;III)Lnet/minecraft/nbt/NBTTagCompound;"))
{
methodNode.desc = "(Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/tileentity/TileEntity;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/World;III)Lnet/minecraft/nbt/NBTTagCompound;";
CoreDescription.log.info(String.format("Class %s implements outdated getNBTData signature. Updating signature to most recent API.", name));
}
}
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
classNode.accept(writer);
return writer.toByteArray();
}
*/
return bytes;
}
}
@@ -0,0 +1,148 @@
screen.button.waila=Waila
screen.button.modules=Moduly
screen.label.scale=Mìøítko
screen.label.dragtuto=Chytni HUD pro nastavení jeho pozice.
screen.button.default=Defaultní
screen.button.cancel=Zrušit
screen.button.ok=Ok
screen.button.yes=Ano
screen.button.no=Ne
screen.button.back=Zpìt
screen.button.hidden=Skrytý
screen.button.visible=Viditelný
screen.button.maintained=Spravované
screen.button.toggled=Pøepnuté
choice.showhidewaila=Zobrazit/Skrýt Wailu
choice.showhideidmeta=Zobrazit ID:Metadata
choice.toggledmaintained=Pøepnuté/Spravované
choice.showliquids=Tekutiny
choice.shifttoggledblock=Pliž se pro pøepnutí blokù
choice.shifttoggledents=Pliž se pro pøepnutí entit
screen.button.configureaspect=Nastavení vzhledu...
enchant.title.name=Jméno
enchant.title.minlvl=Minimální lvl
enchant.title.maxlvl=Maximální lvl
enchant.title.weight=Hmotnost
enchant.label.enchantability=Oèarovatelnost
waila.keybind.wailaconfig=[Waila] Nastavení obrazu
waila.keybind.wailadisplay=[Waila] Zobrazit/Skrýt
waila.keybind.liquid=[Waila] Zobrazit tekutiny
waila.keybind.recipe=[Waila] Zobrazit recept
waila.keybind.usage=[Waila] Zobrazit použití
waila.keybind.testing=[Waila] Testování
client.msg.norecipe=Nenalezen žádný recept.
client.msg.nousage=Nenalezeno žádné využití.
hud.msg.none=<Nic>
hud.msg.empty=<Prázdný>
hud.msg.output=Výstup
hud.msg.input=Vstup
hud.msg.out=Ven
hud.msg.in=Dovnitø
hud.msg.power=Energie
hud.msg.storage=Úložištì
hud.msg.stored=Uloženo
hud.msg.any=Jakýkoliv
hud.msg.mode=Mód
hud.msg.maxpower=Maximální Energie
hud.msg.trigger=Spouštìè
hud.msg.maxio=Maximální propustnost
hud.msg.send=Odeslat
hud.msg.recv=Obdržet
hud.msg.item=Pøedmìt
hud.msg.fluid=Tekutina
hud.msg.energ=Energie
hud.msg.frequency=Frekvence
hud.msg.owner=Vlastník
hud.msg.public=Veøejné
hud.msg.restricted=Omezené
hud.msg.private=Soukromé
hud.msg.white=Bílá
hud.msg.orange=Oranžová
hud.msg.magenta=Purpurová
hud.msg.lblue=Svìtle modrá
hud.msg.yellow=Žlutá
hud.msg.lime=Svìtle zelená
hud.msg.pink=Rùžová
hud.msg.gray=Šedá
hud.msg.lgray=Svìtle šedá
hud.msg.cyan=Tyrkysová
hud.msg.purple=Fialová
hud.msg.blue=Modrá
hud.msg.brown=Hnìdá
hud.msg.green=Zelená
hud.msg.red=Èervená
hud.msg.black=Èerná
hud.msg.growth=Rùst
hud.msg.mature=Stáøí
hud.msg.off=Vypnuto
hud.msg.on=Zapnuto
hud.msg.state=Stav
hud.msg.delay=Prodleva
hud.msg.comparator=Porovnávaè
hud.msg.substractor=Substraktor
hud.msg.record=Záznam
hud.msg.offers=Poskytuje
hud.msg.demands=Požaduje
option.appeng.monitorcontent=Obsah monitoru
option.bb.content=Obsah barelu
option.bc.tankamount=Množství tekutiny
option.bc.tanktype=Typ tekutiny
option.enderstorage.colors=Barvy
option.ic2.inputeumach=Maximální pøíjem EU [Stroje]
option.ic2.inputeuother=Maximální pøíjem EU [Ostatní]
option.ic2.inputeu=Maximální pøijem EU
option.ic2.outputeu=Maximální výstup EU
option.ic2.storage=Uloženo energie
option.ic2.consump=Zobrazit spotøebu
option.ic2.tradeomat=Zobrazit Trade-O-Mat požadavek
option.thaumcraft.storedvis=Úložištì kondenzátoru
option.thermalexpansion.energyhandler=Zobrazit úložištì RF
option.thermalexpansion.energycell=Zobrazit ECell VSTUP/VÝSTUP
option.thermalexpansion.fluidtype=Zobrazit typ tekutiny
option.thermalexpansion.fluidamount=Zobrazit množství tekutiny
option.thermalexpansion.tankmode=Zobrazit mód nádrže
option.thermalexpansion.tesssendrecv=Tesseract mode
option.thermalexpansion.tessfreq=Frekvence Teseraktu
option.thermalexpansion.owner=Zobrazit majitele
option.thermalexpansion.conditemmode=Zobrazit mód Itemduktu
option.vanilla.spawntype=Typ spawneru
option.vanilla.growthvalue=Hodnota rùstu
option.vanilla.leverstate=Stav páky
option.vanilla.repeater=Prodleva opakovaèe
option.vanilla.comparator=Mód porovnávaèe
option.vanilla.redstone=Ruditová energie
option.vanilla.jukebox=Jukeboxový disk
option.vanilla.silverfish=Skrýt rybenku
option.etb.displaydata=Zobrazit data slotu
option.enderio.inout=Zobrazit vstup/výstup
option.enderio.storage=Zobrazit uskladnìné MJ
option.enderio.owner=Zobrazit majitele bloku
option.enderio.channel=Zobrazit kanál nadkrychle
option.bcapi.storage=Zobrazit uskladnìné MJ
option.bcapi.consump=Zobrazit maximální energii
option.bcapi.trigger=Zobrazit spouštìjící se energii
option.pr.showio=Zobrazit IO brány
option.pr.showdata=Zobrazit data bran
option.extrautilities.fluidamount=Zobrazit množství tekutin
option.openblocks.fluidamount=Zobrazit množství tekutin
option.railcraft.fluidamount=Zobrazit množství tekutin
option.secretrooms.hide=Skrýt camo bloky
option.carpenters.hide=Skrýt camo bloky
option.stevescarts.showall=Zobrazit data
option.stevescarts.colorblind=Barevný mód
option.stevescarts.shifttoggle=Shift pro pøepnutí
option.general.showhp=Zobrazit zdraví entit
option.general.showcrop=Zobrazit rùst plodin
option.thaumcraft.aspects=Zobrazit aspekty
@@ -143,6 +143,9 @@ option.carpenters.hide=Hide camo blocks
option.stevescarts.showall=Show data
option.stevescarts.colorblind=Colorblind mode
option.stevescarts.shifttoggle=Shift toggle
option.general.showents=Show entities
option.general.showhp=Show entities health
option.general.showcrop=Show crop growth
option.thaumcraft.aspects=Show aspects
option.thaumcraft.aspects=Show aspects
nei.options.keys.showenchant=Show enchanting values
Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

+4 -4
View File
@@ -1,10 +1,10 @@
[
{
"modid": "waila",
"name": "Waila",
"modid": "${modId}",
"name": "${modName}",
"description": "All your data are belong to us.",
"version": "${version}",
"mcversion": "${mcversion}",
"version": "${modVersion}",
"mcversion": "${minecraftVersion}",
"url": "",
"updateUrl": "",
"authors": ["ProfMobius"],