Skip to content

Commit

Permalink
Updated to 1.21.4 - UNSOLVED - Models Not Working
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelmehdiyev committed Dec 8, 2024
1 parent bf821cd commit fe537f3
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,4 +14,4 @@ maven_group=net.rafael.usefulcactus
archives_base_name=rafaels-useful-cactus

# Dependencies
fabric_version=0.110.0+1.21.3
fabric_version=0.111.0+1.21.4
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
51 changes: 27 additions & 24 deletions src/main/java/net/rafael/usefulcactus/datagen/ModModelProvider.java
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -205,4 +205,6 @@ public void generate() {

};
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"));

}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"depends": {
"fabricloader": ">=0.16.9",
"minecraft": "~1.21.3",
"minecraft": "~1.21.4",
"java": ">=21",
"fabric-api": "*"
}
Expand Down

0 comments on commit fe537f3

Please sign in to comment.