mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 22:34:08 +00:00
Compare commits
167
Commits
1.9.1-GTNH
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c5c51e6fa | ||
|
|
37379acd3d | ||
|
|
3f62d4b8fe | ||
|
|
2257f1648c | ||
|
|
cefdfd7ca6 | ||
|
|
c802a448e4 | ||
|
|
daae5de075 | ||
|
|
abd62c1076 | ||
|
|
8e709b0190 | ||
|
|
a16181c480 | ||
|
|
9f9c413b48 | ||
|
|
31eb7b3516 | ||
|
|
d213b7bf0a | ||
|
|
c168882a48 | ||
|
|
073ae658b5 | ||
|
|
0e88bd8a9c | ||
|
|
9d1709dd74 | ||
|
|
ffdce1834c | ||
|
|
3fa2240e61 | ||
|
|
ec99a884b6 | ||
|
|
944aec7441 | ||
|
|
9d677e7734 | ||
|
|
0852f91ba7 | ||
|
|
38845602a9 | ||
|
|
4878e88fce | ||
|
|
fa850857e8 | ||
|
|
e0a0b1ec53 | ||
|
|
d42076af69 | ||
|
|
610dad28b7 | ||
|
|
eb767ebeaa | ||
|
|
1516aa495e | ||
|
|
bba06bcf46 | ||
|
|
d407ca2c31 | ||
|
|
c0daedcbd8 | ||
|
|
4ee06de9f0 | ||
|
|
506f2200ef | ||
|
|
98860ee317 | ||
|
|
5ca552ce88 | ||
|
|
db1ad3a768 | ||
|
|
c047644908 | ||
|
|
33be87e896 | ||
|
|
7c42710a1a | ||
|
|
e4b5b2c2ff | ||
|
|
8350bd9dc7 | ||
|
|
5dc4882038 | ||
|
|
9404223f53 | ||
|
|
9157df8e3b | ||
|
|
143b8286d8 | ||
|
|
825758d639 | ||
|
|
f4f7485a12 | ||
|
|
a0d7b4dde8 | ||
|
|
d3f4b99d23 | ||
|
|
96521a399b | ||
|
|
c5ceef1a78 | ||
|
|
c72988e435 | ||
|
|
26a8bd6a26 | ||
|
|
23e4f6760d | ||
|
|
72da2272d1 | ||
|
|
36deb60855 | ||
|
|
c387a30be8 | ||
|
|
bcf96ed130 | ||
|
|
7b767d52c5 | ||
|
|
e812d33caf | ||
|
|
a0ba2f2d6a | ||
|
|
10f4e05d37 | ||
|
|
2b586edcf2 | ||
|
|
36dfeea862 | ||
|
|
e8fb04df37 | ||
|
|
f5a21fe41e | ||
|
|
5b81cbe85e | ||
|
|
af57a9fa05 | ||
|
|
f323fe2ac0 | ||
|
|
903619e38c | ||
|
|
7f838cd24c | ||
|
|
512aa4eddb | ||
|
|
13d5384687 | ||
|
|
909cc503c5 | ||
|
|
12f260d494 | ||
|
|
0872239905 | ||
|
|
54508ae852 | ||
|
|
952f9b89ab | ||
|
|
67b44ca6f8 | ||
|
|
ff36cef1f2 | ||
|
|
d5c4e9217b | ||
|
|
6610499e7c | ||
|
|
ebcca54ad4 | ||
|
|
89237f644a | ||
|
|
052041f846 | ||
|
|
8f1d0abbeb | ||
|
|
d179ee57e9 | ||
|
|
1e2c85f898 | ||
|
|
f1900cd9b3 | ||
|
|
398af04ea5 | ||
|
|
d5beca8e52 | ||
|
|
db3e5b6388 | ||
|
|
177cb6af04 | ||
|
|
0c89751e53 | ||
|
|
98cb2bb68c | ||
|
|
7d615a0ceb | ||
|
|
d2be71b4e3 | ||
|
|
d03a0c697c | ||
|
|
e8da80454b | ||
|
|
272075dd51 | ||
|
|
56bd18670f | ||
|
|
29f0c6af40 | ||
|
|
5ed33dfa4f | ||
|
|
7a74dabcea | ||
|
|
68518a7858 | ||
|
|
f83cd1ab0b | ||
|
|
5595d0377c | ||
|
|
6c4d37a345 | ||
|
|
77e14f3c8a | ||
|
|
71e00772b7 | ||
|
|
cf60696c68 | ||
|
|
d24f3facfe | ||
|
|
5cdf19daac | ||
|
|
93e6a1f7ba | ||
|
|
1039b52854 | ||
|
|
33a26a5059 | ||
|
|
5ba45cb86d | ||
|
|
2f47326c7f | ||
|
|
876b18328d | ||
|
|
391406e1de | ||
|
|
dfaa6dde5a | ||
|
|
c14b5d4ddb | ||
|
|
c90e492a66 | ||
|
|
8a5fa6c441 | ||
|
|
3caf8954ad | ||
|
|
09ccf50fde | ||
|
|
54f79398b1 | ||
|
|
84e758e450 | ||
|
|
751640ccec | ||
|
|
4013121abf | ||
|
|
9be15c8ecd | ||
|
|
0c87c31d1d | ||
|
|
b25ef783b3 | ||
|
|
b2b13d9328 | ||
|
|
9e0c82ce36 | ||
|
|
b002bbdd44 | ||
|
|
d33b0cc836 | ||
|
|
5d5277c50b | ||
|
|
a3345d26d3 | ||
|
|
6dce0d9e7b | ||
|
|
6826c25e30 | ||
|
|
528a9a4010 | ||
|
|
c6f94fabc9 | ||
|
|
443aa9733b | ||
|
|
9bf784e82c | ||
|
|
21ce111286 | ||
|
|
19a4028e94 | ||
|
|
ef026803d4 | ||
|
|
a5e1140a2b | ||
|
|
8648533ca9 | ||
|
|
d9042019e5 | ||
|
|
538256cc45 | ||
|
|
8b85a621e1 | ||
|
|
12de9b630d | ||
|
|
7102cc427f | ||
|
|
27053bfeab | ||
|
|
da9019451b | ||
|
|
b8f7f4ee03 | ||
|
|
fe754d3733 | ||
|
|
8c685b42bc | ||
|
|
a7fb7e7b7d | ||
|
|
c0b8fffc40 | ||
|
|
208c74d877 | ||
|
|
74f0f48fd7 |
No files matched your search
@@ -0,0 +1,44 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
@@ -0,0 +1,62 @@
|
||||
name: Report Bug
|
||||
description: "Report a bug."
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "A bug/crash report with sufficient information and logs to reproduce and track down."
|
||||
- type: input
|
||||
id: discord
|
||||
attributes:
|
||||
label: Your GTNH Discord Username
|
||||
description: Leave empty if you don't have one, but this will make it harder to contact you if we need additional info.
|
||||
placeholder: "Example: Fake#1234"
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Mod Version
|
||||
description: "What version of the Mod are you using?"
|
||||
placeholder: "Example: 1.0.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: report
|
||||
attributes:
|
||||
label: Bug Report
|
||||
description: "Relevant information, as well as relevant logs attached such as `logs/fml-client-latest.log."
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: java
|
||||
attributes:
|
||||
label: Java Version
|
||||
description: What Java version are you using? It's worth mentioning that if you play on Java9+ you should try update to latest minor release (e.g. prefer Java 17.0.6 over 17.0.2) of that version.
|
||||
options:
|
||||
- Java 8
|
||||
- Java 9
|
||||
- Java 11
|
||||
- Java 17
|
||||
- Java 19
|
||||
- Java 20
|
||||
- Java 21
|
||||
- Other (Please Specify)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: modlist
|
||||
attributes:
|
||||
label: Mod List or GTNH Pack Version
|
||||
description: "List of mods, ideally a minimal reproducible set (can be retrieved from latest.log). If using GTNH please indicate pack version and any changed mods, not the entire modlist."
|
||||
placeholder: "List of mods or GTNH Pack version goes here"
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: final
|
||||
attributes:
|
||||
label: Final Checklist
|
||||
description: Certify that you read things
|
||||
options:
|
||||
- label: "I have searched the issues and haven't found a similar issue."
|
||||
required: true
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Feature Request
|
||||
description: "Request a feature."
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Please use this form to request features. We ask you check if it was already requested though"
|
||||
- type: input
|
||||
id: discord
|
||||
attributes:
|
||||
label: Your GTNH Discord Username
|
||||
description: Leave empty if you don't have one, but this will make it harder to contact you if we need additional info.
|
||||
placeholder: "Example: Wumpus#1234"
|
||||
- type: textarea
|
||||
id: request
|
||||
attributes:
|
||||
label: Feature Request
|
||||
description: "Relevant information, as well as relevant images"
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: final
|
||||
attributes:
|
||||
label: Final Checklist
|
||||
description: Certify that you read things
|
||||
options:
|
||||
- label: "I have searched the issues and haven't found a similar issue."
|
||||
required: true
|
||||
@@ -1,9 +0,0 @@
|
||||
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
|
||||
@@ -1,5 +1,3 @@
|
||||
# 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
|
||||
|
||||
@@ -11,35 +9,5 @@ on:
|
||||
|
||||
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 60 ./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
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,51 +1,14 @@
|
||||
# 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:
|
||||
- '*'
|
||||
tags: [ '*' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
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 }}
|
||||
release-tags:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||
secrets: inherit
|
||||
+10
-1
@@ -1,6 +1,7 @@
|
||||
.gradle
|
||||
.settings
|
||||
/.idea/
|
||||
/.vscode/
|
||||
/run/
|
||||
/build/
|
||||
/eclipse/
|
||||
@@ -25,5 +26,13 @@ whitelist.json
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
addon.local.gradle
|
||||
addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
+2
-591
@@ -1,594 +1,5 @@
|
||||
//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 {
|
||||
maven {
|
||||
name = "forge"
|
||||
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 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
|
||||
}
|
||||
}
|
||||
//version: 1707058017
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(projectJavaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
downloadJavadoc = true
|
||||
downloadSources = true
|
||||
}
|
||||
}
|
||||
|
||||
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 = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
|
||||
runDir = "run"
|
||||
|
||||
if (replaceGradleTokenInFile) {
|
||||
replaceIn replaceGradleTokenInFile
|
||||
if(gradleTokenModId) {
|
||||
replace gradleTokenModId, modId
|
||||
}
|
||||
if(gradleTokenModName) {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
replace gradleTokenVersion, versionDetails().lastTag
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(file("addon.gradle").exists()) {
|
||||
apply from: "addon.gradle"
|
||||
}
|
||||
|
||||
apply from: 'repositories.gradle'
|
||||
|
||||
configurations {
|
||||
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.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace version and mcversion
|
||||
expand "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 getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(coreModClass) {
|
||||
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : "mixins." + modId + ".json",
|
||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
||||
]
|
||||
}
|
||||
return manifestAttributes
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allJava)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
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)
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
Hey there. Looks like you want to contribute with an issue. Great. Here's what you have to do:
|
||||
* Have a look through the [Botania FAQ](http://botaniamod.net/faq.php), to see if your issue has been solved already;
|
||||
* Read through the steps on [Bug Reporting 101](http://vazkii.us/br101/) (You may skip this if you're already familiar with reporting issues, but it's good for newcomers);
|
||||
* Note the following points:
|
||||
* Issues regarding MCPC+/Cauldron that are not reproducible with forge only are **not accepted**;
|
||||
* Issues regarding outdated versions of the mod are **not accepted**;
|
||||
* Unless you manually update every mod on the pack to the latest, issues regarding any public modpack that is not officially maintained or supported by the botania developers (the ones in the modpack section of the website are not) are **not accepted**;
|
||||
* Duplicate issues or issues that have been solved already (use the search feature!) will be closed without asking.
|
||||
* Do not tag your issues' names. "Something Broke" is prefered to "[Bug] Something Broke" because there's a proper label system in place.
|
||||
* Suggestions are **not** accepted here. Post them on the forums or reddit instead. If there's any still open they're old ones before this rule was added.
|
||||
|
||||
The following "bugs" are not accepted:
|
||||
* Intended Behaviour
|
||||
* Double tall flowers need be harvested with shears to not clutter the inventory
|
||||
* Already fixed but people keep reporting it for some reason
|
||||
* Wearing a Ring of Loki or Ring of the Aesir shows a wireframe below bedrock
|
||||
* Not a botania problem/Not fixable
|
||||
* Crash on startup with ChromatiCraft installed (update CC)
|
||||
* Crash on startup with Blocks3D Mod installed
|
||||
* Crash on opening the Lexica Botania with Enchiridion installed (update Enchiridion)
|
||||
* Flowers don't render (Optifine issue)
|
||||
* Mana Bursts get destroyed on Cauldron by the ClearLagg plugin (add botania:manaBurst to the ClearLagg blacklist)
|
||||
* Force Relays destroy blocks when used very fast (Can't fix due to the nature of the block)
|
||||
* Terrasteel crafting won't start (make sure your checkerboard is correct, there's Livingrock under the plate)
|
||||
* The Horn of the Canopy doesn't break Thaumcraft leaves (Thaumcraft doesn't use the typical class or material)
|
||||
* Some Baubles don't work properly on LAN (Baubles bug)
|
||||
|
||||
[Report the Issue](https://github.com/Vazkii/Botania/issues)!
|
||||
|
||||
You can find me at most times on [#vazkii @ irc.esper.net](http://webchat.esper.net/?channels=vazkii), if you need to speak with me about the issue you would report. Just make sure to use common sense and read what the bot tells you.
|
||||
|
||||
---
|
||||
|
||||
If you want to make a Pull Request keep these in mind:
|
||||
* Do NOT use the github editor. Test your damn PRs before you submit them.
|
||||
* I'm very strict when it comes to syntax. Make sure your PR's syntax matches the syntax of the rest of the code. That includes spacing after if/for/(etc), proper bracket usage, camel casing and copyleft headers on new classes.
|
||||
* If your pull request edits very small chunks of code and isn't flawless I'll close it as it'll probably take less time to fix it myself rather than pull yours and change the code.
|
||||
* Unless you have a very good reason for it, keep your PRs all in one commit. You can do it with [rebase](https://git-scm.com/docs/git-rebase).
|
||||
|
||||
|
||||
+13
-27
@@ -1,33 +1,19 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.35:dev')
|
||||
|
||||
compile("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.11:dev') {transitive=false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.30:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.26-GTNH:api') {transitive=false}
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Railcraft:9.13.5:api") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:StorageDrawers:1.11.11-GTNH:api") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compileOnly("curse.maven:cofh-lib-220333:2388749") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.mod-buildcraft:buildcraft:7.1.23:api") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("curse.maven:minefactory-reloaded-66672:2366150") {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.42:dev")
|
||||
}
|
||||
|
||||
+196
-31
@@ -1,64 +1,229 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Botania
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = Botania
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = vazkii.botania
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random 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"
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Define a source file of your project with:
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jvmDowngrader
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
jvmDowngraderStubsProvider = gtnhlib
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = vazkii.botania.common.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your 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 = LibMisc.java
|
||||
gradleTokenModId =
|
||||
gradleTokenModName =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName =
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
# replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = botania_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatability only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# This parameter is for legacy compatibility 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.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
#customArchiveBaseName =
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+7
-5
@@ -1,5 +1,7 @@
|
||||
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
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,80 +15,114 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# 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
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
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"'
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# 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
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | 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"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,92 +131,118 @@ 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.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
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" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
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, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# 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"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
# 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")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+27
-34
@@ -13,8 +13,10 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,10 +27,14 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@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"
|
||||
|
||||
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -51,48 +57,35 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
: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%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 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
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,14 +1,2 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "GTNH Maven"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
}
|
||||
|
||||
|
||||
@@ -60,37 +60,37 @@ import cpw.mods.fml.common.Loader;
|
||||
|
||||
public final class BotaniaAPI {
|
||||
|
||||
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
|
||||
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
|
||||
private static final List<LexiconCategory> categories = new ArrayList<>();
|
||||
private static final List<LexiconEntry> allEntries = new ArrayList<>();
|
||||
|
||||
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<String, KnowledgeType>();
|
||||
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<>();
|
||||
|
||||
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
|
||||
public static Map<String, Brew> brewMap = new LinkedHashMap<>();
|
||||
|
||||
public static List<String> disposableBlocks = new ArrayList<String>();
|
||||
public static List<String> semiDisposableBlocks = new ArrayList<String>();
|
||||
public static List<String> disposableBlocks = new ArrayList<>();
|
||||
public static List<String> semiDisposableBlocks = new ArrayList<>();
|
||||
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
|
||||
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<RecipePureDaisy>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
|
||||
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
|
||||
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
|
||||
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<>();
|
||||
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<>();
|
||||
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<>();
|
||||
public static List<RecipeBrew> brewRecipes = new ArrayList<>();
|
||||
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<>();
|
||||
|
||||
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
|
||||
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<Class<? extends SubTileEntity>, SubTileSignature>();
|
||||
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet();
|
||||
public static Map<String, String> subTileMods = new HashMap<String, String>();
|
||||
public static BiMap<String, String> miniFlowers = HashBiMap.<String, String> create();
|
||||
private static final BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.create();
|
||||
private static final Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<>();
|
||||
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet<>();
|
||||
public static Map<String, String> subTileMods = new HashMap<>();
|
||||
public static BiMap<String, String> miniFlowers = HashBiMap.create();
|
||||
|
||||
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
|
||||
public static Map<Item, Block> seeds = new HashMap();
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet<Item>();
|
||||
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
|
||||
public static Set<String> magnetBlacklist = new LinkedHashSet<String>();
|
||||
public static Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<Class<? extends Entity>>();
|
||||
public static Map<String, Integer> oreWeights = new HashMap<>();
|
||||
public static Map<String, Integer> oreWeightsNether = new HashMap<>();
|
||||
public static Map<Item, Block> seeds = new HashMap<>();
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet<>();
|
||||
public static Set<Block> paintableBlocks = new LinkedHashSet<>();
|
||||
public static Set<String> magnetBlacklist = new LinkedHashSet<>();
|
||||
public static Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<>();
|
||||
|
||||
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
|
||||
@@ -108,7 +108,7 @@ public final class BotaniaAPI {
|
||||
public static KnowledgeType basicKnowledge;
|
||||
public static KnowledgeType elvenKnowledge;
|
||||
|
||||
// This is here for completeness sake, but you shouldn't use it
|
||||
// This is here for completeness’s sake, but you shouldn't use it
|
||||
public static KnowledgeType relicKnowledge;
|
||||
|
||||
// All of these categories are initialized during botania's PreInit stage.
|
||||
@@ -290,14 +290,14 @@ public final class BotaniaAPI {
|
||||
return fallbackBrew;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Registers a Block as disposable using its Ore Dictionary Name.
|
||||
*/
|
||||
public static void registerDisposableBlock(String oreDictName) {
|
||||
disposableBlocks.add(oreDictName);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Registers a Block as semi disposable using its Ore Dictionary Name.
|
||||
* This means it will not be trashed when sneaking.
|
||||
*/
|
||||
@@ -313,19 +313,19 @@ public final class BotaniaAPI {
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Blacklists an Entity from being affected by the Rod of the Shaded Mesa.
|
||||
* Pass in the class for the Entity, e.g. EntityCow.class
|
||||
*/
|
||||
public static void blacklistEntityFromGravityRod(Class entity) {
|
||||
public static void blacklistEntityFromGravityRod(Class<? extends Entity> entity) {
|
||||
gravityRodBlacklist.add(entity);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if the provided Entity is contained in the Blacklist.
|
||||
* Pass in the class for the Entity, e.g. entity.getClass()
|
||||
*/
|
||||
public static boolean isEntityBlacklistedFromGravityRod(Class entity) {
|
||||
public static boolean isEntityBlacklistedFromGravityRod(Class<? extends Entity> entity) {
|
||||
return gravityRodBlacklist.contains(entity);
|
||||
}
|
||||
|
||||
@@ -443,8 +443,9 @@ public final class BotaniaAPI {
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
|
||||
recipe.setAlchemy(true);
|
||||
manaInfusionRecipes.add(0, recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -454,8 +455,9 @@ public final class BotaniaAPI {
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
|
||||
recipe.setConjuration(true);
|
||||
manaInfusionRecipes.add(0, recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -474,7 +476,7 @@ public final class BotaniaAPI {
|
||||
/**
|
||||
* Registers a Brew Recipe (for the Botanical Brewery).
|
||||
* @param brew The brew in to be set in this recipe.
|
||||
* @inputs The items used in the recipe, no more than 6.
|
||||
* @param inputs The items used in the recipe, no more than 6.
|
||||
*/
|
||||
public static RecipeBrew registerBrewRecipe(Brew brew, Object... inputs) {
|
||||
RecipeBrew recipe = new RecipeBrew(brew, inputs);
|
||||
@@ -590,7 +592,7 @@ public final class BotaniaAPI {
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeightNether(String ore, int weight) {
|
||||
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
|
||||
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).isEmpty())
|
||||
return;
|
||||
|
||||
oreWeightsNether.put(ore, weight);
|
||||
@@ -632,7 +634,7 @@ public final class BotaniaAPI {
|
||||
*/
|
||||
public static List<IRecipe> getLatestAddedRecipes(int x) {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> newList = new ArrayList();
|
||||
List<IRecipe> newList = new ArrayList<>();
|
||||
for(int i = x - 1; i >= 0; i--)
|
||||
newList.add(list.get(list.size() - 1 - i));
|
||||
|
||||
|
||||
@@ -18,7 +18,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* The class for a Brew definition, each one is a singleton.
|
||||
* A type of brew that can be created in the Botanical Brewery.
|
||||
*
|
||||
* <p>
|
||||
* Each instance of this class represents a single <i>type</i> of brew that can be created in the brewery, similarly
|
||||
* to how {@link net.minecraft.item.Item} and {@link net.minecraft.block.Block} work.
|
||||
* </p>
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
@@ -31,18 +36,19 @@ public class Brew {
|
||||
boolean canInfuseIncense = true;
|
||||
|
||||
/**
|
||||
* @param key The key for this brew, used in NBT and the global map.
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
* @param color The color for the potion to be rendered in the bottle. Note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew. Must be positive.
|
||||
* @param effects A list of potion effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.cost = cost;
|
||||
this.effects = new ArrayList(Arrays.asList(effects));
|
||||
this.effects = new ArrayList<>(Arrays.asList(effects));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,14 +107,14 @@ public class Brew {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
* Get the item-insensitive mana cost. This is used for the lexicon and for crafting costs.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
* Gets the mana cost for the ItemStack passed in. In standard Botania, this is used only by the Cursed Blood Pendant.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* Utility methods for checking the properties of {@link ItemStack}s related to Brews.
|
||||
*/
|
||||
public final class BrewUtilities {
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} represents a filled Brew.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item contains a Brew.
|
||||
*/
|
||||
public static boolean isFilledBrew(ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof IBrewItem brewItem)) return false;
|
||||
final Brew brew = brewItem.getBrew(stack);
|
||||
return brew != null && brew != BotaniaAPI.fallbackBrew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} is an empty Brew Container - an item that can go on the middle pedestal of the Botanical Brewery.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item is a Brew Container that does not contain a Brew.
|
||||
*/
|
||||
public static boolean isEmptyBrewContainer(ItemStack stack) {
|
||||
return stack.getItem() instanceof IBrewContainer && !isFilledBrew(stack);
|
||||
}
|
||||
}
|
||||
@@ -10,26 +10,32 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this counts as a Brew Container, by which
|
||||
* it can be used a center item for brew recipes and can contain
|
||||
* a brew.
|
||||
* An {@link Item} that implements this counts as a Brew Container, which allows it to be used a center item in the Botanical Brewery.
|
||||
*/
|
||||
public interface IBrewContainer {
|
||||
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
* Fills an {@link ItemStack} of this container with a {@link Brew}.
|
||||
* If the brew cannot be applied to this container, returns null instead.
|
||||
*
|
||||
* @param brew The brew which may or may not be applicable to this container.
|
||||
* @param stack The stack of this item which is being filled. This stack is not mutated.
|
||||
* @return A <i>new</i> {@link ItemStack} containing an {@link IBrewItem}, or null if this brew is not applicable.
|
||||
* @apiNote The returned stack does not necessarily have to be the same {@link Item} as the empty container.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
* Gets the cost to add this brew onto this container. The cost must be a positive number.
|
||||
*
|
||||
* @param brew The brew being applied, which must be applicable to this container. {@link IBrewContainer#getItemForBrew(Brew, ItemStack)} can be used to determine whether the brew is applicable.
|
||||
* @param stack A stack of this empty container. This stack is not mutated.
|
||||
* @return The mana cost for this recipe, which is a positive number.
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
int getManaCost(Brew brew, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -10,15 +10,26 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* An Item that implements this is a Brew item, by which it contains
|
||||
* a brew. This is only used in vanilla to prevent the brew item
|
||||
* from going back into the brewery but other mods might use it for whatever.
|
||||
* An {@link Item} that implements this is an item which can contain a {@link Brew}.
|
||||
* <p>
|
||||
* This is used in standard Botania to prevent finished brews from going back into the brewery & to enable NEI searches.
|
||||
* However, other mods might use it for other purposes.
|
||||
* </p>
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
/**
|
||||
* Get the brew contained within a stack of this item.
|
||||
*
|
||||
* @param brew A stack of this item whose contents are being queried.
|
||||
* @return The brew within this container, or {@link BotaniaAPI#fallbackBrew} or null if the stack does not contain
|
||||
* a valid brew.
|
||||
*/
|
||||
Brew getBrew(ItemStack brew);
|
||||
|
||||
}
|
||||
@@ -29,9 +29,9 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class CorporeaHelper {
|
||||
|
||||
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
|
||||
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
|
||||
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<ICorporeaAutoCompleteController>();
|
||||
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap<>();
|
||||
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<>();
|
||||
|
||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class CorporeaHelper {
|
||||
return cache;
|
||||
}
|
||||
|
||||
List<IInventory> inventories = new ArrayList();
|
||||
List<IInventory> inventories = new ArrayList<>();
|
||||
if(network != null)
|
||||
for(ICorporeaSpark otherSpark : network)
|
||||
if(otherSpark != null) {
|
||||
@@ -125,7 +125,7 @@ public final class CorporeaHelper {
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(ItemStack stack,List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> countMap = new HashMap<IInventory, Integer>();
|
||||
Map<IInventory, Integer> countMap = new HashMap<>();
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
for (IWrappedInventory inv : wrappedInventories) {
|
||||
CorporeaRequest request = new CorporeaRequest(stack, checkNBT, -1);
|
||||
@@ -166,14 +166,14 @@ public final class CorporeaHelper {
|
||||
* purposes of counting huge amounts.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(Object matcher, int itemCount, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(matcher, itemCount, spark, checkNBT, doit);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
return stacks;
|
||||
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<>();
|
||||
|
||||
CorporeaRequest request = new CorporeaRequest(matcher, checkNBT, itemCount);
|
||||
for(IWrappedInventory inv : inventoriesW) {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/**
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
public class CorporeaRequest {
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
|
||||
super();
|
||||
this.matcher = matcher;
|
||||
this.checkNBT = checkNBT;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
public class CorporeaRequest {
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
|
||||
super();
|
||||
this.matcher = matcher;
|
||||
this.checkNBT = checkNBT;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +1,57 @@
|
||||
/**
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface wraps IInventory corporea works with in order to provide
|
||||
* compatibility with different storage mods.
|
||||
*
|
||||
*/
|
||||
public interface IWrappedInventory {
|
||||
|
||||
/**
|
||||
* Break encapsulation and exposes original inventory.
|
||||
*/
|
||||
IInventory getWrappedObject();
|
||||
|
||||
/**
|
||||
* Counts items in the inventory matching the request
|
||||
*
|
||||
* @param request
|
||||
* - specifies what should be found
|
||||
* @return List of ItemStack, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts. To get final count requestor
|
||||
* should sum stackSize of all stacks.
|
||||
*/
|
||||
List<ItemStack> countItems(CorporeaRequest request);
|
||||
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@link CorporeaRequest#foundItems} and
|
||||
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
|
||||
* items were found and extracted.
|
||||
*
|
||||
* @param request
|
||||
* @return List of ItemStacks to be delivered to the destination.
|
||||
*/
|
||||
List<ItemStack> extractItems(CorporeaRequest request);
|
||||
}
|
||||
/**
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface wraps IInventory corporea works with in order to provide
|
||||
* compatibility with different storage mods.
|
||||
*
|
||||
*/
|
||||
public interface IWrappedInventory {
|
||||
|
||||
/**
|
||||
* Break encapsulation and exposes original inventory.
|
||||
*/
|
||||
IInventory getWrappedObject();
|
||||
|
||||
/**
|
||||
* Counts items in the inventory matching the request
|
||||
*
|
||||
* @param request
|
||||
* - specifies what should be found
|
||||
* @return List of ItemStack, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts. To get final count requestor
|
||||
* should sum stackSize of all stacks.
|
||||
*/
|
||||
List<ItemStack> countItems(CorporeaRequest request);
|
||||
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@link CorporeaRequest#foundItems} and
|
||||
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
|
||||
* items were found and extracted.
|
||||
*
|
||||
* @param request
|
||||
* @return List of ItemStacks to be delivered to the destination.
|
||||
*/
|
||||
List<ItemStack> extractItems(CorporeaRequest request);
|
||||
}
|
||||
@@ -39,12 +39,12 @@ public class DummyManaNetwork implements IManaNetwork {
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllCollectorsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllPoolsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
World world = tile.getWorldObj();
|
||||
List players = world.playerEntities;
|
||||
List<?> players = world.playerEntities;
|
||||
for(Object player : players)
|
||||
if(player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP mp = (EntityPlayerMP) player;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An item that implements this will allow some custom render. This will be called while the item is in the inventory,
|
||||
* armor slot or bauble slots.
|
||||
*/
|
||||
public interface IInWorldRenderable
|
||||
{
|
||||
public void renderInWorld(EntityPlayer player, ItemStack stack);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class LexiconCategory implements Comparable<LexiconCategory> {
|
||||
private static int count = 0;
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
|
||||
public final List<LexiconEntry> entries = new ArrayList<>();
|
||||
private final int sortingId;
|
||||
private ResourceLocation icon;
|
||||
private int priority = 5;
|
||||
|
||||
@@ -27,11 +27,11 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
|
||||
private KnowledgeType type = BotaniaAPI.basicKnowledge;
|
||||
|
||||
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
|
||||
public List<LexiconPage> pages = new ArrayList<>();
|
||||
private boolean priority = false;
|
||||
private ItemStack icon = null;
|
||||
|
||||
private List<ItemStack> extraDisplayedRecipes = new ArrayList();
|
||||
private List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
|
||||
@@ -126,12 +126,12 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
}
|
||||
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
for(LexiconPage page : pages) {
|
||||
List<ItemStack> l = page.getDisplayedRecipes();
|
||||
|
||||
if(l != null) {
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList();
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
|
||||
|
||||
for(ItemStack s : l) {
|
||||
addItem: {
|
||||
|
||||
@@ -23,7 +23,7 @@ import vazkii.botania.api.mana.IManaItem;
|
||||
*/
|
||||
public final class LexiconRecipeMappings {
|
||||
|
||||
private static Map<String, EntryData> mappings = new HashMap();
|
||||
private static Map<String, EntryData> mappings = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Maps the given stack to the given page of the entry.
|
||||
|
||||
@@ -23,7 +23,7 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
*/
|
||||
public interface IMultiblockRenderHook {
|
||||
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap();
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap<>();
|
||||
|
||||
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks, MultiblockComponent comp, float alpha);
|
||||
|
||||
|
||||
@@ -15,10 +15,15 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import vazkii.botania.api.lexicon.multiblock.compat.MultiblockCompatRegistry;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
/**
|
||||
* This class describes a Mutiblock object. It's used to display a
|
||||
@@ -27,22 +32,26 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
*/
|
||||
public class Multiblock {
|
||||
|
||||
public List<MultiblockComponent> components = new ArrayList();
|
||||
public List<ItemStack> materials = new ArrayList();
|
||||
public List<MultiblockComponent> components = new ArrayList<>();
|
||||
public List<ItemStack> materials = new ArrayList<>();
|
||||
|
||||
public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ;
|
||||
|
||||
public HashMap<List<Integer>, MultiblockComponent> locationCache = new HashMap<List<Integer>, MultiblockComponent>();
|
||||
public HashMap<List<Integer>, MultiblockComponent> locationCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Adds a multiblock component to this multiblock. The component's x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(MultiblockComponent component) {
|
||||
if(getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ) != null)
|
||||
throw new IllegalArgumentException("Location in multiblock already occupied");
|
||||
ChunkCoordinates pos = component.relPos;
|
||||
if(getComponentForLocation(pos.posX, pos.posY, pos.posZ) != null) {
|
||||
MultiblockComponent comp = getComponentForLocation(pos.posX, pos.posY, pos.posZ);
|
||||
throw new IllegalArgumentException(
|
||||
"Location in multiblock {x=" + pos.posX + " y=" + pos.posY + " z=" + pos.posZ + "} already occupied by block " + comp.getBlock().getLocalizedName());
|
||||
}
|
||||
components.add(component);
|
||||
changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ);
|
||||
changeAxisForNewComponent(pos.posX, pos.posY, pos.posZ);
|
||||
calculateCostForNewComponent(component);
|
||||
addComponentToLocationCache(component);
|
||||
}
|
||||
@@ -138,6 +147,28 @@ public class Multiblock {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public <T extends TileEntity> MultiblockSet makeSetRegisterStructure(
|
||||
Class<T> controllerTileClass, Block controllerBlock, MultiblockComponent... extra
|
||||
) {
|
||||
registerStructure(controllerTileClass, controllerBlock, extra);
|
||||
return makeSet();
|
||||
}
|
||||
|
||||
public <T extends TileEntity> void registerStructure(
|
||||
Class<T> controllerTileClass, Block controllerBlock, MultiblockComponent... extra
|
||||
) {
|
||||
if (Botania.structureLibLoaded) {
|
||||
try {
|
||||
MultiblockCompatRegistry.registerMultiblock(
|
||||
this, controllerTileClass, controllerBlock, extra
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FMLLog.log(Level.ERROR, "Failed to load a Botania Multiblock into StructureLib.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a MultiblockSet from this Multiblock and its rotations using
|
||||
* createRotations().
|
||||
@@ -176,7 +207,7 @@ public class Multiblock {
|
||||
pos.posX,
|
||||
pos.posY,
|
||||
pos.posZ
|
||||
), comp);
|
||||
), comp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
package vazkii.botania.api.lexicon.multiblock.compat;
|
||||
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.IMultiblockInfoContainer;
|
||||
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
||||
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
|
||||
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
|
||||
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
|
||||
import com.gtnewhorizon.structurelib.structure.StructureUtility;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import vazkii.botania.api.lexicon.multiblock.Multiblock;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Only gets loaded if StructureLib is present inside the Modpack
|
||||
*/
|
||||
public class MultiblockCompatRegistry {
|
||||
|
||||
public static <T extends TileEntity> void registerMultiblock(
|
||||
Multiblock mb, Class<T> controllerTileClass,
|
||||
Block controllerBlock,
|
||||
MultiblockComponent... extra
|
||||
) {
|
||||
List<MultiblockComponent> components = mb.getComponents();
|
||||
if (extra.length != 0) {
|
||||
components = new ArrayList<>(components);
|
||||
Collections.addAll(components, extra);
|
||||
}
|
||||
|
||||
Map<Integer, RawStructureData> structureDataMap = new HashMap<>();
|
||||
int min_x = Integer.MAX_VALUE, max_x = Integer.MIN_VALUE;
|
||||
int min_y = Integer.MAX_VALUE, max_y = Integer.MIN_VALUE;
|
||||
int min_z = Integer.MAX_VALUE, max_z = Integer.MIN_VALUE;
|
||||
|
||||
char ch = 'a';
|
||||
for (MultiblockComponent component : components) {
|
||||
int hash = getHash(component.getBlock(), component.getMeta());
|
||||
ChunkCoordinates pos = component.getRelativePosition();
|
||||
RawStructureData structureData = structureDataMap.get(hash);
|
||||
if (structureData == null) {
|
||||
List<ChunkCoordinates> coordinates = new ArrayList<>();
|
||||
structureData = new RawStructureData(
|
||||
coordinates,
|
||||
component.getBlock(),
|
||||
component.getMeta(),
|
||||
ch++
|
||||
);
|
||||
structureDataMap.put(hash, structureData);
|
||||
}
|
||||
structureData.getPositions().add(pos);
|
||||
|
||||
min_x = Math.min(min_x, pos.posX); max_x = Math.max(max_x, pos.posX);
|
||||
min_y = Math.min(min_y, pos.posY); max_y = Math.max(max_y, pos.posY);
|
||||
min_z = Math.min(min_z, pos.posZ); max_z = Math.max(max_z, pos.posZ);
|
||||
}
|
||||
|
||||
int x_size = max_x - min_x + 1;
|
||||
int y_size = max_y - min_y + 1;
|
||||
int z_size = max_z - min_z + 1;
|
||||
|
||||
//Data is saved in [z][y][x] format
|
||||
String[][] stringData = new String[z_size][y_size];
|
||||
|
||||
char[] buffer = new char[x_size];
|
||||
Arrays.fill(buffer, ' ');
|
||||
//Since Strings and their content are immutable, this is fine.
|
||||
String filledWithSpaces = new String(buffer);
|
||||
for (int z = 0; z < z_size; z++) {
|
||||
for (int y = 0; y < y_size; y++) {
|
||||
stringData[z][y] = filledWithSpaces;
|
||||
}
|
||||
}
|
||||
|
||||
int controller_x = 0, controller_y = 0, controller_z = 0;
|
||||
StringBuilder builder = new StringBuilder(x_size);
|
||||
for (RawStructureData data : structureDataMap.values()) {
|
||||
for (ChunkCoordinates pos : data.getPositions()) {
|
||||
int x = pos.posX - min_x;
|
||||
int z = pos.posZ - min_z;
|
||||
//Data has to get flipped
|
||||
int y = (stringData[z].length - 1) - (pos.posY - min_y);
|
||||
|
||||
if (data.getBlock() == controllerBlock) {
|
||||
controller_x = x;
|
||||
controller_y = y;
|
||||
controller_z = z;
|
||||
}
|
||||
|
||||
String s = stringData[z][y];
|
||||
builder.append(s);
|
||||
builder.setCharAt(x, data.getBlockIdentifier());
|
||||
stringData[z][y] = builder.toString();
|
||||
builder.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
StructureDefinition.Builder<? super T> structureBuilder = IStructureDefinition.builder()
|
||||
.addShape("main", stringData);
|
||||
|
||||
for (RawStructureData data : structureDataMap.values()) {
|
||||
structureBuilder.addElement(
|
||||
data.getBlockIdentifier(),
|
||||
StructureUtility.ofBlock(
|
||||
data.getBlock(),
|
||||
data.getMetadata()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
IMultiblockInfoContainer.registerTileClass(
|
||||
controllerTileClass,
|
||||
new BotaniaMultiblockInfoContainer<>(
|
||||
structureBuilder.build(),
|
||||
controller_x,
|
||||
controller_y,
|
||||
controller_z
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int getHash(Block block, int metadata) {
|
||||
return block.hashCode() * 31 + metadata;
|
||||
}
|
||||
|
||||
|
||||
private static class BotaniaMultiblockInfoContainer<T extends TileEntity> implements IMultiblockInfoContainer<T> {
|
||||
|
||||
private final IStructureDefinition<? super T> structure;
|
||||
private final int x_offset, y_offset, z_offset;
|
||||
|
||||
public BotaniaMultiblockInfoContainer(
|
||||
IStructureDefinition<? super T> structure,
|
||||
int x_offset, int y_offset, int z_offset
|
||||
) {
|
||||
this.structure = structure;
|
||||
this.x_offset = x_offset;
|
||||
this.y_offset = y_offset;
|
||||
this.z_offset = z_offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void construct(ItemStack stackSize, boolean hintsOnly, T tileEntity, ExtendedFacing aSide) {
|
||||
structure.buildOrHints(
|
||||
tileEntity,
|
||||
stackSize,
|
||||
"main",
|
||||
tileEntity.getWorldObj(),
|
||||
noSideWay(aSide),
|
||||
tileEntity.xCoord,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord,
|
||||
x_offset,
|
||||
y_offset,
|
||||
z_offset,
|
||||
hintsOnly
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int survivalConstruct(ItemStack stackSize, int elementBudge, ISurvivalBuildEnvironment env, T tileEntity, ExtendedFacing aSide) {
|
||||
return structure.survivalBuild(
|
||||
tileEntity,
|
||||
stackSize,
|
||||
"main",
|
||||
tileEntity.getWorldObj(),
|
||||
noSideWay(aSide),
|
||||
tileEntity.xCoord,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord,
|
||||
x_offset,
|
||||
y_offset,
|
||||
z_offset,
|
||||
elementBudge,
|
||||
env,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDescription(ItemStack stackSize) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
private static ExtendedFacing noSideWay(ExtendedFacing aSide) {
|
||||
return aSide.getDirection().offsetY != 0 ? ExtendedFacing.DEFAULT : aSide.getOppositeDirection();
|
||||
}
|
||||
}
|
||||
|
||||
private static class RawStructureData {
|
||||
private final List<ChunkCoordinates> positions;
|
||||
private final char identifier;
|
||||
private final Block block;
|
||||
private final int metadata;
|
||||
|
||||
public RawStructureData(List<ChunkCoordinates> positions, Block block, int metadata, char identifier) {
|
||||
this.positions = positions;
|
||||
this.identifier = identifier;
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public List<ChunkCoordinates> getPositions() {
|
||||
return positions;
|
||||
}
|
||||
|
||||
public char getBlockIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class MultiblockComponent {
|
||||
}
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, TileEntity tileEntity) {
|
||||
this(relPos, block, meta, block.hasTileEntity() == (tileEntity != null), tileEntity);
|
||||
this(relPos, block, meta, block.hasTileEntity(0) == (tileEntity != null), tileEntity);
|
||||
}
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, boolean doFancyRender, TileEntity tileEntity) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ITieredManaTooltipDisplay extends IManaTooltipDisplay {
|
||||
/**
|
||||
* Returns the text to use for the top-left side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getLeftManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns the text to use for the top-right side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getRightManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Should the mana bar use the rainbow effect
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean isRainbowEffect(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Indicate the mana level boundaries for this item.
|
||||
*/
|
||||
@Nonnull
|
||||
int[] getManaTiers(@Nonnull ItemStack stack);
|
||||
}
|
||||
@@ -23,10 +23,9 @@ public final class SparkHelper {
|
||||
return SparkHelper.getEntitiesAround(ISparkEntity.class, world, x, y, z);
|
||||
}
|
||||
|
||||
public static <T> List<T> getEntitiesAround(Class<? extends T> clazz, World world, double x, double y, double z) {
|
||||
public static <T> List<T> getEntitiesAround(Class<T> clazz, World world, double x, double y, double z) {
|
||||
int r = SPARK_SCAN_RANGE;
|
||||
List<T> entities = world.getEntitiesWithinAABB(clazz, AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + r, y + r, z + r));
|
||||
return entities;
|
||||
return world.getEntitiesWithinAABB(clazz, AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + r, y + r, z + r));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class RecipeBrew {
|
||||
public RecipeBrew(Brew brew, Object... inputs) {
|
||||
this.brew = brew;
|
||||
|
||||
List<Object> inputsToSet = new ArrayList();
|
||||
List<Object> inputsToSet = new ArrayList<>();
|
||||
for(Object obj : inputs) {
|
||||
if(obj instanceof String || obj instanceof ItemStack)
|
||||
inputsToSet.add(obj);
|
||||
@@ -39,7 +39,7 @@ public class RecipeBrew {
|
||||
}
|
||||
|
||||
public boolean matches(IInventory inv) {
|
||||
List<Object> inputsMissing = new ArrayList(inputs);
|
||||
List<Object> inputsMissing = new ArrayList<>(inputs);
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
@@ -92,7 +92,7 @@ public class RecipeBrew {
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
return new ArrayList(inputs);
|
||||
return new ArrayList<>(inputs);
|
||||
}
|
||||
|
||||
public Brew getBrew() {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class RecipeElvenTrade {
|
||||
public RecipeElvenTrade(ItemStack output, Object... inputs) {
|
||||
this.output = output;
|
||||
|
||||
List<Object> inputsToSet = new ArrayList();
|
||||
List<Object> inputsToSet = new ArrayList<>();
|
||||
for(Object obj : inputs) {
|
||||
if(obj instanceof String || obj instanceof ItemStack)
|
||||
inputsToSet.add(obj);
|
||||
@@ -25,8 +25,8 @@ public class RecipeElvenTrade {
|
||||
}
|
||||
|
||||
public boolean matches(List<ItemStack> stacks, boolean remove) {
|
||||
List<Object> inputsMissing = new ArrayList(inputs);
|
||||
List<ItemStack> stacksToRemove = new ArrayList();
|
||||
List<Object> inputsMissing = new ArrayList<>(inputs);
|
||||
List<ItemStack> stacksToRemove = new ArrayList<>();
|
||||
|
||||
for(ItemStack stack : stacks) {
|
||||
if(stack == null) {
|
||||
@@ -43,11 +43,7 @@ public class RecipeElvenTrade {
|
||||
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : validStacks) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
if(!stacksToRemove.contains(stack))
|
||||
stacksToRemove.add(stack);
|
||||
oredictIndex = j;
|
||||
@@ -84,7 +80,7 @@ public class RecipeElvenTrade {
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
return new ArrayList(inputs);
|
||||
return new ArrayList<>(inputs);
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class RecipePetals {
|
||||
public RecipePetals(ItemStack output, Object... inputs) {
|
||||
this.output = output;
|
||||
|
||||
List<Object> inputsToSet = new ArrayList();
|
||||
List<Object> inputsToSet = new ArrayList<>();
|
||||
for(Object obj : inputs) {
|
||||
if(obj instanceof String || obj instanceof ItemStack)
|
||||
inputsToSet.add(obj);
|
||||
@@ -36,7 +36,7 @@ public class RecipePetals {
|
||||
}
|
||||
|
||||
public boolean matches(IInventory inv) {
|
||||
List<Object> inputsMissing = new ArrayList(inputs);
|
||||
List<Object> inputsMissing = new ArrayList<>(inputs);
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
@@ -86,7 +86,7 @@ public class RecipePetals {
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
return new ArrayList(inputs);
|
||||
return new ArrayList<>(inputs);
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.recipe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -22,8 +18,6 @@ import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class RecipePureDaisy {
|
||||
|
||||
private static final Map<String, List<ItemStack>> oreMap = new HashMap();
|
||||
|
||||
Object input;
|
||||
Block output;
|
||||
int outputMeta;
|
||||
@@ -53,21 +47,10 @@ public class RecipePureDaisy {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return false;
|
||||
|
||||
List<ItemStack> ores;
|
||||
if(oreMap.containsKey(entry))
|
||||
ores = oreMap.get(entry);
|
||||
else {
|
||||
ores = OreDictionary.getOres(entry);
|
||||
oreMap.put(entry, ores);
|
||||
}
|
||||
|
||||
for(ItemStack ostack : ores) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack))
|
||||
for(ItemStack ostack : OreDictionary.getOres(entry, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class WikiHooks {
|
||||
|
||||
private static final IWikiProvider FALLBACK_PROVIDER = new SimpleWikiProvider("FTB Wiki", "http://ftb.gamepedia.com/%s");
|
||||
|
||||
private static final Map<String, IWikiProvider> modWikis = new HashMap();
|
||||
private static final Map<String, IWikiProvider> modWikis = new HashMap<>();
|
||||
|
||||
public static IWikiProvider getWikiFor(Block block) {
|
||||
UniqueIdentifier mod = GameRegistry.findUniqueIdentifierFor(block);
|
||||
|
||||
@@ -25,12 +25,12 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public final class ModChallenges {
|
||||
|
||||
public static final EnumMap<EnumChallengeLevel, List<Challenge>> challenges = new EnumMap(EnumChallengeLevel.class);
|
||||
public static final HashMap<String, Challenge> challengeLookup = new HashMap();
|
||||
public static final EnumMap<EnumChallengeLevel, List<Challenge>> challenges = new EnumMap<>(EnumChallengeLevel.class);
|
||||
public static final HashMap<String, Challenge> challengeLookup = new HashMap<>();
|
||||
|
||||
public static void init() {
|
||||
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants())
|
||||
challenges.put(level, new ArrayList());
|
||||
challenges.put(level, new ArrayList<>());
|
||||
|
||||
addChallenge(EnumChallengeLevel.EASY, "flowerFarm", new ItemStack(ModBlocks.flower, 1, 6));
|
||||
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.record_13));
|
||||
|
||||
@@ -32,7 +32,9 @@ import vazkii.botania.common.core.helper.MathHelper;
|
||||
public final class BossBarHandler {
|
||||
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
static IBotaniaBoss currentBoss;
|
||||
private static IBotaniaBoss currentBoss;
|
||||
private static Entity lastBossEntity;
|
||||
private static String lastBossName;
|
||||
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@@ -47,7 +49,13 @@ public final class BossBarHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Rectangle bgRect = currentBoss.getBossBarTextureRect();
|
||||
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
|
||||
String name = currentBoss.func_145748_c_().getFormattedText();
|
||||
Entity e = (Entity) currentBoss;
|
||||
String name;
|
||||
if(lastBossEntity != e) {
|
||||
name = currentBoss.func_145748_c_().getFormattedText();
|
||||
lastBossEntity = e;
|
||||
lastBossName = name;
|
||||
} else name = lastBossName;
|
||||
int c = res.getScaledWidth() / 2;
|
||||
int x = c - bgRect.width / 2;
|
||||
int y = 20;
|
||||
@@ -66,7 +74,6 @@ public final class BossBarHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Entity e = (Entity) currentBoss;
|
||||
EntityPlayer p = mc.thePlayer;
|
||||
if(e.isDead || !p.worldObj.loadedEntityList.contains(e) || MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, p.posX, p.posY, p.posZ) > 32)
|
||||
currentBoss = null;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
|
||||
import vazkii.botania.api.item.IInWorldRenderable;
|
||||
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
|
||||
import vazkii.botania.api.wand.ICoordBoundItem;
|
||||
import vazkii.botania.api.wand.IWireframeAABBProvider;
|
||||
@@ -36,6 +37,10 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public final class BoundTileRenderer {
|
||||
|
||||
public static int getWireframeColor(){
|
||||
return Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GL11.glPushMatrix();
|
||||
@@ -49,7 +54,7 @@ public final class BoundTileRenderer {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
int color = getWireframeColor();
|
||||
if(stack != null && stack.getItem() instanceof ICoordBoundItem) {
|
||||
ChunkCoordinates coords = ((ICoordBoundItem) stack.getItem()).getBinding(stack);
|
||||
if(coords != null)
|
||||
@@ -82,6 +87,11 @@ public final class BoundTileRenderer {
|
||||
renderBlockOutlineAt(coords, color, 5F);
|
||||
}
|
||||
}
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IInWorldRenderable) {
|
||||
IInWorldRenderable provider = (IInWorldRenderable) stackInSlot.getItem();
|
||||
provider.renderInWorld(player,stackInSlot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ClientTickHandler {
|
||||
if(player != null) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null && stack.getItem() instanceof ItemTwigWand) {
|
||||
List<TileSignature> list = new ArrayList(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld));
|
||||
List<TileSignature> list = new ArrayList<>(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld));
|
||||
for(TileSignature sig : list) {
|
||||
if(!sig.remoteWorld)
|
||||
continue;
|
||||
|
||||
@@ -68,7 +68,7 @@ public final class ContributorFancinessHandler {
|
||||
}
|
||||
|
||||
public static void load(Properties props) {
|
||||
flowerMap = new HashMap();
|
||||
flowerMap = new HashMap<>();
|
||||
for(String key : props.stringPropertyNames()) {
|
||||
String value = props.getProperty(key);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
@@ -30,19 +31,22 @@ import org.lwjgl.input.Keyboard;
|
||||
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class CorporeaAutoCompleteHandler {
|
||||
|
||||
private static final Field COMPLETE_FLAG = ReflectionUtils.findField(GuiChat.class, LibObfuscation.COMPLETE_FLAG);
|
||||
private static final Field INPUT_FIELD = ReflectionUtils.findField(GuiChat.class, LibObfuscation.INPUT_FIELD);
|
||||
|
||||
boolean isAutoCompleted = false;
|
||||
String originalString = "";
|
||||
List<CompletionData> completions = new ArrayList<CompletionData>();
|
||||
List<CompletionData> completions = new ArrayList<>();
|
||||
int position;
|
||||
|
||||
static TreeSet<String> itemNames = new TreeSet<String>(
|
||||
static TreeSet<String> itemNames = new TreeSet<>(
|
||||
new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String arg0, String arg1) {
|
||||
@@ -55,7 +59,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
public static void updateItemList() {
|
||||
itemNames.clear();
|
||||
Iterator<Item> iterator = Item.itemRegistry.iterator();
|
||||
ArrayList<ItemStack> curList = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> curList = new ArrayList<>();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
Item item = iterator.next();
|
||||
@@ -83,7 +87,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
}
|
||||
GuiChat chat = (GuiChat) screen;
|
||||
if(isAutoCompleted) {
|
||||
boolean valid = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
|
||||
boolean valid = ReflectionUtils.getBoolean(COMPLETE_FLAG, chat);
|
||||
if(!valid)
|
||||
isAutoCompleted = false;
|
||||
}
|
||||
@@ -99,7 +103,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(!CorporeaHelper.shouldAutoComplete())
|
||||
return;
|
||||
|
||||
GuiTextField inputField = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.INPUT_FIELD);
|
||||
GuiTextField inputField = (GuiTextField) ReflectionUtils.getObject(INPUT_FIELD, chat);
|
||||
if(!isAutoCompleted)
|
||||
buildAutoCompletes(inputField, chat);
|
||||
if(isAutoCompleted && !completions.isEmpty())
|
||||
@@ -127,7 +131,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(completions.isEmpty())
|
||||
return;
|
||||
position = -1;
|
||||
ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
|
||||
ReflectionUtils.setBoolean(COMPLETE_FLAG, chat, true);
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
CompletionData data;
|
||||
for(Iterator<CompletionData> iterator = completions.iterator(); iterator.hasNext(); stringbuilder.append(data.string)) {
|
||||
@@ -144,9 +148,9 @@ public class CorporeaAutoCompleteHandler {
|
||||
private ArrayList<CompletionData> getNames(String prefix) {
|
||||
String s = prefix.trim();
|
||||
if(s.isEmpty())
|
||||
return new ArrayList();
|
||||
return new ArrayList<>();
|
||||
|
||||
TreeSet<CompletionData> result = new TreeSet<CompletionData>();
|
||||
TreeSet<CompletionData> result = new TreeSet<>();
|
||||
String[] words = s.split(" ");
|
||||
int i = words.length - 1;
|
||||
String curPrefix = words[i];
|
||||
@@ -156,11 +160,11 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(i >= 0)
|
||||
curPrefix = words[i] + " " + curPrefix;
|
||||
}
|
||||
return new ArrayList<CompletionData>(result);
|
||||
return new ArrayList<>(result);
|
||||
}
|
||||
|
||||
private List<CompletionData> getNamesStartingWith(String prefix) {
|
||||
ArrayList<CompletionData> result = new ArrayList<CompletionData>();
|
||||
ArrayList<CompletionData> result = new ArrayList<>();
|
||||
int length = prefix.length();
|
||||
SortedSet<String> after = itemNames.tailSet(prefix);
|
||||
for(String str : after) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class DebugHandler {
|
||||
@SubscribeEvent
|
||||
public void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
|
||||
if(Minecraft.getMinecraft().gameSettings.showDebugInfo && ConfigHandler.showF3Debug) {
|
||||
event.left.add(null);
|
||||
String version = LibMisc.VERSION;
|
||||
if(version.contains("GRADLE"))
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
@@ -50,7 +51,6 @@ import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
@@ -65,15 +65,18 @@ import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
|
||||
|
||||
private static final Field REMAINING_HIGHLIGHT_TICKS = ReflectionUtils.findField(GuiIngame.class, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -128,7 +131,7 @@ public final class HUDHandler {
|
||||
renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
|
||||
if(!TileCorporeaIndex.getInputHandler().getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
|
||||
if(mc.currentScreen != null && mc.currentScreen instanceof GuiChat && TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer)) {
|
||||
profiler.startSection("nearIndex");
|
||||
renderNearIndexDisplay(event.resolution);
|
||||
profiler.endSection();
|
||||
@@ -159,21 +162,23 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}*/
|
||||
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle()) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
|
||||
|
||||
if(ItemMonocle.hasMonocle(baubles)) {
|
||||
profiler.startSection("monocle");
|
||||
ItemMonocle.renderHUD(event.resolution, mc.thePlayer);
|
||||
ItemMonocle.renderHUD(event.resolution, player);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
profiler.startSection("manaBar");
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
int totalMana = 0;
|
||||
int totalMaxMana = 0;
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
|
||||
IInventory baublesInv = baubles;
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
@@ -221,7 +226,7 @@ public final class HUDHandler {
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
profiler.startSection("wandMode");
|
||||
int ticks = ReflectionHelper.getPrivateValue(GuiIngame.class, mc.ingameGUI, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
int ticks = ReflectionUtils.getInt(REMAINING_HIGHLIGHT_TICKS, mc.ingameGUI);
|
||||
ticks -= 15;
|
||||
if(ticks > 0) {
|
||||
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
|
||||
@@ -257,8 +262,8 @@ public final class HUDHandler {
|
||||
else return;
|
||||
}
|
||||
|
||||
Color color = new Color(Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F));
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (255 - color.getRed()));
|
||||
int rgb = Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F);
|
||||
GL11.glColor4ub((byte) (rgb >> 16), (byte) (rgb >> 8), (byte) rgb, (byte) (255 - (rgb >> 16)));
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -480,8 +485,7 @@ public final class HUDHandler {
|
||||
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
|
||||
|
||||
Color color_ = new Color(color);
|
||||
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
|
||||
GL11.glColor4ub((byte) (color >> 16), (byte) (color >> 8), (byte) color, (byte) (255F * alpha));
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, Math.min(100, manaPercentage), 3);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
|
||||
private static ItemStack stack;
|
||||
private static int ticks, count;
|
||||
private static String cachedText;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void render(ScaledResolution resolution, float partTicks) {
|
||||
@@ -62,17 +63,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
String text = cachedText;
|
||||
|
||||
int color = 0x00FFFFFF | (int) (alpha * 0xFF) << 24;
|
||||
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
|
||||
@@ -92,6 +83,22 @@ public final class ItemsRemainingRenderHandler {
|
||||
ItemsRemainingRenderHandler.stack = stack;
|
||||
ItemsRemainingRenderHandler.count = count;
|
||||
ticks = stack == null ? 0 : maxTicks;
|
||||
|
||||
cachedText = "";
|
||||
if(stack != null) {
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
cachedText = text;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.network.PacketLokiClear;
|
||||
import vazkii.botania.common.network.PacketLokiMirror;
|
||||
import vazkii.botania.common.network.PacketLokiToggle;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class KeyHandler {
|
||||
private static final KeyBinding keyToggleRingOfLoki= new KeyBinding("botaniamisc.toggleLoki", 0, "botaniamisc.keyCategory");
|
||||
private static final KeyBinding keyRingOfLokiClear= new KeyBinding("botaniamisc.ringOfLokiClear", 0, "botaniamisc.keyCategory");
|
||||
private static final KeyBinding keyRingOfLokiMirror= new KeyBinding("botaniamisc.ringOfLokiMirror", 0, "botaniamisc.keyCategory");
|
||||
|
||||
public KeyHandler() {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(keyToggleRingOfLoki);
|
||||
ClientRegistry.registerKeyBinding(keyRingOfLokiClear);
|
||||
ClientRegistry.registerKeyBinding(keyRingOfLokiMirror);
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void key(InputEvent.KeyInputEvent event){
|
||||
checkAndPerformKeyActions();
|
||||
}
|
||||
|
||||
private void checkAndPerformKeyActions(){
|
||||
if (keyToggleRingOfLoki.isPressed()){
|
||||
toggleRingLoki();
|
||||
}
|
||||
if(keyRingOfLokiClear.isPressed()){
|
||||
ringOfLokiClear();
|
||||
}
|
||||
if(keyRingOfLokiMirror.isPressed()){
|
||||
toggleRingLokiMirroring();
|
||||
}
|
||||
}
|
||||
|
||||
private static void toggleRingLoki() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLokiToggle());
|
||||
}
|
||||
|
||||
private static void ringOfLokiClear() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLokiClear());
|
||||
}
|
||||
private static void toggleRingLokiMirroring() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLokiMirror());
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,14 @@
|
||||
* This class was created by <Vazkii/ChickenBones>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 3, 2014, 9:05:38 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -51,10 +50,11 @@ public class LightningHandler {
|
||||
static double interpPosY;
|
||||
static double interpPosZ;
|
||||
|
||||
private static Vector3 getRelativeViewVector(Vector3 pos) {
|
||||
Entity renderEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
|
||||
}
|
||||
private final Vector3 scratchView = new Vector3();
|
||||
private final Vector3 scratchPoint = new Vector3();
|
||||
private final Vector3 scratchDiff1 = new Vector3();
|
||||
private final Vector3 scratchDiff2 = new Vector3();
|
||||
private final Vector3 scratchRound = new Vector3();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
@@ -67,12 +67,14 @@ public class LightningHandler {
|
||||
profiler.endStartSection("lightning");
|
||||
|
||||
float frame = event.partialTicks;
|
||||
Entity entity = Minecraft.getMinecraft().thePlayer;
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
|
||||
interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
|
||||
interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
|
||||
Entity viewEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
interpPosX = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * frame;
|
||||
interpPosY = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * frame;
|
||||
interpPosZ = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * frame;
|
||||
|
||||
scratchView.set(viewEntity.posX, viewEntity.posY + viewEntity.getEyeHeight(), viewEntity.posZ);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);
|
||||
@@ -130,22 +132,23 @@ public class LightningHandler {
|
||||
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
|
||||
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
|
||||
|
||||
for(Segment rendersegment : bolt.segments) {
|
||||
for(int i = 0; i < bolt.segments.size(); i++) {
|
||||
Segment rendersegment = bolt.segments.get(i);
|
||||
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
|
||||
continue;
|
||||
|
||||
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
|
||||
Vector3 playervec = scratchPoint.set(rendersegment.startpoint.point).subtract(scratchView);
|
||||
|
||||
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
Vector3 diff1 = scratchDiff1.set(playervec).crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = scratchDiff2.set(playervec).crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
|
||||
Vector3 startvec = rendersegment.startpoint.point;
|
||||
Vector3 endvec = rendersegment.endpoint.point;
|
||||
|
||||
int color = inner ? bolt.colorInner : bolt.colorOuter;
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * new Color(color).getAlpha()));
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * 255));
|
||||
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
@@ -153,7 +156,7 @@ public class LightningHandler {
|
||||
tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1);
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).add(rendersegment.endpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0);
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
@@ -162,7 +165,7 @@ public class LightningHandler {
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).multiply(-1).add(rendersegment.startpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0);
|
||||
@@ -174,11 +177,11 @@ public class LightningHandler {
|
||||
|
||||
public static class LightningBolt {
|
||||
|
||||
public ArrayList<Segment> segments = new ArrayList<Segment>();
|
||||
public ArrayList<Segment> segments = new ArrayList<>();
|
||||
public Vector3 start;
|
||||
public Vector3 end;
|
||||
ChunkCoordinates target;
|
||||
HashMap<Integer, Integer> splitparents = new HashMap<Integer, Integer>();
|
||||
HashMap<Integer, Integer> splitparents = new HashMap<>();
|
||||
|
||||
public double length;
|
||||
public int numsegments0;
|
||||
@@ -195,7 +198,7 @@ public class LightningHandler {
|
||||
private World world;
|
||||
private Entity source;
|
||||
|
||||
public static ConcurrentLinkedQueue<LightningBolt> boltlist = new ConcurrentLinkedQueue<LightningBolt>();
|
||||
public static ConcurrentLinkedQueue<LightningBolt> boltlist = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public float speed = 1.5F;
|
||||
public static final int fadetime = 20;
|
||||
@@ -223,9 +226,9 @@ public class LightningHandler {
|
||||
|
||||
@Override
|
||||
public int compare(Segment o1, Segment o2) {
|
||||
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
|
||||
int comp = o1.splitno - o2.splitno;
|
||||
if(comp == 0)
|
||||
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
|
||||
return o1.segmentno - o2.segmentno;
|
||||
else return comp;
|
||||
}
|
||||
}
|
||||
@@ -347,7 +350,7 @@ public class LightningHandler {
|
||||
return;
|
||||
|
||||
ArrayList<Segment> oldsegments = segments;
|
||||
segments = new ArrayList<Segment>();
|
||||
segments = new ArrayList<>();
|
||||
|
||||
Segment prev = null;
|
||||
|
||||
@@ -428,7 +431,7 @@ public class LightningHandler {
|
||||
}
|
||||
|
||||
private void calculateCollisionAndDiffs() {
|
||||
HashMap<Integer, Integer> lastactivesegment = new HashMap<Integer, Integer>();
|
||||
HashMap<Integer, Integer> lastactivesegment = new HashMap<>();
|
||||
|
||||
Collections.sort(segments, new SegmentSorter());
|
||||
|
||||
@@ -497,4 +500,4 @@ public class LightningHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,9 +51,9 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int p_72802_4_) {
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int lightValue) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getLightBrightnessForSkyBlocks(x,y,z,p_72802_4_);
|
||||
return originalBlockAccess.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
|
||||
return 15728640;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public final class RedStringRenderer {
|
||||
|
||||
public static final Queue<TileRedString> redStringTiles = new ArrayDeque();
|
||||
public static final Queue<TileRedString> redStringTiles = new ArrayDeque<>();
|
||||
static float sizeAlpha = 0F;
|
||||
|
||||
public static void renderAll() {
|
||||
|
||||
+40
-34
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -34,16 +34,18 @@ import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
import vazkii.botania.api.mana.IManaTooltipDisplay;
|
||||
import vazkii.botania.api.mana.ITieredManaTooltipDisplay;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static final Field THE_SLOT = ReflectionUtils.findField(GuiContainer.class, LibObfuscation.THE_SLOT);
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
public static void render() {
|
||||
@@ -51,7 +53,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
GuiScreen gui = mc.currentScreen;
|
||||
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
|
||||
GuiContainer container = (GuiContainer) gui;
|
||||
Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
|
||||
Slot slot = (Slot) ReflectionUtils.getObject(THE_SLOT, container);
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
@@ -64,7 +66,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
try {
|
||||
tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
|
||||
} catch(Exception e) {
|
||||
tooltip = new ArrayList();
|
||||
tooltip = new ArrayList<>();
|
||||
}
|
||||
int width = 0;
|
||||
for(String s : tooltip)
|
||||
@@ -83,10 +85,10 @@ public final class TooltipAdditionDisplayHandler {
|
||||
if(offscreen)
|
||||
offx = -13 - width;
|
||||
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
|
||||
if(stack.getItem() instanceof ITieredManaTooltipDisplay tieredItem)
|
||||
drawTieredManaBar(stack, tieredItem, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay manaItem)
|
||||
drawManaBar(stack, manaItem, mouseX, mouseY, offx, offy, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
@@ -169,33 +171,37 @@ public final class TooltipAdditionDisplayHandler {
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
int level = ItemTerraPick.getLevel(stack);
|
||||
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
|
||||
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
|
||||
int curr = ItemTerraPick.getMana_(stack);
|
||||
float percent = level == 0 ? 0F : (float) curr / (float) max;
|
||||
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
private static void drawTieredManaBar(ItemStack stack, ITieredManaTooltipDisplay item, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
float percent = item.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = Math.min(width - (percent == 1 ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
if (item.isRainbowEffect(stack)) {
|
||||
for (int i = 0; i < manaBarWidth; i++) {
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
}
|
||||
} else {
|
||||
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
}
|
||||
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
|
||||
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
String leftRank = item.getLeftManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!leftRank.isEmpty()) {
|
||||
font.drawStringWithShadow(leftRank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
String rightRank = item.getRightManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!rightRank.isEmpty()) {
|
||||
font.drawStringWithShadow(rightRank, mouseX + offx + width - font.getStringWidth(rightRank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package vazkii.botania.client.core.helper;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.brew.BrewUtilities;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class BrewHelper {
|
||||
|
||||
public static List<ItemStack> getBrewContainers() {
|
||||
class Cache {
|
||||
private static final List<ItemStack> BREW_CONTAINERS = List.copyOf(scanBrewContainers());
|
||||
}
|
||||
|
||||
return Cache.BREW_CONTAINERS;
|
||||
}
|
||||
|
||||
private static List<ItemStack> scanBrewContainers() {
|
||||
ArrayList<ItemStack> containers = new ArrayList<>();
|
||||
|
||||
if (Botania.neiLoaded) {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && BrewUtilities.isEmptyBrewContainer(item)) {
|
||||
containers.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (containers.isEmpty()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Iterable<Item> itemRegistry = Item.itemRegistry;
|
||||
|
||||
ArrayList<ItemStack> potentialContainers = new ArrayList<>();
|
||||
for (Item item : itemRegistry) {
|
||||
if (item instanceof IBrewContainer) {
|
||||
item.getSubItems(item, item.getCreativeTab(), potentialContainers);
|
||||
|
||||
for (ItemStack maybeContainer : potentialContainers) {
|
||||
if (maybeContainer != null && BrewUtilities.isEmptyBrewContainer(maybeContainer)) {
|
||||
containers.add(maybeContainer);
|
||||
}
|
||||
}
|
||||
|
||||
potentialContainers.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return containers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,12 +12,12 @@ package vazkii.botania.client.core.helper;
|
||||
|
||||
public final class FontHelper {
|
||||
|
||||
public static boolean isFormatColor(char par0) {
|
||||
return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70;
|
||||
public static boolean isFormatColor(char letter) {
|
||||
return letter >= 48 && letter <= 57 || letter >= 97 && letter <= 102 || letter >= 65 && letter <= 70;
|
||||
}
|
||||
|
||||
public static boolean isFormatSpecial(char par0) {
|
||||
return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82;
|
||||
public static boolean isFormatSpecial(char letter) {
|
||||
return letter >= 107 && letter <= 111 || letter >= 75 && letter <= 79 || letter == 114 || letter == 82;
|
||||
}
|
||||
|
||||
public static String getFormatFromString(String par0Str) {
|
||||
|
||||
@@ -17,11 +17,12 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
@@ -97,15 +98,15 @@ public final class RenderHelper {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
float var7 = (par5 >> 24 & 255) / 255F;
|
||||
float var8 = (par5 >> 16 & 255) / 255F;
|
||||
float var9 = (par5 >> 8 & 255) / 255F;
|
||||
float var10 = (par5 & 255) / 255F;
|
||||
float var11 = (par6 >> 24 & 255) / 255F;
|
||||
float var12 = (par6 >> 16 & 255) / 255F;
|
||||
float var13 = (par6 >> 8 & 255) / 255F;
|
||||
float var14 = (par6 & 255) / 255F;
|
||||
public static void drawGradientRect(int left, int top, float z, int right, int bottom, int topColor, int bottomColor) {
|
||||
float topA = (topColor >> 24 & 255) / 255F;
|
||||
float topR = (topColor >> 16 & 255) / 255F;
|
||||
float topG = (topColor >> 8 & 255) / 255F;
|
||||
float topB = (topColor & 255) / 255F;
|
||||
float bottomA = (bottomColor >> 24 & 255) / 255F;
|
||||
float bottomR = (bottomColor >> 16 & 255) / 255F;
|
||||
float bottomG = (bottomColor >> 8 & 255) / 255F;
|
||||
float bottomB = (bottomColor & 255) / 255F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -113,12 +114,12 @@ public final class RenderHelper {
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator var15 = Tessellator.instance;
|
||||
var15.startDrawingQuads();
|
||||
var15.setColorRGBA_F(var8, var9, var10, var7);
|
||||
var15.addVertex(par3, par2, z);
|
||||
var15.addVertex(par1, par2, z);
|
||||
var15.setColorRGBA_F(var12, var13, var14, var11);
|
||||
var15.addVertex(par1, par4, z);
|
||||
var15.addVertex(par3, par4, z);
|
||||
var15.setColorRGBA_F(topR, topG, topB, topA);
|
||||
var15.addVertex(right, top, z);
|
||||
var15.addVertex(left, top, z);
|
||||
var15.setColorRGBA_F(bottomR, bottomG, bottomB, bottomA);
|
||||
var15.addVertex(left, bottom, z);
|
||||
var15.addVertex(right, bottom, z);
|
||||
var15.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
@@ -126,17 +127,17 @@ public final class RenderHelper {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
drawTexturedModalRect(par1, par2, z, par3, par4, par5, par6, 0.00390625F, 0.00390625F);
|
||||
public static void drawTexturedModalRect(int x, int y, float z, int textureX, int textureY, int width, int height) {
|
||||
drawTexturedModalRect(x, y, z, textureX, textureY, width, height, 0.00390625F, 0.00390625F);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, float f, float f1) {
|
||||
public static void drawTexturedModalRect(int x, int y, float z, int textureX, int textureY, int width, int height, float f, float f1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + height, z, (textureX + 0) * f, (textureY + height) * f1);
|
||||
tessellator.addVertexWithUV(x + width, y + height, z, (textureX + width) * f, (textureY + height) * f1);
|
||||
tessellator.addVertexWithUV(x + width, y + 0, z, (textureX + width) * f, (textureY + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0, z, (textureX + 0) * f, (textureY + 0) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@@ -243,10 +244,21 @@ public final class RenderHelper {
|
||||
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||
for(KeyBinding otherKey : keys)
|
||||
if(otherKey.getKeyDescription().equals(keyName)) {
|
||||
key = Keyboard.getKeyName(otherKey.getKeyCode());
|
||||
key = GameSettings.getKeyDisplayString(otherKey.getKeyCode());
|
||||
break;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
public static void renderIcon(int x, int y, IIcon icon, int width, int height, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(x, y + height, 0, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(x + width, y + height, 0, icon.getMaxU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(x + width, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(x, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
@@ -33,6 +35,8 @@ public final class ShaderHelper {
|
||||
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
|
||||
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
|
||||
|
||||
private static final Int2IntMap TIME_UNIFORM_LOCATIONS = new Int2IntOpenHashMap();
|
||||
|
||||
public static int pylonGlow = 0;
|
||||
public static int enchanterRune = 0;
|
||||
public static int manaPool = 0;
|
||||
@@ -67,8 +71,8 @@ public final class ShaderHelper {
|
||||
ARBShaderObjects.glUseProgramObjectARB(shader);
|
||||
|
||||
if(shader != 0) {
|
||||
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
|
||||
ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame);
|
||||
int timeUniform = TIME_UNIFORM_LOCATIONS.computeIfAbsent(shader, s -> ARBShaderObjects.glGetUniformLocationARB(shader, "time"));
|
||||
ARBShaderObjects.glUniform1iARB(timeUniform, ClientTickHandler.ticksInGame);
|
||||
|
||||
if(callback != null)
|
||||
callback.call(shader);
|
||||
|
||||
@@ -55,6 +55,7 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
|
||||
import vazkii.botania.client.core.handler.TooltipHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.core.handler.KeyHandler;
|
||||
import vazkii.botania.client.fx.FXSparkle;
|
||||
import vazkii.botania.client.fx.FXWisp;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
@@ -123,7 +124,6 @@ import vazkii.botania.client.render.tile.RenderTileTerraPlate;
|
||||
import vazkii.botania.client.render.tile.RenderTileTeruTeruBozu;
|
||||
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
|
||||
import vazkii.botania.client.render.world.SkyblockRenderEvents;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileAlfPortal;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
@@ -219,6 +219,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SkyblockRenderEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new KeyHandler());
|
||||
FMLCommonHandler.instance().bus().register(new CorporeaAutoCompleteHandler());
|
||||
|
||||
if(ConfigHandler.enableSeasonalFeatures) {
|
||||
@@ -380,23 +381,38 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void setExtraReach(EntityLivingBase entity, float reach) {
|
||||
super.setExtraReach(entity, reach);
|
||||
IExtendedPlayerController controller = getReachController(entity);
|
||||
if(controller != null)
|
||||
controller.setReachDistanceExtension(Math.max(0, controller.getReachDistanceExtension() + reach));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClientExtraReach(EntityLivingBase entity, float reach) {
|
||||
IExtendedPlayerController controller = getReachController(entity);
|
||||
if(controller != null)
|
||||
controller.setReachDistanceExtension(Math.max(0, reach));
|
||||
}
|
||||
|
||||
private IExtendedPlayerController getReachController(EntityLivingBase entity) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
if(entity == player) {
|
||||
if(!(mc.playerController instanceof IExtendedPlayerController)) {
|
||||
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
|
||||
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
controller.setGameType(type);
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
}
|
||||
// Player object might have changed, need to check the UUID.
|
||||
if(!entity.worldObj.isRemote || !entity.getUniqueID().equals(player.getUniqueID()))
|
||||
return null;
|
||||
|
||||
((IExtendedPlayerController) mc.playerController).setReachDistanceExtension(Math.max(0, ((IExtendedPlayerController) mc.playerController).getReachDistanceExtension() + reach));
|
||||
if(!(mc.playerController instanceof IExtendedPlayerController)) {
|
||||
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
|
||||
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
controller.setGameType(type);
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
}
|
||||
|
||||
return (IExtendedPlayerController) mc.playerController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,8 +31,8 @@ public class FXSparkle extends EntityFX {
|
||||
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
|
||||
|
||||
public static Queue<FXSparkle> queuedRenders = new ArrayDeque();
|
||||
public static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque();
|
||||
public static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
|
||||
public static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
|
||||
|
||||
// Queue values
|
||||
float f;
|
||||
@@ -68,16 +68,20 @@ public class FXSparkle extends EntityFX {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ObfuscationHelper.getParticleTexture() : particles);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
if(!queuedRenders.isEmpty()) {
|
||||
for(FXSparkle sparkle : queuedRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.filmGrain);
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedCorruptRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
if(!queuedCorruptRenders.isEmpty()) {
|
||||
ShaderHelper.useShader(ShaderHelper.filmGrain);
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedCorruptRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
queuedRenders.clear();
|
||||
queuedCorruptRenders.clear();
|
||||
@@ -162,85 +166,96 @@ public class FXSparkle extends EntityFX {
|
||||
particleGravity = value;
|
||||
}
|
||||
|
||||
protected boolean pushOutOfBlocks(double par1, double par3, double par5) {
|
||||
int var7 = MathHelper.floor_double(par1);
|
||||
int var8 = MathHelper.floor_double(par3);
|
||||
int var9 = MathHelper.floor_double(par5);
|
||||
double var10 = par1 - var7;
|
||||
double var12 = par3 - var8;
|
||||
double var14 = par5 - var9;
|
||||
protected boolean pushOutOfBlocks(double x, double y, double z) {
|
||||
int blockX = MathHelper.floor_double(x);
|
||||
int blockY = MathHelper.floor_double(y);
|
||||
int blockZ = MathHelper.floor_double(z);
|
||||
double dx = x - blockX;
|
||||
double dy = y - blockY;
|
||||
double dz = z - blockZ;
|
||||
|
||||
if (!worldObj.isAirBlock(var7, var8, var9)) {
|
||||
boolean var16 = !worldObj.isBlockNormalCubeDefault(var7 - 1, var8, var9, false);
|
||||
boolean var17 = !worldObj.isBlockNormalCubeDefault(var7 + 1, var8, var9, false);
|
||||
boolean var18 = !worldObj.isBlockNormalCubeDefault(var7, var8 - 1, var9, false);
|
||||
boolean var19 = !worldObj.isBlockNormalCubeDefault(var7, var8 + 1, var9, false);
|
||||
boolean var20 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 - 1, false);
|
||||
boolean var21 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 + 1, false);
|
||||
byte var22 = -1;
|
||||
double var23 = 9999.0D;
|
||||
if (!worldObj.isAirBlock(blockX, blockY, blockZ)) {
|
||||
boolean westFree = !worldObj.isBlockNormalCubeDefault(blockX - 1, blockY, blockZ, false);
|
||||
boolean eastFree = !worldObj.isBlockNormalCubeDefault(blockX + 1, blockY, blockZ, false);
|
||||
boolean downFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY - 1, blockZ, false);
|
||||
boolean upFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY + 1, blockZ, false);
|
||||
boolean northFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY, blockZ - 1, false);
|
||||
boolean southFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY, blockZ + 1, false);
|
||||
byte direction = -1;
|
||||
double minDist = 9999.0D;
|
||||
|
||||
if (var16 && var10 < var23) {
|
||||
var23 = var10;
|
||||
var22 = 0;
|
||||
if (westFree && dx < minDist) {
|
||||
minDist = dx;
|
||||
direction = 0;
|
||||
}
|
||||
|
||||
if (var17 && 1.0D - var10 < var23) {
|
||||
var23 = 1.0D - var10;
|
||||
var22 = 1;
|
||||
if (eastFree && (1.0D - dx) < minDist) {
|
||||
minDist = 1.0D - dx;
|
||||
direction = 1;
|
||||
}
|
||||
|
||||
if (var18 && var12 < var23) {
|
||||
var23 = var12;
|
||||
var22 = 2;
|
||||
if (downFree && dy < minDist) {
|
||||
minDist = dy;
|
||||
direction = 2;
|
||||
}
|
||||
|
||||
if (var19 && 1.0D - var12 < var23) {
|
||||
var23 = 1.0D - var12;
|
||||
var22 = 3;
|
||||
if (upFree && (1.0D - dy) < minDist) {
|
||||
minDist = 1.0D - dy;
|
||||
direction = 3;
|
||||
}
|
||||
|
||||
if (var20 && var14 < var23) {
|
||||
var23 = var14;
|
||||
var22 = 4;
|
||||
if (northFree && dz < minDist) {
|
||||
minDist = dz;
|
||||
direction = 4;
|
||||
}
|
||||
|
||||
if (var21 && 1.0D - var14 < var23) {
|
||||
var23 = 1.0D - var14;
|
||||
var22 = 5;
|
||||
if (southFree && (1.0D - dz) < minDist) {
|
||||
minDist = 1.0D - dz;
|
||||
direction = 5;
|
||||
}
|
||||
|
||||
float var25 = rand.nextFloat() * 0.05F + 0.025F;
|
||||
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
float mainVel = rand.nextFloat() * 0.05F + 0.025F;
|
||||
float sideVel1 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
float sideVel2 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
|
||||
if (var22 == 0) {
|
||||
motionX = -var25;
|
||||
motionY=motionZ=var26;
|
||||
}
|
||||
switch(direction) {
|
||||
case 0 -> {
|
||||
motionX = -mainVel;
|
||||
motionY = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 1) {
|
||||
motionX = var25;
|
||||
motionY=motionZ=var26;
|
||||
}
|
||||
case 1 -> {
|
||||
motionX = mainVel;
|
||||
motionY = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 2) {
|
||||
motionY = -var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
case 2 -> {
|
||||
motionY = -mainVel;
|
||||
motionX = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 3) {
|
||||
motionY = var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
case 3 -> {
|
||||
motionY = mainVel;
|
||||
motionX = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 4) {
|
||||
motionZ = -var25;
|
||||
motionY=motionX=var26;
|
||||
}
|
||||
case 4 -> {
|
||||
motionZ = -mainVel;
|
||||
motionY = sideVel1;
|
||||
motionX = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 5) {
|
||||
motionZ = var25;
|
||||
motionY=motionX=var26;
|
||||
case 5 -> {
|
||||
motionZ = mainVel;
|
||||
motionY = sideVel1;
|
||||
motionX = sideVel2;
|
||||
}
|
||||
|
||||
default -> {}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -31,8 +31,8 @@ public class FXWisp extends EntityFX {
|
||||
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
|
||||
|
||||
public static Queue<FXWisp> queuedRenders = new ArrayDeque();
|
||||
public static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque();
|
||||
public static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
|
||||
public static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
|
||||
|
||||
// Queue values
|
||||
float f;
|
||||
|
||||
@@ -28,6 +28,14 @@ public final class ParticleRenderDispatcher {
|
||||
// Called from LightningHandler.onRenderWorldLast since that was
|
||||
// already registered. /shrug
|
||||
public static void dispatch() {
|
||||
if(FXSparkle.queuedRenders.isEmpty() && FXSparkle.queuedCorruptRenders.isEmpty() && FXWisp.queuedRenders.isEmpty() && FXWisp.queuedDepthIgnoringRenders.isEmpty()) {
|
||||
sparkleFxCount = 0;
|
||||
fakeSparkleFxCount = 0;
|
||||
wispFxCount = 0;
|
||||
depthIgnoringWispFxCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
@@ -20,7 +20,7 @@ import cpw.mods.fml.client.config.GuiConfig;
|
||||
public class GuiBotaniaConfig extends GuiConfig {
|
||||
|
||||
public GuiBotaniaConfig(GuiScreen parentScreen) {
|
||||
super(parentScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), LibMisc.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
super(parentScreen, new ConfigElement<>(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), LibMisc.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,17 +17,17 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotLocked extends Slot {
|
||||
|
||||
public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
public SlotLocked(IInventory inventory, int slotIndex, int xPos, int yPos) {
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer p_82869_1_) {
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack p_75214_1_) {
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Mar 16, 2015, 6:42:40 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.client.gui.SlotLocked;
|
||||
|
||||
public class ContainerFlowerBag extends Container {
|
||||
|
||||
InventoryFlowerBag flowerBagInv;
|
||||
|
||||
public ContainerFlowerBag(EntityPlayer player) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
int slot = player.inventory.currentItem;
|
||||
IInventory playerInv = player.inventory;
|
||||
flowerBagInv = new InventoryFlowerBag(player, slot);
|
||||
|
||||
for(i = 0; i < 2; ++i)
|
||||
for(j = 0; j < 8; ++j) {
|
||||
int k = j + i * 8;
|
||||
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
|
||||
}
|
||||
|
||||
for(i = 0; i < 3; ++i)
|
||||
for(j = 0; j < 9; ++j)
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
|
||||
for(i = 0; i < 9; ++i) {
|
||||
if(player.inventory.currentItem == i)
|
||||
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
|
||||
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
boolean can = flowerBagInv.isUseableByPlayer(player);
|
||||
if(!can)
|
||||
onContainerClosed(player);
|
||||
|
||||
return can;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
flowerBagInv.pushInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(p_82846_2_ < 16) {
|
||||
if(!mergeItemStack(itemstack1, 16, 52, true))
|
||||
return null;
|
||||
} else {
|
||||
int i = itemstack.getItemDamage();
|
||||
if(i < 16) {
|
||||
Slot slot1 = (Slot)inventorySlots.get(i);
|
||||
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == 0)
|
||||
slot.putStack((ItemStack)null);
|
||||
else slot.onSlotChanged();
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(p_82846_1_, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Mar 16, 2015, 6:42:43 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class GuiFlowerBag extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
|
||||
|
||||
public GuiFlowerBag(EntityPlayer player) {
|
||||
super(new ContainerFlowerBag(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String s = StatCollector.translateToLocal("item.botania:flowerBag.name");
|
||||
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int k = (width - xSize) / 2;
|
||||
int l = (height - ySize) / 2;
|
||||
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
|
||||
|
||||
List<Slot> slotList = inventorySlots.inventorySlots;
|
||||
for(Slot slot : slotList)
|
||||
if(slot instanceof SlotFlower) {
|
||||
SlotFlower slotf = (SlotFlower) slot;
|
||||
if(!slotf.getHasStack()) {
|
||||
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
|
||||
int x = guiLeft + slotf.xDisplayPosition;
|
||||
int y = guiTop + slotf.yDisplayPosition;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Mar 16, 2015, 6:42:56 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.ItemFlowerBag;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class InventoryFlowerBag implements IInventory {
|
||||
|
||||
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
|
||||
|
||||
EntityPlayer player;
|
||||
int slot;
|
||||
ItemStack[] stacks = null;
|
||||
|
||||
boolean invPushed = false;
|
||||
ItemStack storedInv = null;
|
||||
|
||||
public InventoryFlowerBag(EntityPlayer player, int slot) {
|
||||
this.player = player;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public static boolean isFlowerBag(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == ModItems.flowerBag;
|
||||
}
|
||||
|
||||
ItemStack getStack() {
|
||||
ItemStack stack = player.inventory.getStackInSlot(slot);
|
||||
if(stack != null)
|
||||
storedInv = stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
ItemStack[] getInventory() {
|
||||
if(stacks != null)
|
||||
return stacks;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(isFlowerBag(getStack())) {
|
||||
stacks = ItemFlowerBag.loadStacks(stack);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
return FALLBACK_INVENTORY;
|
||||
}
|
||||
|
||||
public void pushInventory() {
|
||||
if(invPushed)
|
||||
return;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(stack == null)
|
||||
stack = storedInv;
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack[] inv = getInventory();
|
||||
ItemFlowerBag.setStacks(stack, inv);
|
||||
}
|
||||
|
||||
invPushed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return getInventory()[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return isFlowerBag(getStack()) ? 64 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return isFlowerBag(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return isFlowerBag(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibItemNames.FLOWER_BAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Mar 16, 2015, 7:20:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class SlotFlower extends Slot {
|
||||
|
||||
InventoryFlowerBag inv;
|
||||
int color;
|
||||
|
||||
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
this.color = color;
|
||||
inv = p_i1824_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
|
||||
inv.setInventorySlotContents(color, newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package vazkii.botania.client.gui.bags;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.client.gui.SlotLocked;
|
||||
|
||||
public abstract class ContainerMagicPlantBag extends Container {
|
||||
|
||||
protected InventoryMagicPlantBag magicPlantInv;
|
||||
public ContainerMagicPlantBag(EntityPlayer player) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
IInventory playerInv = player.inventory;
|
||||
|
||||
addMagicPlantSlots(player);
|
||||
|
||||
for(i = 0; i < 3; ++i) {
|
||||
for(j = 0; j < 9; ++j) {
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(i = 0; i < 9; ++i) {
|
||||
if(player.inventory.currentItem == i) {
|
||||
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
|
||||
}
|
||||
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void addMagicPlantSlots(EntityPlayer player);
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
boolean can = magicPlantInv.isUseableByPlayer(player);
|
||||
if(!can)
|
||||
onContainerClosed(player);
|
||||
|
||||
return can;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
magicPlantInv.pushInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(index < 16) {
|
||||
if(!mergeItemStack(itemstack1, 16, 52, true))
|
||||
return null;
|
||||
} else {
|
||||
int i = itemstack.getItemDamage();
|
||||
if(i < 16) {
|
||||
Slot slot1 = (Slot)inventorySlots.get(i);
|
||||
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(itemstack1.stackSize == 0)
|
||||
slot.putStack((ItemStack)null);
|
||||
else slot.onSlotChanged();
|
||||
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package vazkii.botania.client.gui.bags;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class GuiMagicPlantBag extends GuiContainer {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
public GuiMagicPlantBag(ContainerMagicPlantBag container, ResourceLocation texture) {
|
||||
super(container);
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String s = StatCollector.translateToLocal(getLocalizedNameKey());
|
||||
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int k = (width - xSize) / 2;
|
||||
int l = (height - ySize) / 2;
|
||||
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
|
||||
|
||||
List<Slot> slotList = inventorySlots.inventorySlots;
|
||||
for(Slot slot : slotList)
|
||||
if(slot instanceof SlotMagicPlant) {
|
||||
SlotMagicPlant slotf = (SlotMagicPlant) slot;
|
||||
if(!slotf.getHasStack()) {
|
||||
ItemStack stack = new ItemStack(itemTypeAllowed(), 0, slotf.color);
|
||||
int x = guiLeft + slotf.xDisplayPosition;
|
||||
int y = guiTop + slotf.yDisplayPosition;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int keyCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract Block itemTypeAllowed();
|
||||
|
||||
protected abstract String getLocalizedNameKey();
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package vazkii.botania.client.gui.bags;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.bag.ItemBagBase;
|
||||
|
||||
public abstract class InventoryMagicPlantBag implements IInventory {
|
||||
|
||||
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
|
||||
|
||||
EntityPlayer player;
|
||||
int slot;
|
||||
ItemStack[] stacks = null;
|
||||
|
||||
boolean invPushed = false;
|
||||
ItemStack storedInv = null;
|
||||
|
||||
public InventoryMagicPlantBag(EntityPlayer player, int slot) {
|
||||
this.player = player;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
ItemStack getStack() {
|
||||
ItemStack stack = player.inventory.getStackInSlot(slot);
|
||||
if(stack != null)
|
||||
storedInv = stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
public void pushInventory() {
|
||||
if(invPushed)
|
||||
return;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(stack == null)
|
||||
stack = storedInv;
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack[] inv = getInventory();
|
||||
ItemBagBase.setStacks(stack, inv);
|
||||
}
|
||||
|
||||
invPushed = true;
|
||||
}
|
||||
|
||||
ItemStack[] getInventory() {
|
||||
if(stacks != null)
|
||||
return stacks;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(isMagicPlantBag(getStack())) {
|
||||
stacks = ItemBagBase.loadStacks(stack);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
return FALLBACK_INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIn) {
|
||||
return getInventory()[slotIn];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
if (inventorySlots[index] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[index].stackSize <= count) {
|
||||
stackAt = inventorySlots[index];
|
||||
inventorySlots[index] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[index].splitStack(count);
|
||||
|
||||
if (inventorySlots[index].stackSize == 0)
|
||||
inventorySlots[index] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int index) {
|
||||
return getStackInSlot(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
inventorySlots[index] = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getBagName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return isMagicPlantBag(getStack()) ? 64 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return isMagicPlantBag(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
return isMagicPlantBag(getStack());
|
||||
}
|
||||
|
||||
protected abstract String getBagName();
|
||||
|
||||
public abstract boolean isMagicPlantBag(ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
package vazkii.botania.client.gui.bags;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class SlotMagicPlant extends Slot {
|
||||
|
||||
InventoryMagicPlantBag inv;
|
||||
int color;
|
||||
|
||||
public SlotMagicPlant(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
this.color = color;
|
||||
inv = p_i1824_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
|
||||
inv.setInventorySlotContents(color, newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(getValidBlock()) && stack.getItemDamage() == color;
|
||||
}
|
||||
|
||||
protected abstract Block getValidBlock();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package vazkii.botania.client.gui.bags.flowerBag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import vazkii.botania.client.gui.bags.ContainerMagicPlantBag;
|
||||
|
||||
public class ContainerFlowerBag extends ContainerMagicPlantBag {
|
||||
public ContainerFlowerBag(EntityPlayer player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMagicPlantSlots(EntityPlayer player) {
|
||||
int slot = player.inventory.currentItem;
|
||||
magicPlantInv = new InventoryFlowerBag(player, slot);
|
||||
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
int k = j + i * 8;
|
||||
addSlotToContainer(new SlotFlower(magicPlantInv, k, 17 + j * 18, 26 + i * 18, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package vazkii.botania.client.gui.bags.flowerBag;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.gui.bags.GuiMagicPlantBag;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class GuiFlowerBag extends GuiMagicPlantBag {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
|
||||
|
||||
public GuiFlowerBag(EntityPlayer player) {
|
||||
super(new ContainerFlowerBag(player), texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Block itemTypeAllowed() {
|
||||
return ModBlocks.flower;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "botania.gui.flowerBag.title";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package vazkii.botania.client.gui.bags.flowerBag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class InventoryFlowerBag extends InventoryMagicPlantBag {
|
||||
public InventoryFlowerBag(EntityPlayer player, int slot) {
|
||||
super(player, slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMagicPlantBag(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == ModItems.flowerBag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBagName() {
|
||||
return LibItemNames.FLOWER_BAG;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package vazkii.botania.client.gui.bags.flowerBag;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
|
||||
import vazkii.botania.client.gui.bags.SlotMagicPlant;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class SlotFlower extends SlotMagicPlant {
|
||||
public SlotFlower(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Block getValidBlock() {
|
||||
return ModBlocks.flower;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package vazkii.botania.client.gui.bags.shroomBag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import vazkii.botania.client.gui.bags.ContainerMagicPlantBag;
|
||||
|
||||
public class ContainerShroomBag extends ContainerMagicPlantBag {
|
||||
public ContainerShroomBag(EntityPlayer player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMagicPlantSlots(EntityPlayer player) {
|
||||
int slot = player.inventory.currentItem;
|
||||
magicPlantInv = new InventoryShroomBag(player, slot);
|
||||
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
int k = j + i * 8;
|
||||
addSlotToContainer(new SlotShroom(magicPlantInv, k, 17 + j * 18, 26 + i * 18, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package vazkii.botania.client.gui.bags.shroomBag;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.gui.bags.GuiMagicPlantBag;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class GuiShroomBag extends GuiMagicPlantBag {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_SHROOM_BAG);
|
||||
|
||||
public GuiShroomBag(EntityPlayer player) {
|
||||
super(new ContainerShroomBag(player), texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Block itemTypeAllowed() {
|
||||
return ModBlocks.mushroom;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "botania.gui.shroomBag.title";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package vazkii.botania.client.gui.bags.shroomBag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class InventoryShroomBag extends InventoryMagicPlantBag {
|
||||
public InventoryShroomBag(EntityPlayer player, int slot) {
|
||||
super(player, slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMagicPlantBag(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == ModItems.shroomBag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBagName() {
|
||||
return LibItemNames.SHROOM_BAG;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package vazkii.botania.client.gui.bags.shroomBag;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
|
||||
import vazkii.botania.client.gui.bags.SlotMagicPlant;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class SlotShroom extends SlotMagicPlant {
|
||||
public SlotShroom(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Block getValidBlock() {
|
||||
return ModBlocks.mushroom;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,22 +83,22 @@ public class ContainerBaubleBox extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots(ItemStack[] p_75131_1_) {
|
||||
public void putStacksInSlots(ItemStack[] stacks) {
|
||||
baubles.blockEvents = true;
|
||||
super.putStacksInSlots(p_75131_1_);
|
||||
super.putStacksInSlots(stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
|
||||
Slot slot = (Slot)inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
System.out.println(p_82846_2_ + " " + itemstack);
|
||||
if(p_82846_2_ < 28) {
|
||||
System.out.println(index + " " + itemstack);
|
||||
if(index < 28) {
|
||||
if(!mergeItemStack(itemstack1, 28, 64, true))
|
||||
return null;
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ public class ContainerBaubleBox extends Container {
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(p_82846_1_, itemstack1);
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
||||
@@ -29,12 +29,12 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
protected boolean checkHotbarKeys(int keyCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int k = (width - xSize) / 2;
|
||||
@@ -47,7 +47,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
|
||||
drawTexturedModalRect(k+slot.xDisplayPosition, l+slot.yDisplayPosition, 200, 0, 16, 16);
|
||||
}
|
||||
|
||||
GuiInventory.func_147046_a(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - p_146976_2_, guiTop + 45 - 30 - p_146976_3_, mc.thePlayer);
|
||||
GuiInventory.func_147046_a(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,13 @@ public class GuiCraftingHalo extends GuiContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 28, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
int k = (width - xSize) / 2;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
public static GuiLexicon currentOpenLexicon = new GuiLexicon();
|
||||
public static ItemStack stackUsed;
|
||||
|
||||
public static HashMap<String, String> notes = new HashMap();
|
||||
public static HashMap<String, String> notes = new HashMap<>();
|
||||
|
||||
private static final String TAG_TYPE = "type";
|
||||
|
||||
@@ -79,11 +79,11 @@ public class GuiLexicon extends GuiScreen {
|
||||
public static final int BOOKMARK_START = 1337;
|
||||
public static final int NOTES_BUTTON_ID = 1336; // random button tho
|
||||
public static final int MAX_BOOKMARK_COUNT = 8;
|
||||
public static List<GuiLexicon> bookmarks = new ArrayList();
|
||||
public static List<String> bookmarkKeys = new ArrayList();
|
||||
public static List<GuiLexicon> bookmarks = new ArrayList<>();
|
||||
public static List<String> bookmarkKeys = new ArrayList<>();
|
||||
boolean bookmarksNeedPopulation = false;
|
||||
|
||||
public static Queue<LexiconEntry> tutorial = new ArrayDeque();
|
||||
public static Queue<LexiconEntry> tutorial = new ArrayDeque<>();
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON);
|
||||
public static final ResourceLocation textureToff = new ResourceLocation(LibResources.GUI_TOFF);
|
||||
@@ -130,7 +130,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
public void onInitGui() {
|
||||
allCategories = new ArrayList(BotaniaAPI.getAllCategories());
|
||||
allCategories = new ArrayList<>(BotaniaAPI.getAllCategories());
|
||||
Collections.sort(allCategories);
|
||||
|
||||
lastTime = ClientTickHandler.ticksInGame;
|
||||
@@ -193,15 +193,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
float time = ClientTickHandler.ticksInGame + par3;
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
float time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
timeDelta = time - lastTime;
|
||||
lastTime = time;
|
||||
partialTicks = par3;
|
||||
this.partialTicks = partialTicks;
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawNotes(par3);
|
||||
drawNotes(partialTicks);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
@@ -227,7 +227,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(left - 19, top + 42, 67, 180, 19, 26);
|
||||
if(par1 >= left - 19 && par1 < left && par2 >= top + 62 && par2 < top + 88) {
|
||||
if(mouseX >= left - 19 && mouseX < left && mouseY >= top + 62 && mouseY < top + 88) {
|
||||
mc.renderEngine.bindTexture(textureToff);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
@@ -237,24 +237,24 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
int w = 256;
|
||||
int h = 152;
|
||||
int x = (int) ((ClientTickHandler.ticksInGame + par3) * 6) % (width + w) - w;
|
||||
int y = (int) (top + guiHeight / 2 - h / 4 + Math.sin((ClientTickHandler.ticksInGame + par3) / 6.0) * 40);
|
||||
int x = (int) ((ClientTickHandler.ticksInGame + partialTicks) * 6) % (width + w) - w;
|
||||
int y = (int) (top + guiHeight / 2 - h / 4 + Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 6.0) * 40);
|
||||
|
||||
drawTexturedModalRect(x * 2, y * 2, 0, 0, w, h);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
RenderHelper.renderTooltip(par1, par2, Arrays.asList(EnumChatFormatting.GOLD + "#goldfishchris", EnumChatFormatting.AQUA + "IT SAYS MANUAL"));
|
||||
RenderHelper.renderTooltip(mouseX, mouseY, Arrays.asList(EnumChatFormatting.GOLD + "#goldfishchris", EnumChatFormatting.AQUA + "IT SAYS MANUAL"));
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
if(hasTutorialArrow) {
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + par3) * 0.3F) + 1) * 0.15F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.3F) + 1) * 0.15F);
|
||||
drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
PageText.renderText(x + 5, y - 3, 92, 120, 0, noteDisplay);
|
||||
PageText.renderText(x + 5, y - 3, 92, 0, noteDisplay);
|
||||
fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
@@ -349,20 +349,20 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
|
||||
if(par1GuiButton instanceof GuiButtonChallengeInfo)
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START) {
|
||||
if(button.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
|
||||
if(button instanceof GuiButtonChallengeInfo)
|
||||
mc.displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, this));
|
||||
else mc.displayGuiScreen(new GuiLexiconHistory());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else handleBookmark(par1GuiButton);
|
||||
} else if(par1GuiButton instanceof GuiButtonCategory) {
|
||||
LexiconCategory category = ((GuiButtonCategory) par1GuiButton).getCategory();
|
||||
} else handleBookmark(button);
|
||||
} else if(button instanceof GuiButtonCategory) {
|
||||
LexiconCategory category = ((GuiButtonCategory) button).getCategory();
|
||||
|
||||
mc.displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else switch(par1GuiButton.id) {
|
||||
} else switch(button.id) {
|
||||
case -1 :
|
||||
mc.displayGuiScreen(new GuiBotaniaConfig(this));
|
||||
break;
|
||||
@@ -383,8 +383,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
} else {
|
||||
PersistentVariableHelper.lastBotaniaVersion = LibMisc.VERSION;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
par1GuiButton.visible = false;
|
||||
par1GuiButton.enabled = false;
|
||||
button.visible = false;
|
||||
button.enabled = false;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -394,9 +394,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleBookmark(GuiButton par1GuiButton) {
|
||||
public void handleBookmark(GuiButton button) {
|
||||
boolean modified = false;
|
||||
int i = par1GuiButton.id - BOOKMARK_START;
|
||||
int i = button.id - BOOKMARK_START;
|
||||
String key = getNotesKey();
|
||||
if(i == bookmarks.size()) {
|
||||
if(!bookmarkKeys.contains(key)) {
|
||||
@@ -483,7 +483,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
void populateBookmarks() {
|
||||
List remove = new ArrayList();
|
||||
List<GuiButton> remove = new ArrayList<>();
|
||||
List<GuiButton> buttons = buttonList;
|
||||
for(GuiButton button : buttons)
|
||||
if(button.id >= BOOKMARK_START)
|
||||
@@ -561,15 +561,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
handleNoteKey(par1, par2);
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
handleNoteKey(typedChar, keyCode);
|
||||
|
||||
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == par2) {
|
||||
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == keyCode) {
|
||||
mc.displayGuiScreen(null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
|
||||
if(par2 == KONAMI_CODE[konamiIndex]) {
|
||||
if(keyCode == KONAMI_CODE[konamiIndex]) {
|
||||
konamiIndex++;
|
||||
if(konamiIndex >= KONAMI_CODE.length) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation("botania:way")));
|
||||
@@ -577,15 +577,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
} else konamiIndex = 0;
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
public void handleNoteKey(char par1, int par2) {
|
||||
public void handleNoteKey(char typedChar, int keyCode) {
|
||||
if(notesEnabled) {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
boolean changed = false;
|
||||
|
||||
if(par2 == 14 && note.length() > 0) {
|
||||
if(keyCode == 14 && note.length() > 0) {
|
||||
if(isCtrlKeyDown())
|
||||
note = "";
|
||||
else {
|
||||
@@ -596,8 +596,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if((ChatAllowedCharacters.isAllowedCharacter(par1) || par2 == 28) && note.length() < 250) {
|
||||
note += par2 == 28 ? "<br>" : par1;
|
||||
if((ChatAllowedCharacters.isAllowedCharacter(typedChar) || keyCode == 28) && note.length() < 250) {
|
||||
note += keyCode == 28 ? "<br>" : typedChar;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -83,37 +83,37 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if(par3 == 1)
|
||||
if(mouseButton == 1)
|
||||
back();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
super.actionPerformed(par1GuiButton);
|
||||
else if(par1GuiButton.id == 12) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
super.actionPerformed(button);
|
||||
else if(button.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton.id == 13) {
|
||||
} else if(button.id == 13) {
|
||||
challenge.complete = !challenge.complete;
|
||||
setCompleteButtonTitle();
|
||||
PersistentVariableHelper.saveSafe();
|
||||
} else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
} else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
@@ -72,36 +72,36 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if(par3 == 1)
|
||||
if(mouseButton == 1)
|
||||
back();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
super.actionPerformed(par1GuiButton);
|
||||
else if(par1GuiButton.id == 12) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
super.actionPerformed(button);
|
||||
else if(button.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) par1GuiButton;
|
||||
} else if(button instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) button;
|
||||
mc.displayGuiScreen(new GuiLexiconChallenge(this, cbutton.challenge));
|
||||
} else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
} else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,16 +129,16 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
LexiconPage currentPage = entry.pages.get(page);
|
||||
LexiconPage newPage;
|
||||
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
if(button.id >= BOOKMARK_START)
|
||||
handleBookmark(button);
|
||||
else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
else
|
||||
switch(par1GuiButton.id) {
|
||||
switch(button.id) {
|
||||
case 0 :
|
||||
currentPage.onClosed(this);
|
||||
mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent);
|
||||
@@ -177,7 +177,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
updatePageButtons();
|
||||
currentPage.onActionPerformed(this, par1GuiButton);
|
||||
currentPage.onActionPerformed(this, button);
|
||||
}
|
||||
|
||||
public GuiLexiconEntry setFirstEntry() {
|
||||
@@ -193,11 +193,11 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.renderScreen(this, par1, par2);
|
||||
page.renderScreen(this, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -280,11 +280,11 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
fx = par1;
|
||||
switch(par3) {
|
||||
fx = mouseX;
|
||||
switch(mouseButton) {
|
||||
case 1:
|
||||
back();
|
||||
break;
|
||||
@@ -312,22 +312,22 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
handleNoteKey(par1, par2);
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
handleNoteKey(typedChar, keyCode);
|
||||
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.onKeyPressed(par1, par2);
|
||||
page.onKeyPressed(typedChar, keyCode);
|
||||
|
||||
if(par2 == 1) {
|
||||
if(keyCode == 1) {
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
} else if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
|
||||
} else if(keyCode == 203 || keyCode == 200 || keyCode == 201) // Left, Up, Page Up
|
||||
prevPage();
|
||||
else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
|
||||
else if(keyCode == 205 || keyCode == 208 || keyCode == 209) // Right, Down Page Down
|
||||
nextPage();
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class GuiLexiconHistory extends GuiLexiconIndex {
|
||||
|
||||
public static List<LexiconEntry> history = new ArrayList();
|
||||
public static List<LexiconEntry> history = new ArrayList<>();
|
||||
|
||||
public GuiLexiconHistory() {
|
||||
super(null);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
LexiconEntry currentEntry;
|
||||
float infoTime;
|
||||
|
||||
List<LexiconEntry> entriesToDisplay = new ArrayList();
|
||||
List<LexiconEntry> entriesToDisplay = new ArrayList<>();
|
||||
|
||||
public GuiLexiconIndex() {
|
||||
parent = new GuiLexicon();
|
||||
@@ -177,8 +177,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
if(!searchField.getText().isEmpty()) {
|
||||
drawBookmark(left + 138, top + guiHeight - 24, " " + searchField.getText(), false);
|
||||
@@ -209,8 +209,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
infoTime = Math.max(0, infoTime - timeDelta);
|
||||
|
||||
if(currentButton != null && infoTime == 0) {
|
||||
int x = par1 + 10;
|
||||
int y = par2;
|
||||
int x = mouseX + 10;
|
||||
int y = mouseY;
|
||||
|
||||
x = currentButton.xPosition - 20;
|
||||
y = currentButton.yPosition;
|
||||
@@ -293,13 +293,13 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
handleBookmark(button);
|
||||
else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
else
|
||||
switch(par1GuiButton.id) {
|
||||
switch(button.id) {
|
||||
case 12 :
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
@@ -317,10 +317,10 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
ClientTickHandler.notifyPageChange();
|
||||
break;
|
||||
default :
|
||||
if(par1GuiButton instanceof GuiButtonInvisible && ((GuiButtonInvisible) par1GuiButton).dog)
|
||||
((GuiButtonInvisible) par1GuiButton).click();
|
||||
if(button instanceof GuiButtonInvisible && ((GuiButtonInvisible) button).dog)
|
||||
((GuiButtonInvisible) button).click();
|
||||
else {
|
||||
int index = par1GuiButton.id + page * 12;
|
||||
int index = button.id + page * 12;
|
||||
openEntry(index);
|
||||
}
|
||||
}
|
||||
@@ -364,12 +364,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
searchField.mouseClicked(par1, par2, par3);
|
||||
fx = par1;
|
||||
switch(par3) {
|
||||
searchField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
fx = mouseX;
|
||||
switch(mouseButton) {
|
||||
case 1:
|
||||
back();
|
||||
break;
|
||||
@@ -402,27 +402,27 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 203 || keyCode == 200 || keyCode == 201) // Left, Up, Page Up
|
||||
prevPage();
|
||||
else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
|
||||
else if(keyCode == 205 || keyCode == 208 || keyCode == 209) // Right, Down Page Down
|
||||
nextPage();
|
||||
else if(par2 == 14 && !notesEnabled && searchField.getText().isEmpty()) // Backspace
|
||||
else if(keyCode == 14 && !notesEnabled && searchField.getText().isEmpty()) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par2 == 28 && entriesToDisplay.size() == 1) // Enter
|
||||
} else if(keyCode == 28 && entriesToDisplay.size() == 1) // Enter
|
||||
openEntry(0);
|
||||
|
||||
if(!notesEnabled) {
|
||||
String search = searchField.getText();
|
||||
searchField.textboxKeyTyped(par1, par2);
|
||||
searchField.textboxKeyTyped(typedChar, keyCode);
|
||||
if(!searchField.getText().equalsIgnoreCase(search))
|
||||
updateAll();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
void back() {
|
||||
|
||||
@@ -29,20 +29,20 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 109 : 98, 191, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("botaniamisc.achievements"));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,24 +23,24 @@ import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
public class GuiButtonBack extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonBack(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 18, 9, "");
|
||||
public GuiButtonBack(int id, int xPos, int yPos) {
|
||||
super(id, xPos, yPos, 18, 9, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(enabled) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9);
|
||||
|
||||
List<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GuiButtonBackWithShift extends GuiButtonBack {
|
||||
|
||||
public GuiButtonBackWithShift(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3);
|
||||
public GuiButtonBackWithShift(int id, int xPos, int yPos) {
|
||||
super(id, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,18 +13,18 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonBookmark(int id, int xPos, int yPos, GuiLexicon gui, String text) {
|
||||
super(id, xPos, yPos, gui.bookmarkWidth(text) + 5, 11, text);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
gui.drawBookmark(xPosition, yPosition, displayString, false);
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
if(displayString.equals("+"))
|
||||
tooltip.add(StatCollector.translateToLocal("botaniamisc.clickToAdd"));
|
||||
else {
|
||||
@@ -35,7 +35,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,8 +72,8 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mx, int my) {
|
||||
boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
boolean inside = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
if(inside)
|
||||
ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
|
||||
else ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta);
|
||||
|
||||
@@ -34,30 +34,30 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, challenge.icon, xPosition, yPosition);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, challenge.icon, xPosition, yPosition);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if(challenge.complete) {
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 9, 0x004C00);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 8, 0x0BD20D);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 9, 0x004C00);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 8, 0x0BD20D);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal(challenge.unlocalizedName));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 1662 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user