Skip to content

Commit

Permalink
Minor changes to build process.
Browse files Browse the repository at this point in the history
- Added block to support future Gradle 7 deprecations.
- Removed `maven` dependency, as `maven-publish` contains what we need.
- Updated versions of:
  - Minecraft Version
  - Yarn Mappings
  - Fabric Loader
  - Fabric API
- Slight reformatting of JSON files.
- Slight reformatting of `Config.java`
- Added missing `getProvides()` in DummyModMetadata, which will be refactored out in the future.
  • Loading branch information
BrekiTomasson committed Jan 20, 2021
1 parent d5feed7 commit fba8bfd
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 52 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
Expand Down
31 changes: 16 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
plugins {
id 'java-library'
id 'maven'
id 'maven-publish'
id 'fabric-loom' version '0.5-SNAPSHOT'
}

apply(plugin: "java-library")
apply(plugin: "maven")
apply(plugin: "maven-publish")
apply(plugin: "fabric-loom")

Expand All @@ -27,11 +25,17 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"

// ModMenu
modImplementation("io.github.prospector:modmenu:${project.modmenu_version}") { exclude module: 'fabric-api' }
modImplementation("io.github.prospector:modmenu:${project.modmenu_version}") {
exclude module: 'fabric-api'
}

// Auto Config & Cloth Config
modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}") { exclude module: 'fabric-api' }
modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") { exclude module: 'fabric-api' }
modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}") {
exclude module: 'fabric-api'
}
modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") {
exclude module: 'fabric-api'
}
include "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}"
include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
}
Expand All @@ -42,7 +46,7 @@ processResources {

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand (
expand(
"version": project.version,
"minecraft_version": project.minecraft_version,
"maven_group": project.maven_group,
Expand All @@ -55,6 +59,10 @@ processResources {
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}

task archive(type: Zip) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

tasks.withType(JavaCompile).configureEach() {
Expand All @@ -75,21 +83,14 @@ jar {
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
artifact(remapJar) { builtBy remapJar }
artifact(sourcesJar) { builtBy remapSourcesJar }
}
}

// select the repositories you want to publish to
repositories {
// mavenLocal()
}
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.7
fabric_loader_version=0.10.8
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.1
fabric_loader_version=0.11.1

# Mod Properties
mod_version=1.5.0
Expand All @@ -14,7 +14,7 @@ mod_id=fallingleaves
archives_base_name=fallingleaves

# Required Dependencies
fabric_api_version=0.28.3+1.16
fabric_api_version=0.29.4+1.16
autoconfig_version=3.3.1
cloth_config_version=4.8.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Environment(EnvType.CLIENT)
public class FallingLeavesClient implements ClientModInitializer {

/** The mod's unique identifier, used to avoid mod conflicts in both the registry and config files */
/** The mod's unique identifier, used to avoid mod conflicts in the Registry and config files */
public static final String MOD_ID = "fallingleaves";

public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
Expand All @@ -21,4 +21,5 @@ public void onInitializeClient() {
Config.init();
Leaves.init();
}

}
23 changes: 13 additions & 10 deletions src/main/java/randommcsomethin/fallingleaves/init/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ public static void init() {
configHolder = AutoConfig.register(FallingLeavesConfig.class, GsonConfigSerializer::new);
CONFIG = configHolder.getConfig();

if (CONFIG.displayDebugData && LOGGER.getLevel().compareTo(Level.DEBUG) < 0)
// Note: Configurator.setLevel() might not be supported in future versions of log4j.
if (CONFIG.displayDebugData && LOGGER.getLevel().compareTo(Level.DEBUG) < 0) {
Configurator.setLevel(LOGGER.getName(), Level.DEBUG);
}

AutoConfig.getGuiRegistry(FallingLeavesConfig.class)
.registerPredicateProvider(
new LeafSettingsGuiProvider(),
(Field field) -> field.getName().equals("leafSettings")
);
AutoConfig.getGuiRegistry(FallingLeavesConfig.class).registerPredicateProvider(
new LeafSettingsGuiProvider(),
(Field field) -> field.getName().equals("leafSettings")
);

LOGGER.debug("Loaded configuration.");
}
Expand All @@ -58,25 +59,27 @@ private static void migrateOldConfig() {
}

// v1 can successfully load as v0, so we test the added version field
if (oldConfig.version != 0)
if (oldConfig.version != 0) {
return;
}

LOGGER.info("Migrating old v0 config");

FallingLeavesConfig newConfig = new FallingLeavesConfig();

// In 1.4 leafSize was a double with default 0.1, which matches newConfig.getLeafSize()
newConfig.setLeafSize(oldConfig.leafSize);

// leafLifespan was untouched
newConfig.leafLifespan = oldConfig.leafLifespan;

// Actual spawn rates did not change
newConfig.setLeafSpawnRate(oldConfig.leafRate);
newConfig.setConiferLeafSpawnRate(oldConfig.coniferLeafRate);

// Conifer Leaves were moved to Leaf Settings
for (String leafId : oldConfig.coniferLeafIds) {
newConfig.updateLeafSettings(leafId, (entry) -> {
entry.isConiferBlock = true;
});
newConfig.updateLeafSettings(leafId, (entry) -> entry.isConiferBlock = true);
}

// Rate Overrides were replaced by Spawn Rate Factors/Multipliers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

import static randommcsomethin.fallingleaves.init.Config.CONFIG;

/**
* TODO - Plenty of "Magic numbers" in this class that we may want to get rid of
* or, at the very least, define as class constants at the head of the file.
*/

public class FallingLeafParticle extends SpriteBillboardParticle {

private final float rotateFactor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public String getId() {
return id;
}

@Override
public Collection<String> getProvides() {
return null;
}

@Override
public Version getVersion() {
return new StringVersion("1");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"textures": [
"fallingleaves:falling_leaf_1",
"fallingleaves:falling_leaf_2",
"fallingleaves:falling_leaf_3"
]
{
"textures": [
"fallingleaves:falling_leaf_1",
"fallingleaves:falling_leaf_2",
"fallingleaves:falling_leaf_3"
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"textures": [
"fallingleaves:falling_leaf_conifer_1",
"fallingleaves:falling_leaf_conifer_2",
"fallingleaves:falling_leaf_conifer_3"
]
{
"textures": [
"fallingleaves:falling_leaf_conifer_1",
"fallingleaves:falling_leaf_conifer_2",
"fallingleaves:falling_leaf_conifer_3"
]
}
21 changes: 13 additions & 8 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,34 @@
"id": "fallingleaves",
"version": "${version}",
"name": "Falling Leaves",
"description": "\"How the gentle wind beckons through the leaves as autumn colors fall,\ndancing in a swirl of golden memories: the loveliest lies of all.\"",
"authors": ["RandomMcSomethin", "BrekiTomasson", "Fourmisain"],
"description": "How the gentle wind beckons through the leaves as autumn colors fall, dancing in a swirl of golden memories: the loveliest lies of all.",
"authors": [
"Fourmisain",
"BrekiTomasson",
"RandomMcSomethin"
],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/falling-leaves-fabric",
"issues": "https://github.com/RandomMcSomethin/fallingleaves/issues",
"sources": "https://github.com/RandomMcSomethin/fallingleaves"
},
"license": "MIT",
"icon": "assets/${mod_id}/icon.png",
"icon": "assets/fallingleaves/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"${maven_group}.${mod_id}.FallingLeavesClient"
"randommcsomethin.fallingleaves.FallingLeavesClient"
],
"modmenu": [
"${maven_group}.${mod_id}.config.FallingLeavesMenu"
"randommcsomethin.fallingleaves.config.FallingLeavesMenu"
]
},
"mixins": [
"${mod_id}.mixins.json"
"fallingleaves.mixins.json"
],
"depends": {
"fabricloader": ">=0.10.6",
"fabric": "*",
"fabricloader": ">=0.11.1",
"fabric": ">=0.29.0",
"minecraft": "1.16.x"
}
}

0 comments on commit fba8bfd

Please sign in to comment.