Skip to content

Commit

Permalink
1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
MORIMORI0317 committed Jun 11, 2023
1 parent 0dd3aa5 commit 436fe90
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
path: build/libs/
81 changes: 28 additions & 53 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
id 'fabric-loom' version '1.2-SNAPSHOT'
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
// To use SML, you need to add the FelNullMaven repository
maven {
name = "FelNull Maven"
url = "https://maven.felnull.dev"
}
}

sourceSets {
main {
resources {
Expand All @@ -17,6 +28,15 @@ sourceSets {
}

loom {
splitEnvironmentSourceSets()

mods {
"sml-example-mod" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

runs {
datagen {
server()
Expand All @@ -31,42 +51,18 @@ loom {
}
assemble.dependsOn runDatagen

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.

maven {
name = "FelNull Maven"
url = "https://maven.felnull.dev"
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
/*mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"*/
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi "dev.felnull:special-model-loader:1.1.0"

//↓ Required for inclusion in jar in jar
include "dev.felnull:special-model-loader:1.0.0"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}
// Using the SML API
modApi "dev.felnull:special-model-loader:1.2.0"

base {
archivesName = project.archives_base_name
// Required for inclusion in jar in jar
include "dev.felnull:special-model-loader:1.2.0"
}

processResources {
Expand All @@ -78,14 +74,10 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -94,23 +86,6 @@ java {

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

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.17
# check these on https://fabricmc.net/develop
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21

# Mod Properties
mod_version = 1.0.0
maven_group = com.example
archives_base_name = fabric-example-mod
mod_version=1.0.0
maven_group=com.example
archives_base_name = sml-example-mod

# Dependencies
fabric_version=0.75.3+1.19.4
fabric_version=0.83.0+1.20
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.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 4 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -197,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
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
}
}
}
16 changes: 7 additions & 9 deletions src/main/java/dev/felnull/smlexample/SMLExampleItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ public static void init() {
register("obj_model_item2", OBJ_MODEL_ITEM2);
register("custom_model_data_obj_model_item", CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);

ItemGroupEvents.MODIFY_ENTRIES_ALL.register((group, entries) -> {
if (group == CreativeModeTabs.BUILDING_BLOCKS) {
entries.accept(OBJ_MODEL_ITEM);
entries.accept(OBJ_MODEL_ITEM2);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(ct -> {
ct.accept(OBJ_MODEL_ITEM);
ct.accept(OBJ_MODEL_ITEM2);

entries.accept(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
ct.accept(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);

ItemStack customModelDataItem = new ItemStack(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
customModelDataItem.getOrCreateTag().putInt("CustomModelData", 1);
entries.accept(customModelDataItem);
}
ItemStack customModelDataItem = new ItemStack(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
customModelDataItem.getOrCreateTag().putInt("CustomModelData", 1);
ct.accept(customModelDataItem);
});
}

Expand Down
15 changes: 6 additions & 9 deletions src/main/java/dev/felnull/smlexample/block/SMLExampleBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,20 @@
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;

public class SMLExampleBlocks {
public static final Block OBJ_MODEL_BLOCK = new OBJBlock(FabricBlockSettings.of(Material.METAL, MaterialColor.DEEPSLATE).sound(SoundType.ANVIL));
public static final Block FACING_OBJ_MODEL_BLOCK = new FacingOBJBlock(FabricBlockSettings.of(Material.METAL, MaterialColor.DEEPSLATE).sound(SoundType.ANVIL));
public static final Block OBJ_MODEL_BLOCK = new OBJBlock(FabricBlockSettings.copyOf(Blocks.ANVIL));
public static final Block FACING_OBJ_MODEL_BLOCK = new FacingOBJBlock(FabricBlockSettings.copyOf(Blocks.ANVIL));

public static void init() {
register("obj_model_block", OBJ_MODEL_BLOCK);
register("facing_obj_model_block", FACING_OBJ_MODEL_BLOCK);

ItemGroupEvents.MODIFY_ENTRIES_ALL.register((group, entries) -> {
if (group == CreativeModeTabs.BUILDING_BLOCKS) {
entries.accept(OBJ_MODEL_BLOCK);
entries.accept(FACING_OBJ_MODEL_BLOCK);
}
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(ct -> {
ct.accept(OBJ_MODEL_BLOCK);
ct.accept(FACING_OBJ_MODEL_BLOCK);
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"mixins": [
],
"depends": {
"fabricloader": ">=0.14.17",
"fabric-api": "*",
"minecraft": "~1.19.4",
"java": ">=17"
"fabricloader": ">=0.14.21",
"minecraft": "~1.20",
"java": ">=17",
"fabric-api": "*"
},
"suggests": {
"another-mod": "*"
Expand Down

0 comments on commit 436fe90

Please sign in to comment.