Compare commits

..
12 Commits
Author SHA1 Message Date
Jason Mitchell 8b30294ae0 update to explicit dependencies 2022-01-17 22:18:55 -08:00
Jason Mitchell d4441c85ce maven publish buildscript update 2022-01-17 22:18:46 -08:00
Kiwiand[Kiwi233] c1480d632c Update zh_CN.lang (#4)
Co-authored-by: [Kiwi233] <[[email protected]]>
2021-12-30 14:45:32 +01:00
Jason Mitchell 8268d0a384 Add License (#3) 2021-12-05 21:22:45 +01:00
boubou19 78eb719f06 Merge pull request #2 from GTNewHorizons/update-build-script
Update build script and CI
2021-11-30 15:40:51 +01:00
Johann Bernhardt 0c73ed59c3 Update build script and CI 2021-11-30 10:09:50 +01:00
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
122 changed files with 2276 additions and 2730 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
+51
View File
@@ -0,0 +1,51 @@
# 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
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+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
-10
View File
@@ -1,10 +0,0 @@
syntax: glob
*.orig
.gradle
build
eclipse
out
*.iml
*.ipr
*.iws
src/main/java/net/*
-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
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+111
View File
@@ -0,0 +1,111 @@
License per https://www.curseforge.com/minecraft/mc-mods/waila
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

+536 -90
View File
@@ -1,79 +1,367 @@
//version: 1642484596
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/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:2.0-SNAPSHOT'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
}
}
configurations {
deployerJars
//packed
//compile.extendsFrom packed
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")
id("maven-publish")
}
//add dependency repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
apply plugin: 'forge'
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
version = "1.5.11-RC3_1.8"
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
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
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"
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
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")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(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((getFile(targetPackageJava).exists() || getFile(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(getFile(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((getFile(targetPackageJava).exists() || getFile(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((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(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((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(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 first from the VERSION env and then git tag
String identifiedVersion
try {
String versionOverride = System.getenv("VERSION") ?: null
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
version = minecraftVersion + "-" + identifiedVersion
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
}
group = modGroup
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
}
else {
archivesBaseName = modId
}
minecraft {
version = "1.8-${config.forge_version}"
mappings = "snapshot_20141130"
runDir = "eclipse"
}
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
def root = project.projectDir.parentFile
sourceSets {
main {
java {
srcDir new File(root, "src")
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if(gradleTokenModId) {
replace gradleTokenModId, modId
}
resources {
srcDir new File(root, "resources")
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 {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
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"
}
}
}
dependencies {
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("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
exclude module: "gson"
exclude module: "commons-io"
exclude module: "log4j-core"
}
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
}
}
apply from: 'dependencies.gradle'
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()) {
getFile("/src/main/resources/mixins." + modId + ".json").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 {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
dependsOn(relocateShadowJar)
}
jar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
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.
@@ -83,66 +371,224 @@ processResources
// 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
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
if(usesMixins.toBoolean()) {
from refMap
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
//def commonManifest = {
// attributes 'FMLCorePlugin': 'mcp.mobius.wailacore.asm.CoreDescription'
// attributes 'FMLCorePluginContainsFMLMod': 'mcp.mobius.waila.Waila'
//}
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
jar {
exclude "**/client/gui/inventory/GuiContainer.class"
exclude "**/client/gui/inventory/GuiContainer.java"
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
// manifest commonManifest
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
// from {
// configurations.packed.collect {
// it.isDirectory() ? it : zipTree(it).matching {
// exclude "META-INF", "META-INF/**", "*META-INF*", "meta-inf"
// exclude "**.jar", "**/*.jar", "*.jar"
// }
// }
// }
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task devJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
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'
}
task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
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().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
if(!noPublishedSources) {
archives sourcesJar
}
archives devJar
if(apiPackage) {
archives apiJar
}
}
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
if(!noPublishedSources) {
artifact source: sourcesJar, classifier: "src"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!")
}
}
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
println("Build script update available! Run 'gradle updateBuildScript'")
}
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
}
boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("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
}
boolean isNewBuildScriptVersionAvailable(String projectDir) {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
}
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if(versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
// Helper methods
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/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
}
-7
View File
@@ -1,7 +0,0 @@
mc_version=1.8
forge_version=11.14.3.1521
ccl_version=1.1.2.139
ccc_version=1.0.5.36
nei_version=1.0.5.82
mod_version=1.0
waila_version=1.5.2a
+8
View File
@@ -0,0 +1,8 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH: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
+11
View File
@@ -0,0 +1,11 @@
// Add any additional repositiroes for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url = "https://jitpack.io"
}
}
@@ -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>
+41 -25
View File
@@ -1,34 +1,50 @@
package mcp.mobius.waila;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.commands.CommandDumpHandlers;
import mcp.mobius.waila.network.NetworkHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.overlay.DecoratorRenderer;
import mcp.mobius.waila.overlay.OverlayConfig;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.utils.ModIdentification;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLModContainer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraftforge.fml.relauncher.Side;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Field;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
@Mod(modid="Waila", name="Waila", version="1.5.11", dependencies="after:NotEnoughItems@[1.0.5.0,)", acceptableRemoteVersions="*")
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.network.NetworkHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.overlay.OverlayConfig;
import mcp.mobius.waila.overlay.DecoratorRenderer;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.ModIdentification;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.commands.CommandDumpHandlers;
@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,)")
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -45,7 +44,7 @@ public class HUDHandlerCrop implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
@@ -2,9 +2,9 @@ package mcp.mobius.waila.addons.buildcraft;
import java.lang.reflect.Method;
import net.minecraft.util.EnumFacing;
import org.apache.logging.log4j.Level;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
@@ -23,7 +23,7 @@ public class BCModule {
public static void register(){
try{
TileTank = Class.forName("buildcraft.factory.TileTank");
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", EnumFacing.class);
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
@@ -4,9 +4,9 @@ import java.util.List;
//import buildcraft.factory.TileTank;
import net.minecraft.client.renderer.EnumFaceDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import mcp.mobius.waila.cbcore.LangUtil;
@@ -66,7 +67,7 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
public FluidTankInfo getTank(IWailaDataAccessor accessor){
FluidTankInfo tank = null;
try{
tank = ((FluidTankInfo[])BCModule.TileTank_getTankInfo.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), EnumFacing.DOWN))[0];
tank = ((FluidTankInfo[])BCModule.TileTank_getTankInfo.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN))[0];
} catch (Exception e){
Waila.log.log(Level.ERROR, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
return null;
@@ -75,7 +76,7 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -58,7 +57,7 @@ public class HUDCarpentersBlocksTE implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -67,7 +66,7 @@ public class HUDHandlerCapacitor implements IWailaDataProvider{
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -71,7 +70,7 @@ public class HUDHandlerTesseract implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -76,7 +75,7 @@ public class HUDHandlerStorage implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
@@ -1,19 +1,18 @@
package mcp.mobius.waila.addons.etb;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import java.util.List;
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.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.List;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class HUDHandlerSocket implements IWailaDataProvider {
@@ -47,7 +46,7 @@ public class HUDHandlerSocket implements IWailaDataProvider {
ItemStack stack = new ItemStack(module, 1, sides[s]);
String tipstr = String.format("%-5s : %s ", EnumFacing.values()[s], stack.getDisplayName());
String tipstr = String.format("%-5s : %s ", ForgeDirection.getOrientation(s), stack.getDisplayName());
String configstr = "[ ";
@@ -106,7 +105,7 @@ public class HUDHandlerSocket implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,9 +6,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -41,7 +40,7 @@ public class HUDHandlerDrum implements IWailaDataProvider {
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(EnumFacing.DOWN);
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
currenttip.add(String.format("%d / %d mB", amount, tanks[0].capacity));
@@ -55,7 +54,7 @@ public class HUDHandlerDrum implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -35,7 +34,7 @@ public class HUDHandlerGravestone implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -47,7 +46,7 @@ public class HUDHandlerPamCrop implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -62,7 +61,7 @@ public class HUDHandlerTEGenerator implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
double storage = -1;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -45,7 +44,7 @@ public class HUDHandlerMagicalCrops implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,9 +6,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
@@ -31,7 +30,7 @@ public class HUDHandlerTank implements IWailaDataProvider {
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(EnumFacing.DOWN);
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
FluidStack fluid = tanks[0].fluid;
@@ -55,7 +54,7 @@ public class HUDHandlerTank implements IWailaDataProvider {
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(EnumFacing.DOWN);
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
if(tanks[0].fluid != null)
@@ -72,7 +71,7 @@ public class HUDHandlerTank implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
@@ -1,12 +1,12 @@
package mcp.mobius.waila.addons.projectred;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPDecorator;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.utils.NBTUtil;
import net.minecraft.util.EnumFacing;
public class HUDDecoratorRsGateLogic implements IWailaFMPDecorator {
@@ -44,14 +44,14 @@ public class HUDDecoratorRsGateLogic implements IWailaFMPDecorator {
//orient = orient - ((orient & 0x10) + (orient & 0x8) + (orient & 0x4));
int hOrient = orient & 0x3;
EnumFacing vOrient = EnumFacing.values()[(orient - (orient & 0x3)) >> 2];
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
//System.out.printf("%s\n", ForgeDirection.getOrientation(vOrient));
if (vOrient == EnumFacing.EAST)
if (vOrient == ForgeDirection.EAST)
hOrient -= 1;
if (vOrient == EnumFacing.WEST)
if (vOrient == ForgeDirection.WEST)
hOrient += 1;
if (hOrient == -1)
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
@@ -76,7 +75,7 @@ public class HUDHandlerTank implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -92,7 +91,7 @@ public class HUDTileEntityCamo implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -26,7 +25,7 @@ public class HUDHandlerStatues implements IWailaDataProvider {
try {
String skinName = (String)StatuesModule.skinName.get(accessor.getTileEntity());
if (skinName.equals("")){
TileEntity belowEnt = accessor.getWorld().getTileEntity(new BlockPos(accessor.getPosition().getX(), accessor.getPosition().down().getY(), accessor.getPosition().getZ()));
TileEntity belowEnt = accessor.getWorld().getTileEntity(accessor.getPosition().blockX, accessor.getPosition().blockY - 1, accessor.getPosition().blockZ);
if (StatuesModule.TileEntityStatue.isInstance(belowEnt))
skinName = (String)StatuesModule.skinName.get(belowEnt);
}
@@ -70,7 +69,7 @@ public class HUDHandlerStatues implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -151,7 +150,7 @@ public class HUDCargoManager implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -79,7 +78,7 @@ public class HUDCartAssembler implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -128,7 +127,7 @@ public class HUDLiquidManager implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
@@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -64,7 +63,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider{
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
tag.setTag("Aspects", new NBTTagList());
@@ -76,7 +75,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider{
if (!hasReveal) return tag;
HashMap knownAspects = (HashMap) ThaumcraftModule.CommonProxy_getKnownAspects.invoke(ThaumcraftModule.Thaumcraft_proxy.get(null));
LinkedHashMap playerAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects.get(knownAspects.get(player.getName()));
LinkedHashMap playerAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects.get(knownAspects.get(player.getCommandSenderName()));
LinkedHashMap tileAspects = new LinkedHashMap();
if (ThaumcraftModule.IAspectContainer.isInstance(te)){
@@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
@@ -63,7 +62,7 @@ public class HUDHandlerDuct implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
@@ -1,7 +1,6 @@
package mcp.mobius.waila.addons.thermalexpansion;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.common.registry.GameData;
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;
@@ -37,7 +36,7 @@ public class HUDHandlerCache implements IWailaDataProvider {
color = name.substring(0, 2);
if(storedItem != null) {
String namex = String.valueOf(GameData.getItemRegistry().getNameForObject(storedItem.getItem()));
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
@@ -84,7 +83,7 @@ public class HUDHandlerCache implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if(te != null)
te.writeToNBT(tag);
try {
@@ -103,7 +102,7 @@ public class HUDHandlerCache implements IWailaDataProvider {
is.stackSize = tag.getInteger("Count");
is.setItemDamage(Math.max(0, tag.getShort("Damage")));
if (tag.hasKey("tag", 10)) {
//is.stackTagCompound = tag.getCompoundTag("tag"); //TODO
is.stackTagCompound = tag.getCompoundTag("tag");
}
return is;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -43,7 +42,7 @@ public class HUDHandlerEnergyCell implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
int recv = ThermalExpansionModule.TileEnergyCell_Recv.getInt(te);
int send = ThermalExpansionModule.TileEnergyCell_Send.getInt(te);
@@ -8,9 +8,9 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@@ -38,11 +38,11 @@ public class HUDHandlerIBlockInfo implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
List info = new ArrayList();
Block block = world.getBlockState(pos).getBlock();
ThermalExpansionModule.IBlockInfo_getBlockInfo.invoke(block, world, pos, EnumFacing.DOWN, player, info, false);
Block block = world.getBlock(x, y, z);
ThermalExpansionModule.IBlockInfo_getBlockInfo.invoke(block, world, x, y, z, ForgeDirection.UNKNOWN, player, info, false);
for (Object i : info){
System.out.printf("%s\n", i);
@@ -6,9 +6,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@@ -52,7 +51,7 @@ public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
Integer energy = -1;
Integer maxsto = -1;
@@ -60,11 +59,11 @@ public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
energy = (Integer) ThermalExpansionModule.IEnergyInfo_getCurStorage.invoke(te);
maxsto = (Integer) ThermalExpansionModule.IEnergyInfo_getMaxStorage.invoke(te);
} else if (ThermalExpansionModule.IEnergyProvider.isInstance(te)){
energy = (Integer) ThermalExpansionModule.IEnergyProvider_getCurStorage.invoke(te, EnumFacing.DOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyProvider_getMaxStorage.invoke(te, EnumFacing.DOWN);
energy = (Integer) ThermalExpansionModule.IEnergyProvider_getCurStorage.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyProvider_getMaxStorage.invoke(te, ForgeDirection.UNKNOWN);
} else if (ThermalExpansionModule.IEnergyReceiver.isInstance(te)){
energy = (Integer) ThermalExpansionModule.IEnergyReceiver_getCurStorage.invoke(te, EnumFacing.DOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyReceiver_getMaxStorage.invoke(te, EnumFacing.DOWN);
energy = (Integer) ThermalExpansionModule.IEnergyReceiver_getCurStorage.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyReceiver_getMaxStorage.invoke(te, ForgeDirection.UNKNOWN);
}
tag.setInteger("Energy", energy);
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -63,7 +62,7 @@ public class HUDHandlerISecureTile implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
String owner = (String) ThermalExpansionModule.ISecureTile_getOwnerName.invoke(te);
int access = ((Enum) ThermalExpansionModule.ISecureTile_getAccess.invoke(te)).ordinal();
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -84,7 +83,7 @@ public class HUDHandlerTank implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(te);
tag.setInteger("Amount", amount);
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -94,7 +93,7 @@ public class HUDHandlerTesseract implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
byte modeItem = ThermalExpansionModule.TileTesseract_Item.getByte(te);
byte modeFluid = ThermalExpansionModule.TileTesseract_Fluid.getByte(te);
@@ -2,7 +2,7 @@ package mcp.mobius.waila.addons.thermalexpansion;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;
import org.apache.logging.log4j.Level;
import java.lang.reflect.Field;
@@ -55,12 +55,12 @@ public class ThermalExpansionModule {
// XXX : We register the Energy interface first
try{
IEnergyProvider = Class.forName("cofh.api.energy.IEnergyProvider");
IEnergyProvider_getMaxStorage = IEnergyProvider.getMethod("getMaxEnergyStored", EnumFacing.class);
IEnergyProvider_getCurStorage = IEnergyProvider.getMethod("getEnergyStored", EnumFacing.class);
IEnergyProvider_getMaxStorage = IEnergyProvider.getMethod("getMaxEnergyStored", ForgeDirection.class);
IEnergyProvider_getCurStorage = IEnergyProvider.getMethod("getEnergyStored", ForgeDirection.class);
IEnergyReceiver = Class.forName("cofh.api.energy.IEnergyReceiver");
IEnergyReceiver_getMaxStorage = IEnergyReceiver.getMethod("getMaxEnergyStored", EnumFacing.class);
IEnergyReceiver_getCurStorage = IEnergyReceiver.getMethod("getEnergyStored", EnumFacing.class);
IEnergyReceiver_getMaxStorage = IEnergyReceiver.getMethod("getMaxEnergyStored", ForgeDirection.class);
IEnergyReceiver_getCurStorage = IEnergyReceiver.getMethod("getEnergyStored", ForgeDirection.class);
IEnergyInfo = Class.forName("cofh.api.tileentity.IEnergyInfo");
IEnergyInfo_getMaxStorage = IEnergyInfo.getMethod("getInfoMaxEnergyStored");
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -35,7 +34,7 @@ public class TwilightForestGenericOverride implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
}
@@ -1,7 +1,6 @@
package mcp.mobius.waila.addons.vanillamc;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -13,69 +12,68 @@ public class HUDDecoratorVanilla implements IWailaBlockDecorator {
@Override
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
Tessellator tessellator = Tessellator.instance;
//UIHelper.drawBillboardText(itemStack.getDisplayName(), accessor.getRenderingPosition(), 0.5F, 1.5F, 0.5F, accessor.getPartialFrame());
UIHelper.drawFloatingText("IN", accessor.getRenderingPosition(), 0.5F, 0.2F, -0.2F, 90F, 0F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), -0.2F, 0.2F, 0.5F, 90F, 90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 1.2F, 0.2F, 0.5F, 90F, -90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 0.5F, 0.2F, 1.2F, 90F, -180F, 0F);
double offset = 0.1;
double delta = 1 + 2 * offset;
double x = accessor.getRenderingPosition().xCoord - offset;
double y = accessor.getRenderingPosition().yCoord - offset;
double z = accessor.getRenderingPosition().zCoord - offset;
tessellator.startDrawingQuads();
t.startDrawingQuads();
tessellator.setColorRGBA(255, 255, 255, 150);
t.setColorRGBA(255, 255, 255, 150);
tessellator.addVertex(x, y + 0.2 , z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z);
t.addVertex(x, y + 0.2 , z);
t.addVertex(x, y + 0.2 , z + delta/2 - 0.1);
t.addVertex(x + offset, y + 0.2, z + delta/2 - 0.1);
t.addVertex(x + offset, y + 0.2, z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x, y + 0.2 , z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 + 0.1);
t.addVertex(x, y + 0.2 , z + delta/2 + 0.1);
t.addVertex(x, y + 0.2 , z + delta);
t.addVertex(x + offset, y + 0.2, z + delta);
t.addVertex(x + offset, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + 0.1);
t.addVertex(x + delta - 0.1, y + 0.2 , z + 0.1);
t.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 - 0.1);
t.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 - 0.1);
t.addVertex(x + delta + offset - 0.1, y + 0.2, z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 + 0.1);
t.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 + 0.1);
t.addVertex(x + delta - 0.1, y + 0.2 , z + delta);
t.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta);
t.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x+ 0.1, y + 0.2, z);
tessellator.addVertex(x+ 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z);
t.addVertex(x+ 0.1, y + 0.2, z);
t.addVertex(x+ 0.1, y + 0.2, z+ offset);
t.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset);
t.addVertex(x+ delta/2 - 0.1, y + 0.2, z);
t.addVertex(x+ delta/2 + 0.1, y + 0.2, z);
t.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset);
t.addVertex(x+ delta, y + 0.2, z+ offset);
t.addVertex(x+ delta, y + 0.2, z);
t.addVertex(x + 0.1, y + 0.2, z+ delta - 0.1);
t.addVertex(x + 0.1, y + 0.2, z+ offset+ delta - 0.1);
t.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset+ delta - 0.1);
t.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ delta - 0.1);
t.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ delta - 0.1);
t.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset+ delta - 0.1);
t.addVertex(x+ delta - 0.1, y + 0.2, z+ offset+ delta - 0.1);
t.addVertex(x+ delta - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.draw();
tessellator.addVertex(x + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.draw();
}
}
@@ -1,21 +1,21 @@
package mcp.mobius.waila.addons.vanillamc;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import 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.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class HUDHandlerFurnace implements IWailaDataProvider {
@@ -37,12 +37,12 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
String renderStr = "";
{
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTagAt(0));
String name = String.valueOf(GameData.getItemRegistry().getNameForObject(stack.getItem()));
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 = String.valueOf(GameData.getItemRegistry().getNameForObject(stack.getItem()));
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
renderStr += SpecialChars.getRenderString("waila.stack", "1", name, String.valueOf(stack.stackSize), String.valueOf(stack.getItemDamage()));
}
@@ -50,7 +50,7 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
{
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTagAt(2));
String name = String.valueOf(GameData.getItemRegistry().getNameForObject(stack.getItem()));
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
renderStr += SpecialChars.getRenderString("waila.stack", "1", name, String.valueOf(stack.stackSize), String.valueOf(stack.getItemDamage()));
}
@@ -65,7 +65,7 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -73,6 +73,6 @@ public class HUDHandlerFurnace implements IWailaDataProvider {
public static void register(){
//ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
//ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
//ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerFurnace(), TileEntityFurnace.class);
}
}
@@ -1,34 +1,28 @@
package mcp.mobius.waila.addons.vanillamc;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneOre;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneOre;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class HUDHandlerVanilla implements IWailaDataProvider {
static Block mobSpawner = Blocks.mob_spawner;
static Block crops = Blocks.wheat;
static Block farmland = Blocks.farmland;
static Block melonStem = Blocks.melon_stem;
static Block pumpkinStem = Blocks.pumpkin_stem;
static Block carrot = Blocks.carrots;
@@ -71,31 +65,28 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
if (block == redstone){
return new ItemStack(Items.redstone);
}
if (block == doubleplant && (accessor.getMetadata() & 8) != 0) {
int x = accessor.getPosition().getX();
int y = accessor.getPosition().getY() - 1;
int z = accessor.getPosition().getZ();
int meta = doubleplant.getMetaFromState(accessor.getWorld().getBlockState(new BlockPos(x, y, z)));
return new ItemStack(doubleplant, 1, meta);
}
if (block == doubleplant && (accessor.getMetadata() & 8) != 0){
int x = accessor.getPosition().blockX;
int y = accessor.getPosition().blockY - 1;
int z = accessor.getPosition().blockZ;
int meta = accessor.getWorld().getBlockMetadata(x, y, z);
return new ItemStack(doubleplant, 0, meta);
}
if (block instanceof BlockRedstoneOre){
return new ItemStack(Blocks.redstone_ore);
}
if (block == crops){
if (block == crops ){
return new ItemStack(Items.wheat);
}
if (block == farmland){
return new ItemStack(Blocks.farmland);
}
if ((block == leave || block == leave2) && (accessor.getMetadata() > 3)) {
if ((block == leave || block == leave2) && (accessor.getMetadata() > 3)){
return new ItemStack(block, 1, accessor.getMetadata() - 4);
}
if (block == log || block == log2){
return new ItemStack(block, 1, accessor.getMetadata()%4);
}
@@ -112,11 +103,11 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
//Mob spawner handler
if (block == mobSpawner && accessor.getTileEntity() instanceof TileEntityMobSpawner && config.getConfig("vanilla.spawntype")) {
/* Mob spawner handler */
if (block == mobSpawner && accessor.getTileEntity() instanceof TileEntityMobSpawner && config.getConfig("vanilla.spawntype")){
String name = currenttip.get(0);
String mobname = ((TileEntityMobSpawner)accessor.getTileEntity()).getSpawnerBaseLogic().func_180612_a(accessor.getWorld()).getName();
currenttip.set(0, String.format( "%s (%s)", name, mobname));
String mobname = ((TileEntityMobSpawner)accessor.getTileEntity()).func_145881_a().getEntityNameToSpawn();
currenttip.set(0, String.format("%s (%s)", name, mobname));
}
if (block == redstone){
@@ -130,7 +121,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
if (block == pumpkinStem){
currenttip.set(0, SpecialChars.WHITE + "Pumpkin stem");
}
}
return currenttip;
}
@@ -148,18 +139,18 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
}
if (block == cocoa && config.getConfig("general.showcrop")){
float growthValue = ((accessor.getMetadata() >> 2) / 2.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
}
if (block == netherwart && config.getConfig("general.showcrop")){
float growthValue = (accessor.getMetadata() / 3.0F) * 100.0F;
if (growthValue < 100.0)
@@ -167,14 +158,14 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
}
if (config.getConfig("vanilla.leverstate"))
if (block == lever){
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? LangUtil.translateG("hud.msg.off") : LangUtil.translateG("hud.msg.on");
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.state"), redstoneOn));
return currenttip;
}
return currenttip;
}
if (config.getConfig("vanilla.repeater"))
if ((block == repeaterIdle) ||(block == repeaterActv)){
@@ -183,8 +174,8 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
currenttip.add(String.format("%s : %s tick", LangUtil.translateG("hud.msg.delay"), tick));
else
currenttip.add(String.format("%s : %s ticks", LangUtil.translateG("hud.msg.delay"), tick));
return currenttip;
}
return currenttip;
}
if (config.getConfig("vanilla.comparator"))
if ((block == comparatorIdl) ||(block == comparatorAct)){
@@ -192,28 +183,31 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
//int outputSignal = ((TileEntityComparator)entity).func_96100_a();
currenttip.add("Mode : " + mode);
//currenttip.add(String.format("Out : %s", outputSignal));
return currenttip;
}
return currenttip;
}
if (config.getConfig("vanilla.redstone"))
if (block == redstone){
currenttip.add(String.format("%s : %s" , LangUtil.translateG("hud.msg.power"), accessor.getMetadata()));
return currenttip;
}
return currenttip;
}
/*
if (config.getConfig("vanilla.jukebox"))
if (block == jukebox){
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("RecordItem", 10)) {
Item record = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("RecordItem")).getItem();
currenttip.add(LangUtil.translateG("record.nowPlaying").replace("%s", ((ItemRecord) record).getRecordNameLocal()));
Item record = null;
if (tag.hasKey("Record")){
record = Item.itemsList[accessor.getNBTInteger(tag, "Record")];
currenttip.add(((ItemRecord)record).getRecordTitle());
} else {
currenttip.add(LangUtil.translateG("hud.msg.empty"));
}
}
*/
return currenttip;
}
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
@@ -221,7 +215,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -235,7 +229,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.redstone");
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.silverfish");
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
IWailaDataProvider provider = new HUDHandlerVanilla();
ModuleRegistrar.instance().registerStackProvider(provider, silverfish.getClass());
@@ -243,7 +237,6 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
ModuleRegistrar.instance().registerStackProvider(provider, doubleplant.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, BlockRedstoneOre.class);
ModuleRegistrar.instance().registerStackProvider(provider, crops.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, farmland.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, leave.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, leave2.getClass());
ModuleRegistrar.instance().registerStackProvider(provider, log.getClass());
@@ -1,8 +1,10 @@
package mcp.mobius.waila.api;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
public interface ITaggedList<E, T> extends List<E> {
public boolean add(E e, T tag);
@@ -0,0 +1,34 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.item.ItemStack;
@Deprecated
public interface IWailaBlock {
/*
* Use this method to return an item stack in case the default lookup system fails.
* Return null if you want to use the default lookup system.
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
*/
ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config);
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
* body to where you mostly want to put informations, and I reserve the tail for modname display
*/
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
* currenttip represents the current list of text lines in the tooltip zone.
* For example, getWailaHead() will have the current item name as currenttip.
* You can modify the tips, add more, remove some, etc.
* When you are done, just returns the currenttip and it will display in Waila.
*
* Always return the currenttip is you don't want to modify the current zone.
*/
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
}
@@ -6,11 +6,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
@@ -28,11 +27,11 @@ public interface IWailaCommonAccessor {
int getMetadata();
TileEntity getTileEntity();
Entity getEntity();
BlockPos getPosition();
MovingObjectPosition getPosition();
Vec3 getRenderingPosition();
NBTTagCompound getNBTData();
int getNBTInteger(NBTTagCompound tag, String keyname);
double getPartialFrame();
EnumFacing getSide();
ForgeDirection getSide();
ItemStack getStack();
}
@@ -1,16 +1,14 @@
package mcp.mobius.waila.api;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.<br>
@@ -21,19 +19,19 @@ import net.minecraft.world.World;
*/
public interface IWailaDataAccessor{
World getWorld();
EntityPlayer getPlayer();
Block getBlock();
//int getBlockID();
int getMetadata();
IBlockState getBlockState();
int getBlockID();
String getBlockQualifiedName();
int getMetadata();
TileEntity getTileEntity();
MovingObjectPosition getMOP();
BlockPos getPosition();
MovingObjectPosition getPosition();
Vec3 getRenderingPosition();
NBTTagCompound getNBTData();
int getNBTInteger(NBTTagCompound tag, String keyname);
double getPartialFrame();
EnumFacing getSide();
ForgeDirection getSide();
ItemStack getStack();
}
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
@@ -75,8 +74,10 @@ public interface IWailaDataProvider{
* @param te The TileEntity targeted for synchronization.
* @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers).
* @param world TileEntity's World.
* @param pos Position of the TileEntity.
* @param x X position of the TileEntity.
* @param y Y position of the TileEntity.
* @param z Z position of the TileEntity.
* @return Modified input NBTTagCompound tag.
*/
NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos);
NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z);
}
@@ -19,7 +19,7 @@ public interface IWailaEntityAccessor {
World getWorld();
EntityPlayer getPlayer();
Entity getEntity();
MovingObjectPosition getMOP();
MovingObjectPosition getPosition();
Vec3 getRenderingPosition();
NBTTagCompound getNBTData();
int getNBTInteger(NBTTagCompound tag, String keyname);
@@ -55,7 +55,19 @@ public interface IWailaRegistrar {
/* The block decorators */
public void registerDecorator (IWailaBlockDecorator decorator, Class block);
public void registerDecorator (IWailaFMPDecorator decorator, String name);
public void registerDecorator (IWailaFMPDecorator decorator, String name);
/* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent).
* Accept * as a ending wildcard
* registerNBTKey("bob.*", MyBlock.class)
* registerNBTKey("data.life", MyEntity.class)
* registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5
*
* This registration method is deprecated in favor to registerNBTProvider.
* It will be removed in MC 1.8 !!!
* */
@Deprecated
public void registerSyncedNBTKey(String key, Class target);
public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer);
@@ -1,9 +1,9 @@
package mcp.mobius.waila.api;
import net.minecraft.item.ItemStack;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
public interface IWailaSummaryProvider {
/* This interface is used to control the display data in the description screen */
@@ -1,6 +1,7 @@
package mcp.mobius.waila.api;
import java.awt.*;
import java.awt.Dimension;
import java.awt.Point;
public interface IWailaTooltipRenderer {
@@ -1,5 +1,8 @@
package mcp.mobius.waila.api;
import static mcp.mobius.waila.api.SpecialChars.RENDER;
import static mcp.mobius.waila.api.SpecialChars.WailaStyle;
import java.util.regex.Pattern;
public class SpecialChars {
@@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Set;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.handlers.HUDHandlerEntities;
@@ -1,24 +1,22 @@
package mcp.mobius.waila.api.impl;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaEntityAccessor;
import mcp.mobius.waila.utils.NBTUtil;
import cpw.mods.fml.common.registry.GameData;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaEntityAccessor;
import mcp.mobius.waila.utils.NBTUtil;
public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAccessor, IWailaEntityAccessor{
@@ -27,8 +25,6 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
public MovingObjectPosition mop;
public Vec3 renderingvec = null;
public Block block;
public IBlockState state;
public BlockPos pos;
public int blockID;
public String blockResource;
public int metadata;
@@ -45,25 +41,21 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
this.set(_world, _player, _mop, null, 0.0);
}
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, Entity viewEntity, double partialTicks) {
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, EntityLivingBase viewEntity, double partialTicks) {
this.world = _world;
this.player = _player;
this.mop = _mop;
if (this.mop.typeOfHit == MovingObjectType.BLOCK){
this.pos = _mop.getBlockPos();
this.state = world.getBlockState(this.pos);
this.block = this.state.getBlock();
this.metadata = this.state.getBlock().getMetaFromState(this.state);
this.tileEntity = world.getTileEntity(this.pos);
this.block = world.getBlock(_mop.blockX, _mop.blockY, _mop.blockZ);
this.metadata = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
this.entity = null;
this.blockID = Block.getIdFromBlock(this.block);
this.blockResource = String.valueOf(GameData.getBlockRegistry().getNameForObject(this.block));
this.blockResource = GameData.getBlockRegistry().getNameForObject(this.block);
try{ this.stack = new ItemStack(this.block, 1, this.metadata); } catch (Exception e) {}
} else if (this.mop.typeOfHit == MovingObjectType.ENTITY){
this.pos = new BlockPos(_mop.entityHit);
this.state = null;
this.block = null;
this.metadata = -1;
this.tileEntity = null;
@@ -74,8 +66,8 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
if (viewEntity != null){
double px = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
double py = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
this.renderingvec = new Vec3(this.pos.getX() - px, this.pos.getY() - py, this.pos.getZ() - pz);
double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
this.renderingvec = Vec3.createVectorHelper(_mop.blockX - px, _mop.blockY - py, _mop.blockZ - pz);
this.partialFrame = partialTicks;
}
}
@@ -95,11 +87,6 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
@Override
public int getMetadata() {return this.metadata;}
@Override
public IBlockState getBlockState() {
return this.state;
}
@Override
public TileEntity getTileEntity() { return this.tileEntity;}
@@ -107,12 +94,7 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
public Entity getEntity() {return this.entity;}
@Override
public BlockPos getPosition() {
return this.pos;
}
@Override
public MovingObjectPosition getMOP() {return this.mop;}
public MovingObjectPosition getPosition() {return this.mop;}
@Override
public Vec3 getRenderingPosition() {return this.renderingvec;}
@@ -156,7 +138,7 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
int y = tag.getInteger("WailaY");
int z = tag.getInteger("WailaZ");
if (x == this.mop.getBlockPos().getX() && y == this.mop.getBlockPos().getY() && z == this.mop.getBlockPos().getZ())
if (x == this.mop.blockX && y == this.mop.blockY && z == this.mop.blockZ)
return true;
else {
this.timeLastUpdate = System.currentTimeMillis() - 250;
@@ -191,8 +173,8 @@ public class DataAccessorCommon implements IWailaCommonAccessor, IWailaDataAcces
}
@Override
public EnumFacing getSide() {
return this.getMOP().sideHit;
public ForgeDirection getSide() {
return ForgeDirection.getOrientation(this.getPosition().sideHit);
}
@Override
@@ -1,13 +1,13 @@
package mcp.mobius.waila.api.impl;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.utils.NBTUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.utils.NBTUtil;
public class DataAccessorFMP implements IWailaFMPAccessor {
@@ -32,7 +32,7 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
this.world = _world;
this.player = _player;
this.mop = _mop;
this.entity = world.getTileEntity(_mop.getBlockPos());
this.entity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
this.partialNBT = _partialNBT;
this.id = id;
this.renderingvec = renderVec;
@@ -106,7 +106,7 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
int y = tag.getInteger("y");
int z = tag.getInteger("z");
if (x == this.mop.getBlockPos().getX() && y == this.mop.getBlockPos().getY() && z == this.mop.getBlockPos().getZ())
if (x == this.mop.blockX && y == this.mop.blockY && z == this.mop.blockZ)
return true;
else {
this.timeLastUpdate = System.currentTimeMillis() - 250;
@@ -1,12 +1,20 @@
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;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaEntityProvider;
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;
@@ -16,11 +24,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.minecraftforge.common.config.Configuration;
public class MetaDataProvider{
@@ -38,6 +42,14 @@ public class MetaDataProvider{
public ItemStack identifyBlockHighlight(World world, EntityPlayer player, MovingObjectPosition mop, DataAccessorCommon accessor) {
Block block = accessor.getBlock();
int blockID = accessor.getBlockID();
if (IWailaBlock.class.isInstance(block)){
try{
return ((IWailaBlock)block).getWailaStack(accessor, ConfigHandler.instance());
}catch (Throwable e){
WailaExceptionHandler.handleErr(e, block.getClass().toString(), null);
}
}
if(ModuleRegistrar.instance().hasStackProviders(block)){
for (List<IWailaDataProvider> providerList : ModuleRegistrar.instance().getStackProviders(block).values()){
@@ -62,6 +74,12 @@ public class MetaDataProvider{
accessor.resetTimer();
HashSet<String> keys = new HashSet<String>();
if (ModuleRegistrar.instance().hasSyncedNBTKeys(block))
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(block));
if (ModuleRegistrar.instance().hasSyncedNBTKeys(accessor.getTileEntity()))
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getTileEntity()));
if (keys.size() != 0 || ModuleRegistrar.instance().hasNBTProviders(block) || ModuleRegistrar.instance().hasNBTProviders(accessor.getTileEntity()))
WailaPacketHandler.INSTANCE.sendToServer(new Message0x01TERequest(accessor.getTileEntity(), keys));
@@ -76,6 +94,29 @@ public class MetaDataProvider{
}
}
/* Interface IWailaBlock */
if (IWailaBlock.class.isInstance(block)){
TileEntity entity = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
if (layout == Layout.HEADER)
try{
return ((IWailaBlock)block).getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
}
else if (layout == Layout.BODY)
try{
return ((IWailaBlock)block).getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
}
else if (layout == Layout.FOOTER)
try{
return ((IWailaBlock)block).getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
}
}
headBlockProviders.clear();
bodyBlockProviders.clear();
tailBlockProviders.clear();
@@ -137,6 +178,13 @@ public class MetaDataProvider{
if (accessor.getEntity() != null && Waila.instance.serverPresent && accessor.isTimeElapsed(250)){
accessor.resetTimer();
HashSet<String> keys = new HashSet<String>();
if (ModuleRegistrar.instance().hasSyncedNBTKeys(accessor.getEntity()))
keys.addAll(ModuleRegistrar.instance().getSyncedNBTKeys(accessor.getEntity()));
if (keys.size() != 0 || ModuleRegistrar.instance().hasNBTEntityProviders(accessor.getEntity()))
WailaPacketHandler.INSTANCE.sendToServer(new Message0x03EntRequest(accessor.getEntity(), keys));
} else if (accessor.getEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
@@ -51,7 +51,9 @@ public class ModuleRegistrar implements IWailaRegistrar {
public LinkedHashMap<String, ArrayList<IWailaFMPProvider>> tailFMPProviders = new LinkedHashMap<String, ArrayList<IWailaFMPProvider>>();
public LinkedHashMap<String, ArrayList<IWailaFMPDecorator>> FMPClassDecorators = new LinkedHashMap<String, ArrayList<IWailaFMPDecorator>>();
public LinkedHashMap<Class, HashSet<String>> syncedNBTKeys = new LinkedHashMap<Class, HashSet<String>>();
public LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>>();
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
@@ -210,7 +212,16 @@ public class ModuleRegistrar implements IWailaRegistrar {
if (providers.contains(dataProvider)) return;
target.get(clazz).add(dataProvider);
}
}
@Deprecated
@Override
public void registerSyncedNBTKey(String key, Class target){
if (!this.syncedNBTKeys.containsKey(target))
this.syncedNBTKeys.put(target, new HashSet<String>());
this.syncedNBTKeys.get(target).add(key);
}
@Override
public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer){
@@ -308,6 +319,16 @@ public class ModuleRegistrar implements IWailaRegistrar {
Map<Integer, List<T>> returnList = new TreeMap<Integer, List<T>>();
returnList.put(0, target.get(name));
return returnList;
}
@Deprecated
public HashSet<String> getSyncedNBTKeys(Object target){
HashSet<String> returnList = new HashSet<String>();
for (Class clazz : this.syncedNBTKeys.keySet())
if (clazz.isInstance(target))
returnList.addAll(this.syncedNBTKeys.get(clazz));
return returnList;
}
/* HAS METHODS */
@@ -385,7 +406,15 @@ public class ModuleRegistrar implements IWailaRegistrar {
public boolean hasSummaryProvider(Class item){
return this.summaryProviders.containsKey(item);
}
}
@Deprecated
public boolean hasSyncedNBTKeys(Object target){
for (Class clazz : this.syncedNBTKeys.keySet())
if (clazz.isInstance(target))
return true;
return false;
}
/* ----------------- */
/*
@@ -1,3 +1,3 @@
@API(apiVersion="1.3",owner="Waila",provides="WailaAPI")
@API(apiVersion="1.2",owner="Waila",provides="WailaAPI")
package mcp.mobius.waila.api;
import net.minecraftforge.fml.common.API;
import cpw.mods.fml.common.API;
@@ -12,9 +12,9 @@ import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.common.registry.LanguageRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Easy localisation access.
@@ -1,16 +1,26 @@
package mcp.mobius.waila.client;
import java.util.List;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
import mcp.mobius.waila.overlay.RayTracing;
import mcp.mobius.waila.utils.Constants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import org.lwjgl.input.Keyboard;
public class KeyEvent {
public static KeyBinding key_cfg;
@@ -10,12 +10,14 @@ 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;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.cbcore.LangUtil;
public class ProxyClient extends ProxyServer {
@@ -9,7 +9,7 @@ import net.minecraft.command.ICommandSender;
public class CommandDumpHandlers extends CommandBase {
@Override
public String getName() {
public String getCommandName() {
return "dumphandlers";
}
@@ -19,7 +19,7 @@ public class CommandDumpHandlers extends CommandBase {
}
@Override
public void execute(ICommandSender sender, String[] string) {
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
System.out.printf("\n\n== HEAD BLOCK PROVIDERS ==\n");
for (Class clazz : ModuleRegistrar.instance().headBlockProviders.keySet()){
@@ -99,9 +99,9 @@ public class CommandDumpHandlers extends CommandBase {
public int getRequiredPermissionLevel(){ return 3; }
@Override
public boolean canCommandSenderUse(ICommandSender sender){
public boolean canCommandSenderUseCommand(ICommandSender sender){
//if ((sender instanceof EntityPlayerMP) && ((EntityPlayerMP)sender).playerNetServerHandler.netManager instanceof MemoryConnection) return true;
return super.canCommandSenderUse(sender);
}
return super.canCommandSenderUseCommand(sender);
}
}
@@ -1,7 +1,5 @@
package mcp.mobius.waila.gui.helpers;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -21,15 +19,14 @@ public class UIHelper {
{
float zLevel = 0.0F;
float f = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
t.startDrawingQuads();
t.addVertexWithUV((double)(posX + 0), (double)(posY + sizeY), (double)zLevel, texU*f, (texV + texSizeV)*f);
t.addVertexWithUV((double) (posX + sizeX), (double) (posY + sizeY), (double) zLevel, (texU + texSizeU) * f, (texV + texSizeV) * f);
t.addVertexWithUV((double)(posX + sizeX), (double)(posY + 0), (double)zLevel, (texU + texSizeU)*f, texV*f);
t.addVertexWithUV((double)(posX + 0), (double)(posY + 0), (double)zLevel, texU*f, texV*f);
tessellator.draw();
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV((double)(posX + 0), (double)(posY + sizeY), (double)zLevel, texU*f, (texV + texSizeV)*f);
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + sizeY), (double)zLevel, (texU + texSizeU)*f, (texV + texSizeV)*f);
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + 0), (double)zLevel, (texU + texSizeU)*f, texV*f);
tess.addVertexWithUV((double)(posX + 0), (double)(posY + 0), (double)zLevel, texU*f, texV*f);
tess.draw();
}
public static void drawGradientRect(int minx, int miny, int maxx, int maxy, int zlevel, int color1, int color2)
@@ -47,15 +44,14 @@ public class UIHelper {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
t.startDrawingQuads();
t.setColorRGBA_F(red1, green1, blue1, alpha1);
t.addVertex((double)maxx, (double)miny, (double)zlevel);
t.addVertex((double)minx, (double)miny, (double)zlevel);
t.setColorRGBA_F(red2, green2, blue2, alpha2);
t.addVertex((double)minx, (double)maxy, (double)zlevel);
t.addVertex((double)maxx, (double)maxy, (double)zlevel);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red1, green1, blue1, alpha1);
tessellator.addVertex((double)maxx, (double)miny, (double)zlevel);
tessellator.addVertex((double)minx, (double)miny, (double)zlevel);
tessellator.setColorRGBA_F(red2, green2, blue2, alpha2);
tessellator.addVertex((double)minx, (double)maxy, (double)zlevel);
tessellator.addVertex((double)maxx, (double)maxy, (double)zlevel);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
@@ -68,7 +64,7 @@ public class UIHelper {
}
public static void drawBillboard(float posX, float posY, float posZ, float offX, float offY, float offZ, double x1, double y1, double x2, double y2, int r, int g, int b, int a, double partialFrame){
Entity player = Minecraft.getMinecraft().getRenderViewEntity();
EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;
float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float)partialFrame;
float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float)partialFrame;
@@ -100,12 +96,14 @@ public class UIHelper {
GL11.glPopMatrix();
}
public static void drawBillboardText(String text, Vec3 pos, float offX, float offY, float offZ, double partialFrame){
UIHelper.drawBillboardText(text, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, offX, offY, offZ, partialFrame);
}
public static void drawBillboardText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, double partialFrame){
Entity player = Minecraft.getMinecraft().getRenderViewEntity();
EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;
float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float)partialFrame;
float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float)partialFrame;
@@ -120,11 +118,12 @@ public class UIHelper {
if (text.isEmpty()) return;
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
float f = 1.6F;
float f1 = 0.016666668F * f;
GL11.glPushMatrix();
//GL11.glTranslatef((float)accessor.getPosition().blockX + 0.0F, (float)accessor.getPosition().blockY + 0.5F, (float)accessor.getPosition().blockZ);
GL11.glTranslatef(posX + offX, posY + offY, posZ + offZ);
@@ -145,14 +144,14 @@ public class UIHelper {
byte b0 = 0;
GL11.glDisable(GL11.GL_TEXTURE_2D);
int j = fontRendererObj.getStringWidth(text) / 2;
int j = fontrenderer.getStringWidth(text) / 2;
drawRectangle((double)(-j - 1), (double)(8 + b0), 0.0, (double)(j + 1), (double)(-1 + b0), 0.0, 0, 0, 0, 64);
GL11.glEnable(GL11.GL_TEXTURE_2D);
fontRendererObj.drawString(text, -fontRendererObj.getStringWidth(text) / 2, b0, 553648127);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, 553648127);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
fontRendererObj.drawString(text, -fontRendererObj.getStringWidth(text) / 2, b0, -1);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, -1);
//GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_BLEND);
//GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -162,32 +161,30 @@ public class UIHelper {
}
public static void drawRectangle(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
Tessellator tessellator = Tessellator.instance;
t.startDrawingQuads();
t.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(r, g, b, a);
t.addVertex(x1, y2, z1);
t.addVertex(x1, y1, z2);
t.addVertex(x2, y1, z2);
t.addVertex(x2, y2, z1);
tessellator.addVertex(x1, y2, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y1, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
public static void drawRectangleEW(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
Tessellator tessellator = Tessellator.instance;
t.startDrawingQuads();
t.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(r, g, b, a);
t.addVertex(x1, y1, z1);
t.addVertex(x1, y1, z2);
t.addVertex(x2, y2, z2);
t.addVertex(x2, y2, z1);
tessellator.addVertex(x1, y1, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y2, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
@@ -1,12 +1,16 @@
package mcp.mobius.waila.gui.screens.info;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.*;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.ViewTable;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
public class ScreenEnchants extends ScreenBase {
@@ -1,12 +1,10 @@
package mcp.mobius.waila.gui.truetyper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import java.awt.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
@@ -16,6 +14,18 @@ import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import java.awt.GraphicsEnvironment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.settings.GameSettings;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL30;
import org.lwjgl.util.glu.GLU;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
@@ -233,9 +243,8 @@ public class TrueTypeFont {
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
float RenderHeight = (SrcHeight / textureHeight);
Tessellator t = Tessellator.instance;
//t.setColorRGBA_F(0f, 0f, 0f, 1f);
@@ -351,8 +360,7 @@ public class TrueTypeFont {
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer t = tessellator.getWorldRenderer();
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
// GL11.glBegin(GL11.GL_QUADS);
if(rgba.length == 4)
@@ -401,7 +409,7 @@ public class TrueTypeFont {
}
}
tessellator.draw();
t.draw();
// GL11.glEnd();
GL11.glPopMatrix();
@@ -1,10 +1,15 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Point;
import mcp.mobius.waila.cbcore.LangUtil;
public class LabelFixedFont extends WidgetBase {
protected String text = "";
@@ -42,13 +47,14 @@ public class LabelFixedFont extends WidgetBase {
if (this.geom == null)
this.geom = new WidgetGeometry(0,0,50,50, CType.ABSXY, CType.ABSXY);
this.geom = new WidgetGeometry(this.geom.x, this.geom.y, this.mc.fontRendererObj.getStringWidth(this.text), 8, this.geom.posType, CType.ABSXY, this.geom.alignX, this.geom.alignY);
this.geom = new WidgetGeometry(this.geom.x, this.geom.y, this.mc.fontRenderer.getStringWidth(this.text), 8, this.geom.posType, CType.ABSXY, this.geom.alignX, this.geom.alignY);
}
@Override
public void draw(Point pos) {
this.saveGLState();
this.mc.fontRendererObj.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
//this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.loadGLState();
}
}
@@ -1,7 +1,9 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import org.lwjgl.util.Point;
public class LayoutBase extends WidgetBase {
@@ -248,6 +248,7 @@ public abstract class WidgetBase implements IWidget {
protected void saveGLState(){
hasBlending = GL11.glGetBoolean(GL11.GL_BLEND);
hasLight = GL11.glGetBoolean(GL11.GL_LIGHTING);
boundTexIndex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
GL11.glPushMatrix();
}
@@ -255,8 +256,10 @@ public abstract class WidgetBase implements IWidget {
protected void loadGLState(){
if (hasBlending) GL11.glEnable(GL11.GL_BLEND); else GL11.glDisable(GL11.GL_BLEND);
if (hasLight) GL11.glEnable(GL11.GL_LIGHTING); else GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, boundTexIndex);
GL11.glPopMatrix();
GL11.glPopAttrib();
//GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@Override
@@ -67,7 +67,7 @@ public abstract class ButtonBase extends WidgetBase {
@Override
public void onMouseClick(MouseEvent event){
if (event.button == 0)
this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
this.emit(Signal.CLICKED, event.button);
}
@@ -25,7 +25,7 @@ public class DecoratorFMP implements IWailaBlockDecorator {
String id = subtag.getString("id");
if (ModuleRegistrar.instance().hasFMPDecorator(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getMOP(), subtag, id, accessor.getRenderingPosition(), accessor.getPartialFrame());
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id, accessor.getRenderingPosition(), accessor.getPartialFrame());
for (List<IWailaFMPDecorator> providersList : ModuleRegistrar.instance().getFMPDecorators(id).values())
for (IWailaFMPDecorator provider : providersList)
@@ -1,5 +1,9 @@
package mcp.mobius.waila.handlers;
import java.util.List;
import cpw.mods.fml.common.registry.GameData;
import static mcp.mobius.waila.api.SpecialChars.*;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@@ -7,19 +11,17 @@ import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.ModIdentification;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import java.util.List;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDHandlerBlocks implements IWailaDataProvider {
@Override
@@ -57,8 +59,7 @@ public class HUDHandlerBlocks implements IWailaDataProvider {
currenttip.add("< Unnamed >");
else{
if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, true)){
currenttip.add(String.format(ITALIC + "< Unimplemented >"));
//currenttip.add(String.format(ITALIC + "[%s:%d] | %s", accessor.getBlock().getStateId(accessor.getBlockState()), accessor.getMetadata()/*, accessor.getBlockQualifiedName()*/));
currenttip.add(String.format(ITALIC + "[%d:%d] | %s", accessor.getBlockID(), accessor.getMetadata(), accessor.getBlockQualifiedName()));
}
}
return currenttip;
@@ -89,7 +90,7 @@ public class HUDHandlerBlocks implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
}
@@ -2,9 +2,9 @@ package mcp.mobius.waila.handlers;
import java.util.List;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -20,7 +20,7 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
public static int nhearts = 20;
public static float maxhpfortext = 40.0f;
@Override
public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) {
return null;
@@ -28,42 +28,42 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
@Override
public List<String> getWailaHead(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
try {
currenttip.add(WHITE + entity.getName());
} catch (Exception e) {
try{
currenttip.add(WHITE + entity.getCommandSenderName());
} catch (Exception e){
currenttip.add(WHITE + "Unknown");
}
}
return currenttip;
}
@Override
public List<String> getWailaBody(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("general.showhp")) return currenttip;
if (entity instanceof EntityLivingBase) {
if (entity instanceof EntityLivingBase){
String hptip = "";
nhearts = nhearts <= 0 ? 20 : nhearts;
float health = ((EntityLivingBase) entity).getHealth() / 2.0f;
float maxhp = ((EntityLivingBase) entity).getMaxHealth() / 2.0f;
if (((EntityLivingBase) entity).getMaxHealth() > maxhpfortext)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", ((EntityLivingBase) entity).getHealth(), ((EntityLivingBase) entity).getMaxHealth()));
else {
float health = ((EntityLivingBase)entity).getHealth() / 2.0f;
float maxhp = ((EntityLivingBase)entity).getMaxHealth() / 2.0f;
if (((EntityLivingBase)entity).getMaxHealth() > maxhpfortext)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", ((EntityLivingBase)entity).getHealth(), ((EntityLivingBase)entity).getMaxHealth()));
else{
currenttip.add(getRenderString("waila.health", String.valueOf(nhearts), String.valueOf(health), String.valueOf(maxhp)));
}
}
}
return currenttip;
return currenttip;
}
@Override
public List<String> getWailaTail(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
try {
try{
currenttip.add(BLUE + ITALIC + getEntityMod(entity));
} catch (Exception e) {
} catch (Exception e){
currenttip.add(BLUE + ITALIC + "Unknown");
}
return currenttip;
@@ -72,17 +72,18 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, Entity te, NBTTagCompound tag, World world) {
return tag;
}
private static String getEntityMod(Entity entity) {
String modName = "";
try {
EntityRegistration er = EntityRegistry.instance().lookupModSpawn(entity.getClass(), true);
ModContainer modC = er.getContainer();
modName = modC.getName();
} catch (NullPointerException e) {
modName = "Minecraft";
}
return modName;
}
}
}
private static String getEntityMod(Entity entity){
String modName = "";
try{
EntityRegistration er = EntityRegistry.instance().lookupModSpawn(entity.getClass(), true);
ModContainer modC = er.getContainer();
modName = modC.getName();
} catch (NullPointerException e){
modName = "Minecraft";
}
return modName;
}
}
@@ -2,7 +2,6 @@ package mcp.mobius.waila.handlers;
import java.util.List;
import net.minecraft.util.BlockPos;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -35,7 +34,7 @@ public class HUDHandlerFMP implements IWailaDataProvider {
String id = subtag.getString("id");
if (ModuleRegistrar.instance().hasHeadFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getMOP(), subtag, id);
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getHeadFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
@@ -55,7 +54,7 @@ public class HUDHandlerFMP implements IWailaDataProvider {
String id = subtag.getString("id");
if (ModuleRegistrar.instance().hasBodyFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getMOP(), subtag, id);
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getBodyFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
@@ -75,7 +74,7 @@ public class HUDHandlerFMP implements IWailaDataProvider {
String id = subtag.getString("id");
if (ModuleRegistrar.instance().hasTailFMPProviders(id)){
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getMOP(), subtag, id);
DataAccessorFMP.instance.set(accessor.getWorld(), accessor.getPlayer(), accessor.getPosition(), subtag, id);
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getTailFMPProviders(id).values()){
for (IWailaFMPProvider provider : providersList)
@@ -88,7 +87,7 @@ public class HUDHandlerFMP implements IWailaDataProvider {
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
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;
@@ -2,9 +2,9 @@ package mcp.mobius.waila.handlers;
import mcp.mobius.waila.utils.ModIdentification;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class VanillaTooltipHandler {
@SubscribeEvent
@@ -12,6 +12,6 @@ public class VanillaTooltipHandler {
public void tooltipEvent(ItemTooltipEvent event) {
String canonicalName = ModIdentification.nameFromStack(event.itemStack);
if (canonicalName != null && !canonicalName.equals(""))
event.toolTip.add("\u00a79\u00a7o" + canonicalName);
event.toolTip.add("\u00a79\u00a7o" + canonicalName);
}
}
@@ -1,9 +1,7 @@
package mcp.mobius.waila.handlers.nei;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler;
import mcp.mobius.waila.Waila;
import java.util.Map;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.ModIdentification;
@@ -13,122 +11,132 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.Level;
import java.util.Locale;
import java.util.Map;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler;
public class HandlerEnchants implements IContainerInputHandler {
@Override
public boolean keyTyped(GuiContainer guiContainer, char keyChar, int keyCode) {
return false;
}
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; }
@Override
public void onKeyTyped(GuiContainer guiContainer, char keyChar, int keyID) {
}
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { }
@Override
public boolean lastKeyTyped(GuiContainer guiContainer, char keyChar, int keyID) {
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
GuiContainerManager.getManager();
ItemStack stackover = GuiContainerManager.getStackMouseOver(guiContainer);
if (stackover == null)
ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
if(stackover == null)
return false;
if (keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_ENCH)) {
int itemEnchantability = stackover.getItem().getItemEnchantability();
if (itemEnchantability == 0) {
return false;
}
Minecraft mc = Minecraft.getMinecraft();
ScreenEnchants screen = new ScreenEnchants(mc.currentScreen);
screen.setStack(stackover);
screen.setName(stackover.getDisplayName());
screen.setEnchantability(String.valueOf(itemEnchantability));
Enchantment[] enchants = null;
if (stackover.getItem() == Items.book)
enchants = Enchantment.enchantmentsBookList;
else
enchants = Enchantment.enchantmentsBookList;
for (Enchantment enchant : enchants) {
boolean isCompatible = true;
int level = 0;
boolean isApplied = false;
if (enchant == null) {
continue;
}
if (enchant.canApplyAtEnchantingTable(stackover) || stackover.getItem() == Items.book) {
if (stackover.isItemEnchanted()) {
Map stackenchants = EnchantmentHelper.getEnchantments(stackover);
for (Object id : stackenchants.keySet()) {
if (!enchant.canApplyTogether(Enchantment.getEnchantmentById((Integer) id)))
isCompatible = false;
if ((Integer) id == enchant.effectId) {
isApplied = true;
level = (Integer) stackenchants.get(id);
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_ENCH)){
//try{
int itemEnchantability = stackover.getItem().getItemEnchantability();
if (itemEnchantability == 0){return false;}
Minecraft mc = Minecraft.getMinecraft();
ScreenEnchants screen = new ScreenEnchants(mc.currentScreen);
screen.setStack(stackover);
screen.setName(stackover.getDisplayName());
screen.setEnchantability(String.valueOf(itemEnchantability));
Enchantment[] enchants = null;
if (stackover.getItem() == Items.book)
enchants = Enchantment.enchantmentsBookList;
else
enchants = Enchantment.enchantmentsList;
for(Enchantment enchant : enchants){
boolean isCompatible = true;
int level = 0;
boolean isApplied = false;
if (enchant == null){continue;}
if (enchant.canApplyAtEnchantingTable(stackover) || stackover.getItem() == Items.book){
if (stackover.isItemEnchanted()){
Map stackenchants = EnchantmentHelper.getEnchantments(stackover);
for (Object id : stackenchants.keySet()){
if (!enchant.canApplyTogether(Enchantment.enchantmentsList[(Integer)id]))
isCompatible = false;
if ((Integer)id == enchant.effectId){
isApplied = true;
level = (Integer)stackenchants.get(id);
}
}
}
}
for (int lvl = enchant.getMinLevel(); lvl <= enchant.getMaxLevel(); lvl++) {
String colorcode = isCompatible ? "\u00a7f" : "\u00a7c";
if (isApplied && lvl == level)
colorcode = "\u00a7e";
String enchantModName = getEnchantModName(enchant);
if (enchantModName == null) {
enchantModName = "Minecraft";
for (int lvl = enchant.getMinLevel(); lvl <= enchant.getMaxLevel(); lvl++){
int minEnchantEnchantability = enchant.getMinEnchantability(lvl);
int maxEnchantEnchantability = enchant.getMaxEnchantability(lvl);
int minItemEnchantability = 1;
int meanItemEnchantability = 1 + itemEnchantability/4;
int maxItemEnchantability = 1 + itemEnchantability/2;
int minModifiedEnchantability = (int)(0.85*minItemEnchantability + 0.5);
int meanModifiedEnchantability = (int)(1.00*meanItemEnchantability + 0.5);
int maxModifiedEnchantability = (int)(1.15*maxItemEnchantability + 0.5);
int minLevel = (int) ((minEnchantEnchantability - minModifiedEnchantability)/1.15);
int maxLevel = (int) ((maxEnchantEnchantability - maxModifiedEnchantability)/0.85);
int meanMinLevel = (int) ((minEnchantEnchantability - meanModifiedEnchantability)/1.0);
int meanMaxLevel = (int) ((maxEnchantEnchantability - meanModifiedEnchantability)/1.0);
String colorcode = isCompatible ? "\u00a7f" : "\u00a7c";
if (isApplied && lvl == level)
colorcode = "\u00a7e";
screen.addRow(colorcode + enchant.getTranslatedName(lvl),
colorcode + String.valueOf(minLevel),
colorcode + String.valueOf(maxLevel),
colorcode + String.valueOf(enchant.getWeight()),
"\u00a79\u00a7o"+ ModIdentification.nameFromObject(enchant));
}
screen.addRow(colorcode + enchant.getTranslatedName(lvl),
colorcode + String.valueOf(enchant.getMinLevel()),
colorcode + String.valueOf(enchant.getMaxLevel()),
colorcode + String.valueOf(enchant.getWeight()),
"\u00a79\u00a7o" + enchantModName);
}
}
}
mc.displayGuiScreen(screen);
mc.displayGuiScreen(screen);
}
return false;
}
/*
public String getEnchantModName(Enchantment enchant){
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
Waila.log.log(Level.DEBUG, enchantPath);
//mod_Waila.log.log(Level.INFO, enchantPath);
String enchantModName = "<Unknown>";
for (String s: ModIdentification.modSource_ID.keySet())
if (enchantPath.toLowerCase(Locale.US).contains(s.toLowerCase(Locale.US)))
return enchantModName = ModIdentification.modSource_ID.get(s);
return null;
for (String s: mod_Waila.instance.modSourceList.keySet())
if (enchantPath.contains(s))
enchantModName = mod_Waila.instance.modSourceList.get(s);
if (enchantModName.equals("Minecraft Coder Pack"))
enchantModName = "Minecraft";
return enchantModName;
}
*/
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { return false; }
@Override
public boolean mouseClicked(GuiContainer guiContainer, int mouseX, int mouseY, int button) { return false; }
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { }
@Override
public void onMouseClicked(GuiContainer guiContainer, int mouseX, int mouseY, int button) {}
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { }
@Override
public void onMouseUp(GuiContainer guiContainer, int mouseX, int mouseY, int button) {}
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { return false; }
@Override
public boolean mouseScrolled(GuiContainer guiContainer, int mouseX, int mouseY, int scrolled) { return false; }
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { }
@Override
public void onMouseScrolled(GuiContainer guiContainer, int mouseX, int mouseY, int scrolled) {}
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { }
@Override
public void onMouseDragged(GuiContainer guiContainer, int mouseX, int mouseY, int button, long heldTime) {}
}
}
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more