This repository has been archived by the owner on Jul 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRubyArmorMaterial.kt
58 lines (48 loc) · 2.11 KB
/
RubyArmorMaterial.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.theonlytails.rubymod.util.enums
import com.theonlytails.rubymod.id
import com.theonlytails.rubymod.registries.ItemRegistry
import net.minecraft.inventory.EquipmentSlotType
import net.minecraft.item.IArmorMaterial
import net.minecraft.item.crafting.Ingredient
import net.minecraft.util.SoundEvent
import net.minecraft.util.SoundEvents
import net.minecraftforge.common.util.Lazy
/**
* Holds the properties of any ruby armor piece.
*
* @author TheOnlyTails
*
* @property materialName The name of this armor material.
* @property maxDamageFactor Determines the durability of each piece.
* @property damageReductionAmount Determines how much each piece can block damage.
* @property enchantability Determines how good the enchantments will be when enchanting this armor in an enchanting table.
* @property soundEvent The sound this armor makes.
* @property toughness How much this armor protects against powerful hits.
* @property repairMaterial What item is used to repair this armor.
* @property knockbackResistance How resistant this armor is to knockback.
*/
enum class RubyArmorMaterial(
private val materialName: String, private val maxDamageFactor: Int,
private val damageReductionAmount: IntArray, private val enchantability: Int,
private val soundEvent: SoundEvent, private val toughness: Float,
private val repairMaterial: Lazy<Ingredient>, private val knockbackResistance: Float,
) : IArmorMaterial {
RUBY(
id("ruby").toString(),
24, intArrayOf(2, 5, 6, 2),
18,
SoundEvents.ARMOR_EQUIP_GENERIC,
0f,
Lazy.of { Ingredient.of(ItemRegistry.ruby) },
0.5f
);
override fun getDurabilityForSlot(slotIn: EquipmentSlotType) =
intArrayOf(11, 16, 15, 13)[slotIn.index] * maxDamageFactor
override fun getDefenseForSlot(slotIn: EquipmentSlotType) = damageReductionAmount[slotIn.index]
override fun getEnchantmentValue() = enchantability
override fun getEquipSound(): SoundEvent = soundEvent
override fun getRepairIngredient(): Ingredient = repairMaterial.get()
override fun getToughness() = toughness
override fun getName() = materialName
override fun getKnockbackResistance() = knockbackResistance
}