diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 30026f6..93138ad 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,47 +1,203 @@ -# Contributing to Ranged Pumps +# Contributing + +When contributing to this repository, please first discuss the change you wish to make via +[GitHub issues](https://github.com/refinedmods/rangedpumps/issues), [Discord](https://discordapp.com/invite/VYzsydb), +or any other method with the owners of this repository before making a change. + +## Pull requests + +- Keep your pull request (PR) as small as possible, this makes reviewing easier. +- Commits serve a clear purpose and have a fitting commit message. +- Branches are kept up to date by rebasing (updating a branch by merging makes for a confusing Git history). +- PRs are merged by merging the commits on top of the target branch (which is `develop`). +- Remember to add your changes in `CHANGELOG.md`. If your changes are merely technical, it's not necessary to update the + changelog as it's not relevant for users. + +### Commit messages + +Commit messages must adhere to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). We +use [Commitlint](https://commitlint.js.org/) to validate commit messages. + +We use +the [conventional configuration](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) +for Commitlint. + +It is recommended to install +the [Conventional Commit plugin](https://plugins.jetbrains.com/plugin/13389-conventional-commit) to make it +easier to write commit messages. + +### Branch names + +Because we use merge commits when merging a PR, branch names will be part of the history of the repository. That is why +branch names must follow a certain standard. + +The format is `{category}/GH-{issue number}/{lowercase-description}` and a branch name can be maximum 50 characters of +length. + +Category must match a +category [used in our Commitlint config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum). + +Valid examples are: + +- `fix/GH-123/add-branch-linting` +- `docs/GH-123/cleanup` ## Versioning This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Pull requests +### Version metadata -- Keep your PR as small as possible, this makes reviewing easier. -- Commits serve a clear purpose and have a fitting commit message. -- Branches are kept up to date by rebasing, preferably. -- PRs are merged by rebasing the commits on top of the target branch. -- Changes are added in `CHANGELOG.md`. Please refrain from using technical terminology, keep it user-friendly. The - format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +The code doesn't contain version metadata: `build.gradle` specifies a version of `0.0.0` (via Refined Architect). +The versioning information is entirely contained in Git by using tags. + +Per [Semantic Versioning](https://semver.org/spec/v2.0.0.html), the version number being released depends on the changes +in that release. We usually can't predict those +changes at the start of a release cycle, so we can't bump the version at the start of a release cycle. That means that +the version number being released is determined at release time. + +Because the version number is determined at release time, we can't store any versioning metadata in the +code (`build.gradle`). If we did, `build.gradle` would have the version number of the latest released version during the +release cycle of the new version, which isn't correct. + +### Dealing with Minecraft + +Whenever we port to a new Minecraft version, at least the minor version should be incremented. + +This is needed so that we can still support older Minecraft versions without the version numbers conflicting. + +## Changelog + +The changelog is kept in `CHANGELOG.md`. + +Keeping a readable, relevant and user-friendly changelog is essential for our end users +to stay up to date with the project. + +Please refrain from using technical terminology or adding entries for technical changes +that are (generally) not relevant to the end-user. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Gitflow This project uses [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow). -## Releasing +## Documentation + +Documentation must be kept up to date when adding or changing functionality. + +### Javadoc + +Javadoc is available after every release on https://refinedmods.com/rangedpumps/. + +### API annotations + +Public APIs must be annotated with an `@API` annotation +from [API Guardian](https://github.com/apiguardian-team/apiguardian). + +## Code style + +We use [Checkstyle](https://checkstyle.sourceforge.io/) in our build workflow to validate coding style. + +It is recommended to import the [config/checkstyle/checkstyle.xml](../config/checkstyle/checkstyle.xml) file into your +IDE, so that formatting rules are respected. + +Moreover, the [CheckStyle-IDEA plugin](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea) can be used to check +if there are no style violations. + +## Release process + +The release process is automated and follows Gitflow. + +Before running the "Draft release" workflow to start the release process make sure `CHANGELOG.md` contains all the +unreleased changes. -1) Make sure the version number in `build.gradle` is correct. -2) Merge `develop` to `main`. -3) Push a tag with the version number (prefixed with `v`). +To determine the version number to be released, the workflow will ask you which release type this is (major, minor, +patch). +The latest version from `CHANGELOG.md` will be used as a base, and that will be incremented +depending on the release type. -After releasing: +`CHANGELOG.md` will be updated by this workflow, you can review this in the resulting release PR. -1) Rename the "Unreleased" section to the correct version number in `CHANGELOG.md`. -2) Upgrade the version number in `build.gradle`. -3) Create a new "Unreleased" section in `CHANGELOG.md`. +If you merge the release PR, the "Publish release" workflow will automatically publish the release. An additional PR +will be created to merge the changes in `CHANGELOG.md` back into `develop`. -## Pipelines +## Hotfix process + +The hotfix process is semi-automated and follows Gitflow: + +- Create a hotfix branch off `main`. +- Commit your changes on this branch. +- Update `CHANGELOG.md` (with version number and release date) manually on this branch. +- Push the branch and create a PR for it, merging into `main`. + +The "Publish release" workflow will take care of the rest. + +## Workflows + +We have a few GitHub workflows: + +- Build (PRs, pushes to `develop` and `main`) +- Draft release (manual trigger) +- Publish release (merging a PR to `main`) +- Validate changelog (PRs) + - To validate if `CHANGELOG.md` is valid and updated. + - Not every pull request needs a changelog change, so the `skip-changelog` label can be added to the pull request to + ignore this. +- Validate commit messages (PRs) + - Validates whether the commits on a pull request + respect [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). + - We use + the [conventional configuration](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional). +- Validate branch names (PRs) +- Issue for unsupported version (issues) + - Posts a message on a GitHub issue if the issue is about an unsupported version. +- Lock resolved issues and PRs (every night) ### Build -The build pipeline triggers when a commit is pushed to a branch or pull request. +The build workflow triggers when a pull request is updated or when a commit is pushed to `develop` or `main`. + +The build workflow takes care of the following: + +- Running a Gradle build, running our tests in the process and generating an aggregated code coverage report for the API + modules. +- Analyzing the code on SonarQube. + > Because of + > [limitations with SonarQube](https://portal.productboard.com/sonarsource/1-sonarcloud/c/50-sonarcloud-analyzes-external-pull-request), + > pull requests originating from a fork aren't analyzed on SonarQube. + +- Code style validation with Checkstyle. +- Mutation and line coverage test with Pitest. +- Uploading the artifacts on the action. + +### Draft release + +The draft release workflow is a manual workflow which will create a release branch from `develop`. + +To determine the version number to be released, it will extract the latest version number from `CHANGELOG.md` and +increment it depending on the release type selected. + +This workflow takes care of the following: -### Release +- Creating the release branch. +- Updating the changelog on this release branch. +- Creating a pull request merging the release branch into `main`. -The release pipeline triggers when a tag is pushed. This will run all the steps that our build pipeline does. +### Publish release -After that succeeds, it will publish to GitHub packages and CreeperHost Maven repository. +The "publish release" workflow is triggered when a release or hotfix PR is merged to `main`. Usually, this will be the +PR created earlier in the "Draft release" workflow. -The "Unreleased" section in `CHANGELOG.md` is parsed and a GitHub release is created with the changelog body and -relevant artifacts. +The workflow takes care of the following: -After that, a Discord and Twitter notification is sent. +- Extracting the version number from the release or hotfix branch name that is merged in the PR. +- Extracting the changelog entry for this version number. +- Running a build. +- Publishing on [GitHub packages](https://github.com/refinedmods/rangedpumps/packages) and + CreeperHost Maven. +- Publishing Javadoc on [GitHub pages](https://github.com/refinedmods/rangedpumps/tree/gh-pages). +- Deploying on [GitHub releases](https://github.com/refinedmods/rangedpumps/releases). +- Announcing the release on Discord and Twitter. +- Creating a PR that merges `main` back into `develop` to get the changes to `CHANGELOG.md` and `build.gradle` + into `develop` from the draft release workflow. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index c15da83..6d1353b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,8 +35,8 @@ body: description: | If your Minecraft version isn't listed here, it means that it's no longer supported. In that case, don't create an issue. options: - - Minecraft 1.18.2 - Minecraft 1.19.2 + - Minecraft 1.20.1 validations: required: true - type: input diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 0000000..73da2a0 --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,11 @@ +# Support + +If you have a problem and need help, we offer various channels where you can ask for help. + +## I have a question + +Questions can be asked on [Discord](https://discordapp.com/invite/VYzsydb). + +## I have found a bug + +If you have found a bug, please report it on [GitHub issues](https://github.com/refinedmods/rangedpumps/issues). \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 080dd9f..5813d99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,44 +1,15 @@ name: Build on: - push: - pull_request: - types: [ opened, synchronize, reopened ] + push: + branches: + - develop + - main + pull_request: + types: [ opened, synchronize, reopened ] jobs: - build: - strategy: - matrix: - java: [ - 17 - ] - os: [ ubuntu-latest ] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: Setup JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Make Gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - name: Build - run: ./gradlew build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} - uses: actions/upload-artifact@v2 - with: - name: Artifacts - path: build/libs/ + build: + uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.6.0 + with: + mutation-testing: false + sonarqube: false + secrets: inherit diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 0000000..fd2b11e --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,24 @@ +name: Draft release +on: + workflow_dispatch: + inputs: + release-type: + description: 'Release type' + required: true + default: 'minor' + type: choice + options: + - major + - minor + - patch + version-number-override: + description: 'Version number override' + required: false + type: string +jobs: + draft: + uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.6.0 + with: + release-type: ${{ inputs.release-type }} + version-number-override: ${{ inputs.version-number-override }} + secrets: inherit diff --git a/.github/workflows/issue-for-unsupported-version.yml b/.github/workflows/issue-for-unsupported-version.yml new file mode 100644 index 0000000..b80bdc2 --- /dev/null +++ b/.github/workflows/issue-for-unsupported-version.yml @@ -0,0 +1,7 @@ +name: Issue for unsupported version +on: + issues: + types: [ labeled, unlabeled, reopened ] +jobs: + unsupported-labeler: + uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.6.0 \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..399fba6 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,18 @@ +name: Publish release +on: + pull_request: + branches: + - main + types: + - closed +jobs: + publish-release: + uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.6.0 + secrets: inherit + with: + project-name: 'Ranged Pumps' + announce: true + mutation-testing: false + sonarqube: false + curseforge: true + modrinth: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7d2510f..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release -on: - push: - tags: - - "v**" -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Get tag name - uses: olegtarasov/get-tag@v2.1 - id: tagName - - name: Validate semver - run: | - echo $GIT_TAG_NAME | grep -oP '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - name: Checkout repository - uses: actions/checkout@v2 - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: Setup JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Make Gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - name: Build - run: ./gradlew build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE: ${{ steps.tagName.outputs.tag }} - - name: Build documentation - run: ./gradlew javadoc - env: - RELEASE: ${{ steps.tagName.outputs.tag }} - - name: Publish documentation - uses: JamesIves/github-pages-deploy-action@4.1.5 - with: - branch: gh-pages - folder: build/docs/javadoc - - name: Publish - run: ./gradlew publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CREEPERHOST_MAVEN_USERNAME: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }} - CREEPERHOST_MAVEN_TOKEN: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }} - RELEASE: ${{ steps.tagName.outputs.tag }} - - name: Retrieve changelog - id: changelog_reader - uses: mindsers/changelog-reader-action@v2 - with: - version: 'Unreleased' - path: ./CHANGELOG.md - - name: Release on GitHub - uses: softprops/action-gh-release@v1 - id: ghRelease - with: - body: ${{ steps.changelog_reader.outputs.changes }} - name: ${{ steps.tagName.outputs.tag }} - files: | - build/libs/*.jar - - name: Release on CurseForge - run: ./gradlew curseforge - env: - RELEASE: ${{ steps.tagName.outputs.tag }} - CHANGELOG: ${{ steps.changelog_reader.outputs.changes }} - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} - # This is necessary because the Discord action doesn't support GH actions variable expansion? - - name: Set release URL - run: | - echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV - - name: Notify Discord - uses: Ilshidur/action-discord@0.3.2 - with: - args: 'Ranged Pumps {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - - name: Notify Twitter - uses: ethomson/send-tweet-action@v1 - with: - status: Ranged Pumps ${{ env.GIT_TAG_NAME }} has been released! ${{ env.RELEASE_URL }} - consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }} - consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} - access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} diff --git a/.github/workflows/resolved-issue-locking.yml b/.github/workflows/resolved-issue-locking.yml new file mode 100644 index 0000000..73023ae --- /dev/null +++ b/.github/workflows/resolved-issue-locking.yml @@ -0,0 +1,7 @@ +name: Lock resolved issues and PRs +on: + schedule: + - cron: '0 0 * * *' +jobs: + lock: + uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.6.0 \ No newline at end of file diff --git a/.github/workflows/unsupported.yml b/.github/workflows/unsupported.yml deleted file mode 100644 index 19f21f3..0000000 --- a/.github/workflows/unsupported.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Unsupported versions' -on: - issues: - types: [ labeled, unlabeled, reopened ] -jobs: - support: - runs-on: ubuntu-latest - steps: - - uses: dessant/support-requests@v2 - with: - github-token: ${{ github.token }} - support-label: 'unsupported' - issue-comment: > - :wave: @{issue-author}, we no longer support this version of Minecraft. - close-issue: true - lock-issue: false diff --git a/.github/workflows/validate-branch-name.yml b/.github/workflows/validate-branch-name.yml new file mode 100644 index 0000000..5db6ae8 --- /dev/null +++ b/.github/workflows/validate-branch-name.yml @@ -0,0 +1,5 @@ +name: Validate branch name +on: [ pull_request ] +jobs: + validate-branch-name: + uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.6.0 \ No newline at end of file diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml new file mode 100644 index 0000000..8f3f0d0 --- /dev/null +++ b/.github/workflows/validate-changelog.yml @@ -0,0 +1,7 @@ +name: Validate changelog +on: + pull_request: + types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] +jobs: + validate-changelog: + uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.6.0 \ No newline at end of file diff --git a/.github/workflows/validate-commit-messages.yml b/.github/workflows/validate-commit-messages.yml new file mode 100644 index 0000000..4decd4a --- /dev/null +++ b/.github/workflows/validate-commit-messages.yml @@ -0,0 +1,5 @@ +name: Validate commit messages +on: [ pull_request ] +jobs: + validate-commit-messages: + uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.6.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d67307..802040a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,127 +7,171 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.1.0] - 2023-07-07 + +### Changed + +- Ported to Minecraft 1.20.1. + +## [1.0.0] - 2022-09-30 + ### Changed -- Ported to Minecraft 1.19.2. +- Ported to Minecraft 1.19.2. ## [0.9.2] - 2022-03-26 ### Changed -- Ported to Minecraft 1.18.2. +- Ported to Minecraft 1.18.2. ## [0.9.1] - 2022-03-26 ### Added -- Korean translation by [@mindy15963](https://github.com/mindy15963). -- French translation by [@dracnis](https://github.com/dracnis). +- Korean translation by [@mindy15963](https://github.com/mindy15963). +- French translation by [@dracnis](https://github.com/dracnis). ### Fixed -- Fixed pump scanning past minimum Y level. -- Fixed pump not using minimum Y level from dimension by [@Arayn](https://github.com/Arayn). +- Fixed pump scanning past minimum Y level. +- Fixed pump not using minimum Y level from dimension by [@Arayn](https://github.com/Arayn). ## [0.9.0] - 2021-12-18 ### Added -- Port to Minecraft 1.18.1. -- Added Portuguese translation by [@flagar0](https://github.com/flagar0). -- Added Italian translation by [@maicol07](https://github.com/maicol07). +- Port to Minecraft 1.18.1. +- Added Portuguese translation by [@flagar0](https://github.com/flagar0). +- Added Italian translation by [@maicol07](https://github.com/maicol07). ## [0.8.2] - 2020-09-25 ### Added -- Port to Minecraft 1.16.3. +- Port to Minecraft 1.16.3. ## [0.8.1] - 2020-08-30 ### Added -- Port to Minecraft 1.16.2. -- Simplified Chinese translation by [@a5161655](https://github.com/a5161655). -- Hungarian translation by [@excodex](https://github.com/excodex). +- Port to Minecraft 1.16.2. +- Simplified Chinese translation by [@a5161655](https://github.com/a5161655). +- Hungarian translation by [@excodex](https://github.com/excodex). ## [0.8.0] - 2020-07-15 ### Added -- Port to Minecraft 1.16. +- Port to Minecraft 1.16. ## [0.7.1] - 2020-01-30 ### Added -- Port to Minecraft 1.15.2. +- Port to Minecraft 1.15.2. ## [0.7.0] - 2020-01-20 ### Added -- Port to Minecraft 1.15. -- You can now configure the block that liquids have to be replaced with. +- Port to Minecraft 1.15. +- You can now configure the block that liquids have to be replaced with. ## [0.6.1] - 2019-11-07 ### Fixed -- Fix Pump not dropping when breaking. +- Fix Pump not dropping when breaking. ## [0.6.0] - 2019-11-03 ### Added -- Port to Minecraft 1.14. -- Russian translation by [@DDShadowRU](https://github.com/DDShadowRU). +- Port to Minecraft 1.14. +- Russian translation by [@DDShadowRU](https://github.com/DDShadowRU). ## [0.5.0] - 2017-07-25 ### Added -- Port to Minecraft 1.12. +- Port to Minecraft 1.12. ### Changed -- Changed scanning system to scan nearest blocks first. -- The pump no longer requires a redstone signal. If a redstone signal is given, the pump will pause instead. -- The pump now auto-pushes liquids to neighboring tanks. +- Changed scanning system to scan nearest blocks first. +- The pump no longer requires a redstone signal. If a redstone signal is given, the pump will pause instead. +- The pump now auto-pushes liquids to neighboring tanks. ## [0.4.0] - 2016-11-30 ### Added -- Port to Minecraft 1.11. -- Russian translation by [@CorwinTheCat](https://github.com/CorwinTheCat). +- Port to Minecraft 1.11. +- Russian translation by [@CorwinTheCat](https://github.com/CorwinTheCat). ### Changed -- The pump now uses energy by default in the config. +- The pump now uses energy by default in the config. ### Removed -- Removed RF support, use Forge Energy instead. +- Removed RF support, use Forge Energy instead. ## [0.3.0] - 2016-08-25 ### Added -- Optional RF usage. +- Optional RF usage. ### Changed -- Updated Forge to 2073. +- Updated Forge to 2073. ## [0.2.0] - 2016-07-15 ### Changed -- Increased default speed from 2 to 8 (which means it will run slower). +- Increased default speed from 2 to 8 (which means it will run slower). ## [0.1.0] - 2016-07-15 ### Added -- Initial release for Minecraft 1.10.2. +- Initial release for Minecraft 1.10.2. + +[Unreleased]: https://github.com/refinedmods/rangedpumps/compare/v1.1.0...HEAD + +[1.1.0]: https://github.com/refinedmods/rangedpumps/compare/v1.0.0...v1.1.0 + +[1.0.0]: https://github.com/refinedmods/rangedpumps/compare/v0.9.2...v1.0.0 + +[0.9.2]: https://github.com/refinedmods/rangedpumps/compare/v0.9.1...v0.9.2 + +[0.9.1]: https://github.com/refinedmods/rangedpumps/compare/v0.9.0...v0.9.1 + +[0.9.0]: https://github.com/refinedmods/rangedpumps/compare/v0.8.2...v0.9.0 + +[0.8.2]: https://github.com/refinedmods/rangedpumps/compare/v0.8.1...v0.8.2 + +[0.8.1]: https://github.com/refinedmods/rangedpumps/compare/v0.8.0...v0.8.1 + +[0.8.0]: https://github.com/refinedmods/rangedpumps/compare/v0.7.1...v0.8.0 + +[0.7.1]: https://github.com/refinedmods/rangedpumps/compare/v0.7.0...v0.7.1 + +[0.7.0]: https://github.com/refinedmods/rangedpumps/compare/v0.6.1...v0.7.0 + +[0.6.1]: https://github.com/refinedmods/rangedpumps/compare/v0.6.0...v0.6.1 + +[0.6.0]: https://github.com/refinedmods/rangedpumps/compare/v0.5.0...v0.6.0 + +[0.5.0]: https://github.com/refinedmods/rangedpumps/compare/v0.4.0...v0.5.0 + +[0.4.0]: https://github.com/refinedmods/rangedpumps/compare/v0.3.0...v0.4.0 + +[0.3.0]: https://github.com/refinedmods/rangedpumps/compare/v0.2.0...v0.3.0 + +[0.2.0]: https://github.com/refinedmods/rangedpumps/compare/v0.1.0...v0.2.0 + +[0.1.0]: https://github.com/refinedmods/rangedpumps/releases/tag/v0.1.0 diff --git a/LICENSE.md b/LICENSE.md index 7985d3d..655dc3a 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # The MIT License (MIT) -Copyright © 2016 - 2022 Refined Mods +Copyright © 2016 - 2023 Refined Mods Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/README.md b/README.md index 71ced28..cbc6fad 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ # Ranged Pumps [![Build Status](https://github.com/refinedmods/rangedpumps/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/refinedmods/rangedpumps/actions/workflows/build.yml) [![Downloads on CurseForge](http://cf.way2muchnoise.eu/full_247496_downloads.svg)](http://minecraft.curseforge.com/projects/ranged-pumps) [![Discord](https://img.shields.io/discord/342942776494653441)](https://discordapp.com/invite/VYzsydb) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE.md) +## About + Ranged Pumps is a simple mod that adds a pump that pumps liquids in a range. + +## Links + +- [GitHub](https://github.com/refinedmods/rangedpumps) + - [Releases](https://github.com/refinedmods/rangedpumps/releases) + - [Packages](https://github.com/refinedmods/rangedpumps/packages) + - [Issues](https://github.com/refinedmods/rangedpumps/issues) + - [Refined Mods on GitHub](https://github.com/refinedmods) +- [CurseForge](https://curseforge.com/minecraft/mc-mods/ranged-pumps) +- [Modrinth](https://modrinth.com/mod/ranged-pumps) +- [Wiki](https://refinedmods.com/ranged-pumps/) +- [Discord](https://discordapp.com/invite/VYzsydb) +- [Twitter](https://twitter.com/refinedmods) +- [Mastodon](https://anvil.social/@refinedmods) + +## Building + +Clone the repository and import the Gradle project. + +## Contributing + +See [CONTRIBUTING.md](.github/CONTRIBUTING.md). + +## Support + +See [SUPPORT.md](.github/SUPPORT.md). + +## Changelog + +See [CHANGELOG.md](CHANGELOG.md). diff --git a/build.gradle b/build.gradle index 5f81085..46acff9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,142 +1,12 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } -} - -plugins { - id 'com.matthewprenger.cursegradle' version '1.4.0' -} - -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'eclipse' -apply plugin: 'maven-publish' +apply from: "https://raw.githubusercontent.com/refinedmods/refinedarchitect/v0.6.0/helper.gradle" group = 'com.refinedmods' -archivesBaseName = 'rangedpumps' -version = '1.0.0' - -if (System.getenv('GITHUB_SHA') != null) { - version += '+' + System.getenv('GITHUB_SHA').substring(0, 7) -} - -if (System.getenv('RELEASE') != null) { - version = System.getenv('RELEASE').substring(1) // remove 'v' -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -minecraft { - mappings channel: 'official', version: '1.19.2' - - runs { - client { - workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - property 'forge.logging.console.level', 'debug' - mods { - rangedpumps { - source sourceSets.main - } - } - } - server { - workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - property 'forge.logging.console.level', 'debug' - mods { - rangedpumps { - source sourceSets.main - } - } - } +forgeProject("rangedpumps") - data { - workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - property 'forge.logging.console.level', 'debug' - args '--mod', 'rangedpumps', '--all', '--output', file('src/generated/resources/') - mods { - rangedpumps { - source sourceSets.main - } - } - } - } -} - -processResources { - inputs.property 'version', project.version - - filesMatching('META-INF/mods.toml') { - expand 'version': project.version - } -} - -dependencies { - minecraft 'net.minecraftforge:forge:1.19.2-43.1.32' -} - -jar { - manifest { - attributes([ - "Specification-Title" : "rangedpumps", - "Specification-Vendor" : "refinedmods", - "Specification-Version" : "1", - "Implementation-Title" : project.name, - "Implementation-Version" : "${version}", - "Implementation-Vendor" : "refinedmods", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } -} - -if (System.getenv("CURSEFORGE_TOKEN") != null) { - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = '247496' - changelog = System.getenv("CHANGELOG") - changelogType = 'markdown' - releaseType = project.version.toString().contains('beta') ? 'beta' : (project.version.toString().contains('alpha') ? 'alpha' : 'release') - addGameVersion "1.19.2" - mainArtifact(jar) { - displayName = "v$project.version" - } - } - } -} - -jar.finalizedBy('reobfJar') - -publishing { - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/refinedmods/rangedpumps") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - maven { - name = "CreeperHost" - url = uri("https://maven.creeperhost.net/release") - credentials { - username = System.getenv("CREEPERHOST_MAVEN_USERNAME") - password = System.getenv("CREEPERHOST_MAVEN_TOKEN") - } - } - } - publications { - gpr(MavenPublication) { - from(components.java) - } - } -} +archivesBaseName = 'rangedpumps' +enablePublishing() +enableCurseForge(247496) +enableModrinth("ceOkTRlU") +enableJavadoc() diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..b8e3125 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102..fae0804 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# 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. @@ -32,10 +32,10 @@ # 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». +# * 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: # @@ -205,6 +205,12 @@ set -- \ 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. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..f127cfd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/crafting_recipe.png b/images/crafting_recipe.png similarity index 100% rename from crafting_recipe.png rename to images/crafting_recipe.png diff --git a/images/description.md b/images/description.md new file mode 100644 index 0000000..ece54ac --- /dev/null +++ b/images/description.md @@ -0,0 +1,49 @@ +### Ranged Pumps is a simple mod that adds a pump that pumps liquids in a range. + +![A ranged pump being used to pump lava in the Nether](overview.png) + +![Crafting recipe for a ranged pump](crafting_recipe.png) + +## Placement + +Place the pump down, and it'll only work *without* a redstone signal. + +## Redstone signal + +If you give the pump a redstone signal, it will stop working until you disable the redstone signal. + +## Energy requirements + +By default, the pump requires Forge Energy, but can be configured to not use energy in the config. + +## Internal tank + +The size of the pump's internal tank is 32 buckets by default. You can increase or decrease this in the config. + +The pump will stop running if the internal tank is full. + +## Status updates + +Right click on the pump to know what it is doing and to know if it is running. + +## Scanning and range + +![Scanning behavior of a ranged pump](/assets/ranged-pumps/scanning.png) + +It'll start pumping liquids in rectangular spiral shape 1 block under the pump. + +The default range is 64 blocks. That'll mean it scan 64 blocks in any direction, nearest-first. + +On a vertical (Y) level, it will scan liquids from the pump to bedrock. + +## Liquids to stone + +The pump will also replace any liquids to stone by default. This can be turned off in the config. + +## Auto-pushing liquids + +The pump will auto-push liquids to neighboring tanks. You can also get the liquids out with pipes. + +## Chunkloading + +The mod doesn't chunkload pumps automatically. You'll need another mod to get this behavior. diff --git a/logo.png b/images/logo.png similarity index 100% rename from logo.png rename to images/logo.png diff --git a/overview.png b/images/overview.png similarity index 100% rename from overview.png rename to images/overview.png diff --git a/scanning.png b/images/scanning.png similarity index 100% rename from scanning.png rename to images/scanning.png diff --git a/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java b/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java index 456edee..5fdfe3d 100644 --- a/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java +++ b/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java @@ -3,10 +3,12 @@ import com.refinedmods.rangedpumps.block.PumpBlock; import com.refinedmods.rangedpumps.blockentity.PumpBlockEntity; import com.refinedmods.rangedpumps.config.ServerConfig; -import com.refinedmods.rangedpumps.item.group.MainCreativeModeTab; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.fml.ModLoadingContext; @@ -15,6 +17,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegisterEvent; import net.minecraftforge.registries.RegistryObject; @Mod(RangedPumps.ID) @@ -28,16 +31,28 @@ public final class RangedPumps { public static RegistryObject PUMP_BLOCK; public static RegistryObject> PUMP_BLOCK_ENTITY_TYPE; - public static final CreativeModeTab CREATIVE_MODE_TAB = new MainCreativeModeTab(); public static final ServerConfig SERVER_CONFIG = new ServerConfig(); public RangedPumps() { PUMP_BLOCK = BLOCKS.register("pump", PumpBlock::new); - ITEMS.register("pump", () -> new BlockItem(PUMP_BLOCK.get(), new Item.Properties().tab(RangedPumps.CREATIVE_MODE_TAB))); + ITEMS.register("pump", () -> new BlockItem(PUMP_BLOCK.get(), new Item.Properties())); PUMP_BLOCK_ENTITY_TYPE = BLOCK_ENTITY_TYPES.register("pump", () -> BlockEntityType.Builder.of(PumpBlockEntity::new, PUMP_BLOCK.get()).build(null)); ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SERVER_CONFIG.getSpec()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCK_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + FMLJavaModLoadingContext.get().getModEventBus().addListener(RangedPumps::onRegister); + } + + public static void onRegister(RegisterEvent e) { + e.register(Registries.CREATIVE_MODE_TAB, helper -> { + helper.register("general", CreativeModeTab.builder() + .title(Component.translatable("itemGroup.rangedpumps")) + .icon(() -> new ItemStack(RangedPumps.PUMP_BLOCK.get())) + .displayItems((params, output) -> { + output.accept(RangedPumps.PUMP_BLOCK.get()); + }) + .build()); + }); } } diff --git a/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java b/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java index 95ab5e5..8a05573 100644 --- a/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java +++ b/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java @@ -16,15 +16,13 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.registries.ObjectHolder; public class PumpBlock extends Block implements EntityBlock { public PumpBlock() { - super(Block.Properties.of(Material.STONE).strength(1.9F).sound(SoundType.STONE)); + super(Block.Properties.of().strength(1.9F).sound(SoundType.STONE)); } @SuppressWarnings("deprecation") @@ -33,7 +31,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity instanceof PumpBlockEntity pump) { - IEnergyStorage energy = pump.getCapability(CapabilityEnergy.ENERGY).orElse(null); + IEnergyStorage energy = pump.getCapability(ForgeCapabilities.ENERGY).orElse(null); if (energy == null) { return InteractionResult.SUCCESS; } diff --git a/src/main/java/com/refinedmods/rangedpumps/item/group/MainCreativeModeTab.java b/src/main/java/com/refinedmods/rangedpumps/item/group/MainCreativeModeTab.java deleted file mode 100644 index 7aa4a91..0000000 --- a/src/main/java/com/refinedmods/rangedpumps/item/group/MainCreativeModeTab.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.refinedmods.rangedpumps.item.group; - -import com.refinedmods.rangedpumps.RangedPumps; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.ItemStack; - -public class MainCreativeModeTab extends CreativeModeTab { - public MainCreativeModeTab() { - super(RangedPumps.ID); - } - - @Override - public ItemStack makeIcon() { - return new ItemStack(RangedPumps.PUMP_BLOCK.get()); - } -} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2e56026..3bbd1a4 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader = "javafml" -loaderVersion = "[43,)" +loaderVersion = "[47,)" issueTrackerURL = "https://github.com/refinedmods/rangedpumps" license = "MIT" [[mods]] diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 3299bfc..7fc7110 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,8 @@ { "pack": { - "description": "Ranged Pumps resources", - "pack_format": 9, - "forge:resource_pack_format": 9, - "forge:data_pack_format": 10 + "description": { + "text": "Ranged Pumps resources" + }, + "pack_format": 15 } }