mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-25 22:34:24 +00:00
Compare commits
157
Commits
1.0.3
...
1.4.33-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
365fc9eb6e | ||
|
|
e439f75125 | ||
|
|
afc90899f9 | ||
|
|
a09e6058a9 | ||
|
|
f4546ac4f8 | ||
|
|
15e9be364a | ||
|
|
e774dd5e10 | ||
|
|
e864b9b292 | ||
|
|
0866dbee98 | ||
|
|
208f7ffc41 | ||
|
|
4f1edf1319 | ||
|
|
88a6021546 | ||
|
|
a05267a566 | ||
|
|
dd3413dcaa | ||
|
|
26b88a5f27 | ||
|
|
87903fead7 | ||
|
|
1166c651d2 | ||
|
|
7f42cc1de8 | ||
|
|
34394ef8a5 | ||
|
|
ff3904ec1a | ||
|
|
c3671609d3 | ||
|
|
7c0d3f4bd6 | ||
|
|
cd4f3617be | ||
|
|
256bc60d35 | ||
|
|
70426ab7b3 | ||
|
|
0030c02e9a | ||
|
|
7382db1bbd | ||
|
|
b669cbecf1 | ||
|
|
6283931667 | ||
|
|
3b3bc4b9ad | ||
|
|
bef4fdd949 | ||
|
|
4a06c8f95b | ||
|
|
241bed1989 | ||
|
|
f5594c25db | ||
|
|
7cda901ae5 | ||
|
|
538459eab5 | ||
|
|
3a9ec8b6ac | ||
|
|
330a13271b | ||
|
|
bf5dd5566b | ||
|
|
b9d0143245 | ||
|
|
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 | ||
|
|
03f2c31191 | ||
|
|
9b318f68fb | ||
|
|
adc91bb1dd | ||
|
|
21198c4d39 | ||
|
|
e70ea765f8 | ||
|
|
56a083ce6f | ||
|
|
7389f349db | ||
|
|
5b6b51f80c | ||
|
|
1481b68133 | ||
|
|
ebf2d6f0e1 | ||
|
|
7e7064e006 | ||
|
|
ebcf62fd97 | ||
|
|
74dde96905 | ||
|
|
d73d2bffc2 | ||
|
|
94055bbd6a | ||
|
|
dc1b1fc4db | ||
|
|
fd38dfc31f | ||
|
|
cb82b73e78 | ||
|
|
91d4a8022e | ||
|
|
a12722c4b0 | ||
|
|
b2624a3d36 | ||
|
|
b34e901a93 | ||
|
|
e155c69b20 | ||
|
|
82622d1e15 | ||
|
|
a168702151 | ||
|
|
73f113ed9b | ||
|
|
c19ac860d4 | ||
|
|
d33cdd79c4 | ||
|
|
ed24f15033 | ||
|
|
15c34061bc | ||
|
|
728f25114b | ||
|
|
4a8c154855 | ||
|
|
f65010a547 | ||
|
|
609e50428e | ||
|
|
e8f5cd6489 | ||
|
|
8de7026a00 | ||
|
|
33d377cea7 | ||
|
|
da98b476b0 | ||
|
|
9dd145bc67 | ||
|
|
83b7c35ed1 | ||
|
|
bb0bebf3a2 | ||
|
|
a49ed1996b | ||
|
|
6d5d31f5ab | ||
|
|
3eafe426ba | ||
|
|
eea5227fe3 | ||
|
|
1f520cfd73 | ||
|
|
8357fdc826 | ||
|
|
27bb7b2ad9 | ||
|
|
b9af0ef491 | ||
|
|
7f19399ba3 | ||
|
|
4982bb780d | ||
|
|
a069612e04 | ||
|
|
ab09b791bd | ||
|
|
b086a65828 | ||
|
|
f1f6dae00f | ||
|
|
68c5436496 | ||
|
|
c4eb372cfb | ||
|
|
2446ad2db7 | ||
|
|
906961b6c8 | ||
|
|
393045d4f2 | ||
|
|
74baa66f52 | ||
|
|
24928454fd | ||
|
|
34ceda8ccc | ||
|
|
c78c61f45e |
No files matched your search
@@ -0,0 +1,19 @@
|
|||||||
|
# This is the universal Text Editor Configuration
|
||||||
|
# for all GTNewHorizons projects
|
||||||
|
# See: https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{bat,ini}]
|
||||||
|
end_of_line = crlf
|
||||||
|
|
||||||
|
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||||
|
indent_size = 2
|
||||||
@@ -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
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bashsupport disable=BP5006 # Global environment variables
|
||||||
|
RUNDIR="run" \
|
||||||
|
CRASH="crash-reports" \
|
||||||
|
SERVERLOG="server.log"
|
||||||
|
|
||||||
|
# enable nullglob to get 0 results when no match rather than the pattern
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
# store matches in array
|
||||||
|
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||||
|
|
||||||
|
# if array not empty there are crash_reports
|
||||||
|
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||||
|
# get the latest crash_report from array
|
||||||
|
latest_crash_report="${crash_reports[-1]}"
|
||||||
|
{
|
||||||
|
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||||
|
cat "$latest_crash_report"
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Fatal errors detected:\n'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||||
|
"$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server force stopped:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server did not finish startup:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'No crash reports detected'
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
name: Build and test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
push:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Optimize images
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches: [ master, main, release/** ]
|
||||||
|
paths:
|
||||||
|
- "**/*.png"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
optimize-images:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
name: Deploy Javadoc
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- feature/doc
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
delete:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prune:
|
||||||
|
if: github.event_name == 'delete'
|
||||||
|
concurrency: javadoc-publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
result_hash: ${{ steps.deploy.outputs.hash }}
|
||||||
|
steps:
|
||||||
|
- 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:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: |
|
||||||
|
8
|
||||||
|
11
|
||||||
|
17
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: Generate Javadoc
|
||||||
|
run: ./gradlew --no-daemon spotlessCheck javadoc
|
||||||
|
|
||||||
|
- name: Deploy 🚀
|
||||||
|
id: deploy
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mv build/docs $RUNNER_TEMP/docs_output
|
||||||
|
rm build -rf
|
||||||
|
git checkout gh-pages
|
||||||
|
mkdir -p $TARGET_FOLDER
|
||||||
|
rm -rf $TARGET_FOLDER
|
||||||
|
mv $RUNNER_TEMP/docs_output $TARGET_FOLDER -v
|
||||||
|
git add $TARGET_FOLDER
|
||||||
|
if git diff --cached --exit-code > /dev/null ; then
|
||||||
|
echo Nothing to deploy
|
||||||
|
exit 0
|
||||||
|
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 "Deploy javadoc from ref $TARGET_FOLDER"
|
||||||
|
git push
|
||||||
|
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
env:
|
||||||
|
TARGET_FOLDER: ${{ github.ref_name }}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
name: Release tagged build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ '*' ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-tags:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||||
|
secrets: inherit
|
||||||
+29
-19
@@ -1,20 +1,30 @@
|
|||||||
*.class
|
|
||||||
*.log
|
|
||||||
*.ctxt
|
|
||||||
.mtj.tmp/
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
hs_err_pid*
|
|
||||||
.gradle
|
.gradle
|
||||||
**/build/
|
.settings
|
||||||
!src/**/build/
|
/.idea/
|
||||||
gradle-app.setting
|
/run/
|
||||||
!gradle-wrapper.jar
|
/build/
|
||||||
.gradletasknamecache
|
/eclipse/
|
||||||
.idea/
|
.classpath
|
||||||
run/
|
.project
|
||||||
|
/bin/
|
||||||
|
/config/
|
||||||
|
/crash-reports/
|
||||||
|
/logs/
|
||||||
|
options.txt
|
||||||
|
/saves/
|
||||||
|
usernamecache.json
|
||||||
|
banned-ips.json
|
||||||
|
banned-players.json
|
||||||
|
eula.txt
|
||||||
|
ops.json
|
||||||
|
server.properties
|
||||||
|
servers.dat
|
||||||
|
usercache.json
|
||||||
|
whitelist.json
|
||||||
|
/out/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
src/main/resources/mixins.*.json
|
||||||
|
*.bat
|
||||||
|
layout.json
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Any Github changes require admin approval
|
||||||
|
/.github/** @GTNewHorizons/admin
|
||||||
|
|
||||||
+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.
|
||||||
@@ -21,9 +21,16 @@ Originally created by TecTech authors, taken with permission. It's under MIT lic
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
Replace `master-SNAPSHOT` with a commit hash or a tag name (if any) of your choice to prevent unexpected upstream changes.
|
Replace `master-SNAPSHOT` with a commit hash or a tag name (if any) of your choice to prevent unexpected upstream changes.
|
||||||
2. Add `required-after:structurelib;` to your `@Mod(dependencies = "..")` tring.
|
2. Add `required-after:structurelib;` to your `@Mod(dependencies = "..")` tring.
|
||||||
3. Add `structurelib` to your `mcmod.info`.
|
3. Add `structurelib` to your `mcmod.info`.
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
The project is developed using IDEA. Please manually configure the build to not delegate to gradle for textures to show up in dev.
|
The project is developed using IDEA. Please manually configure the build to not delegate to gradle for textures to show up in dev.
|
||||||
|
|
||||||
|
## Current license
|
||||||
|
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.
|
||||||
|
609e50428ee4e293f65f67f554a70b9fcfae97c4.
|
||||||
|
|
||||||
|
Note while the LICENSE.txt is added by a much later commit, all code on previous commits are covered by this as well.
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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"
|
||||||
|
|
||||||
|
include "com/gtnewhorizon/structurelib/alignment/**"
|
||||||
|
include "com/gtnewhorizon/structurelib/constructable/**"
|
||||||
|
include "com/gtnewhorizon/structurelib/structure/**"
|
||||||
|
include "com/gtnewhorizon/structurelib/util/**"
|
||||||
|
include "com/gtnewhorizon/structurelib/StructureLibAPI.java"
|
||||||
|
include "com/gtnewhorizon/structurelib/StructureEvent.java"
|
||||||
|
|
||||||
|
classpath += sourceSets.patchedMc.output
|
||||||
|
|
||||||
|
options {
|
||||||
|
overview "src/main/javadoc/overview.html"
|
||||||
|
links 'https://docs.oracle.com/javase/8/docs/api/'
|
||||||
|
links 'https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.7.10-10.13.4.1614/'
|
||||||
|
addBooleanOption("-frames", true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('javadocJar', Jar) {
|
||||||
|
dependsOn javadoc
|
||||||
|
archiveClassifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives javadocJar
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-64
@@ -1,65 +1,5 @@
|
|||||||
buildscript {
|
//version: 1707058017
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
plugins {
|
||||||
maven {
|
id 'com.gtnewhorizons.gtnhconvention'
|
||||||
name = "forge"
|
|
||||||
url = "https://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.1'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'forge'
|
|
||||||
|
|
||||||
version = modVersion
|
|
||||||
group= modGroup
|
|
||||||
archivesBaseName = modBaseName
|
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
version = project.forgeVersion
|
|
||||||
replaceIn "StructureLib.java"
|
|
||||||
replace '${version}', project.version
|
|
||||||
runDir = "run"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources
|
|
||||||
{
|
|
||||||
inputs.property "version", project.version
|
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
classifier = 'deobf'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives deobfJar
|
|
||||||
archives jar
|
|
||||||
}
|
|
||||||
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
inheritOutputDirs = false
|
|
||||||
outputDir = new File(compileJava.destinationDir.parentFile.parentFile, "idea")
|
|
||||||
testOutputDir = new File(compileTestJava.destinationDir.parentFile.parentFile, "ideaTest")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// Add your dependencies here
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api("com.github.GTNewHorizons:GTNHLib:0.9.40:dev")
|
||||||
|
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.75-GTNH:dev")
|
||||||
|
|
||||||
|
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
||||||
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
|
testRuntimeOnly ('org.junit.platform:junit-platform-launcher')
|
||||||
|
}
|
||||||
+237
-4
@@ -1,5 +1,238 @@
|
|||||||
modGroup = com.gtnewhorizon
|
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||||
modVersion = 1.0.3
|
# LOCAL to test local config updates.
|
||||||
modBaseName = StructureLib
|
gtnh.settings.blowdryerTag = 0.2.0
|
||||||
|
|
||||||
forgeVersion = 1.7.10-10.13.4.1614-1.7.10
|
# Human-readable mod name, available for mcmod.info population.
|
||||||
|
modName = StructureLib
|
||||||
|
|
||||||
|
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||||
|
# Conventionally lowercase.
|
||||||
|
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
|
||||||
|
|
||||||
|
# Whether to use modGroup as the maven publishing group.
|
||||||
|
# When false, com.github.GTNewHorizons is used.
|
||||||
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
|
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||||
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
# Version of Minecraft to target
|
||||||
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
|
# Version of Minecraft Forge to target
|
||||||
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
|
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||||
|
channel = stable
|
||||||
|
|
||||||
|
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
|
mappingsVersion = 12
|
||||||
|
|
||||||
|
# Defines other MCP mappings for dependency deobfuscation.
|
||||||
|
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
|
# Enables modern Java syntax support. Valid values:
|
||||||
|
# - false: No modern syntax, Java 8 only
|
||||||
|
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||||
|
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||||
|
# - modern: Native modern Java bytecode, no downgrading
|
||||||
|
enableModernJavaSyntax = jabel
|
||||||
|
|
||||||
|
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||||
|
# and should *not* be used in most situations. -1 disables this.
|
||||||
|
# forceToolchainVersion = -1
|
||||||
|
|
||||||
|
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||||
|
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||||
|
# downgradeTargetVersion = 8
|
||||||
|
|
||||||
|
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||||
|
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||||
|
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||||
|
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||||
|
|
||||||
|
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||||
|
# - shade: Shade minimized stubs into the jar
|
||||||
|
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||||
|
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||||
|
# - (empty): Warning reminding you to configure stubs
|
||||||
|
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||||
|
# jvmDowngraderStubsProvider =
|
||||||
|
|
||||||
|
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||||
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
|
enableGenericInjection = true
|
||||||
|
|
||||||
|
# Generate a class with a String field for the mod version named as defined below.
|
||||||
|
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||||
|
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||||
|
generateGradleTokenClass = 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 =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod name replacement token.
|
||||||
|
gradleTokenModName =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
|
# [DEPRECATED]
|
||||||
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
|
# version in @Mod([...], version = VERSION, [...]).
|
||||||
|
# Leave these properties empty to skip individual token replacements.
|
||||||
|
replaceGradleTokenInFile =
|
||||||
|
|
||||||
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
|
# leave this property empty.
|
||||||
|
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||||
|
apiPackage =
|
||||||
|
|
||||||
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
|
# There can be multiple files in a space-separated list.
|
||||||
|
# Example value: mymodid_at.cfg nei_at.cfg
|
||||||
|
accessTransformersFile =
|
||||||
|
|
||||||
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
|
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.
|
||||||
|
mixinPlugin =
|
||||||
|
|
||||||
|
# Specify the package that contains all of your Mixins. The package must exist or
|
||||||
|
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||||
|
# it must match with this or the build will fail.
|
||||||
|
mixinsPackage = mixins
|
||||||
|
|
||||||
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
|
# This parameter is for legacy compatibility only
|
||||||
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
|
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
|
||||||
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
|
forceEnableMixins = false
|
||||||
|
|
||||||
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||||
|
# responsibility to check the license and request permission for distribution if required.
|
||||||
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
|
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||||
|
# their own classes, making the minimization unreliable.
|
||||||
|
minimizeShadowedDependencies = true
|
||||||
|
|
||||||
|
# If disabled, won't rename the shadowed classes.
|
||||||
|
relocateShadowedDependencies = true
|
||||||
|
|
||||||
|
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||||
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
|
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||||
|
# list of strings, with the acceptable keys being(case does not matter):
|
||||||
|
# cursemaven
|
||||||
|
# modrinth
|
||||||
|
excludeWellKnownRepositories =
|
||||||
|
|
||||||
|
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||||
|
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||||
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
usesMavenPublishing = true
|
||||||
|
|
||||||
|
# Maven repository to publish the mod to.
|
||||||
|
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||||
|
|
||||||
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
|
#
|
||||||
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
|
# Leave this empty if you don't want to publish to Modrinth.
|
||||||
|
modrinthProjectId =
|
||||||
|
|
||||||
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
|
# type can be one of [project, version],
|
||||||
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
modrinthRelations =
|
||||||
|
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
#
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
curseForgeRelations =
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||||
|
# projects. New projects should not use this parameter.
|
||||||
|
# customArchiveBaseName =
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||||
|
# runClientWorkingDirectory = run/client
|
||||||
|
|
||||||
|
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||||
|
# runServerWorkingDirectory = run/server
|
||||||
|
|
||||||
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
|
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||||
|
# The check is ONLY performed if the version is a git tag.
|
||||||
|
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||||
|
# versionPattern =
|
||||||
|
|
||||||
|
# Uncomment to prevent the source code from being published.
|
||||||
|
# noPublishedSources = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Spotless checks.
|
||||||
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
|
# disableSpotless = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||||
|
# disableCheckstyle = true
|
||||||
|
|
||||||
|
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||||
|
# (force use delegated build).
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||||
|
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||||
|
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||||
|
# ideaOverrideBuildType = idea
|
||||||
|
|
||||||
|
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
|
# Non-GTNH properties
|
||||||
|
org.gradle.configuration-cache = true
|
||||||
|
org.gradle.parallel = true
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3689d0bcdd77ac01674ba3c9dbbe94d0/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||||
|
toolchainVersion=25
|
||||||
Vendored
BIN
Binary file not shown.
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
#Sat Jan 04 01:52:14 CET 2020
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
|
||||||
@@ -1,79 +1,128 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Attempt to set APP_HOME
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# Resolve links: $0 may be a link
|
||||||
APP_BASE_NAME=`basename "$0"`
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# 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
|
||||||
case "`uname`" in
|
nonstop=false
|
||||||
CYGWIN* )
|
case "$( uname )" in #(
|
||||||
cygwin=true
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
;;
|
Darwin* ) darwin=true ;; #(
|
||||||
Darwin* )
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
darwin=true
|
NONSTOP* ) nonstop=true ;;
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >&-
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >&-
|
|
||||||
|
|
||||||
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
|
||||||
@@ -82,83 +131,118 @@ 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" ] ; 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, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
function splitJvmOpts() {
|
# * args from the command line
|
||||||
JVM_OPTS=("$@")
|
# * the main class name
|
||||||
}
|
# * -classpath
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
# * -D...appname settings
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+46
-43
@@ -1,4 +1,22 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -8,26 +26,30 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
@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=
|
|
||||||
|
|
||||||
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.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
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
|
||||||
|
|
||||||
@@ -35,54 +57,35 @@ 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 Windowz variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_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=%*
|
|
||||||
goto execute
|
|
||||||
|
|
||||||
:4NT_args
|
|
||||||
@rem Get arguments from the 4NT Shell from JP Software
|
|
||||||
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
|
|
||||||
|
|
||||||
@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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
: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
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
before_install:
|
||||||
|
- ./gradlew setupCIWorkspace
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Add any additional repositiroes for your dependencies here
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// RetroFuturaGradle
|
||||||
|
name "GTNH Maven"
|
||||||
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("com.gtnewhorizons")
|
||||||
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
|
||||||
|
// this is not an API! go check StructureLibAPI instead!
|
||||||
|
public class ChannelDescription {
|
||||||
|
|
||||||
|
private static final ItemStackMap<Set<ChannelDescription>> itemToChannels = new ItemStackMap<>(true);
|
||||||
|
private static final Map<String, ChannelDescription> registry = new HashMap<>();
|
||||||
|
private final String channel;
|
||||||
|
private final Map<String, String> descriptions = new HashMap<>();
|
||||||
|
private final ItemStackMap<Integer> items = new ItemStackMap<>(true);
|
||||||
|
|
||||||
|
public static ChannelDescription get(final String channel) {
|
||||||
|
if (StructureLibAPI.isDebugEnabled() && !channel.toLowerCase(Locale.ROOT).equals(channel))
|
||||||
|
throw new IllegalArgumentException("Channel name can be lower case ONLY");
|
||||||
|
return registry.computeIfAbsent(channel, ChannelDescription::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean has(final String channel) {
|
||||||
|
if (StructureLibAPI.isDebugEnabled() && !channel.toLowerCase(Locale.ROOT).equals(channel))
|
||||||
|
throw new IllegalArgumentException("Channel name can be lower case ONLY");
|
||||||
|
return registry.containsKey(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<Map.Entry<String, Integer>> iterate(final ItemStack block) {
|
||||||
|
Set<ChannelDescription> channels = itemToChannels.get(block);
|
||||||
|
if (channels == null) return Collections.emptySet();
|
||||||
|
return channels.stream().map(d -> new AbstractMap.SimpleImmutableEntry<>(d.channel, d.items.get(block)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(final String channel, final String modid, final String description) {
|
||||||
|
if (StructureLibAPI.isDebugEnabled() && !channel.toLowerCase(Locale.ROOT).equals(channel))
|
||||||
|
throw new IllegalArgumentException("Channel name can be lower case ONLY");
|
||||||
|
registry.computeIfAbsent(channel, ChannelDescription::new).add(modid, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void item(final String channel, int channelValue, ItemStack stack) {
|
||||||
|
if (StructureLibAPI.isDebugEnabled()) {
|
||||||
|
if (!channel.toLowerCase(Locale.ROOT).equals(channel)) {
|
||||||
|
throw new IllegalArgumentException("Channel name can be lower case ONLY");
|
||||||
|
}
|
||||||
|
if (channelValue <= 0) {
|
||||||
|
throw new IllegalArgumentException("Channel value must be greater than 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChannelDescription inst = registry.computeIfAbsent(channel, ChannelDescription::new);
|
||||||
|
inst.items.put(stack, channelValue);
|
||||||
|
itemToChannels.computeIfAbsent(stack, s -> new HashSet<>()).add(inst);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, ChannelDescription> getAll() {
|
||||||
|
return Collections.unmodifiableMap(registry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChannelDescription(String channel) {
|
||||||
|
this.channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChannel() {
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChannelDescription add(String modid, String description) {
|
||||||
|
if (Loader.instance().getIndexedModList().get(modid) == null) {
|
||||||
|
throw new IllegalArgumentException("Mod not found: " + modid);
|
||||||
|
}
|
||||||
|
descriptions.put(modid, description);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getDescriptions() {
|
||||||
|
return Collections.unmodifiableMap(descriptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<ItemStack, Integer> getItems() {
|
||||||
|
return Collections.unmodifiableMap(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,657 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import static com.gtnewhorizon.structurelib.StructureLib.RANDOM;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
|
import net.minecraft.client.gui.GuiNewChat;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.culling.Frustrum;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.profiler.Profiler;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
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 Map<HintParticleInfo, HintGroup> allHints = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* All batches of hints.
|
||||||
|
*/
|
||||||
|
private static final List<HintGroup> allGroups = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current batch of hints. Belongs to the same logical multiblock.
|
||||||
|
*/
|
||||||
|
private static HintGroup currentHints;
|
||||||
|
/**
|
||||||
|
* Collection of all hints. Sorted from farthest (index 0) to nearest (index size - 1)
|
||||||
|
* <p>
|
||||||
|
* 10k should be more than enough, if not a bit wasteful
|
||||||
|
*/
|
||||||
|
private static final List<HintParticleInfo> allHintsForRender = new ArrayList<>(10000);
|
||||||
|
/**
|
||||||
|
* If the diff to current player position is too great sort the allHints. Initial value is very far off below y=0
|
||||||
|
* but not huge enough to make a NaN.
|
||||||
|
* <p>
|
||||||
|
* We are using this supposedly immutable object as a mutable object here. So be aware.
|
||||||
|
*/
|
||||||
|
private static final Vec3 lastPlayerPos = Vec3.createVectorHelper(0, -1e30, 0);
|
||||||
|
/**
|
||||||
|
* if true rebuild the allHints list from all hintOwners (and sort it)
|
||||||
|
*/
|
||||||
|
private static boolean allHintsDirty = false;
|
||||||
|
/**
|
||||||
|
* counter keeping track of how many renderThrough hint particle we have. enable optimization if no renderThrough
|
||||||
|
*/
|
||||||
|
private static int renderThrough;
|
||||||
|
/**
|
||||||
|
* A throttle map for local player. Integrated server will use the throttle map in super class instead.
|
||||||
|
*/
|
||||||
|
private static final Map<Object, Long> localThrottleMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
|
||||||
|
ensureHinting();
|
||||||
|
HintParticleInfo info = new HintParticleInfo(w, x, y, z, icons, RGBa);
|
||||||
|
|
||||||
|
// check and remove colliding holograms
|
||||||
|
if (ConfigurationHandler.INSTANCE.isRemoveCollidingHologram()) {
|
||||||
|
HintGroup dupe = allHints.get(info);
|
||||||
|
if (dupe != null && dupe != currentHints) {
|
||||||
|
allGroups.remove(dupe);
|
||||||
|
removeGroup(dupe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allHints.put(info, currentHints);
|
||||||
|
currentHints.getHints().add(info);
|
||||||
|
allHintsDirty = true;
|
||||||
|
|
||||||
|
EntityFX particle = new WeightlessParticleFX(
|
||||||
|
w,
|
||||||
|
x + RANDOM.nextFloat() * 0.5F,
|
||||||
|
y + RANDOM.nextFloat() * 0.5F,
|
||||||
|
z + RANDOM.nextFloat() * 0.5F,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {
|
||||||
|
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), RGBa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hintParticle(World w, int x, int y, int z, IIcon[] icons) {
|
||||||
|
hintParticleTinted(w, x, y, z, icons, RGBA_NO_TINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hintParticle(World w, int x, int y, int z, Block block, int meta) {
|
||||||
|
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), RGBA_NO_TINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateHintParticleTint(EntityPlayer player, World w, int x, int y, int z, short[] rgBa) {
|
||||||
|
if (player instanceof EntityPlayerMP) return super.updateHintParticleTint(player, w, x, y, z, rgBa);
|
||||||
|
if (player != getCurrentPlayer()) return false; // how?
|
||||||
|
HintParticleInfo hint = getHintParticleInfo(w, x, y, z);
|
||||||
|
if (hint == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
hint.setTint(rgBa);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HintParticleInfo getHintParticleInfo(World w, int x, int y, int z) {
|
||||||
|
HintParticleInfo info = new HintParticleInfo(w, x, y, z, null, null);
|
||||||
|
HintGroup existing = allHints.get(info);
|
||||||
|
if (existing != null) {
|
||||||
|
for (HintParticleInfo hint : existing.getHints()) {
|
||||||
|
if (hint.equals(info)) {
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean markHintParticleError(EntityPlayer player, World w, int x, int y, int z) {
|
||||||
|
if (player instanceof EntityPlayerMP) return super.markHintParticleError(player, w, x, y, z);
|
||||||
|
if (player != getCurrentPlayer()) return false; // how?
|
||||||
|
HintParticleInfo hint = getHintParticleInfo(w, x, y, z);
|
||||||
|
if (hint == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
hint.setTint(RGBA_RED_TINT);
|
||||||
|
hint.setRenderThrough();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired,
|
||||||
|
boolean forceUpdateLastSend) {
|
||||||
|
if (player instanceof EntityPlayerMP)
|
||||||
|
super.addThrottledChat(throttleKey, player, text, intervalRequired, forceUpdateLastSend);
|
||||||
|
else if (player != null)
|
||||||
|
addThrottledChat(throttleKey, player, text, intervalRequired, forceUpdateLastSend, localThrottleMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void removeGroup(HintGroup group) {
|
||||||
|
for (HintParticleInfo hintParticleInfo : group.getHints()) {
|
||||||
|
allHints.remove(hintParticleInfo);
|
||||||
|
if (hintParticleInfo.renderThrough) renderThrough--;
|
||||||
|
}
|
||||||
|
allHintsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IIcon[] createIIconFromBlock(Block block, int meta) {
|
||||||
|
IIcon[] ret = new IIcon[6];
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
ret[i] = block.getIcon(i, meta);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addClientSideChatMessages(String... messages) {
|
||||||
|
GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
|
||||||
|
for (String s : messages) {
|
||||||
|
chat.printChatMessage(new ChatComponentText(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityPlayer getCurrentPlayer() {
|
||||||
|
return Minecraft.getMinecraft().thePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCurrentPlayer(EntityPlayer player) {
|
||||||
|
return player == Minecraft.getMinecraft().thePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startHinting(World w) {
|
||||||
|
if (!w.isRemote) return;
|
||||||
|
if (currentHints != null) endHinting(w);
|
||||||
|
currentHints = new HintGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureHinting() {
|
||||||
|
if (currentHints == null) currentHints = new HintGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endHinting(World w) {
|
||||||
|
if (!w.isRemote || currentHints == null) return;
|
||||||
|
while (!allGroups.isEmpty() && allGroups.size() >= ConfigurationHandler.INSTANCE.getMaxCoexistingHologram()) {
|
||||||
|
allGroups.remove(0);
|
||||||
|
}
|
||||||
|
if (!currentHints.getHints().isEmpty()) allGroups.add(currentHints);
|
||||||
|
// we use the player existence time here as some worlds don't really advance the time ticker
|
||||||
|
currentHints.setCreationTime(getCurrentPlayer().ticksExisted);
|
||||||
|
currentHints = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getOverworldTime() {
|
||||||
|
// there is no overworld, better just hope current world time is ok...
|
||||||
|
return Minecraft.getMinecraft().theWorld.getTotalWorldTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uploadChannels(ItemStack trigger) {
|
||||||
|
StructureLib.net.sendToServer(new SetChannelDataMessage(trigger));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
|
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void markTextureUsed(IIcon icon) {
|
||||||
|
if (StructureLib.COMPAT instanceof IStructureCompat)
|
||||||
|
((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 final List<HintParticleInfo> hints = new LinkedList<>();
|
||||||
|
private int creationTime = -1;
|
||||||
|
|
||||||
|
public List<HintParticleInfo> getHints() {
|
||||||
|
return hints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationTime(int creationTime) {
|
||||||
|
this.creationTime = creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCreationTime() {
|
||||||
|
return creationTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class HintParticleInfo {
|
||||||
|
|
||||||
|
private final World w;
|
||||||
|
// these are the block coordinate for e.g. w.getBlock()
|
||||||
|
private final int x, y, z;
|
||||||
|
private final IIcon[] icons;
|
||||||
|
private short[] tint;
|
||||||
|
private boolean renderThrough;
|
||||||
|
|
||||||
|
private final long creationTime = System.currentTimeMillis(); // use tick time instead maybe
|
||||||
|
|
||||||
|
public HintParticleInfo(World w, int x, int y, int z, IIcon[] icons, short[] tint) {
|
||||||
|
this.w = w;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.icons = icons;
|
||||||
|
this.tint = tint;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof HintParticleInfo)) return false;
|
||||||
|
|
||||||
|
HintParticleInfo that = (HintParticleInfo) o;
|
||||||
|
|
||||||
|
return x == that.x && y == that.y && z == that.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTint(short[] tint) {
|
||||||
|
this.tint = tint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRenderThrough() {
|
||||||
|
if (!this.renderThrough) {
|
||||||
|
ClientProxy.renderThrough += 1;
|
||||||
|
allHintsDirty = true;
|
||||||
|
}
|
||||||
|
this.renderThrough = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = x;
|
||||||
|
result = 31 * result + y;
|
||||||
|
result = 31 * result + z;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInFrustrum(Frustrum frustrum) {
|
||||||
|
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, double eyeX, double eyeY, double eyeZ, int eyeXint, int eyeYint,
|
||||||
|
int eyeZint) {
|
||||||
|
double size = 0.5;
|
||||||
|
|
||||||
|
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
|
||||||
|
tes.setColorRGBA(
|
||||||
|
(int) (tint[0] * .9F),
|
||||||
|
(int) (tint[1] * .95F),
|
||||||
|
(int) (tint[2] * 1F),
|
||||||
|
ConfigurationHandler.INSTANCE.getHintTransparency());
|
||||||
|
|
||||||
|
double X = (x - eyeXint) + 0.25;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
markTextureUsed(icons[i]);
|
||||||
|
|
||||||
|
double u = icons[i].getMinU();
|
||||||
|
double U = icons[i].getMaxU();
|
||||||
|
double v = icons[i].getMinV();
|
||||||
|
double V = icons[i].getMaxV();
|
||||||
|
switch (i) { // {DOWN, UP, NORTH, SOUTH, WEST, EAST}
|
||||||
|
case 0:
|
||||||
|
// all these ifs is in form if ((is face unobstructed) != (is in unobstructred pass))
|
||||||
|
if ((worldY >= eyeY) != unobstructedPass) continue;
|
||||||
|
tes.setNormal(0, -1, 0);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if ((worldY + size <= eyeY) != unobstructedPass) continue;
|
||||||
|
tes.setNormal(0, 1, 0);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, 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, u, v);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if ((worldZ >= eyeZ) != unobstructedPass) continue;
|
||||||
|
tes.setNormal(0, 0, -1);
|
||||||
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, u, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if ((worldZ + size <= eyeZ) != unobstructedPass) continue;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreationTime() {
|
||||||
|
return creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSquareDistanceTo(Vec3 point) {
|
||||||
|
return point.squareDistanceTo(x + 0.5, y + 0.5, z + 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FMLEventHandler {
|
||||||
|
|
||||||
|
static boolean connected = false;
|
||||||
|
static boolean configSent = false;
|
||||||
|
|
||||||
|
private void resetPlayerLocation() {
|
||||||
|
lastPlayerPos.xCoord = Minecraft.getMinecraft().thePlayer.posX;
|
||||||
|
lastPlayerPos.yCoord = Minecraft.getMinecraft().thePlayer.posY;
|
||||||
|
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
|
||||||
|
public void onClientTick(ClientTickEvent e) {
|
||||||
|
if (e.phase == Phase.END && Minecraft.getMinecraft().thePlayer != null) {
|
||||||
|
Vec3 playerPos = Minecraft.getMinecraft().thePlayer.getPosition(1);
|
||||||
|
boolean sortRequired = false;
|
||||||
|
// The allGroups is implicitly sorted by creationTime
|
||||||
|
// here we exploit this ordering to reduce iteration size
|
||||||
|
int deadline = Minecraft.getMinecraft().thePlayer.ticksExisted
|
||||||
|
- ConfigurationHandler.INSTANCE.getHintLifespan();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < allGroups.size(); i++) {
|
||||||
|
if (allGroups.get(i).getCreationTime() > deadline) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i != 0) {
|
||||||
|
sortRequired = true;
|
||||||
|
// clear this block and go no further
|
||||||
|
List<HintGroup> toRemove = allGroups.subList(0, i);
|
||||||
|
toRemove.forEach(ClientProxy::removeGroup);
|
||||||
|
toRemove.clear();
|
||||||
|
}
|
||||||
|
if (allHintsDirty) {
|
||||||
|
allHintsForRender.clear();
|
||||||
|
// we need greatly efficient sequential access and mildly efficient sorting
|
||||||
|
// rebuild is sort of rare, and it's expected to lag anyway
|
||||||
|
// so no min-heap here
|
||||||
|
for (HintGroup c : allGroups) allHintsForRender.addAll(c.getHints());
|
||||||
|
sortRequired = true;
|
||||||
|
}
|
||||||
|
if (sortRequired || playerPos.squareDistanceTo(lastPlayerPos) > 1e-2) {
|
||||||
|
// only redo sort if player moved some distance
|
||||||
|
// default is 0.1 block
|
||||||
|
// if there was a full rebuild, go sort it as well
|
||||||
|
allHintsForRender.sort(Comparator.comparingDouble(info -> -info.getSquareDistanceTo(playerPos)));
|
||||||
|
resetPlayerLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ForgeEventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityJoinWorld(EntityJoinWorldEvent e) {
|
||||||
|
if (e.world.isRemote && e.entity instanceof EntityClientPlayerMP) {
|
||||||
|
sendRegistryOrderToServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onWorldLoad(WorldEvent.Load e) {
|
||||||
|
if (e.world.isRemote) {
|
||||||
|
// flush hints. we are in a different world now.
|
||||||
|
allHintsForRender.clear();
|
||||||
|
allGroups.clear();
|
||||||
|
lastPlayerPos.yCoord = -1e30;
|
||||||
|
renderThrough = 0;
|
||||||
|
// clear throttles. hopefully a world switch is enough long as a cool down.
|
||||||
|
localThrottleMap.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRenderWorldLast(RenderWorldLastEvent e) {
|
||||||
|
if (allHintsForRender.isEmpty()) return;
|
||||||
|
|
||||||
|
// seriously, I'm not a OpenGL expert, so I'm probably doing a lot of very stupid stuff here.
|
||||||
|
// Please consider contributing patches if you find something to optimize.
|
||||||
|
|
||||||
|
Profiler p = Minecraft.getMinecraft().mcProfiler;
|
||||||
|
|
||||||
|
p.startSection("HintParticle");
|
||||||
|
p.startSection("Prepare");
|
||||||
|
Frustrum frustrum = new Frustrum();
|
||||||
|
Entity entitylivingbase = Minecraft.getMinecraft().renderViewEntity;
|
||||||
|
double d0 = entitylivingbase.lastTickPosX
|
||||||
|
+ (entitylivingbase.posX - entitylivingbase.lastTickPosX) * e.partialTicks;
|
||||||
|
double d1 = entitylivingbase.lastTickPosY
|
||||||
|
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * e.partialTicks;
|
||||||
|
double d2 = entitylivingbase.lastTickPosZ
|
||||||
|
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * e.partialTicks;
|
||||||
|
int i0 = (int) d0, i1 = (int) d1, i2 = (int) d2;
|
||||||
|
frustrum.setPosition(d0, d1, d2);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
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
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND); // enable blend so it is transparent
|
||||||
|
GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||||
|
// depth test begin as enabled
|
||||||
|
boolean renderThrough = false;
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
GL11.glTranslated(-d0 + i0, -d1 + i1, -d2 + i2);
|
||||||
|
Tessellator tes = Tessellator.instance;
|
||||||
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
for (int i = 0, allHintsForRenderSize = allHintsForRender.size(), cubeDrawn = 0; i
|
||||||
|
< allHintsForRenderSize; i++, cubeDrawn++) {
|
||||||
|
HintParticleInfo hint = allHintsForRender.get(i);
|
||||||
|
if (!hint.isInFrustrum(frustrum)) continue;
|
||||||
|
if (renderThrough != hint.renderThrough) {
|
||||||
|
if (i > 0) {
|
||||||
|
p.endStartSection("Draw");
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
cubeDrawn = 0;
|
||||||
|
p.endStartSection("Prepare");
|
||||||
|
}
|
||||||
|
if (hint.renderThrough) GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
else GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
renderThrough = hint.renderThrough;
|
||||||
|
}
|
||||||
|
// 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");
|
||||||
|
tes.draw();
|
||||||
|
p.endSection();
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
p.endSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
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 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, Block block, int meta, short[] RGBa) {}
|
||||||
|
|
||||||
|
public void hintParticle(World w, int x, int y, int z, IIcon[] icons) {}
|
||||||
|
|
||||||
|
public void hintParticle(World w, int x, int y, int z, Block block, int meta) {}
|
||||||
|
|
||||||
|
public boolean updateHintParticleTint(EntityPlayer player, World w, int x, int y, int z, short[] rgBa) {
|
||||||
|
if (player instanceof EntityPlayerMP) { // just in case
|
||||||
|
StructureLib.net.sendTo(
|
||||||
|
new UpdateHintParticleMessage(x, (short) y, z, rgBa[0], rgBa[1], rgBa[2], rgBa[3]),
|
||||||
|
(EntityPlayerMP) player);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityPlayer getCurrentPlayer() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCurrentPlayer(EntityPlayer player) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addClientSideChatMessages(String... messages) {}
|
||||||
|
|
||||||
|
public void startHinting(World w) {}
|
||||||
|
|
||||||
|
public void endHinting(World w) {}
|
||||||
|
|
||||||
|
public void preInit(FMLPreInitializationEvent e) {}
|
||||||
|
|
||||||
|
public long getOverworldTime() {
|
||||||
|
return MinecraftServer.getServer().getEntityWorld().getTotalWorldTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uploadChannels(ItemStack trigger) {}
|
||||||
|
|
||||||
|
public boolean markHintParticleError(EntityPlayer player, World w, int x, int y, int z) {
|
||||||
|
if (player instanceof EntityPlayerMP) { // just in case
|
||||||
|
StructureLib.net.sendTo(new ErrorHintParticleMessage(x, (short) y, z), (EntityPlayerMP) player);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadComplete(FMLLoadCompleteEvent e) {
|
||||||
|
ConfigurationHandler.INSTANCE.loadRegistryOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<EntityPlayerMP, Map<Object, Long>> throttleMap = new WeakHashMap<>();
|
||||||
|
|
||||||
|
public void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired,
|
||||||
|
boolean forceUpdateLastSend) {
|
||||||
|
if (player instanceof EntityPlayerMP) {
|
||||||
|
Map<Object, Long> submap = throttleMap.computeIfAbsent((EntityPlayerMP) player, p -> new HashMap<>());
|
||||||
|
addThrottledChat(throttleKey, player, text, intervalRequired, forceUpdateLastSend, submap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text,
|
||||||
|
short intervalRequired, boolean forceUpdateLastSend, Map<Object, Long> submap) {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
Long old;
|
||||||
|
if (forceUpdateLastSend) {
|
||||||
|
old = submap.put(throttleKey, now);
|
||||||
|
} else {
|
||||||
|
old = submap.get(throttleKey);
|
||||||
|
}
|
||||||
|
if (old == null || now - old >= intervalRequired) {
|
||||||
|
player.addChatComponentMessage(text);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
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 net.minecraftforge.common.config.ConfigCategory;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
private Configuration config;
|
||||||
|
private int maxCoexistingHologram;
|
||||||
|
private boolean removeCollidingHologram;
|
||||||
|
private int hintLifespan;
|
||||||
|
private int hintTransparency;
|
||||||
|
private int autoPlaceBudget;
|
||||||
|
private int autoPlaceInterval;
|
||||||
|
private Map<String, Pair<List<String>, List<String>>> registryOrders;
|
||||||
|
|
||||||
|
ConfigurationHandler() {
|
||||||
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(File f) {
|
||||||
|
config = new Configuration(f, ConfigurationVersion.latest().getVersionMarker());
|
||||||
|
ConfigurationVersion.migrateToLatest(config);
|
||||||
|
loadConfig();
|
||||||
|
setLanguageKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLanguageKeys() {
|
||||||
|
for (String categoryName : config.getCategoryNames()) {
|
||||||
|
ConfigCategory category = config.getCategory(categoryName);
|
||||||
|
category.setLanguageKey("structurelib.config." + categoryName);
|
||||||
|
for (Map.Entry<String, Property> entry : category.entrySet()) {
|
||||||
|
entry.getValue().setLanguageKey(String.format("%s.%s", category.getLanguagekey(), entry.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadConfig() {
|
||||||
|
maxCoexistingHologram = config.getInt(
|
||||||
|
"maxCoexisting",
|
||||||
|
"client.hologram",
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
100,
|
||||||
|
"An attempt will be made to prune old holograms when a new hologram is about to be projected");
|
||||||
|
removeCollidingHologram = config.getBoolean(
|
||||||
|
"removeColliding",
|
||||||
|
"client.hologram",
|
||||||
|
true,
|
||||||
|
"An attempt will be made to remove an existing hologram if it collides with a new hologram.");
|
||||||
|
hintLifespan = config
|
||||||
|
.getInt("hintLifespan", "client.hologram", 400, 1, 20000, "Ticks before a hologram disappears.");
|
||||||
|
hintTransparency = config.getInt(
|
||||||
|
"hintTransparency",
|
||||||
|
"client.hologram",
|
||||||
|
192,
|
||||||
|
1,
|
||||||
|
255,
|
||||||
|
"Alpha value of hologram particles. Higher the value, the more \"ghostly\" the hologram will appear to be.");
|
||||||
|
autoPlaceBudget = config.getInt(
|
||||||
|
"autoPlaceBudget",
|
||||||
|
"common.hologram",
|
||||||
|
25,
|
||||||
|
1,
|
||||||
|
200,
|
||||||
|
"Max number of elements can be placed in one round of auto place.\n"
|
||||||
|
+ "As expected, server side settings will overrides client settings.\n"
|
||||||
|
+ "Certain larger multi might increase these values beyond this configured value.");
|
||||||
|
autoPlaceInterval = config.getInt(
|
||||||
|
"autoPlaceInterval",
|
||||||
|
"common.hologram",
|
||||||
|
300,
|
||||||
|
0,
|
||||||
|
20000,
|
||||||
|
"Unit: millisecond. Minimal interval between two auto place round.\n"
|
||||||
|
+ "As expected, server side settings will overrides client settings.\n"
|
||||||
|
+ "Note this relates to the wall clock, not in game ticks.\n"
|
||||||
|
+ "Value smaller than default is likely to be perceived as no minimal interval whatsoever.");
|
||||||
|
|
||||||
|
loadRegistryOrder();
|
||||||
|
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadRegistryOrder() {
|
||||||
|
loadRegistryOrderImpl();
|
||||||
|
setLanguageKeys();
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadRegistryOrderImpl() {
|
||||||
|
registryOrders = new HashMap<>();
|
||||||
|
for (Map.Entry<String, WeakReference<SortedRegistry<?>>> e : SortedRegistry.ALL_REGISTRIES.entrySet()) {
|
||||||
|
SortedRegistry<?> r = e.getValue().get();
|
||||||
|
if (r == null) continue;
|
||||||
|
String category = "registries." + e.getKey();
|
||||||
|
if (FMLLaunchHandler.side().isClient()) {
|
||||||
|
// only meaningful on client, and would crash on server
|
||||||
|
config.setCategoryConfigEntryClass(category, RegistryOrderEntry.class);
|
||||||
|
}
|
||||||
|
Property pOrder = config.get(
|
||||||
|
category,
|
||||||
|
"ordering",
|
||||||
|
Iterables.toArray(r.getCurrentOrdering(), String.class),
|
||||||
|
"stuff not in this list will be automatically available after all entries listed here in their natural order, unless explicitly disabled in disabled config below.");
|
||||||
|
Property pDisable = config.get(category, "disabled", new String[0], "stuff in this list will be disabled");
|
||||||
|
List<String> all = Lists.newArrayList(r.getCurrentOrdering());
|
||||||
|
List<String> curVal = new ArrayList<>(Arrays.asList(pOrder.getStringList()));
|
||||||
|
List<String> disabled = new ArrayList<>(Arrays.asList(pDisable.getStringList()));
|
||||||
|
curVal.removeAll(disabled);
|
||||||
|
all.removeAll(disabled);
|
||||||
|
curVal.removeIf(s -> !all.remove(s));
|
||||||
|
curVal.addAll(all);
|
||||||
|
pOrder.set(curVal.toArray(new String[0]));
|
||||||
|
registryOrders.put(e.getKey(), Pair.of(curVal, disabled));
|
||||||
|
}
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveConfig() {
|
||||||
|
if (config.hasChanged()) {
|
||||||
|
config.save();
|
||||||
|
config.load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onConfigChange(ConfigChangedEvent.PostConfigChangedEvent e) {
|
||||||
|
if (e.modID.equals(StructureLibAPI.MOD_ID)) {
|
||||||
|
loadConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxCoexistingHologram() {
|
||||||
|
return maxCoexistingHologram;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveCollidingHologram() {
|
||||||
|
return removeCollidingHologram;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHintLifespan() {
|
||||||
|
return hintLifespan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHintTransparency() {
|
||||||
|
return hintTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAutoPlaceBudget() {
|
||||||
|
return autoPlaceBudget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAutoPlaceInterval() {
|
||||||
|
return autoPlaceInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pair<List<String>, List<String>> getRegistryOrder(String name) {
|
||||||
|
return registryOrders.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
Configuration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
|
enum ConfigurationVersion {
|
||||||
|
|
||||||
|
V1 {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void step(Configuration c) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final ConfigurationVersion[] VALUES = values();
|
||||||
|
|
||||||
|
private final String versionMarker;
|
||||||
|
|
||||||
|
ConfigurationVersion() {
|
||||||
|
this.versionMarker = name();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void migrateToLatest(Configuration c) {
|
||||||
|
for (int i = identify(c).ordinal() + 1; i < VALUES.length; i++) {
|
||||||
|
VALUES[i].step(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConfigurationVersion latest() {
|
||||||
|
return VALUES[VALUES.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConfigurationVersion identify(Configuration c) {
|
||||||
|
return Arrays.stream(VALUES).filter(v -> Objects.equals(c.getLoadedConfigVersion(), v.getVersionMarker()))
|
||||||
|
.findFirst().orElse(V1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getVersionMarker() {
|
||||||
|
return versionMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void step(Configuration c);
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
|
public class DevelopHelper {
|
||||||
|
|
||||||
|
private static final boolean DEBUG = Boolean.getBoolean("structurelib.develop_helper");
|
||||||
|
|
||||||
|
public static void onPreInit() {
|
||||||
|
if (!DEBUG) return;
|
||||||
|
StructureLib.LOGGER.info("Running develop helper");
|
||||||
|
StructureLibAPI.registerChannelDescription("sandstone", StructureLibAPI.MOD_ID, "variants of Sandstone");
|
||||||
|
StructureLibAPI.registerChannelItem("sandstone", StructureLibAPI.MOD_ID, 1, new ItemStack(Blocks.sandstone));
|
||||||
|
StructureLibAPI
|
||||||
|
.registerChannelItem("sandstone", StructureLibAPI.MOD_ID, 2, new ItemStack(Blocks.sandstone, 1, 1));
|
||||||
|
StructureLibAPI
|
||||||
|
.registerChannelItem("sandstone", StructureLibAPI.MOD_ID, 3, new ItemStack(Blocks.sandstone, 1, 2));
|
||||||
|
StructureLibAPI.registerChannelDescription("sandbricks", StructureLibAPI.MOD_ID, "variants of Sandbricks");
|
||||||
|
StructureLibAPI.registerChannelDescription("apple", StructureLibAPI.MOD_ID, "apple");
|
||||||
|
StructureLibAPI.registerChannelDescription("bright", StructureLibAPI.MOD_ID, "bright");
|
||||||
|
StructureLibAPI.registerChannelDescription("apple_blight", StructureLibAPI.MOD_ID, "apple_blight");
|
||||||
|
StructureLibAPI.registerChannelDescription("app_eagle", StructureLibAPI.MOD_ID, "app_eagle");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void x() {
|
||||||
|
NBTTagCompound command = new NBTTagCompound();
|
||||||
|
NBTTagList items = new NBTTagList();
|
||||||
|
int[] metas = { 0, 1, 2 };
|
||||||
|
for (int meta : metas) {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
tag.setTag("Item", new ItemStack(Blocks.sandstone, 1, meta).writeToNBT(new NBTTagCompound()));
|
||||||
|
NBTTagList channels = new NBTTagList();
|
||||||
|
NBTTagCompound channel = new NBTTagCompound();
|
||||||
|
channel.setString("Channel", "sandstone");
|
||||||
|
channel.setInteger("Value", meta + 1);
|
||||||
|
channels.appendTag(channel);
|
||||||
|
tag.setTag("Channels", channels);
|
||||||
|
items.appendTag(tag);
|
||||||
|
}
|
||||||
|
command.setTag("Items", items);
|
||||||
|
FMLInterModComms.sendMessage("structurelib", "register_channel_item", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,702 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader Copyright (c) 2012-2014 cpw. All rights reserved. This program and the accompanying materials are
|
||||||
|
* made available under the terms of the GNU Lesser Public License v2.1 which accompanies this distribution, and is
|
||||||
|
* available at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html Contributors (this class): bspkrs - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.client.config.GuiUtils.RESET_CHAR;
|
||||||
|
import static cpw.mods.fml.client.config.GuiUtils.UNDO_CHAR;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiListExtended;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.config.GuiButtonExt;
|
||||||
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
|
import cpw.mods.fml.client.config.GuiUnicodeGlyphButton;
|
||||||
|
import cpw.mods.fml.client.config.GuiUtils;
|
||||||
|
import cpw.mods.fml.client.config.HoverChecker;
|
||||||
|
import cpw.mods.fml.client.config.IConfigElement;
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent.PostConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is the base GuiScreen for all config GUI screens. It can be extended by mods to provide the top-level
|
||||||
|
* config screen that will be called when the Config button is clicked from the Main Menu Mods list.
|
||||||
|
*
|
||||||
|
* @author bspkrs
|
||||||
|
*/
|
||||||
|
public class GuiEditRegistryConfig extends GuiScreen {
|
||||||
|
|
||||||
|
public static final String OMITTED = "..";
|
||||||
|
public static final int LIST_WINDOW_PADDING = 20;
|
||||||
|
public static final int MID_SECTION_WIDTH = 10;
|
||||||
|
/**
|
||||||
|
* A reference to the screen object that created this. Used for navigating between screens.
|
||||||
|
*/
|
||||||
|
public final GuiScreen parentScreen;
|
||||||
|
private final IConfigElement<String> disabledElement;
|
||||||
|
private final String[] beforeDisabledValue;
|
||||||
|
private final IConfigElement<String> orderElement;
|
||||||
|
private final String[] beforeOrderValue;
|
||||||
|
final Collection<EntriesList> lists;
|
||||||
|
private final String registryName;
|
||||||
|
EntriesList disabledEntries;
|
||||||
|
EntriesList orderEntries;
|
||||||
|
public String title = "Config GUI";
|
||||||
|
public String titleLine2;
|
||||||
|
private GuiButtonExt btnDefault;
|
||||||
|
private GuiButtonExt btnUndoAll;
|
||||||
|
public final String modID;
|
||||||
|
/**
|
||||||
|
* When set to a non-null value the OnConfigChanged and PostConfigChanged events will be posted when the Done button
|
||||||
|
* is pressed if any configElements were changed (includes child screens). If not defined, the events will be posted
|
||||||
|
* if the parent gui is null or if the parent gui is not an instance of GuiConfig.
|
||||||
|
*/
|
||||||
|
public final String configID;
|
||||||
|
public final boolean isWorldRunning;
|
||||||
|
public final boolean allRequireWorldRestart;
|
||||||
|
public final boolean allRequireMcRestart;
|
||||||
|
public boolean needsRefresh = true;
|
||||||
|
private HoverChecker undoHoverChecker;
|
||||||
|
private HoverChecker resetHoverChecker;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public GuiEditRegistryConfig(GuiScreen parentScreen, IConfigElement disabled, IConfigElement order,
|
||||||
|
String registryName, String modID, String configID, boolean allRequireWorldRestart,
|
||||||
|
boolean allRequireMcRestart, String title, String titleLine2) {
|
||||||
|
this.mc = parentScreen.mc;
|
||||||
|
this.lists = Collections.newSetFromMap(new WeakHashMap<>());
|
||||||
|
this.disabledElement = disabled;
|
||||||
|
this.beforeDisabledValue = (String[]) this.disabledElement.getList();
|
||||||
|
this.orderElement = order;
|
||||||
|
this.beforeOrderValue = (String[]) this.orderElement.getList();
|
||||||
|
this.parentScreen = parentScreen;
|
||||||
|
this.allRequireWorldRestart = allRequireWorldRestart;
|
||||||
|
this.allRequireMcRestart = allRequireMcRestart;
|
||||||
|
this.registryName = registryName;
|
||||||
|
this.modID = modID;
|
||||||
|
this.configID = configID;
|
||||||
|
this.isWorldRunning = mc.theWorld != null;
|
||||||
|
if (title != null) this.title = title;
|
||||||
|
this.titleLine2 = titleLine2;
|
||||||
|
if (this.titleLine2 != null && this.titleLine2.startsWith(" > "))
|
||||||
|
this.titleLine2 = this.titleLine2.replaceFirst(" > ", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the buttons (and other controls) to the screen in question.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
if (this.disabledEntries == null || this.needsRefresh) {
|
||||||
|
this.disabledEntries = new EntriesList(
|
||||||
|
(width - MID_SECTION_WIDTH) / 2 - LIST_WINDOW_PADDING,
|
||||||
|
LIST_WINDOW_PADDING,
|
||||||
|
I18n.format("structurelib.configgui.disabled"));
|
||||||
|
this.disabledEntries.initEntries(Arrays.asList(disabledElement.getList()));
|
||||||
|
} else {
|
||||||
|
this.disabledEntries.reinit((width - MID_SECTION_WIDTH) / 2 - LIST_WINDOW_PADDING, LIST_WINDOW_PADDING);
|
||||||
|
}
|
||||||
|
if (this.orderEntries == null || this.needsRefresh) {
|
||||||
|
this.orderEntries = new EntriesList(
|
||||||
|
(width - MID_SECTION_WIDTH) / 2 - LIST_WINDOW_PADDING,
|
||||||
|
(width + MID_SECTION_WIDTH) / 2,
|
||||||
|
I18n.format("structurelib.configgui.enabled"));
|
||||||
|
this.orderEntries.initEntries(Arrays.asList(orderElement.getList()));
|
||||||
|
} else {
|
||||||
|
this.orderEntries
|
||||||
|
.reinit((width - MID_SECTION_WIDTH) / 2 - LIST_WINDOW_PADDING, (width + MID_SECTION_WIDTH) / 2);
|
||||||
|
}
|
||||||
|
this.needsRefresh = false;
|
||||||
|
|
||||||
|
int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2;
|
||||||
|
int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2;
|
||||||
|
int doneWidth = Math.max(mc.fontRenderer.getStringWidth(I18n.format("gui.done")) + 20, 100);
|
||||||
|
int undoWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges"))
|
||||||
|
+ undoGlyphWidth
|
||||||
|
+ 20;
|
||||||
|
int resetWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault"))
|
||||||
|
+ resetGlyphWidth
|
||||||
|
+ 20;
|
||||||
|
int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth + 5) / 2;
|
||||||
|
this.buttonList.add(
|
||||||
|
new GuiButtonExt(
|
||||||
|
2000,
|
||||||
|
this.width / 2 - buttonWidthHalf,
|
||||||
|
this.height - 29,
|
||||||
|
doneWidth,
|
||||||
|
20,
|
||||||
|
I18n.format("gui.done")));
|
||||||
|
this.buttonList.add(
|
||||||
|
this.btnDefault = new GuiUnicodeGlyphButton(
|
||||||
|
2001,
|
||||||
|
this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5,
|
||||||
|
this.height - 29,
|
||||||
|
resetWidth,
|
||||||
|
20,
|
||||||
|
" " + I18n.format("fml.configgui.tooltip.resetToDefault"),
|
||||||
|
RESET_CHAR,
|
||||||
|
2.0F));
|
||||||
|
this.buttonList.add(
|
||||||
|
btnUndoAll = new GuiUnicodeGlyphButton(
|
||||||
|
2002,
|
||||||
|
this.width / 2 - buttonWidthHalf + doneWidth + 5,
|
||||||
|
this.height - 29,
|
||||||
|
undoWidth,
|
||||||
|
20,
|
||||||
|
" " + I18n.format("fml.configgui.tooltip.undoChanges"),
|
||||||
|
UNDO_CHAR,
|
||||||
|
2.0F));
|
||||||
|
|
||||||
|
this.undoHoverChecker = new HoverChecker(this.btnUndoAll, 800);
|
||||||
|
this.resetHoverChecker = new HoverChecker(this.btnDefault, 800);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
if (this.configID != null && this.parentScreen instanceof GuiConfig) {
|
||||||
|
GuiConfig parentGuiConfig = (GuiConfig) this.parentScreen;
|
||||||
|
parentGuiConfig.needsRefresh = true;
|
||||||
|
parentGuiConfig.initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(this.parentScreen instanceof GuiConfig)) Keyboard.enableRepeatEvents(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean saveConfigElements() {
|
||||||
|
if (isChanged()) {
|
||||||
|
disabledElement.set(disabledEntries.entries.stream().map(e -> e.name).toArray(String[]::new));
|
||||||
|
orderElement.set(orderEntries.entries.stream().map(e -> e.name).toArray(String[]::new));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button) {
|
||||||
|
if (button.id == 2000) {
|
||||||
|
try {
|
||||||
|
if ((configID != null || this.parentScreen == null || !(this.parentScreen instanceof GuiConfig))
|
||||||
|
&& isChanged()) {
|
||||||
|
saveConfigElements();
|
||||||
|
if (Loader.isModLoaded(modID)) {
|
||||||
|
ConfigChangedEvent event = new OnConfigChangedEvent(modID, configID, isWorldRunning, false);
|
||||||
|
FMLCommonHandler.instance().bus().post(event);
|
||||||
|
if (!event.getResult().equals(Result.DENY)) FMLCommonHandler.instance().bus()
|
||||||
|
.post(new PostConfigChangedEvent(modID, configID, isWorldRunning, false));
|
||||||
|
|
||||||
|
if (this.parentScreen instanceof GuiConfig) ((GuiConfig) this.parentScreen).needsRefresh = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mc.displayGuiScreen(this.parentScreen);
|
||||||
|
} else if (button.id == 2001) {
|
||||||
|
setToDefault();
|
||||||
|
} else if (button.id == 2002) {
|
||||||
|
undoChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return disabledEntries != null && orderEntries != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void undoChanges() {
|
||||||
|
disabledEntries.initEntries(Arrays.asList(beforeDisabledValue));
|
||||||
|
orderEntries.initEntries(Arrays.asList(beforeOrderValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToDefault() {
|
||||||
|
disabledEntries.initEntries(Arrays.asList(disabledElement.getList()));
|
||||||
|
orderEntries.initEntries(Arrays.asList(orderElement.getList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefault() {
|
||||||
|
return !orderEntries.areContentEqual(orderElement.getDefaults())
|
||||||
|
|| !disabledEntries.areContentEqual(disabledElement.getDefaults());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChanged() {
|
||||||
|
return !orderEntries.areContentEqual(beforeOrderValue) || !disabledEntries.areContentEqual(beforeDisabledValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the mouse is clicked.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int x, int y, int mouseEvent) {
|
||||||
|
if (mouseEvent != 0 || !this.disabledEntries.func_148179_a(x, y, mouseEvent)
|
||||||
|
&& !this.orderEntries.func_148179_a(x, y, mouseEvent)) {
|
||||||
|
super.mouseClicked(x, y, mouseEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is
|
||||||
|
* mouseMove, which==0 or which==1 is mouseUp
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void mouseMovedOrUp(int x, int y, int mouseEvent) {
|
||||||
|
if (mouseEvent != 0 || !this.disabledEntries.func_148181_b(x, y, mouseEvent)
|
||||||
|
&& !this.orderEntries.func_148181_b(x, y, mouseEvent)) {
|
||||||
|
super.mouseMovedOrUp(x, y, mouseEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char eventChar, int eventKey) {
|
||||||
|
if (eventKey == Keyboard.KEY_ESCAPE) this.mc.displayGuiScreen(parentScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
String trimStringToWidth(String str, int width) {
|
||||||
|
int strwidth = mc.fontRenderer.getStringWidth(str);
|
||||||
|
int elipsisWidth = mc.fontRenderer.getStringWidth(OMITTED);
|
||||||
|
if (strwidth > width - elipsisWidth && elipsisWidth > strwidth) {
|
||||||
|
return mc.fontRenderer.trimStringToWidth(str, width - elipsisWidth).trim() + OMITTED;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the screen and all the components in it.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
for (EntriesList list : lists) {
|
||||||
|
list.handleDrag(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
this.drawDefaultBackground();
|
||||||
|
for (EntriesList list : lists) {
|
||||||
|
list.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 8, 16777215);
|
||||||
|
String title2 = this.titleLine2;
|
||||||
|
|
||||||
|
if (title2 != null) {
|
||||||
|
title2 = trimStringToWidth(title2, width - 6);
|
||||||
|
this.drawCenteredString(this.fontRendererObj, title2, this.width / 2, 18, 16777215);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.btnUndoAll.enabled = isChanged();
|
||||||
|
this.btnDefault.enabled = isDefault();
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
for (EntriesList list : lists) {
|
||||||
|
list.drawScreenPost(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
if (this.undoHoverChecker.checkHover(mouseX, mouseY)) this.drawToolTip(
|
||||||
|
this.mc.fontRenderer.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.undoAll"), 300),
|
||||||
|
mouseX,
|
||||||
|
mouseY);
|
||||||
|
if (this.resetHoverChecker.checkHover(mouseX, mouseY)) this.drawToolTip(
|
||||||
|
this.mc.fontRenderer.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.resetAll"), 300),
|
||||||
|
mouseX,
|
||||||
|
mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public void drawToolTip(List stringList, int x, int y) {
|
||||||
|
this.func_146283_a(stringList, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EntriesList extends GuiListExtended {
|
||||||
|
|
||||||
|
final String heading;
|
||||||
|
final List<ListEntry> entries = new ArrayList<>();
|
||||||
|
int controlX;
|
||||||
|
|
||||||
|
public EntriesList(int width, int left, String heading) {
|
||||||
|
super(
|
||||||
|
mc,
|
||||||
|
width,
|
||||||
|
GuiEditRegistryConfig.this.height,
|
||||||
|
titleLine2 != null ? 33 : 23,
|
||||||
|
GuiEditRegistryConfig.this.height - 32,
|
||||||
|
20);
|
||||||
|
this.heading = heading;
|
||||||
|
if (heading != null) {
|
||||||
|
setHasListHeader(true, mc.fontRenderer.FONT_HEIGHT + 4);
|
||||||
|
}
|
||||||
|
setSlotXBoundsFromLeft(left);
|
||||||
|
this.controlX = this.getScrollBarX() - 20;
|
||||||
|
lists.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int p_148128_1_, int p_148128_2_, float p_148128_3_) {
|
||||||
|
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||||
|
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||||
|
GL11.glScissor(
|
||||||
|
(left - 4) * scaledresolution.getScaleFactor(),
|
||||||
|
(int) ((scaledresolution.getScaledHeight_double() - (bottom + 4))
|
||||||
|
* scaledresolution.getScaleFactor()),
|
||||||
|
(width + 8) * scaledresolution.getScaleFactor(),
|
||||||
|
(height + 8) * scaledresolution.getScaleFactor());
|
||||||
|
super.drawScreen(p_148128_1_, p_148128_2_, p_148128_3_);
|
||||||
|
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void overlayBackground(int p_148136_1_, int p_148136_2_, int p_148136_3_, int p_148136_4_) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawContainerBackground(Tessellator tessellator) {
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 1);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorRGBA_I(0, 64);
|
||||||
|
tessellator.addVertex(left, bottom, 0);
|
||||||
|
tessellator.addVertex(right, bottom, 0);
|
||||||
|
tessellator.addVertex(right, top, 0);
|
||||||
|
tessellator.addVertex(left, top, 0);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) {
|
||||||
|
if (heading == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FontRenderer fr = mc.fontRenderer;
|
||||||
|
fr.drawString(
|
||||||
|
this.heading,
|
||||||
|
p_148129_1_ + this.width / 2 - fr.getStringWidth(this.heading) / 2,
|
||||||
|
Math.min(this.top + 3, p_148129_2_),
|
||||||
|
0xffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reinit(int width, int left) {
|
||||||
|
this.width = width;
|
||||||
|
this.bottom = GuiEditRegistryConfig.this.height - 32;
|
||||||
|
this.setSlotXBoundsFromLeft(left);
|
||||||
|
this.controlX = this.getScrollBarX() - 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initEntries(Iterable<?> entries) {
|
||||||
|
this.controlX = this.getScrollBarX() - 20;
|
||||||
|
this.entries.clear();
|
||||||
|
for (Object entry : entries) {
|
||||||
|
addEntry(new ListEntry(entry.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addEntry(ListEntry entry) {
|
||||||
|
entry.entriesList = this;
|
||||||
|
this.entries.add(entry);
|
||||||
|
this.controlX = Math.min(this.controlX, this.getScrollBarX() - entry.getControlSetWidth() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGuiListEntry getListEntry(int i) {
|
||||||
|
return entries.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getSize() {
|
||||||
|
return entries.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getLabelX() {
|
||||||
|
return left + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getControlX() {
|
||||||
|
return controlX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getListWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getScrollBarX() {
|
||||||
|
return left + getListWidth() - 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDrag(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
for (int i = 0, entriesSize = entries.size(); i < entriesSize; i++) {
|
||||||
|
ListEntry entry = entries.get(i);
|
||||||
|
if (entry.handleDrag(i, mouseX, mouseY, partialTicks)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreenPost(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
for (ListEntry entry : entries) {
|
||||||
|
entry.drawToolTip(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areContentEqual(Object[] vals) {
|
||||||
|
if (vals.length != entries.size()) return false;
|
||||||
|
for (int i = 0; i < entries.size(); i++) {
|
||||||
|
ListEntry entry = entries.get(i);
|
||||||
|
if (!entry.name.equals(vals[i])) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ListEntry implements GuiListExtended.IGuiListEntry {
|
||||||
|
|
||||||
|
private EntriesList entriesList;
|
||||||
|
private final HoverChecker hoverCheckerText = new HoverChecker(0, 0, 0, 0, 0);
|
||||||
|
final String name;
|
||||||
|
final String localizedName;
|
||||||
|
private final String tooltip;
|
||||||
|
public boolean modified = false;
|
||||||
|
|
||||||
|
private final GuiButtonExt btnDrag = new GuiButtonDrag(1, 0, 0, 20, 20);
|
||||||
|
private final HoverChecker hoverCheckerBtnDrag = new HoverChecker(btnDrag, 800);
|
||||||
|
private boolean isDragging = false;
|
||||||
|
private long lastScroll = 0;
|
||||||
|
|
||||||
|
ListEntry(String name) {
|
||||||
|
this.name = name;
|
||||||
|
String nameKey = "structurelib.sortedregistry." + registryName + "." + name;
|
||||||
|
this.localizedName = trans(nameKey, name);
|
||||||
|
|
||||||
|
String tooltipKey = nameKey + ".tooltip";
|
||||||
|
String tooltip = trans(tooltipKey, null);
|
||||||
|
StringBuilder tooltipBuilder = new StringBuilder();
|
||||||
|
tooltipBuilder.append(EnumChatFormatting.GREEN);
|
||||||
|
tooltipBuilder.append(this.localizedName);
|
||||||
|
if (tooltip != null) {
|
||||||
|
tooltipBuilder.append('\n').append(EnumChatFormatting.YELLOW).append(tooltip);
|
||||||
|
}
|
||||||
|
tooltipBuilder.append('\n');
|
||||||
|
tooltipBuilder.append(EnumChatFormatting.DARK_GRAY);
|
||||||
|
tooltipBuilder.append(this.name);
|
||||||
|
this.tooltip = tooltipBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator,
|
||||||
|
int mouseX, int mouseY, boolean isSelected) {
|
||||||
|
drawOutlineBox(x, y, listWidth, slotHeight, tessellator);
|
||||||
|
drawLabel(y, slotHeight);
|
||||||
|
drawControlSet(y, slotHeight, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawOutlineBox(int x, int y, int listWidth, int slotHeight, Tessellator tessellator) {
|
||||||
|
if (isDragging) {
|
||||||
|
// left x, right x, top y, bottom y
|
||||||
|
int lx = x, rx = entriesList.getScrollBarX() - 4, ty = y, by = y + slotHeight;
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorOpaque_I(0x808080);
|
||||||
|
tessellator.addVertexWithUV(lx - 4, by + 4, 0.0D, 0.0D, 1.0D);
|
||||||
|
tessellator.addVertexWithUV(rx + 4, by + 4, 0.0D, 1.0D, 1.0D);
|
||||||
|
tessellator.addVertexWithUV(rx + 4, ty - 4, 0.0D, 1.0D, 0.0D);
|
||||||
|
tessellator.addVertexWithUV(lx - 4, ty - 4, 0.0D, 0.0D, 0.0D);
|
||||||
|
tessellator.setColorOpaque_I(0x202020);
|
||||||
|
tessellator.addVertexWithUV(lx - 2, by + 2, 0.0D, 0.0D, 1.0D);
|
||||||
|
tessellator.addVertexWithUV(rx + 2, by + 2, 0.0D, 1.0D, 1.0D);
|
||||||
|
tessellator.addVertexWithUV(rx + 2, ty - 2, 0.0D, 1.0D, 0.0D);
|
||||||
|
tessellator.addVertexWithUV(lx - 2, ty - 2, 0.0D, 0.0D, 0.0D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawControlSet(int y, int slotHeight, int mouseX, int mouseY) {
|
||||||
|
btnDrag.xPosition = entriesList.getControlX();
|
||||||
|
btnDrag.yPosition = y + (slotHeight - btnDrag.height) / 2;
|
||||||
|
btnDrag.drawButton(mc, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawLabel(int y, int slotHeight) {
|
||||||
|
String label = modified ? EnumChatFormatting.ITALIC + localizedName : localizedName;
|
||||||
|
int allowedWidth = entriesList.getControlX() - entriesList.getLabelX() - 4;
|
||||||
|
// probably not very wise to recompute this every render tick, but it doesn't matter for now
|
||||||
|
String toDraw = trimStringToWidth(label, allowedWidth);
|
||||||
|
hoverCheckerText.updateBounds(
|
||||||
|
y + slotHeight / 2 - mc.fontRenderer.FONT_HEIGHT / 2,
|
||||||
|
y + slotHeight / 2 + mc.fontRenderer.FONT_HEIGHT / 2,
|
||||||
|
entriesList.getLabelX(),
|
||||||
|
entriesList.getLabelX() + mc.fontRenderer.getStringWidth(toDraw));
|
||||||
|
|
||||||
|
mc.fontRenderer.drawString(
|
||||||
|
toDraw,
|
||||||
|
entriesList.getLabelX(),
|
||||||
|
y + slotHeight / 2 - mc.fontRenderer.FONT_HEIGHT / 2,
|
||||||
|
getLabelColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawToolTip(int mouseX, int mouseY) {
|
||||||
|
// ensure checkHover() is always called, or the hover threshold might fail under certain corner cases
|
||||||
|
if (hoverCheckerText.checkHover(mouseX, mouseY)) {
|
||||||
|
GuiEditRegistryConfig.this.drawToolTip(
|
||||||
|
mc.fontRenderer.listFormattedStringToWidth(tooltip, entriesList.getListWidth()),
|
||||||
|
mouseX,
|
||||||
|
mouseY);
|
||||||
|
}
|
||||||
|
if (hoverCheckerBtnDrag.checkHover(mouseX, mouseY) && !isDragging) {
|
||||||
|
GuiEditRegistryConfig.this.drawToolTip(
|
||||||
|
mc.fontRenderer.listFormattedStringToWidth(
|
||||||
|
I18n.format("structurelib.configgui.drag.tooltip"),
|
||||||
|
entriesList.getListWidth()),
|
||||||
|
mouseX,
|
||||||
|
mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getLabelColor() {
|
||||||
|
return isDragging ? 0x888888 : 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getControlSetWidth() {
|
||||||
|
return this.btnDrag.getButtonWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean handleDrag(int index, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
if (!isDragging) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (EntriesList list : lists) {
|
||||||
|
if (list == entriesList) continue;
|
||||||
|
if (mouseX > list.left && mouseX < list.right && mouseY > list.top && mouseY < list.bottom) {
|
||||||
|
int l;
|
||||||
|
if (list.entries.isEmpty()) l = 0;
|
||||||
|
else l = list.func_148124_c(mouseX, mouseY);
|
||||||
|
if (l < 0) {
|
||||||
|
if (mouseY < (list.bottom + list.top) / 2) {
|
||||||
|
l = 0;
|
||||||
|
} else {
|
||||||
|
l = list.entries.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entriesList.func_148143_b(true);
|
||||||
|
entriesList.entries.remove(index);
|
||||||
|
list.func_148143_b(false);
|
||||||
|
list.entries.add(l, this);
|
||||||
|
this.entriesList = list;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
if (now - lastScroll > 20) {
|
||||||
|
if (mouseY < entriesList.top) {
|
||||||
|
entriesList.scrollBy(-3);
|
||||||
|
lastScroll = now;
|
||||||
|
} else if (mouseY > entriesList.bottom) {
|
||||||
|
entriesList.scrollBy(3);
|
||||||
|
lastScroll = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int l = entriesList.func_148124_c(
|
||||||
|
MathHelper.clamp_int(mouseX, entriesList.left, entriesList.right),
|
||||||
|
MathHelper.clamp_int(mouseY, entriesList.top, entriesList.bottom));
|
||||||
|
if (l < 0 || l == index) return true;
|
||||||
|
entriesList.entries.remove(index);
|
||||||
|
entriesList.entries.add(l, this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(int index, int x, int y, int mouseEvent, int relativeX, int relativeY) {
|
||||||
|
isDragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY) {
|
||||||
|
if (btnDrag.mousePressed(mc, x, y)) {
|
||||||
|
isDragging = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String trans(String transKey, String fallback) {
|
||||||
|
String translated = I18n.format(transKey);
|
||||||
|
return translated.equals(transKey) ? fallback : translated;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class GuiButtonDrag extends GuiButtonExt {
|
||||||
|
|
||||||
|
public GuiButtonDrag(int id, int xPos, int yPos, int width, int height) {
|
||||||
|
super(id, xPos, yPos, width, height, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||||
|
if (this.visible) {
|
||||||
|
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||||
|
&& mouseX < this.xPosition + this.width
|
||||||
|
&& mouseY < this.yPosition + this.height;
|
||||||
|
int k = this.getHoverState(this.field_146123_n);
|
||||||
|
GuiUtils.drawContinuousTexturedBox(
|
||||||
|
buttonTextures,
|
||||||
|
this.xPosition,
|
||||||
|
this.yPosition,
|
||||||
|
0,
|
||||||
|
46 + k * 20,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
200,
|
||||||
|
20,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
this.zLevel);
|
||||||
|
mc.renderEngine.bindTexture(new ResourceLocation("structurelib", "textures/gui/fourwayarrow2.png"));
|
||||||
|
int x = this.xPosition + (this.width - 12) / 2;
|
||||||
|
int y = this.yPosition + (this.height - 12) / 2;
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.addVertexWithUV(x, y + 12, zLevel, 0, 1);
|
||||||
|
tessellator.addVertexWithUV(x + 12, y + 12, zLevel, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(x + 12, y, zLevel, 1, 0);
|
||||||
|
tessellator.addVertexWithUV(x, y, zLevel, 0, 0);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.IModGuiFactory;
|
||||||
|
|
||||||
|
public class GuiFactory implements IModGuiFactory {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(Minecraft minecraftInstance) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||||
|
return GuiModConfig.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.structurelib.gui.EmptyContainer;
|
||||||
|
import com.gtnewhorizon.structurelib.gui.GuiScreenConfigureChannels;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
|
public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
switch (ID) {
|
||||||
|
case 0:
|
||||||
|
return new EmptyContainer(player);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
switch (ID) {
|
||||||
|
case 0:
|
||||||
|
return new GuiScreenConfigureChannels(new EmptyContainer(player), player.inventory.getStackInSlot(x));
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
|
import cpw.mods.fml.client.config.IConfigElement;
|
||||||
|
|
||||||
|
public class GuiModConfig extends GuiConfig {
|
||||||
|
|
||||||
|
public GuiModConfig(GuiScreen guiScreen) {
|
||||||
|
super(
|
||||||
|
guiScreen,
|
||||||
|
getConfigElements(),
|
||||||
|
StructureLibAPI.MOD_ID,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
GuiConfig.getAbridgedConfigPath(ConfigurationHandler.INSTANCE.getConfig().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private static List<IConfigElement> getConfigElements() {
|
||||||
|
final Configuration config = ConfigurationHandler.INSTANCE.getConfig();
|
||||||
|
return config.getCategoryNames().stream().filter(name -> name.indexOf('.') == -1)
|
||||||
|
.map(name -> new ConfigElement(config.getCategory(name))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
public interface IStructureCompat {
|
||||||
|
|
||||||
|
void markTextureUsed(IIcon o);
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.gtnewhorizon.structurelib;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
|
import cpw.mods.fml.client.config.GuiConfigEntries;
|
||||||
|
import cpw.mods.fml.client.config.IConfigElement;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
public final class RegistryOrderEntry extends GuiConfigEntries.CategoryEntry {
|
||||||
|
|
||||||
|
public RegistryOrderEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList,
|
||||||
|
IConfigElement<?> configElement) {
|
||||||
|
super(owningScreen, owningEntryList, configElement);
|
||||||
|
}
|
||||||
|
|||||||