Skip to content

Commit

Permalink
Merge branch '1.21.3-neoforge' into 1.21-neoforge
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Dec 19, 2024
2 parents b2e6dc5 + 04e0671 commit cd2283c
Show file tree
Hide file tree
Showing 12 changed files with 809 additions and 135 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
# Directory should be `/` instead of `/.github/workflows` according to the docs.
directory: "/"
schedule:
interval: "daily"
55 changes: 52 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Java CI with Gradle

on:
push:
branches:
- "**"
branches-ignore:
- "dependabot/**"
tags-ignore:
- "**"
paths:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: ./gradlew spotlessJsonCheck || (echo "::error::JSON validation failed! Run './gradlew spotlessApply' to fix style issues, or check the full error message for syntax errors." && exit 1)

- name: Validate Java code style
run: ./gradlew spotlessCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1)
run: ./gradlew spotlessJavaCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1)

- name: Run unit tests
run: ./gradlew test --stacktrace --warning-mode=fail
Expand Down Expand Up @@ -92,3 +92,52 @@ jobs:
echo "- [$filename]($url)" >> $GITHUB_STEP_SUMMARY
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Run the mod and take screenshots
uses: modmuss50/xvfb-action@c56c7da0c8fc9a7cb5df2e50dd2a43a80b64c5cb
with:
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail

# Needed because the screenshot gallery won't be created on pull requests.
# Also useful if Imgur uploads fail.
- name: Upload Test Screenshots.zip artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: Test Screenshots
path: runs/client/screenshots

