mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-25 22:34:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ece891f797 | ||
|
|
b9d0143245 | ||
|
|
2bde67bc20 | ||
|
|
361d2932f6 | ||
|
|
27be10dfbf | ||
|
|
43fc39c99b | ||
|
|
6337536dc3 | ||
|
|
9b96560119 | ||
|
|
3ce1c877e3 | ||
|
|
3d150d95cb | ||
|
|
03e84e3d37 | ||
|
|
547833bedb | ||
|
|
61e0d4b7e7 | ||
|
|
6867ed50e6 | ||
|
|
e7a47c199b | ||
|
|
b2bc474382 | ||
|
|
eef6baea4b | ||
|
|
efd49701e1 | ||
|
|
a7f0d6be72 | ||
|
|
0ff38c2da9 | ||
|
|
307bb1714c | ||
|
|
7d8e6a0ea5 | ||
|
|
b6d2af2170 | ||
|
|
8309567076 | ||
|
|
23312198a6 | ||
|
|
fa5e2ae4ca | ||
|
|
a8a1547845 | ||
|
|
113e05b7e6 | ||
|
|
080785ad05 | ||
|
|
6c14ca0a1d | ||
|
|
ea38c4e1d6 | ||
|
|
50e8c97aa3 | ||
|
|
9a82239f2c | ||
|
|
8ed2be38eb | ||
|
|
582f59e73d | ||
|
|
464e44de85 | ||
|
|
392d2ace8a | ||
|
|
978938d450 | ||
|
|
7a2328c294 | ||
|
|
d2cd45e07b | ||
|
|
8a24900623 | ||
|
|
15a0034e03 | ||
|
|
7aae6dc31c | ||
|
|
875bc1990e | ||
|
|
74aefd22be | ||
|
|
72ff51d093 | ||
|
|
7d74a65ec0 | ||
|
|
0ac8908b37 | ||
|
|
2dd4349e54 | ||
|
|
f813104ec4 | ||
|
|
4fe9eb6ea5 | ||
|
|
c0814274ec | ||
|
|
23605fc22d | ||
|
|
8ee90a7338 | ||
|
|
9bd19b9254 | ||
|
|
df4c54ea8d | ||
|
|
e71edd50b0 | ||
|
|
1b7cee7c4e |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore spotlessApply reformat
|
||||||
|
464e44de8541a46833f50c3bd363d50e1677a685
|
||||||
+42
-20
@@ -1,22 +1,44 @@
|
|||||||
# Auto detect text files and perform LF normalization
|
* text eol=lf
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Custom for Visual Studio
|
*.[jJ][aA][rR] binary
|
||||||
*.cs diff=csharp
|
|
||||||
*.sln merge=union
|
|
||||||
*.csproj merge=union
|
|
||||||
*.vbproj merge=union
|
|
||||||
*.fsproj merge=union
|
|
||||||
*.dbproj merge=union
|
|
||||||
|
|
||||||
# Standard to msysgit
|
*.[pP][nN][gG] binary
|
||||||
*.doc diff=astextplain
|
*.[jJ][pP][gG] binary
|
||||||
*.DOC diff=astextplain
|
*.[jJ][pP][eE][gG] binary
|
||||||
*.docx diff=astextplain
|
*.[gG][iI][fF] binary
|
||||||
*.DOCX diff=astextplain
|
*.[tT][iI][fF] binary
|
||||||
*.dot diff=astextplain
|
*.[tT][iI][fF][fF] binary
|
||||||
*.DOT diff=astextplain
|
*.[iI][cC][oO] binary
|
||||||
*.pdf diff=astextplain
|
*.[sS][vV][gG] text
|
||||||
*.PDF diff=astextplain
|
*.[eE][pP][sS] binary
|
||||||
*.rtf diff=astextplain
|
*.[xX][cC][fF] binary
|
||||||
*.RTF diff=astextplain
|
|
||||||
|
*.[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
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# Simple workflow for deploying static content to GitHub Pages
|
|
||||||
name: Deploy static content to Pages
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Runs on pushes targeting the default branch
|
|
||||||
push:
|
|
||||||
branches: ["gh-pages"]
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
# Allow one concurrent deployment
|
|
||||||
concurrency:
|
|
||||||
group: "pages"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Single deploy job since we're just deploying
|
|
||||||
deploy:
|
|
||||||
environment:
|
|
||||||
name: github-pages
|
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup Pages
|
|
||||||
uses: actions/configure-pages@v2
|
|
||||||
- name: Generate Index
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
find . -name javadoc -type d -print > index.txt
|
|
||||||
echo feature/doc >> index.txt
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-pages-artifact@v1
|
|
||||||
with:
|
|
||||||
# Upload entire repository
|
|
||||||
path: '.'
|
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1
|
|
||||||
@@ -7,6 +7,7 @@ on:
|
|||||||
- feature/doc
|
- feature/doc
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
|
delete:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -14,19 +15,53 @@ permissions:
|
|||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
javadoc:
|
prune:
|
||||||
|
if: github.event_name == 'delete'
|
||||||
concurrency: javadoc-publish
|
concurrency: javadoc-publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
result_hash: ${{ steps.deploy.outputs.hash }}
|
result_hash: ${{ steps.deploy.outputs.hash }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: gh-pages
|
||||||
|
|
||||||
|
- name: Deploy 🚀
|
||||||
|
id: deploy
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if git rm -r $TARGET_FOLDER ; then
|
||||||
|
echo Nothing to clean up
|
||||||
|
fi
|
||||||
|
|
||||||
|
find . -name javadoc -type d -print | sed 's#^\./\(.*\)/javadoc$#\1#' | sort --version-sort --reverse > index.txt
|
||||||
|
git add index.txt
|
||||||
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
|
git config user.email "${GITHUB_ACTOR_ID}-${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
|
git commit -m "Clean up javadoc after ref $TARGET_FOLDER is deleted"
|
||||||
|
git push
|
||||||
|
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
env:
|
||||||
|
TARGET_FOLDER: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
javadoc:
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
concurrency: javadoc-publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
result_hash: ${{ steps.deploy.outputs.hash }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 8
|
java-version: |
|
||||||
|
8
|
||||||
|
11
|
||||||
|
17
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
@@ -51,14 +86,12 @@ jobs:
|
|||||||
echo Nothing to deploy
|
echo Nothing to deploy
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
find . -name javadoc -type d -print | sed 's#^\./\(.*\)/javadoc$#\1#' > index.txt
|
find . -name javadoc -type d -print | sed 's#^\./\(.*\)/javadoc$#\1#' | sort --version-sort --reverse > index.txt
|
||||||
git add index.txt
|
git add index.txt
|
||||||
git config user.name "${GITHUB_ACTOR}"
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
git config user.email "${GITHUB_ACTOR_ID}-${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
git commit -m "Deploy javadoc from ref $TARGET_FOLDER"
|
git commit -m "Deploy javadoc from ref $TARGET_FOLDER"
|
||||||
git push
|
git push
|
||||||
echo "::set-output name=hash::$(git rev-parse HEAD)"
|
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
env:
|
env:
|
||||||
TARGET_FOLDER: ${{ github.ref_name }}
|
TARGET_FOLDER: ${{ github.ref_name }}
|
||||||
COMMIT_AUTHOR: ${{ github.pusher.name }}
|
|
||||||
COMMIT_EMAIL: ${{ github.pusher.email }}
|
|
||||||
+165
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
@@ -32,3 +32,5 @@ The project is developed using IDEA. Please manually configure the build to not
|
|||||||
Due to me adding in ItemStackMap, which was derived from code from CodeChicken's LGPL mod NEI. This mod is effectively considered
|
Due to me adding in ItemStackMap, which was derived from code from CodeChicken's LGPL mod NEI. This mod is effectively considered
|
||||||
licensed under LGPL in its entirety since commit ebef584b8c518f8202cfe0984fb28a6d23e52b3d or any squash commit containing it, e.g.
|
licensed under LGPL in its entirety since commit ebef584b8c518f8202cfe0984fb28a6d23e52b3d or any squash commit containing it, e.g.
|
||||||
609e50428ee4e293f65f67f554a70b9fcfae97c4.
|
609e50428ee4e293f65f67f554a70b9fcfae97c4.
|
||||||
|
|
||||||
|
Note while the LICENSE.txt is added by a much later commit, all code on previous commits are covered by this as well.
|
||||||
+20
-2
@@ -1,4 +1,10 @@
|
|||||||
javadoc {
|
javadoc {
|
||||||
|
javadocTool = javaToolchains.javadocToolFor {
|
||||||
|
// Last version with frames, but it also has search
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
vendor = JvmVendorSpec.ADOPTIUM
|
||||||
|
}
|
||||||
|
|
||||||
inputs.file "src/main/javadoc/overview.html"
|
inputs.file "src/main/javadoc/overview.html"
|
||||||
|
|
||||||
include "com/gtnewhorizon/structurelib/alignment/**"
|
include "com/gtnewhorizon/structurelib/alignment/**"
|
||||||
@@ -6,19 +12,31 @@ javadoc {
|
|||||||
include "com/gtnewhorizon/structurelib/structure/**"
|
include "com/gtnewhorizon/structurelib/structure/**"
|
||||||
include "com/gtnewhorizon/structurelib/util/**"
|
include "com/gtnewhorizon/structurelib/util/**"
|
||||||
include "com/gtnewhorizon/structurelib/StructureLibAPI.java"
|
include "com/gtnewhorizon/structurelib/StructureLibAPI.java"
|
||||||
|
include "com/gtnewhorizon/structurelib/StructureEvent.java"
|
||||||
|
|
||||||
|
classpath += sourceSets.patchedMc.output
|
||||||
|
|
||||||
options {
|
options {
|
||||||
overview "src/main/javadoc/overview.html"
|
overview "src/main/javadoc/overview.html"
|
||||||
links 'https://docs.oracle.com/javase/8/docs/api/'
|
links 'https://docs.oracle.com/javase/8/docs/api/'
|
||||||
links 'https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.7.10-10.13.4.1614/'
|
links 'https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.7.10-10.13.4.1614/'
|
||||||
|
addBooleanOption("-frames", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
tasks.register('javadocJar', Jar) {
|
||||||
classifier = 'javadoc'
|
dependsOn javadoc
|
||||||
|
archiveClassifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-939
@@ -1,942 +1,5 @@
|
|||||||
//version: 1659977784
|
//version: 1707058017
|
||||||
/*
|
|
||||||
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 org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
||||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
||||||
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Paths
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipInputStream
|
|
||||||
import java.util.zip.ZipOutputStream
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
|
|
||||||
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.7'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'com.gtnewhorizons.gtnhconvention'
|
||||||
id 'idea'
|
|
||||||
id 'eclipse'
|
|
||||||
id 'scala'
|
|
||||||
id 'maven-publish'
|
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
|
||||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
|
||||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
|
||||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
|
||||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
|
||||||
id 'com.palantir.git-version' version '0.13.0' apply false
|
|
||||||
id 'de.undercouch.download' version '5.0.1'
|
|
||||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
|
||||||
id 'com.diffplug.spotless' version '6.7.2' apply false
|
|
||||||
}
|
|
||||||
verifySettingsGradle()
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation 'com.diffplug:blowdryer:1.6.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'com.diffplug.blowdryer'
|
|
||||||
|
|
||||||
if (project.file('.git/HEAD').isFile()) {
|
|
||||||
apply plugin: 'com.palantir.git-version'
|
|
||||||
}
|
|
||||||
|
|
||||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
|
||||||
|
|
||||||
apply plugin: 'forge'
|
|
||||||
|
|
||||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion.set(projectJavaVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
inheritOutputDirs = true
|
|
||||||
downloadJavadoc = true
|
|
||||||
downloadSources = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
|
|
||||||
|
|
||||||
if (!disableSpotless) {
|
|
||||||
apply plugin: 'com.diffplug.spotless'
|
|
||||||
apply from: Blowdryer.file('spotless.gradle')
|
|
||||||
}
|
|
||||||
|
|
||||||
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.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
|
||||||
boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
|
||||||
boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false
|
|
||||||
String channel = project.hasProperty('channel') ? project.channel : 'stable'
|
|
||||||
String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12'
|
|
||||||
String javaSourceDir = "src/main/java/"
|
|
||||||
String scalaSourceDir = "src/main/scala/"
|
|
||||||
String kotlinSourceDir = "src/main/kotlin/"
|
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(apiPackage) {
|
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
|
||||||
if(!getFile(targetFile).exists()) {
|
|
||||||
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("\\.", "/")
|
|
||||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
|
||||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
|
||||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
|
||||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
try {
|
|
||||||
'git config core.fileMode false'.execute()
|
|
||||||
}
|
|
||||||
catch (Exception ignored) {
|
|
||||||
out.style(Style.Failure).println("git isn't installed at all")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pulls version first from the VERSION env and then git tag
|
|
||||||
String identifiedVersion
|
|
||||||
String versionOverride = System.getenv("VERSION") ?: null
|
|
||||||
try {
|
|
||||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
|
||||||
}
|
|
||||||
catch (Exception ignored) {
|
|
||||||
out.style(Style.Failure).text(
|
|
||||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
|
||||||
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
|
||||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
|
||||||
)
|
|
||||||
versionOverride = 'NO-GIT-TAG-SET'
|
|
||||||
identifiedVersion = versionOverride
|
|
||||||
}
|
|
||||||
version = minecraftVersion + '-' + identifiedVersion
|
|
||||||
ext {
|
|
||||||
modVersion = identifiedVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
if(identifiedVersion == versionOverride) {
|
|
||||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
|
||||||
}
|
|
||||||
|
|
||||||
group = modGroup
|
|
||||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
|
||||||
archivesBaseName = customArchiveBaseName
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
archivesBaseName = modId
|
|
||||||
}
|
|
||||||
|
|
||||||
def arguments = []
|
|
||||||
def jvmArguments = []
|
|
||||||
|
|
||||||
if (usesMixins.toBoolean() || forceEnableMixins) {
|
|
||||||
arguments += [
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
if (usesMixinDebug.toBoolean()) {
|
|
||||||
jvmArguments += [
|
|
||||||
"-Dmixin.debug.countInjections=true",
|
|
||||||
"-Dmixin.debug.verbose=true",
|
|
||||||
"-Dmixin.debug.export=true"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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, modVersion
|
|
||||||
}
|
|
||||||
if(gradleTokenGroupName) {
|
|
||||||
replace gradleTokenGroupName, modGroup
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clientIntellijRun {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
|
|
||||||
if(developmentEnvironmentUserName) {
|
|
||||||
args("--username", developmentEnvironmentUserName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
serverIntellijRun {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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() || forceEnableMixins) {
|
|
||||||
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')
|
|
||||||
}
|
|
||||||
if(usesMixins.toBoolean() || forceEnableMixins) {
|
|
||||||
// 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()) {
|
|
||||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
|
||||||
if (!mixinConfigFile.exists()) {
|
|
||||||
mixinConfigFile.text = """{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.7.11",
|
|
||||||
"package": "${modGroup}.${mixinsPackage}",
|
|
||||||
"plugin": "${modGroup}.${mixinPlugin}",
|
|
||||||
"refmap": "${mixingConfigRefMap}",
|
|
||||||
"target": "@env(DEFAULT)",
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixins": [],
|
|
||||||
"client": [],
|
|
||||||
"server": []
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
if(developmentEnvironmentUserName) {
|
|
||||||
arguments += [
|
|
||||||
"--username",
|
|
||||||
developmentEnvironmentUserName
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
runServer {
|
|
||||||
args(arguments)
|
|
||||||
jvmArgs(jvmArguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
exclude("spotless.gradle")
|
|
||||||
|
|
||||||
// replace stuff in mcmod.info, nothing else
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
|
|
||||||
// replace modVersion and minecraftVersion
|
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
|
||||||
"modVersion": modVersion,
|
|
||||||
"modId": modId,
|
|
||||||
"modName": modName
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy everything else that's not the mcmod.info
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
exclude 'spotless.gradle'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getManifestAttributes() {
|
|
||||||
def manifestAttributes = [:]
|
|
||||||
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (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()
|
|
||||||
]
|
|
||||||
}
|
|
||||||
return manifestAttributes
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
from (sourceSets.main.allSource)
|
|
||||||
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.allSource) {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
|
|
||||||
// and isn't strictly needed with the POM so just disable it.
|
|
||||||
tasks.withType(GenerateModuleMetadata) {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// workaround variable hiding in pom processing
|
|
||||||
def projectConfigs = project.configurations
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
maven(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
|
||||||
artifact source: shadowJar, classifier: ""
|
|
||||||
}
|
|
||||||
if(!noPublishedSources) {
|
|
||||||
artifact source: sourcesJar, classifier: "sources"
|
|
||||||
}
|
|
||||||
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
|
|
||||||
|
|
||||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
|
||||||
pom.withXml {
|
|
||||||
def badArtifacts = [:].withDefault {[] as Set<String>}
|
|
||||||
for (configuration in [
|
|
||||||
projectConfigs.minecraft,
|
|
||||||
projectConfigs.minecraftDeps
|
|
||||||
]) {
|
|
||||||
for (dependency in configuration.allDependencies) {
|
|
||||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// example for specifying extra stuff to ignore
|
|
||||||
// badArtifacts["org.example.group"] += "artifactName"
|
|
||||||
|
|
||||||
Node pomNode = asNode()
|
|
||||||
pomNode.dependencies.'*'.findAll() {
|
|
||||||
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
|
|
||||||
}.each() {
|
|
||||||
it.parent().remove(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (!project.getGradle().startParameter.isOffline() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
|
||||||
if (autoUpdateBuildScript.toBoolean()) {
|
|
||||||
performBuildScriptUpdate(projectDir.toString())
|
|
||||||
} else {
|
|
||||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static URL availableBuildScriptUrl() {
|
|
||||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
|
||||||
}
|
|
||||||
static URL exampleSettingsGradleUrl() {
|
|
||||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def verifySettingsGradle() {
|
|
||||||
def settingsFile = getFile("settings.gradle")
|
|
||||||
if (!settingsFile.exists()) {
|
|
||||||
println("Downloading default settings.gradle")
|
|
||||||
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
|
||||||
throw new GradleException("Settings.gradle has been updated, please re-run task.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean performBuildScriptUpdate(String projectDir) {
|
|
||||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
|
||||||
def buildscriptFile = getFile("build.gradle")
|
|
||||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
|
||||||
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
|
||||||
verifySettingsGradle()
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameter Deobfuscation
|
|
||||||
|
|
||||||
task deobfParams {
|
|
||||||
doLast {
|
|
||||||
|
|
||||||
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion"
|
|
||||||
String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
|
||||||
String paramsCSV = "$mcpDir/params.csv"
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
|
|
||||||
dest mcpZIP
|
|
||||||
overwrite false
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!file(paramsCSV).exists()) {
|
|
||||||
println("Extracting MCP archive ...")
|
|
||||||
unzip(mcpZIP, mcpDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
println("Parsing params.csv ...")
|
|
||||||
Map<String, String> params = new HashMap<>()
|
|
||||||
Files.lines(Paths.get(paramsCSV)).forEach{line ->
|
|
||||||
String[] cells = line.split(",")
|
|
||||||
if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
|
|
||||||
params.put(cells[0], cells[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
|
|
||||||
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int replaceParams(File file, Map<String, String> params) {
|
|
||||||
int fileCount = 0
|
|
||||||
|
|
||||||
if(file.isDirectory()) {
|
|
||||||
for(File f : file.listFiles()) {
|
|
||||||
fileCount += replaceParams(f, params)
|
|
||||||
}
|
|
||||||
return fileCount
|
|
||||||
}
|
|
||||||
println("Visiting ${file.getName()} ...")
|
|
||||||
try {
|
|
||||||
String content = new String(Files.readAllBytes(file.toPath()))
|
|
||||||
int hash = content.hashCode()
|
|
||||||
params.forEach{key, value ->
|
|
||||||
content = content.replaceAll(key, value)
|
|
||||||
}
|
|
||||||
if(hash != content.hashCode()) {
|
|
||||||
Files.write(file.toPath(), content.getBytes("UTF-8"))
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
|
|
||||||
static unzip(String zipFileName, String outputDir) {
|
|
||||||
byte[] buffer = new byte[16384]
|
|
||||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
|
|
||||||
ZipEntry zipEntry = zis.getNextEntry()
|
|
||||||
while (zipEntry != null) {
|
|
||||||
File newFile = new File(outputDir + File.separator, zipEntry.name)
|
|
||||||
if (zipEntry.isDirectory()) {
|
|
||||||
if (!newFile.isDirectory() && !newFile.mkdirs()) {
|
|
||||||
throw new IOException("Failed to create directory $newFile")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// fix for Windows-created archives
|
|
||||||
File parent = newFile.parentFile
|
|
||||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
|
||||||
throw new IOException("Failed to create directory $parent")
|
|
||||||
}
|
|
||||||
// write file content
|
|
||||||
FileOutputStream fos = new FileOutputStream(newFile)
|
|
||||||
int len = 0
|
|
||||||
while ((len = zis.read(buffer)) > 0) {
|
|
||||||
fos.write(buffer, 0, len)
|
|
||||||
}
|
|
||||||
fos.close()
|
|
||||||
}
|
|
||||||
zipEntry = zis.getNextEntry()
|
|
||||||
}
|
|
||||||
zis.closeEntry()
|
|
||||||
zis.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(deobfParams) {
|
|
||||||
group = 'forgegradle'
|
|
||||||
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dependency Deobfuscation
|
|
||||||
|
|
||||||
def deobf(String sourceURL) {
|
|
||||||
try {
|
|
||||||
URL url = new URL(sourceURL)
|
|
||||||
String fileName = url.getFile()
|
|
||||||
|
|
||||||
//get rid of directories:
|
|
||||||
int lastSlash = fileName.lastIndexOf("/")
|
|
||||||
if(lastSlash > 0) {
|
|
||||||
fileName = fileName.substring(lastSlash + 1)
|
|
||||||
}
|
|
||||||
//get rid of extension:
|
|
||||||
if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
|
|
||||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
|
||||||
}
|
|
||||||
|
|
||||||
String hostName = url.getHost()
|
|
||||||
if(hostName.startsWith("www.")) {
|
|
||||||
hostName = hostName.substring(4)
|
|
||||||
}
|
|
||||||
List parts = Arrays.asList(hostName.split("\\."))
|
|
||||||
Collections.reverse(parts)
|
|
||||||
hostName = String.join(".", parts)
|
|
||||||
|
|
||||||
return deobf(sourceURL, "$hostName/$fileName")
|
|
||||||
} catch(Exception e) {
|
|
||||||
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
|
||||||
def deobf(String sourceURL, String rawFileName) {
|
|
||||||
String bon2Version = "2.5.1"
|
|
||||||
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
|
|
||||||
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
|
|
||||||
String bon2Dir = "$cacheDir/forge_gradle/deobf"
|
|
||||||
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
|
|
||||||
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
|
|
||||||
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
|
|
||||||
|
|
||||||
if(file(deobfFile).exists()) {
|
|
||||||
return files(deobfFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
String mappingsVer
|
|
||||||
String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
|
|
||||||
if(remoteMappings) {
|
|
||||||
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
|
|
||||||
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
|
|
||||||
|
|
||||||
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
|
|
||||||
|
|
||||||
mappingsVer = "snapshot_$id"
|
|
||||||
} else {
|
|
||||||
mappingsVer = "${channel}_$mappingsVersion"
|
|
||||||
}
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
|
|
||||||
dest bon2File
|
|
||||||
quiet true
|
|
||||||
overwrite false
|
|
||||||
}
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src sourceURL
|
|
||||||
dest obfFile
|
|
||||||
quiet true
|
|
||||||
overwrite false
|
|
||||||
}
|
|
||||||
|
|
||||||
exec {
|
|
||||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
|
||||||
workingDir bon2Dir
|
|
||||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
|
||||||
}
|
|
||||||
|
|
||||||
return files(deobfFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
def zipMappings(String zipPath, String url, String bon2Dir) {
|
|
||||||
File zipFile = new File(zipPath)
|
|
||||||
if(zipFile.exists()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
String fieldsCache = "$bon2Dir/data/fields.csv"
|
|
||||||
String methodsCache = "$bon2Dir/data/methods.csv"
|
|
||||||
|
|
||||||
download.run {
|
|
||||||
src "${url}fields.csv"
|
|
||||||
dest fieldsCache
|
|
||||||
quiet true
|
|
||||||
}
|
|
||||||
download.run {
|
|
||||||
src "${url}methods.csv"
|
|
||||||
dest methodsCache
|
|
||||||
quiet true
|
|
||||||
}
|
|
||||||
|
|
||||||
zipFile.getParentFile().mkdirs()
|
|
||||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
|
|
||||||
|
|
||||||
zos.putNextEntry(new ZipEntry("fields.csv"))
|
|
||||||
Files.copy(Paths.get(fieldsCache), zos)
|
|
||||||
zos.closeEntry()
|
|
||||||
|
|
||||||
zos.putNextEntry(new ZipEntry("methods.csv"))
|
|
||||||
Files.copy(Paths.get(methodsCache), zos)
|
|
||||||
zos.closeEntry()
|
|
||||||
|
|
||||||
zos.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper methods
|
|
||||||
|
|
||||||
def checkPropertyExists(String propertyName) {
|
|
||||||
if (!project.hasProperty(propertyName)) {
|
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("com.github.GTNewHorizons:GTNHLib:0.0.1:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.5.22:dev")
|
||||||
runtime("com.github.GTNewHorizons:NotEnoughItems:2.2.20-GTNH:dev")
|
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.51-GTNH:dev")
|
||||||
|
|
||||||
|
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
||||||
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
}
|
}
|
||||||
+170
-27
@@ -1,60 +1,203 @@
|
|||||||
|
# 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 = StructureLib
|
modName = StructureLib
|
||||||
|
|
||||||
# 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 = structurelib
|
modId = structurelib
|
||||||
|
|
||||||
|
# Root package of the mod, used to find various classes in other properties,
|
||||||
|
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||||
modGroup = com.gtnewhorizon.structurelib
|
modGroup = com.gtnewhorizon.structurelib
|
||||||
|
|
||||||
# WHY is there no version field?
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
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
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
# Version of Minecraft to target
|
||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
|
# Version of Minecraft Forge to target
|
||||||
forgeVersion = 10.13.4.1614
|
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
|
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
channel = stable
|
||||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
|
||||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
# Specify an MCP 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"
|
developmentEnvironmentUserName = "Developer"
|
||||||
|
|
||||||
# Define a source file of your project with:
|
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
enableModernJavaSyntax = true
|
||||||
# version in @Mod([...], version = VERSION, [...])
|
|
||||||
# Leave these properties empty to skip individual token replacements
|
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||||
replaceGradleTokenInFile = StructureLib.java
|
# 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 = com.gtnewhorizon.structurelib.Tags
|
||||||
|
|
||||||
|
# Name of the token containing the project's current version to generate/replace.
|
||||||
|
gradleTokenVersion = VERSION
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod ID replacement token.
|
||||||
gradleTokenModId =
|
gradleTokenModId =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod name replacement token.
|
||||||
gradleTokenModName =
|
gradleTokenModName =
|
||||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
gradleTokenGroupName =
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
# [DEPRECATED]
|
||||||
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
|
# version in @Mod([...], version = VERSION, [...]).
|
||||||
|
# Leave these properties empty to skip individual token replacements.
|
||||||
|
replaceGradleTokenInFile =
|
||||||
|
|
||||||
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
# leave this property empty.
|
# 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 =
|
apiPackage =
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
# Example value: mymodid_at.cfg
|
# There can be multiple files in a space-separated list.
|
||||||
|
# Example value: mymodid_at.cfg nei_at.cfg
|
||||||
accessTransformersFile =
|
accessTransformersFile =
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = true
|
||||||
|
|
||||||
|
# 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.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
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. You may only place Mixins in this package or the build will fail!
|
||||||
mixinsPackage =
|
mixinsPackage = mixins
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatability only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass = core.StructureLibCore
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# 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!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
containsMixinsAndOrCoreModOnly = false
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
# responsibility check the licence and request permission for distribution, if required.
|
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
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
|
# 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
|
modrinthRelations =
|
||||||
|
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
#
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
curseForgeRelations =
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||||
|
# projects. New projects should not use this parameter.
|
||||||
|
# customArchiveBaseName =
|
||||||
|
|
||||||
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
|
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||||
|
# The check is ONLY performed if the version is a git tag.
|
||||||
|
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||||
|
# versionPattern =
|
||||||
|
|
||||||
|
# Uncomment to prevent the source code from being published.
|
||||||
|
# noPublishedSources = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Spotless checks.
|
||||||
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
|
# disableSpotless = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||||
|
# disableCheckstyle = true
|
||||||
|
|
||||||
|
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||||
|
# (force use delegated build).
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||||
|
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||||
|
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||||
|
# ideaOverrideBuildType = idea
|
||||||
|
|
||||||
|
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,80 +15,116 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -97,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --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
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# 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
|
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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# 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" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+27
-33
@@ -13,8 +13,10 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,10 +27,14 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -51,48 +57,36 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
// Add any additional repositiroes for your dependencies here
|
// Add any additional repositiroes for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
name = "GTNH"
|
|
||||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+19
-6
@@ -1,10 +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 {
|
plugins {
|
||||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.diffplug.blowdryerSetup'
|
|
||||||
|
|
||||||
blowdryerSetup {
|
|
||||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4')
|
|
||||||
//devLocal '.' // Use this when testing config updates locally
|
|
||||||
}
|
|
||||||
@@ -2,22 +2,24 @@ package com.gtnewhorizon.structurelib;
|
|||||||
|
|
||||||
import static com.gtnewhorizon.structurelib.StructureLib.RANDOM;
|
import static com.gtnewhorizon.structurelib.StructureLib.RANDOM;
|
||||||
|
|
||||||
import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX;
|
import java.lang.ref.WeakReference;
|
||||||
import com.gtnewhorizon.structurelib.net.SetChannelDataMessage;
|
import java.util.ArrayList;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import java.util.Comparator;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import java.util.HashMap;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import java.util.LinkedList;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
import java.util.List;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
import java.util.Map;
|
||||||
import java.util.*;
|
import java.util.UUID;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
import net.minecraft.client.gui.GuiNewChat;
|
import net.minecraft.client.gui.GuiNewChat;
|
||||||
import net.minecraft.client.particle.EntityFX;
|
import net.minecraft.client.particle.EntityFX;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.culling.Frustrum;
|
import net.minecraft.client.renderer.culling.Frustrum;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
@@ -30,20 +32,38 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX;
|
||||||
|
import com.gtnewhorizon.structurelib.net.RegistryOrderSyncMessage;
|
||||||
|
import com.gtnewhorizon.structurelib.net.SetChannelDataMessage;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
|
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.common.network.FMLNetworkEvent;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy {
|
public class ClientProxy extends CommonProxy {
|
||||||
|
|
||||||
private static final short[] RGBA_NO_TINT = {255, 255, 255, 255};
|
private static final short[] RGBA_NO_TINT = { 255, 255, 255, 255 };
|
||||||
private static final short[] RGBA_RED_TINT = {255, 128, 128, 0};
|
private static final short[] RGBA_RED_TINT = { 255, 128, 128, 0 };
|
||||||
private static final Map<HintParticleInfo, HintGroup> allHints = new HashMap<>();
|
private static final Map<HintParticleInfo, HintGroup> allHints = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* All batches of hints.
|
* All batches of hints.
|
||||||
*/
|
*/
|
||||||
private static final List<HintGroup> allGroups = new ArrayList<>();
|
private static final List<HintGroup> allGroups = new ArrayList<>();
|
||||||
|
|
||||||
public static int HOLOGRAM_LIFETIME = 200;
|
|
||||||
/**
|
/**
|
||||||
* Current batch of hints. Belongs to the same logical multiblock.
|
* Current batch of hints. Belongs to the same logical multiblock.
|
||||||
*/
|
*/
|
||||||
@@ -55,11 +75,10 @@ public class ClientProxy extends CommonProxy {
|
|||||||
*/
|
*/
|
||||||
private static final List<HintParticleInfo> allHintsForRender = new ArrayList<>(10000);
|
private static final List<HintParticleInfo> allHintsForRender = new ArrayList<>(10000);
|
||||||
/**
|
/**
|
||||||
* If the diff to current player position is too great sort the allHints.
|
* If the diff to current player position is too great sort the allHints. Initial value is very far off below y=0
|
||||||
* Initial value is very far off below y=0 but not huge enough to make a NaN.
|
* but not huge enough to make a NaN.
|
||||||
* <p>
|
* <p>
|
||||||
* We are using this supposedly immutable object as a mutable object here.
|
* We are using this supposedly immutable object as a mutable object here. So be aware.
|
||||||
* So be aware.
|
|
||||||
*/
|
*/
|
||||||
private static final Vec3 lastPlayerPos = Vec3.createVectorHelper(0, -1e30, 0);
|
private static final Vec3 lastPlayerPos = Vec3.createVectorHelper(0, -1e30, 0);
|
||||||
/**
|
/**
|
||||||
@@ -158,11 +177,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addThrottledChat(
|
public void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired,
|
||||||
Object throttleKey,
|
|
||||||
EntityPlayer player,
|
|
||||||
IChatComponent text,
|
|
||||||
short intervalRequired,
|
|
||||||
boolean forceUpdateLastSend) {
|
boolean forceUpdateLastSend) {
|
||||||
if (player instanceof EntityPlayerMP)
|
if (player instanceof EntityPlayerMP)
|
||||||
super.addThrottledChat(throttleKey, player, text, intervalRequired, forceUpdateLastSend);
|
super.addThrottledChat(throttleKey, player, text, intervalRequired, forceUpdateLastSend);
|
||||||
@@ -249,7 +264,49 @@ public class ClientProxy extends CommonProxy {
|
|||||||
((IStructureCompat) StructureLib.COMPAT).markTextureUsed(icon);
|
((IStructureCompat) StructureLib.COMPAT).markTextureUsed(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sendRegistryOrderToServer() {
|
||||||
|
if (FMLEventHandler.configSent) return;
|
||||||
|
FMLEventHandler.configSent = true;
|
||||||
|
for (String s : SortedRegistry.ALL_REGISTRIES.keySet()) {
|
||||||
|
Pair<List<String>, List<String>> registryOrder = ConfigurationHandler.INSTANCE.getRegistryOrder(s);
|
||||||
|
if (registryOrder == null || registryOrder.getKey().isEmpty() && registryOrder.getValue().isEmpty())
|
||||||
|
continue;
|
||||||
|
StructureLib.net
|
||||||
|
.sendToServer(new RegistryOrderSyncMessage(s, registryOrder.getKey(), registryOrder.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadComplete(FMLLoadCompleteEvent evt) {
|
||||||
|
super.loadComplete(evt);
|
||||||
|
for (Map.Entry<String, WeakReference<SortedRegistry<?>>> e : SortedRegistry.ALL_REGISTRIES.entrySet()) {
|
||||||
|
SortedRegistry<?> r = e.getValue().get();
|
||||||
|
if (r == null) continue;
|
||||||
|
Pair<List<String>, List<String>> p = ConfigurationHandler.INSTANCE.getRegistryOrder(e.getKey());
|
||||||
|
r.registerOrdering(getSPPlayerUUID(), p.getKey(), p.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getSPPlayerUUID() {
|
||||||
|
return EntityPlayer.func_146094_a(Minecraft.getMinecraft().getSession().func_148256_e());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayConfigGUI(String category) {
|
||||||
|
ConfigElement<Object> element = new ConfigElement<>(
|
||||||
|
ConfigurationHandler.INSTANCE.getConfig().getCategory(category));
|
||||||
|
GuiConfig guiConfig = new GuiConfig(
|
||||||
|
null,
|
||||||
|
element.getChildElements(),
|
||||||
|
StructureLibAPI.MOD_ID,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
I18n.format(element.getLanguageKey()));
|
||||||
|
Minecraft.getMinecraft().displayGuiScreen(guiConfig);
|
||||||
|
}
|
||||||
|
|
||||||
private static class HintGroup {
|
private static class HintGroup {
|
||||||
|
|
||||||
private final List<HintParticleInfo> hints = new LinkedList<>();
|
private final List<HintParticleInfo> hints = new LinkedList<>();
|
||||||
private int creationTime = -1;
|
private int creationTime = -1;
|
||||||
|
|
||||||
@@ -267,9 +324,10 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class HintParticleInfo {
|
private static class HintParticleInfo {
|
||||||
|
|
||||||
private final World w;
|
private final World w;
|
||||||
|
// these are the block coordinate for e.g. w.getBlock()
|
||||||
private final int x, y, z;
|
private final int x, y, z;
|
||||||
private final double X, Y, Z;
|
|
||||||
private final IIcon[] icons;
|
private final IIcon[] icons;
|
||||||
private short[] tint;
|
private short[] tint;
|
||||||
private boolean renderThrough;
|
private boolean renderThrough;
|
||||||
@@ -281,9 +339,6 @@ public class ClientProxy extends CommonProxy {
|
|||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
X = x + 0.25;
|
|
||||||
Y = y + 0.25;
|
|
||||||
Z = z + 0.25;
|
|
||||||
this.icons = icons;
|
this.icons = icons;
|
||||||
this.tint = tint;
|
this.tint = tint;
|
||||||
}
|
}
|
||||||
@@ -319,10 +374,11 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInFrustrum(Frustrum frustrum) {
|
public boolean isInFrustrum(Frustrum frustrum) {
|
||||||
return frustrum.isBoxInFrustum(x, y, z, X, Y, Z);
|
return frustrum.isBoxInFrustum(x + 0.25, y + 0.25, z + 0.25, x + 0.75, y + 0.75, z + 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Tessellator tes) {
|
public void draw(Tessellator tes, double eyeX, double eyeY, double eyeZ, int eyeXint, int eyeYint,
|
||||||
|
int eyeZint) {
|
||||||
double size = 0.5;
|
double size = 0.5;
|
||||||
|
|
||||||
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
|
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
|
||||||
@@ -334,52 +390,94 @@ public class ClientProxy extends CommonProxy {
|
|||||||
(int) (tint[2] * 1F),
|
(int) (tint[2] * 1F),
|
||||||
ConfigurationHandler.INSTANCE.getHintTransparency());
|
ConfigurationHandler.INSTANCE.getHintTransparency());
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
double X = (x - eyeXint) + 0.25;
|
||||||
if (icons[i] == null) continue;
|
double Y = (y - eyeYint) + 0.25;
|
||||||
|
double Z = (z - eyeZint) + 0.25;
|
||||||
|
double worldX = x + 0.25;
|
||||||
|
double worldY = y + 0.25;
|
||||||
|
double worldZ = z + 0.25;
|
||||||
|
|
||||||
markTextureUsed(icons[i]);
|
// this rendering code is independently written by glee8e on July 10th, 2023
|
||||||
|
// and is released as part of StructureLib under LGPL terms, just like everything else in this project
|
||||||
|
// cube is a very special model. its facings can be rendered correctly by viewer distance without using
|
||||||
|
// surface normals and view vector
|
||||||
|
// here we do a 2 pass render.
|
||||||
|
// first pass we draw obstructed faces (i.e. faces that are further away from player)
|
||||||
|
// second pass we draw unobstructed faces
|
||||||
|
for (int j = 0; j < 2; j++) {
|
||||||
|
boolean unobstructedPass = j == 1;
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (icons[i] == null) continue;
|
||||||
|
|
||||||
double u = icons[i].getMinU();
|
markTextureUsed(icons[i]);
|
||||||
double U = icons[i].getMaxU();
|
|
||||||
double v = icons[i].getMinV();
|
double u = icons[i].getMinU();
|
||||||
double V = icons[i].getMaxV();
|
double U = icons[i].getMaxU();
|
||||||
switch (i) { // {DOWN, UP, NORTH, SOUTH, WEST, EAST}
|
double v = icons[i].getMinV();
|
||||||
case 0:
|
double V = icons[i].getMaxV();
|
||||||
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
switch (i) { // {DOWN, UP, NORTH, SOUTH, WEST, EAST}
|
||||||
tes.addVertexWithUV(X, Y, Z, u, v);
|
case 0:
|
||||||
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
// all these ifs is in form if ((is face unobstructed) != (is in unobstructred pass))
|
||||||
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
if ((worldY >= eyeY) != unobstructedPass) continue;
|
||||||
break;
|
tes.setNormal(0, -1, 0);
|
||||||
case 1:
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
tes.addVertexWithUV(X, Y, Z, u, v);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, u, V);
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
break;
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
case 2:
|
break;
|
||||||
tes.addVertexWithUV(X, Y, Z, U, V);
|
case 1:
|
||||||
tes.addVertexWithUV(X, Y + size, Z, U, v);
|
if ((worldY + size <= eyeY) != unobstructedPass) continue;
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
tes.setNormal(0, 1, 0);
|
||||||
tes.addVertexWithUV(X + size, Y, Z, u, V);
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
break;
|
tes.addVertexWithUV(X, Y + size, Z + size, u, V);
|
||||||
case 3:
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, U, v);
|
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
break;
|
||||||
break;
|
case 2:
|
||||||
case 4:
|
if ((worldZ >= eyeZ) != unobstructedPass) continue;
|
||||||
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
tes.setNormal(0, 0, -1);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, U, v);
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
tes.addVertexWithUV(X, Y + size, Z, U, v);
|
||||||
tes.addVertexWithUV(X, Y, Z, u, V);
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
break;
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
case 5:
|
tes.addVertexWithUV(X + size, Y, Z, u, V);
|
||||||
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
break;
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
case 3:
|
||||||
tes.addVertexWithUV(X + size, Y, Z + size, u, V);
|
if ((worldZ + size <= eyeZ) != unobstructedPass) continue;
|
||||||
break;
|
tes.setNormal(0, 0, 1);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if ((worldX >= eyeX) != unobstructedPass) continue;
|
||||||
|
tes.setNormal(-1, 0, 0);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z + size, U, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y, Z, u, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if ((worldX + size <= eyeX) != unobstructedPass) continue;
|
||||||
|
tes.setNormal(1, 0, 0);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z + size, u, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,17 +487,40 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getSquareDistanceTo(Vec3 point) {
|
public double getSquareDistanceTo(Vec3 point) {
|
||||||
return point.squareDistanceTo(X, Y, Z);
|
return point.squareDistanceTo(x + 0.5, y + 0.5, z + 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FMLEventHandler {
|
public static class FMLEventHandler {
|
||||||
|
|
||||||
|
static boolean connected = false;
|
||||||
|
static boolean configSent = false;
|
||||||
|
|
||||||
private void resetPlayerLocation() {
|
private void resetPlayerLocation() {
|
||||||
lastPlayerPos.xCoord = Minecraft.getMinecraft().thePlayer.posX;
|
lastPlayerPos.xCoord = Minecraft.getMinecraft().thePlayer.posX;
|
||||||
lastPlayerPos.yCoord = Minecraft.getMinecraft().thePlayer.posY;
|
lastPlayerPos.yCoord = Minecraft.getMinecraft().thePlayer.posY;
|
||||||
lastPlayerPos.zCoord = Minecraft.getMinecraft().thePlayer.posZ;
|
lastPlayerPos.zCoord = Minecraft.getMinecraft().thePlayer.posZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onPlayerLogIn(FMLNetworkEvent.ClientConnectedToServerEvent e) {
|
||||||
|
connected = true;
|
||||||
|
configSent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onPlayerLogOut(FMLNetworkEvent.ClientDisconnectionFromServerEvent e) {
|
||||||
|
connected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
|
public void onConfigChange(ConfigChangedEvent.PostConfigChangedEvent e) {
|
||||||
|
if (connected && e.modID.equals(StructureLibAPI.MOD_ID)) {
|
||||||
|
configSent = false;
|
||||||
|
sendRegistryOrderToServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onClientTick(ClientTickEvent e) {
|
public void onClientTick(ClientTickEvent e) {
|
||||||
if (e.phase == Phase.END && Minecraft.getMinecraft().thePlayer != null) {
|
if (e.phase == Phase.END && Minecraft.getMinecraft().thePlayer != null) {
|
||||||
@@ -430,12 +551,11 @@ public class ClientProxy extends CommonProxy {
|
|||||||
for (HintGroup c : allGroups) allHintsForRender.addAll(c.getHints());
|
for (HintGroup c : allGroups) allHintsForRender.addAll(c.getHints());
|
||||||
sortRequired = true;
|
sortRequired = true;
|
||||||
}
|
}
|
||||||
if (renderThrough > 0 && (sortRequired || playerPos.squareDistanceTo(lastPlayerPos) > 1e-2)) {
|
if (sortRequired || playerPos.squareDistanceTo(lastPlayerPos) > 1e-2) {
|
||||||
// only sort if there is anything that need depth test disabled
|
|
||||||
// only redo sort if player moved some distance
|
// only redo sort if player moved some distance
|
||||||
// default is 0.1 block
|
// default is 0.1 block
|
||||||
// if there was a full rebuild, go sort it as well
|
// if there was a full rebuild, go sort it as well
|
||||||
allHintsForRender.sort(Comparator.comparingDouble(info -> info.getSquareDistanceTo(playerPos)));
|
allHintsForRender.sort(Comparator.comparingDouble(info -> -info.getSquareDistanceTo(playerPos)));
|
||||||
resetPlayerLocation();
|
resetPlayerLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,6 +563,14 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class ForgeEventHandler {
|
public static class ForgeEventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityJoinWorld(EntityJoinWorldEvent e) {
|
||||||
|
if (e.world.isRemote && e.entity instanceof EntityClientPlayerMP) {
|
||||||
|
sendRegistryOrderToServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onWorldLoad(WorldEvent.Load e) {
|
public void onWorldLoad(WorldEvent.Load e) {
|
||||||
if (e.world.isRemote) {
|
if (e.world.isRemote) {
|
||||||
@@ -475,35 +603,47 @@ public class ClientProxy extends CommonProxy {
|
|||||||
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * e.partialTicks;
|
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * e.partialTicks;
|
||||||
double d2 = entitylivingbase.lastTickPosZ
|
double d2 = entitylivingbase.lastTickPosZ
|
||||||
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * e.partialTicks;
|
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * e.partialTicks;
|
||||||
|
int i0 = (int) d0, i1 = (int) d1, i2 = (int) d2;
|
||||||
frustrum.setPosition(d0, d1, d2);
|
frustrum.setPosition(d0, d1, d2);
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT); // TODO figure out original states
|
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT); // TODO figure out original states
|
||||||
// we need the back facing rendered because the thing is transparent
|
// we need the back facing rendered because the thing is transparent
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
GL11.glEnable(GL11.GL_BLEND); // enable blend so it is transparent
|
GL11.glEnable(GL11.GL_BLEND); // enable blend so it is transparent
|
||||||
GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||||
// depth test begin as enabled
|
// depth test begin as enabled
|
||||||
boolean renderThrough = false;
|
boolean renderThrough = false;
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
GL11.glTranslated(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ);
|
GL11.glTranslated(-d0 + i0, -d1 + i1, -d2 + i2);
|
||||||
Tessellator tes = Tessellator.instance;
|
Tessellator tes = Tessellator.instance;
|
||||||
tes.startDrawingQuads();
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
for (int i = 0, allHintsForRenderSize = allHintsForRender.size(); i < allHintsForRenderSize; i++) {
|
for (int i = 0, allHintsForRenderSize = allHintsForRender.size(), cubeDrawn = 0; i
|
||||||
|
< allHintsForRenderSize; i++, cubeDrawn++) {
|
||||||
HintParticleInfo hint = allHintsForRender.get(i);
|
HintParticleInfo hint = allHintsForRender.get(i);
|
||||||
if (!hint.isInFrustrum(frustrum)) continue;
|
if (!hint.isInFrustrum(frustrum)) continue;
|
||||||
if (renderThrough != hint.renderThrough) {
|
if (renderThrough != hint.renderThrough) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
p.endStartSection("Draw");
|
p.endStartSection("Draw");
|
||||||
tes.draw();
|
tes.draw();
|
||||||
tes.startDrawingQuads();
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
cubeDrawn = 0;
|
||||||
p.endStartSection("Prepare");
|
p.endStartSection("Prepare");
|
||||||
}
|
}
|
||||||
if (hint.renderThrough) GL11.glDisable(GL11.GL_DEPTH_TEST);
|
if (hint.renderThrough) GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
else GL11.glEnable(GL11.GL_DEPTH_TEST);
|
else GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
renderThrough = hint.renderThrough;
|
renderThrough = hint.renderThrough;
|
||||||
}
|
}
|
||||||
hint.draw(tes);
|
// Minecraft Tessellator draw in batch of 4096. This plays nicely with quads, but for trigs
|
||||||
|
// it might occasionally end up with one half in first batch and the other half in later batch.
|
||||||
|
// so we manually flush the buffer here if that would happen.
|
||||||
|
// 6 faces per particle, 2 trig per face, 3 vertex per trig
|
||||||
|
if ((cubeDrawn + 1) >= 4096 / (6 * 2 * 3)) {
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
}
|
||||||
|
hint.draw(tes, d0, d1, d2, i0, i1, i2);
|
||||||
}
|
}
|
||||||
p.endStartSection("Draw");
|
p.endStartSection("Draw");
|
||||||
tes.draw();
|
tes.draw();
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.gtnewhorizon.structurelib;
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
import com.gtnewhorizon.structurelib.net.ErrorHintParticleMessage;
|
|
||||||
import com.gtnewhorizon.structurelib.net.UpdateHintParticleMessage;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
@@ -14,8 +12,23 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.structurelib.net.ErrorHintParticleMessage;
|
||||||
|
import com.gtnewhorizon.structurelib.net.UpdateHintParticleMessage;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
public class CommonProxy {
|
public class CommonProxy {
|
||||||
|
|
||||||
|
public CommonProxy() {
|
||||||
|
super();
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {}
|
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {}
|
||||||
|
|
||||||
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {}
|
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {}
|
||||||
@@ -66,13 +79,13 @@ public class CommonProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadComplete(FMLLoadCompleteEvent e) {
|
||||||
|
ConfigurationHandler.INSTANCE.loadRegistryOrder();
|
||||||
|
}
|
||||||
|
|
||||||
private final Map<EntityPlayerMP, Map<Object, Long>> throttleMap = new WeakHashMap<>();
|
private final Map<EntityPlayerMP, Map<Object, Long>> throttleMap = new WeakHashMap<>();
|
||||||
|
|
||||||
public void addThrottledChat(
|
public void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired,
|
||||||
Object throttleKey,
|
|
||||||
EntityPlayer player,
|
|
||||||
IChatComponent text,
|
|
||||||
short intervalRequired,
|
|
||||||
boolean forceUpdateLastSend) {
|
boolean forceUpdateLastSend) {
|
||||||
if (player instanceof EntityPlayerMP) {
|
if (player instanceof EntityPlayerMP) {
|
||||||
Map<Object, Long> submap = throttleMap.computeIfAbsent((EntityPlayerMP) player, p -> new HashMap<>());
|
Map<Object, Long> submap = throttleMap.computeIfAbsent((EntityPlayerMP) player, p -> new HashMap<>());
|
||||||
@@ -80,13 +93,8 @@ public class CommonProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void addThrottledChat(
|
protected static void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text,
|
||||||
Object throttleKey,
|
short intervalRequired, boolean forceUpdateLastSend, Map<Object, Long> submap) {
|
||||||
EntityPlayer player,
|
|
||||||
IChatComponent text,
|
|
||||||
short intervalRequired,
|
|
||||||
boolean forceUpdateLastSend,
|
|
||||||
Map<Object, Long> submap) {
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
Long old;
|
Long old;
|
||||||
if (forceUpdateLastSend) {
|
if (forceUpdateLastSend) {
|
||||||
@@ -99,4 +107,22 @@ public class CommonProxy {
|
|||||||
if (!forceUpdateLastSend) submap.put(throttleKey, now);
|
if (!forceUpdateLastSend) submap.put(throttleKey, now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayConfigGUI(String category) {}
|
||||||
|
|
||||||
|
public static class ForgeEventHandler {
|
||||||
|
|
||||||
|
private int ticksSinceLastPurge;
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onServerTickEnd(TickEvent.ServerTickEvent e) {
|
||||||
|
if (e.phase != TickEvent.Phase.END) return;
|
||||||
|
if (++ticksSinceLastPurge < 20 * 60 * 10) return;
|
||||||
|
ticksSinceLastPurge = 0;
|
||||||
|
MinecraftServer server = MinecraftServer.getServer();
|
||||||
|
// it's hard to tell why server could be null in a server tick handler, but who knows?
|
||||||
|
if (server == null) return;
|
||||||
|
SortedRegistry.cleanup(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,29 @@
|
|||||||
package com.gtnewhorizon.structurelib;
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraftforge.common.config.ConfigCategory;
|
import net.minecraftforge.common.config.ConfigCategory;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.common.config.Property;
|
import net.minecraftforge.common.config.Property;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||||
|
|
||||||
public enum ConfigurationHandler {
|
public enum ConfigurationHandler {
|
||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
@@ -19,6 +33,7 @@ public enum ConfigurationHandler {
|
|||||||
private int hintTransparency;
|
private int hintTransparency;
|
||||||
private int autoPlaceBudget;
|
private int autoPlaceBudget;
|
||||||
private int autoPlaceInterval;
|
private int autoPlaceInterval;
|
||||||
|
private Map<String, Pair<List<String>, List<String>>> registryOrders;
|
||||||
|
|
||||||
ConfigurationHandler() {
|
ConfigurationHandler() {
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
@@ -54,8 +69,8 @@ public enum ConfigurationHandler {
|
|||||||
"client.hologram",
|
"client.hologram",
|
||||||
true,
|
true,
|
||||||
"An attempt will be made to remove an existing hologram if it collides with a new hologram.");
|
"An attempt will be made to remove an existing hologram if it collides with a new hologram.");
|
||||||
hintLifespan =
|
hintLifespan = config
|
||||||
config.getInt("hintLifespan", "client.hologram", 400, 1, 20000, "Ticks before a hologram disappears.");
|
.getInt("hintLifespan", "client.hologram", 400, 1, 20000, "Ticks before a hologram disappears.");
|
||||||
hintTransparency = config.getInt(
|
hintTransparency = config.getInt(
|
||||||
"hintTransparency",
|
"hintTransparency",
|
||||||
"client.hologram",
|
"client.hologram",
|
||||||