Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NaoCraftLab authored Oct 9, 2024
1 parent f94a169 commit e19082e
Show file tree
Hide file tree
Showing 35 changed files with 2,809 additions and 348 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

release:
runs-on: ubuntu-latest
if: github.event_name == 'create'
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -147,4 +147,4 @@ jobs:
- name: Publish to CurseForge
run: ./gradlew curseforge
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ bin/

### Eclipse ###
*.launch

### Project ###
logs/
local/
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
1.21.2-2.0.0

### Added
- New fog preset format allowing you to add different fog based on selected conditions
- Automatic migration from configuration v1 to v2
- Ability to save any number of fog presets and select the active one through the mod’s config
- Presets can apply different fog settings based on biome, difficulty level, weather, and time
- Preset application conditions support logical operations AND, OR, and NOT
- When configuring fog, you can set the color based on in-game fog or a custom HEX value
- When configuring fog, you can set the brightness based on in-game fog or a custom value

## 1.21.2-1.2.1

### Fixed
Expand Down
189 changes: 150 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Foggy Pale Garden

---
A Minecraft mod that adds thick fog to the Pale Garden biome.
A Minecraft mod that adds fog to the Pale Garden biome. But you can customize any kind of fog anywhere you like!

---

Expand Down Expand Up @@ -37,6 +37,48 @@ A Minecraft mod that adds thick fog to the Pale Garden biome.

</details>

<details>
<summary>🔧 Create different types of fog based on any set of conditions</summary>

For example, this preset will create pre-dawn fog during clear weather in all biomes.

![custom-preset-pre-dawn-fog.gif](docs/images/custom-preset-pre-dawn-fog.gif)

```json
{
"code": "PRE_DAWN_FOG",
"bindings": [
{
"condition": {
"and": [
{ "timeIn": { "start": 22500, "end": 23800 } },
{ "weatherIn": ["CLEAR"] }
]
},
"startDistance": 0.0,
"skyLightStartLevel": 4,
"endDistance": 15.0,
"surfaceHeightEnd": 15.0,
"opacity": 50.0,
"encapsulationSpeed": 16.0,
"brightness": {
"mode": "BY_GAME_FOG"
},
"color": {
"mode": "BY_GAME_FOG"
}
}
],
"version": 2
}
```

To apply it, create a file `PRE_DAWN_FOG.json` with this content in the `config/foggypalegarden` folder and set the value `"preset": "PRE_DAWN_FOG"` in `config/foggy-pale-garden.json`.

