diff --git a/build.gradle b/build.gradle index 7c18d5e..bccb97e 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,7 @@ sourceSets { } loom { + accessWidenerPath = file("src/main/resources/additional-armoury.accesswidener") runs { // This adds a new gradle task that runs the datagen API: "gradlew runDatagen" datagen { diff --git a/gradle.properties b/gradle.properties index 356b5dc..bc81804 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,12 +9,12 @@ yarn_mappings=1.20.6+build.1 loader_version=0.15.11 # Mod Properties -mod_version=1.0.3 +mod_version=1.0.4 maven_group=com.provismet archives_base_name=additional-armoury modid=additional-armoury #Fabric api fabric_version=0.98.0+1.20.6 -combatplus_version=2.0.0-mc1.20.6 +combatplus_version=2.0.1-mc1.20.6 lilylib_version=1.1.3-mc1.20.6 \ No newline at end of file diff --git a/src/main/java/com/provismet/AdditionalArmoury/registries/AAItemGroups.java b/src/main/java/com/provismet/AdditionalArmoury/registries/AAItemGroups.java index 89ab2a9..72e626d 100644 --- a/src/main/java/com/provismet/AdditionalArmoury/registries/AAItemGroups.java +++ b/src/main/java/com/provismet/AdditionalArmoury/registries/AAItemGroups.java @@ -4,6 +4,7 @@ import com.provismet.AdditionalArmoury.items.DaggerItem; import com.provismet.AdditionalArmoury.items.MaceItem; +import com.provismet.AdditionalArmoury.utility.AATags; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.component.type.PotionContentsComponent; import net.minecraft.item.ArmorItem; @@ -15,8 +16,11 @@ import net.minecraft.potion.Potion; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryWrapper; +import net.minecraft.registry.tag.TagKey; import net.minecraft.resource.featuretoggle.FeatureSet; +import java.util.Set; + public class AAItemGroups { public static void register () { @@ -56,6 +60,14 @@ public static void register () { AAItems.DAGGERS.forEach(dagger -> addPotions(content, wrapper, dagger, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS, content.getEnabledFeatures())); }); }); + + Set> itemTags = Set.of(AATags.ItemTags.DAGGER_ENCHANTABLE, AATags.ItemTags.MACE_ENCHANTABLE, AATags.ItemTags.BOOMERANG_ENCHANTABLE, AATags.ItemTags.STAFF_ENCHANTABLE); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> { + content.getContext().lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent(registryWrapper -> { + ItemGroups.addMaxLevelEnchantedBooks(content, registryWrapper, itemTags, ItemGroup.StackVisibility.PARENT_TAB_ONLY, content.getContext().enabledFeatures()); + ItemGroups.addAllLevelEnchantedBooks(content, registryWrapper, itemTags, ItemGroup.StackVisibility.SEARCH_TAB_ONLY, content.getContext().enabledFeatures()); + }); + }); } private static void addPotions (ItemGroup.Entries entries, RegistryWrapper registryWrapper, Item item, ItemGroup.StackVisibility visibility, FeatureSet enabledFeatures) { diff --git a/src/main/resources/additional-armoury.accesswidener b/src/main/resources/additional-armoury.accesswidener new file mode 100644 index 0000000..9fa450f --- /dev/null +++ b/src/main/resources/additional-armoury.accesswidener @@ -0,0 +1,4 @@ +accessWidener v2 named + +accessible method net/minecraft/item/ItemGroups addMaxLevelEnchantedBooks (Lnet/minecraft/item/ItemGroup$Entries;Lnet/minecraft/registry/RegistryWrapper;Ljava/util/Set;Lnet/minecraft/item/ItemGroup$StackVisibility;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V +accessible method net/minecraft/item/ItemGroups addAllLevelEnchantedBooks (Lnet/minecraft/item/ItemGroup$Entries;Lnet/minecraft/registry/RegistryWrapper;Ljava/util/Set;Lnet/minecraft/item/ItemGroup$StackVisibility;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 59fedad..61cf092 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,6 +29,7 @@ "mixins": [ "additional-armoury.mixins.json" ], + "accessWidener": "additional-armoury.accesswidener", "depends": { "fabricloader": ">=0.15.0", "minecraft": "~1.20.5",