added armor
Some checks failed
build / build (push) Has been cancelled

This commit is contained in:
Jottyfan
2026-01-10 17:14:40 +01:00
parent 042df08b9b
commit 28761d44c0
23 changed files with 187 additions and 17 deletions

View File

@@ -0,0 +1,30 @@
package de.jottyfan.minecraft.item;
import java.util.EnumMap;
import de.jottyfan.minecraft.Gtamfmd;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentAsset;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
public class ModArmorMaterial {
public static RegistryKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = RegistryKey
.ofRegistry(Identifier.ofVanilla("equipment_asset"));
public static final RegistryKey<EquipmentAsset> RUBY_KEY = RegistryKey.of(REGISTRY_KEY,
Identifier.of(Gtamfmd.MOD_ID, "ruby"));
public static final ArmorMaterial RUBY_ARMOR_MATERIAL = new ArmorMaterial(500,
Util.make(new EnumMap<>(EquipmentType.class), map -> {
map.put(EquipmentType.BOOTS, 3);
map.put(EquipmentType.LEGGINGS,4);
map.put(EquipmentType.CHESTPLATE, 10);
map.put(EquipmentType.HELMET, 3);
map.put(EquipmentType.BODY, 5);
}), 20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0, 0, null, RUBY_KEY);
}

View File

@@ -5,6 +5,7 @@ import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings; import net.minecraft.item.Item.Settings;
import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemGroups;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKey;
@@ -13,19 +14,26 @@ import net.minecraft.util.Identifier;
public class ModItems { public class ModItems {
public static final Item STUB = registerStubItem( public static final Item STUB = registerStubItem(Identifier.of(Gtamfmd.MOD_ID, "stub"), new Item.Settings());
Identifier.of(Gtamfmd.MOD_ID, "stub"), new Item.Settings());
public static final Item RUBY = registerItem( public static final Item RUBY = registerItem(Identifier.of(Gtamfmd.MOD_ID, "ruby"), new Item.Settings());
Identifier.of(Gtamfmd.MOD_ID, "ruby"), new Item.Settings()); public static final Item GINGERBREAD = registerItem(Identifier.of(Gtamfmd.MOD_ID, "gingerbread"),
public static final Item GINGERBREAD = registerItem( new Item.Settings().food(Food.GINGERBREAD.get()));
Identifier.of(Gtamfmd.MOD_ID, "gingerbread"), new Item.Settings()
.food(Food.GINGERBREAD.get())); public static final Item RUBY_BOOTS = registerArmorItem("ruby_boots", EquipmentType.BOOTS);
public static final Item RUBY_HELMET = registerArmorItem("ruby_helmet", EquipmentType.HELMET);
public static final Item RUBY_CHESTPLATE = registerArmorItem("ruby_chestplate", EquipmentType.CHESTPLATE);
public static final Item RUBY_LEGGINGS = registerArmorItem("ruby_leggings", EquipmentType.LEGGINGS);
private static Item registerArmorItem(String name, EquipmentType type) {
Identifier identifier = Identifier.of(Gtamfmd.MOD_ID, name);
Item.Settings settings = new Item.Settings().maxCount(1).armor(ModArmorMaterial.RUBY_ARMOR_MATERIAL, type);
return registerItem(identifier, settings);
}
private static Item registerStubItem(Identifier identifier, Settings settings) { private static Item registerStubItem(Identifier identifier, Settings settings) {
return Registry.register(Registries.ITEM, identifier, new StubItem( return Registry.register(Registries.ITEM, identifier, new StubItem(
settings.useItemPrefixedTranslationKey() settings.useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))));
.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))));
} }
private static Item registerItem(Identifier identifier, Settings settings) { private static Item registerItem(Identifier identifier, Settings settings) {
@@ -37,11 +45,14 @@ public class ModItems {
public static void registerModItems() { public static void registerModItems() {
Gtamfmd.LOGGER.info("registering mod items for " + Gtamfmd.MOD_ID); Gtamfmd.LOGGER.info("registering mod items for " + Gtamfmd.MOD_ID);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS) ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(entries -> {
.register(entries -> { entries.add(STUB);
entries.add(STUB); entries.add(RUBY);
entries.add(RUBY); entries.add(GINGERBREAD);
entries.add(GINGERBREAD); entries.add(RUBY_HELMET);
}); entries.add(RUBY_CHESTPLATE);
entries.add(RUBY_LEGGINGS);
entries.add(RUBY_BOOTS);
});
} }
} }

View File

@@ -0,0 +1,14 @@
{
"layers": {
"humanoid": [
{
"texture": "gtamfmd:ruby"
}
],
"humanoid_leggings": [
{
"texture": "gtamfmd:ruby"
}
]
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "gtamfmd:item/ruby_boots"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "gtamfmd:item/ruby_chestplate"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "gtamfmd:item/ruby_helmet"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "gtamfmd:item/ruby_leggings"
}
}

View File

@@ -4,5 +4,9 @@
"item.gtamfmd.ruby": "Rubin", "item.gtamfmd.ruby": "Rubin",
"item.gtamfmd.ruby_block": "Rubinblock", "item.gtamfmd.ruby_block": "Rubinblock",
"item.gtamfmd.ruby_ore": "Rubinerz", "item.gtamfmd.ruby_ore": "Rubinerz",
"item.gtamfmd.christmastree": "Weihnachtsbaum" "item.gtamfmd.christmastree": "Weihnachtsbaum",
"item.gtamfmd.ruby_helmet": "Rubinhelm",
"item.gtamfmd.ruby_chestplate": "Rubinbrustpanzer",
"item.gtamfmd.ruby_leggings": "Rubinhose",
"item.gtamfmd.ruby_boots": "Rubinschuhe"
} }

View File

@@ -4,5 +4,9 @@
"item.gtamfmd.ruby": "Ruby", "item.gtamfmd.ruby": "Ruby",
"item.gtamfmd.ruby_block": "Ruby block", "item.gtamfmd.ruby_block": "Ruby block",
"item.gtamfmd.ruby_ore": "Ruby ore", "item.gtamfmd.ruby_ore": "Ruby ore",
"item.gtamfmd.christmastree": "Christmas tree" "item.gtamfmd.christmastree": "Christmas tree",
"item.gtamfmd.ruby_helmet": "ruby helmet",
"item.gtamfmd.ruby_chestplate": "ruby chestplate",
"item.gtamfmd.ruby_leggings": "ruby leggings",
"item.gtamfmd.ruby_boots": "ruby boots"
} }

View File

@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "gtamfmd:item/ruby_boots"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "gtamfmd:item/ruby_chestplate"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "gtamfmd:item/ruby_helmet"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "gtamfmd:item/ruby_leggings"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"t t",
"t t"
],
"key": {
"t": "gtamfmd:ruby"
},
"result": {
"id": "gtamfmd:ruby_boots",
"count": 1
}
}

View File

@@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"t t",
"ttt",
"ttt"
],
"key": {
"t": "gtamfmd:ruby"
},
"result": {
"id": "gtamfmd:ruby_chestplate",
"count": 1
}
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ttt",
"t t"
],
"key": {
"t": "gtamfmd:ruby"
},
"result": {
"id": "gtamfmd:ruby_helmet",
"count": 1
}
}

View File

@@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ttt",
"t t",
"t t"
],
"key": {
"t": "gtamfmd:ruby"
},
"result": {
"id": "gtamfmd:ruby_leggings",
"count": 1
}
}