- name: Create test screenshot gallery
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }}
shell: bash
run: |
echo "<details open>" >> $GITHUB_STEP_SUMMARY
echo "<summary>📸 Test Screenshots</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for img in runs/client/screenshots/*.png; do
if [ -f "$img" ]; then
filename=$(basename "$img")
name_without_ext="${filename%.*}"
# Upload to Imgur
response=$(curl -s -X POST \
-H "Authorization: Client-ID $IMGUR_CLIENT_ID" \
-F "image=@$img" \
https://api.imgur.com/3/image)
# Extract the URL from the response
url=$(echo $response | grep -o '"link":"[^"]*"' | cut -d'"' -f4)
if [ ! -z "$url" ]; then
# Convert underscores to spaces and capitalize first letter of each word
title=$(echo "$name_without_ext" | tr '_' ' ' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
echo "### $title" >> $GITHUB_STEP_SUMMARY
echo "![${name_without_ext}]($url)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
else
echo "Failed to upload $filename" >> $GITHUB_STEP_SUMMARY
fi
fi
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
47 changes: 42 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: Publish Release
run-name: "Publish release from ${{ github.ref_name }} branch"

permissions:
# Needed to push the tag.
contents: write

on:
workflow_dispatch:
Expand Down Expand Up @@ -28,6 +33,11 @@ on:
required: true
type: boolean
default: true
update_website:
description: "Update wimods.net post (only works if there already is one and publish_curseforge is true)"
required: false
type: boolean
default: false

jobs:
publish:
Expand All @@ -37,9 +47,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

steps:
- uses: actions/checkout@v4

- name: Checkout repository
uses: actions/checkout@v4
with:
# Include all tags in case the new tag already exists.
fetch-tags: true

- name: Set up Java 21
uses: actions/setup-java@v4
Expand All @@ -58,11 +72,11 @@ jobs:

- name: Create and push tag
run: |
MOD_VERSION=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d ' ')
MOD_VERSION=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
git config --global user.name "Wurst-Bot"
git config --global user.email "[email protected]"
git tag v$MOD_VERSION
git push origin v$MOD_VERSION
git tag "v$MOD_VERSION"
git push origin "v$MOD_VERSION"
- name: Close milestone
if: ${{ inputs.close_milestone }}
Expand All @@ -82,6 +96,29 @@ jobs:
if: ${{ inputs.publish_curseforge }}
run: ./gradlew publishCurseforge --stacktrace

- name: Get CurseForge file ID
id: cf_file_id
if: ${{ inputs.publish_curseforge }}
run: |
file_id=$(./gradlew getCurseforgeId | grep -o 'CURSEFORGE_FILE_ID=[0-9]*' | grep -o '[0-9]*')
echo "file_id=$file_id" >> "$GITHUB_OUTPUT"
echo "CurseForge file ID: `$file_id`" >> $GITHUB_STEP_SUMMARY
- name: Publish to Modrinth
if: ${{ inputs.publish_modrinth }}
run: ./gradlew publishModrinth --stacktrace

- name: Trigger website update
if: ${{ inputs.update_website && inputs.publish_curseforge }}
env:
GH_TOKEN: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
run: |
MOD_VERSION=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d ' \r' | sed 's/-MC.*$//')
MC_VERSION=$(grep "minecraft_version" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
gh workflow run add_mod_port.yml \
-R Wurst-Imperium/wimods.net \
-f mod="mo-glass" \
-f modloader="neoforge" \
-f mod_version="$MOD_VERSION" \
-f mc_version="$MC_VERSION" \
-f file_id="${{ steps.cf_file_id.outputs.file_id }}"
3 changes: 2 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/stale@v9
- name: Run stale bot
uses: actions/stale@v9
with:
stale-issue-message: |
This issue has been open for a while with no recent activity. If this issue is still important to you, please add a comment within the next 7 days to keep it open. Otherwise, the issue will be automatically closed to free up time for other tasks.
Expand Down
128 changes: 104 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ Mo Glass is a Minecraft mod that adds glass stairs and glass slabs, including st

![A Minecraft house with its roof made out of glass stairs, powered by the Mo Glass mod](https://user-images.githubusercontent.com/10100202/69939492-ab78a480-14e8-11ea-8aa7-c351657b334b.jpg)

## Downloads (for users)
## Downloads

[![Download Mo Glass](https://user-images.githubusercontent.com/10100202/214880552-859aa2ed-b4bc-4f8d-9ee7-bdd8c7fb33a2.png)](https://www.wimods.net/mo-glass/download/?utm_source=GitHub&utm_medium=Mo+Glass&utm_content=Mo+Glass+GitHub+repo+download+button)

## Setup (for developers)
## Installation

(This assumes that you are using Windows with [Eclipse](https://www.eclipse.org/downloads/) and [Java Development Kit 21](https://adoptium.net/?variant=openjdk21&jvmVariant=hotspot) already installed.)
> [!IMPORTANT]
> Always make sure that your modloader and all of your mods are made for the same Minecraft version. Your game will crash if you mix different versions.
1. Clone / download the repository.
### Installation using Fabric

2. Run these two commands in PowerShell:
1. Install [Fabric Loader](https://fabricmc.net/use/installer/).
2. Add [Fabric API](https://modrinth.com/mod/fabric-api) to your mods folder.
3. Add Mo Glass to your mods folder.

```powershell
./gradlew.bat --stop
./gradlew.bat eclipse
```
### Installation using NeoForge

3. In Eclipse, go to `Import...` > `Existing Projects into Workspace` and select this project.
1. Install [NeoForge](https://neoforged.net/).
2. Add Mo Glass to your mods folder.

## Features

Expand Down Expand Up @@ -59,43 +60,53 @@ That's a lot of effort just to add two new blocks to the game - and a lot of opp
<details>
<summary>*Here's how I got those numbers: (click to expand)</summary>

possible variations of stairs:
possible variations of stairs:
pvStairs = 4 * 2 * 5 = 40

possible variations of slabs:
possible variations of slabs:
pvSlabs = 3

possible variations of glass blocks:
possible variations of glass blocks:
pvGlass = 1

possible variations of non-transparent blocks:
possible variations of non-transparent blocks:
pvBlocks = 1 (because any variations would be ignored when calculating transparency)

possible combinations combined:
pvAll = pvStairs + pvSlabs + pvGlass + pvBlocks&nbsp;= 40 + 3 + 1 + 1 = 45
possible combinations combined:
pvAll = pvStairs + pvSlabs + pvGlass + pvBlocks = 40 + 3 + 1 + 1 = 45

possibly transparent faces of a block (including stairs, even though they have more faces):
possibly transparent faces of a block (including stairs, even though they have more faces):
f = 6

possible scenarios for transparency of stairs:
possible scenarios for transparency of stairs:
psStairs = pvAll * f * pvStairs = 45 * 6 * 40 = 10800

possible scenarios for transparency of slabs:
possible scenarios for transparency of slabs:
psSlabs = pvAll * f * pvSlabs = 45 * 6 * 3 = 810

possible scenarios for transparency of glass blocks:
possible scenarios for transparency of glass blocks:
psGlass = pvAll * f * pvGlass = 45 * 6 * 1 = 270

possible scenarios for transparency of glass blocks if glass stairs and slabs don't exist:
psGlassVanilla = (pvGlass + pvBlocks) * f * pvGlass = (1 + 1) * 6 * 1 = 12&nbsp;
possible scenarios for transparency of glass blocks if glass stairs and slabs don't exist:
psGlassVanilla = (pvGlass + pvBlocks) * f * pvGlass = (1 + 1) * 6 * 1 = 12
</details>

## What about connected textures mods?

~~So far, all connected textures mods that I've seen only seem to work on full blocks. They don't generate connected textures for stairs or slabs, which makes using them with Mo Glass impossible.~~

~~It's not that Mo Glass doesn't have support for connected textures, it's that connected textures mods don't have support for Mo Glass (or any other mod that adds stairs/slabs).~~

~~This might change one day as people make new mods all the time, so do let me know if there is a connected texture mod that supports stairs now. I'd be happy to add the extra texture files needed (if any) to make that work with Mo Glass.~~

This has changed and support for connected textures is currently being worked on. Please be patient.

## Crafting Recipes

<details>
<summary>Glass Slab: (click to expand)</summary>

![glass slab crafting recipse](https://user-images.githubusercontent.com/10100202/69957444-5a2ddc80-150b-11ea-8c8c-e2afc5d72fb7.png)
![glass slab crafting recipe](https://user-images.githubusercontent.com/10100202/69957444-5a2ddc80-150b-11ea-8c8c-e2afc5d72fb7.png)
![glass slab stonecutter recipe](https://user-images.githubusercontent.com/10100202/70445670-2a974b00-1a9c-11ea-9a09-46c304cd167b.png)
</details>

Expand All @@ -106,7 +117,7 @@ That's a lot of effort just to add two new blocks to the game - and a lot of opp
![glass stairs stonecutter recipe](https://user-images.githubusercontent.com/10100202/70445677-2c610e80-1a9c-11ea-8e1b-108863b47124.png)
</details>

## Supported Languages
## Supported languages

- Chinese (Simplified) (since v1.2)
- Chinese (Traditional) (since v1.2)
Expand All @@ -126,3 +137,72 @@ That's a lot of effort just to add two new blocks to the game - and a lot of opp
- Spanish (Mexico) (since v1.4)
- Spanish (Uruguay) (since v1.4)
- Spanish (Venezuela) (since v1.4)

## Development Setup

> [!IMPORTANT]
> Make sure you have [Java Development Kit 21](https://adoptium.net/?variant=openjdk21&jvmVariant=hotspot) installed. It won't work with other versions.
### Development using Eclipse

1. Clone the repository:

```pwsh
git clone https://github.com/Wurst-Imperium/Mo-Glass.git
cd Mo-Glass
```

2. Generate the sources:

In Fabric versions:
```pwsh
./gradlew genSources eclipse
```

In NeoForge versions:
```pwsh
./gradlew eclipse
```

3. In Eclipse, go to `Import...` > `Existing Projects into Workspace` and select this project.

4. **Optional:** Right-click on the project and select `Properties` > `Java Code Style`. Then under `Clean Up`, `Code Templates`, `Formatter`, import the respective files in the `codestyle` folder.

### Development using VSCode / Cursor

> [!TIP]
> You'll probably want to install the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) to make development easier.
1. Clone the repository:

```pwsh
git clone https://github.com/Wurst-Imperium/Mo-Glass.git
cd Mo-Glass
```

2. Generate the sources:

In Fabric versions:
```pwsh
./gradlew genSources vscode
```

In NeoForge versions:
```pwsh
./gradlew eclipse
```
(That's not a typo. NeoForge doesn't have `vscode`, but `eclipse` works fine.)

3. Open the `Mo-Glass` folder in VSCode / Cursor.

4. **Optional:** In the VSCode settings, set `java.format.settings.url` to `https://raw.githubusercontent.com/Wurst-Imperium/Mo-Glass/master/codestyle/formatter.xml` and `java.format.settings.profile` to `Wurst-Imperium`.

### Development using IntelliJ IDEA

I don't use or recommend IntelliJ, but the commands to run would be:

```pwsh
git clone https://github.com/Wurst-Imperium/Mo-Glass.git
cd Mo-Glass
./gradlew genSources idea
```
Loading

0 comments on commit cd2283c

Please sign in to comment.