mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-24 09:24:29 +00:00
Compare commits
160
Commits
1.0.0
...
1.4.0-beta0003
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71ead0785e | ||
|
|
4aca859012 | ||
|
|
ff0dce66f5 | ||
|
|
9a3126d7f9 | ||
|
|
7ff89947ea | ||
|
|
39e6b70922 | ||
|
|
bbe23d663d | ||
|
|
5d3bb1bc77 | ||
|
|
69d09fc70f | ||
|
|
973a178fad | ||
|
|
4233905892 | ||
|
|
890e04d0dc | ||
|
|
edba4b6145 | ||
|
|
595779ea21 | ||
|
|
6c78eb217e | ||
|
|
2f88904515 | ||
|
|
763aa9889a | ||
|
|
7ff1c55036 | ||
|
|
822e2688b9 | ||
|
|
4c6b927eb4 | ||
|
|
c19dee3682 | ||
|
|
2d93a1e080 | ||
|
|
5bddcb0346 | ||
|
|
8e83ba76d4 | ||
|
|
dd26846984 | ||
|
|
2268011f5d | ||
|
|
356a980bc7 | ||
|
|
c00c54e686 | ||
|
|
1ed846b29e | ||
|
|
54f216922f | ||
|
|
582a83a7a6 | ||
|
|
b7d7398c04 | ||
|
|
71fb7a86a7 | ||
|
|
31189ae9d1 | ||
|
|
34a8ff7833 | ||
|
|
e44229300a | ||
|
|
d2cdf2f345 | ||
|
|
6272dd6929 | ||
|
|
9ef1b8fabb | ||
|
|
4b967882e0 | ||
|
|
444cef7482 | ||
|
|
33af25e6fe | ||
|
|
95f0d8d62e | ||
|
|
3a271b1930 | ||
|
|
ad330ec622 | ||
|
|
6892b59e4d | ||
|
|
0f51273d5b | ||
|
|
f1a7c548da | ||
|
|
7d40fbef5a | ||
|
|
5e024d8a0c | ||
|
|
fb3ac74956 | ||
|
|
600c28edbb | ||
|
|
86f9e54251 | ||
|
|
322e267e48 | ||
|
|
3d834429f9 | ||
|
|
7ccf86928f | ||
|
|
b721edafe0 | ||
|
|
642a99ea7b | ||
|
|
1aa130549e | ||
|
|
69a4c18eab | ||
|
|
927eee5844 | ||
|
|
4b90a090f8 | ||
|
|
81ad254832 | ||
|
|
4fa9674a0d | ||
|
|
f4b2460ad7 | ||
|
|
b3c96056b2 | ||
|
|
24796dab0c | ||
|
|
3ceaa51119 | ||
|
|
eebb1d629e | ||
|
|
b1c8d1edb2 | ||
|
|
4b23b1949c | ||
|
|
0e32ffebae | ||
|
|
ef52fa6e51 | ||
|
|
42c59a668f | ||
|
|
9d24a015ff | ||
|
|
3b85cf7db5 | ||
|
|
15803fceff | ||
|
|
4a185892ea | ||
|
|
a2d354dd38 | ||
|
|
5c3f35a855 | ||
|
|
1082b5538f | ||
|
|
9bb729071b | ||
|
|
f28d5fbc3e | ||
|
|
3c53ecf624 | ||
|
|
0c3e745afa | ||
|
|
d594898485 | ||
|
|
85689649bd | ||
|
|
04ddf0c29a | ||
|
|
fb6fb88a49 | ||
|
|
8e23dd1f07 | ||
|
|
362e1dc9ca | ||
|
|
a2774e84ef | ||
|
|
f315774db4 | ||
|
|
6e66066f65 | ||
|
|
76a9345665 | ||
|
|
bf57fac244 | ||
|
|
f2450e0bda | ||
|
|
72a65de83f | ||
|
|
254a438ba1 | ||
|
|
88174167ae | ||
|
|
31ba27c584 | ||
|
|
d3dfc3dbc2 | ||
|
|
f099ac4bf7 | ||
|
|
9735717af4 | ||
|
|
7de5788013 | ||
|
|
413a113a4c | ||
|
|
a44be1dc1e | ||
|
|
53a9fa8cf7 | ||
|
|
948220dedc | ||
|
|
d3d6e73f68 | ||
|
|
4cdc933192 | ||
|
|
ba2b4e360a | ||
|
|
e86f0fc29f | ||
|
|
cad9285c10 | ||
|
|
73d7d3459e | ||
|
|
d1666b582f | ||
|
|
5ec489592a | ||
|
|
b820a8af28 | ||
|
|
4cdbd06fda | ||
|
|
e3820669f8 | ||
|
|
42b2968fde | ||
|
|
32e88ec680 | ||
|
|
b46cd34868 | ||
|
|
6bcf0e8bd5 | ||
|
|
e468253906 | ||
|
|
ed3adba5e3 | ||
|
|
2a72daa6cf | ||
|
|
072ca7bcf8 | ||
|
|
164ec7b923 | ||
|
|
b92ae7985f | ||
|
|
f15acb23ba | ||
|
|
18d1e77e56 | ||
|
|
2efcbe2e16 | ||
|
|
d4b2e9f5da | ||
|
|
e8212e3224 | ||
|
|
066ae631c1 | ||
|
|
1d32553b2d | ||
|
|
2b8bc1c1c1 | ||
|
|
345ec097d7 | ||
|
|
72bfd43b9f | ||
|
|
4f1e4a22cc | ||
|
|
2a4d841b9d | ||
|
|
31e4d39338 | ||
|
|
1d0e0550fa | ||
|
|
5a61d8afe0 | ||
|
|
336c4cd54d | ||
|
|
00d2a28264 | ||
|
|
798f3d6124 | ||
|
|
4aecea7066 | ||
|
|
14a6897297 | ||
|
|
a6420b7580 | ||
|
|
6c9ea1c6fd | ||
|
|
2203ab3a34 | ||
|
|
e96d0db982 | ||
|
|
918e880155 | ||
|
|
1a8aa60577 | ||
|
|
99fde997de | ||
|
|
6967fc26fe | ||
|
|
91da87b4d6 | ||
|
|
fd6061a946 |
No files matched your search
@@ -0,0 +1,55 @@
|
||||
name: Crash
|
||||
description: The game has a problem when EndlessIDs is present
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
assignees:
|
||||
- falsepattern
|
||||
body:
|
||||
# Optional, only for mods that do stuff with rendering/native code
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
description: What kind of operating system do you have?
|
||||
options:
|
||||
- Windows
|
||||
- Linux/BSD
|
||||
- MacOS
|
||||
validations:
|
||||
required: true
|
||||
# Optional, only for graphics mods
|
||||
- type: dropdown
|
||||
id: gpu
|
||||
attributes:
|
||||
label: GPU
|
||||
description: What kind of graphics card do you have? If you have multiple, select the one that minecraft uses, you can usually find it somewhere at the top of the crash report.
|
||||
options:
|
||||
- AMD
|
||||
- NVIDIA
|
||||
- Intel
|
||||
validations:
|
||||
required: true
|
||||
# Recommended for precise context
|
||||
- type: input
|
||||
id: modpack
|
||||
attributes:
|
||||
label: Modpack (Optional)
|
||||
description: If you used the mod in a modpack, you should include the pack's exact name and version here to make debugging easier.
|
||||
validations:
|
||||
required: false
|
||||
# Essential
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Game log
|
||||
description: Attach the fml-client-latest.log file here.
|
||||
validations:
|
||||
required: true
|
||||
# Essential
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Describe how and when you experience this bug.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,78 @@
|
||||
name: Compatibility Request
|
||||
description: If you tested EndlessIDs with another mod and it crashes or has weird bugs, you can ask for a compatibility patch through this.
|
||||
title: "[Compatibility Request]: "
|
||||
labels: ["compat-request"]
|
||||
assignees:
|
||||
- falsepattern
|
||||
body:
|
||||
# Essential
|
||||
- type: input
|
||||
id: modname
|
||||
attributes:
|
||||
label: Other mod's name
|
||||
description: The name of the other mod
|
||||
validations:
|
||||
required: true
|
||||
# Essential
|
||||
- type: input
|
||||
id: modurl
|
||||
attributes:
|
||||
label: Other mod's homepage
|
||||
description: A link to the main site where the other mod is hosted. Preferrably the original website of a mod, but a modrinth/curseforge/whatever page is also acceptable. Do not post a raw download link, those requests will be ignored.
|
||||
validations:
|
||||
required: true
|
||||
# Important
|
||||
- type: dropdown
|
||||
id: license
|
||||
attributes:
|
||||
label: Other mod's license
|
||||
description: What license does the other mod have? (Open source mods are easier to write compatibility patches for)
|
||||
options:
|
||||
- AGPLv3
|
||||
- AGPLv2
|
||||
- GPLv3
|
||||
- GPLv2
|
||||
- LGPLv3
|
||||
- LGPLv2
|
||||
- Apache 2.0
|
||||
- Beerware
|
||||
- BSD 3-Clause
|
||||
- BSD 2-Clause
|
||||
- EPL 2.0
|
||||
- MIT
|
||||
- MPL 2.0
|
||||
- Unlicense
|
||||
- WTFPL
|
||||
- Other open source license (please specify in the description)
|
||||
- All Rights Reserved
|
||||
validations:
|
||||
required: true
|
||||
# Recommended
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Game log
|
||||
description: Attach the fml-client-latest.log file here.
|
||||
validations:
|
||||
required: true
|
||||
# Recommended
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Describe any visual errors that appear, and attach screenshots of them. You can leave this empty if it's a crash without any visible stuff.
|
||||
validations:
|
||||
required: false
|
||||
# Modify this after every added patch
|
||||
# - type: checkboxes
|
||||
# id: existingpatches
|
||||
# attributes:
|
||||
# label: Existing Patches
|
||||
# description: The mods below already have compatibility patches. If you're experiencing issues with those, submit either a crash or a bug report!
|
||||
# options:
|
||||
# - label: This request is not for X
|
||||
# required: true
|
||||
# - label: This request is not for Y
|
||||
# required: true
|
||||
# - label: This request is not for Z
|
||||
# required: true
|
||||
@@ -1,10 +0,0 @@
|
||||
if [ ! -z $(git diff --name-only HEAD HEAD~1 | grep build.gradle) ]; then
|
||||
new_version="$(date +%s)"
|
||||
sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle
|
||||
git add build.gradle
|
||||
git commit -m "[ci skip] update build script version to $new_version"
|
||||
git push
|
||||
echo "Updated buildscript version to $new_version";
|
||||
else
|
||||
echo "Ignored buildscript version update: no changes detected"
|
||||
fi
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
- name: Run server for 1.5 minutes
|
||||
run: |
|
||||
mkdir run
|
||||
mkdir -p run
|
||||
echo "eula=true" > run/eula.txt
|
||||
timeout 90 ./gradlew runServer | tee --append server.log || true
|
||||
|
||||
|
||||
@@ -43,3 +43,9 @@ jobs:
|
||||
prerelease: false
|
||||
title: "${{ env.RELEASE_VERSION }}"
|
||||
files: build/libs/*.jar
|
||||
|
||||
- name: Publish to maven
|
||||
run: ./gradlew publish
|
||||
env:
|
||||
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
|
||||
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
|
||||
+1
-2
@@ -144,5 +144,4 @@ gradle-app.setting
|
||||
.classpath
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
|
||||
|
||||
srgmap.cfg
|
||||
!lib/*.jar
|
||||
Generated
+66
@@ -0,0 +1,66 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
||||
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value />
|
||||
</option>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net.minecraft" withSubpackages="true" static="false" />
|
||||
<package name="net.minecraftforge" withSubpackages="true" static="false" />
|
||||
<package name="cpw" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
||||
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
||||
</JavaCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="RESOURCE_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="ASSERT_STATEMENT_WRAP" value="1" />
|
||||
<option name="ASSERT_STATEMENT_COLON_ON_NEXT_LINE" value="true" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<option name="PARAMETER_ANNOTATION_WRAP" value="1" />
|
||||
<option name="VARIABLE_ANNOTATION_WRAP" value="5" />
|
||||
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
||||
<option name="WRAP_ON_TYPING" value="0" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
-165
@@ -1,165 +0,0 @@
|
||||
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.
|
||||
-674
@@ -1,674 +0,0 @@
|
||||
GNU 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,21 +1,165 @@
|
||||
MIT License
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (c) 2021 Johann Bernhardt
|
||||
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.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
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.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
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.
|
||||
@@ -1,6 +1,68 @@
|
||||
EndlessIDs is a modern rewrite of NotEnoughIDs which increases the limit even more, up to the maximum 24 bit unsigned integer value.
|
||||
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
||||
new limits.
|
||||
|
||||
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
||||
|-----------|---------|--------------|------------|
|
||||
| Block IDs | 4096 | 32000 | 16777216 |
|
||||
| Item IDs | 32000 | 32000 | 16777216 |
|
||||
Comparison of the known limits:
|
||||
|
||||
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
||||
|-----------------|----------------------------------------------------|--------------|----------------------------------|
|
||||
| Block IDs | 4,096 | 32,000 | 16,777,216 |
|
||||
| Item IDs | 32,000 | 32,000 | 16,777,216 |
|
||||
| Biome IDs | 256 | 256 | 65,536 |
|
||||
| Entity IDs | 256 | 256 | 256 right now, extension planned |
|
||||
| Potion IDs | 32 | 32 | 32 right now, extension planned |
|
||||
| Enchantment IDs | 256 | 256 | 256 right now, extension planned |
|
||||
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same |
|
||||
|
||||
This mod also contains patches for the following mods:
|
||||
|
||||
- AbyssalCraft
|
||||
- Alternate Terrain Generation
|
||||
- Antique Atlas
|
||||
- Anti ID Conflict
|
||||
- ArchaicFix
|
||||
- Atum
|
||||
- Biomes O' Plenty
|
||||
- Biome Wand
|
||||
- BuildCraft
|
||||
- ChromatiCraft
|
||||
- Compact Machines
|
||||
- CoFH Lib
|
||||
- Dark World
|
||||
- DragonAPI
|
||||
- Dynamic Surroundings
|
||||
- Enhanced Biomes
|
||||
- Erebus
|
||||
- Extra Planets
|
||||
- Extra Utilities
|
||||
- Futurepack
|
||||
- GalactiCraft
|
||||
- Highlands
|
||||
- Immersive Cavegen
|
||||
- LOTR
|
||||
- More Fun Quicksand Mod
|
||||
- Nature's Compass
|
||||
- Netherlicious
|
||||
- Random Things
|
||||
- Realistic Terrain Generation
|
||||
- Thaumcraft
|
||||
- Tropicraft
|
||||
- Twilight Forest
|
||||
- Underground Biomes Constructs
|
||||
- WorldEdit
|
||||
|
||||
Mods not listed here may or may not work.
|
||||
|
||||
- For item/block IDs:
|
||||
- A good rule of thumb is that the more invasive a mod is, the higher the chance
|
||||
it's broken without a patch once the IDs exceed 4096 and 32000.
|
||||
- For biome IDs:
|
||||
- If a mod adds a custom world generator, it has a high chance of invoking an old vanilla method in the worldgen code.
|
||||
|
||||
To avoid world corruption and broken biomes, this method has been replaced with an instant crash that refers the
|
||||
user to this github repo.
|
||||
|
||||
If you find any crashes or incompatibilities, don't hesitate to open an issue.
|
||||
|
||||
## Dependencies
|
||||
- [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
|
||||
- [SpongeMixins](https://github.com/TimeConqueror/SpongeMixins)
|
||||
+460
-102
@@ -1,4 +1,4 @@
|
||||
//version: 1641429628falsepattern12
|
||||
//version: 1656003793falsepattern34
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
|
||||
@@ -9,14 +9,22 @@ Please check https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/build.gr
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "https://maven.minecraftforge.net"
|
||||
url = "https://mvn.falsepattern.com/forge"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
@@ -28,22 +36,37 @@ buildscript {
|
||||
}
|
||||
maven {
|
||||
name = "jitpack"
|
||||
url = "https://jitpack.falsepattern.com/"
|
||||
url = "https://mvn.falsepattern.com/jitpack/"
|
||||
}
|
||||
maven {
|
||||
name = "mavenpattern"
|
||||
url = "https://mvn.falsepattern.com/releases/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.6'
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
classpath 'com.falsepattern:jtweaker:0.2.1'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'scala'
|
||||
id("org.ajoberstar.grgit") version("3.1.1")
|
||||
id("com.github.johnrengelman.shadow") version("4.0.4")
|
||||
id("com.palantir.git-version") version("0.12.3")
|
||||
id("maven-publish")
|
||||
id 'maven-publish'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
|
||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
||||
id 'com.palantir.git-version' version '0.13.0'
|
||||
id 'de.undercouch.download' version '5.0.1'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
||||
}
|
||||
apply plugin: 'com.falsepattern.jtweaker'
|
||||
|
||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
@@ -89,34 +112,43 @@ checkPropertyExists("usesShadowedDependencies")
|
||||
checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
//Properties added in fork
|
||||
checkPropertyExists("skipBuildScriptUpdateCheck")
|
||||
checkPropertyExists("repositoryURL")
|
||||
checkPropertyExists("repositoryName")
|
||||
checkPropertyExists("mavenGroupId")
|
||||
checkPropertyExists("mavenArtifactId")
|
||||
checkPropertyExists("hasMixinDeps")
|
||||
propertyDefaultIfUnset("skipBuildScriptUpdateCheck", false)
|
||||
propertyDefaultIfUnset("repositoryURL", "")
|
||||
propertyDefaultIfUnset("repositoryName", "")
|
||||
propertyDefaultIfUnset("mavenGroupId", "")
|
||||
propertyDefaultIfUnset("mavenArtifactId", "")
|
||||
propertyDefaultIfUnset("hasMixinDeps", false)
|
||||
propertyDefaultIfUnset("mixinPreinitConfig", "")
|
||||
propertyDefaultIfUnset("remapStubs", false)
|
||||
propertyDefaultIfUnset("useObsoleteSpongeMixins", false)
|
||||
|
||||
propertyDefaultIfUnset("remoteMappings", "https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/")
|
||||
propertyDefaultIfUnset("mappingsChannel", "stable")
|
||||
propertyDefaultIfUnset("mappingsVersion", "12")
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
String kotlinSourceDir = "src/main/kotlin/"
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
if(apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||
if(getFile(targetFile).exists() == false) {
|
||||
if(!getFile(targetFile).exists()) {
|
||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||
}
|
||||
}
|
||||
@@ -128,15 +160,17 @@ if(usesMixins.toBoolean()) {
|
||||
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
|
||||
}
|
||||
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,8 +178,9 @@ if(coreModClass) {
|
||||
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
||||
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,13 +193,35 @@ configurations.all {
|
||||
}
|
||||
|
||||
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
|
||||
'git config core.fileMode false'.execute()
|
||||
// Pulls version from git tag
|
||||
try {
|
||||
version = gitVersion()
|
||||
'git config core.fileMode false'.execute()
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).println("git isn't installed at all")
|
||||
}
|
||||
|
||||
// Pulls version first from the VERSION env and then git tag
|
||||
String identifiedVersion
|
||||
String versionOverride = System.getenv("VERSION") ?: null
|
||||
try {
|
||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).text(
|
||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
||||
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
||||
)
|
||||
versionOverride = 'NO-GIT-TAG-SET'
|
||||
identifiedVersion = versionOverride
|
||||
}
|
||||
version = identifiedVersion
|
||||
ext {
|
||||
modVersion = identifiedVersion
|
||||
}
|
||||
|
||||
if(identifiedVersion == versionOverride) {
|
||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
@@ -189,7 +246,7 @@ minecraft {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
replace gradleTokenVersion, versionDetails().lastTag
|
||||
replace gradleTokenVersion, modVersion
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
@@ -215,51 +272,67 @@ repositories {
|
||||
url = "https://gregtech.overminddl1.com/"
|
||||
}
|
||||
if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://sponge.falsepattern.com/"
|
||||
if (useObsoleteSpongeMixins.toBoolean()) {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://mvn.falsepattern.com/sponge"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.falsepattern.com/"
|
||||
url = "https://mvn.falsepattern.com/jitpack"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if(usesMixins.toBoolean()) {
|
||||
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
||||
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
||||
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
||||
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
|
||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: "launchwrapper"
|
||||
exclude module: "guava"
|
||||
exclude module: "gson"
|
||||
exclude module: "commons-io"
|
||||
exclude module: "log4j-core"
|
||||
if (useObsoleteSpongeMixins.toBoolean()) {
|
||||
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
||||
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
||||
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
||||
annotationProcessor("org.spongepowered:mixin:0.8-20200110.181151-15")
|
||||
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||
compile("org.spongepowered:mixin:0.7.11-20180703.121122-1") {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: "launchwrapper"
|
||||
exclude module: "guava"
|
||||
exclude module: "gson"
|
||||
exclude module: "commons-io"
|
||||
exclude module: "log4j-core"
|
||||
}
|
||||
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||
} else {
|
||||
compile("com.github.tox1cozZ:mixin-booter-legacy:1.1.2")
|
||||
annotationProcessor("com.github.tox1cozZ:mixin-booter-legacy:1.1.2:processor")
|
||||
}
|
||||
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||
}
|
||||
if(hasMixinDeps.toBoolean()) {
|
||||
runtime("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: "launchwrapper"
|
||||
exclude module: "guava"
|
||||
exclude module: "gson"
|
||||
exclude module: "commons-io"
|
||||
exclude module: "log4j-core"
|
||||
if (useObsoleteSpongeMixins.toBoolean()) {
|
||||
runtime("org.spongepowered:mixin:0.7.11-20180703.121122-1") {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: "launchwrapper"
|
||||
exclude module: "guava"
|
||||
exclude module: "gson"
|
||||
exclude module: "commons-io"
|
||||
exclude module: "log4j-core"
|
||||
}
|
||||
runtime("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||
} else {
|
||||
runtime("com.github.tox1cozZ:mixin-booter-legacy:1.1.2")
|
||||
}
|
||||
runtime("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
|
||||
def mixinDir = new File(project.buildDir, 'mixins')
|
||||
if (!mixinDir.exists()) {
|
||||
mixinDir.mkdirs()
|
||||
}
|
||||
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
|
||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
|
||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||
def srgFile = new File(project.buildDir, 'srgs/mcp-srg.srg')
|
||||
def mixinSrg = new File(mixinDir, "${mixingConfigRefMap}.srg")
|
||||
def mixinRefMap = new File(mixinDir, mixingConfigRefMap)
|
||||
|
||||
task generateAssets {
|
||||
if(usesMixins.toBoolean()) {
|
||||
@@ -283,6 +356,9 @@ task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
if (remapStubs.toBoolean()) {
|
||||
dependsOn(removeStub)
|
||||
}
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
@@ -299,6 +375,9 @@ shadowJar {
|
||||
}
|
||||
|
||||
jar {
|
||||
if (remapStubs.toBoolean()) {
|
||||
dependsOn(removeStub)
|
||||
}
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
@@ -321,18 +400,14 @@ reobf {
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if(usesMixins.toBoolean()) {
|
||||
tasks.compileJava {
|
||||
options.compilerArgs += [
|
||||
"-AreobfSrgFile=${tasks.reobf.srg}",
|
||||
"-AoutSrgFile=${mixinSrg}",
|
||||
"-AoutRefMapFile=${refMap}",
|
||||
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
||||
"-XDenableSunApiLintControl",
|
||||
"-XDignore.symbol.file"
|
||||
]
|
||||
}
|
||||
if(usesMixins.toBoolean()) {
|
||||
tasks.compileJava {
|
||||
options.compilerArgs += [
|
||||
'-Xlint:-processing',
|
||||
"-AreobfSrgFile=${srgFile}",
|
||||
"-AoutSrgFile=${mixinSrg}",
|
||||
"-AoutRefMapFile=${mixinRefMap}"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,8 +472,7 @@ tasks.withType(JavaExec).configureEach {
|
||||
)
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
processResources {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
@@ -407,18 +481,18 @@ processResources
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
// replace version and mcversion
|
||||
// replace modVersion and minecraftVersion
|
||||
expand "minecraftVersion": project.minecraft.version,
|
||||
"modVersion": versionDetails().lastTag,
|
||||
"modVersion": modVersion,
|
||||
"modId": modId,
|
||||
"modName": modName
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
from mixinRefMap
|
||||
}
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
// copy everything else that's not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
@@ -426,7 +500,7 @@ processResources
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
|
||||
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||
}
|
||||
|
||||
@@ -441,20 +515,23 @@ def getManifestAttributes() {
|
||||
if(usesMixins.toBoolean()) {
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : "mixins." + modId + ".json",
|
||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
||||
"MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""),
|
||||
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
|
||||
]
|
||||
}
|
||||
return manifestAttributes
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allJava)
|
||||
from (sourceSets.main.allSource)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
task shadowDevJar(type: ShadowJar) {
|
||||
if (remapStubs.toBoolean()) {
|
||||
dependsOn(removeStub)
|
||||
}
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
@@ -484,6 +561,9 @@ task circularResolverJar(type: Jar) {
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
if (remapStubs.toBoolean()) {
|
||||
dependsOn(removeStub)
|
||||
}
|
||||
project.configurations.shadeCompile.each { dep ->
|
||||
from(project.zipTree(dep)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
@@ -504,7 +584,7 @@ task devJar(type: Jar) {
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allJava) {
|
||||
from (sourceSets.main.allSource) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
@@ -519,6 +599,14 @@ task apiJar(type: Jar) {
|
||||
getArchiveClassifier().set('api')
|
||||
}
|
||||
|
||||
task copySrgs(type: Copy, dependsOn: 'genSrgs') {
|
||||
from plugins.getPlugin('forge').delayedFile('{SRG_DIR}')
|
||||
include '**/*.srg'
|
||||
into layout.buildDirectory.file('srgs')
|
||||
}
|
||||
|
||||
compileJava.dependsOn(copySrgs)
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives devJar
|
||||
@@ -527,6 +615,15 @@ artifacts {
|
||||
}
|
||||
}
|
||||
|
||||
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
|
||||
// and isn't strictly needed with the POM so just disable it.
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
// workaround variable hiding in pom processing
|
||||
def projectConfigs = project.configurations
|
||||
|
||||
// publishing
|
||||
|
||||
def getMavenSettingsCredentials = {
|
||||
@@ -538,15 +635,20 @@ def getMavenSettingsCredentials = {
|
||||
}
|
||||
|
||||
def getCredentials = {
|
||||
try {
|
||||
def entries = getMavenSettingsCredentials()
|
||||
for (entry in entries) {
|
||||
if (entry."id".text() == repositoryName) {
|
||||
return [username: entry.username.text(), password: entry.password.text()]
|
||||
String username = System.getenv("MAVEN_DEPLOY_USER")
|
||||
String password = System.getenv("MAVEN_DEPLOY_PASSWORD")
|
||||
if (username == null) {
|
||||
try {
|
||||
def entries = getMavenSettingsCredentials()
|
||||
for (entry in entries) {
|
||||
if (entry."id".text() == repositoryName) {
|
||||
return [username: entry.username.text(), password: entry.password.text()]
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception ignored){}
|
||||
return [username: "none", password: "none"]
|
||||
} else {
|
||||
return [username: username, password: password]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,9 +656,12 @@ def getCredentials = {
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifact source: jar
|
||||
artifact source: sourcesJar, classifier: "src"
|
||||
artifact source: devJar, classifier: "dev"
|
||||
from components.java
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
artifact source: shadowJar, classifier: ""
|
||||
}
|
||||
artifact source: sourcesJar, classifier: "sources"
|
||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||
if (apiPackage) {
|
||||
artifact source: apiJar, classifier: "api"
|
||||
}
|
||||
@@ -564,17 +669,38 @@ publishing {
|
||||
groupId = mavenGroupId
|
||||
artifactId = mavenArtifactId + "-mc" + minecraftVersion
|
||||
version = gitVersion()
|
||||
|
||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
||||
pom.withXml {
|
||||
def badArtifacts = [:].withDefault {[] as Set<String>}
|
||||
for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
|
||||
for (dependency in configuration.allDependencies) {
|
||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
||||
}
|
||||
}
|
||||
// example for specifying extra stuff to ignore
|
||||
// badArtifacts["org.example.group"] += "artifactName"
|
||||
|
||||
Node pomNode = asNode()
|
||||
pomNode.dependencies.'*'.findAll() {
|
||||
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
|
||||
}.each() {
|
||||
it.parent().remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = repositoryName
|
||||
url = repositoryURL
|
||||
def creds = getCredentials()
|
||||
credentials {
|
||||
username = creds == null ? "none" : creds.username
|
||||
password = creds == null ? "none" : creds.password
|
||||
if (repositoryURL.trim() != "") {
|
||||
maven {
|
||||
name = repositoryName
|
||||
url = repositoryURL
|
||||
def creds = getCredentials()
|
||||
credentials {
|
||||
username = creds?.username ?: "none"
|
||||
password = creds?.password ?: "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,11 +715,11 @@ task updateBuildScript {
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (!project.getGradle().startParameter.isOffline() && !skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (autoUpdateBuildScript.toBoolean()) {
|
||||
performBuildScriptUpdate(projectDir.toString())
|
||||
} else {
|
||||
println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +731,7 @@ boolean performBuildScriptUpdate(String projectDir) {
|
||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||
def buildscriptFile = getFile("build.gradle")
|
||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
out.println("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -636,14 +762,246 @@ configure(updateBuildScript) {
|
||||
description = 'Updates the build script to the latest version'
|
||||
}
|
||||
|
||||
// Parameter Deobfuscation
|
||||
|
||||
task deobfParams {
|
||||
doLast {
|
||||
|
||||
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion"
|
||||
String mcpZIP = "$mcpDir/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
String paramsCSV = "$mcpDir/params.csv"
|
||||
|
||||
download.run {
|
||||
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion-$minecraftVersion/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip"
|
||||
dest mcpZIP
|
||||
overwrite false
|
||||
}
|
||||
|
||||
if(!file(paramsCSV).exists()) {
|
||||
println("Extracting MCP archive ...")
|
||||
unzip(mcpZIP, mcpDir)
|
||||
}
|
||||
|
||||
println("Parsing params.csv ...")
|
||||
Map<String, String> params = new HashMap<>()
|
||||
Files.lines(Paths.get(paramsCSV)).forEach{line ->
|
||||
String[] cells = line.split(",")
|
||||
if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
|
||||
params.put(cells[0], cells[1])
|
||||
}
|
||||
}
|
||||
|
||||
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
|
||||
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
|
||||
}
|
||||
}
|
||||
|
||||
static int replaceParams(File file, Map<String, String> params) {
|
||||
int fileCount = 0
|
||||
|
||||
if(file.isDirectory()) {
|
||||
for(File f : file.listFiles()) {
|
||||
fileCount += replaceParams(f, params)
|
||||
}
|
||||
return fileCount
|
||||
}
|
||||
println("Visiting ${file.getName()} ...")
|
||||
try {
|
||||
String content = new String(Files.readAllBytes(file.toPath()))
|
||||
int hash = content.hashCode()
|
||||
params.forEach{key, value ->
|
||||
content = content.replaceAll(key, value)
|
||||
}
|
||||
if(hash != content.hashCode()) {
|
||||
Files.write(file.toPath(), content.getBytes("UTF-8"))
|
||||
return 1
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
|
||||
static unzip(String zipFileName, String outputDir) {
|
||||
byte[] buffer = new byte[16384]
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
|
||||
ZipEntry zipEntry = zis.getNextEntry()
|
||||
while (zipEntry != null) {
|
||||
File newFile = new File(outputDir + File.separator, zipEntry.name)
|
||||
if (zipEntry.isDirectory()) {
|
||||
if (!newFile.isDirectory() && !newFile.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $newFile")
|
||||
}
|
||||
} else {
|
||||
// fix for Windows-created archives
|
||||
File parent = newFile.parentFile
|
||||
if (!parent.isDirectory() && !parent.mkdirs()) {
|
||||
throw new IOException("Failed to create directory $parent")
|
||||
}
|
||||
// write file content
|
||||
FileOutputStream fos = new FileOutputStream(newFile)
|
||||
int len = 0
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len)
|
||||
}
|
||||
fos.close()
|
||||
}
|
||||
zipEntry = zis.getNextEntry()
|
||||
}
|
||||
zis.closeEntry()
|
||||
zis.close()
|
||||
}
|
||||
|
||||
configure(deobfParams) {
|
||||
group = 'forgegradle'
|
||||
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
|
||||
}
|
||||
|
||||
// Dependency Deobfuscation
|
||||
|
||||
def deobfMaven(mavenDep) {
|
||||
throw new GradleException("deobfMaven(mavenDep) is deprecated. " +
|
||||
"You must use the new deobfMaven(repoURL, mavenDep) method instead." +
|
||||
"The old method broke the buildscript when used.")
|
||||
}
|
||||
|
||||
def deobfMaven(String repoURL, String mavenDep) {
|
||||
if (!repoURL.endsWith("/")) {
|
||||
repoURL += "/"
|
||||
}
|
||||
String[] parts = mavenDep.split(":")
|
||||
parts[0] = parts[0].replace('.', '/')
|
||||
def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar"
|
||||
return deobf(jarURL)
|
||||
}
|
||||
|
||||
def deobf(String sourceURL) {
|
||||
try {
|
||||
URL url = new URL(sourceURL)
|
||||
String fileName = url.getFile()
|
||||
|
||||
//get rid of directories:
|
||||
int lastSlash = fileName.lastIndexOf("/")
|
||||
if(lastSlash > 0) {
|
||||
fileName = fileName.substring(lastSlash + 1)
|
||||
}
|
||||
//get rid of extension:
|
||||
if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
}
|
||||
|
||||
String hostName = url.getHost()
|
||||
if(hostName.startsWith("www.")) {
|
||||
hostName = hostName.substring(4)
|
||||
}
|
||||
List parts = Arrays.asList(hostName.split("\\."))
|
||||
Collections.reverse(parts)
|
||||
hostName = String.join(".", parts)
|
||||
|
||||
return deobf(sourceURL, "$hostName/$fileName")
|
||||
} catch(Exception e) {
|
||||
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
|
||||
}
|
||||
}
|
||||
|
||||
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
|
||||
def deobf(String sourceURL, String rawFileName) {
|
||||
String bon2Version = "2.5.1"
|
||||
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
|
||||
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
|
||||
String bon2Dir = "$cacheDir/forge_gradle/deobf"
|
||||
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
|
||||
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
|
||||
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
|
||||
|
||||
if(file(deobfFile).exists()) {
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
String mappingsVer
|
||||
if(remoteMappings) {
|
||||
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
|
||||
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
|
||||
|
||||
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
|
||||
|
||||
mappingsVer = "snapshot_$id"
|
||||
} else {
|
||||
mappingsVer = "${mappingsChannel}_$mappingsVersion"
|
||||
}
|
||||
|
||||
download.run {
|
||||
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
|
||||
dest bon2File
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
download.run {
|
||||
src sourceURL
|
||||
dest obfFile
|
||||
quiet true
|
||||
overwrite false
|
||||
}
|
||||
|
||||
exec {
|
||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
||||
workingDir bon2Dir
|
||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
||||
}
|
||||
|
||||
return files(deobfFile)
|
||||
}
|
||||
|
||||
def zipMappings(String zipPath, String url, String bon2Dir) {
|
||||
File zipFile = new File(zipPath)
|
||||
if(zipFile.exists()) {
|
||||
return
|
||||
}
|
||||
|
||||
String fieldsCache = "$bon2Dir/data/fields.csv"
|
||||
String methodsCache = "$bon2Dir/data/methods.csv"
|
||||
|
||||
download.run {
|
||||
src "${url}fields.csv"
|
||||
dest fieldsCache
|
||||
quiet true
|
||||
}
|
||||
download.run {
|
||||
src "${url}methods.csv"
|
||||
dest methodsCache
|
||||
quiet true
|
||||
}
|
||||
|
||||
zipFile.getParentFile().mkdirs()
|
||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
|
||||
|
||||
zos.putNextEntry(new ZipEntry("fields.csv"))
|
||||
Files.copy(Paths.get(fieldsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.putNextEntry(new ZipEntry("methods.csv"))
|
||||
Files.copy(Paths.get(methodsCache), zos)
|
||||
zos.closeEntry()
|
||||
|
||||
zos.close()
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
if (project.hasProperty(propertyName) == false) {
|
||||
if (!project.hasProperty(propertyName)) {
|
||||
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/gradle.properties")
|
||||
}
|
||||
}
|
||||
|
||||
def propertyDefaultIfUnset(String propertyName, defaultValue) {
|
||||
if (!project.hasProperty(propertyName)) {
|
||||
project.ext.setProperty(propertyName, defaultValue)
|
||||
}
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
}
|
||||
@@ -1,6 +1,150 @@
|
||||
static def curse(curseDep) {
|
||||
return "curse.maven:" + curseDep
|
||||
}
|
||||
|
||||
def deobfCurse(curseDep) {
|
||||
try {
|
||||
return deobfMaven("https://cursemaven.com/", curse(curseDep))
|
||||
} catch (Exception ignored) {
|
||||
println("Failed to get dep " + curseDep + " from cursemaven. Grabbing from mirror.")
|
||||
return deobfMaven("https://mvn.falsepattern.com/cursemaven/", curse(curseDep))
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
////////////////Our dependencies////////////////
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.22") {
|
||||
transitive = false
|
||||
}
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.22")
|
||||
|
||||
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.10.5:dev")
|
||||
|
||||
////////////////Patched mods////////////////
|
||||
|
||||
//AbyssalCraft 1.9.1.3-FINAL
|
||||
compile(deobfCurse("abyssalcraft-53686:2311135"))
|
||||
|
||||
//Alternate Terrain Generation 0.12.0
|
||||
compile(deobfCurse("atg-228356:2231155"))
|
||||
|
||||
//Antique Atlas 4.4.4
|
||||
compile(deobfCurse("antiqueatlas-227795:2454232"))
|
||||
|
||||
//Anti ID Conflict 1.3.5
|
||||
compile(deobfCurse("antiidconflict-246288:2308279"))
|
||||
|
||||
// //ArchaicFix 0.2.0
|
||||
// compileOnly("com.github.embeddedt:ArchaicFix:0.2.0:dev")
|
||||
|
||||
//Atum 0.6.77
|
||||
compile(deobfCurse("atum-59621:2256356"))
|
||||
|
||||
//Biomes O' Plenty 2.1.0.2308
|
||||
compile(deobfCurse("biomesoplenty-220318:2499612"))
|
||||
|
||||
//Biome Tweaker 2.0.182
|
||||
compile(deobfCurse("biometweaker-228895:2279911"))
|
||||
|
||||
//Biome Wand 1.1.9
|
||||
//Mirrored at: https://maven.falsepattern.com/mirror/mirror/1.7.10-Biome-Wand-1.1.9.jar
|
||||
compile(deobf("https://spacechase0.com/wp-content/uploads/2014/10/1.7.10-Biome-Wand-1.1.9.jar"))
|
||||
|
||||
//Buildcraft 7.1.24
|
||||
compile(deobfCurse("buildcraft-61811:3538651"))
|
||||
|
||||
//CoFH Lib 1.2.1-185
|
||||
compile(deobfCurse("cofh-lib-220333:2388748"))
|
||||
|
||||
//CompactMachines 1.21
|
||||
compileOnly(deobfCurse("compactmachines-224218:2268575"))
|
||||
|
||||
//Dark World 0.2
|
||||
compile(deobfCurse("darkworld-225075:2225172"))
|
||||
|
||||
//DragonAPI V31b
|
||||
compileOnly(deobfCurse("dragonapi-235591:3574508"))
|
||||
|
||||
//Dynamic Surroundings 1.0.6.4
|
||||
compile(deobfCurse("dynamicsurrounding-238891:2642381"))
|
||||
|
||||
//Enhanced Biomes 2.5
|
||||
compile(deobf("https://maven.falsepattern.com/releases/mirror/mirror/enhancedbiomes-2.5.jar"))
|
||||
|
||||
//Erebus 0.4.7
|
||||
compile(deobfCurse("theerebus-220698:2305035"))
|
||||
|
||||
//Extra Planets 2.1.4
|
||||
compileOnly(deobfCurse("extraplanets-241291:3214413"))
|
||||
|
||||
//Extra Utilities 1.2.12
|
||||
compile(deobfCurse("extrautilities-225561:2264384"))
|
||||
|
||||
//Futurepack v18.7
|
||||
compile(deobfCurse("futurepack-237333:2263966"))
|
||||
|
||||
//Galacticraft Core 3.0.12.504
|
||||
//micdoodle8.com went down
|
||||
compileOnly(deobf("https://maven.falsepattern.com/mirror/mirror/micdoodle/GalacticraftCore-1.7-3.0.12.504.jar"))
|
||||
|
||||
//Galacticraft Planets 3.0.12.504
|
||||
compileOnly(deobf("https://maven.falsepattern.com/mirror/mirror/micdoodle/Galacticraft-Planets-1.7-3.0.12.504.jar"))
|
||||
|
||||
//Highlands 2.2.3
|
||||
compile(deobfCurse("highlands-221226:2227924"))
|
||||
|
||||
//Immersive Cavegen 1.2g
|
||||
compile(deobfCurse("immersivecavegen-521557:3649411"))
|
||||
|
||||
//LOTR Mod 36.14
|
||||
compileOnly(deobfCurse("lotrmod-423748:3646430"))
|
||||
|
||||
//More Fun Quicksands Mod 1.0.8.8-fixed
|
||||
compile(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
||||
|
||||
//Nature's Compass 1.3.1
|
||||
compile(deobfCurse("naturescompass-252848:2451823"))
|
||||
|
||||
//Netherlicious 3.2.3
|
||||
compile(deobfCurse("netherlicious-385860:3858031"))
|
||||
|
||||
//RandomThings 2.2.4
|
||||
compileOnly(deobfCurse("randomthings-59816:2225310"))
|
||||
|
||||
//Realistic Terrain Generation 1.1.1.7
|
||||
compile(deobfCurse("rtg-237989:2521557"))
|
||||
|
||||
//Thaumcraft 4.2.3.5
|
||||
compile(deobfCurse("thaumcraft-223628:2227552"))
|
||||
|
||||
//Tropicraft 6.0.5
|
||||
//This is from a mirror file, because the file on curseforge is a zip containing other files too.
|
||||
//Source: https://www.curseforge.com/minecraft/mc-mods/tropicraft/files/2353906
|
||||
compile(deobf("https://maven.falsepattern.com/mirror/mirror/tropicraft-6.0.5.jar"))
|
||||
|
||||
//Twilight Forest 2.3.8
|
||||
compile(deobfCurse("twilightforest-227639:3039937"))
|
||||
|
||||
//Underground Biomes Constructs 0.8-beta49
|
||||
compile(deobfCurse("undergroundbiomesconstructs-72744:2304497"))
|
||||
|
||||
//WorldEdit 6.1.1
|
||||
compileOnly(deobfCurse("worldedit-225608:2309699"))
|
||||
|
||||
////////////////Dependencies for patched mods////////////////
|
||||
|
||||
//SpaceCore 0.7.14
|
||||
//needed by: Biome Wand
|
||||
//Mirrored at: https://maven.falsepattern.com/mirror/mirror/1.7.10-SpaceCore-0.7.14.jar
|
||||
compile(deobf("http://spacechase0.com/files/mcmod/1.7.10-SpaceCore-0.7.14.jar"))
|
||||
|
||||
//Baubles 1.0.1.10
|
||||
//needed by: Thaumcraft
|
||||
compile(deobfCurse("baubles-227083:2224857"))
|
||||
|
||||
//CoroUtil 1.1.3
|
||||
//needed by: Tropicraft
|
||||
//Same reason for being mirrored as tropicraft
|
||||
compile(deobf("https://maven.falsepattern.com/mirror/mirror/coroutil-1.1.3.jar"))
|
||||
}
|
||||
+14
-1
@@ -14,7 +14,7 @@ modGroup = com.falsepattern.endlessids
|
||||
#
|
||||
|
||||
# The server to upload the artifacts to
|
||||
repositoryURL = https://maven.falsepattern.com
|
||||
repositoryURL = https://mvn.falsepattern.com/releases
|
||||
|
||||
# What name is the login information inside ~/.m2/settings.xml stored under
|
||||
# (see https://gist.github.com/FalsePattern/82d93e3cfab01f671cc5f4a95931cfe3 for an example)
|
||||
@@ -68,6 +68,13 @@ hasMixinDeps = false
|
||||
mixinPlugin = mixin.plugin.MixinPlugin
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage = mixin.mixins
|
||||
# Specify a preinit mixin here. Preinit mixins should be used very rarely, if at all, so this mixin config will not be managed by the buildscript, only included.
|
||||
mixinPreinitConfig =
|
||||
# By default, the buildscript uses mixin-booter-legacy for mixins. You can force the buildscript to use the obsolete SpongeMixins
|
||||
# library using this setting.
|
||||
# MixinBooterLegacy provides Mixins 0.8.2
|
||||
# SpongeMixins provides Mixins 0.7.11 on the official version, and Mixins 0.7.12 on the nh version
|
||||
useObsoleteSpongeMixins = false
|
||||
# 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
|
||||
@@ -80,6 +87,12 @@ containsMixinsAndOrCoreModOnly = false
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# If enabled, class stubbing will be enabled. In this mode, all classes with a package named "stubpackage" in their
|
||||
# path will be removed, and all classes that refer to said classes will be modified so that the "stubpackage" will map
|
||||
# to the root package instead. This is useful for referring to compile-time inaccessible classes, such as classes in the
|
||||
# default package
|
||||
remapStubs = true
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
#customArchiveBaseName =
|
||||
+15
-1
@@ -1,5 +1,19 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
|
||||
maven {
|
||||
name = "cursemaven"
|
||||
url = "https://mvn.falsepattern.com/cursemaven/"
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "mavenpattern"
|
||||
url = "https://mvn.falsepattern.com/releases/"
|
||||
}
|
||||
maven {
|
||||
name = "jitpack"
|
||||
url = "https://mvn.falsepattern.com/jitpack/"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,48 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import com.falsepattern.endlessids.patching.CommonManager;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = Tags.MODID, name = Tags.MODNAME, version = Tags.VERSION)
|
||||
public class EndlessIDs {}
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = Tags.MODID,
|
||||
version = Tags.VERSION,
|
||||
name = Tags.MODNAME,
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
dependencies = "required-after:falsepatternlib@[0.9.2,);after:antiidconflict")
|
||||
public class EndlessIDs {
|
||||
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
||||
public static final byte[] FAKE_BIOME_ARRAY_PLACEHOLDER = new byte[256];
|
||||
public static final Logger LOG = LogManager.getLogger(Tags.MODNAME);
|
||||
|
||||
@SidedProxy(clientSide = Tags.GROUPNAME + ".patching.ClientManager",
|
||||
serverSide = Tags.GROUPNAME + ".patching.ServerManager",
|
||||
modId = Tags.MODID)
|
||||
private static CommonManager patchManager;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void construct(FMLConstructionEvent e) {
|
||||
patchManager.construct();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
patchManager.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
patchManager.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
patchManager.postInit();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import lombok.val;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import java.nio.ShortBuffer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public class Hooks {
|
||||
|
||||
@@ -19,7 +24,7 @@ public class Hooks {
|
||||
System.arraycopy(msb, 0, ret, lsb.length * 2, lsb.length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public static void setBlockData(final IExtendedBlockStorageMixin ebs, final byte[] data, final int offset) {
|
||||
val lsb = ebs.getLSB();
|
||||
val msb = ebs.getMSB();
|
||||
@@ -44,9 +49,11 @@ public class Hooks {
|
||||
byte3Data[i] = ebsMSB[i];
|
||||
}
|
||||
val idLSB = (ebsLSB[i] & 0xFFFF);
|
||||
byte1Data[i] = (byte)(idLSB & 0xFF);
|
||||
byte1Data[i] = (byte) (idLSB & 0xFF);
|
||||
|
||||
if (idLSB <= 0xFF) continue;
|
||||
if (idLSB <= 0xFF) {
|
||||
continue;
|
||||
}
|
||||
val nibbleIndex = i >> 1;
|
||||
val nibbleShift = (i & 1) * 4;
|
||||
if (byte2BottomNibbleData == null) {
|
||||
@@ -54,7 +61,9 @@ public class Hooks {
|
||||
}
|
||||
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
||||
|
||||
if (idLSB <= 0xFFF) continue;
|
||||
if (idLSB <= 0xFFF) {
|
||||
continue;
|
||||
}
|
||||
if (byte2TopNibbleData == null) {
|
||||
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
||||
}
|
||||
@@ -62,12 +71,15 @@ public class Hooks {
|
||||
|
||||
}
|
||||
nbt.setByteArray("Blocks", byte1Data);
|
||||
if (byte2BottomNibbleData != null)
|
||||
if (byte2BottomNibbleData != null) {
|
||||
nbt.setByteArray("Add", byte2BottomNibbleData);
|
||||
if (byte2TopNibbleData != null)
|
||||
}
|
||||
if (byte2TopNibbleData != null) {
|
||||
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
||||
if (byte3Data != null)
|
||||
}
|
||||
if (byte3Data != null) {
|
||||
nbt.setByteArray("BlocksB3", byte3Data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
||||
@@ -91,7 +103,7 @@ public class Hooks {
|
||||
if (byte2TopNibbleData != null) {
|
||||
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
||||
}
|
||||
lsb[i] = (short)id;
|
||||
lsb[i] = (short) id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,15 +113,15 @@ public class Hooks {
|
||||
int cntNonEmpty = 0;
|
||||
int cntTicking = 0;
|
||||
for (int off = 0; off < blkIdsLSB.length; ++off) {
|
||||
final int id = ((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
||||
final int id =
|
||||
((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
||||
if (id > 0) {
|
||||
final Block block = (Block)Block.blockRegistry.getObjectById(id);
|
||||
final Block block = (Block) Block.blockRegistry.getObjectById(id);
|
||||
if (block == null) {
|
||||
if (IEConfig.removeInvalidBlocks) {
|
||||
if (GeneralConfig.removeInvalidBlocks) {
|
||||
blkIdsLSB[off] = 0;
|
||||
}
|
||||
}
|
||||
else if (block != Blocks.air) {
|
||||
} else if (block != Blocks.air) {
|
||||
++cntNonEmpty;
|
||||
if (block.getTickRandomly()) {
|
||||
++cntTicking;
|
||||
@@ -120,11 +132,12 @@ public class Hooks {
|
||||
ebs.setBlockRefCount(cntNonEmpty);
|
||||
ebs.setTickRefCount(cntTicking);
|
||||
}
|
||||
|
||||
|
||||
public static int getIdFromBlockWithCheck(final Block block, final Block oldBlock) {
|
||||
final int id = Block.getIdFromBlock(block);
|
||||
if (IEConfig.catchUnregisteredBlocks && id == -1) {
|
||||
throw new IllegalArgumentException("Block " + block + " is not registered. <-- Say about this to the author of this mod, or you can try to enable \"RemoveInvalidBlocks\" option in NEID config.");
|
||||
if (GeneralConfig.catchUnregisteredBlocks && id == -1) {
|
||||
throw new IllegalArgumentException("Block " + block +
|
||||
" is not registered. <-- Say about this to the author of this mod, or you can try to enable \"RemoveInvalidBlocks\" option in EID config.");
|
||||
}
|
||||
if (id >= 0 && id <= ExtendedConstants.maxBlockID) {
|
||||
return id;
|
||||
@@ -134,5 +147,83 @@ public class Hooks {
|
||||
}
|
||||
throw new IllegalArgumentException("id out of range: " + id);
|
||||
}
|
||||
|
||||
|
||||
public static void shortToByteArray(short[] shortArray, int shortOffset, byte[] byteArray, int byteOffset, int shortCount) {
|
||||
for (int i = 0; i < shortCount; i++) {
|
||||
short s = shortArray[shortOffset + i];
|
||||
byteArray[byteOffset + i * 2] = (byte)(s & 255);
|
||||
byteArray[byteOffset + i * 2 + 1] = (byte)((s >>> 8) & 255);
|
||||
}
|
||||
}
|
||||
|
||||
public static void byteToShortArray(byte[] byteArray, int byteOffset, short[] shortArray, int shortOffset, int byteCount) {
|
||||
for (int i = 0; i < byteCount; i++) {
|
||||
byte b = byteArray[byteOffset + i];
|
||||
shortArray[shortOffset + i / 2] = (short) (i % 2 == 0
|
||||
? (b & 255)
|
||||
: (shortArray[shortOffset + i / 2] | ((b & 255) << 8)));
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] shortToByteArray(short[] shortArray) {
|
||||
byte[] byteArray = new byte[shortArray.length * 2];
|
||||
shortToByteArray(shortArray, 0, byteArray, 0, shortArray.length);
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static short[] byteToShortArray(byte[] byteArray) {
|
||||
short[] shortArray = new short[(byteArray.length + 1) / 2];
|
||||
byteToShortArray(byteArray, 0, shortArray, 0, byteArray.length);
|
||||
return shortArray;
|
||||
}
|
||||
|
||||
public static void byteToShortArrayLegacy(byte[] byteArray, short[] shortArray) {
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
shortArray[i] = (short) (((byteArray[i + 256] << 8) & 255) | (byteArray[i] & 255));
|
||||
}
|
||||
}
|
||||
|
||||
public static void oldBiomeByteToNewShortArray(byte[] byteArray, short[] shortArray) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
shortArray[i] = (short) (byteArray[i] & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
public static int readBiomeArrayFromPacket(Chunk chunk, byte[] array, int offset) {
|
||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
byteToShortArray(array, offset, biomeArray, 0, biomeArray.length * 2);
|
||||
return biomeArray.length * 2;
|
||||
}
|
||||
|
||||
public static int writeBiomeArrayToPacket(Chunk chunk, byte[] array, int offset) {
|
||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
shortToByteArray(biomeArray, 0, array, offset, biomeArray.length);
|
||||
return biomeArray.length * 2;
|
||||
}
|
||||
|
||||
public static void writeChunkBiomeArrayToNbt(Chunk chunk, NBTTagCompound nbt) {
|
||||
byte[] byteArray = shortToByteArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||
nbt.setByteArray("Biomes16v2", byteArray);
|
||||
}
|
||||
|
||||
public static void readChunkBiomeArrayFromNbt(Chunk chunk, NBTTagCompound nbt) {
|
||||
short[] data = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
boolean put = false;
|
||||
if (data == null) {
|
||||
data = new short[16 * 16];
|
||||
put = true;
|
||||
}
|
||||
if (nbt.hasKey("Biomes16v2", 7)) {
|
||||
byteToShortArray(nbt.getByteArray("Biomes16v2"), 0, data, 0, data.length * 2);
|
||||
} else if (nbt.hasKey("Biomes16", 7)) {
|
||||
byteToShortArrayLegacy(nbt.getByteArray("Biomes16"), data);
|
||||
} else if (nbt.hasKey("Biomes", 7)) {
|
||||
oldBiomeByteToNewShortArray(nbt.getByteArray("Biomes"), data);
|
||||
} else {
|
||||
put = false;
|
||||
}
|
||||
if (put) {
|
||||
((IChunkMixin) chunk).setBiomeShortArray(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class IEConfig {
|
||||
static Configuration config;
|
||||
public static boolean catchUnregisteredBlocks;
|
||||
public static boolean removeInvalidBlocks;
|
||||
public static boolean extendDataWatcher;
|
||||
|
||||
public static void init(final File file) {
|
||||
File newFile;
|
||||
if (file.getPath().contains("bin")) {
|
||||
newFile = new File(file.getParent() + "/eclipse/config", Tags.MODID + ".cfg");
|
||||
}
|
||||
else {
|
||||
newFile = new File(file.getParentFile().getParent() + "/config", Tags.MODID + ".cfg");
|
||||
}
|
||||
IEConfig.config = new Configuration(newFile);
|
||||
IEConfig.catchUnregisteredBlocks = IEConfig.config.getBoolean("CatchUnregisteredBlocks", Tags.MODNAME, false, "");
|
||||
IEConfig.removeInvalidBlocks = IEConfig.config.getBoolean("RemoveInvalidBlocks", Tags.MODNAME, false, "Remove invalid (corrupted) blocks from the game.");
|
||||
IEConfig.extendDataWatcher = IEConfig.config.getBoolean("ExtendDataWatcher", Tags.MODNAME, false, "Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.");
|
||||
IEConfig.config.save();
|
||||
}
|
||||
|
||||
static {
|
||||
IEConfig.catchUnregisteredBlocks = false;
|
||||
IEConfig.removeInvalidBlocks = false;
|
||||
IEConfig.extendDataWatcher = false;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,58 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import com.falsepattern.endlessids.asm.IETransformer;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions({ "com.falsepattern.endlessids.asm" })
|
||||
public class IEPlugin implements IFMLLoadingPlugin
|
||||
{
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn;
|
||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.Name;
|
||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
|
||||
|
||||
@MCVersion("1.7.10")
|
||||
@Name(Tags.MODID)
|
||||
@TransformerExclusions({"com.falsepattern.endlessids.asm"})
|
||||
@DependsOn("falsepatternlib")
|
||||
public class IEPlugin implements IFMLLoadingPlugin {
|
||||
|
||||
public IEPlugin() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
public String[] getASMTransformerClass() {
|
||||
return new String[] { IETransformer.class.getName() };
|
||||
val cl = ((LaunchClassLoader) this.getClass().getClassLoader());
|
||||
val field = cl.getClass().getDeclaredField("transformerExceptions");
|
||||
field.setAccessible(true);
|
||||
val exceptions = (Set<String>) field.get(cl);
|
||||
if (exceptions.contains("code.elix_x.coremods")) {
|
||||
IETransformer.logger.info("AntiIDConflict detected!");
|
||||
IETransformer.logger.info("Removing ASM protections so that we can fix its code.");
|
||||
exceptions.remove("code.elix_x.coremods");
|
||||
exceptions.add("code.elix_x.coremods.antiidconflict.core");
|
||||
exceptions.add("code.elix_x.coremods.antiidconflict.ByteCodeTester");
|
||||
}
|
||||
return new String[]{IETransformer.class.getName()};
|
||||
}
|
||||
|
||||
|
||||
public String getModContainerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public String getSetupClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void injectData(final Map<String, Object> data) {
|
||||
IEConfig.init((File) data.get("coremodLocation"));
|
||||
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
|
||||
}
|
||||
|
||||
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class PlaceholderBiome extends BiomeGenBase {
|
||||
public PlaceholderBiome(int id, BiomeGenBase parent) {
|
||||
super(id);
|
||||
biomeName = "EndlessIDs ID conflict avoidance placeholder for ID " + parent.biomeID + " [" +
|
||||
parent.getClass().getName() + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import Reika.DragonAPI.Libraries.Java.ReikaJavaLibrary;
|
||||
import com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI.ModList;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class ASMHooks {
|
||||
@SneakyThrows
|
||||
public static void DragonAPIModListConstructorTweak(ModList list) {
|
||||
list.successful = false;
|
||||
DragonAPIModListTryLoad(list);
|
||||
}
|
||||
|
||||
public static boolean DragonAPIModListTryLoad(ModList list) {
|
||||
if (!list.successful) {
|
||||
try {
|
||||
list.condition = Loader.isModLoaded(list.modLabel);
|
||||
list.successful = true;
|
||||
if (list.condition) {
|
||||
ReikaJavaLibrary.pConsole(
|
||||
"DRAGONAPI: " + list + " detected in the MC installation. Adjusting behavior accordingly.");
|
||||
} else {
|
||||
ReikaJavaLibrary.pConsole(
|
||||
"DRAGONAPI: " + list + " not detected in the MC installation. No special action taken.");
|
||||
}
|
||||
if (list.condition) {
|
||||
ReikaJavaLibrary.pConsole("DRAGONAPI: Attempting to load data from " + list);
|
||||
if (list.blockClasses == null) {
|
||||
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not block class for " + list +
|
||||
": Specified class was null. This may not be an error.");
|
||||
}
|
||||
if (list.itemClasses == null) {
|
||||
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not item class for " + list +
|
||||
": Specified class was null. This may not be an error.");
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
list.condition = list.successful = false;
|
||||
}
|
||||
}
|
||||
return list.condition;
|
||||
}
|
||||
|
||||
public static void DragonAPIModListSuppressLogging(Object obj) {
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class AsmTransformException extends RuntimeException
|
||||
{
|
||||
public class AsmTransformException extends RuntimeException {
|
||||
private static final long serialVersionUID = 5128914670008752449L;
|
||||
|
||||
|
||||
public AsmTransformException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public AsmTransformException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
public AsmTransformException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@@ -1,62 +1,20 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.util.Printer;
|
||||
import org.objectweb.asm.util.TraceMethodVisitor;
|
||||
import org.objectweb.asm.util.Textifier;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class AsmUtil
|
||||
{
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class AsmUtil {
|
||||
public AsmUtil() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final String name) {
|
||||
return findMethod(cn, name, false);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final String name, final boolean optional) {
|
||||
for (final MethodNode ret : cn.methods) {
|
||||
if (ret.name.equals(name)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new MethodNotFoundException(name);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final Name name) {
|
||||
return findMethod(cn, name, false);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final Name name, final boolean optional) {
|
||||
for (final MethodNode ret : cn.methods) {
|
||||
if (name.matches(ret)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new MethodNotFoundException(name.deobf);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final String name) {
|
||||
return findField(cn, name, false);
|
||||
}
|
||||
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final String name, final boolean optional) {
|
||||
for (final FieldNode ret : cn.fields) {
|
||||
if (name.equals(ret.name)) {
|
||||
@@ -68,68 +26,33 @@ public class AsmUtil
|
||||
}
|
||||
throw new FieldNotFoundException(name);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final Name name) {
|
||||
return findField(cn, name, false);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final Name name, final boolean optional) {
|
||||
for (final FieldNode ret : cn.fields) {
|
||||
if (name.matches(ret)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new FieldNotFoundException(name.deobf);
|
||||
}
|
||||
|
||||
public static void makePublic(final MethodNode x) {
|
||||
x.access = ((x.access & 0xFFFFFFF9) | 0x1);
|
||||
}
|
||||
|
||||
public static void makePublic(final FieldNode x) {
|
||||
x.access = ((x.access & 0xFFFFFFF9) | 0x1);
|
||||
}
|
||||
|
||||
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue) {
|
||||
return transformInlinedSizeMethod(cn, method, oldValue, newValue, false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue, final boolean optional) {
|
||||
boolean found = false;
|
||||
boolean foundOnce = false;
|
||||
final int i = 0;
|
||||
final ListIterator<AbstractInsnNode> it = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
final ListIterator<AbstractInsnNode> it = method.instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
final AbstractInsnNode insn = it.next();
|
||||
if (insn.getOpcode() == 3 && oldValue == 0) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 4 && oldValue == 1) {
|
||||
} else if (insn.getOpcode() == 4 && oldValue == 1) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 5 && oldValue == 2) {
|
||||
} else if (insn.getOpcode() == 5 && oldValue == 2) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 6 && oldValue == 3) {
|
||||
} else if (insn.getOpcode() == 6 && oldValue == 3) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 7 && oldValue == 4) {
|
||||
} else if (insn.getOpcode() == 7 && oldValue == 4) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 8 && oldValue == 5) {
|
||||
} else if (insn.getOpcode() == 8 && oldValue == 5) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 18) {
|
||||
final LdcInsnNode node = (LdcInsnNode)insn;
|
||||
if (node.cst instanceof Integer && (int)node.cst == oldValue) {
|
||||
} else if (insn.getOpcode() == 18) {
|
||||
final LdcInsnNode node = (LdcInsnNode) insn;
|
||||
if (node.cst instanceof Integer && (int) node.cst == oldValue) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else if (insn.getOpcode() == 17 || insn.getOpcode() == 16) {
|
||||
final IntInsnNode node2 = (IntInsnNode)insn;
|
||||
} else if (insn.getOpcode() == 17 || insn.getOpcode() == 16) {
|
||||
final IntInsnNode node2 = (IntInsnNode) insn;
|
||||
if (node2.operand == oldValue) {
|
||||
found = true;
|
||||
}
|
||||
@@ -138,30 +61,22 @@ public class AsmUtil
|
||||
foundOnce = true;
|
||||
if (newValue == 0) {
|
||||
it.set(new InsnNode(3));
|
||||
}
|
||||
else if (newValue == 1) {
|
||||
} else if (newValue == 1) {
|
||||
it.set(new InsnNode(4));
|
||||
}
|
||||
else if (newValue == 2) {
|
||||
} else if (newValue == 2) {
|
||||
it.set(new InsnNode(5));
|
||||
}
|
||||
else if (newValue == 3) {
|
||||
} else if (newValue == 3) {
|
||||
it.set(new InsnNode(6));
|
||||
}
|
||||
else if (newValue == 4) {
|
||||
} else if (newValue == 4) {
|
||||
it.set(new InsnNode(7));
|
||||
}
|
||||
else if (newValue == 5) {
|
||||
} else if (newValue == 5) {
|
||||
it.set(new InsnNode(8));
|
||||
}
|
||||
else if (newValue >= -128 && newValue <= 127) {
|
||||
} else if (newValue >= -128 && newValue <= 127) {
|
||||
it.set(new IntInsnNode(16, newValue));
|
||||
}
|
||||
else if (newValue >= -32768 && newValue <= 32767) {
|
||||
} else if (newValue >= -32768 && newValue <= 32767) {
|
||||
it.set(new IntInsnNode(17, newValue));
|
||||
}
|
||||
else {
|
||||
it.set(new LdcInsnNode((Object)Integer.valueOf(newValue)));
|
||||
} else {
|
||||
it.set(new LdcInsnNode(newValue));
|
||||
}
|
||||
found = false;
|
||||
}
|
||||
@@ -171,13 +86,5 @@ public class AsmUtil
|
||||
}
|
||||
return foundOnce;
|
||||
}
|
||||
|
||||
public static void dump(final InsnList list) {
|
||||
final Textifier textifier = new Textifier();
|
||||
final TraceMethodVisitor visitor = new TraceMethodVisitor((Printer)textifier);
|
||||
list.accept((MethodVisitor)visitor);
|
||||
final PrintWriter writer = new PrintWriter(System.out);
|
||||
textifier.print(writer);
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +1,23 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.falsepattern.endlessids.asm.transformer.WorldEditBaseBlock;
|
||||
import com.falsepattern.endlessids.asm.transformer.MFQM;
|
||||
import com.falsepattern.endlessids.asm.transformer.UndergroundBiomesBiomeUndergroundDecorator;
|
||||
import com.falsepattern.endlessids.asm.transformer.UndergroundBiomesOreUBifier;
|
||||
import com.falsepattern.endlessids.asm.transformer.CofhBlockHelper;
|
||||
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
||||
import com.falsepattern.endlessids.asm.transformer.DragonAPIModList;
|
||||
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
||||
import com.falsepattern.endlessids.asm.transformer.SpaceCoreModInfoGenerator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ClassEdit
|
||||
{
|
||||
//SelfHooks(new SelfHooks(), new String[] { "com.falsepattern.endlessids.Hooks" }),
|
||||
//VanillaBlockFire(new VanillaBlockFire(), new String[] { "net.minecraft.block.BlockFire" }),
|
||||
//VanillaStatList(new VanillaStatList(), new String[] { "net.minecraft.stats.StatList" }),
|
||||
//VanillaAnvilChunkLoader(new VanillaAnvilChunkLoader(), new String[] { "net.minecraft.world.chunk.storage.AnvilChunkLoader" }),
|
||||
//VanillaChunk(new VanillaChunk(), new String[] { "net.minecraft.world.chunk.Chunk" }),
|
||||
//VanillaExtendedBlockStorage(new VanillaExtendedBlockStorage(), new String[] { "net.minecraft.world.chunk.storage.ExtendedBlockStorage" }),
|
||||
//VanillaDataWatcher(new VanillaDataWatcher(), new String[] { "net.minecraft.entity.DataWatcher" }),
|
||||
//VanillaNetHandlerPlayClient(new VanillaNetHandlerPlayClient(), new String[] { "net.minecraft.client.network.NetHandlerPlayClient" }),
|
||||
//VanillaS21PacketChunkData(new VanillaS21PacketChunkData(), new String[] { "net.minecraft.network.play.server.S21PacketChunkData" }),
|
||||
//VanillaS22PacketMultiBlockChange(new VanillaS22PacketMultiBlockChange(), new String[] { "net.minecraft.network.play.server.S22PacketMultiBlockChange" }),
|
||||
//VanillaS24PacketBlockActivation(new VanillaS24PacketBlockActivation(), new String[] { "net.minecraft.network.play.server.S24PacketBlockAction" }),
|
||||
//VanillaS26PacketMapChunkBulk(new VanillaS26PacketMapChunkBulk(), new String[] { "net.minecraft.network.play.server.S26PacketMapChunkBulk" }),
|
||||
//VanillaRenderGlobal(new VanillaRenderGlobal(), new String[] { "net.minecraft.client.renderer.RenderGlobal" }),
|
||||
//VanillaPlayerControllerMP(new VanillaPlayerControllerMP(), new String[] { "net.minecraft.client.multiplayer.PlayerControllerMP" }),
|
||||
//VanillaItemInWorldManager(new VanillaItemInWorldManager(), new String[] { "net.minecraft.server.management.ItemInWorldManager" }),
|
||||
//VanillaWorld(new VanillaWorld(), new String[] { "net.minecraft.world.World" }),
|
||||
FmlRegistry(new FmlRegistry(), new String[] { "cpw.mods.fml.common.registry.GameData", "cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry" }),
|
||||
CofhBlockHelper(new CofhBlockHelper(), new String[] { "cofh.lib.util.helpers.BlockHelper" }),
|
||||
UndergroundBiomesOreUBifier(new UndergroundBiomesOreUBifier(), new String[] { "exterminatorJeff.undergroundBiomes.worldGen.OreUBifier" }),
|
||||
UndergroundBiomesBiomeUndergroundDecorator(new UndergroundBiomesBiomeUndergroundDecorator(), new String[] { "exterminatorJeff.undergroundBiomes.worldGen.BiomeUndergroundDecorator" }),
|
||||
MFQM(new MFQM(), new String[] { "MoreFunQuicksandMod.main.MFQM" }),
|
||||
WorldEditBaseBlock(new WorldEditBaseBlock(), new String[] { "com.sk89q.worldedit.blocks.BaseBlock" });
|
||||
|
||||
public enum ClassEdit {
|
||||
ChunkProviderSuperPatcher(new ChunkProviderSuperPatcher()),
|
||||
DragonAPIModList(new DragonAPIModList(), "Reika.DragonAPI.ModList"),
|
||||
FmlRegistry(new FmlRegistry(),
|
||||
"cpw.mods.fml.common.registry.GameData",
|
||||
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry"),
|
||||
SpaceCoreModInfoGenerator(new SpaceCoreModInfoGenerator(), "com.spacechase0.minecraft.spacecore.mcp.ModInfoGenerator");
|
||||
|
||||
private static final Map<String, ClassEdit> editMap;
|
||||
private final IClassNodeTransformer transformer;
|
||||
private final String[] classNames;
|
||||
|
||||
ClassEdit(final IClassNodeTransformer transformer, final String[] classNames) {
|
||||
this.transformer = transformer;
|
||||
this.classNames = classNames;
|
||||
}
|
||||
|
||||
public static ClassEdit get(final String className) {
|
||||
return ClassEdit.editMap.get(className);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
public IClassNodeTransformer getTransformer() {
|
||||
return this.transformer;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
editMap = new HashMap<>();
|
||||
for (final ClassEdit edit : values()) {
|
||||
@@ -63,4 +26,24 @@ public enum ClassEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final IClassNodeTransformer transformer;
|
||||
private final String[] classNames;
|
||||
|
||||
ClassEdit(final IClassNodeTransformer transformer, final String... classNames) {
|
||||
this.transformer = transformer;
|
||||
this.classNames = classNames;
|
||||
}
|
||||
|
||||
public static ClassEdit get(final String className) {
|
||||
return ClassEdit.editMap.get(className);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
public IClassNodeTransformer getTransformer() {
|
||||
return this.transformer;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class Constants
|
||||
{
|
||||
|
||||
public static final int maxBlockId = 32767;
|
||||
public static final int blockIdMask = 65535;
|
||||
public static final int ebsIdArrayLength = 4096;
|
||||
public static final int ebsIdArraySize = 8192;
|
||||
public static final int vanillaEbsSize = 12288;
|
||||
public static final int vanillaSize = 196864;
|
||||
public static final int newEbsSize = 14336;
|
||||
public static final int newSize = 229632;
|
||||
public static final int maxDataWatcherId = 127;
|
||||
public static final int vanillaIDCount = 4096;
|
||||
public static final int newIDCount = 32768;
|
||||
public static final int vanillaIDBits = 12;
|
||||
public static final int newIDBits = 16;
|
||||
|
||||
public Constants() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class FieldNotFoundException extends AsmTransformException
|
||||
{
|
||||
public class FieldNotFoundException extends AsmTransformException {
|
||||
public FieldNotFoundException(final String field) {
|
||||
super("can't find field " + field);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.falsepattern.endlessids.asm;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public interface IClassNodeTransformer
|
||||
{
|
||||
public interface IClassNodeTransformer {
|
||||
void transform(final ClassNode p0, final boolean p1);
|
||||
}
|
||||
@@ -1,72 +1,91 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
||||
import com.falsepattern.endlessids.asm.transformer.DevFixer;
|
||||
import lombok.val;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.objectweb.asm.util.CheckClassAdapter;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
public class IETransformer implements IClassTransformer
|
||||
{
|
||||
private static final boolean enablePreVerification = false;
|
||||
private static final boolean enablePostVerification = true;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IETransformer implements IClassTransformer {
|
||||
public static final Logger logger;
|
||||
public static boolean isObfuscated;
|
||||
private static Boolean isClient;
|
||||
|
||||
|
||||
private static final List<String> blacklist = new ArrayList<>();
|
||||
|
||||
static {
|
||||
logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
||||
blacklist.add("net.minecraft.world.chunk.storage.AnvilChunkLoader");
|
||||
}
|
||||
|
||||
public IETransformer() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public byte[] transform(final String name, final String transformedName, final byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
if (blacklist.contains(transformedName)) {
|
||||
return bytes;
|
||||
}
|
||||
final ClassEdit edit = ClassEdit.get(transformedName);
|
||||
if (edit == null) {
|
||||
return bytes;
|
||||
ClassEdit[] edits = new ClassEdit[2];
|
||||
edits[0] = ClassEdit.get(transformedName);
|
||||
ClassNode cn = new ClassNode(Opcodes.ASM5);
|
||||
{
|
||||
val reader = new ClassReader(bytes);
|
||||
reader.accept(cn, 0);
|
||||
}
|
||||
IETransformer.logger.debug("Patching {} with {}...", new Object[] { transformedName, edit.getName() });
|
||||
final ClassNode cn = new ClassNode(327680);
|
||||
final ClassReader reader = new ClassReader(bytes);
|
||||
final int readFlags = 0;
|
||||
reader.accept((ClassVisitor)cn, 0);
|
||||
try {
|
||||
edit.getTransformer().transform(cn, IETransformer.isObfuscated);
|
||||
boolean expanded = false;
|
||||
if (ChunkProviderSuperPatcher.shouldPatch(cn)) {
|
||||
expanded = true;
|
||||
{
|
||||
cn = new ClassNode(Opcodes.ASM5);
|
||||
val reader = new ClassReader(bytes);
|
||||
reader.accept(cn, ClassReader.EXPAND_FRAMES);
|
||||
}
|
||||
if (edits[0] == null) {
|
||||
edits[0] = ClassEdit.ChunkProviderSuperPatcher;
|
||||
} else {
|
||||
edits[1] = ClassEdit.ChunkProviderSuperPatcher;
|
||||
}
|
||||
}
|
||||
catch (AsmTransformException t) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", new Object[] { transformedName, edit.getName(), t.getMessage() });
|
||||
throw t;
|
||||
if (edits[0] == null) {
|
||||
return isObfuscated ? bytes : DevFixer.fixDev(bytes);
|
||||
}
|
||||
catch (Throwable t2) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", new Object[] { transformedName, edit.getName(), t2.getMessage() });
|
||||
throw new RuntimeException(t2);
|
||||
if (!isObfuscated) {
|
||||
DevFixer.transform(cn);
|
||||
}
|
||||
final ClassWriter writer = new ClassWriter(0);
|
||||
try {
|
||||
final ClassVisitor check = (ClassVisitor)new CheckClassAdapter((ClassVisitor)writer);
|
||||
cn.accept(check);
|
||||
for (int i = 0; i < edits.length; i++) {
|
||||
val edit = edits[i];
|
||||
if (edit == null) {
|
||||
continue;
|
||||
}
|
||||
IETransformer.logger.debug("Patching {} with {}...", transformedName, edit.getName());
|
||||
try {
|
||||
edit.getTransformer().transform(cn, IETransformer.isObfuscated);
|
||||
} catch (AsmTransformException t) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(),
|
||||
t.getMessage());
|
||||
throw t;
|
||||
} catch (Throwable t2) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(),
|
||||
t2.getMessage());
|
||||
throw new RuntimeException(t2);
|
||||
}
|
||||
}
|
||||
catch (Throwable t3) {
|
||||
IETransformer.logger.error("Error verifying {} transformed with {}: {}", new Object[] { transformedName, edit.getName(), t3.getMessage() });
|
||||
throw new RuntimeException(t3);
|
||||
}
|
||||
IETransformer.logger.debug("Patched {} successfully.", new Object[] { edit.getName() });
|
||||
final ClassWriter writer = new ClassWriter(expanded ? ClassWriter.COMPUTE_FRAMES : 0);
|
||||
cn.accept(writer);
|
||||
IETransformer.logger.debug("Patched {} successfully.", transformedName);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
public static boolean isClient() {
|
||||
if (IETransformer.isClient == null) {
|
||||
IETransformer.isClient = Boolean.valueOf(IETransformer.class.getResource("/net/minecraft/client/main/Main.class") != null);
|
||||
}
|
||||
return IETransformer.isClient;
|
||||
}
|
||||
|
||||
static {
|
||||
logger = LogManager.getLogger("NEID");
|
||||
IETransformer.isClient = null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class MethodNotFoundException extends AsmTransformException
|
||||
{
|
||||
public class MethodNotFoundException extends AsmTransformException {
|
||||
public MethodNotFoundException(final String method) {
|
||||
super("can't find method " + method);
|
||||
}
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public enum Name
|
||||
{
|
||||
hooks("com/falsepattern/endlessids/Hooks"),
|
||||
hooks_create16BArray(Name.hooks, "create16BArray", null, null, "()[S"),
|
||||
hooks_getBlockData(Name.hooks, "getBlockData", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;)[B"),
|
||||
hooks_setBlockData(Name.hooks, "setBlockData", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;[BI)V"),
|
||||
hooks_writeChunkToNbt(Name.hooks, "writeChunkToNbt", null, null, "(Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;)V"),
|
||||
hooks_readChunkFromNbt(Name.hooks, "readChunkFromNbt", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;Lnet/minecraft/nbt/NBTTagCompound;)V"),
|
||||
hooks_getBlockId(Name.hooks, "getBlockId", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;III)I"),
|
||||
hooks_getBlockById(Name.hooks, "getBlock", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;III)Lnet/minecraft/block/Block;"),
|
||||
hooks_setBlockId(Name.hooks, "setBlockId", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;IIII)V"),
|
||||
hooks_getIdFromBlockWithCheck(Name.hooks, "getIdFromBlockWithCheck", null, null, "(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)I"),
|
||||
acl("net/minecraft/world/chunk/storage/AnvilChunkLoader", "aqk"),
|
||||
block("net/minecraft/block/Block", "aji"),
|
||||
chunk("net/minecraft/world/chunk/Chunk", "apx"),
|
||||
extendedBlockStorage("net/minecraft/world/chunk/storage/ExtendedBlockStorage", "apz"),
|
||||
iChunkProvider("net/minecraft/world/chunk/IChunkProvider", "apu"),
|
||||
nbtTagCompound("net/minecraft/nbt/NBTTagCompound", "dh"),
|
||||
nhpc("net/minecraft/client/network/NetHandlerPlayClient", "bjb"),
|
||||
nibbleArray("net/minecraft/world/chunk/NibbleArray", "apv"),
|
||||
packet("net/minecraft/network/Packet", "ft"),
|
||||
packetBuffer("net/minecraft/network/PacketBuffer", "et"),
|
||||
s22("net/minecraft/network/play/server/S22PacketMultiBlockChange", "gk"),
|
||||
s21("net/minecraft/network/play/server/S21PacketChunkData", "gx"),
|
||||
s21_extracted("net/minecraft/network/play/server/S21PacketChunkData$Extracted", "gy"),
|
||||
world("net/minecraft/world/World", "ahb"),
|
||||
dataWatcher("net/minecraft/entity/DataWatcher", "te"),
|
||||
dataWatcher_watchableObject("net/minecraft/entity/DataWatcher$WatchableObject", "tf"),
|
||||
renderGlobal("net/minecraft/client/renderer/RenderGlobal", "bma"),
|
||||
playerControllerMP("net/minecraft/client/multiplayer/PlayerControllerMP", "bje"),
|
||||
itemInWorldManager("net/minecraft/server/management/ItemInWorldManager", "mx"),
|
||||
entityPlayer("net/minecraft/entity/player/EntityPlayer", "yz"),
|
||||
ebs_getBlock(Name.extendedBlockStorage, "getBlockByExtId", "a", "func_150819_a", "(III)Lnet/minecraft/block/Block;"),
|
||||
ebs_setBlock(Name.extendedBlockStorage, "func_150818_a", "a", null, "(IIILnet/minecraft/block/Block;)V"),
|
||||
ebs_getBlockLSBArray(Name.extendedBlockStorage, "getBlockLSBArray", "g", "func_76658_g", "()[B"),
|
||||
ebs_getBlockMSBArray(Name.extendedBlockStorage, "getBlockMSBArray", "i", "func_76660_i", "()Lnet/minecraft/world/chunk/NibbleArray;"),
|
||||
ebs_setBlockMSBArray(Name.extendedBlockStorage, "setBlockMSBArray", "a", "func_76673_a", "(Lnet/minecraft/world/chunk/NibbleArray;)V"),
|
||||
ebs_isEmpty(Name.extendedBlockStorage, "isEmpty", "a", "func_76663_a", "()Z"),
|
||||
ebs_removeInvalidBlocks(Name.extendedBlockStorage, "removeInvalidBlocks", "e", "func_76672_e", "()V"),
|
||||
dataWatcher_addObject(Name.dataWatcher, "addObject", "a", "func_75682_a", "(ILjava/lang/Object;)V"),
|
||||
dataWatcher_writeWatchableObjectToPacketBuffer(Name.dataWatcher, "writeWatchableObjectToPacketBuffer", "a", "func_151510_a", "(Lnet/minecraft/network/PacketBuffer;Lnet/minecraft/entity/DataWatcher$WatchableObject;)V"),
|
||||
dataWatcher_readWatchedListFromPacketBuffer(Name.dataWatcher, "readWatchedListFromPacketBuffer", "b", "func_151508_b", "(Lnet/minecraft/network/PacketBuffer;)Ljava/util/List;"),
|
||||
dataWatcher_writeWatchedListToPacketBuffer(Name.dataWatcher, "writeWatchedListToPacketBuffer", "a", "func_151507_a", "(Ljava/util/List;Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
dataWatcher_func_151509_a(Name.dataWatcher, "func_151509_a", "a", "func_151509_a", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
ebs_blockRefCount(Name.extendedBlockStorage, "blockRefCount", "b", "field_76682_b", "I"),
|
||||
ebs_tickRefCount(Name.extendedBlockStorage, "tickRefCount", "c", "field_76683_c", "I"),
|
||||
acl_writeChunkToNBT(Name.acl, "writeChunkToNBT", "a", "func_75820_a", "(Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;)V"),
|
||||
acl_readChunkFromNBT(Name.acl, "readChunkFromNBT", "a", "func_75823_a", "(Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;)Lnet/minecraft/world/chunk/Chunk;"),
|
||||
block_getIdFromBlock(Name.block, "getIdFromBlock", "b", "func_149682_b", "(Lnet/minecraft/block/Block;)I"),
|
||||
chunk_fillChunk(Name.chunk, "fillChunk", "a", "func_76607_a", "([BIIZ)V"),
|
||||
packet_readPacketData(Name.packet, "readPacketData", "a", "func_148837_a", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
packet_writePacketData(Name.packet, "writePacketData", "b", "func_148840_b", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
nhpc_handleMultiBlockChange(Name.nhpc, "handleMultiBlockChange", "a", "func_147287_a", "(Lnet/minecraft/network/play/server/S22PacketMultiBlockChange;)V"),
|
||||
s22_init_server(Name.s22, "<init>", null, null, "(I[SLnet/minecraft/world/chunk/Chunk;)V"),
|
||||
s21_undefined1(Name.s21, "func_149275_c", "c", null, "()I"),
|
||||
s21_undefined2(Name.s21, "func_149269_a", "a", null, "(Lnet/minecraft/world/chunk/Chunk;ZI)Lnet/minecraft/network/play/server/S21PacketChunkData$Extracted;"),
|
||||
renderGlobal_playAuxSFX(Name.renderGlobal, "playAuxSFX", "a", "func_72706_a", "(Lnet/minecraft/entity/player/EntityPlayer;IIIII)V"),
|
||||
playerControllerMP_onPlayerDestroyBlock(Name.playerControllerMP, "onPlayerDestroyBlock", "a", "func_78751_a", "(IIII)Z"),
|
||||
itemInWorldManager_tryHarvestBlock(Name.itemInWorldManager, "tryHarvestBlock", "b", "func_73084_b", "(III)Z"),
|
||||
world_breakBlock(Name.world, "func_147480_a", "a", null, "(IIIZ)Z"),
|
||||
ub_bud("exterminatorJeff/undergroundBiomes/worldGen/BiomeUndergroundDecorator"),
|
||||
ub_bud_replaceChunkOres_world(Name.ub_bud, "replaceChunkOres", null, null, "(IILnet/minecraft/world/World;)V"),
|
||||
ub_bud_replaceChunkOres_iChunkProvider(Name.ub_bud, "replaceChunkOres", null, null, "(Lnet/minecraft/world/chunk/IChunkProvider;II)V"),
|
||||
MFQM("MoreFunQuicksandMod/main/MFQM"),
|
||||
MFQM_preInit(Name.MFQM, "preInit", null, null, "(Lcpw/mods/fml/common/event/FMLPreInitializationEvent;)V");
|
||||
|
||||
public final Name clazz;
|
||||
public final String deobf;
|
||||
public final String obf;
|
||||
public final String srg;
|
||||
public final String desc;
|
||||
public String obfDesc;
|
||||
|
||||
Name(final String deobf) {
|
||||
this(deobf, deobf);
|
||||
}
|
||||
|
||||
Name(final String deobf, final String obf) {
|
||||
this.clazz = null;
|
||||
this.deobf = deobf;
|
||||
this.obf = obf;
|
||||
this.srg = deobf;
|
||||
this.desc = null;
|
||||
}
|
||||
|
||||
Name(final Name clazz, final String deobf, final String obf, final String srg, final String desc) {
|
||||
this.clazz = clazz;
|
||||
this.deobf = deobf;
|
||||
this.obf = ((obf != null) ? obf : deobf);
|
||||
this.srg = ((srg != null) ? srg : deobf);
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public boolean matches(final MethodNode x) {
|
||||
assert this.desc.startsWith("(");
|
||||
return (this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.srg.equals(x.name) && this.desc.equals(x.desc)) || (this.deobf.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
|
||||
public boolean matches(final FieldNode x) {
|
||||
assert !this.desc.startsWith("(");
|
||||
return (this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.srg.equals(x.name) && this.desc.equals(x.desc)) || (this.deobf.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
|
||||
public boolean matches(final MethodInsnNode x, final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return (this.clazz.obf.equals(x.owner) && this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.clazz.srg.equals(x.owner) && this.srg.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
return this.clazz.deobf.equals(x.owner) && this.deobf.equals(x.name) && this.desc.equals(x.desc);
|
||||
}
|
||||
|
||||
public boolean matches(final FieldInsnNode x, final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return (this.clazz.obf.equals(x.owner) && this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.clazz.srg.equals(x.owner) && this.srg.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
return this.clazz.deobf.equals(x.owner) && this.deobf.equals(x.name) && this.desc.equals(x.desc);
|
||||
}
|
||||
|
||||
public MethodInsnNode staticInvocation(final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new MethodInsnNode(184, this.clazz.srg, this.srg, this.desc, false);
|
||||
}
|
||||
return new MethodInsnNode(184, this.clazz.deobf, this.deobf, this.desc, false);
|
||||
}
|
||||
|
||||
public MethodInsnNode virtualInvocation(final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new MethodInsnNode(182, this.clazz.srg, this.srg, this.desc, false);
|
||||
}
|
||||
return new MethodInsnNode(182, this.clazz.deobf, this.deobf, this.desc, false);
|
||||
}
|
||||
|
||||
public FieldInsnNode staticGet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(178, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(178, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode virtualGet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(180, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(180, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode staticSet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(179, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(179, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode virtualSet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(181, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(181, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
private static void translateDescs() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (final Name name : values()) {
|
||||
if (name.desc != null) {
|
||||
int pos;
|
||||
int endPos;
|
||||
for (pos = 0, endPos = -1; (pos = name.desc.indexOf(76, pos)) != -1; pos = endPos + 1) {
|
||||
sb.append(name.desc, endPos + 1, pos);
|
||||
endPos = name.desc.indexOf(59, pos + 1);
|
||||
String cName = name.desc.substring(pos + 1, endPos);
|
||||
for (final Name name2 : values()) {
|
||||
if (name2.deobf.equals(cName)) {
|
||||
cName = name2.obf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.append('L');
|
||||
sb.append(cName);
|
||||
sb.append(';');
|
||||
}
|
||||
sb.append(name.desc, endPos + 1, name.desc.length());
|
||||
name.obfDesc = sb.toString();
|
||||
sb.setLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
translateDescs();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI;
|
||||
|
||||
public class ModList {
|
||||
public String modLabel;
|
||||
public boolean condition;
|
||||
public boolean successful;
|
||||
public String[] itemClasses;
|
||||
public String[] blockClasses;
|
||||
}
|
||||
+468
@@ -0,0 +1,468 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import com.falsepattern.endlessids.asm.IETransformer;
|
||||
import lombok.Data;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FrameNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.JumpInsnNode;
|
||||
import org.objectweb.asm.tree.LabelNode;
|
||||
import org.objectweb.asm.tree.LineNumberNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* <p>This class is the bread and butter of the patching logic from now on. It covers about 90% of cases where manual patching
|
||||
* was required, and so with a heavy heart, I (finally) implemented a universal patch.</p>
|
||||
*
|
||||
* <pre>
|
||||
* Java form:
|
||||
* ...
|
||||
* byte[] abyte = chunk.getBiomeArray(); //replace byte[] with short[] and getBiomeArray with getBiomeShortArray
|
||||
*
|
||||
* for (int k = 0; k < abyte.length; ++k) {
|
||||
* //Possibility A:
|
||||
* abyte[k] = (byte)abiomegenbase[k].biomeID; //from local variable //replace byte cast with short cast
|
||||
*
|
||||
* //Possibility B:
|
||||
* abyte[k] = (byte)this.biomesToGenerate[k].biomeID; //from arbitrary field //replace byte cast with short cast
|
||||
*
|
||||
* //Possibility C:
|
||||
* abyte[k] = (byte)SomeClass.biome.biomeID; //usually galacticraft and derivatives do this for space stations.
|
||||
*
|
||||
* //Possibility D:
|
||||
* abyte[k] = (byte)object.biome.biomeID; //could also happen.
|
||||
* }
|
||||
* ...
|
||||
* In ASM form:
|
||||
*
|
||||
* L1
|
||||
* //state 0
|
||||
* ALOAD chunk
|
||||
* //state 1
|
||||
* INVOKEVIRTUAL net/minecraft/world/chunk/Chunk.getBiomeArray ()[B //Replace with INVOKEVIRTUAL net/minecraft/world/chunk/Chunk.getBiomeShortArray ()[S
|
||||
* //state 2
|
||||
* ASTORE abyte
|
||||
* //state 3
|
||||
* L2
|
||||
* //state 4
|
||||
* ICONST_0
|
||||
* //state 5
|
||||
* ISTORE k
|
||||
* //state 6
|
||||
* L3
|
||||
* //state 7
|
||||
* FRAME <snip>
|
||||
* //state 8
|
||||
* ILOAD k
|
||||
* //state 9
|
||||
* ALOAD abyte
|
||||
* //state 10
|
||||
* ARRAYLENGTH
|
||||
* //state 11
|
||||
* IF_ICMPGE L6
|
||||
* //state 12
|
||||
* L4
|
||||
* //state 13
|
||||
* ALOAD abyte
|
||||
* //state 14
|
||||
* ILOAD k
|
||||
*
|
||||
* //Branch A | B | C | D
|
||||
* //A:
|
||||
* ALOAD abiomegenbase
|
||||
*
|
||||
* //B:
|
||||
* ALOAD <something else>
|
||||
* GETFIELD classname.fieldname : [Lnet/minecraft/world/biome/BiomeGenBase;
|
||||
*
|
||||
* //C:
|
||||
* GETSTATIC classname.fieldname : Lnet/minecraft/world/biome/BiomeGenBase;
|
||||
*
|
||||
* //D:
|
||||
* ALOAD <something else>
|
||||
* GETFIELD classname.fieldname : Lnet/minecraft/world/biome/BiomeGenBase;
|
||||
*
|
||||
* //Join A | B
|
||||
* ILOAD k
|
||||
* AALOAD
|
||||
*
|
||||
* //Join A,B | C | D
|
||||
*
|
||||
* //state 15
|
||||
* GETFIELD net/minecraft/world/biome/BiomeGenBase.biomeID : I
|
||||
* //state 16
|
||||
* I2B //Replace with I2S
|
||||
* //state 17
|
||||
* BASTORE //Replace with SASTORE
|
||||
* //state final, matched.
|
||||
* L5
|
||||
* IINC k 1
|
||||
* GOTO L3
|
||||
* L6
|
||||
* </pre>
|
||||
*/
|
||||
public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
||||
public static final String[] CLASS_BiomeGenBase;
|
||||
public static final String[] CLASS_IChunkProvider;
|
||||
public static final String[] CLASS_ChunkProviderGenerate;
|
||||
public static final String[] CLASS_Chunk;
|
||||
public static final String[] FIELD_biomeID;
|
||||
public static final String[] METHOD_getBiomeArray;
|
||||
|
||||
static {
|
||||
if (IETransformer.isObfuscated) {
|
||||
CLASS_BiomeGenBase = new String[]{"ahu", "net/minecraft/world/biome/BiomeGenBase"};
|
||||
CLASS_IChunkProvider = new String[]{"apu", "net/minecraft/world/chunk/IChunkProvider"};
|
||||
CLASS_ChunkProviderGenerate = new String[]{"aqz", "net/minecraft/world/gen/ChunkProviderGenerate"};
|
||||
CLASS_Chunk = new String[]{"apx", "net/minecraft/world/chunk/Chunk"};
|
||||
FIELD_biomeID = new String[]{"ay", "field_76756_M"};
|
||||
METHOD_getBiomeArray = new String[]{"m", "func_76605_m"};
|
||||
} else {
|
||||
CLASS_BiomeGenBase = new String[]{"net/minecraft/world/biome/BiomeGenBase"};
|
||||
CLASS_IChunkProvider = new String[]{"net/minecraft/world/chunk/IChunkProvider"};
|
||||
CLASS_ChunkProviderGenerate = new String[]{"net/minecraft/world/gen/ChunkProviderGenerate"};
|
||||
CLASS_Chunk = new String[]{"net/minecraft/world/chunk/Chunk"};
|
||||
FIELD_biomeID = new String[]{"biomeID"};
|
||||
METHOD_getBiomeArray = new String[]{"getBiomeArray"};
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldPatch(final ClassNode cn) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (scanForBrokenCall(method)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean scanForBrokenCall(MethodNode method) {
|
||||
val instructions = method.instructions;
|
||||
val insnCount = instructions.size();
|
||||
for (int i = 0; i < insnCount; i++) {
|
||||
val insn = instructions.get(i);
|
||||
if (insn.getOpcode() != Opcodes.INVOKEVIRTUAL) {
|
||||
continue;
|
||||
}
|
||||
val invoke = (MethodInsnNode) insn;
|
||||
|
||||
if (anyMatch(invoke.owner, CLASS_Chunk) &&
|
||||
anyMatch(invoke.name, METHOD_getBiomeArray) &&
|
||||
invoke.desc.equals("()[B")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean anyMatch(List<String> str, String[] candidates) {
|
||||
for (val s: str) {
|
||||
for (val candidate: candidates) {
|
||||
if (s.equals(candidate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean anyMatch(String str, String[] candidates) {
|
||||
for (val candidate: candidates) {
|
||||
if (str.equals(candidate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean anyMatch(String str, String[] candidates, String prefix, String suffix) {
|
||||
for (val candidate: candidates) {
|
||||
if (str.equals(prefix + candidate + suffix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public interface State<T extends AbstractInsnNode> extends BiFunction<T, Memory, State<AbstractInsnNode>> {}
|
||||
|
||||
private static State<AbstractInsnNode> STATE0 = null;
|
||||
private static State<AbstractInsnNode> STATE1 = null;
|
||||
private static State<AbstractInsnNode> STATE2 = null;
|
||||
private static State<AbstractInsnNode> STATE3 = null;
|
||||
private static State<AbstractInsnNode> STATE4 = null;
|
||||
private static State<AbstractInsnNode> STATE5 = null;
|
||||
private static State<AbstractInsnNode> STATE6 = null;
|
||||
private static State<AbstractInsnNode> STATE7 = null;
|
||||
private static State<AbstractInsnNode> STATE8 = null;
|
||||
private static State<AbstractInsnNode> STATE9 = null;
|
||||
private static State<AbstractInsnNode> STATE10 = null;
|
||||
private static State<AbstractInsnNode> STATE11 = null;
|
||||
private static State<AbstractInsnNode> STATE12 = null;
|
||||
private static State<AbstractInsnNode> STATE13 = null;
|
||||
private static State<AbstractInsnNode> STATE14 = null;
|
||||
private static State<AbstractInsnNode> STATE14_ABD1 = null;
|
||||
private static State<AbstractInsnNode> STATE14_ABD1_BD1 = null;
|
||||
private static State<AbstractInsnNode> STATE14_ABD1_BA2 = null;
|
||||
private static State<AbstractInsnNode> STATE14_ABD1_BA3 = null;
|
||||
private static State<AbstractInsnNode> STATE14_C1 = null;
|
||||
private static State<AbstractInsnNode> STATE15 = null;
|
||||
private static State<AbstractInsnNode> STATE16 = null;
|
||||
private static State<AbstractInsnNode> STATE17 = null;
|
||||
private static State<AbstractInsnNode> STATE_FINAL = null;
|
||||
static {
|
||||
STATE_FINAL = (insn, memory) -> STATE_FINAL;
|
||||
|
||||
STATE0 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.ALOAD) {
|
||||
memory.chunkIndex = insn.var;
|
||||
memory.startingInsn = memory.currentInsn;
|
||||
return STATE1;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE1 = casting(MethodInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.INVOKEVIRTUAL &&
|
||||
anyMatch(insn.owner, CLASS_Chunk) &&
|
||||
anyMatch(insn.name, METHOD_getBiomeArray) &&
|
||||
insn.desc.equals("()[B")) {
|
||||
memory.getBiomeArrayInsn = memory.currentInsn;
|
||||
return STATE2;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE2 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.ASTORE) {
|
||||
memory.biomeArrayIndex = insn.var;
|
||||
return STATE3;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE3 = typeCheck(LabelNode.class, () -> STATE4);
|
||||
|
||||
STATE4 = casting(InsnNode.class, (insn) ->
|
||||
insn.getOpcode() == Opcodes.ICONST_0
|
||||
? STATE5 : STATE0);
|
||||
|
||||
STATE5 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.ISTORE) {
|
||||
memory.iteratorIndex = insn.var;
|
||||
return STATE6;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE6 = typeCheck(LabelNode.class, () -> STATE7);
|
||||
|
||||
STATE7 = casting(FrameNode.class, (insn, memory) ->
|
||||
anyMatch((String)memory.locals.get(memory.chunkIndex), CLASS_Chunk) &&
|
||||
memory.locals.get(memory.biomeArrayIndex).equals("[B") &&
|
||||
memory.locals.get(memory.iteratorIndex).equals(1)
|
||||
? STATE8 : STATE0);
|
||||
|
||||
STATE8 = casting(VarInsnNode.class, (insn, memory) ->
|
||||
insn.getOpcode() == Opcodes.ILOAD &&
|
||||
insn.var == memory.iteratorIndex
|
||||
? STATE9 : STATE0);
|
||||
|
||||
STATE9 = casting(VarInsnNode.class, (insn, memory) ->
|
||||
insn.getOpcode() == Opcodes.ALOAD
|
||||
&& insn.var == memory.biomeArrayIndex
|
||||
? STATE10 : STATE0);
|
||||
|
||||
STATE10 = casting(InsnNode.class, (insn) ->
|
||||
insn.getOpcode() == Opcodes.ARRAYLENGTH
|
||||
? STATE11 : STATE0);
|
||||
|
||||
STATE11 = casting(JumpInsnNode.class, (insn) ->
|
||||
insn.getOpcode() == Opcodes.IF_ICMPGE
|
||||
? STATE12 : STATE0);
|
||||
|
||||
STATE12 = typeCheck(LabelNode.class, () -> STATE13);
|
||||
|
||||
STATE13 = casting(VarInsnNode.class, (insn, memory) ->
|
||||
insn.getOpcode() == Opcodes.ALOAD &&
|
||||
insn.var == memory.biomeArrayIndex
|
||||
? STATE14 : STATE0);
|
||||
|
||||
STATE14 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.ILOAD &&
|
||||
insn.var == memory.iteratorIndex) {
|
||||
if (insn.getNext() instanceof FieldInsnNode) {
|
||||
return STATE14_C1;
|
||||
} else {
|
||||
return STATE14_ABD1;
|
||||
}
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE14_ABD1 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.ALOAD) {
|
||||
if (anyMatch((String)memory.locals.get(insn.var), CLASS_BiomeGenBase, "[L", ";")) {
|
||||
return STATE14_ABD1_BA2;
|
||||
} else {
|
||||
return STATE14_ABD1_BD1;
|
||||
}
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE14_ABD1_BD1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.GETFIELD) {
|
||||
if (anyMatch(insn.desc, CLASS_BiomeGenBase, "[L", ";")) {
|
||||
return STATE14_ABD1_BA2;
|
||||
} else if (anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
||||
return STATE15;
|
||||
}
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE14_ABD1_BA2 = casting(VarInsnNode.class, (insn, memory) ->
|
||||
insn.getOpcode() == Opcodes.ILOAD &&
|
||||
insn.var == memory.iteratorIndex
|
||||
? STATE14_ABD1_BA3 : STATE0);
|
||||
|
||||
STATE14_ABD1_BA3 = casting(InsnNode.class, (insn) ->
|
||||
insn.getOpcode() == Opcodes.AALOAD
|
||||
? STATE15 : STATE0);
|
||||
|
||||
STATE14_C1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.GETSTATIC &&
|
||||
anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
||||
return STATE15;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE15 = casting(FieldInsnNode.class, (insn) ->
|
||||
insn.getOpcode() == Opcodes.GETFIELD &&
|
||||
anyMatch(insn.owner, CLASS_BiomeGenBase) &&
|
||||
anyMatch(insn.name, FIELD_biomeID) &
|
||||
insn.desc.equals("I")
|
||||
? STATE16 : STATE0);
|
||||
|
||||
STATE16 = casting(InsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.I2B) {
|
||||
memory.castInsn = memory.currentInsn;
|
||||
return STATE17;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
|
||||
STATE17 = casting(InsnNode.class, (insn, memory) -> {
|
||||
if (insn.getOpcode() == Opcodes.BASTORE) {
|
||||
memory.arrayStoreInsn = memory.currentInsn;
|
||||
return STATE_FINAL;
|
||||
}
|
||||
return STATE0;
|
||||
});
|
||||
}
|
||||
|
||||
private static <T extends AbstractInsnNode> State<AbstractInsnNode> typeCheck(Class<T> clazz, Supplier<State<AbstractInsnNode>> okState) {
|
||||
return casting(clazz, (insn, memory) -> okState.get());
|
||||
}
|
||||
|
||||
private static <T extends AbstractInsnNode> State<AbstractInsnNode> casting(Class<T> clazz, Function<T, State<AbstractInsnNode>> okState) {
|
||||
return casting(clazz, (insn, memory) -> okState.apply(insn));
|
||||
}
|
||||
|
||||
private static <T extends AbstractInsnNode> State<AbstractInsnNode> casting(Class<T> clazz, State<T> okState) {
|
||||
return (insn, memory) -> {
|
||||
if (insn instanceof LineNumberNode) {
|
||||
return null;
|
||||
} else if (clazz.isInstance(insn)) {
|
||||
return okState.apply(clazz.cast(insn), memory);
|
||||
} else {
|
||||
return STATE0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
boolean patched = false;
|
||||
for (val method: cn.methods) {
|
||||
val memory = findTheTarget(method);
|
||||
if (memory != null) {
|
||||
patched = true;
|
||||
IETransformer.logger.debug("[ChunkProvider patcher]: Match found in method " + method.name);
|
||||
val insnList = method.instructions;
|
||||
for (val node: method.localVariables) {
|
||||
if (node.desc.equals("[B") && node.index == memory.biomeArrayIndex) {
|
||||
node.desc = "[S";
|
||||
}
|
||||
}
|
||||
val getBiomeArray = (MethodInsnNode) insnList.get(memory.getBiomeArrayInsn);
|
||||
insnList.set(getBiomeArray, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, getBiomeArray.owner, "getBiomeShortArray", "()[S", false));
|
||||
insnList.set(insnList.get(memory.castInsn), new InsnNode(Opcodes.I2S));
|
||||
insnList.set(insnList.get(memory.arrayStoreInsn), new InsnNode(Opcodes.SASTORE));
|
||||
}
|
||||
}
|
||||
if (!patched) {
|
||||
IETransformer.logger.debug("[ChunkProvider patcher]: No matches found in class! This is not explicitly " +
|
||||
"an error, because the patch might be applied by a mixin instead!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Memory findTheTarget(MethodNode method) {
|
||||
val insnList = method.instructions;
|
||||
var currentState = STATE0;
|
||||
val memory = new Memory();
|
||||
for (int insnIndex = 0; insnIndex < insnList.size(); insnIndex++) {
|
||||
memory.currentInsn = insnIndex;
|
||||
val insn = insnList.get(insnIndex);
|
||||
if (insn instanceof FrameNode) {
|
||||
val frame = (FrameNode) insn;
|
||||
if (frame.type == Opcodes.F_NEW) {
|
||||
memory.locals.clear();
|
||||
memory.locals.addAll(frame.local);
|
||||
}
|
||||
}
|
||||
val newState = currentState.apply(insn, memory);
|
||||
if (newState != null) {
|
||||
if (newState == STATE_FINAL) {
|
||||
return memory;
|
||||
}
|
||||
currentState = newState;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class Memory {
|
||||
|
||||
int currentInsn;
|
||||
|
||||
int startingInsn;
|
||||
int getBiomeArrayInsn;
|
||||
int castInsn;
|
||||
int arrayStoreInsn;
|
||||
|
||||
int chunkIndex;
|
||||
int biomeArrayIndex;
|
||||
int iteratorIndex;
|
||||
|
||||
final List<Object> locals = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class CofhBlockHelper implements IClassNodeTransformer
|
||||
{
|
||||
public CofhBlockHelper() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "<clinit>");
|
||||
if (!AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.blockIDCount, ExtendedConstants.blockIDCount, true)) {
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.blockIDCount / 4, ExtendedConstants.blockIDCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.ClassEdit;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import com.falsepattern.endlessids.asm.IETransformer;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.util.CheckClassAdapter;
|
||||
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class DevFixer {
|
||||
private static final ClassNode blocks;
|
||||
static {
|
||||
if (IETransformer.isObfuscated) {
|
||||
blocks = null;
|
||||
} else {
|
||||
try {
|
||||
byte[] blox = Launch.classLoader.getClassBytes("net/minecraft/init/Blocks");
|
||||
blocks = new ClassNode(Opcodes.ASM5);
|
||||
final ClassReader reader = new ClassReader(blox);
|
||||
reader.accept(blocks, 0);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] fixDev(byte[] classBytes) {
|
||||
if (IETransformer.isObfuscated) {
|
||||
return classBytes;
|
||||
}
|
||||
val cn = new ClassNode(Opcodes.ASM5);
|
||||
val reader = new ClassReader(classBytes);
|
||||
reader.accept(cn, 0);
|
||||
transform(cn);
|
||||
val writer = new ClassWriter(0);
|
||||
val check = new CheckClassAdapter(writer);
|
||||
cn.accept(check);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void transform(final ClassNode cn) {
|
||||
if (IETransformer.isObfuscated) {
|
||||
return;
|
||||
}
|
||||
remapBlocks(cn);
|
||||
if (cn.name.equals("net/minecraft/world/biome/BiomeGenBase")) {
|
||||
biomeTweakerCompat(cn);
|
||||
}
|
||||
}
|
||||
|
||||
private static void biomeTweakerCompat(final ClassNode cn) {
|
||||
for (val field: cn.fields) {
|
||||
if (field.name.startsWith("spawnable")) {
|
||||
field.access &= ~Opcodes.ACC_PROTECTED;
|
||||
field.access |= Opcodes.ACC_PUBLIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void remapBlocks(final ClassNode cn) {
|
||||
for (val method: cn.methods) {
|
||||
val instructions = method.instructions;
|
||||
int insnCount = instructions.size();
|
||||
for (int i = 0; i < insnCount; i++) {
|
||||
val insn = instructions.get(i);
|
||||
if (insn instanceof FieldInsnNode) {
|
||||
val field = (FieldInsnNode) insn;
|
||||
if (field.getOpcode() == Opcodes.GETSTATIC &&
|
||||
field.owner.equals("net/minecraft/init/Blocks")) {
|
||||
for (val blockField: blocks.fields) {
|
||||
if (blockField.name.equals(field.name) &&
|
||||
!blockField.desc.equals(field.desc)) {
|
||||
field.desc = blockField.desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.ASMHooks;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.FrameNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.LineNumberNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class DragonAPIModList implements IClassNodeTransformer {
|
||||
private static final List<String> fields = Arrays.asList("condition", "itemClasses", "blockClasses");
|
||||
|
||||
private static void tweakIsLoaded(MethodNode method) {
|
||||
val iterator = method.instructions.iterator();
|
||||
iterator.next();
|
||||
iterator.next();
|
||||
iterator.next();
|
||||
iterator.next();
|
||||
iterator.set(new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(ASMHooks.class),
|
||||
"DragonAPIModListTryLoad", "(LReika/DragonAPI/ModList;)Z", false));
|
||||
}
|
||||
|
||||
private static void tweakInit(MethodNode method) {
|
||||
val iterator = method.instructions.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
var insn = iterator.next();
|
||||
if (insn instanceof LineNumberNode && ((LineNumberNode) insn).line == 154) {
|
||||
//SRC:
|
||||
// L3
|
||||
// LINENUMBER 154 L3
|
||||
// ALOAD 0
|
||||
// ALOAD 0
|
||||
// GETFIELD Reika/DragonAPI/ModList.modLabel : Ljava/lang/String;
|
||||
// INVOKESTATIC cpw/mods/fml/common/Loader.isModLoaded (Ljava/lang/String;)Z
|
||||
// PUTFIELD Reika/DragonAPI/ModList.condition : Z
|
||||
//TGT:
|
||||
// L3
|
||||
// LINENUMBER 154 L3
|
||||
// ALOAD 0
|
||||
// ALOAD 5
|
||||
// PUTFIELD Reika/DragonAPI/ModList.itemClasses : [Ljava/lang/String;
|
||||
// ALOAD 0
|
||||
// ALOAD 4
|
||||
// PUTFIELD Reika/DragonAPI/ModList.blockClasses : [Ljava/lang/String;
|
||||
// ALOAD 0
|
||||
// INVOKESTATIC ASMHooks.isModLoaded (LReika/DragonAPI/ModList;)V
|
||||
// FRAME FULL [Reika/DragonAPI/ModList java/lang/String I java/lang/String [Ljava/lang/String; [Ljava/lang/String;] []
|
||||
// RETURN
|
||||
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
iterator.add(new VarInsnNode(Opcodes.ALOAD, 5));
|
||||
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "itemClasses",
|
||||
"[Ljava/lang/String;"));
|
||||
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
iterator.add(new VarInsnNode(Opcodes.ALOAD, 4));
|
||||
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "blockClasses",
|
||||
"[Ljava/lang/String;"));
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
iterator.next();
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
var methodInsn = (MethodInsnNode) iterator.next();
|
||||
methodInsn.owner = Type.getInternalName(ASMHooks.class);
|
||||
methodInsn.name = "DragonAPIModListConstructorTweak";
|
||||
methodInsn.desc = "(LReika/DragonAPI/ModList;)V";
|
||||
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
|
||||
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
|
||||
"java/lang/String", "[Ljava/lang/String;",
|
||||
"[Ljava/lang/String;"}, 0, new Object[]{}));
|
||||
iterator.add(new InsnNode(Opcodes.RETURN));
|
||||
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
|
||||
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
|
||||
"java/lang/String", "[Ljava/lang/String;",
|
||||
"[Ljava/lang/String;"}, 0, new Object[]{}));
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void crash() {
|
||||
throw new IllegalStateException("Tweaking failed!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
int state = 0;
|
||||
for (val field : cn.fields) {
|
||||
if (field.name.equals("__MARKER__FALSEPATTERN__MIXINPATCH__")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (val field : cn.fields) {
|
||||
if (field.name.equals("condition") && field.desc.equals("Z")) {
|
||||
field.access &= ~Opcodes.ACC_FINAL;
|
||||
state++;
|
||||
}
|
||||
if (fields.contains(field.name)) {
|
||||
field.access &= ~Opcodes.ACC_PRIVATE;
|
||||
field.access &= ~Opcodes.ACC_PROTECTED;
|
||||
field.access |= Opcodes.ACC_PUBLIC;
|
||||
state++;
|
||||
}
|
||||
}
|
||||
if (state != 4) {
|
||||
crash();
|
||||
}
|
||||
cn.fields.add(new FieldNode(Opcodes.ACC_PUBLIC, "successful", "Z", null, 0));
|
||||
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "__MARKER__FALSEPATTERN__MIXINPATCH__", "Z", null, 0));
|
||||
|
||||
int state2 = 0;
|
||||
for (val method : cn.methods) {
|
||||
if ((state2 & 1) == 0 && method.name.equals("<init>") &&
|
||||
method.desc.equals("(Ljava/lang/String;ILjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V")) {
|
||||
tweakInit(method);
|
||||
state2 |= 1;
|
||||
}
|
||||
if ((state2 & 2) == 0 && method.name.equals("isLoaded") && method.desc.equals("()Z")) {
|
||||
tweakIsLoaded(method);
|
||||
state2 |= 2;
|
||||
}
|
||||
}
|
||||
if (state2 != 3) {
|
||||
crash();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,19 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import lombok.var;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public class FmlRegistry implements IClassNodeTransformer
|
||||
{
|
||||
public class FmlRegistry implements IClassNodeTransformer {
|
||||
public FmlRegistry() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||
@@ -28,7 +26,8 @@ public class FmlRegistry implements IClassNodeTransformer
|
||||
}
|
||||
boolean found = false;
|
||||
for (final MethodNode method : cn.methods) {
|
||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID, ExtendedConstants.maxBlockID, true)) {
|
||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID,
|
||||
ExtendedConstants.maxBlockID, true)) {
|
||||
found = true;
|
||||
}
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import com.falsepattern.endlessids.IEConfig;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class MFQM implements IClassNodeTransformer
|
||||
{
|
||||
public MFQM() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
if (IEConfig.extendDataWatcher) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.MFQM_preInit);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.watchableMask, ExtendedConstants.watchableMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
|
||||
public class SpaceCoreModInfoGenerator implements IClassNodeTransformer {
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
if (obfuscated) {
|
||||
return;
|
||||
}
|
||||
for (val method: cn.methods) {
|
||||
if (method.name.equals("generate")) {
|
||||
val iterator = method.instructions.iterator();
|
||||
iterator.add(new InsnNode(Opcodes.RETURN));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class UndergroundBiomesBiomeUndergroundDecorator implements IClassNodeTransformer
|
||||
{
|
||||
public UndergroundBiomesBiomeUndergroundDecorator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, Name.ub_bud_replaceChunkOres_world);
|
||||
this.transformReplaceChunkOres(cn, method, obfuscated, 1);
|
||||
method = AsmUtil.findMethod(cn, Name.ub_bud_replaceChunkOres_iChunkProvider);
|
||||
this.transformReplaceChunkOres(cn, method, obfuscated, 0);
|
||||
}
|
||||
|
||||
private void transformReplaceChunkOres(final ClassNode cn, final MethodNode method, final boolean obfuscated, final int varOffset) {
|
||||
final InsnList code = method.instructions;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (insn.getOpcode() == 182 && Name.ebs_getBlockLSBArray.matches((MethodInsnNode)insn, obfuscated)) {
|
||||
iterator.remove();
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 9 + varOffset));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 18 + varOffset));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 10 + varOffset));
|
||||
iterator.add((AbstractInsnNode)Name.hooks_getBlockId.staticInvocation(obfuscated));
|
||||
while (((AbstractInsnNode)iterator.next()).getOpcode() != 54) {
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class UndergroundBiomesOreUBifier implements IClassNodeTransformer
|
||||
{
|
||||
public UndergroundBiomesOreUBifier() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "renewBlockReplacers");
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.blockIDCount, ExtendedConstants.blockIDCount, false);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class WorldEditBaseBlock implements IClassNodeTransformer
|
||||
{
|
||||
public WorldEditBaseBlock() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "internalSetId", true);
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID, ExtendedConstants.maxBlockID);
|
||||
final InsnList code = method.instructions;
|
||||
val iter = code.iterator();
|
||||
while (iter.hasNext()) {
|
||||
val insn = iter.next();
|
||||
if (insn.getType() == 9 && ((LdcInsnNode)insn).cst instanceof String) {
|
||||
final String string = (String)((LdcInsnNode)insn).cst;
|
||||
if (string.contains(Integer.toString(VanillaConstants.maxBlockID))) {
|
||||
((LdcInsnNode)insn).cst = string.replace(Integer.toString(VanillaConstants.maxBlockID), Integer.toString(ExtendedConstants.maxBlockID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.falsepattern.endlessids.config;
|
||||
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
|
||||
@Config(modid = Tags.MODID, category = "darkworld")
|
||||
public class DarkWorldIDConfig {
|
||||
static {
|
||||
ConfigurationManager.selfInit();
|
||||
}
|
||||
@Config.Comment("Original: 100")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10100)
|
||||
public static int darkOceanID;
|
||||
|
||||
@Config.Comment("Original: 101")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10101)
|
||||
public static int darkPlainsID;
|
||||
|
||||
@Config.Comment("Original: 102")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10102)
|
||||
public static int darkDesertID;
|
||||
|
||||
@Config.Comment("Original: 103")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10103)
|
||||
public static int darkHillsID;
|
||||
|
||||
@Config.Comment("Original: 104")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10104)
|
||||
public static int darkForestID;
|
||||
|
||||
@Config.Comment("Original: 105")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10105)
|
||||
public static int darkTaigaID;
|
||||
|
||||
@Config.Comment("Original: 106")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(10106)
|
||||
public static int darkSwampID;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.falsepattern.endlessids.config;
|
||||
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
|
||||
@Config(modid = Tags.MODID, category = "futurepack")
|
||||
public class FuturepackIDConfig {
|
||||
static {
|
||||
ConfigurationManager.selfInit();
|
||||
}
|
||||
@Config.Comment("Original: 97")
|
||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
||||
@Config.DefaultInt(11097)
|
||||
public static int spaceID;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.falsepattern.endlessids.config;
|
||||
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
|
||||
@Config(modid = Tags.MODID)
|
||||
public class GeneralConfig {
|
||||
static {
|
||||
ConfigurationManager.selfInit();
|
||||
}
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean catchUnregisteredBlocks;
|
||||
|
||||
@Config.Comment("Remove invalid (corrupted) blocks from the game.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean removeInvalidBlocks;
|
||||
|
||||
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean extendDataWatcher;
|
||||
|
||||
@Config.Comment(
|
||||
"Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
||||
"Notice: This does not affect ITEM IDs.\n" +
|
||||
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
||||
"this value.\n" +
|
||||
"(0: 16M, 1: 8M, 2: 4M, 3: 2M, 4: 1M, 5: 512K, 6: 256K, 7: 128K, 8: 64K, 9: 32K, 10: 16K, 11: 8K, 12: 4K)\n")
|
||||
@Config.RangeInt(min = 0,
|
||||
max = 12)
|
||||
@Config.DefaultInt(0)
|
||||
public static int countCorrectionBits;
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.falsepattern.endlessids.constants;
|
||||
|
||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||
|
||||
public class ExtendedConstants {
|
||||
//Tunables
|
||||
public static final int bitsPerID = 24;
|
||||
public static final int bitsPerMetadata = 4;
|
||||
public static final int countCorrectionBits = 0;
|
||||
public static final int countCorrectionBits = GeneralConfig.countCorrectionBits;
|
||||
|
||||
public static final int watchableBits = 7;
|
||||
public static final int bitsPerBiome = 16;
|
||||
|
||||
//IDs
|
||||
//BlockItemIDs
|
||||
public static final int nibblesPerID = bitsPerID / 4;
|
||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||
|
||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
||||
|
||||
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
||||
@@ -22,9 +24,15 @@ public class ExtendedConstants {
|
||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerEBS = nibblesPerEBS / 2;
|
||||
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
|
||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||
|
||||
//BiomeIDs
|
||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||
public static final int biomeIDMask = biomeIDCount - 1;
|
||||
public static final int biomeIDNull = biomeIDMask;
|
||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
||||
//Chunk
|
||||
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
||||
//DataWatcher
|
||||
public static final int watchableCount = 1 << watchableBits;
|
||||
public static final int maxWatchableID = watchableCount - 1;
|
||||
|
||||
@@ -7,12 +7,12 @@ public class VanillaConstants {
|
||||
public static final int countCorrectionBits = 0;
|
||||
|
||||
public static final int watchableBits = 5;
|
||||
public static final int bitsPerBiome = 8;
|
||||
|
||||
//IDs
|
||||
//BlockItemIDs
|
||||
public static final int nibblesPerID = bitsPerID / 4;
|
||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||
|
||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
||||
|
||||
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
||||
@@ -22,9 +22,15 @@ public class VanillaConstants {
|
||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerEBS = nibblesPerEBS / 2;
|
||||
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
|
||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||
|
||||
//BiomeIDs
|
||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||
public static final int biomeIDMask = biomeIDCount - 1;
|
||||
public static final int biomeIDNull = biomeIDMask;
|
||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
||||
//Chunk
|
||||
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
||||
//DataWatcher
|
||||
public static final int watchableCount = 1 << watchableBits;
|
||||
public static final int maxWatchableID = watchableCount - 1;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class AIDCStringFixer {
|
||||
public static String fixString(String str) {
|
||||
str = str.replace("\\", "");
|
||||
str = str.replace("vaible", "vailable");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
|
||||
public class BiomePatchHelper {
|
||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
|
||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
||||
}
|
||||
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
|
||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
|
||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
|
||||
}
|
||||
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
public interface IChunkMixin {
|
||||
short[] getBiomeShortArray();
|
||||
|
||||
void setBiomeShortArray(short[] data);
|
||||
}
|
||||
+3
@@ -2,7 +2,10 @@ package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
public interface IExtendedBlockStorageMixin {
|
||||
void setBlockRefCount(int value);
|
||||
|
||||
void setTickRefCount(int value);
|
||||
|
||||
short[] getLSB();
|
||||
|
||||
byte[] getMSB();
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
import com.falsepattern.endlessids.Hooks;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.val;
|
||||
import lotr.common.LOTRDimension;
|
||||
import lotr.common.network.LOTRPacketBiomeVariantsUnwatch;
|
||||
import lotr.common.network.LOTRPacketBiomeVariantsWatch;
|
||||
import lotr.common.network.LOTRPacketHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class LOTRBiomeVariantStorageShort {
|
||||
private static final Map<LOTRDimension, Map<ChunkCoordIntPair, short[]>> chunkVariantMap = new HashMap<>();
|
||||
private static final Map<LOTRDimension, Map<ChunkCoordIntPair, short[]>> chunkVariantMapClient = new HashMap<>();
|
||||
|
||||
private static Map<ChunkCoordIntPair, short[]> getDimensionChunkMap(World world) {
|
||||
Map<LOTRDimension, Map<ChunkCoordIntPair, short[]>> sourcemap;
|
||||
if (!world.isRemote) {
|
||||
sourcemap = chunkVariantMap;
|
||||
} else {
|
||||
sourcemap = chunkVariantMapClient;
|
||||
}
|
||||
|
||||
val dim = LOTRDimension.getCurrentDimensionWithFallback(world);
|
||||
|
||||
return sourcemap.computeIfAbsent(dim, k -> new HashMap<>());
|
||||
}
|
||||
|
||||
private static ChunkCoordIntPair getChunkKey(Chunk chunk) {
|
||||
return new ChunkCoordIntPair(chunk.xPosition, chunk.zPosition);
|
||||
}
|
||||
|
||||
public static short[] getChunkBiomeVariants(World world, Chunk chunk) {
|
||||
return getChunkBiomeVariants(world, getChunkKey(chunk));
|
||||
}
|
||||
|
||||
public static short[] getChunkBiomeVariants(World world, ChunkCoordIntPair chunk) {
|
||||
return getDimensionChunkMap(world).get(chunk);
|
||||
}
|
||||
|
||||
public static void setChunkBiomeVariants(World world, Chunk chunk, short[] variants) {
|
||||
setChunkBiomeVariants(world, getChunkKey(chunk), variants);
|
||||
}
|
||||
|
||||
public static void setChunkBiomeVariants(World world, ChunkCoordIntPair chunk, short[] variants) {
|
||||
getDimensionChunkMap(world).put(chunk, variants);
|
||||
}
|
||||
|
||||
public static void clearChunkBiomeVariants(World world, Chunk chunk) {
|
||||
clearChunkBiomeVariants(world, getChunkKey(chunk));
|
||||
}
|
||||
|
||||
public static void clearChunkBiomeVariants(World world, ChunkCoordIntPair chunk) {
|
||||
getDimensionChunkMap(world).remove(chunk);
|
||||
}
|
||||
|
||||
public static void loadChunkVariants(World world, Chunk chunk, NBTTagCompound data) {
|
||||
if (getChunkBiomeVariants(world, chunk) == null) {
|
||||
short[] variants;
|
||||
if (data.hasKey("LOTRBiomeVariantsS")) {
|
||||
variants = Hooks.byteToShortArray(data.getByteArray("LOTRBiomeVariantsS"));
|
||||
} else {
|
||||
variants = new short[256];
|
||||
}
|
||||
|
||||
setChunkBiomeVariants(world, chunk, variants);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void saveChunkVariants(World world, Chunk chunk, NBTTagCompound data) {
|
||||
val variants = getChunkBiomeVariants(world, chunk);
|
||||
if (variants != null) {
|
||||
data.setByteArray("LOTRBiomeVariantsS", Hooks.shortToByteArray(variants));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void clearAllVariants(World world) {
|
||||
getDimensionChunkMap(world).clear();
|
||||
FMLLog.info("Unloading LOTR biome variants in %s",
|
||||
LOTRDimension.getCurrentDimensionWithFallback(world).dimensionName);
|
||||
}
|
||||
|
||||
public static void performCleanup(WorldServer world) {
|
||||
val dimensionMap = getDimensionChunkMap(world);
|
||||
val removalChunks = new ArrayList<ChunkCoordIntPair>();
|
||||
|
||||
for (val chunk : dimensionMap.keySet()) {
|
||||
if (!world.theChunkProviderServer.chunkExists(chunk.chunkXPos, chunk.chunkZPos)) {
|
||||
removalChunks.add(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
for (val chunk : removalChunks) {
|
||||
dimensionMap.remove(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendChunkVariantsToPlayer(World world, Chunk chunk, EntityPlayerMP entityplayer) {
|
||||
short[] variants = getChunkBiomeVariants(world, chunk);
|
||||
if (variants != null) {
|
||||
val packet = new LOTRPacketBiomeVariantsWatch(chunk.xPosition, chunk.zPosition,
|
||||
Hooks.shortToByteArray(variants));
|
||||
LOTRPacketHandler.networkWrapper.sendTo(packet, entityplayer);
|
||||
} else {
|
||||
val dimName = world.provider.getDimensionName();
|
||||
val posX = chunk.xPosition << 4;
|
||||
val posZ = chunk.zPosition << 4;
|
||||
val playerName = entityplayer.getCommandSenderName();
|
||||
FMLLog.severe("Could not find LOTR biome variants for %s chunk at %d, %d; requested by %s", dimName, posX,
|
||||
posZ, playerName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendUnwatchToPlayer(World world, Chunk chunk, EntityPlayerMP entityplayer) {
|
||||
val packet = new LOTRPacketBiomeVariantsUnwatch(chunk.xPosition, chunk.zPosition);
|
||||
LOTRPacketHandler.networkWrapper.sendTo(packet, entityplayer);
|
||||
}
|
||||
|
||||
public static int getSize(World world) {
|
||||
val map = getDimensionChunkMap(world);
|
||||
return map.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class ShortUtil {
|
||||
public static int unsignedShortToInt(short s) {
|
||||
return s & 65535;
|
||||
}
|
||||
|
||||
public static int[] unsignedShortToIntArray(short[] shorts) {
|
||||
int[] ints = new int[shorts.length];
|
||||
|
||||
for(int i = 0; i < shorts.length; ++i) {
|
||||
ints[i] = unsignedShortToInt(shorts[i]);
|
||||
}
|
||||
|
||||
return ints;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers.stubpackage.lotr.common.network;
|
||||
|
||||
public class LOTRPacketBiomeVariantsWatch {
|
||||
public int chunkX;
|
||||
public int chunkZ;
|
||||
public byte[] variants;
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.biomewand;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.spacechase0.minecraft.biomewand.BiomeWandMod;
|
||||
import com.spacechase0.minecraft.biomewand.item.BiomeWandItem;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = BiomeWandItem.class,
|
||||
remap = false)
|
||||
public abstract class BiomeWandItemMixin {
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Biome ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
int biomeID = -1;
|
||||
if (tag != null && tag.hasKey("sampledBiomeS")) {
|
||||
biomeID = Short.toUnsignedInt(tag.getShort("sampledBiomeS"));
|
||||
}
|
||||
if (pass != 1) {
|
||||
return -1;
|
||||
}
|
||||
if (biomeID < 0) {
|
||||
return 0;
|
||||
}
|
||||
val biome = BiomeGenBase.getBiomeGenArray()[biomeID];
|
||||
if (biome == null) {
|
||||
return 0;
|
||||
}
|
||||
return biome.color;
|
||||
}
|
||||
}
|
||||
+43
-33
@@ -1,55 +1,62 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.client;
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||
|
||||
import com.falsepattern.endlessids.Hooks;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.NibbleArray;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({"rawtypes", "WhileLoopReplaceableByForEach", "unchecked"})
|
||||
@Mixin(Chunk.class)
|
||||
public abstract class ChunkMixin {
|
||||
@Shadow public Map chunkTileEntityMap;
|
||||
@Shadow
|
||||
public Map chunkTileEntityMap;
|
||||
|
||||
@Shadow public World worldObj;
|
||||
@Shadow
|
||||
public World worldObj;
|
||||
@Shadow
|
||||
public boolean isLightPopulated;
|
||||
@Shadow
|
||||
public boolean isTerrainPopulated;
|
||||
@Shadow
|
||||
private ExtendedBlockStorage[] storageArrays;
|
||||
@Shadow
|
||||
private byte[] blockBiomeArray;
|
||||
|
||||
@Shadow private ExtendedBlockStorage[] storageArrays;
|
||||
@Shadow
|
||||
public abstract void generateHeightMap();
|
||||
|
||||
@Shadow private byte[] blockBiomeArray;
|
||||
@Shadow
|
||||
public abstract Block getBlock(int p_150810_1_, int p_150810_2_, int p_150810_3_);
|
||||
|
||||
@Shadow public boolean isLightPopulated;
|
||||
|
||||
@Shadow public boolean isTerrainPopulated;
|
||||
|
||||
@Shadow public abstract void generateHeightMap();
|
||||
|
||||
@Shadow public abstract Block getBlock(int p_150810_1_, int p_150810_2_, int p_150810_3_);
|
||||
|
||||
@Shadow public abstract int getBlockMetadata(int p_76628_1_, int p_76628_2_, int p_76628_3_);
|
||||
@Shadow
|
||||
public abstract int getBlockMetadata(int p_76628_1_, int p_76628_2_, int p_76628_3_);
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Direct port from dumped code
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Overwrite
|
||||
public void fillChunk(byte[] var1, int var2, int var3, boolean var4) {
|
||||
Iterator var5 = this.chunkTileEntityMap.values().iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
TileEntity var6 = (TileEntity)var5.next();
|
||||
while (var5.hasNext()) {
|
||||
TileEntity var6 = (TileEntity) var5.next();
|
||||
var6.updateContainingBlockInfo();
|
||||
var6.getBlockMetadata();
|
||||
var6.getBlockType();
|
||||
@@ -59,7 +66,7 @@ public abstract class ChunkMixin {
|
||||
boolean var7 = !this.worldObj.provider.hasNoSky;
|
||||
|
||||
int var8;
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
if ((var2 & 1 << var8) != 0) {
|
||||
if (this.storageArrays[var8] == null) {
|
||||
this.storageArrays[var8] = new ExtendedBlockStorage(var8 << 4, var7);
|
||||
@@ -73,7 +80,7 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
|
||||
NibbleArray var9;
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||
var9 = this.storageArrays[var8].getMetadataArray();
|
||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||
@@ -81,7 +88,7 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
}
|
||||
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||
var9 = this.storageArrays[var8].getBlocklightArray();
|
||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||
@@ -90,7 +97,7 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
|
||||
if (var7) {
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||
var9 = this.storageArrays[var8].getSkylightArray();
|
||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||
@@ -100,10 +107,10 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
|
||||
if (var4) {
|
||||
System.arraycopy(var1, var16, this.blockBiomeArray, 0, this.blockBiomeArray.length);
|
||||
var16 += Hooks.readBiomeArrayFromPacket((Chunk) (Object) this, var1, var16);
|
||||
}
|
||||
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
if (this.storageArrays[var8] != null && (var2 & 1 << var8) != 0) {
|
||||
this.storageArrays[var8].removeInvalidBlocks();
|
||||
}
|
||||
@@ -115,21 +122,24 @@ public abstract class ChunkMixin {
|
||||
ArrayList var10 = new ArrayList();
|
||||
|
||||
TileEntity var11;
|
||||
for(var5 = this.chunkTileEntityMap.values().iterator(); var5.hasNext(); var11.updateContainingBlockInfo()) {
|
||||
var11 = (TileEntity)var5.next();
|
||||
for (var5 = this.chunkTileEntityMap.values().iterator(); var5.hasNext(); var11.updateContainingBlockInfo()) {
|
||||
var11 = (TileEntity) var5.next();
|
||||
int var12 = var11.xCoord & 15;
|
||||
int var13 = var11.yCoord;
|
||||
int var14 = var11.zCoord & 15;
|
||||
Block var15 = var11.getBlockType();
|
||||
if ((var15 != this.getBlock(var12, var13, var14) || var11.blockMetadata != this.getBlockMetadata(var12, var13, var14)) && var11.shouldRefresh(var15, this.getBlock(var12, var13, var14), var11.blockMetadata, this.getBlockMetadata(var12, var13, var14), this.worldObj, var12, var13, var14)) {
|
||||
if ((var15 != this.getBlock(var12, var13, var14) ||
|
||||
var11.blockMetadata != this.getBlockMetadata(var12, var13, var14)) &&
|
||||
var11.shouldRefresh(var15, this.getBlock(var12, var13, var14), var11.blockMetadata,
|
||||
this.getBlockMetadata(var12, var13, var14), this.worldObj, var12, var13, var14)) {
|
||||
var10.add(var11);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator var17 = var10.iterator();
|
||||
|
||||
while(var17.hasNext()) {
|
||||
TileEntity var18 = (TileEntity)var17.next();
|
||||
while (var17.hasNext()) {
|
||||
TileEntity var18 = (TileEntity) var17.next();
|
||||
var18.invalidate();
|
||||
}
|
||||
|
||||
+12
-9
@@ -1,14 +1,15 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.client;
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
@@ -18,7 +19,8 @@ import java.io.IOException;
|
||||
@Mixin(NetHandlerPlayClient.class)
|
||||
public abstract class NetHandlerPlayClientMixin {
|
||||
|
||||
@Shadow private WorldClient clientWorldController;
|
||||
@Shadow
|
||||
private WorldClient clientWorldController;
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
if (packetIn.func_148921_d() != null) {
|
||||
DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(packetIn.func_148921_d()));
|
||||
|
||||
for(int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||
for (int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||
short var6 = dataInput.readShort();
|
||||
short idLSB = dataInput.readShort();
|
||||
byte idMSB = dataInput.readByte();
|
||||
@@ -41,7 +43,8 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
int var10 = var6 >> 12 & 15;
|
||||
int var11 = var6 >> 8 & 15;
|
||||
int var12 = var6 & 255;
|
||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id), var9);
|
||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id),
|
||||
var9);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -1,17 +1,18 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common;
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||
|
||||
import com.falsepattern.endlessids.asm.Constants;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
|
||||
@Mixin(PlayerControllerMP.class)
|
||||
public abstract class PlayerControllerMPMixin {
|
||||
@ModifyConstant(method = "onPlayerDestroyBlock",
|
||||
constant = @Constant(intValue = VanillaConstants.bitsPerID, ordinal = 0),
|
||||
constant = @Constant(intValue = VanillaConstants.bitsPerID,
|
||||
ordinal = 0),
|
||||
require = 1)
|
||||
private int extend1(int constant) {
|
||||
return ExtendedConstants.bitsPerID;
|
||||
+5
-4
@@ -1,14 +1,15 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.client;
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Mixin(RenderGlobal.class)
|
||||
public abstract class RenderGlobalMixin {
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.abyssalcraft;
|
||||
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.shinoow.abyssalcraft.AbyssalCraft;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@Mixin(value = AbyssalCraft.class,
|
||||
remap = false)
|
||||
public abstract class AbyssalCraftMixin {
|
||||
@Shadow
|
||||
public static int configBiomeId1;
|
||||
@Shadow
|
||||
public static int configBiomeId2;
|
||||
@Shadow
|
||||
public static int configBiomeId3;
|
||||
@Shadow
|
||||
public static int configBiomeId4;
|
||||
@Shadow
|
||||
public static int configBiomeId5;
|
||||
@Shadow
|
||||
public static int configBiomeId6;
|
||||
@Shadow
|
||||
public static int configBiomeId7;
|
||||
@Shadow
|
||||
public static int configBiomeId8;
|
||||
@Shadow
|
||||
public static int configBiomeId9;
|
||||
@Shadow
|
||||
public static int configBiomeId10;
|
||||
@Shadow
|
||||
public static int configBiomeId11;
|
||||
@Shadow
|
||||
public static int configBiomeId12;
|
||||
@Shadow
|
||||
public static int configBiomeId13;
|
||||
|
||||
@Inject(method = "checkBiomeIds",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||
val bga = BiomeGenBase.getBiomeGenArray();
|
||||
|
||||
int[] biomes = new int[]{configBiomeId1, configBiomeId2, configBiomeId3, configBiomeId4, configBiomeId5,
|
||||
configBiomeId6, configBiomeId7, configBiomeId8, configBiomeId9, configBiomeId10,
|
||||
configBiomeId11, configBiomeId12, configBiomeId13};
|
||||
for (val biome : biomes) {
|
||||
if (biome < 0 || biome >= ExtendedConstants.biomeIDCount) {
|
||||
continue;
|
||||
}
|
||||
if (bga[biome] instanceof PlaceholderBiome) {
|
||||
bga[biome] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Mixin(value = AntiIdConflictBase.class,
|
||||
remap = false)
|
||||
public abstract class AntiIdConflictBaseMixin {
|
||||
@Shadow
|
||||
public static File mainFolder;
|
||||
|
||||
@Inject(method = "preinit",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private static void fixPath(FMLPreInitializationEvent event, CallbackInfo ci) {
|
||||
mainFolder = new File(event.getModConfigurationDirectory().getPath(), "AntiIDConflict");
|
||||
}
|
||||
|
||||
@Redirect(method = "preinit",
|
||||
at = @At(value = "FIELD",
|
||||
target = "Lcode/elix_x/coremods/antiidconflict/AntiIdConflictBase;mainFolder:Ljava/io/File;",
|
||||
opcode = Opcodes.PUTSTATIC),
|
||||
require = 1)
|
||||
private static void removeOldPut(File value) {
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.core.AsmHooks;
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@Mixin(BiomeGenBase.class)
|
||||
public abstract class BiomeGenBasePlaceholderMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private static BiomeGenBase[] biomeList;
|
||||
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature", "UnresolvedMixinReference", "MixinAnnotationTarget"})
|
||||
@Redirect(method = "<init>(IZ)V",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lcode/elix_x/coremods/antiidconflict/core/AsmHooks;getBiomeID(IZ)I",
|
||||
remap = false),
|
||||
require = 1)
|
||||
private int removePlaceholders(int id, boolean register) {
|
||||
if (register) {
|
||||
if (biomeList[id] instanceof PlaceholderBiome) {
|
||||
biomeList[id] = null;
|
||||
}
|
||||
}
|
||||
return AsmHooks.getBiomeID(id, register);
|
||||
}
|
||||
}
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||
import lombok.val;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import static code.elix_x.coremods.antiidconflict.managers.BiomesManager.conflicts;
|
||||
|
||||
@Mixin(value = BiomesManager.class,
|
||||
remap = false)
|
||||
public abstract class BiomesManagerMixin {
|
||||
@Shadow
|
||||
public static String freeBiomeIDs;
|
||||
|
||||
@Shadow
|
||||
public static String occupiedBiomeIDs;
|
||||
|
||||
@Shadow
|
||||
public static boolean debug;
|
||||
|
||||
@Shadow
|
||||
public static int IconflictedIds;
|
||||
|
||||
@Shadow
|
||||
public static String conflictedIds;
|
||||
|
||||
private static String[] getIntervalNaming(int first, int last) {
|
||||
if (first == last) {
|
||||
return new String[]{Integer.toString(first)};
|
||||
} else if (first + 1 == last) {
|
||||
return new String[]{Integer.toString(first), Integer.toString(last)};
|
||||
} else {
|
||||
return new String[]{first + "-" + last};
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
||||
constant = {@Constant(stringValue = "\\biomes"),
|
||||
@Constant(stringValue = "\\main.cfg")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Better code, and detecting empty areas.
|
||||
*/
|
||||
@Overwrite
|
||||
public static void updateBiomesFolder() throws Exception {
|
||||
val biomes = BiomeGenBase.getBiomeGenArray();
|
||||
val builder = new StringBuilder();
|
||||
boolean hasEmpty = false;
|
||||
int emptyRegionStart = 0;
|
||||
for (int i = 0; i < biomes.length; ++i) {
|
||||
if (biomes[i] == null) {
|
||||
if (!hasEmpty) {
|
||||
emptyRegionStart = i;
|
||||
hasEmpty = true;
|
||||
}
|
||||
++BiomesManager.freeIds;
|
||||
} else if (hasEmpty) {
|
||||
hasEmpty = false;
|
||||
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
|
||||
builder.append(part).append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasEmpty) {
|
||||
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
|
||||
builder.append(part).append('\n');
|
||||
}
|
||||
}
|
||||
freeBiomeIDs = builder.toString();
|
||||
builder.setLength(0);
|
||||
|
||||
System.out.println("Found " + BiomesManager.freeIds + " free biome ids in total.");
|
||||
|
||||
for (val biome : biomes) {
|
||||
if (biome != null) {
|
||||
builder.append(biome.biomeID)
|
||||
.append(" : ")
|
||||
.append(biome.biomeName)
|
||||
.append(" (")
|
||||
.append(biome.getBiomeClass())
|
||||
.append(")\n");
|
||||
++BiomesManager.occupiedIds;
|
||||
}
|
||||
}
|
||||
occupiedBiomeIDs = builder.toString();
|
||||
builder.setLength(0);
|
||||
|
||||
System.out.println("Found " + BiomesManager.occupiedIds + " occupied biome ids in total.");
|
||||
|
||||
for (val conflict : conflicts) {
|
||||
if (conflict != null) {
|
||||
if (debug) {
|
||||
System.out.println(
|
||||
"Found biomes id conflict for " + conflict.ID + " : " + conflict.getCrashMessage());
|
||||
}
|
||||
builder.append(conflict.getCrashMessage()).append('\n');
|
||||
++IconflictedIds;
|
||||
}
|
||||
}
|
||||
conflictedIds = builder.toString();
|
||||
builder.setLength(0);
|
||||
|
||||
System.out.println("Found " + IconflictedIds + " conflicted biome ids in total.");
|
||||
File available = new File(AntiIdConflictBase.biomesFolder, "availableIDs.txt");
|
||||
if (available.exists()) {
|
||||
available.delete();
|
||||
}
|
||||
|
||||
available.createNewFile();
|
||||
PrintWriter writer = new PrintWriter(available);
|
||||
writer.println("Total amount of free biome ids: " + available);
|
||||
writer.println("List of free biome ids:");
|
||||
val freeIDs = freeBiomeIDs.split("\n");
|
||||
|
||||
for (val freeID : freeIDs) {
|
||||
writer.println(freeID);
|
||||
}
|
||||
|
||||
writer.close();
|
||||
val occupied = new File(AntiIdConflictBase.biomesFolder, "occupiedIDs.txt");
|
||||
if (occupied.exists()) {
|
||||
occupied.delete();
|
||||
}
|
||||
|
||||
occupied.createNewFile();
|
||||
writer = new PrintWriter(occupied);
|
||||
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
|
||||
writer.println("Table of occupied biome ids and their owners");
|
||||
writer.println("id:name(class)");
|
||||
val occupiedIDs = occupiedBiomeIDs.split("\n");
|
||||
|
||||
for (String occupiedID : occupiedIDs) {
|
||||
writer.println(occupiedID);
|
||||
}
|
||||
|
||||
writer.close();
|
||||
val conflicted = new File(AntiIdConflictBase.biomesFolder, "conflictedIDs.txt");
|
||||
if (conflicted.exists()) {
|
||||
conflicted.delete();
|
||||
}
|
||||
|
||||
conflicted.createNewFile();
|
||||
writer = new PrintWriter(conflicted);
|
||||
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
|
||||
writer.println("IDs in conflict:\n");
|
||||
val conflictedIDs = conflictedIds.split("\n");
|
||||
for (val conflictedID : conflictedIDs) {
|
||||
writer.println(conflictedID);
|
||||
}
|
||||
|
||||
writer.close();
|
||||
val all = new File(AntiIdConflictBase.biomesFolder, "AllIDs.txt");
|
||||
writer = new PrintWriter(all);
|
||||
writer.println("Total amount of free biome ids: " + BiomesManager.freeIds);
|
||||
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
|
||||
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
|
||||
writer.println("All ids and their position:");
|
||||
|
||||
hasEmpty = false;
|
||||
emptyRegionStart = 0;
|
||||
|
||||
for (int i = 0; i < biomes.length; ++i) {
|
||||
if (!ArrayUtils.isEmpty(conflicts) && conflicts[i] != null) {
|
||||
writer.println(conflicts[i].getCrashMessage());
|
||||
} else if (biomes[i] != null) {
|
||||
if (hasEmpty) {
|
||||
hasEmpty = false;
|
||||
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
|
||||
writer.print(part);
|
||||
writer.println(" is Available");
|
||||
}
|
||||
}
|
||||
writer.print(i);
|
||||
writer.print(" is Occupied by ");
|
||||
writer.print(biomes[i].biomeName);
|
||||
writer.print(" (");
|
||||
writer.print(biomes[i].getBiomeClass().getName());
|
||||
writer.println(")");
|
||||
} else if (!hasEmpty) {
|
||||
hasEmpty = true;
|
||||
emptyRegionStart = i;
|
||||
}
|
||||
}
|
||||
if (hasEmpty) {
|
||||
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
|
||||
writer.print(part);
|
||||
writer.println(" is Available");
|
||||
}
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.managers.DimensionsManager;
|
||||
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = DimensionsManager.class,
|
||||
remap = false)
|
||||
public abstract class DimensionsManagerMixin {
|
||||
|
||||
@ModifyConstant(method = "*",
|
||||
constant = {@Constant(stringValue = "\\dimensions"),
|
||||
@Constant(stringValue = "\\main.cfg"),
|
||||
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||
@Constant(stringValue = "\\AllIDs.txt")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.managers.EnchantementsManager;
|
||||
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = EnchantementsManager.class,
|
||||
remap = false)
|
||||
public abstract class EnchantementsManagerMixin {
|
||||
|
||||
@ModifyConstant(method = "*",
|
||||
constant = {@Constant(stringValue = "\\enchantements"),
|
||||
@Constant(stringValue = "\\main.cfg"),
|
||||
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||
@Constant(stringValue = "\\AllIDs.txt")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.managers.EntitiesManager;
|
||||
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = EntitiesManager.class,
|
||||
remap = false)
|
||||
public abstract class EntitiesManagerMixin {
|
||||
|
||||
@ModifyConstant(method = "*",
|
||||
constant = {@Constant(stringValue = "\\entities"),
|
||||
@Constant(stringValue = "\\main.cfg"),
|
||||
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||
@Constant(stringValue = "\\AllIDs.txt")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||
|
||||
import code.elix_x.coremods.antiidconflict.managers.PotionsManager;
|
||||
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = PotionsManager.class,
|
||||
remap = false)
|
||||
public abstract class PotionsManagerMixin {
|
||||
|
||||
@ModifyConstant(method = "*",
|
||||
constant = {@Constant(stringValue = "\\potions"),
|
||||
@Constant(stringValue = "\\main.cfg"),
|
||||
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||
@Constant(stringValue = "\\conflictedIDs.txt"),
|
||||
@Constant(stringValue = "\\AllIDs.txt")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||
import hunternif.mc.atlas.core.BiomeDetectorBase;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = BiomeDetectorBase.class,
|
||||
remap = false)
|
||||
public abstract class BiomeDetectorBaseMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 2)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
private Chunk chunk;
|
||||
|
||||
@Redirect(method = "getBiomeID",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
require = 1)
|
||||
private byte[] disableGetter(Chunk instance) {
|
||||
chunk = instance;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Redirect(method = "getBiomeID",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lhunternif/mc/atlas/util/ByteUtil;unsignedByteToIntArray([B)[I"),
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||
import hunternif.mc.atlas.core.BiomeDetectorNether;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = BiomeDetectorNether.class,
|
||||
remap = false)
|
||||
public abstract class BiomeDetectorNetherMixin {
|
||||
private Chunk chunk;
|
||||
|
||||
@Redirect(method = "getBiomeID",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
require = 1)
|
||||
private byte[] disableGetter(Chunk instance) {
|
||||
chunk = instance;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Redirect(method = "getBiomeID",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lhunternif/mc/atlas/util/ByteUtil;unsignedByteToIntArray([B)[I"),
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import ttftcuts.atg.config.configfiles.ATGBiomeConfig;
|
||||
|
||||
@Mixin(value = ATGBiomeConfig.class,
|
||||
remap = false)
|
||||
public abstract class ATGBiomeConfigMixin {
|
||||
@ModifyConstant(method = {"<clinit>", "postInit"},
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 4)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import ttftcuts.atg.gen.ATGBiomeManager;
|
||||
|
||||
@Mixin(value = ATGBiomeManager.class,
|
||||
remap = false)
|
||||
public abstract class ATGBiomeManagerMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import ttftcuts.atg.feature.ATGWorldGenRocks;
|
||||
|
||||
@Mixin(value = ATGWorldGenRocks.class,
|
||||
remap = false)
|
||||
public abstract class ATGWorldGenRocksMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 3)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biometweaker;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import me.superckl.biometweaker.common.handler.BiomeEventHandler;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mixin(value = BiomeEventHandler.class,
|
||||
remap = false)
|
||||
public abstract class BiomeEventHandlerMixin {
|
||||
@Mutable
|
||||
@Shadow
|
||||
@Final
|
||||
private int[] colorCache;
|
||||
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs1(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private void extendIDs2(CallbackInfo ci) {
|
||||
colorCache = new int[ExtendedConstants.biomeIDCount * 3];
|
||||
Arrays.fill(colorCache, -2);
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "onGetFoliageColor",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs3(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "onGetWaterColor",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount * 2),
|
||||
require = 1)
|
||||
private static int extendIDs4(int constant) {
|
||||
return ExtendedConstants.biomeIDCount * 2;
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biomewand;
|
||||
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.spacechase0.minecraft.biomewand.BiomeWandMod;
|
||||
import com.spacechase0.minecraft.biomewand.item.BiomeWandItem;
|
||||
import com.spacechase0.minecraft.spacecore.util.TranslateUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(value = BiomeWandItem.class,
|
||||
remap = false)
|
||||
public abstract class BiomeWandItemMixin {
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Biome ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int blockX, int blockY, int blockZ, int side, float par8, float par9, float par10) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
boolean sample = true;
|
||||
if (tag != null) {
|
||||
if (tag.hasKey("sampledBiomeS")) {
|
||||
sample = false;
|
||||
}
|
||||
} else {
|
||||
tag = new NBTTagCompound();
|
||||
}
|
||||
|
||||
if (sample) {
|
||||
int relBlockX = blockX & 15;
|
||||
int relBlockZ = blockZ & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
short biome = ((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||
tag.setShort("sampledBiomeS", biome);
|
||||
} else {
|
||||
short biome = tag.getShort("sampledBiomeS");
|
||||
|
||||
for(int ix = blockX - 3; ix <= blockX + 3; ++ix) {
|
||||
for(int iz = blockZ - 3; iz <= blockZ + 3; ++iz) {
|
||||
int relBlockX = ix & 15;
|
||||
int relBlockZ = iz & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||
chunk.isModified = true;
|
||||
BiomeWandMod.proxy.updateRendererAt(ix, iz);
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
tag.removeTag("sampledBiomeS");
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
stack.setTagCompound(tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Biome ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
String str = TranslateUtils.translate("biomewand.tooltip.biome") + ": ";
|
||||
if (tag == null || !tag.hasKey("sampledBiomeS")) {
|
||||
str = str + TranslateUtils.translate("biomewand.tooltip.none");
|
||||
} else {
|
||||
BiomeGenBase b = BiomeGenBase.getBiomeGenArray()[Short.toUnsignedInt(tag.getShort("sampledBiomeS"))];
|
||||
if (b == null) {
|
||||
str = str + TranslateUtils.translate("biomewand.tooltip.unknown");
|
||||
} else {
|
||||
str = str + b.biomeName;
|
||||
}
|
||||
}
|
||||
|
||||
list.add(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Biome ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
list.add(new ItemStack((BiomeWandItem)(Object)this, 1));
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome != null && !(biome instanceof PlaceholderBiome)) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setShort("sampledBiomeS", (short) biome.biomeID);
|
||||
ItemStack wand = new ItemStack((BiomeWandItem)(Object)this, 1);
|
||||
wand.setTagCompound(compound);
|
||||
list.add(wand);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
||||
|
||||
import biomesoplenty.common.world.BOPBiomeManager;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = BOPBiomeManager.class,
|
||||
remap = false)
|
||||
public abstract class BOPBiomeManagerMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = 40),
|
||||
require = 1)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 14000;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getNextFreeBiomeId",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs1(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getNextFreeBiomeId",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount - 1),
|
||||
require = 1)
|
||||
private static int extendIDs2(int constant) {
|
||||
return ExtendedConstants.biomeIDCount - 1;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.buildcraft;
|
||||
|
||||
import buildcraft.BuildCraftEnergy;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = BuildCraftEnergy.class,
|
||||
remap = false)
|
||||
public abstract class BuildcraftEnergyMixin {
|
||||
@ModifyConstant(method = "findUnusedBiomeID",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.cofhlib;
|
||||
|
||||
import cofh.lib.util.helpers.BlockHelper;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = BlockHelper.class,
|
||||
remap = false)
|
||||
public abstract class BlockHelperMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = {@Constant(intValue = VanillaConstants.blockIDCount),
|
||||
@Constant(intValue = VanillaConstants.blockIDCount / 4)},
|
||||
require = 1)
|
||||
private static int extend(int constant) {
|
||||
return ExtendedConstants.blockIDCount;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.compactmachines;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.stubpackage.org.dave.CompactMachines.tileentity.TileEntityMachine;
|
||||
import org.dave.CompactMachines.handler.ConfigurationHandler;
|
||||
import org.dave.CompactMachines.machines.tools.CubeTools;
|
||||
import org.dave.CompactMachines.utility.WorldUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
@Mixin(value = CubeTools.class,
|
||||
remap = false)
|
||||
public abstract class CubeToolsMixin {
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason getBiomeArray fix
|
||||
*/
|
||||
@Overwrite
|
||||
public static void setCubeBiome(int coords, BiomeGenBase biome) {
|
||||
WorldServer machineWorld = MinecraftServer.getServer().worldServerForDimension(ConfigurationHandler.dimensionId);
|
||||
Chunk chunk = machineWorld.getChunkFromBlockCoords(coords * ConfigurationHandler.cubeDistance, 0);
|
||||
if (chunk != null && chunk.isChunkLoaded) {
|
||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
for(int x = 0; x < 15; ++x) {
|
||||
for(int z = 0; z < 15; ++z) {
|
||||
biomeArray[z << 4 | x] = (short)biome.biomeID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason getBiomeArray fix
|
||||
*/
|
||||
@Overwrite
|
||||
public static BiomeGenBase getMachineBiome(TileEntityMachine machine) {
|
||||
short[] biomeArray = ((IChunkMixin)machine.getWorldObj().getChunkFromBlockCoords(machine.xCoord, machine.zCoord)).getBiomeShortArray();
|
||||
int biomeId = biomeArray[(machine.zCoord & 15) << 4 | machine.xCoord & 15];
|
||||
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length && BiomeDictionary.isBiomeRegistered(biomeId)
|
||||
? BiomeGenBase.getBiome(biomeId)
|
||||
: WorldUtils.getBiomeByName(ConfigurationHandler.defaultBiome);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.darkworld;
|
||||
|
||||
import com.falsepattern.endlessids.config.DarkWorldIDConfig;
|
||||
import matthbo.mods.darkworld.init.ModBiomes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = ModBiomes.class,
|
||||
remap = false)
|
||||
public abstract class ModBiomesMixin {
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 100),
|
||||
require = 1)
|
||||
private static int darkOceanID(int id) {
|
||||
return DarkWorldIDConfig.darkOceanID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 101),
|
||||
require = 1)
|
||||
private static int darkPlainsID(int id) {
|
||||
return DarkWorldIDConfig.darkPlainsID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 102),
|
||||
require = 1)
|
||||
private static int darkDesertID(int id) {
|
||||
return DarkWorldIDConfig.darkDesertID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 103),
|
||||
require = 1)
|
||||
private static int darkHillsID(int id) {
|
||||
return DarkWorldIDConfig.darkHillsID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 104),
|
||||
require = 1)
|
||||
private static int darkForestID(int id) {
|
||||
return DarkWorldIDConfig.darkForestID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 105),
|
||||
require = 1)
|
||||
private static int darkTaigaID(int id) {
|
||||
return DarkWorldIDConfig.darkTaigaID;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 106),
|
||||
require = 1)
|
||||
private static int darkSwampID(int id) {
|
||||
return DarkWorldIDConfig.darkSwampID;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Extras.BlockProperties;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = BlockProperties.class,
|
||||
remap = false)
|
||||
public abstract class BlockPropertiesMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
||||
require = 1)
|
||||
private static int extendColorArray(int constant) {
|
||||
return ExtendedConstants.blockIDCount;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Instantiable.Event.GenLayerRiverEvent;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = GenLayerRiverEvent.class,
|
||||
remap = false)
|
||||
public abstract class GenLayerRiverEventMixin {
|
||||
@ModifyConstant(method = "fire_1614",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||
require = 2)
|
||||
private static int increaseBiomeMask(int constant) {
|
||||
return ExtendedConstants.biomeIDMask;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Extras.IDType;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = IDType.class,
|
||||
remap = false)
|
||||
public abstract class IDTypeMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = 254),
|
||||
require = 1)
|
||||
private static int extendBiomeIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount - 2;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = {@Constant(intValue = 4095), @Constant(intValue = 32767)},
|
||||
require = 2)
|
||||
private static int extendBlockItemIDs(int constant) {
|
||||
return ExtendedConstants.maxBlockID;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Libraries.World.ReikaChunkHelper;
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = ReikaChunkHelper.class,
|
||||
remap = false)
|
||||
public abstract class ReikaChunkHelperMixin {
|
||||
private static short[] biomeArray;
|
||||
@Redirect(method = "copyChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static void customSet(Chunk chunk, byte[] p_76616_1_) {
|
||||
((IChunkMixin)chunk).setBiomeShortArray(biomeArray);
|
||||
biomeArray = null;
|
||||
}
|
||||
|
||||
@Redirect(method = "copyChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static byte[] customGet(Chunk chunk) {
|
||||
biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Libraries.World.ReikaWorldHelper;
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = ReikaWorldHelper.class,
|
||||
remap = false)
|
||||
public abstract class ReikaWorldHelperMixin {
|
||||
@Redirect(method = {"setBiomeForXZ", "setBiomeAndBlocksForXZ"},
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
require = 2)
|
||||
private static byte[] getFake(Chunk instance) {
|
||||
return EndlessIDs.FAKE_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
|
||||
@Redirect(method = {"setBiomeForXZ", "setBiomeAndBlocksForXZ"},
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||
remap = true),
|
||||
require = 2)
|
||||
private static void noSet(Chunk instance, byte[] arr) {
|
||||
|
||||
}
|
||||
|
||||
@Inject(method = "setBiomeForXZ",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;setChunkModified()V",
|
||||
remap = true),
|
||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||
require = 1)
|
||||
private static void customLogicSetBiome(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
|
||||
private static int fromBiomeID;
|
||||
|
||||
@Inject(method = "setBiomeAndBlocksForXZ",
|
||||
at = @At(value = "FIELD",
|
||||
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
|
||||
remap = true),
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void captureIndexSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
fromBiomeID = ((IChunkMixin)ch).getBiomeShortArray()[index];
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "setBiomeAndBlocksForXZ",
|
||||
at = @At("STORE"),
|
||||
ordinal = 1)
|
||||
private static BiomeGenBase changeBiomeFrom(BiomeGenBase value) {
|
||||
return BiomeGenBase.getBiome(fromBiomeID);
|
||||
}
|
||||
|
||||
@Inject(method = "setBiomeAndBlocksForXZ",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||
remap = true),
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void customLogicSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index, BiomeGenBase from) {
|
||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi.vanilla;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import net.minecraft.world.gen.layer.GenLayerRiverMix;
|
||||
|
||||
@Mixin(GenLayerRiverMix.class)
|
||||
public abstract class GenLayerRiverMixMixin {
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||
expect = -1)
|
||||
private int extendTheID(int constant) {
|
||||
return ExtendedConstants.biomeIDMask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
||||
|
||||
import enhancedbiomes.world.biomestats.BiomeIDs;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(BiomeIDs.class)
|
||||
public abstract class BiomeIDsMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = 39),
|
||||
require = 1)
|
||||
private static int extendIDs(int id) {
|
||||
return id + 15000;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import enhancedbiomes.world.gen.layer.GenLayerArchipelagoEdge;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = GenLayerArchipelagoEdge.class,
|
||||
remap = false)
|
||||
public abstract class GenLayerArchipelagoEdgeMixin {
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
remap = true,
|
||||
require = 5)
|
||||
private int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import enhancedbiomes.world.gen.layer.GenLayerEBHills;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = GenLayerEBHills.class,
|
||||
remap = false)
|
||||
public abstract class GenLayerEBHillsMixin {
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
remap = true,
|
||||
require = 8)
|
||||
private int extendIDs1(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = 128),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private int extendIDs2(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@Redirect(method = "getInts",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;)V"),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private void noLog(Logger instance, String s) {
|
||||
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import enhancedbiomes.world.gen.layer.GenLayerEBRiverMix;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = GenLayerEBRiverMix.class,
|
||||
remap = false)
|
||||
public abstract class GenLayerEBRiverMixMixin {
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private int extendIDs1(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private int extendIDs2(int constant) {
|
||||
return ExtendedConstants.biomeIDMask;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import enhancedbiomes.world.gen.layer.GenLayerEBVoronoiZoom;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = GenLayerEBVoronoiZoom.class,
|
||||
remap = false)
|
||||
public abstract class GenLayerEBVoronoiZoomMixin {
|
||||
@ModifyConstant(method = "getInts",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||
remap = true,
|
||||
require = 2)
|
||||
private int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDMask;
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.erebus;
|
||||
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import erebus.ModBiomes;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@Mixin(value = ModBiomes.class,
|
||||
remap = false)
|
||||
public abstract class ModBiomesMixin {
|
||||
@Shadow
|
||||
public static int undergroundJungleID;
|
||||
@Shadow
|
||||
public static int volcanicDesertID;
|
||||
@Shadow
|
||||
public static int subterraneanSavannahID;
|
||||
@Shadow
|
||||
public static int elysianFieldsID;
|
||||
@Shadow
|
||||
public static int ulteriorOutbackID;
|
||||
@Shadow
|
||||
public static int fungalForestID;
|
||||
@Shadow
|
||||
public static int submergedSwampID;
|
||||
@Shadow
|
||||
public static int fieldsSubForestID;
|
||||
@Shadow
|
||||
public static int jungleSubLakeID;
|
||||
@Shadow
|
||||
public static int jungleSubAsperGroveID;
|
||||
@Shadow
|
||||
public static int desertSubCharredForestID;
|
||||
@Shadow
|
||||
public static int savannahSubRockyWastelandID;
|
||||
@Shadow
|
||||
public static int savannahSubAsperGroveID;
|
||||
@Shadow
|
||||
public static int savannahSubSteppeID;
|
||||
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = {@Constant(intValue = 100),
|
||||
@Constant(intValue = 101),
|
||||
@Constant(intValue = 102),
|
||||
@Constant(intValue = 103),
|
||||
@Constant(intValue = 104),
|
||||
@Constant(intValue = 105),
|
||||
@Constant(intValue = 106),
|
||||
@Constant(intValue = 107)},
|
||||
require = 8)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 13000;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 128),
|
||||
require = 1)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount - 129;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(stringValue = "Erebus biome IDs cannot be higher than 127 or smaller than 0!"),
|
||||
require = 1)
|
||||
private static String modifyWarning(String str) {
|
||||
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) + " or smaller than 0!";
|
||||
}
|
||||
|
||||
@Inject(method = "init",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private static void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||
val bga = BiomeGenBase.getBiomeGenArray();
|
||||
|
||||
int[] biomes = new int[]{undergroundJungleID, volcanicDesertID, subterraneanSavannahID, elysianFieldsID,
|
||||
ulteriorOutbackID, fungalForestID, submergedSwampID, fieldsSubForestID,
|
||||
jungleSubLakeID, jungleSubAsperGroveID, desertSubCharredForestID,
|
||||
savannahSubRockyWastelandID, savannahSubAsperGroveID, savannahSubSteppeID};
|
||||
for (val biome: biomes) {
|
||||
if (biome <= 0 || biome >= ExtendedConstants.biomeIDCount - 129) {
|
||||
continue;
|
||||
}
|
||||
if (bga[biome] instanceof PlaceholderBiome) {
|
||||
bga[biome] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.extraplanets;
|
||||
|
||||
import com.mjr.extraplanets.Config;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
@Mixin(value = Config.class,
|
||||
remap = false)
|
||||
public abstract class ConfigMixin {
|
||||
@Redirect(method = "load",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraftforge/common/config/Configuration;get(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)Lnet/minecraftforge/common/config/Property;"))
|
||||
private static Property shiftBiomeIDsUp(Configuration config, String category, String key, int defaultValue, String comment) {
|
||||
if (category.equals("biomeID")) {
|
||||
defaultValue += 17000;
|
||||
comment = "[range: 0 ~ 65535, default: " + defaultValue + "]";
|
||||
}
|
||||
return config.get(category, key, defaultValue, comment);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.extrautilities;
|
||||
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mixin(value = ChunkProviderEndOfTime.class,
|
||||
remap = false)
|
||||
public abstract class ChunkProviderEndOfTimeMixin {
|
||||
private int id;
|
||||
private Chunk chunk;
|
||||
|
||||
@Redirect(method = "provideChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private byte[] setBiomesTweaked1(Chunk instance) {
|
||||
chunk = instance;
|
||||
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
|
||||
@Redirect(method = "provideChunk",
|
||||
at = @At(value = "FIELD",
|
||||
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeID:I",
|
||||
remap = true),
|
||||
remap = true)
|
||||
private int setBiomesTweaked2(BiomeGenBase instance) {
|
||||
return id = instance.biomeID;
|
||||
}
|
||||
|
||||
@Redirect(method = "provideChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Ljava/util/Arrays;fill([BB)V"),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private void setBiomesTweaked3(byte[] bytes, byte b) {
|
||||
try {
|
||||
Arrays.fill(((IChunkMixin) chunk).getBiomeShortArray(), (short) id);
|
||||
} finally {
|
||||
chunk = null;
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.futurepack;
|
||||
|
||||
import com.falsepattern.endlessids.config.FuturepackIDConfig;
|
||||
import futurepack.common.dim.BiomeGenSpace;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(BiomeGenSpace.class)
|
||||
public abstract class BiomeGenSpaceMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = 97),
|
||||
require = 1)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return FuturepackIDConfig.spaceID;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.galacticraft;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||
import futurepack.common.dim.ChunkProviderSpace;
|
||||
import micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseOrbit;
|
||||
import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderOrbit;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = ChunkProviderOrbit.class,
|
||||
remap = false)
|
||||
public abstract class ChunkProviderOrbitMixin {
|
||||
|
||||
@Redirect(method = "provideChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
remap = true),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||
return BiomePatchHelper.getBiomeArrayTweaked(chunk, (i) -> BiomeGenBaseOrbit.space);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.galacticraft;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = ConfigManagerCore.class,
|
||||
remap = false)
|
||||
public abstract class ConfigManagerCoreMixin {
|
||||
@ModifyConstant(method = {"<clinit>", "syncConfig"},
|
||||
constant = @Constant(intValue = 102),
|
||||
require = 3)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 18000;
|
||||
}
|
||||
@ModifyConstant(method = "syncConfig",
|
||||
constant = @Constant(stringValue = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."),
|
||||
require = 1)
|
||||
private static String modifyHint(String constant) {
|
||||
return "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-" +
|
||||
(ExtendedConstants.biomeIDCount - 6);
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "syncConfig",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount - 6),
|
||||
require = 1)
|
||||
private static int modifyLimit(int constant) {
|
||||
return ExtendedConstants.biomeIDCount - 6;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.highlands;
|
||||
|
||||
import highlands.Config;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(value = Config.class,
|
||||
remap = false)
|
||||
public abstract class ConfigMixin {
|
||||
@ModifyArg(method = "addBiomeEntries",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraftforge/common/config/Configuration;get(Ljava/lang/String;Ljava/lang/String;I)Lnet/minecraftforge/common/config/Property;"),
|
||||
index = 2,
|
||||
require = 44)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 16000;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.icg;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import net.tclproject.mysteriumlib.asm.fixes.MysteriumPatchesFixesCave;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(value = MysteriumPatchesFixesCave.class,
|
||||
remap = false)
|
||||
public abstract class MysteriumPatchesFixesCaveMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||
import lotr.common.world.biome.variant.LOTRBiomeVariantStorage;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = LOTRBiomeVariantStorage.class,
|
||||
remap = false)
|
||||
public abstract class LOTRBiomeVariantStorageMixin {
|
||||
|
||||
private static UnsupportedOperationException crash() {
|
||||
return new UnsupportedOperationException("Deprecated method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static byte[] getChunkBiomeVariants(World world, Chunk chunk) {
|
||||
throw crash();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static byte[] getChunkBiomeVariants(World world, ChunkCoordIntPair chunk) {
|
||||
throw crash();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void setChunkBiomeVariants(World world, Chunk chunk, byte[] variants) {
|
||||
throw crash();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void setChunkBiomeVariants(World world, ChunkCoordIntPair chunk, byte[] variants) {
|
||||
throw crash();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void clearChunkBiomeVariants(World world, Chunk chunk) {
|
||||
LOTRBiomeVariantStorageShort.clearChunkBiomeVariants(world, chunk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void clearChunkBiomeVariants(World world, ChunkCoordIntPair chunk) {
|
||||
LOTRBiomeVariantStorageShort.clearChunkBiomeVariants(world, chunk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void loadChunkVariants(World world, Chunk chunk, NBTTagCompound data) {
|
||||
LOTRBiomeVariantStorageShort.loadChunkVariants(world, chunk, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void saveChunkVariants(World world, Chunk chunk, NBTTagCompound data) {
|
||||
LOTRBiomeVariantStorageShort.saveChunkVariants(world, chunk, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void clearAllVariants(World world) {
|
||||
LOTRBiomeVariantStorageShort.clearAllVariants(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void performCleanup(WorldServer world) {
|
||||
LOTRBiomeVariantStorageShort.performCleanup(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void sendChunkVariantsToPlayer(World world, Chunk chunk, EntityPlayerMP entityPlayer) {
|
||||
LOTRBiomeVariantStorageShort.sendChunkVariantsToPlayer(world, chunk, entityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static void sendUnwatchToPlayer(World world, Chunk chunk, EntityPlayerMP entityPlayer) {
|
||||
LOTRBiomeVariantStorageShort.sendUnwatchToPlayer(world, chunk, entityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Fix stuff
|
||||
*/
|
||||
@Overwrite
|
||||
public static int getSize(World world) {
|
||||
return LOTRBiomeVariantStorageShort.getSize(world);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||
import lotr.common.world.LOTRChunkProvider;
|
||||
import lotr.common.world.biome.variant.LOTRBiomeVariant;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
@Mixin(value = LOTRChunkProvider.class,
|
||||
remap = false)
|
||||
public abstract class LOTRChunkProviderMixin {
|
||||
@Shadow
|
||||
private LOTRBiomeVariant[] variantsForGeneration;
|
||||
|
||||
@Redirect(method = "provideChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Llotr/common/world/biome/variant/LOTRBiomeVariantStorage;setChunkBiomeVariants(Lnet/minecraft/world/World;Lnet/minecraft/world/chunk/Chunk;[B)V"),
|
||||
remap = true,
|
||||
require = 1)
|
||||
private void storeShorts(World world, Chunk chunk, byte[] variantsB) {
|
||||
short[] variants = new short[256];
|
||||
|
||||
for (int l = 0; l < variants.length; ++l) {
|
||||
variants[l] = (short) this.variantsForGeneration[l].variantID;
|
||||
}
|
||||
|
||||
LOTRBiomeVariantStorageShort.setChunkBiomeVariants(world, chunk, variants);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 149 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user