added robes items

This commit is contained in:
Ryan
2025-01-21 19:57:28 +02:00
parent 146dba3dac
commit 8e2ec142b1
8 changed files with 151 additions and 10 deletions

View File

@@ -26,6 +26,7 @@ public class TerraOriginum implements ModInitializer {
cottonItems.register();
sunTotem.register();
ghostlyItems.register();
robesItems.register();
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(umbrella.UMBRELLA));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(sunTotem.SUN_TOTEM));

View File

@@ -0,0 +1,89 @@
package com.smithy.terraoriginum.customMaterials;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import java.util.function.Supplier;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.items.cottonItems;
public enum robesMaterial implements ArmorMaterial {
ROBES("robes", 42, new int[] { 4, 9, 7, 4 }, 19,
SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 5, 0.1f, () -> Ingredient.ofItems(cottonItems.COTTON_BALL));
private final String name;
private final int durabilityMultiplier;
private final int[] protectionAmounts;
private final int enchantability;
private final SoundEvent equipSound;
private final float toughness;
private final float knockbackResistance;
private final Supplier<Ingredient> repairIngredient;
private static final int[] BASE_DURABILITY = { 11, 16, 15, 13 };
robesMaterial(
String name,
int durabilityMultiplier,
int[] protectionAmounts,
int enchantability,
SoundEvent equipSound,
float toughness,
float knockbackResistance,
Supplier<Ingredient> repairIngredient
) {
this.name = name;
this.durabilityMultiplier = durabilityMultiplier;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = repairIngredient;
}
@Override
public int getDurability(ArmorItem.Type type) {
return BASE_DURABILITY[type.ordinal()] * this.durabilityMultiplier;
}
@Override
public int getProtection(ArmorItem.Type type) {
return protectionAmounts[type.ordinal()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
@Override
public String getName() {
return TerraOriginum.MOD_ID + ":" + this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
}

View File

@@ -0,0 +1,34 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.customMaterials.robesMaterial;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
public class robesItems {
public static final Item ROBES_HELMET = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.HELMET, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_CHESTPLATE = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.CHESTPLATE, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_LEGGING = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.LEGGINGS, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_BOOTS = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.BOOTS, new FabricItemSettings().rarity(Rarity.EPIC));
public static void register() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_helmet"), ROBES_HELMET);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_chestplate"), ROBES_CHESTPLATE);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_leggings"), ROBES_LEGGING);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_boots"), ROBES_BOOTS);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_HELMET));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_CHESTPLATE));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_LEGGING));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_BOOTS));
}
}

View File

@@ -1,5 +0,0 @@
{
"values": [
"terraoriginum:tick"
]
}