From fe537f35c9c21dacb13540da0e9e703331607d3d Mon Sep 17 00:00:00 2001 From: Rafael Mehdiyev Date: Sun, 8 Dec 2024 12:56:05 +0400 Subject: [PATCH] Updated to 1.21.4 - UNSOLVED - Models Not Working --- build.gradle | 2 +- gradle.properties | 6 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../datagen/ModModelProvider.java | 51 ++++++++++--------- .../datagen/ModRecipeProvider.java | 6 ++- .../usefulcactus/item/ModArmorMaterials.java | 7 ++- .../item/custom/ModArmorItem.java | 7 +-- src/main/resources/fabric.mod.json | 2 +- 8 files changed, 41 insertions(+), 42 deletions(-) diff --git a/build.gradle b/build.gradle index bb01955..fb4e628 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.8-SNAPSHOT' + id 'fabric-loom' version '1.9-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 3775bb1..064ff32 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.3 -yarn_mappings=1.21.3+build.2 +minecraft_version=1.21.4 +yarn_mappings=1.21.4+build.1 loader_version=0.16.9 # Mod Properties @@ -14,4 +14,4 @@ maven_group=net.rafael.usefulcactus archives_base_name=rafaels-useful-cactus # Dependencies -fabric_version=0.110.0+1.21.3 \ No newline at end of file +fabric_version=0.111.0+1.21.4 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index df97d72..e2847c8 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.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/net/rafael/usefulcactus/datagen/ModModelProvider.java b/src/main/java/net/rafael/usefulcactus/datagen/ModModelProvider.java index 8b57795..f836f22 100644 --- a/src/main/java/net/rafael/usefulcactus/datagen/ModModelProvider.java +++ b/src/main/java/net/rafael/usefulcactus/datagen/ModModelProvider.java @@ -1,14 +1,11 @@ package net.rafael.usefulcactus.datagen; +import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; -import net.minecraft.data.client.BlockStateModelGenerator; -import net.minecraft.data.client.ItemModelGenerator; -import net.minecraft.data.client.Models; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.equipment.EquipmentModel; -import net.minecraft.util.Identifier; -import net.rafael.usefulcactus.RafaelsUsefulCactus; +import net.minecraft.client.data.BlockStateModelGenerator; +import net.minecraft.client.data.ItemModelGenerator; +import net.minecraft.client.data.Models; +import net.minecraft.item.equipment.EquipmentAssetKeys; import net.rafael.usefulcactus.block.ModBlocks; import net.rafael.usefulcactus.item.ModItems; @@ -53,21 +50,27 @@ public void generateItemModels(ItemModelGenerator itemModelGenerator) { itemModelGenerator.register(ModItems.CACTUS_HAMMER, Models.HANDHELD); // Armor - itemModelGenerator.registerArmor(ModItems.CACTUS_HELMET, - Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() - .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), - EquipmentSlot.HEAD); - itemModelGenerator.registerArmor(ModItems.CACTUS_CHESTPLATE, - Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() - .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), - EquipmentSlot.CHEST); - itemModelGenerator.registerArmor(ModItems.CACTUS_LEGGINGS, - Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() - .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), - EquipmentSlot.LEGS); - itemModelGenerator.registerArmor(ModItems.CACTUS_BOOTS, - Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() - .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), - EquipmentSlot.FEET); + itemModelGenerator.registerArmor(ModItems.CACTUS_HELMET, EquipmentAssetKeys.register("cactus_skin"), "helmet", false); + itemModelGenerator.registerArmor(ModItems.CACTUS_CHESTPLATE, EquipmentAssetKeys.register("cactus_skin"), "chestplate", false); + itemModelGenerator.registerArmor(ModItems.CACTUS_LEGGINGS, EquipmentAssetKeys.register("cactus_skin"), "leggings", false); + itemModelGenerator.registerArmor(ModItems.CACTUS_BOOTS, EquipmentAssetKeys.register("cactus_skin"), "boots", false); + + // itemModelGenerator.registerArmor(ModItems.CACTUS_HELMET, + // Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() + // .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), + // EquipmentSlot.HEAD); + + // itemModelGenerator.registerArmor(ModItems.CACTUS_CHESTPLATE, + // Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() + // .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), + // EquipmentSlot.CHEST); + // itemModelGenerator.registerArmor(ModItems.CACTUS_LEGGINGS, + // Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() + // .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), + // EquipmentSlot.LEGS); + // itemModelGenerator.registerArmor(ModItems.CACTUS_BOOTS, + // Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin"), EquipmentModel.builder() + // .addHumanoidLayers(Identifier.of(RafaelsUsefulCactus.MOD_ID, "cactus_skin")).build(), + // EquipmentSlot.FEET); } } diff --git a/src/main/java/net/rafael/usefulcactus/datagen/ModRecipeProvider.java b/src/main/java/net/rafael/usefulcactus/datagen/ModRecipeProvider.java index 1018f6a..06f5a32 100644 --- a/src/main/java/net/rafael/usefulcactus/datagen/ModRecipeProvider.java +++ b/src/main/java/net/rafael/usefulcactus/datagen/ModRecipeProvider.java @@ -4,8 +4,8 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; -import net.minecraft.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeGenerator; +import net.minecraft.data.recipe.RecipeExporter; +import net.minecraft.data.recipe.RecipeGenerator; import net.minecraft.item.Items; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.registry.RegistryWrapper; @@ -205,4 +205,6 @@ public void generate() { }; } + + } diff --git a/src/main/java/net/rafael/usefulcactus/item/ModArmorMaterials.java b/src/main/java/net/rafael/usefulcactus/item/ModArmorMaterials.java index b2c4158..2290762 100644 --- a/src/main/java/net/rafael/usefulcactus/item/ModArmorMaterials.java +++ b/src/main/java/net/rafael/usefulcactus/item/ModArmorMaterials.java @@ -4,11 +4,10 @@ import java.util.EnumMap; import net.minecraft.item.equipment.ArmorMaterial; +import net.minecraft.item.equipment.EquipmentAssetKeys; import net.minecraft.item.equipment.EquipmentType; import net.minecraft.sound.SoundEvents; -import net.minecraft.util.Identifier; import net.minecraft.util.Util; -import net.rafael.usefulcactus.RafaelsUsefulCactus; import net.rafael.usefulcactus.util.ModTags; public class ModArmorMaterials { @@ -20,6 +19,6 @@ public class ModArmorMaterials { map.put(EquipmentType.CHESTPLATE,6); map.put(EquipmentType.LEGGINGS,2); map.put(EquipmentType.BODY,4); - }),20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND,0,0,ModTags.Items.CACTUS_REPAIR, - Identifier.of(RafaelsUsefulCactus.MOD_ID,"cactus")); + }),20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND,0,0,ModTags.Items.CACTUS_REPAIR,EquipmentAssetKeys.register("cactus_skin")); + } \ No newline at end of file diff --git a/src/main/java/net/rafael/usefulcactus/item/custom/ModArmorItem.java b/src/main/java/net/rafael/usefulcactus/item/custom/ModArmorItem.java index dcecc8d..5f2a6ca 100644 --- a/src/main/java/net/rafael/usefulcactus/item/custom/ModArmorItem.java +++ b/src/main/java/net/rafael/usefulcactus/item/custom/ModArmorItem.java @@ -85,13 +85,8 @@ private boolean hasFullSuitOfArmorOn(PlayerEntity player) { * Checks if the player is wearing the correct set of armor for the given material. */ private boolean hasCorrectArmorOn(ArmorMaterial material, PlayerEntity player) { - - - return player.getInventory().armor.stream() .allMatch(stack -> stack.getItem() instanceof ArmorItem && - ((EquippableComponent) stack.getComponents().get(DataComponentTypes.EQUIPPABLE)).model().get() == material.modelId()); - - + ((EquippableComponent) stack.getComponents().get(DataComponentTypes.EQUIPPABLE)).equals(material)); } } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3478f1b..ddf0111 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,7 +30,7 @@ ], "depends": { "fabricloader": ">=0.16.9", - "minecraft": "~1.21.3", + "minecraft": "~1.21.4", "java": ">=21", "fabric-api": "*" }