From 9e64a6e654e09dccacd90d3ddf08d2d1d775b68f Mon Sep 17 00:00:00 2001 From: MattiDragon <61198884+MattiDragon@users.noreply.github.com> Date: Sat, 29 Jun 2024 15:00:16 +0300 Subject: [PATCH] Update to 1.21 --- build.gradle | 9 ++++---- changelog/4.0.0+1.21.md | 1 + changelog/4.0.0-beta.1+1.20.6.md | 4 ---- gradle.properties | 18 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../recipes/misc/compound.json | 0 .../recipes/redstone/cable.json | 0 .../recipes/redstone/controller.json | 0 .../blocks/cable.json | 0 .../blocks/controller.json | 0 .../{recipes => recipe}/cable.json | 0 .../{recipes => recipe}/compound.json | 0 .../{recipes => recipe}/controller.json | 0 .../tags/{items => item}/wrenches.json | 0 .../{blocks => block}/mineable/pickaxe.json | 0 .../AdvancedNetworking.java | 2 +- .../misc/ResourceFilter.java | 2 +- .../mixin/DataOutputMixin.java | 21 +++++++++++++++++++ .../registry/ModBlocks.java | 6 +++--- .../resources/advanced_networking.mixins.json | 1 + .../advanced_networking/lang/en_us.json | 2 ++ src/main/resources/fabric.mod.json | 4 ++-- .../{structures => structure}/empty4x4x4.snbt | 0 23 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 changelog/4.0.0+1.21.md delete mode 100644 changelog/4.0.0-beta.1+1.20.6.md rename src/main/generated/data/advanced_networking/{advancements => advancement}/recipes/misc/compound.json (100%) rename src/main/generated/data/advanced_networking/{advancements => advancement}/recipes/redstone/cable.json (100%) rename src/main/generated/data/advanced_networking/{advancements => advancement}/recipes/redstone/controller.json (100%) rename src/main/generated/data/advanced_networking/{loot_tables => loot_table}/blocks/cable.json (100%) rename src/main/generated/data/advanced_networking/{loot_tables => loot_table}/blocks/controller.json (100%) rename src/main/generated/data/advanced_networking/{recipes => recipe}/cable.json (100%) rename src/main/generated/data/advanced_networking/{recipes => recipe}/compound.json (100%) rename src/main/generated/data/advanced_networking/{recipes => recipe}/controller.json (100%) rename src/main/generated/data/advanced_networking/tags/{items => item}/wrenches.json (100%) rename src/main/generated/data/minecraft/tags/{blocks => block}/mineable/pickaxe.json (100%) create mode 100644 src/main/java/io/github/mattidragon/advancednetworking/mixin/DataOutputMixin.java rename src/testmod/resources/data/advanced_networking_test/gametest/{structures => structure}/empty4x4x4.snbt (100%) diff --git a/build.gradle b/build.gradle index 637628e..0a3c10d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } @@ -14,8 +14,7 @@ repositories { maven { url "https://kneelawk.com/maven/" content { - includeGroup "com.kneelawk.graphlib" - includeGroup "com.kneelawk" + includeGroupByRegex "com\\.kneelawk.*" } } maven { @@ -81,8 +80,8 @@ dependencies { // Core apis modImplementation include("com.github.mattidragon:nodeflow:$nodeflow_version") - include modImplementation("com.kneelawk.graphlib:core-fabric:$graphlib_version") - modLocalRuntime("com.kneelawk.graphlib:debugrender-fabric:$graphlib_version") + include modImplementation("com.kneelawk.graphlib:graphlib-core-fabric:$graphlib_version") + modLocalRuntime("com.kneelawk.graphlib:graphlib-debugrender-fabric:$graphlib_version") include modApi("teamreborn:energy:$energy_version") { exclude(group: "net.fabricmc.fabric-api") } diff --git a/changelog/4.0.0+1.21.md b/changelog/4.0.0+1.21.md new file mode 100644 index 0000000..2d104be --- /dev/null +++ b/changelog/4.0.0+1.21.md @@ -0,0 +1 @@ +* Updated to 1.21 \ No newline at end of file diff --git a/changelog/4.0.0-beta.1+1.20.6.md b/changelog/4.0.0-beta.1+1.20.6.md deleted file mode 100644 index c293fc3..0000000 --- a/changelog/4.0.0-beta.1+1.20.6.md +++ /dev/null @@ -1,4 +0,0 @@ -* Update to 1.20.6 - * Nbt filtering now converts the component changes of a stack into nbt and the filters that. - I might add a way to filter components directly later. -* Fix adventure mode access toggle not being properly hidden in cables \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index d2839bc..00e7598 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.20.6 -yarn_mappings=1.20.6+build.1 +minecraft_version=1.21 +yarn_mappings=1.21+build.4 loader_version=0.15.11 -mod_version=4.0.0-beta.1 +mod_version=4.0.0 maven_group=io.github.mattidragon archives_base_name=advanced-networking -fabric_version=0.98.0+1.20.6 -nodeflow_version=2.0.0-mc.1.20.6 -graphlib_version=2.0.0-alpha.17+1.20.6 -energy_version=4.0.1 -yacl_version=3.4.2+1.20.5 -modmenu_version=10.0.0-beta.1 +fabric_version=0.100.4+1.21 +nodeflow_version=6e969b499d25645b2921303881b5e64328dbb20c +graphlib_version=2.0.0+1.21 +energy_version=4.1.0 +yacl_version=3.5.0+1.21 +modmenu_version=11.0.1 configtoolkit_version=1.1.1 noindium_version=1.1.0+1.20 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json b/src/main/generated/data/advanced_networking/advancement/recipes/misc/compound.json similarity index 100% rename from src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json rename to src/main/generated/data/advanced_networking/advancement/recipes/misc/compound.json diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json b/src/main/generated/data/advanced_networking/advancement/recipes/redstone/cable.json similarity index 100% rename from src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json rename to src/main/generated/data/advanced_networking/advancement/recipes/redstone/cable.json diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json b/src/main/generated/data/advanced_networking/advancement/recipes/redstone/controller.json similarity index 100% rename from src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json rename to src/main/generated/data/advanced_networking/advancement/recipes/redstone/controller.json diff --git a/src/main/generated/data/advanced_networking/loot_tables/blocks/cable.json b/src/main/generated/data/advanced_networking/loot_table/blocks/cable.json similarity index 100% rename from src/main/generated/data/advanced_networking/loot_tables/blocks/cable.json rename to src/main/generated/data/advanced_networking/loot_table/blocks/cable.json diff --git a/src/main/generated/data/advanced_networking/loot_tables/blocks/controller.json b/src/main/generated/data/advanced_networking/loot_table/blocks/controller.json similarity index 100% rename from src/main/generated/data/advanced_networking/loot_tables/blocks/controller.json rename to src/main/generated/data/advanced_networking/loot_table/blocks/controller.json diff --git a/src/main/generated/data/advanced_networking/recipes/cable.json b/src/main/generated/data/advanced_networking/recipe/cable.json similarity index 100% rename from src/main/generated/data/advanced_networking/recipes/cable.json rename to src/main/generated/data/advanced_networking/recipe/cable.json diff --git a/src/main/generated/data/advanced_networking/recipes/compound.json b/src/main/generated/data/advanced_networking/recipe/compound.json similarity index 100% rename from src/main/generated/data/advanced_networking/recipes/compound.json rename to src/main/generated/data/advanced_networking/recipe/compound.json diff --git a/src/main/generated/data/advanced_networking/recipes/controller.json b/src/main/generated/data/advanced_networking/recipe/controller.json similarity index 100% rename from src/main/generated/data/advanced_networking/recipes/controller.json rename to src/main/generated/data/advanced_networking/recipe/controller.json diff --git a/src/main/generated/data/advanced_networking/tags/items/wrenches.json b/src/main/generated/data/advanced_networking/tags/item/wrenches.json similarity index 100% rename from src/main/generated/data/advanced_networking/tags/items/wrenches.json rename to src/main/generated/data/advanced_networking/tags/item/wrenches.json diff --git a/src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/generated/data/minecraft/tags/block/mineable/pickaxe.json similarity index 100% rename from src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json rename to src/main/generated/data/minecraft/tags/block/mineable/pickaxe.json diff --git a/src/main/java/io/github/mattidragon/advancednetworking/AdvancedNetworking.java b/src/main/java/io/github/mattidragon/advancednetworking/AdvancedNetworking.java index 17e35e6..5c5e52e 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/AdvancedNetworking.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/AdvancedNetworking.java @@ -52,7 +52,7 @@ public class AdvancedNetworking implements ModInitializer { .build(); public static Identifier id(String path) { - return new Identifier(MOD_ID, path); + return Identifier.of(MOD_ID, path); } @Override diff --git a/src/main/java/io/github/mattidragon/advancednetworking/misc/ResourceFilter.java b/src/main/java/io/github/mattidragon/advancednetworking/misc/ResourceFilter.java index a240b76..5ac2e33 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/misc/ResourceFilter.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/misc/ResourceFilter.java @@ -92,7 +92,7 @@ private boolean checkId(Identifier id) { if (shouldUseRegex()) { return Pattern.matches(idFilter, id.toString()); } else { - return new Identifier(idFilter).equals(id); + return id.equals(Identifier.tryParse(idFilter)); } } diff --git a/src/main/java/io/github/mattidragon/advancednetworking/mixin/DataOutputMixin.java b/src/main/java/io/github/mattidragon/advancednetworking/mixin/DataOutputMixin.java new file mode 100644 index 0000000..c4f80af --- /dev/null +++ b/src/main/java/io/github/mattidragon/advancednetworking/mixin/DataOutputMixin.java @@ -0,0 +1,21 @@ +package io.github.mattidragon.advancednetworking.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import net.minecraft.data.DataOutput; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +// Temporary hack to generate tags correctly. See: https://github.com/FabricMC/fabric/issues/3894 +@Mixin(DataOutput.class) +public class DataOutputMixin { + @ModifyExpressionValue(method = "getTagResolver", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/RegistryKeys;getTagPath(Lnet/minecraft/registry/RegistryKey;)Ljava/lang/String;")) + private String fixTagPath(String original, RegistryKey> registryRef) { + var id = registryRef.getValue(); + if (id.getNamespace().equals("minecraft")) { + return original; + } + return "tags/" + id.getNamespace() + "/" + id.getPath(); + } +} diff --git a/src/main/java/io/github/mattidragon/advancednetworking/registry/ModBlocks.java b/src/main/java/io/github/mattidragon/advancednetworking/registry/ModBlocks.java index 977677b..ad2411e 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/registry/ModBlocks.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/registry/ModBlocks.java @@ -8,13 +8,13 @@ import net.minecraft.block.AbstractBlock; import net.minecraft.block.MapColor; import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.enums.Instrument; +import net.minecraft.block.enums.NoteBlockInstrument; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; public final class ModBlocks { - public static final ControllerBlock CONTROLLER = new ControllerBlock(AbstractBlock.Settings.create().mapColor(MapColor.IRON_GRAY).instrument(Instrument.BASEDRUM).requiresTool().strength(3.5F)); - public static final CableBlock CABLE = new CableBlock(AbstractBlock.Settings.create().mapColor(MapColor.DEEPSLATE_GRAY).instrument(Instrument.BASEDRUM).requiresTool().strength(3.5F)); + public static final ControllerBlock CONTROLLER = new ControllerBlock(AbstractBlock.Settings.create().mapColor(MapColor.IRON_GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresTool().strength(3.5F)); + public static final CableBlock CABLE = new CableBlock(AbstractBlock.Settings.create().mapColor(MapColor.DEEPSLATE_GRAY).instrument(NoteBlockInstrument.BASEDRUM).requiresTool().strength(3.5F)); public static final BlockEntityType CONTROLLER_BLOCK_ENTITY = BlockEntityType.Builder.create(ControllerBlockEntity::new, ModBlocks.CONTROLLER).build(null); public static final BlockEntityType CABLE_BLOCK_ENTITY = BlockEntityType.Builder.create(CableBlockEntity::new, ModBlocks.CABLE).build(null); diff --git a/src/main/resources/advanced_networking.mixins.json b/src/main/resources/advanced_networking.mixins.json index 16e396b..cb89f9f 100644 --- a/src/main/resources/advanced_networking.mixins.json +++ b/src/main/resources/advanced_networking.mixins.json @@ -4,6 +4,7 @@ "package": "io.github.mattidragon.advancednetworking.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ + "DataOutputMixin", "PlayerEntityMixin", "RedstoneWireBlockMixin" ], diff --git a/src/main/resources/assets/advanced_networking/lang/en_us.json b/src/main/resources/assets/advanced_networking/lang/en_us.json index b0116ea..1a3205b 100644 --- a/src/main/resources/assets/advanced_networking/lang/en_us.json +++ b/src/main/resources/assets/advanced_networking/lang/en_us.json @@ -12,6 +12,8 @@ "screen.advanced_networking.cable_config.interface_type.interface": "Interface", "screen.advanced_networking.cable_config.interface_type.blocked": "Blocked", "screen.advanced_networking.adventure_mode_access": "Adventure mode access", + + "tag.item.advanced_networking.wrenches": "Wrenches", "side.advanced_networking.north": "North", "side.advanced_networking.south": "South", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 897c656..7d68da1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -40,8 +40,8 @@ "accessWidener": "advanced_networking.accesswidener", "depends": { "fabricloader": ">=0.15.11", - "fabric-api": ">=0.98.0", - "minecraft": "1.20.6", + "fabric-api": ">=0.100.4", + "minecraft": "1.21", "nodeflow": "*", "graphlib": "*" } diff --git a/src/testmod/resources/data/advanced_networking_test/gametest/structures/empty4x4x4.snbt b/src/testmod/resources/data/advanced_networking_test/gametest/structure/empty4x4x4.snbt similarity index 100% rename from src/testmod/resources/data/advanced_networking_test/gametest/structures/empty4x4x4.snbt rename to src/testmod/resources/data/advanced_networking_test/gametest/structure/empty4x4x4.snbt