added armor
build / build (push) Has been cancelled

This commit is contained in:
Jottyfan
2026-05-14 12:39:51 +02:00
parent ae51e83dac
commit 7393ee53ce
23 changed files with 186 additions and 9 deletions
@@ -0,0 +1,30 @@
package de.jottyfan.minecraft.gta.item;
import java.util.EnumMap;
import de.jottyfan.minecraft.gta.Uno;
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;
public class ModArmorMaterial {
public static ResourceKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = ResourceKey
.createRegistryKey(Identifier.withDefaultNamespace("equipment_asset"));
public static final ResourceKey<EquipmentAsset> RUBY_KEY = ResourceKey.create(REGISTRY_KEY,
Identifier.fromNamespaceAndPath(Uno.MOD_ID, "ruby"));
public static final ArmorMaterial RUBY_ARMOR_MATERIAL = new ArmorMaterial(500,
Util.make(new EnumMap<>(ArmorType.class), map -> {
map.put(ArmorType.BOOTS, 3);
map.put(ArmorType.LEGGINGS,4);
map.put(ArmorType.CHESTPLATE, 10);
map.put(ArmorType.HELMET, 3);
map.put(ArmorType.BODY, 5);
}), 20, SoundEvents.ARMOR_EQUIP_DIAMOND, 0, 0, null, RUBY_KEY);
}
@@ -10,21 +10,37 @@ import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Item.Properties;
import net.minecraft.world.item.equipment.ArmorType;
public class UnoItems {
public static final Item STUB = registerStubItem(Identifier.fromNamespaceAndPath(Uno.MOD_ID, "stub"));
public static final Item RUBY = registerItem(Identifier.fromNamespaceAndPath(Uno.MOD_ID, "ruby"));
public static final Item STUB = registerStubItem("stub");
public static final Item RUBY = registerItem("ruby");
private static final Item RUBY_BOOTS = registerArmorItem("ruby_boots", ArmorType.BOOTS);
private static final Item RUBY_HELMET = registerArmorItem("ruby_helmet", ArmorType.HELMET);
private static final Item RUBY_CHESTPLATE = registerArmorItem("ruby_chestplate", ArmorType.CHESTPLATE);
private static final Item RUBY_LEGGINGS = registerArmorItem("ruby_leggings", ArmorType.LEGGINGS);
private static final Item registerStubItem(Identifier identifier) {
return registerItem(identifier, new Item.Properties()
private static final Item registerArmorItem(String name, ArmorType type) {
Item.Properties properties = new Item.Properties()
.humanoidArmor(ModArmorMaterial.RUBY_ARMOR_MATERIAL, type);
return registerItem(name, properties);
}
private static final Item registerItem(String name, Properties properties) {
return registerItem(name, properties, Item::new);
}
private static final Item registerStubItem(String name) {
return registerItem(name, new Item.Properties()
.food(Food.DELICIOUS_STUB.get()), StubItem::new);
}
private static final Item registerItem(Identifier identifier) {
return registerItem(identifier, new Item.Properties(), Item::new);
private static final Item registerItem(String name) {
return registerItem(name, new Item.Properties(), Item::new);
}
private static final Item registerItem(Identifier identifier, Properties properties, Function<Item.Properties, Item> function) {
private static final Item registerItem(String name, Properties properties, Function<Item.Properties, Item> function) {
Identifier identifier = Identifier.fromNamespaceAndPath(Uno.MOD_ID, name);
Item item = function.apply(properties.setId(ResourceKey.create(Registries.ITEM, identifier)).modelId(identifier).useItemDescriptionPrefix());
return Registry.register(BuiltInRegistries.ITEM, identifier, item);
}
@@ -0,0 +1,16 @@
{
"layers": {
"humanoid": [
{
"texture": "uno:ruby"
}
],
"humanoid_leggings": [
{
"texture": "uno:ruby"
}
]
}
}
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "uno:item/ruby_boots"
}
}
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "uno:item/ruby_chestplate"
}
}
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "uno:item/ruby_helmet"
}
}
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "uno:item/ruby_leggings"
}
}
@@ -3,5 +3,9 @@
"item.uno.ruby": "Rubin",
"item.uni.ruby_block": "Rubinblock",
"item.uni.ruby_ore": "Rubinerz",
"item.uni.ruby_deepslate_ore": "Rubintiefenerz"
"item.uni.ruby_deepslate_ore": "Rubintiefenerz",
"item.uni.ruby_helmet": "Rubinhelm",
"item.uni.ruby_chestplate": "Rubinbrustpanzer",
"item.uni.ruby_leggings": "Rubinhose",
"item.uni.ruby_boots": "Rubinschuhe"
}
@@ -3,5 +3,9 @@
"item.uno.ruby": "Ruby",
"item.uno.ruby_block": "Ruby block",
"item.uno.ruby_ore": "Ruby ore",
"item.uno.ruby_deepslate_ore": "Ruby deepslate ore"
"item.uno.ruby_deepslate_ore": "Ruby deepslate ore",
"item.uno.ruby_helmet": "ruby helmet",
"item.uno.ruby_chestplate": "ruby chestplate",
"item.uno.ruby_leggings": "ruby leggings",
"item.uno.ruby_boots": "ruby boots"
}
@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "uno:item/ruby_boots"
}
}
@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "uno:item/ruby_chestplate"
}
}
@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "uno:item/ruby_helmet"
}
}
@@ -0,0 +1,6 @@
{
"parent": "item/coal",
"textures": {
"layer0": "uno: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

@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"t t",
"t t"
],
"key": {
"t": "uno:ruby"
},
"result": {
"id": "uno:ruby_boots",
"count": 1
}
}
@@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"t t",
"ttt",
"ttt"
],
"key": {
"t": "uno:ruby"
},
"result": {
"id": "uno:ruby_chestplate",
"count": 1
}
}
@@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ttt",
"t t"
],
"key": {
"t": "uno:ruby"
},
"result": {
"id": "uno:ruby_helmet",
"count": 1
}
}
@@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ttt",
"t t",
"t t"
],
"key": {
"t": "uno:ruby"
},
"result": {
"id": "uno:ruby_leggings",
"count": 1
}
}