diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..9f8dcb9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,79 @@ +name: Bug Report +description: Something doesn't seem correct and it might be a bug +labels: [] +body: + - type: textarea + id: description + attributes: + label: Bug description + description: | + A clear and concise description of what the bug is. + Is it a game crash, an unexpected behavior, or has something gone wrong? + If applicable, add screenshots to help explain the bug. + placeholder: Tell us what you see! + validations: + required: true + - type: textarea + id: to-reproduce + attributes: + label: Steps to reproduce + description: Steps to reproduce the bug + placeholder: | + 1. Create a world + 2. Wait until midnight + 3. Hug a creeper + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: What did you expect to happen? + placeholder: The creeper explodes + - type: textarea + id: actual-behavior + attributes: + label: Actual behavior + description: What actually happened? + placeholder: The creeper launches itself into the sky + - type: textarea + id: logs + attributes: + label: Relevant logs + description: |- + If it's a crash, send the corresponding Minecraft log in the `logs` folder, or crash report in the `crash-reports` folder, here. + Please upload the log file as an attachment, or upload the log to [pastebin](https://pastebin.com/) / [mclo.gs](https://mclo.gs/) and paste the url here. + Please refrain from pasting the entire log file directly. + Leave empty if there is none. + placeholder: https://pastebin.com/J6b7lKxR + - type: input + id: minecraft-version + attributes: + label: Minecraft version + description: The Minecraft version(s) where this bug occurs in. + placeholder: 1.15.2 + validations: + required: true + - type: input + id: mod-version + attributes: + label: TemplateMod version + description: The TemplateMod version(s) where this bug occurs in. + placeholder: 1.2.3 + validations: + required: true + - type: textarea + id: other-information + attributes: + label: Other information + description: Other useful information to this bug report, e.g. other related mod version(s). Leave empty if there is none. + placeholder: The issue only occurs if the player is in survival mode + - type: checkboxes + id: check-list + attributes: + label: Check list + options: + - label: I have verified that the issue persists in the latest version of the mod. + required: true + - label: I have searched the existing issues and confirmed that this is not a duplicate. + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..75d7db3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,25 @@ +name: Feature Request +description: Suggest an idea for this project +labels: [] +body: + - type: textarea + id: motivation + attributes: + label: Motivation + description: Why do you want this feature? What problem do you want to solve? How can the suggested feature help with that? + placeholder: Tell us what you want! + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: Describe the feature you want, as detailed as possible + placeholder: I want to see a fancy starry sky when I look up at midnight. + validations: + required: true + - type: textarea + id: other-information + attributes: + label: Other information + description: Other useful information to this feature request. Leave empty if there is none. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..88ee224 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,108 @@ +name: step.build + +on: + workflow_call: + inputs: + release: + type: boolean + required: false + default: false + target_subproject: + description: see release.yml, leave it empty to build all + type: string + required: false + default: '' +# # [FEATURE] MIXIN_AUDITOR +# mixin_audit: +# description: run mixin audit for Minecraft server after build +# type: boolean +# required: false +# default: false + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + + - name: Cache gradle files + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + ./.gradle/loom-cache + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle.properties', '**/*.accesswidener', 'settings.json') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build with gradle + run: | + chmod +x gradlew + if [ -z "${{ inputs.target_subproject }}" ]; then + echo "Building all subprojects" + ./gradlew build + else + args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:build/' | paste -sd ' ') + echo "Building with arguments=$args" + ./gradlew $args + fi + env: + BUILD_ID: ${{ github.run_number }} + BUILD_RELEASE: ${{ inputs.release }} + +# # [FEATURE] MIXIN_AUDITOR +# - name: Run mixin audit check for Minecraft server +# if: ${{ inputs.mixin_audit }} +# timeout-minutes: 10 +# run: | +# mkdir -p ./run +# echo eula=true > ./run/eula.txt +# ./gradlew runServerMixinAudit + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: versions/*/build/libs/ + +# # [FEATURE] FALLENS_MAVEN +# - name: Publish with gradle +# if: inputs.release || github.ref == 'refs/heads/dev' +# run: | +# if [ -z "${{ inputs.target_subproject }}" ]; then +# echo "Publishing all subprojects" +# ./gradlew publish +# else +# args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:publish/' | paste -sd ' ') +# echo "Publishing with arguments=$args" +# ./gradlew $args +# fi +# env: +# BUILD_RELEASE: ${{ inputs.release }} +# FALLENS_MAVEN_TOKEN: ${{ secrets.FALLENS_MAVEN_TOKEN }} + + summary: + runs-on: ubuntu-22.04 + needs: + - build + + steps: + - uses: actions/checkout@v3 + + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts + path: build-artifacts + + - name: Make build summary + run: python3 .github/workflows/scripts/summary.py # ubuntu-22.04 uses Python 3.10.6 + env: + TARGET_SUBPROJECT: ${{ inputs.target_subproject }} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..c8314b7 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,20 @@ +name: Dev Builds + +on: + push: + paths: + - "*.gradle" + - "gradle.properties" + - "src/**" + - "versions/**" + - ".github/**" + pull_request: + + +jobs: + build: + uses: ./.github/workflows/build.yml + secrets: inherit +# # [FEATURE] MIXIN_AUDITOR +# with: +# mixin_audit: true diff --git a/.github/workflows/matrix_prep.yml b/.github/workflows/matrix_prep.yml new file mode 100644 index 0000000..44ebaa4 --- /dev/null +++ b/.github/workflows/matrix_prep.yml @@ -0,0 +1,29 @@ +name: step.matrix_prepare + +on: + workflow_call: + inputs: + target_subproject: + description: see release.yml, for generating matrix entries + type: string + required: false + default: '' + outputs: + matrix: + description: The generated run matrix + value: ${{ jobs.matrix_prep.outputs.matrix }} + + +jobs: + matrix_prep: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - id: setmatrix + run: python3 .github/workflows/scripts/matrix.py # ubuntu-22.04 uses Python 3.10.6 + env: + TARGET_SUBPROJECT: ${{ inputs.target_subproject }} + + outputs: + matrix: ${{ steps.setmatrix.outputs.matrix }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eb4db86 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,188 @@ +name: Release + +on: + release: + types: + - published + workflow_dispatch: + inputs: + target_subproject: + description: |- + The subproject name(s) of the specified Minecraft version to be released, seperated with ",". + By default all subprojects will be released + type: string + required: false + default: '' + target_release_tag: + description: The tag of the release you want to append the artifact to + type: string + required: true + + +jobs: + show_action_parameters: + runs-on: ubuntu-latest + steps: + - name: Show action parameters + run: | + cat < $GITHUB_STEP_SUMMARY + ## Action Parameters + - target_subproject: \`${{ github.event.inputs.target_subproject }}\` + - target_release_tag: \`${{ github.event.inputs.target_release_tag }}\` + EOF + + matrix_prep: + uses: ./.github/workflows/matrix_prep.yml + with: + target_subproject: ${{ github.event.inputs.target_subproject }} + + build: + uses: ./.github/workflows/build.yml + secrets: inherit + with: + target_subproject: ${{ github.event.inputs.target_subproject }} + release: true + + release: + needs: + - matrix_prep + - build + runs-on: ubuntu-latest + + # allow the mod publish step to add asserts to release + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token + permissions: + contents: write + + strategy: + matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }} + + steps: + - uses: actions/checkout@v3 + + - name: Display context + run: | + echo ref_name = ${{ github.ref_name }} + echo target_subproject = ${{ github.event.inputs.target_subproject }} + echo target_release_tag = ${{ github.event.inputs.target_release_tag }} + + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts + path: build-artifacts + + - name: Get github release information + if: ${{ github.event_name == 'workflow_dispatch' }} + id: get_release + uses: cardinalby/git-get-release-action@1.2.4 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag: ${{ github.event.inputs.target_release_tag }} + + - name: Generate publish related information + id: release_info + run: | + if [ $GITHUB_EVENT_NAME == 'release' ] + then + # Leave an empty value here, so Kir-Antipov/mc-publish will infer the tag from the action context + echo "tag_name=" >> $GITHUB_OUTPUT + elif [ $GITHUB_EVENT_NAME == 'workflow_dispatch' ] + then + echo "tag_name=${{ github.event.inputs.target_release_tag }}" >> $GITHUB_OUTPUT + else + echo Unknown github event name $GITHUB_EVENT_NAME + exit 1 + fi + + - name: Read common properties + id: properties_g + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_name mod_version' + + - name: Read version-specific properties + id: properties_v + uses: christian-draeger/read-properties@1.1.1 + with: + path: ${{ format('versions/{0}/gradle.properties', matrix.subproject) }} + properties: 'minecraft_version game_versions' + + - name: Fix game version + id: game_versions + run: | + # Fixed \n in game_versions isn't parsed by christian-draeger/read-properties as a line separator + echo 'value<> $GITHUB_OUTPUT + echo -e "${{ steps.properties_v.outputs.game_versions }}" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Prepare file information + id: file_info + run: | + shopt -s extglob + FILE_PATHS=$(ls ${{ format('build-artifacts/{0}/build/libs/!(*-@(dev|sources|shadow)).jar', matrix.subproject) }}) + if (( ${#FILE_PATHS[@]} != 1 )); then + echo "Error: Found ${#FILE_PATHS[@]} files, expected exactly 1" + exit 1 + else + FILE_PATH=${FILE_PATHS[0]} + fi + + FILE_NAME=$(basename $FILE_PATH) + FILE_HASH=$(sha256sum $FILE_PATH | awk '{ print $1 }') + echo "path=$FILE_PATH" >> $GITHUB_OUTPUT + echo "name=$FILE_NAME" >> $GITHUB_OUTPUT + echo "hash=$FILE_HASH" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + + - name: Prepare changelog + uses: actions/github-script@v6 + id: changelog + with: + script: return process.env.CHANGELOG + result-encoding: string + env: + CHANGELOG: |- + ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }} + + ------- + + Build Information + + - File name: `${{ steps.file_info.outputs.name }}` + - SHA-256: `${{ steps.file_info.outputs.hash }}` + - Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + - name: Publish Minecraft Mods + uses: Kir-Antipov/mc-publish@v3.3 + with: + # https://modrinth.com/settings/pats +# modrinth-id: fo0Bar +# modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }} + + # https://legacy.curseforge.com/account/api-tokens +# curseforge-id: 314159 +# curseforge-token: ${{ secrets.CF_API_TOKEN }} + + github-tag: ${{ steps.release_info.outputs.tag_name }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + files: ${{ steps.file_info.outputs.path }} + + name: ${{ format('{0} v{1} for mc{2}', steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }} + version: ${{ format('mc{0}-v{1}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }} + version-type: release + + loaders: fabric + game-versions: ${{ steps.game_versions.outputs.value }} + game-version-filter: any + dependencies: '' # declare the dependencies explicitly, so mc-publish won't try to load from fabric.mod.json + + github-changelog: ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }} + modrinth-changelog: ${{ steps.changelog.outputs.result }} + curseforge-changelog: ${{ steps.changelog.outputs.result }} + + retry-attempts: 3 + retry-delay: 10000 diff --git a/.github/workflows/scripts/matrix.py b/.github/workflows/scripts/matrix.py new file mode 100644 index 0000000..a20e581 --- /dev/null +++ b/.github/workflows/scripts/matrix.py @@ -0,0 +1,46 @@ +""" +A script to scan through the versions directory and collect all folder names as the subproject list, +then output a json as the github action include matrix +""" +__author__ = 'Fallen_Breath' + +import json +import os +import sys + + +def main(): + target_subproject_env = os.environ.get('TARGET_SUBPROJECT', '') + target_subprojects = list(filter(None, target_subproject_env.split(',') if target_subproject_env != '' else [])) + print('target_subprojects: {}'.format(target_subprojects)) + + with open('settings.json') as f: + settings: dict = json.load(f) + + if len(target_subprojects) == 0: + subprojects = settings['versions'] + else: + subprojects = [] + for subproject in settings['versions']: + if subproject in target_subprojects: + subprojects.append(subproject) + target_subprojects.remove(subproject) + if len(target_subprojects) > 0: + print('Unexpected subprojects: {}'.format(target_subprojects), file=sys.stderr) + sys.exit(1) + + matrix_entries = [] + for subproject in subprojects: + matrix_entries.append({ + 'subproject': subproject, + }) + matrix = {'include': matrix_entries} + with open(os.environ['GITHUB_OUTPUT'], 'w') as f: + f.write('matrix={}\n'.format(json.dumps(matrix))) + + print('matrix:') + print(json.dumps(matrix, indent=2)) + + +if __name__ == '__main__': + main() diff --git a/.github/workflows/scripts/summary.py b/.github/workflows/scripts/summary.py new file mode 100644 index 0000000..6f2bebe --- /dev/null +++ b/.github/workflows/scripts/summary.py @@ -0,0 +1,73 @@ +""" +A script to scan through all valid mod jars in build-artifacts.zip/$version/build/libs, +and generate an artifact summary table for that to GitHub action step summary +""" +__author__ = 'Fallen_Breath' + +import functools +import glob +import hashlib +import json +import os + + +def read_prop(file_name: str, key: str) -> str: + with open(file_name) as prop: + return next(filter( + lambda l: l.split('=', 1)[0].strip() == key, + prop.readlines() + )).split('=', 1)[1].lstrip() + + +def get_sha256_hash(file_path: str) -> str: + sha256_hash = hashlib.sha256() + + with open(file_path, 'rb') as f: + for buf in iter(functools.partial(f.read, 4096), b''): + sha256_hash.update(buf) + + return sha256_hash.hexdigest() + + +def main(): + target_subproject_env = os.environ.get('TARGET_SUBPROJECT', '') + target_subprojects = list(filter(None, target_subproject_env.split(',') if target_subproject_env != '' else [])) + print('target_subprojects: {}'.format(target_subprojects)) + + with open('settings.json') as f: + settings: dict = json.load(f) + + with open(os.environ['GITHUB_STEP_SUMMARY'], 'w') as f: + f.write('## Build Artifacts Summary\n\n') + f.write('| Subproject | for Minecraft | File | Size | SHA-256 |\n') + f.write('| --- | --- | --- | --- | --- |\n') + + warnings = [] + for subproject in settings['versions']: + if len(target_subprojects) > 0 and subproject not in target_subprojects: + print('skipping {}'.format(subproject)) + continue + game_versions = read_prop('versions/{}/gradle.properties'.format(subproject), 'game_versions') + game_versions = game_versions.strip().replace('\\n', ', ') + file_paths = glob.glob('build-artifacts/{}/build/libs/*.jar'.format(subproject)) + file_paths = list(filter(lambda fp: not fp.endswith('-sources.jar') and not fp.endswith('-dev.jar') and not fp.endswith('-shadow.jar'), file_paths)) + if len(file_paths) == 0: + file_name = '*not found*' + sha256 = '*N/A*' + else: + file_name = '`{}`'.format(os.path.basename(file_paths[0])) + file_size = '{} B'.format(os.path.getsize(file_paths[0])) + sha256 = '`{}`'.format(get_sha256_hash(file_paths[0])) + if len(file_paths) > 1: + warnings.append('Found too many build files in subproject {}: {}'.format(subproject, ', '.join(file_paths))) + + f.write('| {} | {} | {} | {} | {} |\n'.format(subproject, game_versions, file_name, file_size, sha256)) + + if len(warnings) > 0: + f.write('\n### Warnings\n\n') + for warning in warnings: + f.write('- {}\n'.format(warning)) + + +if __name__ == '__main__': + main() diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09cd281 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ diff --git a/HEADER.txt b/HEADER.txt new file mode 100644 index 0000000..8099a84 --- /dev/null +++ b/HEADER.txt @@ -0,0 +1,17 @@ +This file is part of the ${name} project, licensed under the +GNU Lesser General Public License v3.0 + +Copyright (C) ${year} ${author} and contributors + +${name} 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. + +${name} 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with ${name}. If not, see . diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0a04128 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7581596 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Joacarpet + +[![License](https://img.shields.io/github/license/Fallen-Breath/fabric-mod-template.svg)](http://www.gnu.org/licenses/lgpl-3.0.html) + +A small [carpet](https://github.com/gnembon/fabric-carpet) extension mod. + +## Carpet Mod Settings +### insaneBehaviors +Makes the random velocities of droppers and projectiles (as well as both the position and velocity of blocks broken by pistons) systematically iterate through the most extreme values possible, and then repeatedly iterate through all the halfway points in between, in a sense attempting every point in a 3d/5d "grid" that slowly increases in resolution. + +For droppers and projectiles, this setting determines whether the max value corresponds to the old gaussian randomness limits (\"extreme\"), or the limits of the triangular randomness introduced in 1.19 (\"sensible\"). Both settings function the same for blocks being broken by pistons. + +For the `/insanebehaviors ` command, see `/carpet commandInsaneBehaviors`. + +Do note that insaneBehaviors works on a global iterator: any triggering event will step through an iteration from all other insaneBehaviors events, too. + +* Type: `String` +* Categories: `CREATIVE`, `JOA` +* Options: `extreme`, `sensible`, `off` +* Default value: `off` + +### commandInsaneBehaviors +The command used for the `insaneBehaviors` rule. +\"reset\" sets the `resolution` and `counter` back to the default values. \"getstate\" and \"setstate\" are used to manually read and write the current iteration state. + +* Type: `String` +* Categories: `COMMAND`, `CREATIVE`, `JOA` +* Options `true`, `ops`, `false`, `0`, `1`, `2`, `3`, `4` +* Default value: `ops` + +### blockTickling +Lets you send manual block and/or shape updates to blocks using a feather item. Shape updates are sent from the block in front of the face you're clicking on. Useful if you're working with update interactions off or with budded blocks. + +* Type: `String` +* Categories: `CREATIVE`, `JOA` +* Options `off`, `blockupdates`, `shapeupdates`, `both` +* Default value: `off` \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..ef6e57a --- /dev/null +++ b/build.gradle @@ -0,0 +1,54 @@ +plugins { + id 'maven-publish' + id 'com.github.hierynomus.license' version '0.16.1' apply false + id 'fabric-loom' version '1.4-SNAPSHOT' apply false + + // https://github.com/ReplayMod/preprocessor + // https://github.com/Fallen-Breath/preprocessor + id 'com.replaymod.preprocess' version 'ce1aeb2b' + + // https://github.com/Fallen-Breath/yamlang + id 'me.fallenbreath.yamlang' version '1.3.1' apply false +} + +preprocess { + def mc114 = createNode('1.14.4' , 1_14_04, 'yarn') + def mc115 = createNode('1.15.2' , 1_15_02, 'yarn') + def mc116 = createNode('1.16.5' , 1_16_05, 'yarn') + def mc117 = createNode('1.17.1' , 1_17_01, 'yarn') + def mc118 = createNode('1.18.2' , 1_18_02, 'yarn') + def mc119 = createNode('1.19.4' , 1_19_04, 'yarn') + def mc120 = createNode('1.20.2' , 1_20_02, 'yarn') + + mc115.link(mc114, null) + mc115.link(mc116, null) + mc116.link(mc117, null) + mc117.link(mc118, null) + mc118.link(mc119, null) + mc119.link(mc120, null) +} + +tasks.register('buildAndGather') { + subprojects { + dependsOn project.tasks.named('build').get() + } + doFirst { + println 'Gathering builds' + def buildLibs = { + p -> p.buildDir.toPath().resolve('libs') + } + delete fileTree(buildLibs(rootProject)) { + include '*' + } + subprojects { + copy { + from(buildLibs(project)) { + include '*.jar' + exclude '*-dev.jar', '*-sources.jar', '*-shadow.jar' + } + into buildLibs(rootProject) + duplicatesStrategy DuplicatesStrategy.INCLUDE + } + } + } +} diff --git a/common.gradle b/common.gradle new file mode 100644 index 0000000..f0c42db --- /dev/null +++ b/common.gradle @@ -0,0 +1,217 @@ +apply plugin: 'maven-publish' +apply plugin: 'com.github.hierynomus.license' +apply plugin: 'fabric-loom' +apply plugin: 'com.replaymod.preprocess' +apply plugin: 'me.fallenbreath.yamlang' + +int mcVersion = project.mcVersion + +preprocess { + tabIndentation = true +} + +repositories { + maven { + url 'https://jitpack.io' + } + maven { + url 'https://maven.fallenbreath.me/releases' + } + maven { + url 'https://masa.dy.fi/maven' + } +} + +// https://github.com/FabricMC/fabric-loader/issues/783 +configurations { + modRuntimeOnly.exclude group: 'net.fabricmc', module: 'fabric-loader' +} + +dependencies { + // loom + minecraft "com.mojang:minecraft:${project.minecraft_version}" +// mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + mappings loom.officialMojangMappings() + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + modImplementation "carpet:fabric-carpet:${project.carpet_minecraft_version}-${project.carpet_core_version}" + + // runtime mods +// if (mcVersion < 11904) { +// modRuntimeOnly(mcVersion < 11900 ? "com.github.astei:lazydfu:0.1.2" : "com.github.Fallen-Breath:lazydfu:a7cfc44c0c") +// } +// // [FEATURE] MIXIN_AUDITOR +// modRuntimeOnly 'me.fallenbreath:mixin-auditor:0.1.0' + + // dependencies +// include(modImplementation(fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version))) +// include(modImplementation("me.fallenbreath:conditional-mixin:${project.conditionalmixin_version}")) +// include(annotationProcessor(implementation("io.github.llamalad7:mixinextras-fabric:${project.mixinextras_version}"))) +} + +String MIXIN_CONFIG_PATH = 'joacarpet.mixins.json' +String LANG_DIR = 'assets/joacarpet/lang' +JavaVersion JAVA_COMPATIBILITY +if (mcVersion >= 11800) { + JAVA_COMPATIBILITY = JavaVersion.VERSION_17 +} else if (mcVersion >= 11700) { + JAVA_COMPATIBILITY = JavaVersion.VERSION_16 +} else { + JAVA_COMPATIBILITY = JavaVersion.VERSION_1_8 +} + +loom { + runConfigs.configureEach { + // to make sure it generates all "Minecraft Client (:subproject_name)" applications + ideConfigGenerated = true + runDir '../../run' + vmArgs '-Dmixin.debug.export=true' + } +// // [FEATURE] MIXIN_AUDITOR +// runs { +// serverMixinAudit { +// server() +// vmArgs '-DmixinAuditor.audit=true' +// ideConfigGenerated false +// } +// } +} + +remapJar { + remapperIsolation = true +} + +String versionSuffix = '' +// detect github action environment variables +// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables +if (System.getenv("BUILD_RELEASE") != "true") { + String buildNumber = System.getenv("BUILD_ID") + versionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT' +} +String fullModVersion = project.mod_version + versionSuffix + +group = project.maven_group +if (System.getenv("JITPACK") == "true") { + // move mc version into archivesBaseName, so jitpack will be able to organize archives from multiple subprojects correctly + base.archivesName = project.archives_base_name + '-mc' + project.minecraft_version + version = 'v' + fullModVersion +} else { + base.archivesName = project.archives_base_name + version = 'mc' + project.minecraft_version + '-v' + fullModVersion +} + +// See https://youtrack.jetbrains.com/issue/IDEA-296490 +// if IDEA complains about "Cannot resolve resource filtering of MatchingCopyAction" and you want to know why +processResources { + inputs.property "id", project.mod_id + inputs.property "name", project.mod_name + inputs.property "version", fullModVersion + inputs.property "minecraft_dependency", project.minecraft_dependency + + filesMatching("fabric.mod.json") { + def valueMap = [ + "id": project.mod_id, + "name": project.mod_name, + "version": fullModVersion, + "minecraft_dependency": project.minecraft_dependency, + ] + expand valueMap + } + + filesMatching(MIXIN_CONFIG_PATH) { + filter { s -> s.replace('{{COMPATIBILITY_LEVEL}}', "JAVA_${JAVA_COMPATIBILITY.ordinal() + 1}") } + } +} + +// https://github.com/Fallen-Breath/yamlang +yamlang { + targetSourceSets = [sourceSets.main] + inputDir = LANG_DIR +} + +// ensure that the encoding is set to UTF-8, no matter what the system default is +// this fixes some edge cases with special characters not displaying correctly +// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html +tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" + options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked" +} + +java { + sourceCompatibility = JAVA_COMPATIBILITY + targetCompatibility = JAVA_COMPATIBILITY + + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() +} + +jar { + from(rootProject.file('LICENSE')) { + rename { "${it}_${project.archives_base_name}" } + } +} + +// https://github.com/hierynomus/license-gradle-plugin +license { + // use "gradle licenseFormat" to apply license headers + header = rootProject.file('HEADER.txt') + include '**/*.java' + skipExistingHeaders = true + + headerDefinitions { + // ref: https://github.com/mathieucarbou/license-maven-plugin/blob/4c42374bb737378f5022a3a36849d5e23ac326ea/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderType.java#L48 + // modification: add a newline at the end + SLASHSTAR_STYLE_NEWLINE { + firstLine = "/*" + beforeEachLine = " * " + endLine = " */" + System.lineSeparator() + afterEachLine = "" + skipLinePattern = null + firstLineDetectionPattern = "(\\s|\\t)*/\\*.*\$" + lastLineDetectionPattern = ".*\\*/(\\s|\\t)*\$" + allowBlankLines = false + isMultiline = true + padLines = false + } + } + mapping { + java = 'SLASHSTAR_STYLE_NEWLINE' + } + ext { + name = project.mod_name + author = 'Joa' + year = Calendar.getInstance().get(Calendar.YEAR).toString() + } +} +classes.dependsOn licenseFormatMain +testClasses.dependsOn licenseFormatTest + +// configure the maven publication +publishing { + publications { + mavenJava(MavenPublication) { + artifactId base.archivesName.get() + + from components.java + } + } + + // select the repositories you want to publish to + repositories { + // mavenLocal() + +// // [FEATURE] FALLENS_MAVEN +// maven { +// url = version.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases" +// credentials(PasswordCredentials) { +// username = 'fallen' +// password = System.getenv("FALLENS_MAVEN_TOKEN") +// } +// authentication { +// basic(BasicAuthentication) +// } +// } + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..8809119 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +# Gradle Properties + org.gradle.jvmargs=-Xmx6G + +# Fabric Basic Properties + # https://fabricmc.net/versions.html + loader_version=0.15.2 + +# Mod Properties + mod_id=joacarpet + mod_name=JoaCarpet + mod_version=2.0.0 + maven_group=me.fallenbreath + archives_base_name=joacarpet + +# Global Dependencies + # https://github.com/Fallen-Breath/conditional-mixin +# conditionalmixin_version=0.4.1 + + # https://github.com/LlamaLad7/MixinExtras +# mixinextras_version=0.3.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..c1962a7 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..c30b486 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..aeb74cb --- /dev/null +++ b/gradlew @@ -0,0 +1,245 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# 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/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..95f1a13 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: +- sdk install java 17.0.8.1-tem +- sdk use java 17.0.8.1-tem diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..dcf86ee --- /dev/null +++ b/settings.gradle @@ -0,0 +1,35 @@ +import groovy.json.JsonSlurper + +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + maven { + name = 'Jitpack' + url = 'https://jitpack.io' + } + mavenCentral() + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + switch (requested.id.id) { + case "com.replaymod.preprocess": { + useModule("com.github.Fallen-Breath:preprocessor:${requested.version}") + break + } + } + } + } +} + +def settings = new JsonSlurper().parseText(file('settings.json').text) +for (String version : settings.versions) { + include(":$version") + + def proj = project(":$version") + proj.projectDir = file("versions/$version") + proj.buildFileName = "../../common.gradle" +} diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..f0e128c --- /dev/null +++ b/settings.json @@ -0,0 +1,11 @@ +{ + "versions": [ + "1.14.4", + "1.15.2", + "1.16.5", + "1.17.1", + "1.18.2", + "1.19.4", + "1.20.2" + ] +} \ No newline at end of file diff --git a/src/main/java/com/joacarpet/HelloWorldTemplate.java b/src/main/java/com/joacarpet/HelloWorldTemplate.java new file mode 100644 index 0000000..150cf3a --- /dev/null +++ b/src/main/java/com/joacarpet/HelloWorldTemplate.java @@ -0,0 +1,55 @@ +/* + * This file is part of the TemplateMod project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * TemplateMod 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. + * + * TemplateMod 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TemplateMod. If not, see . + */ + +package com.joacarpet; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.metadata.ModMetadata; + +//#if MC >= 11800 +//$$ import com.mojang.logging.LogUtils; +//$$ import org.slf4j.Logger; +//#else +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +//#endif + +public class HelloWorldTemplate implements ModInitializer +{ + public static final Logger LOGGER = + //#if MC >= 11800 + //$$ LogUtils.getLogger(); + //#else + LogManager.getLogger(); + //#endif + + public static final String MOD_ID = "com/joacarpet"; + public static String MOD_VERSION = "2.0.0"; + public static String MOD_NAME = "JoaCarpet"; + + @Override + public void onInitialize() + { + ModMetadata metadata = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow(RuntimeException::new).getMetadata(); + MOD_NAME = metadata.getName(); + MOD_VERSION = metadata.getVersion().getFriendlyString(); + } +} diff --git a/src/main/java/com/joacarpet/InsaneBehaviors.java b/src/main/java/com/joacarpet/InsaneBehaviors.java new file mode 100644 index 0000000..53c8797 --- /dev/null +++ b/src/main/java/com/joacarpet/InsaneBehaviors.java @@ -0,0 +1,72 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet; + +import carpet.utils.Messenger; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.world.phys.Vec3; + +import java.util.ArrayList; + +public class InsaneBehaviors { + private static int counter = 0; + private static int resolution = 2; + + public static ArrayList nextEvenlyDistributedPoint(int dimensions) { + int remainder = counter; + ArrayList list = new ArrayList<>(); + for (int i = 0; i < dimensions; i++) { + list.add((float) (remainder % resolution) / (resolution-1)); + remainder = remainder / resolution; + } + counter++; + if(counter >= Math.pow(resolution, dimensions)) { + resolution = (resolution-1) *2 +1; + counter = 0; + } + return list; + } + + public static Vec3 mapUnitVelocityToVec3(ArrayList velocity, int factor, double xCenter, double xVariance, double yCenter, double yVariance, double zCenter, double zVariance) { + return new Vec3( + xCenter + (velocity.get(0) -0.5) * 2 * xVariance * factor, + yCenter + (velocity.get(2) -0.5) * 2 * yVariance * factor, + zCenter + (velocity.get(1) -0.5) * 2 * zVariance * factor + ); + } + + public static int resetCounterAndResolution(CommandSourceStack c) { + counter = 0; + resolution = 2; + JoaCarpetMod.messagePlayerIfExists(c, "w Reset."); + return 1; + } + public static int getState(CommandSourceStack c) { + JoaCarpetMod.messagePlayerIfExists(c, "w Current state: Resolution=" + resolution + ", Counter=" + counter); + return 1; + } + public static int setState(CommandSourceStack c, int _resolution, int _counter) { + resolution = _resolution; + counter = _counter; + JoaCarpetMod.messagePlayerIfExists(c, "w Updated resolution and counter: Resolution=" + resolution + ", Counter=" + counter); + return 1; + } +} diff --git a/src/main/java/com/joacarpet/JoaCarpetMod.java b/src/main/java/com/joacarpet/JoaCarpetMod.java new file mode 100644 index 0000000..f69a29e --- /dev/null +++ b/src/main/java/com/joacarpet/JoaCarpetMod.java @@ -0,0 +1,101 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet; + +import carpet.CarpetExtension; +import carpet.CarpetServer; +import carpet.utils.Messenger; +import carpet.utils.Translations; +import com.joacarpet.commands.InsaneBehaviorsCommand; +import com.mojang.brigadier.CommandDispatcher; +import net.fabricmc.api.ModInitializer; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import java.util.Map; + + + +//#if MC >= 11900 +//$$ import net.minecraft.commands.CommandBuildContext; +//#endif +//#if MC >= 11800 +//$$ import org.slf4j.Logger; +//$$ import org.slf4j.LoggerFactory; +//#else +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +//#endif + + +public class JoaCarpetMod implements ModInitializer, CarpetExtension { + public static final Logger LOGGER = + //#if MC >= 11800 +//$$ LoggerFactory.getLogger("joacarpet"); + //#else + LogManager.getLogger("joacarpet"); + //#endif + + + @Override + public void onInitialize() {} + + static { + CarpetServer.manageExtension(new JoaCarpetMod()); + } + + @Override + public void registerCommands(CommandDispatcher dispatcher + //#if MC >= 11900 +//$$ , final CommandBuildContext commandBuildContext + //#endif + ) { + InsaneBehaviorsCommand.register(dispatcher); + } + + @Override + public void onGameStarted() { + CarpetServer.settingsManager.parseSettingsClass(JoaCarpetSettings.class); + } + + @Override + public String version() { + return "joacarpet"; + } + + @Override + public Map canHasTranslations(String lang) { + return Translations.getTranslationFromResourcePath(String.format("assets/joacarpet/lang/%s.json", lang)); + } + + public static void messagePlayerIfExists(CommandSourceStack c, String message) { + + //#if MC >= 11900 +//$$ if(c.getPlayer() != null) { +//$$ Messenger.m(c.getPlayer(), message); +//$$ } + //#else + if(c.getEntity() instanceof ServerPlayer) { + Messenger.m((Player) c.getEntity(), message); + } + //#endif + } +} diff --git a/src/main/java/com/joacarpet/JoaCarpetSettings.java b/src/main/java/com/joacarpet/JoaCarpetSettings.java new file mode 100644 index 0000000..57364e2 --- /dev/null +++ b/src/main/java/com/joacarpet/JoaCarpetSettings.java @@ -0,0 +1,73 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet; + +//#if MC >= 11900 +//$$ import carpet.api.settings.Rule; +//#else +import carpet.settings.Rule; +//#endif + +//#if MC >= 11900 +//$$ import static carpet.api.settings.RuleCategory.COMMAND; +//$$ import static carpet.api.settings.RuleCategory.CREATIVE; +//#else +import static carpet.settings.RuleCategory.COMMAND; +import static carpet.settings.RuleCategory.CREATIVE; +//#endif + + +public class JoaCarpetSettings { + public static final String JOA = "JoaCarpet"; + + @Rule( + //#if MC >= 11900 +//$$ categories = {CREATIVE, JOA}, + //#else + category = {CREATIVE, JOA}, + desc="Makes the random velocities of droppers and projectiles (as well as both the position and velocity of blocks broken by pistons) systematically iterate through the most extreme values possible, and then repeatedly iterate through all the halfway points in between, in a sense attempting every point in a 3d/5d \"grid\" that slowly increases in resolution.\nFor droppers and projectiles, this setting determines whether the max value corresponds to the old gaussian randomness limits (\"extreme\"), or the limits of the triangular randomness introduced in 1.19 (\"sensible\"). Both settings function the same for blocks being broken by pistons.\nFor the `/insanebehaviors ` command, see `/carpet commandInsaneBehaviors`.\nDo note that insaneBehaviors works on a global iterator: any triggering event will step through an iteration from all other insaneBehaviors events, too.", + //#endif + options = {"extreme", "sensible", "off"} + ) + public static String insaneBehaviors = "off"; + + @Rule( + //#if MC >= 11900 +//$$ categories = {COMMAND, CREATIVE, JOA}, + //#else + category = {COMMAND, CREATIVE, JOA}, + desc="The command used for the `insaneBehaviors` rule.\n\"reset\" sets the `resolution` and `counter` back to the default values. \"getstate\" and \"setstate\" are used to manually read and write the current iteration state.", + //#endif + options = {"true", "ops", "false", "0", "1", "2", "3", "4"} + ) + public static String commandInsaneBehaviors = "ops"; + + @Rule( + //#if MC >= 11900 +//$$ categories = {CREATIVE, JOA}, + //#else + category = {CREATIVE, JOA}, + desc="Lets you send manual block and/or shape updates to blocks using a feather item. Updates are sent from the block in front of the face you're clicking on. Useful if you're working with update interations off or with budded blocks.", + //#endif + options = {"off", "blockupdates", "shapeupdates", "both"} + ) + public static String blockTickling = "off"; +} diff --git a/src/main/java/com/joacarpet/commands/InsaneBehaviorsCommand.java b/src/main/java/com/joacarpet/commands/InsaneBehaviorsCommand.java new file mode 100644 index 0000000..7eca08f --- /dev/null +++ b/src/main/java/com/joacarpet/commands/InsaneBehaviorsCommand.java @@ -0,0 +1,70 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.commands; + +import com.joacarpet.InsaneBehaviors; +import com.joacarpet.JoaCarpetMod; +import com.joacarpet.JoaCarpetSettings; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import net.minecraft.commands.CommandSourceStack; +import java.util.Objects; + +//#if MC >= 11900 +//$$ import carpet.utils.CommandHelper; +//#else +import carpet.settings.SettingsManager; +//#endif + +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; + +public class InsaneBehaviorsCommand { + public static void register(CommandDispatcher dispatcher) { + dispatcher.register( + literal("insanebehaviors") + .requires(c -> !Objects.equals(JoaCarpetSettings.insaneBehaviors, "normal") && + //#if MC >= 11900 +//$$ CommandHelper.canUseCommand(c, JoaCarpetSettings.commandInsaneBehaviors)) + //#else + SettingsManager.canUseCommand(c, JoaCarpetSettings.commandInsaneBehaviors)) + //#endif + + + .executes(c -> 1) + .then( + literal("reset") + .executes(c -> InsaneBehaviors.resetCounterAndResolution(c.getSource())) + ) + .then( + literal("getstate") + .executes(c -> InsaneBehaviors.getState(c.getSource())) + ) + .then( + literal("setstate") + .then(argument("resolution", IntegerArgumentType.integer(2)) + .then(argument("counter", IntegerArgumentType.integer(0)) + .executes(c -> InsaneBehaviors.setState(c.getSource(), IntegerArgumentType.getInteger(c, "resolution"), IntegerArgumentType.getInteger(c, "counter"))) + )))); + + JoaCarpetMod.LOGGER.info("insanebehaviors command registered"); + } +} diff --git a/src/main/java/com/joacarpet/mixin/MinecraftServerMixin.java b/src/main/java/com/joacarpet/mixin/MinecraftServerMixin.java new file mode 100644 index 0000000..859b193 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/MinecraftServerMixin.java @@ -0,0 +1,53 @@ +/* + * This file is part of the TemplateMod project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * TemplateMod 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. + * + * TemplateMod 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TemplateMod. If not, see . + */ + +package com.joacarpet.mixin; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.MinecraftServer; +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.callback.CallbackInfo; + +@Mixin(MinecraftServer.class) +public abstract class MinecraftServerMixin +{ + @Inject( + //#if MC >= 11600 + method = "runServer", + //#else + //$$ method = "run", + //#endif + at = @At("HEAD") + ) + private void onRun(CallbackInfo ci) + { + //#if MC >= 11500 + System.err.println("Hello world from mc11500 branch"); + //#elseif MC >= 11400 + //$$ System.err.println("Hello world from mc11400 branch"); + //#endif + + CompoundTag nbt = new CompoundTag(); + nbt.putString("key", "value"); + System.err.println("nbt: " + nbt); + } +} diff --git a/src/main/java/com/joacarpet/mixin/blockTickling/ItemMixin.java b/src/main/java/com/joacarpet/mixin/blockTickling/ItemMixin.java new file mode 100644 index 0000000..4c9c677 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/blockTickling/ItemMixin.java @@ -0,0 +1,70 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.blockTickling; + +import com.joacarpet.JoaCarpetMod; +import com.joacarpet.JoaCarpetSettings; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +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.callback.CallbackInfoReturnable; + +@Mixin(Item.class) +class ItemMixin { + @Inject(method = "useOn", at = @At("RETURN"), cancellable = true) + public void useOn(UseOnContext useOnContext, CallbackInfoReturnable cir) { + if (JoaCarpetSettings.blockTickling.equals("off") || !useOnContext.getItemInHand().is(Items.FEATHER)) { + return; + } + Level level = useOnContext.getLevel(); + if (level.isClientSide) { + return; + } + BlockPos clickedPos = useOnContext.getClickedPos(); + BlockPos neighborPos = clickedPos.relative(useOnContext.getClickedFace()); + BlockState neighborBlockState = level.getBlockState(neighborPos); + + JoaCarpetMod.LOGGER.info("NeighborPos: {}", neighborPos); + + if (JoaCarpetSettings.blockTickling.equals("blockupdates") || JoaCarpetSettings.blockTickling.equals("both")) { + level.neighborChanged(clickedPos, neighborBlockState.getBlock(), neighborPos); + } + if (JoaCarpetSettings.blockTickling.equals("shapeupdates") || JoaCarpetSettings.blockTickling.equals("both")) { + //#if MC >= 11900 +//$$ level.neighborShapeChanged(useOnContext.getClickedFace(), neighborBlockState, clickedPos, neighborPos, 2, 512); + //#else + BlockState clickedBlockState = level.getBlockState(clickedPos); + BlockState newState = clickedBlockState.updateShape(useOnContext.getClickedFace(), neighborBlockState, level, clickedPos, neighborPos); + Block.updateOrDestroy(clickedBlockState, newState, level, clickedPos, 2, 512); + //#endif + } + cir.setReturnValue(InteractionResult.SUCCESS); + } + +} diff --git a/src/main/java/com/joacarpet/mixin/blockTickling/PlayerMixin.java b/src/main/java/com/joacarpet/mixin/blockTickling/PlayerMixin.java new file mode 100644 index 0000000..c4dbbd8 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/blockTickling/PlayerMixin.java @@ -0,0 +1,47 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.blockTickling; + +import com.joacarpet.JoaCarpetSettings; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +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.callback.CallbackInfoReturnable; + +@Mixin(Player.class) +public abstract class PlayerMixin extends LivingEntity { + + protected PlayerMixin(EntityType entityType, Level level) { + super(entityType, level); + } + + @Inject(method="isSecondaryUseActive", at = @At("HEAD"), cancellable = true) + public void isSecondaryUseActive(CallbackInfoReturnable cir) { + if (JoaCarpetSettings.blockTickling.equals("off") && this.getMainHandItem().is(Items.FEATHER)) { + cir.setReturnValue(true); + } + } +} diff --git a/src/main/java/com/joacarpet/mixin/insaneBehaviors/BlockMixin.java b/src/main/java/com/joacarpet/mixin/insaneBehaviors/BlockMixin.java new file mode 100644 index 0000000..3d90662 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/insaneBehaviors/BlockMixin.java @@ -0,0 +1,38 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.insaneBehaviors; + +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +import java.util.function.Supplier; + +@Mixin(Block.class) +public interface BlockMixin { + @Invoker("popResource") + static void popResourceInvoker(Level level, Supplier supplier, ItemStack itemStack) { + throw new AssertionError(); + } +} diff --git a/src/main/java/com/joacarpet/mixin/insaneBehaviors/ContainersMixin.java b/src/main/java/com/joacarpet/mixin/insaneBehaviors/ContainersMixin.java new file mode 100644 index 0000000..b621c25 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/insaneBehaviors/ContainersMixin.java @@ -0,0 +1,60 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.insaneBehaviors; + +import net.minecraft.world.Containers; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(Containers.class) +public class ContainersMixin { + +// @Redirect(method = "dropItemStack", at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/world/entity/item/ItemEntity;setDeltaMovement(DDD)V" +// )) +// private static void setDeltaMovement(ItemEntity itemEntity, double d, double e, double f) { +// if (JoaCarpetSettings.insaneBehaviors.equals("off")) { +// itemEntity.setDeltaMovement(d+1, e, f); +// return; +// } +// // Vec3 unitVelocity = nextEvenlyDistributedPoint(); +// // Vec3 velocity = switch (JoaCarpetSettings.insaneBehaviors) { +// // // net.minecraft.core.dispenser.DefaultDispenseItemBehavior.spawnItem, Line 7 +// // case "sensible" -> mapUnitVelocityToVec3( +// // unitVelocity, +// // 1, +// // 0.3 * (double) direction.getStepX(), 0.0172275 * (double) i, +// // 0.2, 0.0172275 * (double) i, +// // 0.3 * (double) direction.getStepZ(), 0.0172275 * (double) i +// // ); +// // // spawnItem from pre-1.19 +// // case "extreme" -> mapUnitVelocityToVec3( +// // unitVelocity, +// // 8, +// // 0.3 * (double) direction.getStepX(), 0.0075 * (double) i, +// // 0.2, 0.0075 * (double) i, +// // 0.3 * (double) direction.getStepZ(), 0.0075 * (double) i +// // ); +// // default -> throw new IllegalStateException("Unexpected value: " + JoaCarpetSettings.insaneBehaviors); +// // }; +// // itemEntity.setDeltaMovement(velocity); +// } +} diff --git a/src/main/java/com/joacarpet/mixin/insaneBehaviors/DefaultDispenseItemBehaviorMixin.java b/src/main/java/com/joacarpet/mixin/insaneBehaviors/DefaultDispenseItemBehaviorMixin.java new file mode 100644 index 0000000..471ca37 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/insaneBehaviors/DefaultDispenseItemBehaviorMixin.java @@ -0,0 +1,73 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.insaneBehaviors; + +import com.joacarpet.JoaCarpetSettings; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.ArrayList; + +import static com.joacarpet.InsaneBehaviors.*; + +@Mixin(DefaultDispenseItemBehavior.class) +public class DefaultDispenseItemBehaviorMixin { + + @Redirect(method = "spawnItem", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/entity/item/ItemEntity;setDeltaMovement(DDD)V" + )) + private static void setDeltaMovement(ItemEntity itemEntity, double d, double e, double f, Level _level, ItemStack _itemStack, int i, Direction direction, Position _position) { + if (JoaCarpetSettings.insaneBehaviors.equals("off")) { + itemEntity.setDeltaMovement(d, e, f); + return; + } + ArrayList unitVelocity = nextEvenlyDistributedPoint(3); + Vec3 velocity = switch (JoaCarpetSettings.insaneBehaviors) { + // net.minecraft.core.dispenser.DefaultDispenseItemBehavior.spawnItem, Line 7 + case "sensible" -> mapUnitVelocityToVec3( + unitVelocity, + 1, + 0.3 * (double) direction.getStepX(), 0.0172275 * (double) i, + 0.2, 0.0172275 * (double) i, + 0.3 * (double) direction.getStepZ(), 0.0172275 * (double) i + ); + // spawnItem from pre-1.19 + case "extreme" -> mapUnitVelocityToVec3( + unitVelocity, + 8, + 0.3 * (double) direction.getStepX(), 0.0075 * (double) i, + 0.2, 0.0075 * (double) i, + 0.3 * (double) direction.getStepZ(), 0.0075 * (double) i + ); + default -> throw new IllegalStateException("Unexpected value: " + JoaCarpetSettings.insaneBehaviors); + }; + itemEntity.setDeltaMovement(velocity); + } +} diff --git a/src/main/java/com/joacarpet/mixin/insaneBehaviors/PistonBaseBlockMixin.java b/src/main/java/com/joacarpet/mixin/insaneBehaviors/PistonBaseBlockMixin.java new file mode 100644 index 0000000..1e394fd --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/insaneBehaviors/PistonBaseBlockMixin.java @@ -0,0 +1,82 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.insaneBehaviors; + +import com.joacarpet.JoaCarpetSettings; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.piston.PistonBaseBlock; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.ArrayList; + +import static com.joacarpet.InsaneBehaviors.nextEvenlyDistributedPoint; + +@Mixin(PistonBaseBlock.class) +public class PistonBaseBlockMixin { + @Redirect(method = "moveBlocks", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/block/piston/PistonBaseBlock;dropResources(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;)V" + )) + private void dropResources(BlockState blockState, LevelAccessor levelAccessor, BlockPos blockPos, @Nullable BlockEntity blockEntity) { + // net.minecraft.world.level.block.Block.dropResources(net.minecraft.world.level.block.state.BlockState, net.minecraft.world.level.LevelAccessor, net.minecraft.core.BlockPos, net.minecraft.world.level.block.entity.BlockEntity) + if (levelAccessor instanceof ServerLevel) { + Level level = (ServerLevel) levelAccessor; + Block.getDrops(blockState, (ServerLevel)levelAccessor, blockPos, blockEntity).forEach(itemStack -> { + if (JoaCarpetSettings.insaneBehaviors.equals("off")) { + Block.popResource(level, blockPos, itemStack); + } else { + customPopResource(level, blockPos, itemStack); + } + }); + //#if MC >= 11900 +//$$ blockState.spawnAfterBreak((ServerLevel)levelAccessor, blockPos, ItemStack.EMPTY, true); + //#else + blockState.spawnAfterBreak((ServerLevel)levelAccessor, blockPos, ItemStack.EMPTY); + //#endif + } + } + + @Unique + private static void customPopResource(Level level, BlockPos blockPos, ItemStack itemStack) { + // net.minecraft.world.level.block.Block.popResource(net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.world.item.ItemStack) + ArrayList unitValueList = nextEvenlyDistributedPoint(5); + double velX = unitValueList.get(0) * 0.2 - 0.1; + double velZ = unitValueList.get(1) * 0.2 - 0.1; + double d = (double)EntityType.ITEM.getHeight() / 2.0; + double posX = (double)blockPos.getX() + 0.5 + unitValueList.get(2) * 0.5 - 0.25; + double posZ = (double)blockPos.getZ() + 0.5 + unitValueList.get(3) * 0.5 - 0.25; + double posY = (double)blockPos.getY() + 0.5 + unitValueList.get(4) * 0.5 - 0.25 - d; + BlockMixin.popResourceInvoker(level, () -> new ItemEntity(level, posX, posY, posZ, itemStack, velX, 0.2, velZ), itemStack); + } +} diff --git a/src/main/java/com/joacarpet/mixin/insaneBehaviors/ProjectileMixin.java b/src/main/java/com/joacarpet/mixin/insaneBehaviors/ProjectileMixin.java new file mode 100644 index 0000000..38739b0 --- /dev/null +++ b/src/main/java/com/joacarpet/mixin/insaneBehaviors/ProjectileMixin.java @@ -0,0 +1,69 @@ +/* + * This file is part of the JoaCarpet project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Joa and contributors + * + * JoaCarpet 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. + * + * JoaCarpet 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with JoaCarpet. If not, see . + */ + +package com.joacarpet.mixin.insaneBehaviors; + +import com.joacarpet.InsaneBehaviors; +import com.joacarpet.JoaCarpetSettings; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.ArrayList; + +import static com.joacarpet.InsaneBehaviors.mapUnitVelocityToVec3; + +@Mixin(Projectile.class) +public class ProjectileMixin { + @Redirect(method = "shoot", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/phys/Vec3;add(DDD)Lnet/minecraft/world/phys/Vec3;" + )) + private Vec3 add(Vec3 vec3, double d, double e, double f, double deltaMovementX, double deltaMovementY, double deltaMovementZ, float deltaMovementMultiplier, float divergence) { + if (JoaCarpetSettings.insaneBehaviors.equals("off")) { + return new Vec3(vec3.x + d, vec3.y + e, vec3.z + f); + } + + ArrayList unitVelocity = InsaneBehaviors.nextEvenlyDistributedPoint(3); + Vec3 velocity = switch (JoaCarpetSettings.insaneBehaviors) { + // net.minecraft.world.entity.projectile.Projectile.shoot, Line 2 + case "sensible" -> mapUnitVelocityToVec3( + unitVelocity, + 1, + 0.0, 0.0172275 * (double)divergence, + 0.0, 0.0172275 * (double)divergence, + 0.0, 0.0172275 * (double)divergence + ); + // net.minecraft.world.entity.projectile.Projectile.shoot pre-1.19 + case "extreme" -> mapUnitVelocityToVec3( + unitVelocity, + 8, + 0.0, (double)0.0075F * (double)divergence, + 0.0, (double)0.0075F * (double)divergence, + 0.0, (double)0.0075F * (double)divergence + ); + default -> throw new IllegalStateException("Unexpected value: " + JoaCarpetSettings.insaneBehaviors); + }; + return new Vec3(vec3.x + velocity.x, vec3.y + velocity.y, vec3.z + velocity.z); + } + +} diff --git a/src/main/resources/assets/joacarpet/icon.png b/src/main/resources/assets/joacarpet/icon.png new file mode 100644 index 0000000..0f31956 Binary files /dev/null and b/src/main/resources/assets/joacarpet/icon.png differ diff --git a/src/main/resources/assets/joacarpet/lang/en_us.json b/src/main/resources/assets/joacarpet/lang/en_us.json new file mode 100644 index 0000000..1c06f87 --- /dev/null +++ b/src/main/resources/assets/joacarpet/lang/en_us.json @@ -0,0 +1,5 @@ +{ + "carpet.rule.insaneBehaviors.desc": "Makes the random velocities of droppers and projectiles (as well as both the position and velocity of blocks broken by pistons) systematically iterate through the most extreme values possible, and then repeatedly iterate through all the halfway points in between, in a sense attempting every point in a 3d/5d \"grid\" that slowly increases in resolution.\nFor droppers and projectiles, this setting determines whether the max value corresponds to the old gaussian randomness limits (\"extreme\"), or the limits of the triangular randomness introduced in 1.19 (\"sensible\"). Both settings function the same for blocks being broken by pistons.\nFor the `/insanebehaviors ` command, see `/carpet commandInsaneBehaviors`.\nDo note that insaneBehaviors works on a global iterator: any triggering event will step through an iteration from all other insaneBehaviors events, too.", + "carpet.rule.commandInsaneBehaviors.desc": "The command used for the `insaneBehaviors` rule.\n\"reset\" sets the `resolution` and `counter` back to the default values. \"getstate\" and \"setstate\" are used to manually read and write the current iteration state.", + "carpet.rule.blockTickling.desc": "Lets you send manual block and/or shape updates to blocks using a feather item. Updates are sent from the block in front of the face you're clicking on. Useful if you're working with update interations off or with budded blocks." +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..fa59ad3 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "id": "${id}", + "version": "${version}", + + "name": "${name}", + "description": "Joa's small, creative-focused carpet extension mod", + "authors": [ + "Joa" + ], + "contact": { + "homepage": "https://modrinth.com/mod/joacarpet", + "sources": "https://github.com/JoakimThorsen/joacarpet" + }, + "license": "CC0-1.0", + "icon": "assets/joacarpet/icon.png", + + "environment": "*", + "entrypoints": { + "main": [ + "com.joacarpet.JoaCarpetMod" + ] + }, + "mixins": [ + "joacarpet.mixins.json" + ], + + "depends": { + "fabricloader": ">=0.11.4", + "minecraft": "${minecraft_dependency}", + "carpet": "=1.4.x" + } +} diff --git a/src/main/resources/joacarpet.mixins.json b/src/main/resources/joacarpet.mixins.json new file mode 100644 index 0000000..d63d31f --- /dev/null +++ b/src/main/resources/joacarpet.mixins.json @@ -0,0 +1,23 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.joacarpet.mixin", + "compatibilityLevel": "{{COMPATIBILITY_LEVEL}}", + "mixins": [ + "MinecraftServerMixin", + + "blockTickling.ItemMixin", + "blockTickling.PlayerMixin", + + "insaneBehaviors.BlockMixin", + "insaneBehaviors.ContainersMixin", + "insaneBehaviors.DefaultDispenseItemBehaviorMixin", + "insaneBehaviors.PistonBaseBlockMixin", + "insaneBehaviors.ProjectileMixin" + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/versions/1.14.4/gradle.properties b/versions/1.14.4/gradle.properties new file mode 100644 index 0000000..b1a6a4f --- /dev/null +++ b/versions/1.14.4/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.14.4 + minecraft_version=1.14.4 + yarn_mappings=1.14.4+build.18 + +# Fabric Mod Metadata + minecraft_dependency=1.14.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.14.4 + +# Dependencies + # fabric_api_version=0.28.5+1.14 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.3.7+v200127 +carpet_minecraft_version=1.14.4 diff --git a/versions/1.15.2/gradle.properties b/versions/1.15.2/gradle.properties new file mode 100644 index 0000000..3549e5b --- /dev/null +++ b/versions/1.15.2/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.15.2 + minecraft_version=1.15.2 + yarn_mappings=1.15.2+build.17 + +# Fabric Mod Metadata + minecraft_dependency=1.15.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.15.2 + +# Dependencies + # fabric_api_version=0.28.5+1.15 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.8+v200811 +carpet_minecraft_version=1.15.2 diff --git a/versions/1.16.5/gradle.properties b/versions/1.16.5/gradle.properties new file mode 100644 index 0000000..f439d6d --- /dev/null +++ b/versions/1.16.5/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.16.5 + minecraft_version=1.16.5 + yarn_mappings=1.16.5+build.10 + +# Fabric Mod Metadata + minecraft_dependency=1.16.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.16.4\n1.16.5 + +# Dependencies + # fabric_api_version=0.42.0+1.16 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.44+v210714 +carpet_minecraft_version=1.16.5 diff --git a/versions/1.17.1/gradle.properties b/versions/1.17.1/gradle.properties new file mode 100644 index 0000000..353c74c --- /dev/null +++ b/versions/1.17.1/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.17.1 + minecraft_version=1.17.1 + yarn_mappings=1.17.1+build.65 + +# Fabric Mod Metadata + minecraft_dependency=1.17.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.17.1 + +# Dependencies + # fabric_api_version=0.46.1+1.17 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.57+v220119 +carpet_minecraft_version=1.17.1 diff --git a/versions/1.18.2/gradle.properties b/versions/1.18.2/gradle.properties new file mode 100644 index 0000000..7292cc4 --- /dev/null +++ b/versions/1.18.2/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.18.2 + minecraft_version=1.18.2 + yarn_mappings=1.18.2+build.4 + +# Fabric Mod Metadata + minecraft_dependency=1.18.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.18.2 + +# Dependencies + # fabric_api_version=0.76.0+1.18.2 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.69+v220331 +carpet_minecraft_version=1.18.2 diff --git a/versions/1.19.4/gradle.properties b/versions/1.19.4/gradle.properties new file mode 100644 index 0000000..fd9ce76 --- /dev/null +++ b/versions/1.19.4/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.19.4 + minecraft_version=1.19.4 + yarn_mappings=1.19.4+build.2 + +# Fabric Mod Metadata + minecraft_dependency=1.19.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.19.4 + +# Dependencies + # fabric_api_version=0.87.2+1.19.4 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.101+v230319 +carpet_minecraft_version=1.19.4 diff --git a/versions/1.20.2/gradle.properties b/versions/1.20.2/gradle.properties new file mode 100644 index 0000000..e4d07fc --- /dev/null +++ b/versions/1.20.2/gradle.properties @@ -0,0 +1,18 @@ +# Fabric Properties + # check these on https://fallen-breath.github.io/fabric-versions/?&version=1.20.4 + minecraft_version=1.20.2 + yarn_mappings=1.20.2+build.4 + +# Fabric Mod Metadata + minecraft_dependency=1.20.x + +# Build Information + # The target mc versions for the mod during mod publishing, separated with \n + game_versions=1.20.2\n1.20.1 + +# Dependencies + # fabric_api_version=0.91.3+1.20.4 + +# https://masa.dy.fi/maven/carpet/fabric-carpet/ +carpet_core_version=1.4.119+v230928 +carpet_minecraft_version=1.20.2 diff --git a/versions/mainProject b/versions/mainProject new file mode 100644 index 0000000..507266b --- /dev/null +++ b/versions/mainProject @@ -0,0 +1 @@ +1.17.1 \ No newline at end of file