Skip to content

Commit 436fe90

Browse files
committed
1.20
1 parent 0dd3aa5 commit 436fe90

File tree

10 files changed

+61
-90
lines changed

10 files changed

+61
-90
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
uses: actions/upload-artifact@v3
3838
with:
3939
name: Artifacts
40-
path: build/libs/
40+
path: build/libs/

build.gradle

Lines changed: 28 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
plugins {
2-
id 'fabric-loom' version '1.1-SNAPSHOT'
3-
id 'maven-publish'
2+
id 'fabric-loom' version '1.2-SNAPSHOT'
43
}
54

65
version = project.mod_version
76
group = project.maven_group
87

8+
base {
9+
archivesName = project.archives_base_name
10+
}
11+
12+
repositories {
13+
// To use SML, you need to add the FelNullMaven repository
14+
maven {
15+
name = "FelNull Maven"
16+
url = "https://maven.felnull.dev"
17+
}
18+
}
19+
920
sourceSets {
1021
main {
1122
resources {
@@ -17,6 +28,15 @@ sourceSets {
1728
}
1829

1930
loom {
31+
splitEnvironmentSourceSets()
32+
33+
mods {
34+
"sml-example-mod" {
35+
sourceSet sourceSets.main
36+
sourceSet sourceSets.client
37+
}
38+
}
39+
2040
runs {
2141
datagen {
2242
server()
@@ -31,42 +51,18 @@ loom {
3151
}
3252
assemble.dependsOn runDatagen
3353

34-
repositories {
35-
// Add repositories to retrieve artifacts from in here.
36-
// You should only use this when depending on other mods because
37-
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
38-
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
39-
// for more information about repositories.
40-
41-
maven {
42-
name = "FelNull Maven"
43-
url = "https://maven.felnull.dev"
44-
}
45-
}
46-
4754
dependencies {
48-
// To change the versions see the gradle.properties file
4955
minecraft "com.mojang:minecraft:${project.minecraft_version}"
50-
/*mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"*/
5156
mappings loom.officialMojangMappings()
5257
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
5358

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

57-
modApi "dev.felnull:special-model-loader:1.1.0"
58-
59-
//↓ Required for inclusion in jar in jar
60-
include "dev.felnull:special-model-loader:1.0.0"
61-
62-
// Uncomment the following line to enable the deprecated Fabric API modules.
63-
// 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.
64-
65-
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
66-
}
61+
// Using the SML API
62+
modApi "dev.felnull:special-model-loader:1.2.0"
6763

68-
base {
69-
archivesName = project.archives_base_name
64+
// Required for inclusion in jar in jar
65+
include "dev.felnull:special-model-loader:1.2.0"
7066
}
7167

7268
processResources {
@@ -78,14 +74,10 @@ processResources {
7874
}
7975

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

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

9183
sourceCompatibility = JavaVersion.VERSION_17
@@ -94,23 +86,6 @@ java {
9486

9587
jar {
9688
from("LICENSE") {
97-
rename { "${it}_${base.archivesName.get()}" }
89+
rename { "${it}_${project.archivesBaseName}" }
9890
}
99-
}
100-
101-
// configure the maven publication
102-
publishing {
103-
publications {
104-
mavenJava(MavenPublication) {
105-
from components.java
106-
}
107-
}
108-
109-
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
110-
repositories {
111-
// Add repositories to publish to here.
112-
// Notice: This block does NOT have the same function as the block in the top level.
113-
// The repositories here will be used for publishing your artifact, not for
114-
// retrieving dependencies.
115-
}
116-
}
91+
}

gradle.properties

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Done to increase the memory available to gradle.
2-
org.gradle.jvmargs=-Xmx1G
2+
org.gradle.jvmargs=-Xmx3G
33
org.gradle.parallel=true
44

55
# Fabric Properties
6-
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.19.4
8-
yarn_mappings=1.19.4+build.1
9-
loader_version=0.14.17
6+
# check these on https://fabricmc.net/develop
7+
minecraft_version=1.20
8+
yarn_mappings=1.20+build.1
9+
loader_version=0.14.21
1010

1111
# Mod Properties
12-
mod_version = 1.0.0
13-
maven_group = com.example
14-
archives_base_name = fabric-example-mod
12+
mod_version=1.0.0
13+
maven_group=com.example
14+
archives_base_name = sml-example-mod
1515

1616
# Dependencies
17-
fabric_version=0.75.3+1.19.4
17+
fabric_version=0.83.0+1.20

gradle/wrapper/gradle-wrapper.jar

468 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

gradlew

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ done
8585
APP_BASE_NAME=${0##*/}
8686
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90-
9188
# Use the maximum available, or set MAX_FD != -1 to use that value.
9289
MAX_FD=maximum
9390

@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
197194
done
198195
fi
199196

197+
198+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
199+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
200+
200201
# Collect all arguments for the java command;
201202
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202203
# shell script including quotes and variable substitutions, so put them in

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pluginManagement {
77
mavenCentral()
88
gradlePluginPortal()
99
}
10-
}
10+
}

src/main/java/dev/felnull/smlexample/SMLExampleItems.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ public static void init() {
1919
register("obj_model_item2", OBJ_MODEL_ITEM2);
2020
register("custom_model_data_obj_model_item", CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
2121

22-
ItemGroupEvents.MODIFY_ENTRIES_ALL.register((group, entries) -> {
23-
if (group == CreativeModeTabs.BUILDING_BLOCKS) {
24-
entries.accept(OBJ_MODEL_ITEM);
25-
entries.accept(OBJ_MODEL_ITEM2);
22+
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(ct -> {
23+
ct.accept(OBJ_MODEL_ITEM);
24+
ct.accept(OBJ_MODEL_ITEM2);
2625

27-
entries.accept(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
26+
ct.accept(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
2827

29-
ItemStack customModelDataItem = new ItemStack(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
30-
customModelDataItem.getOrCreateTag().putInt("CustomModelData", 1);
31-
entries.accept(customModelDataItem);
32-
}
28+
ItemStack customModelDataItem = new ItemStack(CUSTOM_MODEL_DATA_OBJ_MODEL_ITEM);
29+
customModelDataItem.getOrCreateTag().putInt("CustomModelData", 1);
30+
ct.accept(customModelDataItem);
3331
});
3432
}
3533

src/main/java/dev/felnull/smlexample/block/SMLExampleBlocks.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@
1010
import net.minecraft.world.item.BlockItem;
1111
import net.minecraft.world.item.CreativeModeTabs;
1212
import net.minecraft.world.level.block.Block;
13+
import net.minecraft.world.level.block.Blocks;
1314
import net.minecraft.world.level.block.SoundType;
14-
import net.minecraft.world.level.material.Material;
15-
import net.minecraft.world.level.material.MaterialColor;
1615

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

2120
public static void init() {
2221
register("obj_model_block", OBJ_MODEL_BLOCK);
2322
register("facing_obj_model_block", FACING_OBJ_MODEL_BLOCK);
2423

25-
ItemGroupEvents.MODIFY_ENTRIES_ALL.register((group, entries) -> {
26-
if (group == CreativeModeTabs.BUILDING_BLOCKS) {
27-
entries.accept(OBJ_MODEL_BLOCK);
28-
entries.accept(FACING_OBJ_MODEL_BLOCK);
29-
}
24+
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(ct -> {
25+
ct.accept(OBJ_MODEL_BLOCK);
26+
ct.accept(FACING_OBJ_MODEL_BLOCK);
3027
});
3128
}
3229

src/main/resources/fabric.mod.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"mixins": [
2929
],
3030
"depends": {
31-
"fabricloader": ">=0.14.17",
32-
"fabric-api": "*",
33-
"minecraft": "~1.19.4",
34-
"java": ">=17"
31+
"fabricloader": ">=0.14.21",
32+
"minecraft": "~1.20",
33+
"java": ">=17",
34+
"fabric-api": "*"
3535
},
3636
"suggests": {
3737
"another-mod": "*"

0 commit comments

Comments
 (0)