diff --git a/build.gradle b/build.gradle index ad5f01b..83f69dd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false id "me.shedaniel.unified-publishing" version "0.1.+" apply false } @@ -26,7 +26,10 @@ subprojects { // The following line declares the mojmap mappings, you may use other mappings as well //mappings loom.officialMojangMappings() // The following line declares the yarn mappings you may select this one as well. - mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2" + mappings loom.layered { + it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2") + it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version") + } } } @@ -49,7 +52,7 @@ allprojects { tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" - options.release = 17 + options.release = 21 } ext { releaseChangelog = { diff --git a/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/azalea_leaves.json b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/azalea_leaves.json new file mode 100644 index 0000000..028400d --- /dev/null +++ b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/azalea_leaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/leaves_notint", + "textures": { + "all": "minecraft:block/azalea_leaves" + } +} \ No newline at end of file diff --git a/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/flowering_azalea_leaves.json b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/flowering_azalea_leaves.json new file mode 100644 index 0000000..417008c --- /dev/null +++ b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/flowering_azalea_leaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/leaves_notint", + "textures": { + "all": "minecraft:block/flowering_azalea_leaves" + } +} \ No newline at end of file diff --git a/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves_notint.json b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves_notint.json new file mode 100644 index 0000000..4455fee --- /dev/null +++ b/common/src/main/resources/resourcepacks/smartleaves/assets/minecraft/models/block/leaves_notint.json @@ -0,0 +1,73 @@ +{ + "credit": "made by Motschen", + "parent": "block/block", + "textures": { + "particle": "#all" + }, + "elements": [ + { + "name": "main", + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"} + } + }, + { + "name": "bottom", + "from": [0, 0.01, 0], + "to": [16, 0.01, 16], + "faces": { + "up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"} + } + }, + { + "name": "west", + "from": [0.01, 0, 0], + "to": [0.01, 16, 16], + "faces": { + "east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"} + } + }, + { + "name": "north", + "from": [0, 0, 0.01], + "to": [16, 16, 0.01], + "faces": { + "south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"} + } + }, + { + "name": "east", + "from": [15.99, 0, 0], + "to": [15.99, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [23, 8, 8]}, + "faces": { + "west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"} + } + }, + { + "name": "south", + "from": [0, 0, 15.99], + "to": [16, 16, 15.99], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 23]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"} + } + }, + { + "name": "up", + "from": [0, 15.99, 0], + "to": [16, 15.99, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]}, + "faces": { + "down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"} + } + } + ] +} \ No newline at end of file diff --git a/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java b/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java index 03bdbdf..a2101ad 100644 --- a/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java +++ b/fabric/src/main/java/eu/midnightdust/cullleaves/fabric/CullLeavesClientFabric.java @@ -13,7 +13,7 @@ public class CullLeavesClientFabric implements ClientModInitializer { public void onInitializeClient() { MidnightConfig.init("cullleaves", CullLeavesConfig.class); FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> { - ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), modContainer, ResourcePackActivationType.NORMAL); + ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of("cullleaves:smartleaves"), modContainer, ResourcePackActivationType.NORMAL); }); } } diff --git a/gradle.properties b/gradle.properties index 51779a4..045a861 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,23 +1,24 @@ org.gradle.jvmargs=-Xmx4096M -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 +minecraft_version=1.21 +yarn_mappings=1.21+build.2 enabled_platforms=fabric,neoforge archives_base_name=cullleaves -mod_version=3.3.0 +mod_version=3.4.0 maven_group=eu.midnightdust release_type=release curseforge_id=423254 modrinth_id=GNxdLCoP -midnightlib_version=1.5.3 -sodium_version=mc1.20.4-0.5.8 +midnightlib_version=1.5.7 +sodium_version=mc1.21-0.5.9 -fabric_loader_version=0.15.7 -fabric_api_version=0.96.3+1.20.4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 -neoforge_version=20.4.170 +neoforge_version=21.0.14-beta +yarn_mappings_patch_neoforge_version = 1.21+build.4 quilt_loader_version=0.18.9 quilt_fabric_api_version=7.0.6+0.85.0-1.20.1 diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 88d487e..0ae8c50 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -28,7 +28,7 @@ dependencies { neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" // Remove the next line if you don't want to depend on the API //modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" - modImplementation "maven.modrinth:midnightlib:1.5.2-neoforge" + modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge" //include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge" common(project(path: ":common", configuration: "namedElements")) { transitive false } @@ -38,7 +38,7 @@ dependencies { processResources { inputs.property "version", project.version - filesMatching("META-INF/mods.toml") { + filesMatching("META-INF/neoforge.mods.toml") { expand "version": project.version } } diff --git a/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientEvents.java b/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientEvents.java index 5469225..65a8312 100644 --- a/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientEvents.java +++ b/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientEvents.java @@ -1,32 +1,35 @@ package eu.midnightdust.cullleaves.neoforge; -import net.minecraft.resource.DirectoryResourcePack; -import net.minecraft.resource.ResourcePackProfile; -import net.minecraft.resource.ResourcePackSource; -import net.minecraft.resource.ResourceType; +import net.minecraft.resource.*; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModList; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.event.AddPackFindersEvent; import net.neoforged.neoforgespi.locating.IModFile; -@Mod.EventBusSubscriber(modid = "cullleaves", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) +import java.util.Optional; + +@EventBusSubscriber(modid = "cullleaves", bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class CullLeavesClientEvents { @SubscribeEvent public static void addPackFinders(AddPackFindersEvent event) { if (event.getPackType() == ResourceType.CLIENT_RESOURCES) { - registerResourcePack(event, new Identifier("cullleaves", "smartleaves"), false); + registerResourcePack(event, Identifier.of("cullleaves", "smartleaves"), false); } } private static void registerResourcePack(AddPackFindersEvent event, Identifier id, boolean alwaysEnabled) { - event.addRepositorySource((profileAdder -> { + event.addRepositorySource(((profileAdder) -> { IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile(); try { - ResourcePackProfile.PackFactory pack = new DirectoryResourcePack.DirectoryBackedFactory(file.findResource("resourcepacks/" + id.getPath()), true); - profileAdder.accept(ResourcePackProfile.create(id.toString(), Text.of(id.getNamespace()+"/"+id.getPath()), alwaysEnabled, pack, ResourceType.CLIENT_RESOURCES, ResourcePackProfile.InsertionPosition.TOP, ResourcePackSource.BUILTIN)); + ResourcePackProfile.PackFactory pack = new DirectoryResourcePack.DirectoryBackedFactory(file.findResource("resourcepacks/" + id.getPath())); + ResourcePackInfo info = new ResourcePackInfo(id.toString(), Text.of(id.getNamespace()+"/"+id.getPath()), ResourcePackSource.BUILTIN, Optional.empty()); + ResourcePackProfile packProfile = ResourcePackProfile.create(info, pack, ResourceType.CLIENT_RESOURCES, new ResourcePackPosition(alwaysEnabled, ResourcePackProfile.InsertionPosition.TOP, false)); + if (packProfile != null) { + profileAdder.accept(packProfile); + } } catch (NullPointerException e) {e.fillInStackTrace();} })); } diff --git a/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientForge.java b/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientForge.java index eb078a4..93e2940 100644 --- a/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientForge.java +++ b/neoforge/src/main/java/eu/midnightdust/cullleaves/neoforge/CullLeavesClientForge.java @@ -2,19 +2,11 @@ package eu.midnightdust.cullleaves.neoforge; import eu.midnightdust.cullleaves.config.CullLeavesConfig; import eu.midnightdust.lib.config.MidnightConfig; -import net.neoforged.fml.IExtensionPoint; -import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.client.ConfigScreenHandler; - -import static net.neoforged.fml.IExtensionPoint.DisplayTest.IGNORESERVERONLY; @Mod("cullleaves") public class CullLeavesClientForge { public CullLeavesClientForge() { MidnightConfig.init("cullleaves", CullLeavesConfig.class); - ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> IGNORESERVERONLY, (remote, server) -> true)); - ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> - new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> MidnightConfig.getScreen(parent, "cullleaves"))); } } \ No newline at end of file diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml similarity index 95% rename from neoforge/src/main/resources/META-INF/mods.toml rename to neoforge/src/main/resources/META-INF/neoforge.mods.toml index 5dc29f9..55c5e70 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -34,5 +34,5 @@ side = "CLIENT" modId = "midnightlib" required = true versionRange = "[1.0.0,)" -ordering = "BEFORE" +ordering = "AFTER" side = "CLIENT" \ No newline at end of file