Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ on:

jobs:
build:
if: github.event.pull_request.draft == false
name: Build the project (using Java ${{ matrix.java }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ 21 ]
os: [ ubuntu-latest ]
name: Build the project (Java ${{ matrix.java }}, on ${{ matrix.os }}))
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
steps:

- name: Checkout repository
uses: actions/checkout@v2

Expand All @@ -35,6 +34,9 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew

- name: Run Spotless check
run: ./gradlew spotlessCheck

- name: Generate data files
run: ./gradlew runDatagen

Expand Down
11 changes: 11 additions & 0 deletions HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2020, 2021, 2022, 2023, 2024, 2025 Hugman
*
* This software is licensed under the PolyForm Shield License 1.0.0.
* You may obtain a copy of the License at
*
* https://polyformproject.org/licenses/shield/1.0.0
*
* You may use this software only for non-commercial purposes.
* For commercial use, you must obtain a separate commercial license.
*/
118 changes: 72 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,92 +1,118 @@
plugins {
id 'fabric-loom' version "${loom_version}"
id 'org.moddedmc.wiki.toolkit' version '0.2.7'
id 'fabric-loom' version "${loom_version}"
id 'org.moddedmc.wiki.toolkit' version '0.2.7'
id "com.diffplug.spotless" version "8.0.0"
}

group = "com.github.hugman"

base {
archivesName = project.mod_id
archivesName = project.mod_id
}

