mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-24 10:34:29 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc4879114d | ||
|
|
3a4194a3ff | ||
|
|
09d7677541 | ||
|
|
3f9173bdfe | ||
|
|
a9e8554f18 | ||
|
|
27ca556182 | ||
|
|
2c96f817d7 | ||
|
|
95c380a5b1 | ||
|
|
ed7507a58e | ||
|
|
c31e218197 | ||
|
|
5ad71c29c2 | ||
|
|
684d419465 | ||
|
|
c7067c7d72 | ||
|
|
f57bd9c353 | ||
|
|
38caffb85d | ||
|
|
6a10291318 | ||
|
|
c7b7e36e10 | ||
|
|
51023c0e6c | ||
|
|
724508e1b0 | ||
|
|
76f5ed7b8f | ||
|
|
76e4c68669 | ||
|
|
25ddb78268 | ||
|
|
804ad7570e | ||
|
|
371277a2a8 | ||
|
|
c8f9403478 | ||
|
|
7d2344b63d | ||
|
|
2acbb60547 | ||
|
|
098254dc82 | ||
|
|
0f810afe90 | ||
|
|
fa66c21a8a | ||
|
|
2b90b7688b | ||
|
|
ca5f27dffc | ||
|
|
6eeafe5a23 | ||
|
|
22d269eda5 | ||
|
|
87ff6bc0ab | ||
|
|
0a74b2494b | ||
|
|
a58bb1e202 | ||
|
|
8c77bf1110 | ||
|
|
35bd58a9d0 | ||
|
|
07474f33f9 | ||
|
|
a4868e8de8 | ||
|
|
19f11ee62e | ||
|
|
c8de7349dc | ||
|
|
410d344b84 | ||
|
|
f8e024f1bb | ||
|
|
06b033e179 | ||
|
|
a432bdeb04 | ||
|
|
d43e108513 | ||
|
|
eeaca66dd5 | ||
|
|
380841b840 | ||
|
|
9d37327993 | ||
|
|
9a1b9f7798 | ||
|
|
3dd168fc8e | ||
|
|
83bfb89d8b | ||
|
|
5d5a03486f | ||
|
|
6103fe96bb | ||
|
|
d3334c7ca8 | ||
|
|
7fc49578ce | ||
|
|
59862bb5ad | ||
|
|
c052edf912 | ||
|
|
79f0c06fa5 | ||
|
|
53f3cffb59 | ||
|
|
c1d8e273fc | ||
|
|
484a9175e7 | ||
|
|
1bb71d9448 | ||
|
|
11ff4a4a6a | ||
|
|
6b3d872fbd | ||
|
|
344b788108 | ||
|
|
b61711280b | ||
|
|
67badb8fcb | ||
|
|
e529ad49cb | ||
|
|
10c19feb0c | ||
|
|
fb0096350c | ||
|
|
1f726e42d3 | ||
|
|
1944aa08f1 | ||
|
|
0dfe4bfc2d | ||
|
|
fcac948f88 | ||
|
|
04fe960ca4 | ||
|
|
a1d13d833d | ||
|
|
8ae84392ba | ||
|
|
76092e5c4c | ||
|
|
0ecadb8563 | ||
|
|
147099d625 | ||
|
|
e699d67f4e | ||
|
|
6101766529 | ||
|
|
8c715bd579 | ||
|
|
e7340cd9b1 | ||
|
|
786652504c | ||
|
|
4ded45cc5c | ||
|
|
16be8d607c | ||
|
|
775ea5769c | ||
|
|
93e375a07d | ||
|
|
a2c0ac2d99 | ||
|
|
de5fa2d322 | ||
|
|
984c976b34 | ||
|
|
0e58bf113d | ||
|
|
0b968923df | ||
|
|
f98d2c98e3 | ||
|
|
bf52cfaadf | ||
|
|
c321707f0e | ||
|
|
c8e076f6d2 | ||
|
|
6f832f4905 | ||
|
|
818f201f30 | ||
|
|
b09565144f | ||
|
|
6fe932e136 | ||
|
|
06c44e3cb8 | ||
|
|
7c5652879f | ||
|
|
bbeaad3f3c | ||
|
|
268a95414c | ||
|
|
80e1f2754f | ||
|
|
a30a223b87 | ||
|
|
5bd48c168c | ||
|
|
7381139fdf | ||
|
|
3c78543a82 | ||
|
|
83227b76f2 | ||
|
|
8e22c69168 | ||
|
|
078cc110ff | ||
|
|
5c81a620e2 | ||
|
|
012fa8188c | ||
|
|
495c70223c | ||
|
|
7e97287004 | ||
|
|
ccb2c62a89 | ||
|
|
c65179a4b3 | ||
|
|
d825ea3c97 | ||
|
|
9d5d87fe81 | ||
|
|
8a3b75cf14 | ||
|
|
20d7738cc4 |
No files matched your search
@@ -0,0 +1,44 @@
|
|||||||
|
* text eol=lf
|
||||||
|
|
||||||
|
*.[jJ][aA][rR] binary
|
||||||
|
|
||||||
|
*.[pP][nN][gG] binary
|
||||||
|
*.[jJ][pP][gG] binary
|
||||||
|
*.[jJ][pP][eE][gG] binary
|
||||||
|
*.[gG][iI][fF] binary
|
||||||
|
*.[tT][iI][fF] binary
|
||||||
|
*.[tT][iI][fF][fF] binary
|
||||||
|
*.[iI][cC][oO] binary
|
||||||
|
*.[sS][vV][gG] text
|
||||||
|
*.[eE][pP][sS] binary
|
||||||
|
*.[xX][cC][fF] binary
|
||||||
|
|
||||||
|
*.[kK][aA][rR] binary
|
||||||
|
*.[mM]4[aA] binary
|
||||||
|
*.[mM][iI][dD] binary
|
||||||
|
*.[mM][iI][dD][iI] binary
|
||||||
|
*.[mM][pP]3 binary
|
||||||
|
*.[oO][gG][gG] binary
|
||||||
|
*.[rR][aA] binary
|
||||||
|
|
||||||
|
*.7[zZ] binary
|
||||||
|
*.[gG][zZ] binary
|
||||||
|
*.[tT][aA][rR] binary
|
||||||
|
*.[tT][gG][zZ] binary
|
||||||
|
*.[zZ][iI][pP] binary
|
||||||
|
|
||||||
|
*.[tT][cC][nN] binary
|
||||||
|
*.[sS][oO] binary
|
||||||
|
*.[dD][lL][lL] binary
|
||||||
|
*.[dD][yY][lL][iI][bB] binary
|
||||||
|
*.[pP][sS][dD] binary
|
||||||
|
*.[tT][tT][fF] binary
|
||||||
|
*.[oO][tT][fF] binary
|
||||||
|
|
||||||
|
*.[pP][aA][tT][cC][hH] -text
|
||||||
|
|
||||||
|
*.[bB][aA][tT] text eol=crlf
|
||||||
|
*.[cC][mM][dD] text eol=crlf
|
||||||
|
*.[pP][sS]1 text eol=crlf
|
||||||
|
|
||||||
|
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
patreon: falsepattern
|
||||||
|
ko_fi: falsepattern
|
||||||
@@ -5,31 +5,6 @@ labels: ["bug"]
|
|||||||
assignees:
|
assignees:
|
||||||
- falsepattern
|
- falsepattern
|
||||||
body:
|
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
|
- type: input
|
||||||
id: modpack
|
id: modpack
|
||||||
attributes:
|
attributes:
|
||||||
@@ -37,7 +12,6 @@ body:
|
|||||||
description: If you used the mod in a modpack, you should include the pack's exact name and version here to make debugging easier.
|
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:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
# Essential
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
@@ -45,7 +19,6 @@ body:
|
|||||||
description: Attach the fml-client-latest.log file here.
|
description: Attach the fml-client-latest.log file here.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
# Essential
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ labels: ["compat-request"]
|
|||||||
assignees:
|
assignees:
|
||||||
- falsepattern
|
- falsepattern
|
||||||
body:
|
body:
|
||||||
# Essential
|
|
||||||
- type: input
|
- type: input
|
||||||
id: modname
|
id: modname
|
||||||
attributes:
|
attributes:
|
||||||
@@ -13,7 +12,6 @@ body:
|
|||||||
description: The name of the other mod
|
description: The name of the other mod
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
# Essential
|
|
||||||
- type: input
|
- type: input
|
||||||
id: modurl
|
id: modurl
|
||||||
attributes:
|
attributes:
|
||||||
@@ -21,7 +19,6 @@ body:
|
|||||||
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.
|
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:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
# Important
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: license
|
id: license
|
||||||
attributes:
|
attributes:
|
||||||
@@ -47,7 +44,6 @@ body:
|
|||||||
- All Rights Reserved
|
- All Rights Reserved
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
# Recommended
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
@@ -55,24 +51,10 @@ body:
|
|||||||
description: Attach the fml-client-latest.log file here.
|
description: Attach the fml-client-latest.log file here.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
# Recommended
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
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.
|
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:
|
validations:
|
||||||
required: false
|
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,27 +0,0 @@
|
|||||||
if [[ -d "run/crash-reports" ]]; then
|
|
||||||
echo "Crash reports detected:"
|
|
||||||
cat $directory/*
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep --quiet "Fatal errors were detected" server.log; then
|
|
||||||
echo "Fatal errors detected:"
|
|
||||||
cat server.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
|
|
||||||
echo "Server force stopped:"
|
|
||||||
cat server.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
|
|
||||||
echo "Server didn't finish startup:"
|
|
||||||
cat server.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "No crash reports detected"
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
@@ -1,45 +1,17 @@
|
|||||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
||||||
|
|
||||||
name: Build and test
|
name: Build and test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main ]
|
branches:
|
||||||
|
- master
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
runs-on: ubuntu-latest
|
uses: FalsePattern/fpgradle-workflows/.github/workflows/build-and-test.yml@master
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v2
|
timeout: 90
|
||||||
with:
|
workspace: setupCIWorkspace
|
||||||
fetch-depth: 0
|
client-only: false
|
||||||
|
|
||||||
- name: Set up JDK 8
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: '8'
|
|
||||||
distribution: 'adopt'
|
|
||||||
cache: gradle
|
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
|
|
||||||
- name: Setup the workspace
|
|
||||||
run: ./gradlew setupCIWorkspace
|
|
||||||
|
|
||||||
- name: Build the mod
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Run server for 1.5 minutes
|
|
||||||
run: |
|
|
||||||
mkdir -p run
|
|
||||||
echo "eula=true" > run/eula.txt
|
|
||||||
timeout 90 ./gradlew runServer | tee --append server.log || true
|
|
||||||
|
|
||||||
- name: Test no errors reported during server run
|
|
||||||
run: |
|
|
||||||
chmod +x .github/scripts/test-no-error-reports.sh
|
|
||||||
.github/scripts/test-no-error-reports.sh
|
|
||||||
@@ -1,50 +1,21 @@
|
|||||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
name: Release Tags
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
||||||
|
|
||||||
name: Release tagged build
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release-tags:
|
||||||
runs-on: ubuntu-latest
|
uses: FalsePattern/fpgradle-workflows/.github/workflows/release-tags.yml@master
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v2
|
workspace: "setupCIWorkspace"
|
||||||
with:
|
secrets:
|
||||||
fetch-depth: 0
|
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
|
||||||
|
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
|
||||||
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||||
|
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
||||||
|
|
||||||
- name: Set release version
|
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set up JDK 8
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: '8'
|
|
||||||
distribution: 'adopt'
|
|
||||||
cache: gradle
|
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
|
|
||||||
- name: Setup the workspace
|
|
||||||
run: ./gradlew setupCIWorkspace
|
|
||||||
|
|
||||||
- name: Publish to Maven, Modrinth, and CurseForge
|
|
||||||
run: ./gradlew publish
|
|
||||||
env:
|
|
||||||
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
|
|
||||||
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
|
|
||||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
|
||||||
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
|
||||||
|
|
||||||
- name: Release under current tag
|
|
||||||
uses: "marvinpinto/action-automatic-releases@latest"
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
|
|
||||||
prerelease: false
|
|
||||||
title: "${{ env.RELEASE_VERSION }}"
|
|
||||||
files: build/libs/*.jar
|
|
||||||
+32
-13
@@ -1,6 +1,5 @@
|
|||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/gradle,forgegradle,kotlin,java,scala,intellij+all
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
|
# Edit at https://www.toptal.com/developers/gitignore?templates=gradle,forgegradle,kotlin,java,scala,intellij+all
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,gradle,forgegradle,java
|
|
||||||
|
|
||||||
### ForgeGradle ###
|
### ForgeGradle ###
|
||||||
# Minecraft client/server files
|
# Minecraft client/server files
|
||||||
@@ -40,14 +39,14 @@ run/
|
|||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
# since they will be recreated, and may cause churn. Uncomment if using
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
# auto-import.
|
# auto-import.
|
||||||
.idea/artifacts
|
# .idea/artifacts
|
||||||
.idea/compiler.xml
|
# .idea/compiler.xml
|
||||||
.idea/jarRepositories.xml
|
# .idea/jarRepositories.xml
|
||||||
.idea/modules.xml
|
# .idea/modules.xml
|
||||||
.idea/*.iml
|
# .idea/*.iml
|
||||||
.idea/modules
|
# .idea/modules
|
||||||
*.iml
|
# *.iml
|
||||||
*.ipr
|
# *.ipr
|
||||||
|
|
||||||
# CMake
|
# CMake
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
@@ -120,6 +119,23 @@ fabric.properties
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
### Kotlin ###
|
||||||
|
# Compiled class file
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
|
||||||
|
### Scala ###
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
|
||||||
### Gradle ###
|
### Gradle ###
|
||||||
.gradle
|
.gradle
|
||||||
**/build/
|
**/build/
|
||||||
@@ -143,5 +159,8 @@ gradle-app.setting
|
|||||||
# JDT-specific (Eclipse Java Development Tools)
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
.classpath
|
.classpath
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
|
### Gradle Patch ###
|
||||||
!lib/*.jar
|
# Java heap dump
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/gradle,forgegradle,kotlin,java,scala,intellij+all
|
||||||
Generated
+10
@@ -1,5 +1,6 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<option name="FORMATTER_TAGS_ENABLED" value="true" />
|
||||||
<JavaCodeStyleSettings>
|
<JavaCodeStyleSettings>
|
||||||
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
||||||
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
||||||
@@ -25,6 +26,12 @@
|
|||||||
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
||||||
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<ScalaCodeStyleSettings>
|
||||||
|
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||||
|
</ScalaCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="KEEP_LINE_BREAKS" value="false" />
|
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
@@ -62,5 +69,8 @@
|
|||||||
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
||||||
<option name="WRAP_ON_TYPING" value="0" />
|
<option name="WRAP_ON_TYPING" value="0" />
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
The code is a rewrite of NotEnoughIDs, created by fewizz and Player,
|
The code is a rewrite of NotEnoughIDs, created by fewizz and Player,
|
||||||
which was released under the MIT license on CurseForge at https://www.curseforge.com/minecraft/mc-mods/notenoughids
|
which was released under the MIT license on CurseForge at
|
||||||
|
https://www.curseforge.com/minecraft/mc-mods/notenoughids
|
||||||
|
|
||||||
Original License text of NotEnoughIDs:
|
Original License text of NotEnoughIDs:
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@@ -18,4 +19,12 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Some patches have been adapted from the GTNH fork of NotEnoughIDs,
|
||||||
|
its license is as follows:
|
||||||
|
|
||||||
|
GTNH modifications Copyright (c) 2021-2022 The GTNH Team
|
||||||
|
|
||||||
|
This code is licensed LGPL v3.0 or later. Feel free to use our changes,
|
||||||
|
just give back any changes you make to the community as well!
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@@ -1,9 +1,9 @@
|
|||||||
EndlessIDs
|
EndlessIDs
|
||||||
|
|
||||||
Copyright (C) 2022 FalsePattern
|
Copyright (C) 2022-2024 FalsePattern
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
The above copyright notice, this permission notice and the word "SNEED"
|
The above copyright notice, this permission notice and the word "MEGA"
|
||||||
shall be included in all copies or substantial portions of the Software.
|
shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,20 +1,40 @@
|
|||||||
|
# EndlessIDs <img src="EIDSico.png" align="right" width=150>
|
||||||
|
|
||||||
|
<sup>**[CurseForge](https://www.curseforge.com/minecraft/mc-mods/endlessids) | [Modrinth](https://modrinth.com/mod/endlessids)**</sup>
|
||||||
|
|
||||||
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
||||||
new limits.
|
new limits.
|
||||||
|
|
||||||
Comparison of the known limits:
|
## REQUIRED MODS
|
||||||
|
- [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
|
||||||
|
- [UniMixins](https://github.com/LegacyModdingMC/UniMixins)
|
||||||
|
- [ChunkAPI](https://github.com/FalsePattern/ChunkAPI)
|
||||||
|
|
||||||
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
## NotEnoughIDs world compatibility
|
||||||
|-----------------|----------------------------------------------------|--------------|----------------------------------|
|
EndlessIDs can open and upgrade worlds created with NotEnoughIDs without any problems (both the original and the Unofficial version).
|
||||||
| Block IDs | 4,096 | 32,000 | 16,777,216 |
|
If you notice any problems when opening NEID worlds with EndlessIDs, please open an issue!
|
||||||
| Item IDs | 32,000 | 32,000 | 16,777,216 |
|
|
||||||
| Biome IDs | 256 | 256 | 65,536 |
|
## Comparison of the known limits
|
||||||
| Entity IDs | 256 | 256 | 256 right now, extension planned |
|
|
||||||
| Potion IDs | 32 | 32 | 32 right now, extension planned |
|
| | Vanilla | NotEnoughIDs | NEID Unofficial | EndlessIDs |
|
||||||
| Enchantment IDs | 256 | 256 | 256 right now, extension planned |
|
|-----------------|----------------------------------------------------|--------------|-----------------|------------|
|
||||||
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same |
|
| Block IDs | 4,096 | 32,000 | 65,536 | 16,777,216 |
|
||||||
|
| Block Metadata | 16 | 16 | 65,536 | 65,536 |
|
||||||
|
| Item IDs | 32,000 | 32,000 | 65,536 | 16,777,216 |
|
||||||
|
| Biome IDs | 256 | 256 | 256 | 65,536 |
|
||||||
|
| Entity IDs | 256 | 256 | 256 | 32,768 |
|
||||||
|
| Potion IDs | 32 | 32 | 32 | 65,536 |
|
||||||
|
| Enchantment IDs | 256 | 256 | 256 | 32,768 |
|
||||||
|
| DataWatcher IDs | 32 | 127 (Broken) | 127 | 65,536 |
|
||||||
|
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same | Same |
|
||||||
|
|
||||||
|
## Mod compat
|
||||||
|
|
||||||
This mod also contains patches for the following mods:
|
This mod also contains patches for the following mods:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Mod list</summary>
|
||||||
|
|
||||||
- AbyssalCraft
|
- AbyssalCraft
|
||||||
- Advanced Rocketry
|
- Advanced Rocketry
|
||||||
- Alternate Terrain Generation
|
- Alternate Terrain Generation
|
||||||
@@ -26,9 +46,11 @@ This mod also contains patches for the following mods:
|
|||||||
- Biome Wand
|
- Biome Wand
|
||||||
- BuildCraft
|
- BuildCraft
|
||||||
- ChromatiCraft
|
- ChromatiCraft
|
||||||
|
- Climate Control
|
||||||
- Compact Machines
|
- Compact Machines
|
||||||
- CoFH Lib
|
- CoFH Lib
|
||||||
- Dark World
|
- Dark World
|
||||||
|
- Dimensional Doors
|
||||||
- DragonAPI
|
- DragonAPI
|
||||||
- Dynamic Surroundings
|
- Dynamic Surroundings
|
||||||
- Enderlicious
|
- Enderlicious
|
||||||
@@ -40,21 +62,30 @@ This mod also contains patches for the following mods:
|
|||||||
- GalactiCraft
|
- GalactiCraft
|
||||||
- Highlands
|
- Highlands
|
||||||
- Immersive Cavegen
|
- Immersive Cavegen
|
||||||
- LOTR
|
- Industrial Revolution by Redstone Rebooted
|
||||||
|
- Matter Overdrive
|
||||||
- More Fun Quicksand Mod
|
- More Fun Quicksand Mod
|
||||||
- Nature's Compass
|
- Nature's Compass
|
||||||
- Netherlicious
|
- Netherlicious
|
||||||
- Nomadic Tents
|
- Nomadic Tents
|
||||||
|
- Nostalgic World Generation
|
||||||
|
- Old World Gen
|
||||||
- Random Things
|
- Random Things
|
||||||
|
- Restructured
|
||||||
- Realistic Terrain Generation
|
- Realistic Terrain Generation
|
||||||
- Realistic World Generation
|
- Realistic World Generation
|
||||||
- Thaumcraft
|
- Thaumcraft
|
||||||
|
- The Lord of the Rings Mod: Legacy
|
||||||
|
- ThutCore/ThutMods
|
||||||
- Tropicraft
|
- Tropicraft
|
||||||
- Twilight Forest
|
- Twilight Forest
|
||||||
- Underground Biomes Constructs
|
- Underground Biomes Constructs
|
||||||
- Witchery
|
- Witchery
|
||||||
- WorldEdit
|
- WorldEdit
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
Mods not listed here may or may not work.
|
Mods not listed here may or may not work.
|
||||||
|
|
||||||
- For item/block IDs:
|
- For item/block IDs:
|
||||||
@@ -64,10 +95,59 @@ Mods not listed here may or may not work.
|
|||||||
- If a mod adds a custom world generator, it has a high chance of invoking an old vanilla method in the worldgen code.
|
- 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
|
To avoid world corruption and broken biomes, this method has been replaced with an instant crash that refers the
|
||||||
user to this github repo.
|
user to this GitHub repo.
|
||||||
|
|
||||||
If you find any crashes or incompatibilities, don't hesitate to open an issue.
|
If you find any crashes or incompatibilities, don't hesitate to open an issue.
|
||||||
|
|
||||||
## Dependencies
|
## Depending On Metadata Increase In Another Mod
|
||||||
- [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
|
|
||||||
- [GasStation](https://github.com/FalsePattern/GasStation)
|
**NOTE:** This API is available as of version TODO of EndlessIDs.
|
||||||
|
|
||||||
|
EndlessIDs implements the common ID Extender API introduced in NotEnoughIDs Unofficial. See:
|
||||||
|
https://github.com/GTNewHorizons/NotEnoughIds/pull/17
|
||||||
|
|
||||||
|
The description below is an excerpt of NEID-U's readme concerning this API:
|
||||||
|
|
||||||
|
In order to use the metadata, you should not create a hard dependency on the `endlessids` Mod ID, but rather on the `idextender` Mod ID.
|
||||||
|
EndlessIDs bundles this "dummy" mod alongside itself.
|
||||||
|
|
||||||
|
Here is an example of how to use it, you could put this code in your Mod's pre-init for example:
|
||||||
|
|
||||||
|
```java
|
||||||
|
import idextender;
|
||||||
|
|
||||||
|
int maxMeta = 15;
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("idextender")) {
|
||||||
|
maxMeta = (Integer) Class.forName("idextender.Metadata").getDeclaredMethod("maximumMetadata").invoke(null);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also query for the number of bits the metadata value is extended to, rather than the maximum value:
|
||||||
|
|
||||||
|
```java
|
||||||
|
import idextender;
|
||||||
|
|
||||||
|
int metadataBits = 4;
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("idextender")){
|
||||||
|
metadataBits = (Integer) Class.forName("idextender.Metadata").getDeclaredMethod("metadataBits").invoke(null);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `idextender.DataWatcher` class also exposes the extended DataWatcher count (used for entity data syncing over network)
|
||||||
|
in a similar fashion.
|
||||||
|
|
||||||
|
Note that these values CAN be identical to the vanilla values if the ID Extension mod implementing it has a config to
|
||||||
|
toggle itself, existence of the IDExtender class does not guarantee a fixed increase, and you should check that the
|
||||||
|
returned value is large enough for your needs.
|
||||||
|
|
||||||
|
If for some reason, you need to know what parent mod is providing the `idextender` mod, you can do the following, which will give you
|
||||||
|
back the Mod ID of the actual mod that has provided `idextender`. For example, `endlessids`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
// This will give back the value "endlessids" which is EndlessIDs' Mod ID
|
||||||
|
String parentIDExtender = (String) Class.forName("idextender.IDExtender").getDeclaredMethod("parentModId").invoke(null);
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, see the NotEnoughIDs readme.
|
||||||
-1125
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,230 @@
|
|||||||
|
plugins {
|
||||||
|
id("fpgradle-minecraft") version ("0.8.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.falsepattern"
|
||||||
|
|
||||||
|
minecraft_fp {
|
||||||
|
mod {
|
||||||
|
modid = "endlessids"
|
||||||
|
name = "EndlessIDs"
|
||||||
|
rootPkg = "$group.endlessids"
|
||||||
|
}
|
||||||
|
|
||||||
|
api {
|
||||||
|
packages = listOf("idextender")
|
||||||
|
ignoreRootPkg = true
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin {
|
||||||
|
pkg = "mixin.mixins"
|
||||||
|
pluginClass = "mixin.plugin.MixinPlugin"
|
||||||
|
}
|
||||||
|
|
||||||
|
core {
|
||||||
|
coreModClass = "asm.EndlessIDsCore"
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens {
|
||||||
|
tokenClass = "Tags"
|
||||||
|
modid = "MODID"
|
||||||
|
name = "MODNAME"
|
||||||
|
version = "VERSION"
|
||||||
|
rootPkg = "GROUPNAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
publish {
|
||||||
|
changelog = "https://github.com/GTMEGA/EndlessIDs/releases/tag/$version"
|
||||||
|
maven {
|
||||||
|
repoUrl = "https://mvn.falsepattern.com/releases/"
|
||||||
|
repoName = "mavenpattern"
|
||||||
|
}
|
||||||
|
curseforge {
|
||||||
|
projectId = "665730"
|
||||||
|
dependencies {
|
||||||
|
required("fplib")
|
||||||
|
required("chunkapi")
|
||||||
|
incompatible("notenoughids-unofficial-1-7-10")
|
||||||
|
incompatible("notenoughids")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modrinth {
|
||||||
|
projectId = "qGHY4QGo"
|
||||||
|
dependencies {
|
||||||
|
required("fplib")
|
||||||
|
required("chunkapi")
|
||||||
|
incompatible("notenoughids-unofficial")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
cursemavenEX()
|
||||||
|
exclusive(mavenpattern(), "com.falsepattern")
|
||||||
|
exclusive(ivy("https://mvn.falsepattern.com/releases/mirror/", "[orgPath]/[artifact]-[revision].[ext]"), "mirror", "mirror.micdoodle")
|
||||||
|
exclusive(ivy("https://github.com/", "[orgPath]/releases/download/[revision]/[artifact]-[revision].[ext]"), "CannibalVox.DimDoors")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
////////////////Our dependencies////////////////
|
||||||
|
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.4.1")
|
||||||
|
implementation("it.unimi.dsi:fastutil:8.5.13")
|
||||||
|
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.5.1")
|
||||||
|
|
||||||
|
////////////////Patched mods////////////////
|
||||||
|
|
||||||
|
//AbyssalCraft 1.9.1.3-FINAL
|
||||||
|
compileOnly(deobfCurse("abyssalcraft-53686:2311135"))
|
||||||
|
|
||||||
|
//Advanced Rocketry
|
||||||
|
compileOnly(deobfCurse("advancedrocketry-236542:2985057"))
|
||||||
|
|
||||||
|
//Alternate Terrain Generation 0.12.0
|
||||||
|
compileOnly(deobfCurse("atg-228356:2231155"))
|
||||||
|
|
||||||
|
//Antique Atlas 4.4.4
|
||||||
|
compileOnly(deobfCurse("antiqueatlas-227795:2454232"))
|
||||||
|
|
||||||
|
//Anti ID Conflict 1.3.5
|
||||||
|
compileOnly(deobfCurse("antiidconflict-246288:2308279"))
|
||||||
|
|
||||||
|
// //ArchaicFix 0.2.0
|
||||||
|
// compileOnly("com.github.embeddedt:ArchaicFix:0.2.0:dev")
|
||||||
|
|
||||||
|
//Atum 0.6.77
|
||||||
|
compileOnly(deobfCurse("atum-59621:2256356"))
|
||||||
|
|
||||||
|
//Biomes O' Plenty 2.1.0.2308
|
||||||
|
compileOnly(deobfCurse("biomesoplenty-220318:2499612"))
|
||||||
|
|
||||||
|
//Biome Tweaker 2.0.182
|
||||||
|
compileOnly(deobfCurse("biometweaker-228895:2279911"))
|
||||||
|
|
||||||
|
//Biome Wand 1.1.9
|
||||||
|
//Source: https://spacechase0.com/wp-content/uploads/2014/10/1.7.10-Biome-Wand-1.1.9.jar
|
||||||
|
compileOnly(deobf("mirror:1.7.10-Biome-Wand:1.1.9"))
|
||||||
|
|
||||||
|
//Buildcraft 7.1.24
|
||||||
|
compileOnly(deobfCurse("buildcraft-61811:3538651"))
|
||||||
|
|
||||||
|
//Climate Control 0.8.2
|
||||||
|
compileOnly(deobfCurse("climatecontrol-76544:2359685"))
|
||||||
|
|
||||||
|
//CoFH Lib 1.2.1-185
|
||||||
|
compileOnly(deobfCurse("cofh-lib-220333:2388748"))
|
||||||
|
|
||||||
|
//CompactMachines 1.21
|
||||||
|
compileOnly(deobfCurse("compactmachines-224218:2268575"))
|
||||||
|
|
||||||
|
//Dark World 0.2
|
||||||
|
compileOnly(deobfCurse("darkworld-225075:2225172"))
|
||||||
|
|
||||||
|
//DimDoors 2.2.5-test9
|
||||||
|
//Source: https://github.com/CannibalVox/DimDoors/releases/download/2.2.5-test9/DimensionalDoors-2.2.5-test9.jar
|
||||||
|
compileOnly(deobf("CannibalVox.DimDoors:DimensionalDoors:2.2.5-test9"))
|
||||||
|
|
||||||
|
//DragonAPI V32a
|
||||||
|
compileOnly(deobfCurse("dragonapi-235591:4611379"))
|
||||||
|
|
||||||
|
//Dynamic Surroundings 1.0.6.4
|
||||||
|
compileOnly(deobfCurse("dynamicsurrounding-238891:2642381"))
|
||||||
|
|
||||||
|
//Enderlicious 1.1.2
|
||||||
|
compileOnly(deobfCurse("enderlicious-508777:3504111"))
|
||||||
|
|
||||||
|
//Enhanced Biomes 2.5
|
||||||
|
compileOnly(deobf("mirror:enhancedbiomes:2.5"))
|
||||||
|
|
||||||
|
//Erebus 0.4.7
|
||||||
|
compileOnly(deobfCurse("theerebus-220698:2305035"))
|
||||||
|
|
||||||
|
//Extra Planets 2.1.4
|
||||||
|
compileOnly(deobfCurse("extraplanets-241291:3214413"))
|
||||||
|
|
||||||
|
//Extra Utilities 1.2.12
|
||||||
|
compileOnly(deobfCurse("extrautilities-225561:2264384"))
|
||||||
|
|
||||||
|
//Futurepack v18.7
|
||||||
|
compileOnly(deobfCurse("futurepack-237333:2263966"))
|
||||||
|
|
||||||
|
//Galacticraft Core 3.0.12.504
|
||||||
|
//micdoodle8.com went down
|
||||||
|
compileOnly(deobf("mirror.micdoodle:GalacticraftCore:1.7-3.0.12.504"))
|
||||||
|
|
||||||
|
//Galacticraft Planets 3.0.12.504
|
||||||
|
compileOnly(deobf("mirror.micdoodle:Galacticraft-Planets:1.7-3.0.12.504"))
|
||||||
|
|
||||||
|
//Highlands 2.2.3
|
||||||
|
compileOnly(deobfCurse("highlands-221226:2227924"))
|
||||||
|
|
||||||
|
//Immersive Cavegen 1.2g
|
||||||
|
compileOnly(deobfCurse("immersivecavegen-521557:3649411"))
|
||||||
|
|
||||||
|
//Industrial Revolution by Redstone Rebooted 1.1.1
|
||||||
|
compileOnly(deobfCurse("industrialrevolutionbyredstonerebooted-241812:2538035"))
|
||||||
|
|
||||||
|
//LOTR Mod 36.15
|
||||||
|
compileOnly(deobfCurse("lotrmod-423748:4091561"))
|
||||||
|
|
||||||
|
//Matter Overdrive 0.4.2-hotfix1
|
||||||
|
compileOnly(deobfCurse("matteroverdrive-229694:2331162"))
|
||||||
|
|
||||||
|
//More Fun Quicksands Mod 1.0.8.8-fixed
|
||||||
|
compileOnly(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
||||||
|
|
||||||
|
//Nature's Compass 1.3.1
|
||||||
|
compileOnly(deobfCurse("naturescompass-252848:2451823"))
|
||||||
|
|
||||||
|
//Netherlicious 3.2.8
|
||||||
|
compileOnly(deobfCurse("netherlicious-385860:4363437"))
|
||||||
|
|
||||||
|
//Nomadic Tents 1.12.1
|
||||||
|
compileOnly(deobfCurse("nomadictents-238794:2679476"))
|
||||||
|
|
||||||
|
//Nostalgic World Generation 1.0.0
|
||||||
|
compileOnly(deobfCurse("nostalgiagenerator-927053:4816167"))
|
||||||
|
|
||||||
|
//Hbm's Nuclear Tech Mod 1.0.27X5027
|
||||||
|
compileOnly(deobfCurse("hbm-ntm-235439:5534354"))
|
||||||
|
|
||||||
|
//RandomThings 2.2.4
|
||||||
|
compileOnly(deobfCurse("randomthings-59816:2225310"))
|
||||||
|
|
||||||
|
//Realistic Terrain Generation 1.1.1.7
|
||||||
|
compileOnly(deobfCurse("rtg-237989:2521557"))
|
||||||
|
|
||||||
|
//Restructured 1.0.4.2
|
||||||
|
compileOnly(deobfCurse("restructured-230570:2276784"))
|
||||||
|
|
||||||
|
//Thaumcraft 4.2.3.5
|
||||||
|
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
||||||
|
|
||||||
|
//ThutCore 2.0
|
||||||
|
//Only available on dropbox
|
||||||
|
compileOnly(deobf("mirror:thutcore:2.0"))
|
||||||
|
|
||||||
|
//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
|
||||||
|
compileOnly(deobf("mirror:tropicraft:6.0.5"))
|
||||||
|
|
||||||
|
//Twilight Forest 2.3.8
|
||||||
|
compileOnly(deobfCurse("twilightforest-227639:3039937"))
|
||||||
|
|
||||||
|
//Underground Biomes Constructs 0.8-beta49
|
||||||
|
compileOnly(deobfCurse("undergroundbiomesconstructs-72744:2304497"))
|
||||||
|
|
||||||
|
//Witchery 0.24.1
|
||||||
|
compileOnly(deobfCurse("witchery-69673:2234410"))
|
||||||
|
|
||||||
|
//WorldEdit 6.1.1
|
||||||
|
compileOnly(deobfCurse("worldedit-225608:2309699"))
|
||||||
|
|
||||||
|
////////////////Dependencies for patched mods////////////////
|
||||||
|
|
||||||
|
//SpaceCore 0.7.14
|
||||||
|
//needed by: Biome Wand
|
||||||
|
//Source: http://spacechase0.com/files/mcmod/1.7.10-SpaceCore-0.7.14.jar
|
||||||
|
compileOnly(deobf("mirror:1.7.10-SpaceCore:0.7.14"))
|
||||||
|
}
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
//file:noinspection DependencyNotationArgument
|
|
||||||
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.24") {
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
|
||||||
|
|
||||||
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.10.13:dev")
|
|
||||||
|
|
||||||
////////////////Patched mods////////////////
|
|
||||||
|
|
||||||
//AbyssalCraft 1.9.1.3-FINAL
|
|
||||||
compileOnly(deobfCurse("abyssalcraft-53686:2311135"))
|
|
||||||
|
|
||||||
//Advanced Rocketry
|
|
||||||
compileOnly(deobfCurse("advancedrocketry-236542:2985057"))
|
|
||||||
|
|
||||||
//Alternate Terrain Generation 0.12.0
|
|
||||||
compileOnly(deobfCurse("atg-228356:2231155"))
|
|
||||||
|
|
||||||
//Antique Atlas 4.4.4
|
|
||||||
compileOnly(deobfCurse("antiqueatlas-227795:2454232"))
|
|
||||||
|
|
||||||
//Anti ID Conflict 1.3.5
|
|
||||||
compileOnly(deobfCurse("antiidconflict-246288:2308279"))
|
|
||||||
|
|
||||||
// //ArchaicFix 0.2.0
|
|
||||||
// compileOnly("com.github.embeddedt:ArchaicFix:0.2.0:dev")
|
|
||||||
|
|
||||||
//Atum 0.6.77
|
|
||||||
compileOnly(deobfCurse("atum-59621:2256356"))
|
|
||||||
|
|
||||||
//Biomes O' Plenty 2.1.0.2308
|
|
||||||
compileOnly(deobfCurse("biomesoplenty-220318:2499612"))
|
|
||||||
|
|
||||||
//Biome Tweaker 2.0.182
|
|
||||||
compileOnly(deobfCurse("biometweaker-228895:2279911"))
|
|
||||||
|
|
||||||
//Biome Wand 1.1.9
|
|
||||||
//Mirrored at: https://maven.falsepattern.com/releases/mirror/mirror/1.7.10-Biome-Wand-1.1.9.jar
|
|
||||||
compileOnly(deobf("https://spacechase0.com/wp-content/uploads/2014/10/1.7.10-Biome-Wand-1.1.9.jar"))
|
|
||||||
|
|
||||||
//Buildcraft 7.1.24
|
|
||||||
compileOnly(deobfCurse("buildcraft-61811:3538651"))
|
|
||||||
|
|
||||||
//CoFH Lib 1.2.1-185
|
|
||||||
compileOnly(deobfCurse("cofh-lib-220333:2388748"))
|
|
||||||
|
|
||||||
//CompactMachines 1.21
|
|
||||||
compileOnly(deobfCurse("compactmachines-224218:2268575"))
|
|
||||||
|
|
||||||
//Dark World 0.2
|
|
||||||
compileOnly(deobfCurse("darkworld-225075:2225172"))
|
|
||||||
|
|
||||||
//DragonAPI V31b
|
|
||||||
compileOnly(deobfCurse("dragonapi-235591:3574508"))
|
|
||||||
|
|
||||||
//Dynamic Surroundings 1.0.6.4
|
|
||||||
compileOnly(deobfCurse("dynamicsurrounding-238891:2642381"))
|
|
||||||
|
|
||||||
//Enderlicious 1.1.2
|
|
||||||
compileOnly(deobfCurse("enderlicious-508777:3504111"))
|
|
||||||
|
|
||||||
//Enhanced Biomes 2.5
|
|
||||||
compileOnly(deobf("https://mvn.falsepattern.com/releases/mirror/mirror/enhancedbiomes-2.5.jar"))
|
|
||||||
|
|
||||||
//Erebus 0.4.7
|
|
||||||
compileOnly(deobfCurse("theerebus-220698:2305035"))
|
|
||||||
|
|
||||||
//Extra Planets 2.1.4
|
|
||||||
compileOnly(deobfCurse("extraplanets-241291:3214413"))
|
|
||||||
|
|
||||||
//Extra Utilities 1.2.12
|
|
||||||
compileOnly(deobfCurse("extrautilities-225561:2264384"))
|
|
||||||
|
|
||||||
//Futurepack v18.7
|
|
||||||
compileOnly(deobfCurse("futurepack-237333:2263966"))
|
|
||||||
|
|
||||||
//Galacticraft Core 3.0.12.504
|
|
||||||
//micdoodle8.com went down
|
|
||||||
compileOnly(deobf("https://mvn.falsepattern.com/releases/mirror/mirror/micdoodle/GalacticraftCore-1.7-3.0.12.504.jar"))
|
|
||||||
|
|
||||||
//Galacticraft Planets 3.0.12.504
|
|
||||||
compileOnly(deobf("https://mvn.falsepattern.com/releases/mirror/mirror/micdoodle/Galacticraft-Planets-1.7-3.0.12.504.jar"))
|
|
||||||
|
|
||||||
//Highlands 2.2.3
|
|
||||||
compileOnly(deobfCurse("highlands-221226:2227924"))
|
|
||||||
|
|
||||||
//Immersive Cavegen 1.2g
|
|
||||||
compileOnly(deobfCurse("immersivecavegen-521557:3649411"))
|
|
||||||
|
|
||||||
//LOTR Mod 36.14
|
|
||||||
compileOnly(deobfCurse("lotrmod-423748:3646430"))
|
|
||||||
|
|
||||||
//More Fun Quicksands Mod 1.0.8.8-fixed
|
|
||||||
compileOnly(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
|
||||||
|
|
||||||
//Nature's Compass 1.3.1
|
|
||||||
compileOnly(deobfCurse("naturescompass-252848:2451823"))
|
|
||||||
|
|
||||||
//Netherlicious 3.2.3
|
|
||||||
compileOnly(deobfCurse("netherlicious-385860:3858031"))
|
|
||||||
|
|
||||||
//Nomadic Tents 1.12.1
|
|
||||||
compileOnly(deobfCurse("nomadictents-238794:2679476"))
|
|
||||||
|
|
||||||
//RandomThings 2.2.4
|
|
||||||
compileOnly(deobfCurse("randomthings-59816:2225310"))
|
|
||||||
|
|
||||||
//Realistic Terrain Generation 1.1.1.7
|
|
||||||
compileOnly(deobfCurse("rtg-237989:2521557"))
|
|
||||||
|
|
||||||
//Thaumcraft 4.2.3.5
|
|
||||||
compileOnly(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
|
|
||||||
compileOnly(deobf("https://mvn.falsepattern.com/releases/mirror/mirror/tropicraft-6.0.5.jar"))
|
|
||||||
|
|
||||||
//Twilight Forest 2.3.8
|
|
||||||
compileOnly(deobfCurse("twilightforest-227639:3039937"))
|
|
||||||
|
|
||||||
//Underground Biomes Constructs 0.8-beta49
|
|
||||||
compileOnly(deobfCurse("undergroundbiomesconstructs-72744:2304497"))
|
|
||||||
|
|
||||||
//Witchery 0.24.1
|
|
||||||
compileOnly(deobfCurse("witchery-69673:2234410"))
|
|
||||||
|
|
||||||
//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/releases/mirror/mirror/1.7.10-SpaceCore-0.7.14.jar
|
|
||||||
compileOnly(deobf("http://spacechase0.com/files/mcmod/1.7.10-SpaceCore-0.7.14.jar"))
|
|
||||||
}
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
# Mod settings
|
|
||||||
#region mod
|
|
||||||
|
|
||||||
modName = EndlessIDs
|
|
||||||
|
|
||||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
|
||||||
modId = endlessids
|
|
||||||
|
|
||||||
# The "root package" of your mod. All of your mod classes *should* be placed under this package for simplicity.
|
|
||||||
modGroup = com.falsepattern.endlessids
|
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
|
||||||
# leave this property empty.
|
|
||||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
|
||||||
apiPackage =
|
|
||||||
|
|
||||||
# WHY is there no version field?
|
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
|
||||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
|
||||||
# However, if you really want to, you can use the VERSION environment variable to override this.
|
|
||||||
|
|
||||||
minecraftVersion = 1.7.10
|
|
||||||
forgeVersion = 10.13.4.1614
|
|
||||||
|
|
||||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
|
||||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
|
||||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
|
||||||
developmentEnvironmentUserName = Developer
|
|
||||||
|
|
||||||
#endregion mod
|
|
||||||
|
|
||||||
# Publishing settings
|
|
||||||
#region publishing
|
|
||||||
|
|
||||||
# Note: Both the modrinth and the curseforge publications are invoked by the "publish" gradle task
|
|
||||||
# (when the respective publication's project ID is set up correctly, of course). You don't need to individually run
|
|
||||||
# each of them.
|
|
||||||
|
|
||||||
# Maven publishing
|
|
||||||
#region maven
|
|
||||||
|
|
||||||
# The maven server to upload the artifacts to
|
|
||||||
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)
|
|
||||||
# You can also use the MAVEN_DEPLOY_USER and MAVEN_DEPLOY_PASSWORD environment variables to set this information!
|
|
||||||
repositoryName = mavenpattern
|
|
||||||
|
|
||||||
# What the artifact should be called. These will be the "name" of the published package, suffixed with the minecraft
|
|
||||||
# version with a -mc prefix (groupid:artifactid-mcminecraftVersion:version:qualifier).
|
|
||||||
# For instance, the default values this example ships with would turn into com.myname:mymodid-mc1.7.10:version
|
|
||||||
# The version is determined automatically from the git version.
|
|
||||||
mavenGroupId = com.falsepattern
|
|
||||||
mavenArtifactId = endlessids
|
|
||||||
|
|
||||||
#endregion maven
|
|
||||||
|
|
||||||
# Modrinth publishing
|
|
||||||
#region modrinth
|
|
||||||
|
|
||||||
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
|
||||||
|
|
||||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
|
||||||
# Leave this empty if you don't want to publish on Modrinth.
|
|
||||||
modrinthProjectId = qGHY4QGo
|
|
||||||
|
|
||||||
# The project's dependencies on Modrinth. You can use this to refer to other projects on Modrinth.
|
|
||||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
|
||||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
|
||||||
# type can be one of [project, version],
|
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
|
||||||
# Example: required-project:fplib;optional-project:spongemixin1710;incompatible-project:gregtech
|
|
||||||
modrinthDependencies = required-project:fplib;optional-project:spongemixin1710
|
|
||||||
|
|
||||||
#endregion modrinth
|
|
||||||
|
|
||||||
# CurseForge publishing
|
|
||||||
#region curseforge
|
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
|
||||||
|
|
||||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
|
||||||
# Leave this empty if you don't want to publish on CurseForge.
|
|
||||||
curseForgeProjectId = 665730
|
|
||||||
|
|
||||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
|
||||||
# Syntax: type1:name1;type2:name2;...
|
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
|
||||||
# and the name is the CurseForge project id of the other mod.
|
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
|
||||||
# TODO add fplib once verified.
|
|
||||||
curseForgeRelations = optionalDependency:spongemixins;optionalDependency:mixinbooterlegacy
|
|
||||||
|
|
||||||
#endregion curseforge
|
|
||||||
|
|
||||||
# This will be inserted as the changelog text in the Modrinth/CurseForge publications.
|
|
||||||
# If the text contains "{version}", it will be replaced with the current mod version. This is useful when the changelog
|
|
||||||
# is just a URL pointing to a GitHub release tag.
|
|
||||||
# If left empty, the changelog text will be set to "No changelog URL was provided."
|
|
||||||
# Example: https://github.com/myname/mymod/releases/tag/{version}
|
|
||||||
changelog = https://github.com/FalsePattern/EndlessIDs/releases/tag/{version}
|
|
||||||
|
|
||||||
# endregion publishing
|
|
||||||
|
|
||||||
# Buildscript automatic update checker settings
|
|
||||||
#region autoupdates
|
|
||||||
|
|
||||||
# Will update your build.gradle automatically whenever an update is available
|
|
||||||
autoUpdateBuildScript = false
|
|
||||||
# Disable checking of buildscript updates.
|
|
||||||
skipBuildScriptUpdateCheck = false
|
|
||||||
|
|
||||||
#endregion autoupdates
|
|
||||||
|
|
||||||
# Gradle token strings
|
|
||||||
#region gradletokens
|
|
||||||
|
|
||||||
# Define a source file of your project with:
|
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
|
||||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
|
||||||
# version in @Mod([...], version = VERSION, [...])
|
|
||||||
# Leave these properties empty to skip individual token replacements
|
|
||||||
replaceGradleTokenInFile = Tags.java
|
|
||||||
gradleTokenModId = GRADLETOKEN_MODID
|
|
||||||
gradleTokenModName = GRADLETOKEN_MODNAME
|
|
||||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
|
||||||
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
|
||||||
|
|
||||||
#endregion gradletokens
|
|
||||||
|
|
||||||
# Mixins
|
|
||||||
#region mixins
|
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
|
||||||
usesMixins = true
|
|
||||||
# Enable this if one of the dependencies uses SpongeMixins.
|
|
||||||
hasMixinDeps = false
|
|
||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
|
||||||
mixinPlugin = mixin.plugin.MixinPlugin
|
|
||||||
# Whether you want the plugin to be configured as a PREINIT mixin
|
|
||||||
mixinPluginPreInit = false
|
|
||||||
# The minimum SpongePowered Mixins version required by the plugin. Internal default is 0.8.5 (GasStation)
|
|
||||||
mixinPluginMinimumVersion =
|
|
||||||
# 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 any custom mixin .json configs here. If you have multiple, comma-separate them. If you don't want to load
|
|
||||||
# any jsons manually, leave this empty. You can use custom configs even if you already have a plugin added.
|
|
||||||
# note: mixins.<modid>.json is used by the mixinPlugin's autogenerated config. Additionally, the refmap from the mixinsPackage
|
|
||||||
# is always put into mixins.<modid>.refmap.json.
|
|
||||||
# example: mixins.foo.json,mixins.bar.json
|
|
||||||
mixinConfigs =
|
|
||||||
|
|
||||||
#endregion mixins
|
|
||||||
|
|
||||||
# Coremod and access transformers
|
|
||||||
#region core
|
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
|
||||||
# Example value: mymodid_at.cfg
|
|
||||||
accessTransformersFile =
|
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
|
||||||
# This parameter is for legacy compatibility only
|
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
|
||||||
coreModClass = IEPlugin
|
|
||||||
|
|
||||||
#endregion core
|
|
||||||
|
|
||||||
# Dependency deobfuscation settings (advanced)
|
|
||||||
#region ddeobf
|
|
||||||
|
|
||||||
# These 3 entries specify the location where the SRG mappings should be fetched from. Only set these if you know
|
|
||||||
# what you're doing. The defaults inside the buildscript should just work without any extra configuration.
|
|
||||||
remoteMappings =
|
|
||||||
mappingsChannel =
|
|
||||||
mappingsVersion =
|
|
||||||
|
|
||||||
#endregion ddeobf
|
|
||||||
|
|
||||||
# Miscellaneous settings
|
|
||||||
#region misc
|
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
|
||||||
containsMixinsAndOrCoreModOnly = false
|
|
||||||
|
|
||||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
|
||||||
# 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 =
|
|
||||||
|
|
||||||
#endregion misc
|
|
||||||
|
|
||||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,80 +15,116 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -97,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+27
-33
@@ -13,8 +13,10 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,10 +27,14 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -51,48 +57,36 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
// 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/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = uri("https://mvn.falsepattern.com/fpgradle/")
|
||||||
|
name = "fpgradle"
|
||||||
|
content {
|
||||||
|
includeModule("com.gtnewhorizons", "retrofuturagradle")
|
||||||
|
includeModule("com.falsepattern", "fpgradle-plugin")
|
||||||
|
includeModule("fpgradle-minecraft", "fpgradle-minecraft.gradle.plugin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://mvn.falsepattern.com/releases/")
|
||||||
|
name = "mavenpattern"
|
||||||
|
content {
|
||||||
|
includeGroup("com.falsepattern")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://mvn.falsepattern.com/jitpack/")
|
||||||
|
name = "jitpack"
|
||||||
|
content {
|
||||||
|
includeModule("io.github.LegacyModdingMC.MappingGenerator", "MappingGenerator")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "EndlessIDs"
|
||||||
@@ -1,5 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.DataRegistry;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import com.falsepattern.endlessids.managers.BiomeManager;
|
||||||
|
import com.falsepattern.endlessids.managers.BlockIDManager;
|
||||||
|
import com.falsepattern.endlessids.managers.BlockMetaManager;
|
||||||
import com.falsepattern.endlessids.patching.CommonManager;
|
import com.falsepattern.endlessids.patching.CommonManager;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -15,7 +43,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
name = Tags.MODNAME,
|
name = Tags.MODNAME,
|
||||||
acceptedMinecraftVersions = "[1.7.10]",
|
acceptedMinecraftVersions = "[1.7.10]",
|
||||||
dependencies = "required-after:falsepatternlib@[0.10.13,);required-after:gasstation@[0.5.0,);after:antiidconflict")
|
dependencies = "required-after:chunkapi@[0.5.0,0.6.0);" +
|
||||||
|
"required-after:falsepatternlib@[1.4.1,);" +
|
||||||
|
"after:antiidconflict")
|
||||||
public class EndlessIDs {
|
public class EndlessIDs {
|
||||||
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
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 byte[] FAKE_BIOME_ARRAY_PLACEHOLDER = new byte[256];
|
||||||
@@ -33,16 +63,59 @@ public class EndlessIDs {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
|
LOG.info("---------------------------------------------------------");
|
||||||
|
LOG.info("Current EndlessIDs configuration:");
|
||||||
|
logConfig(" Biome Extension", GeneralConfig.extendBiome);
|
||||||
|
logConfig(" Block/Item Extension", GeneralConfig.extendBlockItem);
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
logConfig(" Extra Item Bits", GeneralConfig.extraItemIDBits);
|
||||||
|
logConfig(" Extra Block Bits", GeneralConfig.extraBlockIDBits);
|
||||||
|
}
|
||||||
|
logConfig(" DataWatcher Extension", GeneralConfig.extendDataWatcher);
|
||||||
|
logConfig(" Enchantment Extension", GeneralConfig.extendEnchantment);
|
||||||
|
logConfig(" Potion Extension", GeneralConfig.extendPotion);
|
||||||
|
logConfig(" Redstone Extension", GeneralConfig.extendRedstone);
|
||||||
|
if (GeneralConfig.extendRedstone) {
|
||||||
|
LOG.warn(" (Redstone extension is an experimental and dangerous feature, and should NEVER be used in worlds that you worry about getting corrupted!)");
|
||||||
|
logConfig(" Max redstone level", GeneralConfig.maxRedstone);
|
||||||
|
}
|
||||||
|
logConfig(" Registry performance tweak", GeneralConfig.enableRegistryPerformanceTweak);
|
||||||
|
if (GeneralConfig.enableRegistryPerformanceTweak) {
|
||||||
|
LOG.warn(" (This tweak has not gone through proper testing yet, so it might corrupt worlds. USE BACKUPS!)");
|
||||||
|
}
|
||||||
|
LOG.info("---------------------------------------------------------");
|
||||||
patchManager.preInit();
|
patchManager.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void logConfig(String name, boolean value) {
|
||||||
|
LOG.info(name + (value ? ": ENABLED" : ": disabled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void logConfig(String name, int value) {
|
||||||
|
LOG.info(name + ": " + value);
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent e) {
|
public void init(FMLInitializationEvent e) {
|
||||||
patchManager.init();
|
patchManager.init();
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
DataRegistry.registerDataManager(new BiomeManager());
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
DataRegistry.registerDataManager(new BlockIDManager());
|
||||||
|
DataRegistry.registerDataManager(new BlockMetaManager());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent e) {
|
public void postInit(FMLPostInitializationEvent e) {
|
||||||
patchManager.postInit();
|
patchManager.postInit();
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
DataRegistry.disableDataManager("minecraft", "biome");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
DataRegistry.disableDataManager("minecraft", "blockid");
|
||||||
|
DataRegistry.disableDataManager("minecraft", "metadata");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,138 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
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.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ShortBuffer;
|
|
||||||
|
|
||||||
public class Hooks {
|
public class Hooks {
|
||||||
|
|
||||||
public static byte[] getBlockData(final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val lsb = ebs.getLSB();
|
|
||||||
val msb = ebs.getMSB();
|
|
||||||
final byte[] ret = new byte[lsb.length * 3];
|
|
||||||
ByteBuffer.wrap(ret).asShortBuffer().put(lsb);
|
|
||||||
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();
|
|
||||||
val lsbBytes = lsb.length * 2;
|
|
||||||
ShortBuffer.wrap(ebs.getLSB()).put(ByteBuffer.wrap(data, offset, lsbBytes).asShortBuffer());
|
|
||||||
System.arraycopy(data, offset + lsbBytes, msb, 0, msb.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeChunkToNbt(final NBTTagCompound nbt, final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val ebsLSB = ebs.getLSB();
|
|
||||||
val ebsMSB = ebs.getMSB();
|
|
||||||
|
|
||||||
val byte1Data = new byte[ebsLSB.length];
|
|
||||||
byte[] byte2BottomNibbleData = null;
|
|
||||||
byte[] byte2TopNibbleData = null;
|
|
||||||
byte[] byte3Data = null;
|
|
||||||
for (int i = 0; i < ebsLSB.length; ++i) {
|
|
||||||
if (ebsMSB[i] != 0) {
|
|
||||||
if (byte3Data == null) {
|
|
||||||
byte3Data = new byte[ebsLSB.length];
|
|
||||||
}
|
|
||||||
byte3Data[i] = ebsMSB[i];
|
|
||||||
}
|
|
||||||
val idLSB = (ebsLSB[i] & 0xFFFF);
|
|
||||||
byte1Data[i] = (byte) (idLSB & 0xFF);
|
|
||||||
|
|
||||||
if (idLSB <= 0xFF) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
val nibbleIndex = i >> 1;
|
|
||||||
val nibbleShift = (i & 1) * 4;
|
|
||||||
if (byte2BottomNibbleData == null) {
|
|
||||||
byte2BottomNibbleData = new byte[ebsLSB.length / 2];
|
|
||||||
}
|
|
||||||
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
|
||||||
|
|
||||||
if (idLSB <= 0xFFF) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData == null) {
|
|
||||||
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
|
||||||
}
|
|
||||||
byte2TopNibbleData[nibbleIndex] |= ((idLSB >>> 12) & 0xF) << nibbleShift;
|
|
||||||
|
|
||||||
}
|
|
||||||
nbt.setByteArray("Blocks", byte1Data);
|
|
||||||
if (byte2BottomNibbleData != null) {
|
|
||||||
nbt.setByteArray("Add", byte2BottomNibbleData);
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData != null) {
|
|
||||||
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
|
||||||
}
|
|
||||||
if (byte3Data != null) {
|
|
||||||
nbt.setByteArray("BlocksB3", byte3Data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
|
||||||
assert nbt.hasKey("Blocks");
|
|
||||||
val byte1Data = nbt.getByteArray("Blocks");
|
|
||||||
val byte2BottomNibbleData = nbt.hasKey("Add") ? nbt.getByteArray("Add") : null;
|
|
||||||
val byte2TopNibbleData = nbt.hasKey("BlocksB2Hi") ? nbt.getByteArray("BlocksB2Hi") : null;
|
|
||||||
val byte3Data = nbt.hasKey("BlocksB3") ? nbt.getByteArray("BlocksB3") : null;
|
|
||||||
|
|
||||||
val lsb = ebs.getLSB();
|
|
||||||
val msb = ebs.getMSB();
|
|
||||||
for (int i = 0; i < lsb.length; i++) {
|
|
||||||
if (byte3Data != null) {
|
|
||||||
msb[i] = byte3Data[i];
|
|
||||||
}
|
|
||||||
int nibbleShift = (i & 1) * 4;
|
|
||||||
int id = byte1Data[i] & 0xFF;
|
|
||||||
if (byte2BottomNibbleData != null) {
|
|
||||||
id |= ((byte2BottomNibbleData[i >> 1] >> nibbleShift) & 0xF) << 8;
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData != null) {
|
|
||||||
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
|
||||||
}
|
|
||||||
lsb[i] = (short) id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeInvalidBlocksHook(final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val blkIdsLSB = ebs.getLSB();
|
|
||||||
val blkIdsMSB = ebs.getMSB();
|
|
||||||
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;
|
|
||||||
if (id > 0) {
|
|
||||||
final Block block = (Block) Block.blockRegistry.getObjectById(id);
|
|
||||||
if (block == null) {
|
|
||||||
if (GeneralConfig.removeInvalidBlocks) {
|
|
||||||
blkIdsLSB[off] = 0;
|
|
||||||
}
|
|
||||||
} else if (block != Blocks.air) {
|
|
||||||
++cntNonEmpty;
|
|
||||||
if (block.getTickRandomly()) {
|
|
||||||
++cntTicking;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ebs.setBlockRefCount(cntNonEmpty);
|
|
||||||
ebs.setTickRefCount(cntTicking);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getIdFromBlockWithCheck(final Block block, final Block oldBlock) {
|
public static int getIdFromBlockWithCheck(final Block block, final Block oldBlock) {
|
||||||
final int id = Block.getIdFromBlock(block);
|
final int id = Block.getIdFromBlock(block);
|
||||||
if (GeneralConfig.catchUnregisteredBlocks && id == -1) {
|
if (GeneralConfig.catchUnregisteredBlocks && id == -1) {
|
||||||
@@ -151,8 +47,8 @@ public class Hooks {
|
|||||||
public static void shortToByteArray(short[] shortArray, int shortOffset, byte[] byteArray, int byteOffset, int shortCount) {
|
public static void shortToByteArray(short[] shortArray, int shortOffset, byte[] byteArray, int byteOffset, int shortCount) {
|
||||||
for (int i = 0; i < shortCount; i++) {
|
for (int i = 0; i < shortCount; i++) {
|
||||||
short s = shortArray[shortOffset + i];
|
short s = shortArray[shortOffset + i];
|
||||||
byteArray[byteOffset + i * 2] = (byte)(s & 255);
|
byteArray[byteOffset + i * 2] = (byte) (s & 255);
|
||||||
byteArray[byteOffset + i * 2 + 1] = (byte)((s >>> 8) & 255);
|
byteArray[byteOffset + i * 2 + 1] = (byte) ((s >>> 8) & 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,47 +79,9 @@ public class Hooks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void oldBiomeByteToNewShortArray(byte[] byteArray, short[] shortArray) {
|
public static void scatter(byte[] byteArray, short[] shortArray) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < byteArray.length; i++) {
|
||||||
shortArray[i] = (short) (byteArray[i] & 0xff);
|
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,59 +0,0 @@
|
|||||||
package com.falsepattern.endlessids;
|
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
|
||||||
import cpw.mods.fml.relauncher.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() {
|
|
||||||
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) {
|
|
||||||
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAccessTransformerClass() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.falsepattern.endlessids;
|
|
||||||
|
|
||||||
public class Tags {
|
|
||||||
public static final String MODID = "GRADLETOKEN_MODID";
|
|
||||||
public static final String MODNAME = "GRADLETOKEN_MODNAME";
|
|
||||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
|
||||||
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
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,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class AsmTransformException extends RuntimeException {
|
public class AsmTransformException extends RuntimeException {
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
|
||||||
|
|
||||||
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 {
|
|
||||||
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;
|
|
||||||
|
|
||||||
static {
|
|
||||||
editMap = new HashMap<>();
|
|
||||||
for (final ClassEdit edit : values()) {
|
|
||||||
for (final String name : edit.classNames) {
|
|
||||||
ClassEdit.editMap.put(name, edit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
|
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||||
|
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||||
|
import cpw.mods.fml.relauncher.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 + "_core")
|
||||||
|
@TransformerExclusions({"com.falsepattern.endlessids.asm", "com.falsepattern.endlessids.config.GeneralConfig"})
|
||||||
|
@DependsOn("falsepatternlib")
|
||||||
|
public class EndlessIDsCore implements IFMLLoadingPlugin {
|
||||||
|
public static boolean deobfuscated;
|
||||||
|
public EndlessIDsCore() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public String[] getASMTransformerClass() {
|
||||||
|
deobfuscated = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
||||||
|
val cl = Launch.classLoader;
|
||||||
|
val field = LaunchClassLoader.class.getDeclaredField("transformerExceptions");
|
||||||
|
field.setAccessible(true);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
val exceptions = (Set<String>) field.get(cl);
|
||||||
|
if (exceptions.contains("code.elix_x.coremods")) {
|
||||||
|
EndlessIDsTransformer.logger.info("AntiIDConflict detected!");
|
||||||
|
EndlessIDsTransformer.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[]{EndlessIDsTransformer.class.getName()};
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModContainerClass() {
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BiomeContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BlockItemContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendDataWatcher) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.DataWatcherContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendEnchantment) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.EnchantmentContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendPotion) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.PotionContainer");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSetupClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void injectData(final Map<String, Object> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.DevFixer;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.GameDataAccelerator;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.SpaceCoreModInfoGenerator;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.chunk.ChunkProviderSuperPatcher;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.chunk.LOTRFieldExposer;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import com.falsepattern.lib.turboasm.MergeableTurboTransformer;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
|
import lombok.val;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EndlessIDsTransformer extends MergeableTurboTransformer {
|
||||||
|
public static final Logger logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
||||||
|
|
||||||
|
private static List<TurboClassTransformer> transformers() {
|
||||||
|
val result = new ArrayList<TurboClassTransformer>();
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
result.add(new ChunkProviderSuperPatcher());
|
||||||
|
result.add(new LOTRFieldExposer());
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
result.add(new FmlRegistry());
|
||||||
|
}
|
||||||
|
if (GeneralConfig.enableRegistryPerformanceTweak) {
|
||||||
|
new GameDataAccelerator();
|
||||||
|
}
|
||||||
|
if (EndlessIDsCore.deobfuscated) {
|
||||||
|
result.add(new SpaceCoreModInfoGenerator());
|
||||||
|
result.add(new DevFixer());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EndlessIDsTransformer() {
|
||||||
|
super(transformers());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class FieldNotFoundException extends AsmTransformException {
|
public class FieldNotFoundException extends AsmTransformException {
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.asm.stubpackage.cpw.mods.fml.common.registry.GameData;
|
||||||
|
import com.falsepattern.endlessids.util.WeakIdentityHashMap;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
//Used by ASM
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class GameDataHooks {
|
||||||
|
private static WeakIdentityHashMap<Block, WeakReference<ItemBlock>> forGameData(GameData gameData) {
|
||||||
|
if (gameData.endlessIDsItemBlockCache == null) {
|
||||||
|
gameData.endlessIDsItemBlockCache = new WeakIdentityHashMap<>();
|
||||||
|
}
|
||||||
|
return gameData.endlessIDsItemBlockCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cacheItemBlock(ItemBlock itemBlock, GameData gameData) {
|
||||||
|
forGameData(gameData).put(itemBlock.field_150939_a, new WeakReference<>(itemBlock));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemBlock fetchCachedItemBlock(Block block, GameData gameData) {
|
||||||
|
var weakItem = forGameData(gameData).get(block);
|
||||||
|
if (weakItem != null) {
|
||||||
|
return weakItem.get();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Iterable<Item> fakeIterable() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|||||||
@@ -1,91 +0,0 @@
|
|||||||
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.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;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class IETransformer implements IClassTransformer {
|
|
||||||
public static final Logger logger;
|
|
||||||
public static boolean isObfuscated;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (edits[0] == null) {
|
|
||||||
return isObfuscated ? bytes : DevFixer.fixDev(bytes);
|
|
||||||
}
|
|
||||||
if (!isObfuscated) {
|
|
||||||
DevFixer.transform(cn);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final ClassWriter writer = new ClassWriter(expanded ? ClassWriter.COMPUTE_FRAMES : 0);
|
|
||||||
cn.accept(writer);
|
|
||||||
IETransformer.logger.debug("Patched {} successfully.", transformedName);
|
|
||||||
return writer.toByteArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class MethodNotFoundException extends AsmTransformException {
|
public class MethodNotFoundException extends AsmTransformException {
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm.stubpackage.cpw.mods.fml.common.registry;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.util.WeakIdentityHashMap;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
public class GameData {
|
||||||
|
public WeakIdentityHashMap<Block, WeakReference<ItemBlock>> endlessIDsItemBlockCache;
|
||||||
|
}
|
||||||
@@ -1,28 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm.transformer;
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.ClassEdit;
|
import com.falsepattern.endlessids.Tags;
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
import com.falsepattern.endlessids.asm.EndlessIDsCore;
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
import lombok.AccessLevel;
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.FieldInsnNode;
|
import org.objectweb.asm.tree.FieldInsnNode;
|
||||||
import org.objectweb.asm.util.CheckClassAdapter;
|
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.Launch;
|
import net.minecraft.launchwrapper.Launch;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
public class DevFixer implements TurboClassTransformer {
|
||||||
public final class DevFixer {
|
|
||||||
private static final ClassNode blocks;
|
private static final ClassNode blocks;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (IETransformer.isObfuscated) {
|
if (!EndlessIDsCore.deobfuscated) {
|
||||||
blocks = null;
|
blocks = null;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -36,59 +56,66 @@ public final class DevFixer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] fixDev(byte[] classBytes) {
|
private static boolean biomeTweakerCompat(final ClassNode cn) {
|
||||||
if (IETransformer.isObfuscated) {
|
boolean modified = false;
|
||||||
return classBytes;
|
for (val field : cn.fields) {
|
||||||
}
|
|
||||||
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")) {
|
if (field.name.startsWith("spawnable")) {
|
||||||
field.access &= ~Opcodes.ACC_PROTECTED;
|
field.access &= ~Opcodes.ACC_PROTECTED;
|
||||||
field.access |= Opcodes.ACC_PUBLIC;
|
field.access |= Opcodes.ACC_PUBLIC;
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void remapBlocks(final ClassNode cn) {
|
private static boolean remapBlocks(final ClassNode cn) {
|
||||||
for (val method: cn.methods) {
|
boolean modified = false;
|
||||||
|
for (val method : cn.methods) {
|
||||||
val instructions = method.instructions;
|
val instructions = method.instructions;
|
||||||
int insnCount = instructions.size();
|
int insnCount = instructions.size();
|
||||||
for (int i = 0; i < insnCount; i++) {
|
for (int i = 0; i < insnCount; i++) {
|
||||||
val insn = instructions.get(i);
|
val insn = instructions.get(i);
|
||||||
if (insn instanceof FieldInsnNode) {
|
if (insn instanceof FieldInsnNode) {
|
||||||
val field = (FieldInsnNode) insn;
|
val field = (FieldInsnNode) insn;
|
||||||
if (field.getOpcode() == Opcodes.GETSTATIC &&
|
if (field.getOpcode() == Opcodes.GETSTATIC && field.owner.equals("net/minecraft/init/Blocks")) {
|
||||||
field.owner.equals("net/minecraft/init/Blocks")) {
|
for (val blockField : blocks.fields) {
|
||||||
for (val blockField: blocks.fields) {
|
if (blockField.name.equals(field.name) && !blockField.desc.equals(field.desc)) {
|
||||||
if (blockField.name.equals(field.name) &&
|
|
||||||
!blockField.desc.equals(field.desc)) {
|
|
||||||
field.desc = blockField.desc;
|
field.desc = blockField.desc;
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String owner() {
|
||||||
|
return Tags.MODNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "DevFixer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
return EndlessIDsCore.deobfuscated && !"net.minecraft.world.chunk.storage.AnvilChunkLoader".equals(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
boolean modified = false;
|
||||||
|
modified |= remapBlocks(cn);
|
||||||
|
if (className.equals("net.minecraft.world.biome.BiomeGenBase")) {
|
||||||
|
modified |= biomeTweakerCompat(cn);
|
||||||
|
}
|
||||||
|
return modified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
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,28 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm.transformer;
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
|
import lombok.val;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
public class FmlRegistry implements IClassNodeTransformer {
|
public class FmlRegistry implements TurboClassTransformer {
|
||||||
public FmlRegistry() {
|
public FmlRegistry() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
public String owner() {
|
||||||
|
return Tags.MODNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "FMLRegistry";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
return GeneralConfig.extendBlockItem && ("cpw.mods.fml.common.registry.GameData".equals(className) ||
|
||||||
|
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry".equals(className));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
field.value = ExtendedConstants.maxBlockID;
|
field.value = ExtendedConstants.maxBlockID;
|
||||||
}
|
}
|
||||||
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
|
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
field.value = ExtendedConstants.maxBlockID;
|
field.value = ExtendedConstants.maxItemID;
|
||||||
}
|
}
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final MethodNode method : cn.methods) {
|
for (final MethodNode method : cn.methods) {
|
||||||
@@ -30,10 +78,11 @@ public class FmlRegistry implements IClassNodeTransformer {
|
|||||||
ExtendedConstants.maxBlockID, true)) {
|
ExtendedConstants.maxBlockID, true)) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxItemID, true);
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw new AsmTransformException("can't find 4095 constant in any method");
|
throw new AsmTransformException("can't find 4095 constant in any method");
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||||
|
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.FieldInsnNode;
|
||||||
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
public class GameDataAccelerator implements TurboClassTransformer {
|
||||||
|
private static final int MASK_REGISTER_BLOCK = 0b1;
|
||||||
|
private static final int MASK_REGISTER_ITEM = 0b10;
|
||||||
|
|
||||||
|
private void transformRegisterItem(MethodNode method) {
|
||||||
|
var iter = method.instructions.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var insn = iter.next();
|
||||||
|
if (!(insn instanceof FieldInsnNode))
|
||||||
|
continue;
|
||||||
|
var typeInsn = (FieldInsnNode) insn;
|
||||||
|
if (!(typeInsn.owner.equals("net/minecraft/item/ItemBlock") &&
|
||||||
|
typeInsn.name.equals("field_150939_a") &&
|
||||||
|
typeInsn.desc.equals("Lnet/minecraft/block/Block;")))
|
||||||
|
continue;
|
||||||
|
iter.previous();
|
||||||
|
iter.add(new InsnNode(Opcodes.DUP));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "cacheItemBlock", "(Lnet/minecraft/item/ItemBlock;Lcpw/mods/fml/common/registry/GameData;)V", false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
transformError(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void transformError(MethodNode method) {
|
||||||
|
EndlessIDsTransformer.logger.error("Could not add caching code to GameData." + method.name + method.desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformRegisterBlock(MethodNode method) {
|
||||||
|
var iter = method.instructions.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var insn = iter.next();
|
||||||
|
if ((insn.getOpcode() != Opcodes.GETFIELD) && !(insn instanceof FieldInsnNode))
|
||||||
|
continue;
|
||||||
|
var fieldInsn = (FieldInsnNode) insn;
|
||||||
|
if (!(fieldInsn.owner.equals("cpw/mods/fml/common/registry/GameData") &&
|
||||||
|
fieldInsn.name.equals("iItemRegistry") &&
|
||||||
|
fieldInsn.desc.equals("Lcpw/mods/fml/common/registry/FMLControlledNamespacedRegistry;")))
|
||||||
|
continue;
|
||||||
|
iter.remove();
|
||||||
|
{
|
||||||
|
val testInsn = iter.previous();
|
||||||
|
if (testInsn.getOpcode() != Opcodes.ALOAD || ((VarInsnNode)testInsn).var != 0)
|
||||||
|
throw new AsmTransformException("Opcode assertion 1 failed!");
|
||||||
|
}
|
||||||
|
iter.remove();
|
||||||
|
{
|
||||||
|
val testInsn = iter.next();
|
||||||
|
if (testInsn.getOpcode() != Opcodes.INVOKEVIRTUAL)
|
||||||
|
throw new AsmTransformException("Opcodes assertion 2 failed!");
|
||||||
|
|
||||||
|
val testInvoke = (MethodInsnNode)testInsn;
|
||||||
|
if (!testInvoke.owner.equals("cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry") ||
|
||||||
|
!testInvoke.name.equals("typeSafeIterable"))
|
||||||
|
throw new AsmTransformException("Opcodes assertion 3 failed!");
|
||||||
|
}
|
||||||
|
iter.remove();
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 1));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "fetchCachedItemBlock", "(Lnet/minecraft/block/Block;Lcpw/mods/fml/common/registry/GameData;)Lnet/minecraft/item/ItemBlock;", false));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ASTORE, 4));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "fakeIterable", "()Ljava/lang/Iterable;", false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
transformError(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String owner() {
|
||||||
|
return Tags.MODNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "GameDataAccelerator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
return GeneralConfig.enableRegistryPerformanceTweak && "cpw.mods.fml.common.registry.GameData".equals(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
var cacheField = new FieldNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, "endlessIDsItemBlockCache", "Lcom/falsepattern/endlessids/util/WeakIdentityHashMap;", null, null);
|
||||||
|
cn.fields.add(cacheField);
|
||||||
|
int tweaksLeft = MASK_REGISTER_BLOCK | MASK_REGISTER_ITEM;
|
||||||
|
for (val method: cn.methods) {
|
||||||
|
if ((tweaksLeft & MASK_REGISTER_BLOCK) != 0 &&
|
||||||
|
method.name.equals("registerBlock") &&
|
||||||
|
method.desc.equals("(Lnet/minecraft/block/Block;Ljava/lang/String;I)I")) {
|
||||||
|
transformRegisterBlock(method);
|
||||||
|
tweaksLeft &= ~MASK_REGISTER_BLOCK;
|
||||||
|
} else if ((tweaksLeft & MASK_REGISTER_ITEM) != 0 &&
|
||||||
|
method.name.equals("registerItem") &&
|
||||||
|
method.desc.equals("(Lnet/minecraft/item/Item;Ljava/lang/String;I)I")) {
|
||||||
|
transformRegisterItem(method);
|
||||||
|
tweaksLeft &= ~MASK_REGISTER_ITEM;
|
||||||
|
}
|
||||||
|
if (tweaksLeft == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new AsmTransformException("Failed to accelerate block registration! Disable enableRegistryPerformanceTweak in the EndlessIDs config!");
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
-8
@@ -1,22 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.asm.transformer;
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.asm.EndlessIDsCore;
|
||||||
|
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
|
||||||
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.objectweb.asm.tree.InsnNode;
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
|
||||||
public class SpaceCoreModInfoGenerator implements IClassNodeTransformer {
|
public class SpaceCoreModInfoGenerator implements TurboClassTransformer {
|
||||||
@Override
|
@Override
|
||||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
public String owner() {
|
||||||
if (obfuscated) {
|
return Tags.MODNAME;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
for (val method: cn.methods) {
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "SpaceCoreModInfoGenerator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
return EndlessIDsCore.deobfuscated && "com.spacechase0.minecraft.spacecore.mcp.ModInfoGenerator".equals(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
for (val method : cn.methods) {
|
||||||
if (method.name.equals("generate")) {
|
if (method.name.equals("generate")) {
|
||||||
val iterator = method.instructions.iterator();
|
val iterator = method.instructions.iterator();
|
||||||
iterator.add(new InsnNode(Opcodes.RETURN));
|
iterator.add(new InsnNode(Opcodes.RETURN));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+337
-147
@@ -1,10 +1,37 @@
|
|||||||
package com.falsepattern.endlessids.asm.transformer;
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
package com.falsepattern.endlessids.asm.transformer.chunk;
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.asm.EndlessIDsCore;
|
||||||
|
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
|
||||||
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
@@ -20,6 +47,7 @@ import org.objectweb.asm.tree.VarInsnNode;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -115,91 +143,13 @@ import java.util.function.Supplier;
|
|||||||
* L6
|
* L6
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
public class ChunkProviderSuperPatcher implements TurboClassTransformer {
|
||||||
public static final String[] CLASS_BiomeGenBase;
|
public static final String[] CLASS_BiomeGenBase;
|
||||||
public static final String[] CLASS_IChunkProvider;
|
public static final String[] CLASS_IChunkProvider;
|
||||||
public static final String[] CLASS_ChunkProviderGenerate;
|
public static final String[] CLASS_ChunkProviderGenerate;
|
||||||
public static final String[] CLASS_Chunk;
|
public static final String[] CLASS_Chunk;
|
||||||
public static final String[] FIELD_biomeID;
|
public static final String[] FIELD_biomeID;
|
||||||
public static final String[] METHOD_getBiomeArray;
|
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> STATE0 = null;
|
||||||
private static State<AbstractInsnNode> STATE1 = null;
|
private static State<AbstractInsnNode> STATE1 = null;
|
||||||
private static State<AbstractInsnNode> STATE2 = null;
|
private static State<AbstractInsnNode> STATE2 = null;
|
||||||
@@ -224,13 +174,33 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
private static State<AbstractInsnNode> STATE16 = null;
|
private static State<AbstractInsnNode> STATE16 = null;
|
||||||
private static State<AbstractInsnNode> STATE17 = null;
|
private static State<AbstractInsnNode> STATE17 = null;
|
||||||
private static State<AbstractInsnNode> STATE_FINAL = null;
|
private static State<AbstractInsnNode> STATE_FINAL = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (EndlessIDsCore.deobfuscated) {
|
||||||
|
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"};
|
||||||
|
} else {
|
||||||
|
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"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
STATE_FINAL = (insn, memory) -> STATE_FINAL;
|
STATE_FINAL = (insn, memory) -> STATE_FINAL;
|
||||||
|
|
||||||
STATE0 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE0 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
|
memory.reset();
|
||||||
if (insn.getOpcode() == Opcodes.ALOAD) {
|
if (insn.getOpcode() == Opcodes.ALOAD) {
|
||||||
memory.chunkIndex = insn.var;
|
memory.chunkIndex = insn.var;
|
||||||
memory.startingInsn = memory.currentInsn;
|
memory.startingInsn = insn;
|
||||||
return STATE1;
|
return STATE1;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -241,7 +211,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
anyMatch(insn.owner, CLASS_Chunk) &&
|
anyMatch(insn.owner, CLASS_Chunk) &&
|
||||||
anyMatch(insn.name, METHOD_getBiomeArray) &&
|
anyMatch(insn.name, METHOD_getBiomeArray) &&
|
||||||
insn.desc.equals("()[B")) {
|
insn.desc.equals("()[B")) {
|
||||||
memory.getBiomeArrayInsn = memory.currentInsn;
|
memory.getBiomeArrayInsn = insn;
|
||||||
return STATE2;
|
return STATE2;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -250,6 +220,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
STATE2 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE2 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.ASTORE) {
|
if (insn.getOpcode() == Opcodes.ASTORE) {
|
||||||
memory.biomeArrayIndex = insn.var;
|
memory.biomeArrayIndex = insn.var;
|
||||||
|
memory.startPatchingFrames();
|
||||||
return STATE3;
|
return STATE3;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -272,7 +243,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
STATE6 = typeCheck(LabelNode.class, () -> STATE7);
|
STATE6 = typeCheck(LabelNode.class, () -> STATE7);
|
||||||
|
|
||||||
STATE7 = casting(FrameNode.class, (insn, memory) ->
|
STATE7 = casting(FrameNode.class, (insn, memory) ->
|
||||||
anyMatch((String)memory.locals.get(memory.chunkIndex), CLASS_Chunk) &&
|
anyMatch((String) memory.locals.get(memory.chunkIndex), CLASS_Chunk) &&
|
||||||
memory.locals.get(memory.biomeArrayIndex).equals("[B") &&
|
memory.locals.get(memory.biomeArrayIndex).equals("[B") &&
|
||||||
memory.locals.get(memory.iteratorIndex).equals(1)
|
memory.locals.get(memory.iteratorIndex).equals(1)
|
||||||
? STATE8 : STATE0);
|
? STATE8 : STATE0);
|
||||||
@@ -287,13 +258,9 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
&& insn.var == memory.biomeArrayIndex
|
&& insn.var == memory.biomeArrayIndex
|
||||||
? STATE10 : STATE0);
|
? STATE10 : STATE0);
|
||||||
|
|
||||||
STATE10 = casting(InsnNode.class, (insn) ->
|
STATE10 = casting(InsnNode.class, (insn) -> insn.getOpcode() == Opcodes.ARRAYLENGTH ? STATE11 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.ARRAYLENGTH
|
|
||||||
? STATE11 : STATE0);
|
|
||||||
|
|
||||||
STATE11 = casting(JumpInsnNode.class, (insn) ->
|
STATE11 = casting(JumpInsnNode.class, (insn) -> insn.getOpcode() == Opcodes.IF_ICMPGE ? STATE12 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.IF_ICMPGE
|
|
||||||
? STATE12 : STATE0);
|
|
||||||
|
|
||||||
STATE12 = typeCheck(LabelNode.class, () -> STATE13);
|
STATE12 = typeCheck(LabelNode.class, () -> STATE13);
|
||||||
|
|
||||||
@@ -303,8 +270,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
? STATE14 : STATE0);
|
? STATE14 : STATE0);
|
||||||
|
|
||||||
STATE14 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE14 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.ILOAD &&
|
if (insn.getOpcode() == Opcodes.ILOAD && insn.var == memory.iteratorIndex) {
|
||||||
insn.var == memory.iteratorIndex) {
|
|
||||||
if (insn.getNext() instanceof FieldInsnNode) {
|
if (insn.getNext() instanceof FieldInsnNode) {
|
||||||
return STATE14_C1;
|
return STATE14_C1;
|
||||||
} else {
|
} else {
|
||||||
@@ -316,7 +282,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
|
|
||||||
STATE14_ABD1 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE14_ABD1 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.ALOAD) {
|
if (insn.getOpcode() == Opcodes.ALOAD) {
|
||||||
if (anyMatch((String)memory.locals.get(insn.var), CLASS_BiomeGenBase, "[L", ";")) {
|
if (anyMatch((String) memory.locals.get(insn.var), CLASS_BiomeGenBase, "[L", ";")) {
|
||||||
return STATE14_ABD1_BA2;
|
return STATE14_ABD1_BA2;
|
||||||
} else {
|
} else {
|
||||||
return STATE14_ABD1_BD1;
|
return STATE14_ABD1_BD1;
|
||||||
@@ -337,17 +303,12 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
STATE14_ABD1_BA2 = casting(VarInsnNode.class, (insn, memory) ->
|
STATE14_ABD1_BA2 = casting(VarInsnNode.class, (insn, memory) ->
|
||||||
insn.getOpcode() == Opcodes.ILOAD &&
|
insn.getOpcode() == Opcodes.ILOAD && insn.var == memory.iteratorIndex ? STATE14_ABD1_BA3 : STATE0);
|
||||||
insn.var == memory.iteratorIndex
|
|
||||||
? STATE14_ABD1_BA3 : STATE0);
|
|
||||||
|
|
||||||
STATE14_ABD1_BA3 = casting(InsnNode.class, (insn) ->
|
STATE14_ABD1_BA3 = casting(InsnNode.class, (insn) -> insn.getOpcode() == Opcodes.AALOAD ? STATE15 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.AALOAD
|
|
||||||
? STATE15 : STATE0);
|
|
||||||
|
|
||||||
STATE14_C1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
STATE14_C1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.GETSTATIC &&
|
if (insn.getOpcode() == Opcodes.GETSTATIC && anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
||||||
anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
|
||||||
return STATE15;
|
return STATE15;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -362,7 +323,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
|
|
||||||
STATE16 = casting(InsnNode.class, (insn, memory) -> {
|
STATE16 = casting(InsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.I2B) {
|
if (insn.getOpcode() == Opcodes.I2B) {
|
||||||
memory.castInsn = memory.currentInsn;
|
memory.castInsn = insn;
|
||||||
return STATE17;
|
return STATE17;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -370,13 +331,60 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
|
|
||||||
STATE17 = casting(InsnNode.class, (insn, memory) -> {
|
STATE17 = casting(InsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.BASTORE) {
|
if (insn.getOpcode() == Opcodes.BASTORE) {
|
||||||
memory.arrayStoreInsn = memory.currentInsn;
|
memory.arrayStoreInsn = insn;
|
||||||
return STATE_FINAL;
|
return STATE_FINAL;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
private static <T extends AbstractInsnNode> State<AbstractInsnNode> typeCheck(Class<T> clazz, Supplier<State<AbstractInsnNode>> okState) {
|
private static <T extends AbstractInsnNode> State<AbstractInsnNode> typeCheck(Class<T> clazz, Supplier<State<AbstractInsnNode>> okState) {
|
||||||
return casting(clazz, (insn, memory) -> okState.get());
|
return casting(clazz, (insn, memory) -> okState.get());
|
||||||
}
|
}
|
||||||
@@ -397,50 +405,28 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private static Memory findTheTarget(MethodNode method, ClassNode cn) {
|
||||||
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;
|
val insnList = method.instructions;
|
||||||
var currentState = STATE0;
|
var currentState = STATE0;
|
||||||
val memory = new Memory();
|
val memory = new Memory();
|
||||||
for (int insnIndex = 0; insnIndex < insnList.size(); insnIndex++) {
|
memory.initLocals(method, cn);
|
||||||
memory.currentInsn = insnIndex;
|
val iter = insnList.iterator();
|
||||||
val insn = insnList.get(insnIndex);
|
while (iter.hasNext()) {
|
||||||
|
val insn = iter.next();
|
||||||
if (insn instanceof FrameNode) {
|
if (insn instanceof FrameNode) {
|
||||||
val frame = (FrameNode) insn;
|
val frame = (FrameNode) insn;
|
||||||
if (frame.type == Opcodes.F_NEW) {
|
memory.recordFrame(frame);
|
||||||
memory.locals.clear();
|
memory.updateLocalsState(frame);
|
||||||
memory.locals.addAll(frame.local);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val newState = currentState.apply(insn, memory);
|
val newState = currentState.apply(insn, memory);
|
||||||
if (newState != null) {
|
if (newState != null) {
|
||||||
if (newState == STATE_FINAL) {
|
if (newState == STATE_FINAL) {
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
val insn2 = iter.next();
|
||||||
|
if (insn2 instanceof FrameNode) {
|
||||||
|
memory.recordFrame((FrameNode) insn2);
|
||||||
|
}
|
||||||
|
}
|
||||||
return memory;
|
return memory;
|
||||||
}
|
}
|
||||||
currentState = newState;
|
currentState = newState;
|
||||||
@@ -449,20 +435,224 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String owner() {
|
||||||
|
return Tags.MODNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "ChunkProviderSuperPatcher";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
if ("net.minecraft.world.chunk.storage.AnvilChunkLoader".equals(className))
|
||||||
|
return false;
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
for (MethodNode method : cn.methods) {
|
||||||
|
if (scanForBrokenCall(method)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
boolean patched = false;
|
||||||
|
for (val method : cn.methods) {
|
||||||
|
val memory = findTheTarget(method, cn);
|
||||||
|
if (memory != null) {
|
||||||
|
patched = true;
|
||||||
|
EndlessIDsTransformer.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 = memory.getBiomeArrayInsn;
|
||||||
|
insnList.set(getBiomeArray,
|
||||||
|
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, getBiomeArray.owner, "getBiomeShortArray",
|
||||||
|
"()[S", false));
|
||||||
|
insnList.set(memory.castInsn, new InsnNode(Opcodes.I2S));
|
||||||
|
insnList.set(memory.arrayStoreInsn, new InsnNode(Opcodes.SASTORE));
|
||||||
|
patchStackFrames(memory, method, cn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!patched) {
|
||||||
|
EndlessIDsTransformer.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!");
|
||||||
|
}
|
||||||
|
return patched;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void patchStackFrames(Memory memory, MethodNode method, ClassNode owner) {
|
||||||
|
memory.locals.clear();
|
||||||
|
memory.initLocals(method, owner);
|
||||||
|
for (val frame: memory.framesLeaveUnpatched)
|
||||||
|
memory.updateLocalsState(frame);
|
||||||
|
|
||||||
|
int localToPatch = memory.biomeArrayIndex;
|
||||||
|
for (val frame: memory.framesToPatch) {
|
||||||
|
int currentLocalIndex = memory.locals.size() - 1;
|
||||||
|
if (frame.local != null) {
|
||||||
|
switch (frame.type) {
|
||||||
|
case Opcodes.F_NEW:
|
||||||
|
case Opcodes.F_FULL:
|
||||||
|
if (frame.local.size() > localToPatch &&
|
||||||
|
"[B".equals(frame.local.get(localToPatch))) {
|
||||||
|
frame.local.set(localToPatch, "[S");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Opcodes.F_APPEND:
|
||||||
|
if (currentLocalIndex < localToPatch &&
|
||||||
|
(currentLocalIndex + frame.local.size()) >= localToPatch) {
|
||||||
|
int indexInFrame = localToPatch - currentLocalIndex - 1;
|
||||||
|
if ("[B".equals(frame.local.get(indexInFrame))) {
|
||||||
|
frame.local.set(indexInFrame, "[S");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memory.updateLocalsState(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface State<T extends AbstractInsnNode> extends BiFunction<T, Memory, State<AbstractInsnNode>> {
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static class Memory {
|
private static class Memory {
|
||||||
|
|
||||||
int currentInsn;
|
final List<Object> locals = new ArrayList<>();
|
||||||
|
List<Object> localsAtPatchStart;
|
||||||
int startingInsn;
|
List<FrameNode> framesLeaveUnpatched = new ArrayList<>();
|
||||||
int getBiomeArrayInsn;
|
List<FrameNode> framesToPatch = new ArrayList<>();
|
||||||
int castInsn;
|
boolean patchingFrames;
|
||||||
int arrayStoreInsn;
|
VarInsnNode startingInsn;
|
||||||
|
MethodInsnNode getBiomeArrayInsn;
|
||||||
|
InsnNode castInsn;
|
||||||
|
InsnNode arrayStoreInsn;
|
||||||
int chunkIndex;
|
int chunkIndex;
|
||||||
int biomeArrayIndex;
|
int biomeArrayIndex;
|
||||||
int iteratorIndex;
|
int iteratorIndex;
|
||||||
|
|
||||||
final List<Object> locals = new ArrayList<>();
|
public void startPatchingFrames() {
|
||||||
|
localsAtPatchStart = new ArrayList<>(locals);
|
||||||
|
patchingFrames = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void recordFrame(FrameNode frame) {
|
||||||
|
if (patchingFrames)
|
||||||
|
framesToPatch.add(frame);
|
||||||
|
else
|
||||||
|
framesLeaveUnpatched.add(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
localsAtPatchStart = null;
|
||||||
|
framesLeaveUnpatched.addAll(framesToPatch);
|
||||||
|
framesToPatch.clear();
|
||||||
|
patchingFrames = false;
|
||||||
|
startingInsn = null;
|
||||||
|
getBiomeArrayInsn = null;
|
||||||
|
castInsn = null;
|
||||||
|
arrayStoreInsn = null;
|
||||||
|
chunkIndex = 0;
|
||||||
|
biomeArrayIndex = 0;
|
||||||
|
iteratorIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getDescriptorNameEnd(String desc, int index) {
|
||||||
|
val c = desc.charAt(index);
|
||||||
|
switch (c) {
|
||||||
|
case '[':
|
||||||
|
return getDescriptorNameEnd(desc, index + 1);
|
||||||
|
case 'L':
|
||||||
|
do {
|
||||||
|
index++;
|
||||||
|
} while (desc.charAt(index) != ';');
|
||||||
|
default:
|
||||||
|
return index + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Object> parseDesc(String desc) {
|
||||||
|
val result = new ArrayList<Object>();
|
||||||
|
desc = desc.substring(1, desc.indexOf(')'));
|
||||||
|
for (int i = 0; i < desc.length(); i++) {
|
||||||
|
val end = getDescriptorNameEnd(desc, i);
|
||||||
|
val name = desc.substring(i, end);
|
||||||
|
switch (name) {
|
||||||
|
case "I":
|
||||||
|
case "S":
|
||||||
|
case "B":
|
||||||
|
case "Z":
|
||||||
|
result.add(Opcodes.INTEGER);
|
||||||
|
break;
|
||||||
|
case "F":
|
||||||
|
result.add(Opcodes.FLOAT);
|
||||||
|
break;
|
||||||
|
case "D":
|
||||||
|
result.add(Opcodes.DOUBLE);
|
||||||
|
result.add(Opcodes.DOUBLE);
|
||||||
|
break;
|
||||||
|
case "J":
|
||||||
|
result.add(Opcodes.LONG);
|
||||||
|
result.add(Opcodes.LONG);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result.add(name);
|
||||||
|
}
|
||||||
|
i = end - 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initLocals(MethodNode method, ClassNode owner) {
|
||||||
|
locals.clear();
|
||||||
|
if ((method.access & Opcodes.ACC_STATIC) == 0) {
|
||||||
|
locals.add("L" + owner.name + ";");
|
||||||
|
}
|
||||||
|
locals.addAll(parseDesc(method.desc));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLocalsState(FrameNode frame) {
|
||||||
|
switch (frame.type) {
|
||||||
|
case Opcodes.F_NEW:
|
||||||
|
case Opcodes.F_FULL:
|
||||||
|
locals.clear();
|
||||||
|
case Opcodes.F_APPEND:
|
||||||
|
if (frame.local != null) {
|
||||||
|
for (val local : frame.local) {
|
||||||
|
if (Objects.equals(local, Opcodes.DOUBLE) || Objects.equals(local, Opcodes.LONG))
|
||||||
|
locals.add(local);
|
||||||
|
locals.add(local);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Opcodes.F_CHOP: {
|
||||||
|
int removeCount = frame.local.size();
|
||||||
|
for (int i = removeCount - 1; i >= 0 && !locals.isEmpty(); i--) {
|
||||||
|
val removed = locals.remove(locals.size() - 1);
|
||||||
|
if (Objects.equals(removed, Opcodes.DOUBLE) || Objects.equals(removed, Opcodes.LONG))
|
||||||
|
locals.remove(locals.size() - 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Opcodes.F_SAME:
|
||||||
|
case Opcodes.F_SAME1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.asm.transformer.chunk;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.lib.turboasm.ClassNodeHandle;
|
||||||
|
import com.falsepattern.lib.turboasm.TurboClassTransformer;
|
||||||
|
import lombok.val;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
|
||||||
|
public class LOTRFieldExposer implements TurboClassTransformer {
|
||||||
|
@Override
|
||||||
|
public String owner() {
|
||||||
|
return Tags.MODNAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return "LOTRFieldExposer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
return "lotr.common.network.LOTRPacketBiomeVariantsWatch".equals(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
|
||||||
|
val cn = classNode.getNode();
|
||||||
|
if (cn == null)
|
||||||
|
return false;
|
||||||
|
for (val field: cn.fields) {
|
||||||
|
if ("chunkX".equals(field.name) ||
|
||||||
|
"chunkZ".equals(field.name) ||
|
||||||
|
"variants".equals(field.name)) {
|
||||||
|
field.access &= ~Opcodes.ACC_PRIVATE;
|
||||||
|
field.access |= Opcodes.ACC_PUBLIC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.config;
|
package com.falsepattern.endlessids.config;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Tags;
|
import com.falsepattern.endlessids.Tags;
|
||||||
@@ -5,45 +28,48 @@ import com.falsepattern.endlessids.constants.ExtendedConstants;
|
|||||||
import com.falsepattern.lib.config.Config;
|
import com.falsepattern.lib.config.Config;
|
||||||
import com.falsepattern.lib.config.ConfigurationManager;
|
import com.falsepattern.lib.config.ConfigurationManager;
|
||||||
|
|
||||||
@Config(modid = Tags.MODID, category = "darkworld")
|
@Config(modid = Tags.MODID,
|
||||||
|
category = "darkworld")
|
||||||
public class DarkWorldIDConfig {
|
public class DarkWorldIDConfig {
|
||||||
static {
|
|
||||||
ConfigurationManager.selfInit();
|
|
||||||
}
|
|
||||||
@Config.Comment("Original: 100")
|
@Config.Comment("Original: 100")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1100)
|
@Config.DefaultInt(1100)
|
||||||
public static int darkOceanID;
|
public static int darkOceanID;
|
||||||
|
|
||||||
@Config.Comment("Original: 101")
|
@Config.Comment("Original: 101")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1101)
|
@Config.DefaultInt(1101)
|
||||||
public static int darkPlainsID;
|
public static int darkPlainsID;
|
||||||
|
|
||||||
@Config.Comment("Original: 102")
|
@Config.Comment("Original: 102")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1102)
|
@Config.DefaultInt(1102)
|
||||||
public static int darkDesertID;
|
public static int darkDesertID;
|
||||||
|
|
||||||
@Config.Comment("Original: 103")
|
@Config.Comment("Original: 103")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1103)
|
@Config.DefaultInt(1103)
|
||||||
public static int darkHillsID;
|
public static int darkHillsID;
|
||||||
|
|
||||||
@Config.Comment("Original: 104")
|
@Config.Comment("Original: 104")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1104)
|
@Config.DefaultInt(1104)
|
||||||
public static int darkForestID;
|
public static int darkForestID;
|
||||||
|
|
||||||
@Config.Comment("Original: 105")
|
@Config.Comment("Original: 105")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1105)
|
@Config.DefaultInt(1105)
|
||||||
public static int darkTaigaID;
|
public static int darkTaigaID;
|
||||||
|
|
||||||
@Config.Comment("Original: 106")
|
@Config.Comment("Original: 106")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1106)
|
@Config.DefaultInt(1106)
|
||||||
public static int darkSwampID;
|
public static int darkSwampID;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ConfigurationManager.selfInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.config;
|
package com.falsepattern.endlessids.config;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Tags;
|
import com.falsepattern.endlessids.Tags;
|
||||||
@@ -5,13 +28,16 @@ import com.falsepattern.endlessids.constants.ExtendedConstants;
|
|||||||
import com.falsepattern.lib.config.Config;
|
import com.falsepattern.lib.config.Config;
|
||||||
import com.falsepattern.lib.config.ConfigurationManager;
|
import com.falsepattern.lib.config.ConfigurationManager;
|
||||||
|
|
||||||
@Config(modid = Tags.MODID, category = "futurepack")
|
@Config(modid = Tags.MODID,
|
||||||
|
category = "futurepack")
|
||||||
public class FuturepackIDConfig {
|
public class FuturepackIDConfig {
|
||||||
|
@Config.Comment("Original: 97")
|
||||||
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
|
@Config.DefaultInt(2097)
|
||||||
|
public static int spaceID;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ConfigurationManager.selfInit();
|
ConfigurationManager.selfInit();
|
||||||
}
|
}
|
||||||
@Config.Comment("Original: 97")
|
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
|
||||||
@Config.DefaultInt(2097)
|
|
||||||
public static int spaceID;
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.config;
|
package com.falsepattern.endlessids.config;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Tags;
|
import com.falsepattern.endlessids.Tags;
|
||||||
@@ -6,28 +29,92 @@ import com.falsepattern.lib.config.ConfigurationManager;
|
|||||||
|
|
||||||
@Config(modid = Tags.MODID)
|
@Config(modid = Tags.MODID)
|
||||||
public class GeneralConfig {
|
public class GeneralConfig {
|
||||||
static {
|
@Config.Comment(
|
||||||
ConfigurationManager.selfInit();
|
"WARNING: THIS CONFIG IS EXTREMELY SENSITIVE TO CHANGES, DISABLING STUFF ONCE THEY HAVE BEEN ENABLED\n" +
|
||||||
}
|
"CAN CORRUPT YOUR WORLD! ONLY TOUCH THIS FILE IF YOU KNOW WHAT YOU'RE DOING!\n" +
|
||||||
|
"This file should only be edited by modpack developers to finetune it for the modpack. Once an option\n" +
|
||||||
|
"has been enabled, it modifies the chunk save data format, which is (partially) compatible with\n" +
|
||||||
|
"vanilla, but removing the mod might cause block/item corruption for higher IDs.\n" +
|
||||||
|
"Additional note: Every client and server must have the exact same config, this also affects netcode.")
|
||||||
|
@Config.DefaultString("")
|
||||||
|
public static String __NOTICE__;
|
||||||
|
@Config.Comment("Throw an exception when an invalid block is registered. FOR DEBUGGING PURPOSES")
|
||||||
@Config.DefaultBoolean(false)
|
@Config.DefaultBoolean(false)
|
||||||
public static boolean catchUnregisteredBlocks;
|
public static boolean catchUnregisteredBlocks;
|
||||||
|
@Config.Comment("Remove invalid (corrupted) blocks from the game. FOR DEBUGGING PURPOSES")
|
||||||
@Config.Comment("Remove invalid (corrupted) blocks from the game.")
|
|
||||||
@Config.DefaultBoolean(false)
|
@Config.DefaultBoolean(false)
|
||||||
public static boolean removeInvalidBlocks;
|
public static boolean removeInvalidBlocks;
|
||||||
|
@Config.Comment("Extend Biome IDs. Vanilla limit is 256, new limit is 65536.")
|
||||||
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
@Config.DefaultBoolean(true)
|
||||||
@Config.DefaultBoolean(false)
|
public static boolean extendBiome;
|
||||||
|
@Config.Comment("Extend Block and Item IDs. Vanilla limit is 4096/32000, new limit is 16777216 for both.\n" +
|
||||||
|
"See also: countCorrectionBits")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendBlockItem;
|
||||||
|
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 32, new limit is 65536.\n")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
public static boolean extendDataWatcher;
|
public static boolean extendDataWatcher;
|
||||||
|
@Config.Comment("Extend Enchantment IDs. Vanilla limit is 256, new limit is 32768.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendEnchantment;
|
||||||
|
@Config.Comment("Extend Potion IDs. Vanilla limit is 32, new limit is 65536.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendPotion;
|
||||||
|
@Config.Comment("Extend Entity IDs. Vanilla limit is 256, new limit is 32768.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendEntity;
|
||||||
|
|
||||||
|
@Config.Comment("Improves the speed of the block registry by multiple orders of magnitudes. (not thoroughly tested yet)\n" +
|
||||||
|
"It's highly recommended to leave this enabled, especially when using a lot of IDs.\n" +
|
||||||
|
"With this disabled, registering 1 million blocks on a test system took 80 minutes\n" +
|
||||||
|
"With this enabled, registering the same million blocks took 7 seconds")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean enableRegistryPerformanceTweak;
|
||||||
@Config.Comment(
|
@Config.Comment(
|
||||||
"Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
"Extends the maximum redstone signal strength.\n" + "Only has effect with extendBlockItem enabled.\n" +
|
||||||
"Notice: This does not affect ITEM IDs.\n" +
|
"WARNING: THIS IS HERE ONLY FOR FUN, IT WILL DEFINITELY CORRUPT YOUR WORLD!")
|
||||||
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
@Config.DefaultBoolean(false)
|
||||||
"this value.\n" +
|
public static boolean extendRedstone;
|
||||||
"(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.Comment("Increases the max signal strength of redstone.\n" +
|
||||||
|
"Only has effect with both extendBlockItem and extendRedstone enabled.\n" + "Vanilla value is 15.")
|
||||||
|
@Config.RangeInt(min = 15,
|
||||||
|
max = 127)
|
||||||
|
@Config.DefaultInt(15)
|
||||||
|
public static int maxRedstone;
|
||||||
|
@Config.Comment("Use this to tune the amount of available block IDs.\n" +
|
||||||
|
"Minecraft contains some internal code that uses a HUGE amount of RAM with too many block IDs available.\n" +
|
||||||
|
"Notice: This does not affect ITEM IDs.\n" +
|
||||||
|
"The vanilla default is 4k block IDs, while the maximum is 16 million.\n" +
|
||||||
|
"The default setting sets it to 4k (vanilla).\n" +
|
||||||
|
"increase if necessary (when running out of BLOCK IDs in your modpack)\n" +
|
||||||
|
"Only effective if extendBlockItem is enabled.\n" +
|
||||||
|
"Effective values: (0: 4k, 1: 8k, 2: 16k, 3: 32k, 4: 64k, 5: 128k, 6: 256k, 7: 512k, 8: 1M, 9: 2M, 10: 4M, 11: 8M, 12: 16M)\n" +
|
||||||
|
"The effective value of this variable must always be smaller or equal to the effective value of extraItemIDBits")
|
||||||
@Config.RangeInt(min = 0,
|
@Config.RangeInt(min = 0,
|
||||||
max = 12)
|
max = 12)
|
||||||
@Config.DefaultInt(0)
|
@Config.DefaultInt(0)
|
||||||
|
public static int extraBlockIDBits;
|
||||||
|
@Config.Comment("Use this to tune the amount of available item IDs.\n" +
|
||||||
|
"The vanilla default is 32k item IDs, while the maximum is 16 million.\n" +
|
||||||
|
"The default setting sets it to 32k (vanilla).\n" +
|
||||||
|
"increase if necessary (when running out of ITEM IDs in your modpack)\n" +
|
||||||
|
"Only effective if extendBlockItem is enabled.\n" +
|
||||||
|
"Effective values: (0: 32k, 1: 64k, 2: 128k, 3: 256k, 4: 512k, 5: 1M, 6: 2M, 7: 4M, 8: 8M, 9: 16M)\n" +
|
||||||
|
"The effective value of this variable must always be equal or larger than the effective value of extraBlockIDBits")
|
||||||
|
@Config.RangeInt(min = 0,
|
||||||
|
max = 9)
|
||||||
|
@Config.DefaultInt(0)
|
||||||
|
public static int extraItemIDBits;
|
||||||
|
|
||||||
|
|
||||||
|
@Config.Comment("DEPRECATED, will be removed in the next version of EndlessIDs!\n" +
|
||||||
|
"This property does nothing.\n" +
|
||||||
|
"Use extraBlockIDBits and extraItemIDBits instead.")
|
||||||
|
@Config.DefaultInt(0)
|
||||||
|
@Deprecated
|
||||||
public static int countCorrectionBits;
|
public static int countCorrectionBits;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ConfigurationManager.selfInit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.constants;
|
package com.falsepattern.endlessids.constants;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ExtendedConstants {
|
public class ExtendedConstants {
|
||||||
//Tunables
|
//Tunables
|
||||||
public static final int bitsPerID = 24;
|
public static final int bitsPerID = 24;
|
||||||
public static final int bitsPerMetadata = 4;
|
public static final int bitsPerMetadata = 16;
|
||||||
public static final int countCorrectionBits = GeneralConfig.countCorrectionBits;
|
public static final int countCorrectionItemBits = 9 - GeneralConfig.extraItemIDBits;
|
||||||
|
public static final int countCorrectionBlockBits = 12 - GeneralConfig.extraBlockIDBits;
|
||||||
|
|
||||||
public static final int watchableBits = 7;
|
public static final int watchableBits = 16;
|
||||||
public static final int bitsPerBiome = 16;
|
public static final int bitsPerBiome = 16;
|
||||||
|
|
||||||
|
public static final int maximumPotionIDs = 65536;
|
||||||
|
public static final int maximumEnchantmentIDs = 32768;
|
||||||
|
|
||||||
|
public static final int blocksPerSubChunk = 16 * 16 * 16;
|
||||||
|
public static final int subChunkNibbleArraySize = 16 * 16 * 16;
|
||||||
|
|
||||||
|
//Align with max item metadata for spawn eggs. Will be treated as short in netcode
|
||||||
|
public static final int bitsPerEntity = 15;
|
||||||
|
|
||||||
//BlockItemIDs
|
//BlockItemIDs
|
||||||
public static final int nibblesPerID = bitsPerID / 4;
|
public static final int nibblesPerID = bitsPerID / 4;
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
@@ -18,23 +52,32 @@ public class ExtendedConstants {
|
|||||||
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
||||||
|
|
||||||
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
||||||
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBlockBits);
|
||||||
public static final int maxBlockID = blockIDCount - 1;
|
public static final int maxBlockID = blockIDCount - 1;
|
||||||
|
|
||||||
|
public static final int itemIDCount = 1 << (bitsPerID - countCorrectionItemBits);
|
||||||
|
public static final int maxItemID = itemIDCount - 1;
|
||||||
|
|
||||||
|
public static final int metadataCount = (1 << bitsPerMetadata);
|
||||||
|
public static final int maxMetadata = metadataCount - 1;
|
||||||
|
|
||||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
|
||||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
public static final int bytesPerSubChunk = (nibblesPerSubChunk + 1) / 2;
|
||||||
|
|
||||||
//BiomeIDs
|
//BiomeIDs
|
||||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||||
public static final int biomeIDMask = biomeIDCount - 1;
|
public static final int biomeIDMask = biomeIDCount - 1;
|
||||||
public static final int biomeIDNull = biomeIDMask;
|
public static final int biomeIDNull = biomeIDMask;
|
||||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
||||||
//Chunk
|
|
||||||
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
|
||||||
//DataWatcher
|
//DataWatcher
|
||||||
public static final int watchableCount = 1 << watchableBits;
|
public static final int watchableCount = 1 << watchableBits;
|
||||||
public static final int maxWatchableID = watchableCount - 1;
|
public static final int maxWatchableID = watchableCount - 1;
|
||||||
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
|
||||||
|
//EntityIDs
|
||||||
|
public static final int entityIDCount = 1 << bitsPerEntity;
|
||||||
|
public static final int entityIDMask = entityIDCount - 1;
|
||||||
|
public static final int maxEntityID = entityIDMask;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.constants;
|
package com.falsepattern.endlessids.constants;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class VanillaConstants {
|
public class VanillaConstants {
|
||||||
//Tunables
|
//Tunables
|
||||||
public static final int bitsPerID = 12;
|
public static final int bitsPerID = 12;
|
||||||
@@ -9,6 +33,8 @@ public class VanillaConstants {
|
|||||||
public static final int watchableBits = 5;
|
public static final int watchableBits = 5;
|
||||||
public static final int bitsPerBiome = 8;
|
public static final int bitsPerBiome = 8;
|
||||||
|
|
||||||
|
public static final int bitsPerEntity = 8;
|
||||||
|
|
||||||
//BlockItemIDs
|
//BlockItemIDs
|
||||||
public static final int nibblesPerID = bitsPerID / 4;
|
public static final int nibblesPerID = bitsPerID / 4;
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
@@ -19,20 +45,29 @@ public class VanillaConstants {
|
|||||||
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
||||||
public static final int maxBlockID = blockIDCount - 1;
|
public static final int maxBlockID = blockIDCount - 1;
|
||||||
|
|
||||||
|
public static final int itemIDCount = 32000;
|
||||||
|
public static final int maxItemID = itemIDCount - 1;
|
||||||
|
|
||||||
|
public static final int metadataCount = (1 << bitsPerMetadata);
|
||||||
|
public static final int maxMetadata = metadataCount - 1;
|
||||||
|
|
||||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
|
||||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
public static final int bytesPerSubChunk = (nibblesPerSubChunk + 1) / 2;
|
||||||
|
|
||||||
//BiomeIDs
|
//BiomeIDs
|
||||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||||
public static final int biomeIDMask = biomeIDCount - 1;
|
public static final int biomeIDMask = biomeIDCount - 1;
|
||||||
public static final int biomeIDNull = biomeIDMask;
|
public static final int biomeIDNull = biomeIDMask;
|
||||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
||||||
//Chunk
|
|
||||||
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
|
||||||
//DataWatcher
|
//DataWatcher
|
||||||
public static final int watchableCount = 1 << watchableBits;
|
public static final int watchableCount = 1 << watchableBits;
|
||||||
public static final int maxWatchableID = watchableCount - 1;
|
public static final int maxWatchableID = watchableCount - 1;
|
||||||
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
||||||
|
|
||||||
|
//EntityIDs
|
||||||
|
public static final int entityIDCount = 1 << bitsPerEntity;
|
||||||
|
public static final int maxEntityID = entityIDCount - 1;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class BiomeContainer extends _Dummy {
|
||||||
|
public BiomeContainer() {
|
||||||
|
super("biome", "Biome");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class BlockItemContainer extends _Dummy {
|
||||||
|
public BlockItemContainer() {
|
||||||
|
super("blockitem", "BlockItem");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class DataWatcherContainer extends _Dummy {
|
||||||
|
public DataWatcherContainer() {
|
||||||
|
super("datawatcher", "DataWatcher");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class EnchantmentContainer extends _Dummy {
|
||||||
|
public EnchantmentContainer() {
|
||||||
|
super("enchantment", "Enchantment");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class PotionContainer extends _Dummy {
|
||||||
|
public PotionContainer() {
|
||||||
|
super("potion", "Potion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.DummyModContainer;
|
||||||
|
import cpw.mods.fml.common.LoadController;
|
||||||
|
import cpw.mods.fml.common.ModMetadata;
|
||||||
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
|
|
||||||
|
public class _Dummy extends DummyModContainer {
|
||||||
|
public _Dummy(String id, String name) {
|
||||||
|
super(createMetadata(id, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ModMetadata createMetadata(String id, String name) {
|
||||||
|
val meta = new ModMetadata();
|
||||||
|
meta.modId = Tags.MODID + "_" + id;
|
||||||
|
meta.name = Tags.MODNAME + " " + name + " Module";
|
||||||
|
meta.version = Tags.VERSION;
|
||||||
|
meta.dependencies.add(new DefaultArtifactVersion(Tags.MODID, Tags.VERSION));
|
||||||
|
meta.parent = Tags.MODID;
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean registerBus(EventBus bus, LoadController controller) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ArrayUtil;
|
||||||
|
import com.falsepattern.chunk.api.DataManager;
|
||||||
|
import com.falsepattern.endlessids.Hooks;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
|
public class BiomeManager implements DataManager.PacketDataManager, DataManager.ChunkDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "biome";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 2 * 16 * 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
data.asShortBuffer().put(((ChunkBiomeHook)chunk).getBiomeShortArray());
|
||||||
|
data.position(data.position() + maxPacketSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
var arr = ((ChunkBiomeHook)chunk).getBiomeShortArray();
|
||||||
|
if (arr == null) {
|
||||||
|
arr = new short[16 * 16];
|
||||||
|
((ChunkBiomeHook)chunk).setBiomeShortArray(arr);
|
||||||
|
}
|
||||||
|
buffer.asShortBuffer().get(arr);
|
||||||
|
buffer.position(buffer.position() + maxPacketSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean chunkPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeChunkToNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||||
|
byte[] arr = Hooks.shortToByteArray(((ChunkBiomeHook)chunk).getBiomeShortArray());
|
||||||
|
nbt.setByteArray("Biomes16v2", arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readChunkFromNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||||
|
var data = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||||
|
if (data == null) {
|
||||||
|
data = new short[16 * 16];
|
||||||
|
((ChunkBiomeHook)chunk).setBiomeShortArray(data);
|
||||||
|
}
|
||||||
|
if (nbt.hasKey("Biomes16v2", 7)) {
|
||||||
|
Hooks.byteToShortArray(nbt.getByteArray("Biomes16v2"), 0, data, 0, data.length * 2);
|
||||||
|
} else if (nbt.hasKey("Biomes16", 7)) { //NotEnoughBiomes DFU
|
||||||
|
Hooks.byteToShortArrayLegacy(nbt.getByteArray("Biomes16"), data);
|
||||||
|
} else if (nbt.hasKey("Biomes", 7)) { //Vanilla DFU
|
||||||
|
Hooks.scatter(nbt.getByteArray("Biomes"), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cloneChunk(Chunk fromVanilla, Chunk toVanilla) {
|
||||||
|
val from = (ChunkBiomeHook) fromVanilla;
|
||||||
|
val to = (ChunkBiomeHook) toVanilla;
|
||||||
|
|
||||||
|
to.setBiomeShortArray(ArrayUtil.copyArray(from.getBiomeShortArray(), to.getBiomeShortArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String version() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String newInstallDescription() {
|
||||||
|
return "EndlessIDs extended biome data. Vanilla biome data is limited to 256 biomes. This allows for 65536 biomes.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String uninstallMessage() {
|
||||||
|
return "EndlessIDs extended biome data has been uninstalled. Biomes are limited to 256,\n" +
|
||||||
|
"and any biomes with IDs above 255 in the save will be corrupted.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String versionChangeMessage(String priorVersion) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ArrayUtil;
|
||||||
|
import com.falsepattern.chunk.api.DataManager;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||||
|
import com.falsepattern.endlessids.util.DataUtil;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
||||||
|
import static com.falsepattern.endlessids.util.DataUtil.*;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
|
public class BlockIDManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "blockid";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 3 * 16 * 16 * 16 * 16 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
val subChunkList = chunk.getBlockStorageArray();
|
||||||
|
int storageFlags = 0;
|
||||||
|
val start = data.position() + 4;
|
||||||
|
data.position(start);
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||||
|
|
||||||
|
storageFlags |= subChunk.getBlockMask() << (i * 2);
|
||||||
|
|
||||||
|
val b1 = subChunk.getB1();
|
||||||
|
data.put(b1);
|
||||||
|
|
||||||
|
val b2Low = subChunk.getB2Low();
|
||||||
|
if (b2Low == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(b2Low.data);
|
||||||
|
|
||||||
|
val b2High = subChunk.getB2High();
|
||||||
|
if (b2High == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(b2High.data);
|
||||||
|
|
||||||
|
val b3 = subChunk.getB3();
|
||||||
|
if (b3 != null) {
|
||||||
|
data.put(b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.putInt(start - 4, storageFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
val subChunkList = chunk.getBlockStorageArray();
|
||||||
|
val storageFlags = buffer.getInt();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||||
|
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||||
|
val b1 = subChunk.getB1();
|
||||||
|
buffer.get(b1);
|
||||||
|
if (storageFlag == 0b00) {
|
||||||
|
subChunk.setB2Low(null);
|
||||||
|
subChunk.setB2High(null);
|
||||||
|
subChunk.setB3(null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b2Low = subChunk.getB2Low();
|
||||||
|
if (b2Low == null) {
|
||||||
|
b2Low = subChunk.createB2Low();
|
||||||
|
}
|
||||||
|
buffer.get(b2Low.data);
|
||||||
|
if (storageFlag == 0b01) {
|
||||||
|
subChunk.setB2High(null);
|
||||||
|
subChunk.setB3(null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b2High = subChunk.getB2High();
|
||||||
|
if (b2High == null) {
|
||||||
|
b2High = subChunk.createB2High();
|
||||||
|
}
|
||||||
|
buffer.get(b2High.data);
|
||||||
|
if (storageFlag == 0b10) {
|
||||||
|
subChunk.setB3(null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b3 = subChunk.getB3();
|
||||||
|
if (b3 == null) {
|
||||||
|
b3 = subChunk.createB3();
|
||||||
|
}
|
||||||
|
buffer.get(b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean subChunkPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||||
|
val b1 = subChunk.getB1();
|
||||||
|
val b2Low = subChunk.getB2Low();
|
||||||
|
val b2High = subChunk.getB2High();
|
||||||
|
val b3 = subChunk.getB3();
|
||||||
|
nbt.setByteArray("Blocks", b1);
|
||||||
|
if (b2Low != null) {
|
||||||
|
nbt.setByteArray("Add", b2Low.data);
|
||||||
|
}
|
||||||
|
if (b2High != null) {
|
||||||
|
nbt.setByteArray("BlocksB2Hi", b2High.data);
|
||||||
|
}
|
||||||
|
if (b3 != null) {
|
||||||
|
nbt.setByteArray("BlocksB3", b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//NotEnoughIDs world compatibility
|
||||||
|
public static void readSubChunkFromNBTNotEnoughIDsDFU(SubChunkBlockHook subChunk, NBTTagCompound nbt) {
|
||||||
|
val data = nbt.getByteArray("Blocks16");
|
||||||
|
val dataShort = new short[data.length >>> 1];
|
||||||
|
ByteBuffer.wrap(data).asShortBuffer().get(dataShort);
|
||||||
|
val b1 = new byte[blocksPerSubChunk];
|
||||||
|
val b2L = new byte[blocksPerSubChunk >>> 1];
|
||||||
|
val b2H = new byte[blocksPerSubChunk >>> 1];
|
||||||
|
for (int i = 0; i < dataShort.length; i++) {
|
||||||
|
val s = dataShort[i];
|
||||||
|
val nI = i >>> 1;
|
||||||
|
val mI = (i & 1) * 4;
|
||||||
|
b1[i] = (byte) (s & 0x00FF);
|
||||||
|
b2L[nI] |= (byte) (((s & 0x0F00) >>> 8) << mI);
|
||||||
|
b2H[nI] |= (byte) (((s & 0xF000) >>> 12) << mI);
|
||||||
|
}
|
||||||
|
subChunk.setB1(b1);
|
||||||
|
subChunk.setB2Low(new NibbleArray(b2L, 4));
|
||||||
|
subChunk.setB2High(new NibbleArray(b2H, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||||
|
if (nbt.hasKey("Blocks16")) {
|
||||||
|
readSubChunkFromNBTNotEnoughIDsDFU(subChunk, nbt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert nbt.hasKey("Blocks");
|
||||||
|
val b1 = nbt.getByteArray("Blocks");
|
||||||
|
final byte[] b2Low = nbt.hasKey("Add") ? nbt.getByteArray("Add") : null;
|
||||||
|
final byte[] b2High = nbt.hasKey("BlocksB2Hi") ? nbt.getByteArray("BlocksB2Hi") : null;
|
||||||
|
final byte[] b3 = nbt.hasKey("BlocksB3") ? nbt.getByteArray("BlocksB3") : null;
|
||||||
|
|
||||||
|
subChunk.setB1(ensureSubChunkByteArray(b1));
|
||||||
|
subChunk.setB2Low(ensureSubChunkNibbleArray(b2Low));
|
||||||
|
subChunk.setB2High(ensureSubChunkNibbleArray(b2High));
|
||||||
|
subChunk.setB3(ensureSubChunkByteArray(b3));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage fromVanilla, ExtendedBlockStorage toVanilla) {
|
||||||
|
val from = (SubChunkBlockHook) fromVanilla;
|
||||||
|
val to = (SubChunkBlockHook) toVanilla;
|
||||||
|
|
||||||
|
to.setB1(ArrayUtil.copyArray(from.getB1(), to.getB1()));
|
||||||
|
to.setB2Low(ArrayUtil.copyArray(from.getB2Low(), to.getB2Low()));
|
||||||
|
to.setB2High(ArrayUtil.copyArray(from.getB2High(), to.getB2High()));
|
||||||
|
to.setB3(ArrayUtil.copyArray(from.getB3(), to.getB3()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String version() {
|
||||||
|
return Tags.VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String newInstallDescription() {
|
||||||
|
return "EndlessIDs extended block IDs. Vanilla worlds can be converted to EndlessIDs worlds safely.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String uninstallMessage() {
|
||||||
|
return "EndlessIDs extended block IDs removed. Any blocks with IDs above 4095 will get corrupted.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String versionChangeMessage(String priorVersion) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ArrayUtil;
|
||||||
|
import com.falsepattern.chunk.api.DataManager;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||||
|
import com.falsepattern.endlessids.util.DataUtil;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
|
public class BlockMetaManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "metadata";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 2 * 16 * 16 * 16 * 16 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
val subChunkList = chunk.getBlockStorageArray();
|
||||||
|
int storageFlags = 0;
|
||||||
|
val start = data.position() + 4;
|
||||||
|
data.position(start);
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||||
|
|
||||||
|
storageFlags |= subChunk.getMetadataMask() << (i * 2);
|
||||||
|
|
||||||
|
val m1Low = subChunk.getM1Low();
|
||||||
|
data.put(m1Low.data);
|
||||||
|
|
||||||
|
val m1High = subChunk.getM1High();
|
||||||
|
if (m1High == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(m1High.data);
|
||||||
|
|
||||||
|
val m2 = subChunk.getM2();
|
||||||
|
if (m2 != null) {
|
||||||
|
data.put(m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.putInt(start - 4, storageFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
val subChunkList = chunk.getBlockStorageArray();
|
||||||
|
val storageFlags = buffer.getInt();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||||
|
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||||
|
val m1Low = subChunk.getM1Low();
|
||||||
|
buffer.get(m1Low.data);
|
||||||
|
if (storageFlag == 0b01) {
|
||||||
|
subChunk.setM1High(null);
|
||||||
|
subChunk.setM2(null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var m1High = subChunk.getM1High();
|
||||||
|
if (m1High == null) {
|
||||||
|
m1High = subChunk.createM1High();
|
||||||
|
}
|
||||||
|
buffer.get(m1High.data);
|
||||||
|
if (storageFlag == 0b10) {
|
||||||
|
subChunk.setM2(null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var m2 = subChunk.getM2();
|
||||||
|
if (m2 == null) {
|
||||||
|
m2 = subChunk.createM2();
|
||||||
|
}
|
||||||
|
buffer.get(m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean subChunkPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||||
|
val m1Low = subChunk.getM1Low();
|
||||||
|
val m1High = subChunk.getM1High();
|
||||||
|
val m2 = subChunk.getM2();
|
||||||
|
nbt.setByteArray("Data", m1Low.data);
|
||||||
|
if (m1High != null) {
|
||||||
|
nbt.setByteArray("Data1High", m1High.data);
|
||||||
|
}
|
||||||
|
if (m2 != null) {
|
||||||
|
nbt.setByteArray("Data2", m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//NotEnoughIDs world compatibility
|
||||||
|
private void readSubChunkFromNBTNotEnoughIDsDFU(SubChunkBlockHook subChunk, NBTTagCompound nbt) {
|
||||||
|
val data = nbt.getByteArray("Data16");
|
||||||
|
val dataShort = new short[data.length >>> 1];
|
||||||
|
ByteBuffer.wrap(data).asShortBuffer().get(dataShort);
|
||||||
|
val m1Low = new byte[blocksPerSubChunk >>> 1];
|
||||||
|
val m1High = new byte[blocksPerSubChunk >>> 1];
|
||||||
|
val m2 = new byte[blocksPerSubChunk];
|
||||||
|
for (int i = 0; i < dataShort.length; i++) {
|
||||||
|
val s = dataShort[i];
|
||||||
|
val nI = i >>> 1;
|
||||||
|
val mI = (i & 1) * 4;
|
||||||
|
m1Low[nI] |= (byte) ((s & 0x000F) << mI);
|
||||||
|
m1High[nI] |= (byte) (((s & 0x00F0) >>> 4) << mI);
|
||||||
|
m2[i] = (byte) ((s & 0xFF00) >>> 8);
|
||||||
|
}
|
||||||
|
subChunk.setM1Low(new NibbleArray(m1Low, 4));
|
||||||
|
subChunk.setM1High(new NibbleArray(m1High, 4));
|
||||||
|
subChunk.setM2(m2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||||
|
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||||
|
if (nbt.hasKey("Data16")) {
|
||||||
|
readSubChunkFromNBTNotEnoughIDsDFU(subChunk, nbt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert nbt.hasKey("Data");
|
||||||
|
val m1Low = nbt.getByteArray("Data");
|
||||||
|
final byte[] m1High = nbt.hasKey("Data1High") ? nbt.getByteArray("Data1High") : null;
|
||||||
|
final byte[] m2 = nbt.hasKey("Data2") ? nbt.getByteArray("Data2") : null;
|
||||||
|
|
||||||
|
subChunk.setM1Low(DataUtil.ensureSubChunkNibbleArray(m1Low));
|
||||||
|
subChunk.setM1High(DataUtil.ensureSubChunkNibbleArray(m1High));
|
||||||
|
subChunk.setM2(DataUtil.ensureSubChunkByteArray(m2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage fromVanilla, ExtendedBlockStorage toVanilla) {
|
||||||
|
val from = (SubChunkBlockHook) fromVanilla;
|
||||||
|
val to = (SubChunkBlockHook) toVanilla;
|
||||||
|
|
||||||
|
to.setM1Low(ArrayUtil.copyArray(from.getM1Low(), to.getM1Low()));
|
||||||
|
to.setM1High(ArrayUtil.copyArray(from.getM1High(), to.getM1High()));
|
||||||
|
to.setM2(ArrayUtil.copyArray(from.getM2(), to.getM2()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String version() {
|
||||||
|
return Tags.VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String newInstallDescription() {
|
||||||
|
return "EndlessIDs extended block metadata. Vanilla worlds can be converted to EndlessIDs worlds safely.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String uninstallMessage() {
|
||||||
|
return "EndlessIDs extended block metadata removed. Any blocks with metadata above 15 will get corrupted.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String versionChangeMessage(String priorVersion) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
@@ -11,7 +34,7 @@ import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLA
|
|||||||
|
|
||||||
public class BiomePatchHelper {
|
public class BiomePatchHelper {
|
||||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||||
|
|
||||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||||
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
||||||
@@ -20,7 +43,7 @@ public class BiomePatchHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
||||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||||
|
|
||||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||||
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
|
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
public interface ChunkBiomeHook {
|
||||||
|
short[] getBiomeShortArray();
|
||||||
|
|
||||||
|
void setBiomeShortArray(short[] data);
|
||||||
|
}
|
||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.EndlessIDs;
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
@@ -8,6 +31,7 @@ import java.lang.reflect.Field;
|
|||||||
|
|
||||||
public class GalaxySpaceHelper {
|
public class GalaxySpaceHelper {
|
||||||
private static final Field GSSpaceField;
|
private static final Field GSSpaceField;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Class<?> clazz;
|
Class<?> clazz;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.mixin.helpers;
|
|
||||||
|
|
||||||
public interface IChunkMixin {
|
|
||||||
short[] getBiomeShortArray();
|
|
||||||
|
|
||||||
void setBiomeShortArray(short[] data);
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.mixin.helpers;
|
|
||||||
|
|
||||||
public interface IExtendedBlockStorageMixin {
|
|
||||||
void setBlockRefCount(int value);
|
|
||||||
|
|
||||||
void setTickRefCount(int value);
|
|
||||||
|
|
||||||
short[] getLSB();
|
|
||||||
|
|
||||||
byte[] getMSB();
|
|
||||||
}
|
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
public interface IS1DPacketEntityEffectMixin {
|
||||||
|
int getIDExtended();
|
||||||
|
}
|
||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
@@ -12,7 +35,7 @@ public final class ShortUtil {
|
|||||||
public static int[] unsignedShortToIntArray(short[] shorts) {
|
public static int[] unsignedShortToIntArray(short[] shorts) {
|
||||||
int[] ints = new int[shorts.length];
|
int[] ints = new int[shorts.length];
|
||||||
|
|
||||||
for(int i = 0; i < shorts.length; ++i) {
|
for (int i = 0; i < shorts.length; ++i) {
|
||||||
ints[i] = unsignedShortToInt(shorts[i]);
|
ints[i] = unsignedShortToInt(shorts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
|
||||||
|
public interface SubChunkBlockHook {
|
||||||
|
byte[] getB1();
|
||||||
|
|
||||||
|
void setB1(byte[] data);
|
||||||
|
|
||||||
|
NibbleArray getB2Low();
|
||||||
|
|
||||||
|
void setB2Low(NibbleArray data);
|
||||||
|
|
||||||
|
NibbleArray createB2Low();
|
||||||
|
|
||||||
|
NibbleArray getB2High();
|
||||||
|
|
||||||
|
void setB2High(NibbleArray data);
|
||||||
|
|
||||||
|
NibbleArray createB2High();
|
||||||
|
|
||||||
|
byte[] getB3();
|
||||||
|
|
||||||
|
void setB3(byte[] data);
|
||||||
|
|
||||||
|
byte[] createB3();
|
||||||
|
|
||||||
|
int getMetadataMask();
|
||||||
|
|
||||||
|
int getBlockMask();
|
||||||
|
|
||||||
|
int getID(int x, int y, int z);
|
||||||
|
|
||||||
|
NibbleArray getM1Low();
|
||||||
|
|
||||||
|
void setM1Low(NibbleArray m1Low);
|
||||||
|
|
||||||
|
NibbleArray getM1High();
|
||||||
|
|
||||||
|
void setM1High(NibbleArray m1High);
|
||||||
|
|
||||||
|
NibbleArray createM1High();
|
||||||
|
|
||||||
|
byte[] getM2();
|
||||||
|
|
||||||
|
void setM2(byte[] m2);
|
||||||
|
|
||||||
|
byte[] createM2();
|
||||||
|
}
|
||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.helpers.stubpackage.lotr.common.network;
|
package com.falsepattern.endlessids.mixin.helpers.stubpackage.lotr.common.network;
|
||||||
|
|
||||||
public class LOTRPacketBiomeVariantsWatch {
|
public class LOTRPacketBiomeVariantsWatch {
|
||||||
|
|||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.biome.biomewand;
|
||||||
|
|
||||||
|
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.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@Mixin(value = BiomeWandItem.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BiomeWandItemMixin {
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Biome ID extension
|
||||||
|
*/
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
-44
@@ -1,44 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.vanilla;
|
||||||
|
|
||||||
|
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.client.multiplayer.WorldClient;
|
||||||
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
|
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
|
@Shadow
|
||||||
|
private WorldClient clientWorldController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Ported code, TODO figure out a proper mixin for this (difficult)
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) {
|
||||||
|
int chunkX = packetIn.func_148920_c().chunkXPos * 16;
|
||||||
|
int chunkZ = packetIn.func_148920_c().chunkZPos * 16;
|
||||||
|
if (packetIn.func_148921_d() != null) {
|
||||||
|
DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(packetIn.func_148921_d()));
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||||
|
short pos = dataInput.readShort();
|
||||||
|
short idLSB = dataInput.readShort();
|
||||||
|
byte idMSB = dataInput.readByte();
|
||||||
|
int id = (idLSB & 0xFFFF) | ((idMSB & 0xFF) << 16);
|
||||||
|
int meta = dataInput.readShort() & 0xFFFF;
|
||||||
|
int x = pos >> 12 & 15;
|
||||||
|
int z = pos >> 8 & 15;
|
||||||
|
int y = pos & 255;
|
||||||
|
this.clientWorldController.func_147492_c(x + chunkX, y, z + chunkZ, Block.getBlockById(id), meta);
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.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.client.multiplayer.PlayerControllerMP;
|
||||||
|
|
||||||
|
@Mixin(PlayerControllerMP.class)
|
||||||
|
public abstract class PlayerControllerMPMixin {
|
||||||
|
@ModifyConstant(method = "onPlayerDestroyBlock",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.bitsPerID,
|
||||||
|
ordinal = 0),
|
||||||
|
require = 1)
|
||||||
|
private int extend1(int constant) {
|
||||||
|
return ExtendedConstants.bitsPerID;
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
-1
@@ -1,4 +1,27 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.vanilla;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.potion.vanilla;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IS1DPacketEntityEffectMixin;
|
||||||
|
import lombok.val;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.network.play.server.S1DPacketEntityEffect;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
|
private static int theID;
|
||||||
|
|
||||||
|
@Inject(method = "handleEntityEffect",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
require = 1)
|
||||||
|
private void grabID(S1DPacketEntityEffect packetIn, CallbackInfo ci) {
|
||||||
|
theID = ((IS1DPacketEntityEffectMixin) packetIn).getIDExtended();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "handleEntityEffect",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/EntityLivingBase;addPotionEffect(Lnet/minecraft/potion/PotionEffect;)V"),
|
||||||
|
require = 1)
|
||||||
|
private void addPotionEffect(EntityLivingBase entity, PotionEffect effect) {
|
||||||
|
val newPotion = new PotionEffect(theID, effect.getDuration(), effect.getAmplifier());
|
||||||
|
theID = 0;
|
||||||
|
newPotion.setPotionDurationMax(effect.getIsPotionDurationMax());
|
||||||
|
entity.addPotionEffect(newPotion);
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.redstone;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockRedstoneWire;
|
||||||
|
|
||||||
|
@Mixin(BlockRedstoneWire.class)
|
||||||
|
public abstract class BlockRedstoneWireMixin {
|
||||||
|
@ModifyConstant(method = "randomDisplayTick",
|
||||||
|
constant = @Constant(floatValue = 15.0F),
|
||||||
|
require = 1)
|
||||||
|
private float bigRedstone(float constant) {
|
||||||
|
return GeneralConfig.maxRedstone;
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.redstone;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
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.RenderBlocks;
|
||||||
|
|
||||||
|
@Mixin(RenderBlocks.class)
|
||||||
|
public abstract class RenderBlocksMixin {
|
||||||
|
@ModifyConstant(method = "renderBlockRedstoneWire",
|
||||||
|
constant = @Constant(floatValue = 15.0F),
|
||||||
|
require = 1)
|
||||||
|
private float bigRedstone(float constant) {
|
||||||
|
return GeneralConfig.maxRedstone;
|
||||||
|
}
|
||||||
|
}
|
||||||
-147
@@ -1,147 +0,0 @@
|
|||||||
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 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 cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "WhileLoopReplaceableByForEach", "unchecked"})
|
|
||||||
@Mixin(Chunk.class)
|
|
||||||
public abstract class ChunkMixin {
|
|
||||||
@Shadow
|
|
||||||
public Map chunkTileEntityMap;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public World worldObj;
|
|
||||||
@Shadow
|
|
||||||
public boolean isLightPopulated;
|
|
||||||
@Shadow
|
|
||||||
public boolean isTerrainPopulated;
|
|
||||||
@Shadow
|
|
||||||
private ExtendedBlockStorage[] storageArrays;
|
|
||||||
@Shadow
|
|
||||||
private byte[] blockBiomeArray;
|
|
||||||
|
|
||||||
@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_);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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();
|
|
||||||
var6.updateContainingBlockInfo();
|
|
||||||
var6.getBlockMetadata();
|
|
||||||
var6.getBlockType();
|
|
||||||
}
|
|
||||||
|
|
||||||
int var16 = 0;
|
|
||||||
boolean var7 = !this.worldObj.provider.hasNoSky;
|
|
||||||
|
|
||||||
int 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
Hooks.setBlockData((IExtendedBlockStorageMixin) this.storageArrays[var8], var1, var16);
|
|
||||||
var16 += 16 * 16 * 16 * ExtendedConstants.bytesPerID;
|
|
||||||
} else if (var4 && this.storageArrays[var8] != null) {
|
|
||||||
this.storageArrays[var8] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NibbleArray var9;
|
|
||||||
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);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var7) {
|
|
||||||
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);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var4) {
|
|
||||||
var16 += Hooks.readBiomeArrayFromPacket((Chunk) (Object) this, var1, var16);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if (this.storageArrays[var8] != null && (var2 & 1 << var8) != 0) {
|
|
||||||
this.storageArrays[var8].removeInvalidBlocks();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isLightPopulated = true;
|
|
||||||
this.isTerrainPopulated = true;
|
|
||||||
this.generateHeightMap();
|
|
||||||
ArrayList var10 = new ArrayList();
|
|
||||||
|
|
||||||
TileEntity var11;
|
|
||||||
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)) {
|
|
||||||
var10.add(var11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator var17 = var10.iterator();
|
|
||||||
|
|
||||||
while (var17.hasNext()) {
|
|
||||||
TileEntity var18 = (TileEntity) var17.next();
|
|
||||||
var18.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
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 net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
|
||||||
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Mixin(NetHandlerPlayClient.class)
|
|
||||||
public abstract class NetHandlerPlayClientMixin {
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
private WorldClient clientWorldController;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author FalsePattern
|
|
||||||
* @reason Direct port from dumped code
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) throws IOException {
|
|
||||||
int var2 = packetIn.func_148920_c().chunkXPos * 16;
|
|
||||||
int var3 = packetIn.func_148920_c().chunkZPos * 16;
|
|
||||||
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) {
|
|
||||||
short var6 = dataInput.readShort();
|
|
||||||
short idLSB = dataInput.readShort();
|
|
||||||
byte idMSB = dataInput.readByte();
|
|
||||||
int id = (idLSB & 0xFFFF) | ((idMSB & 0xFF) << 16);
|
|
||||||
int var9 = dataInput.readByte() & 15;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.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.client.multiplayer.PlayerControllerMP;
|
|
||||||
|
|
||||||
@Mixin(PlayerControllerMP.class)
|
|
||||||
public abstract class PlayerControllerMPMixin {
|
|
||||||
@ModifyConstant(method = "onPlayerDestroyBlock",
|
|
||||||
constant = @Constant(intValue = VanillaConstants.bitsPerID,
|
|
||||||
ordinal = 0),
|
|
||||||
require = 1)
|
|
||||||
private int extend1(int constant) {
|
|
||||||
return ExtendedConstants.bitsPerID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||||
|
|||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.core.AsmHooks;
|
import code.elix_x.coremods.antiidconflict.core.AsmHooks;
|
||||||
|
|||||||
+31
-4
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||||
@@ -55,10 +78,14 @@ public abstract class BiomesManagerMixin {
|
|||||||
return ExtendedConstants.biomeIDCount;
|
return ExtendedConstants.biomeIDCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
@ModifyConstant(method = "preinit",
|
||||||
constant = {@Constant(stringValue = "\\biomes"),
|
constant = @Constant(stringValue = "\\biomes"))
|
||||||
@Constant(stringValue = "\\main.cfg")})
|
private static String fixPaths1(String original) {
|
||||||
private static String fixPaths(String original) {
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
@ModifyConstant(method = "setUpBiomesFolder",
|
||||||
|
constant = @Constant(stringValue = "\\main.cfg"))
|
||||||
|
private static String fixPaths2(String original) {
|
||||||
return AIDCStringFixer.fixString(original);
|
return AIDCStringFixer.fixString(original);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.managers.DimensionsManager;
|
import code.elix_x.coremods.antiidconflict.managers.DimensionsManager;
|
||||||
|
|||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.managers.EnchantementsManager;
|
import code.elix_x.coremods.antiidconflict.managers.EnchantementsManager;
|
||||||
|
|||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.managers.EntitiesManager;
|
import code.elix_x.coremods.antiidconflict.managers.EntitiesManager;
|
||||||
|
|||||||
+23
@@ -1,3 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
import code.elix_x.coremods.antiidconflict.managers.PotionsManager;
|
import code.elix_x.coremods.antiidconflict.managers.PotionsManager;
|
||||||
|
|||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.arocketry;
|
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import zmaster587.advancedRocketry.api.AdvancedRocketryBiomes;
|
|
||||||
import zmaster587.advancedRocketry.world.ChunkProviderSpace;
|
|
||||||
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
|
|
||||||
@Mixin(value = ChunkProviderSpace.class,
|
|
||||||
remap = false)
|
|
||||||
public abstract class ChunkProviderSpaceMixin {
|
|
||||||
|
|
||||||
@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) -> AdvancedRocketryBiomes.spaceBiome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
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
@@ -1,19 +0,0 @@
|
|||||||
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
@@ -1,19 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+43
-20
@@ -1,4 +1,27 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.abyssalcraft;
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.abyssalcraft;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
@@ -44,25 +67,6 @@ public abstract class AbyssalCraftMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public static int configBiomeId13;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyConstant(method = "syncConfig",
|
@ModifyConstant(method = "syncConfig",
|
||||||
constant = {@Constant(intValue = 100, ordinal = 0),
|
constant = {@Constant(intValue = 100, ordinal = 0),
|
||||||
@Constant(intValue = 101, ordinal = 0),
|
@Constant(intValue = 101, ordinal = 0),
|
||||||
@@ -81,4 +85,23 @@ public abstract class AbyssalCraftMixin {
|
|||||||
private static int shiftBiomeIDsUp(int constant) {
|
private static int shiftBiomeIDsUp(int constant) {
|
||||||
return constant + 8000;
|
return constant + 8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+28
-5
@@ -1,8 +1,31 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||||
import hunternif.mc.atlas.core.BiomeDetectorBase;
|
import hunternif.mc.atlas.core.BiomeDetectorBase;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -16,6 +39,8 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
@Mixin(value = BiomeDetectorBase.class,
|
@Mixin(value = BiomeDetectorBase.class,
|
||||||
remap = false)
|
remap = false)
|
||||||
public abstract class BiomeDetectorBaseMixin {
|
public abstract class BiomeDetectorBaseMixin {
|
||||||
|
private Chunk chunk;
|
||||||
|
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
require = 2)
|
require = 2)
|
||||||
@@ -23,8 +48,6 @@ public abstract class BiomeDetectorBaseMixin {
|
|||||||
return ExtendedConstants.biomeIDCount;
|
return ExtendedConstants.biomeIDCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Chunk chunk;
|
|
||||||
|
|
||||||
@Redirect(method = "getBiomeID",
|
@Redirect(method = "getBiomeID",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
@@ -41,7 +64,7 @@ public abstract class BiomeDetectorBaseMixin {
|
|||||||
require = 1)
|
require = 1)
|
||||||
private int[] biomeIDs(byte[] i) {
|
private int[] biomeIDs(byte[] i) {
|
||||||
try {
|
try {
|
||||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
return ShortUtil.unsignedShortToIntArray(((ChunkBiomeHook) chunk).getBiomeShortArray());
|
||||||
} finally {
|
} finally {
|
||||||
chunk = null;
|
chunk = null;
|
||||||
}
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
|
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(((ChunkBiomeHook) chunk).getBiomeShortArray());
|
||||||
|
} finally {
|
||||||
|
chunk = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
-3
@@ -1,4 +1,27 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.arocketry;
|
/*
|
||||||
|
* EndlessIDs
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022-2024 FalsePattern
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* The above copyright notice, this permission notice and the words "MEGA"
|
||||||
|
* shall be included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.arocketry;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
@@ -20,14 +43,14 @@ public abstract class AdvancedRocketryMixin {
|
|||||||
@Constant(intValue = 118, ordinal = 0),
|
@Constant(intValue = 118, ordinal = 0),
|
||||||
@Constant(intValue = 119, ordinal = 0)},
|
@Constant(intValue = 119, ordinal = 0)},
|
||||||
require = 10)
|
require = 10)
|
||||||
private static int shiftBiomeIDsUp(int constant) {
|
private int shiftBiomeIDsUp(int constant) {
|
||||||
return constant + 9000;
|
return constant + 9000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "preInit",
|
@ModifyConstant(method = "preInit",
|
||||||
constant = @Constant(intValue = -2),
|
constant = @Constant(intValue = -2),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static int changeDefaultDimID(int constant) {
|
private int changeDefaultDimID(int constant) {
|
||||||
return -5613;
|
return -5613;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 282 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user