added armor

This commit is contained in:
Jottyfan
2025-12-25 18:26:31 +01:00
parent 83ddc724bd
commit a4dd705db3
23 changed files with 175 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package de.jottyfan.minecraft.item;
import java.util.EnumMap;
import de.jottyfan.minecraft.Quickly;
import net.minecraft.core.Registry;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Util;
import net.minecraft.world.item.equipment.ArmorMaterial;
import net.minecraft.world.item.equipment.ArmorType;
import net.minecraft.world.item.equipment.EquipmentAsset;
/**
*
* @author jotty
*
*/
public class ModArmorMaterials {
static ResourceKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = ResourceKey.createRegistryKey(Identifier.fromNamespaceAndPath("minecraft", "equipment_asset"));
public static final ResourceKey<EquipmentAsset> TURQUOISE_KEY = ResourceKey.create(REGISTRY_KEY, Identifier.fromNamespaceAndPath(Quickly.MOD_ID, "turquoise"));
public static final ArmorMaterial TURQUOISE_ARMOR_MATERIAL = new ArmorMaterial(500, Util.make(new EnumMap<>(ArmorType.class), map -> {
map.put(ArmorType.BOOTS, 4);
map.put(ArmorType.LEGGINGS, 8);
map.put(ArmorType.CHESTPLATE, 15);
map.put(ArmorType.HELMET, 4);
map.put(ArmorType.BODY, 8);
}), 20, SoundEvents.ARMOR_EQUIP_DIAMOND, 0, 0, null, TURQUOISE_KEY);
}

View File

@@ -12,6 +12,7 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Item.Properties;
import net.minecraft.world.item.equipment.ArmorType;
/**
*
@@ -27,6 +28,16 @@ public class QuicklyItems {
public static final Item COTTONSEED = registerItem("cottonseed", properties -> new Plant(properties, "blockcottonplant"));
public static final Item ROTTENFLESHSTRIPES = registerItem("rotten_flesh_stripes");
public static final Item ARMOR_TURQUOISE_BOOTS = registerItem("turquoise_boots", ArmorType.BOOTS);
public static final Item ARMOR_TURQUOISE_HELMET = registerItem("turquoise_helmet", ArmorType.HELMET);
public static final Item ARMOR_TURQUOISE_LEGGINGS = registerItem("turquoise_leggings", ArmorType.LEGGINGS);
public static final Item ARMOR_TURQUOISE_CHESTPLATE = registerItem("turquoise_chestplate", ArmorType.CHESTPLATE);
private static final Item registerItem(String name, ArmorType armorType) {
return QuicklyItems.registerItem(name, new Item.Properties().stacksTo(1).humanoidArmor(ModArmorMaterials.TURQUOISE_ARMOR_MATERIAL, armorType));
}
private static final Item registerItem(String name) {
return QuicklyItems.registerItem(name, new Item.Properties());
}
@@ -54,6 +65,11 @@ public class QuicklyItems {
item.accept(COTTON);
item.accept(COTTONSEED);
item.accept(ROTTENFLESHSTRIPES);
item.accept(ARMOR_TURQUOISE_HELMET);
item.accept(ARMOR_TURQUOISE_CHESTPLATE);
item.accept(ARMOR_TURQUOISE_LEGGINGS);
item.accept(ARMOR_TURQUOISE_BOOTS);
});
}
}