repositories {
maven { url 'https://maven.terraformersmc.com/' } // Required for Biolith
maven { url 'https://maven.terraformersmc.com/' } // Required for Biolith
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi include ("com.terraformersmc:biolith-fabric:${biolith_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modApi include("com.terraformersmc:biolith-fabric:${biolith_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

compileOnly "com.google.code.findbugs:jsr305:3.0.2"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"

// Version list: https://maven.sinytra.org/org/sinytra/item-asset-export-fabric
//modRuntimeOnly "org.sinytra:item-asset-export-fabric:1.1.0+1.21.4" FIXME not updated for 1.21.5 yet
// Version list: https://maven.sinytra.org/org/sinytra/item-asset-export-fabric
//modRuntimeOnly "org.sinytra:item-asset-export-fabric:1.1.0+1.21.4" FIXME not updated for 1.21.5 yet
}

loom {
accessWidenerPath = file("src/main/resources/promenade.accesswidener")
accessWidenerPath = file("src/main/resources/promenade.accesswidener")

splitEnvironmentSourceSets()
splitEnvironmentSourceSets()

mods {
"promenade" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
mods {
"promenade" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}

fabricApi {
configureDataGeneration() {
modId = "promenade-datagen"
createSourceSet = true
client = true
}
configureDataGeneration() {
modId = "promenade-datagen"
createSourceSet = true
client = true
}
}

processResources {
inputs.property "version", project.version
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
it.options.encoding = "UTF-8"
it.options.release = 21
}

java {
withSourcesJar()
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

// for JitPack
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

wiki {
docs {
promenade {
root = file('docs')
exportedAssetNamespaces = ['promenade']
}
}
docs {
promenade {
root = file('docs')
exportedAssetNamespaces = ['promenade']
}
}
}

// Spotless - Java CodeStyle
spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX

java {
licenseHeaderFile(rootProject.file("HEADER"))
removeUnusedImports()
importOrder('java', 'javax', '', 'net.minecraft', 'net.fabricmc', 'fr.hugman')
leadingSpacesToTabs()
trimTrailingWhitespace()
}

groovyGradle {
target 'src/**/*.gradle', '*.gradle', 'gradle/*.gradle'
greclipse()
}

// Sort the en_us translation files
json {
target 'src/**/lang/en_us.json'
targetExclude 'src/**/generated/**'
gson().indentWithSpaces(2)
}
}
30 changes: 21 additions & 9 deletions src/client/java/fr/hugman/promenade/client/PromenadeClient.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
/*
* Copyright (c) 2020, 2021, 2022, 2023, 2024, 2025 Hugman
*
* This software is licensed under the PolyForm Shield License 1.0.0.
* You may obtain a copy of the License at
*
* https://polyformproject.org/licenses/shield/1.0.0
*
* You may use this software only for non-commercial purposes.
* For commercial use, you must obtain a separate commercial license.
*/
package fr.hugman.promenade.client;

import net.fabricmc.api.ClientModInitializer;

import fr.hugman.promenade.client.color.PromenadeBlockColors;
import fr.hugman.promenade.client.particle.PromenadeParticleFactories;
import fr.hugman.promenade.client.render.block.PromenadeBlockRenderLayers;
import fr.hugman.promenade.client.render.entity.PromenadeEntityRenderers;
import fr.hugman.promenade.client.render.entity.model.PromenadeEntityModelLayers;
import net.fabricmc.api.ClientModInitializer;

public class PromenadeClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
PromenadeEntityModelLayers.register();
PromenadeBlockRenderLayers.register();
PromenadeBlockColors.register();
PromenadeEntityRenderers.register();
PromenadeParticleFactories.register();
}
@Override
public void onInitializeClient() {
PromenadeEntityModelLayers.register();
PromenadeBlockRenderLayers.register();
PromenadeBlockColors.register();
PromenadeEntityRenderers.register();
PromenadeParticleFactories.register();
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
/*
* Copyright (c) 2020, 2021, 2022, 2023, 2024, 2025 Hugman
*
* This software is licensed under the PolyForm Shield License 1.0.0.
* You may obtain a copy of the License at
*
* https://polyformproject.org/licenses/shield/1.0.0
*
* You may use this software only for non-commercial purposes.
* For commercial use, you must obtain a separate commercial license.
*/
package fr.hugman.promenade.client.color;

import fr.hugman.promenade.block.PromenadeBlocks;
import fr.hugman.promenade.world.biome.PromenadeFoliageColors;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.world.biome.FoliageColors;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.world.biome.FoliageColors;

import fr.hugman.promenade.block.PromenadeBlocks;
import fr.hugman.promenade.world.biome.PromenadeFoliageColors;

@Environment(EnvType.CLIENT)
public final class PromenadeBlockColors {
public static void register() {
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> PromenadeFoliageColors.PALM, PromenadeBlocks.PALM_LEAVES, PromenadeBlocks.SNOWY_PALM_LEAVES, PromenadeBlocks.PALM_HANGING_LEAVES, PromenadeBlocks.PALM_LEAF_PILE);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> pos != null && world != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.DEFAULT,
PromenadeBlocks.SNOWY_OAK_LEAVES, PromenadeBlocks.SNOWY_JUNGLE_LEAVES, PromenadeBlocks.SNOWY_ACACIA_LEAVES, PromenadeBlocks.SNOWY_DARK_OAK_LEAVES, PromenadeBlocks.SNOWY_MANGROVE_LEAVES,
PromenadeBlocks.OAK_LEAF_PILE, PromenadeBlocks.JUNGLE_LEAF_PILE, PromenadeBlocks.ACACIA_LEAF_PILE, PromenadeBlocks.DARK_OAK_LEAF_PILE, PromenadeBlocks.MANGROVE_LEAF_PILE,
PromenadeBlocks.SAP_MAPLE_LEAVES, PromenadeBlocks.SNOWY_SAP_MAPLE_LEAVES, PromenadeBlocks.SAP_MAPLE_LEAF_PILE, PromenadeBlocks.FALLEN_SAP_MAPLE_LEAVES,
PromenadeBlocks.SNOWY_OAK_LEAVES, PromenadeBlocks.SNOWY_JUNGLE_LEAVES
);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> FoliageColors.SPRUCE, PromenadeBlocks.SPRUCE_LEAF_PILE, PromenadeBlocks.SNOWY_SPRUCE_LEAVES);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> FoliageColors.BIRCH, PromenadeBlocks.BIRCH_LEAF_PILE, PromenadeBlocks.SNOWY_BIRCH_LEAVES);
}
public static void register() {
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> PromenadeFoliageColors.PALM, PromenadeBlocks.PALM_LEAVES, PromenadeBlocks.SNOWY_PALM_LEAVES, PromenadeBlocks.PALM_HANGING_LEAVES, PromenadeBlocks.PALM_LEAF_PILE);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> pos != null && world != null ? BiomeColors.getFoliageColor(world, pos) : FoliageColors.DEFAULT,
PromenadeBlocks.SNOWY_OAK_LEAVES, PromenadeBlocks.SNOWY_JUNGLE_LEAVES, PromenadeBlocks.SNOWY_ACACIA_LEAVES, PromenadeBlocks.SNOWY_DARK_OAK_LEAVES, PromenadeBlocks.SNOWY_MANGROVE_LEAVES,
PromenadeBlocks.OAK_LEAF_PILE, PromenadeBlocks.JUNGLE_LEAF_PILE, PromenadeBlocks.ACACIA_LEAF_PILE, PromenadeBlocks.DARK_OAK_LEAF_PILE, PromenadeBlocks.MANGROVE_LEAF_PILE,
PromenadeBlocks.SAP_MAPLE_LEAVES, PromenadeBlocks.SNOWY_SAP_MAPLE_LEAVES, PromenadeBlocks.SAP_MAPLE_LEAF_PILE, PromenadeBlocks.FALLEN_SAP_MAPLE_LEAVES,
PromenadeBlocks.SNOWY_OAK_LEAVES, PromenadeBlocks.SNOWY_JUNGLE_LEAVES
);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> FoliageColors.SPRUCE, PromenadeBlocks.SPRUCE_LEAF_PILE, PromenadeBlocks.SNOWY_SPRUCE_LEAVES);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> FoliageColors.BIRCH, PromenadeBlocks.BIRCH_LEAF_PILE, PromenadeBlocks.SNOWY_BIRCH_LEAVES);
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
/*
* Copyright (c) 2020, 2021, 2022, 2023, 2024, 2025 Hugman
*
* This software is licensed under the PolyForm Shield License 1.0.0.
* You may obtain a copy of the License at
*
* https://polyformproject.org/licenses/shield/1.0.0
*
* You may use this software only for non-commercial purposes.
* For commercial use, you must obtain a separate commercial license.
*/
package fr.hugman.promenade.client.particle;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.jetbrains.annotations.Nullable;

import net.minecraft.client.particle.LeavesParticle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.util.math.random.Random;
import org.jetbrains.annotations.Nullable;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

public class PromenadeLeavesParticleFactories {
@Environment(EnvType.CLIENT)
public static class MapleLeavesFactory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;
@Environment(EnvType.CLIENT)
public static class MapleLeavesFactory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;

public MapleLeavesFactory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}
public MapleLeavesFactory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}

@Override
public @Nullable Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, Random random) {
return new LeavesParticle(world, x, y, z, this.spriteProvider.getSprite(random), 0.07F, 5.0F, true, false, 1.5F, 0.021F);
}
}
@Override
public @Nullable Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, Random random) {
return new LeavesParticle(world, x, y, z, this.spriteProvider.getSprite(random), 0.07F, 5.0F, true, false, 1.5F, 0.021F);
}
}
}
Loading