Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Growthcraft Decorations 1.20.6.1 Release #26

Merged
merged 5 commits into from
Jun 17, 2024
Merged
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
6 changes: 4 additions & 2 deletions .github/workflows/growthcraft-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
Expand All @@ -33,6 +33,8 @@ jobs:
restore-keys: ${{ runner.os }}-gradle
- name: Setup Gradle
run: chmod +x gradlew
- name: DataGen Resources
run: ./gradlew runData
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
58 changes: 35 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id "org.sonarqube" version "4.2.1.3168"
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
id "org.sonarqube" version "5.0.0.4638"
}

version = "${minecraft_version}-${mod_version}"
Expand All @@ -21,7 +21,8 @@ sonarqube {
}
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

println('========================================')
println('Java: ' + System.getProperty('java.version'))
Expand All @@ -32,6 +33,7 @@ println('----------------------------------------')

minecraft {
mappings channel: mapping_channel, version: mapping_version
reobf = false
copyIdeResources = true

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
Expand All @@ -42,12 +44,6 @@ minecraft {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

//mods {
// "${mod_id}" {
// source sourceSets.main
// }
//}
}

client {
Expand Down Expand Up @@ -79,8 +75,9 @@ repositories {

dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
//runtimeOnly fg.deobf("curse.maven:theoneprobe-${curseforge_theoneprobe}")
//runtimeOnly fg.deobf("curse.maven:jei-${curseforge_jei}")

// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
}

// This block of code expands all declared replace properties in the specified resource targets.
Expand All @@ -89,11 +86,17 @@ dependencies {
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range,
minecraft_version: minecraft_version,
minecraft_version_range: minecraft_version_range,
forge_version: forge_version,
forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors : mod_authors, mod_description: mod_description,
mod_id: mod_id,
mod_name: mod_name,
mod_license: mod_license,
mod_version: mod_version,
mod_authors: mod_authors,
mod_description: mod_description,
]
inputs.properties replaceProperties

Expand All @@ -115,16 +118,8 @@ tasks.named('jar', Jar).configure {
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}

// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}

// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
// }

// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
Expand All @@ -142,3 +137,20 @@ publishing {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

eclipse {
// Run everytime eclipse builds the code
//autoBuildTasks genEclipseRuns
// Run when importing the project
synchronizationTasks 'genEclipseRuns'
}

// Merge the resources and classes into the same directory.
// This is done because java expects modules to be in a single directory.
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}
14 changes: 9 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false


## Environment Properties

# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20.4
minecraft_version=1.20.6
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.4,1.21)
minecraft_version_range=[1.20.6,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=49.1.0
forge_version=50.1.0
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[0,)
# The loader version range can only use the major version of Forge/FML as bounds
Expand All @@ -32,7 +35,8 @@ loader_version_range=[0,)
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.20.4
mapping_version=1.20.6


## Mod Properties

Expand All @@ -44,7 +48,7 @@ mod_name=Growthcraft Decorations
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GNU General Public License v3.0
# The mod version. See https://semver.org/
mod_version=1.20.4.1
mod_version=1.20.6.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
7 changes: 0 additions & 7 deletions src/main/java/growthcraft/deco/GrowthcraftDeco.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.MissingMappingsEvent;
import org.apache.logging.log4j.LogManager;
Expand All @@ -26,7 +25,6 @@ public class GrowthcraftDeco {

public GrowthcraftDeco() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::setup);
modEventBus.addListener(this::clientSetupEvent);

GrowthcraftDecoBlocks.BLOCKS.register(modEventBus);
Expand All @@ -39,15 +37,10 @@ public GrowthcraftDeco() {

}

private void setup(final FMLCommonSetupEvent event) {
// Do nothing for now ...
}

private void clientSetupEvent(final FMLClientSetupEvent event) {
GrowthcraftDecoBlockRenderers.registerBlockRenders();
}

// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {
// do something when the server starts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -26,8 +27,8 @@ public static void gatherData(GatherDataEvent event) {
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();

generator.addProvider(true, new GrowthcraftDecoRecipeProvider(packOutput));
generator.addProvider(true, GrowthcraftDecoLootTableProvider.create(packOutput));
generator.addProvider(true, new GrowthcraftDecoRecipeProvider(packOutput, lookupProvider));
generator.addProvider(true, GrowthcraftDecoLootTableProvider.create(packOutput, lookupProvider));
generator.addProvider(true, new GrowthcraftDecoBlockStateProvider(packOutput, existingFileHelper));
generator.addProvider(true, new GrowthcraftDecoItemModelProvider(packOutput, existingFileHelper));
generator.addProvider(true, new GrowthcraftDecoBlockTagsProvider(packOutput, Registries.BLOCK, lookupProvider, "minecraft", existingFileHelper));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
package growthcraft.deco.datagen.providers;

import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;

import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

/**
* @credit Kaupenjoe for his DataGenerator tutorials
*/
public class GrowthcraftDecoLootTableProvider {
public static LootTableProvider create(PackOutput output) {
public static LootTableProvider create(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
return new LootTableProvider(
output,
Set.of(),
List.of(new LootTableProvider.SubProviderEntry(GrowthcraftDecoBlockLootTables::new, LootContextParamSets.BLOCK))
List.of(new LootTableProvider.SubProviderEntry(GrowthcraftDecoBlockLootTables::new, LootContextParamSets.BLOCK)),
lookupProvider
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import growthcraft.deco.init.GrowthcraftDecoBlocks;
import growthcraft.deco.init.GrowthcraftDecoTags;
import growthcraft.deco.shared.Reference;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.*;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -13,14 +14,16 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.crafting.conditions.IConditionBuilder;

import java.util.concurrent.CompletableFuture;

/**
* @credit Kaupenjoe for his DataGenerator tutorials
*/
public class GrowthcraftDecoRecipeProvider extends RecipeProvider implements IConditionBuilder {


public GrowthcraftDecoRecipeProvider(PackOutput packOutput) {
super(packOutput);
public GrowthcraftDecoRecipeProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ credits = "Thanks to Gwafu for starting a great mod. And the Growthcraft CE Deve
authors = "${mod_authors}"
description = '''${mod_description}'''

[[dependencies.${ mod_id }]] #optional
[[dependencies.${mod_id}]] #optional
modId = "forge" #mandatory
mandatory = true #mandatory
versionRange = "${forge_version_range}" #mandatory
ordering = "NONE"
side = "BOTH"
[[dependencies.${ mod_id }]]
[[dependencies.${mod_id}]]
modId = "minecraft"
mandatory = true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"pack": {
"description": "Growthcraft Decoration resources",
"pack_format": 9,
"forge:resource_pack_format": 9,
"forge:data_pack_format": 10
"pack_format": 32
}
}
Loading