Read more about the available features in the [🛠️ Configuration](#-configuration) section.

</details>

## 📥 Installation

1. Install Minecraft version `24w40a` or newer
Expand All @@ -47,54 +89,119 @@ A Minecraft mod that adds thick fog to the Pale Garden biome.

## 🛠️ Configuration

To change the configuration of the mod, edit the `config/foggy-pale-garden.json` file and restart the game.

<details>
<summary>Available configuration options</summary>

The configuration file is located at `config/foggy-pale-garden.json` and allows you to set one of the available fog presets.

```json
{
// active fog preset
"preset": "FPG_STEPHEN_KING",

// config schema version (do not change this value)
"version": 2
}
```

// List of biomes where the fog will be active
"biomes": [
"minecraft:pale_garden"
],

// Fog preset:
// DIFFICULTY_BASED - depends on the world's difficulty level
// AMBIANCE - atmospheric fog that doesn't consider the biome's mechanics
// I_AM_NOT_AFRAID_BUT - denser fog that hides monsters but maintains enough visibility
// STEPHEN_KING - fog similar to the movie The Mist, concealing monsters to allow them to attack suddenly
// CUSTOM - your custom settings specified in the "customFog" section
"fogPreset": "STEPHEN_KING",

// Your custom fog settings (applies when using "fogPreset": "CUSTOM")
"customFog": {

// Distance (in blocks) at which the fog starts
"startDistance": 0.0,

// Sky light level (1-15) below which the fog disperses. The lower the value, the deeper the fog will descend into caves
"skyLightStartLevel": 4,

// Distance (in blocks) at which the fog ends and nothing is visible beyond
"endDistance": 10.0,

// Player's height above the surface after which the fog disperses
"surfaceHeightEnd": 15.0,

// Fog opacity percentage
"opacity": 100.0,

// Speed of fog spread (in blocks per second) when entering or exiting the biome
"encapsulationSpeed": 6.0
},
Preset files are located in the `config/foggypalegarden` directory. Each file contains the full fog settings for the game.

// Configuration file version. Do not change this parameter manually!
"version": 1
```json
{

// preset code (you need to specify this value in config/foggy-pale-garden.json to apply the preset)
"code": "MY_PRESET",

// a set of bindings, each responsible for your configured fog appearance and applied based on specified conditions
"bindings": [

{

// condition under which this binding is applied
// has a tree-like structure (you can place other conditions inside and, or, not)
// only one field can be filled at the same time in one condition
// correct - { "and": [{ "biomeIdIn": ["minecraft:desert"] }, { "difficultyIn": ["HARD"] }] }
// incorrect - { "biomeIdIn": ["minecraft:desert"], "difficultyIn": ["HARD"] }
"condition": {

// (optional) list of biomes where this binding is applied
"biomeIdIn": [""],

// (optional) list of difficulty levels where this binding is applied
"difficultyIn": [""],

// (optional) list of weather conditions where this binding is applied
"weatherIn": [""],

// (optional) time range during which this binding is applied (start can be greater than end)
"timeIn": { "start": 0, "end": 0 },

// (optional) group of conditions that must all be met for this binding to be applied
"and": [{}],
// (optional) list of conditions where at least one must be met for this binding to be applied
"or": [{}],

// (optional) condition that must not be met for this binding to be applied
"not": {}
},

// (optional) distance (in blocks) at which the fog starts (cannot be negative)
"startDistance": 0.0,

// (optional) sky light level [0, 15] below which the fog dissipates. The lower the value, the deeper the fog will descend into caves
// if not set, the fog extends down to bedrock
"skyLightStartLevel": 0,

// (optional) distance (in blocks) at which the fog ends (cannot be negative)
"endDistance": 0.0,

// (optional) player height above the surface after which the fog dissipates (cannot be negative)
// if not set, the fog extends up to the top of the world
"surfaceHeightEnd": 0.0,

// (optional) fog density in percent (0.0, 100.0]
"opacity": 0.0,

// (optional) fog spread speed (in blocks per second) when entering or exiting it (cannot be less than or equal to 0)
"encapsulationSpeed": 0.0,

// (optional) fog brightness settings
"brightness": {

// mode of fog brightness calculation
// BY_GAME_FOG - brightness is calculated based on in-game fog brightness
// FIXED - manually set brightness
"mode": "FIXED",

// (required for FIXED mode) fog brightness level in percent (0.0, 100.0]
"fixedBrightness": 0.0
},

// (optional) fog color settings
"color": {

// mode of fog color calculation
// BY_GAME_FOG - uses in-game fog color
// FIXED - manually set fog color
"mode": "FIXED",

// (required for FIXED mode) fog color in HEX format (without #)
"fixedHex": "f0f0f0"
}
},
{
// another binding
}
],

// preset schema version (do not change this value)
"version": 2
}
```

Examples of presets can be found in the [GitHub repository](docs/presets).

</details>

## 💥 Compatibility with Other Mods
Expand All @@ -105,9 +212,13 @@ If you encounter compatibility issues between Foggy Pale Garden and other mods,

- [x] Add fog to the Pale Garden
- [x] Add configurations
- [ ] Port to previous game versions and add support for mods backporting the Pale Garden
- [ ] Disable fog based on game mode
- [ ] Apply fog conditions depending on player’s current dimension
- [ ] Apply fog conditions based on biome temperature
- [ ] Control the shape of fog
- [ ] (After the Winter Drop release) Port to NeoForge
- [ ] (After the Winter Drop release) Add visual configuration
- [ ] Port to previous game versions and add support for mods backporting the Pale Garden

## 🤗 Modpacks

Expand Down
51 changes: 31 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ repositories {
}

dependencies {
compileOnly("org.projectlombok:lombok:1.18.34")
annotationProcessor("org.projectlombok:lombok:1.18.34")
minecraft("com.mojang:minecraft:${project.property("minecraftFirstSnapshotVersion")}")
mappings("net.fabricmc:yarn:${project.property("fabricYarnMappingsVersion")}:v2")
modImplementation("net.fabricmc:fabric-loader:${project.property("fabricLoaderMinVersion")}")

testCompileOnly("org.projectlombok:lombok:1.18.34")
testAnnotationProcessor("org.projectlombok:lombok:1.18.34")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
testImplementation("org.mockito:mockito-core:4.0.0")
testImplementation("org.assertj:assertj-core:3.21.0")
testImplementation("org.skyscreamer:jsonassert:1.5.0")
}

tasks.processResources {
Expand All @@ -49,14 +54,17 @@ tasks.processResources {
}
}

java {
withSourcesJar()
}

tasks.withType<JavaCompile>().configureEach {
options.release.set(project.property("minecraftJavaVersion").toString().toInt())
options.annotationProcessorPath = configurations.annotationProcessor.get()
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8

withSourcesJar()
tasks.test {
useJUnitPlatform()
}

tasks.jar {
Expand Down Expand Up @@ -97,23 +105,26 @@ fun getChangelogForVersion(version: String): String {
}
}

modrinth {
token.set(project.findProperty("modrinthToken")?.toString() ?: System.getenv("MODRINTH_TOKEN"))
projectId.set(project.property("modId").toString())
versionNumber.set(project.version.toString())
versionName.set("${project.property("minecraftReleaseVersion")}-${project.property("modVersion")}")
versionType.set("release")
uploadFile.set(File("build/libs/${project.base.archivesName.get()}-${project.version}.jar"))
changelog.set(getChangelogForVersion("${project.property("minecraftReleaseVersion")}-${project.property("modVersion")}"))
gameVersions.set(
listOf(
project.property("minecraftFirstSnapshotVersion").toString(),
// TODO check versions
// project.property("minecraftReleaseVersion").toString()
val modrinthToken = project.findProperty("modrinthToken")?.toString() ?: System.getenv("MODRINTH_TOKEN")
if (modrinthToken != null) {
modrinth {
token.set(modrinthToken)
projectId.set(project.property("modId").toString())
versionNumber.set(project.version.toString())
versionName.set("${project.property("minecraftReleaseVersion")}-${project.property("modVersion")}")
versionType.set("release")
uploadFile.set(File("build/libs/${project.base.archivesName.get()}-${project.version}.jar"))
changelog.set(getChangelogForVersion("${project.property("minecraftReleaseVersion")}-${project.property("modVersion")}"))
gameVersions.set(
listOf(
project.property("minecraftFirstSnapshotVersion").toString(),
// TODO check versions
// project.property("minecraftReleaseVersion").toString()
)
)
)
loaders.set(project.property("fabricSupportedLoaders").toString().split(',').map { it.trim().lowercase() })
additionalFiles.set(listOf(File("build/libs/${project.base.archivesName.get()}-${project.version}-sources.jar")))
loaders.set(project.property("fabricSupportedLoaders").toString().split(',').map { it.trim().lowercase() })
additionalFiles.set(listOf(File("build/libs/${project.base.archivesName.get()}-${project.version}-sources.jar")))
}
}

val curseForgeApiKey = project.findProperty("curseforgeApiKey")?.toString() ?: System.getenv("CURSEFORGE_API_KEY")
Expand Down
Binary file added docs/images/custom-preset-pre-dawn-fog.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/presets/custom/PRE_DAWN_FOG.v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"code": "PRE_DAWN_FOG",
"bindings": [
{
"condition": {
"and": [
{ "timeIn": { "start": 22500, "end": 23800 } },
{ "weatherIn": ["CLEAR"] }
]
},
"startDistance": 0.0,
"skyLightStartLevel": 4,
"endDistance": 15.0,
"surfaceHeightEnd": 15.0,
"opacity": 50.0,
"encapsulationSpeed": 16.0,
"brightness": {
"mode": "BY_GAME_FOG"
},
"color": {
"mode": "BY_GAME_FOG"
}
}
],
"version": 2
}
Loading

0 comments on commit e19082e

Please sign in to comment.