Simple Tritanium Armor, some balancing to regular tritanium armor

This commit is contained in:
DBotThePony 2023-04-16 12:43:20 +07:00
parent 3976c6da56
commit c5d9ba34dd
Signed by: DBot
GPG Key ID: DCC23B5715498507
12 changed files with 145 additions and 22 deletions

View File

@ -281,8 +281,8 @@ fun addAdvancements(serializer: Consumer<Advancement>, existingFileHelper: Exist
title = translation.add("armor", "Composite Armor") {
russian("Композитная броня")
},
description = translation.add("armor.desc", "Bend some Tritanium Plates into simple yet sturdy armor") {
russian("Согните немного тритановых пластин в простую, но прочную, броню")
description = translation.add("armor.desc", "Bend some Tritanium Plates and Carbon Mesh into incredibly sturdy armor") {
russian("Согните немного тритановых пластин вместе с углеродной сеткой в невероятно прочную броню")
}
)
.requirements(RequirementsStrategy.OR)
@ -292,6 +292,24 @@ fun addAdvancements(serializer: Consumer<Advancement>, existingFileHelper: Exist
.addCriterion("has_item3", criterion(MItems.TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/armor"), existingFileHelper)
AdvancementBuilder()
.parent(ingot)
.display(
itemStack = ItemStack(MItems.SIMPLE_TRITANIUM_CHESTPLATE),
title = translation.add("simple_armor", "Sturdy Armor") {
russian("Прочная броня")
},
description = translation.add("simple_armor.desc", "Put togeher Simple Tritanium Armor from Tritanium Ingots, simple and effective") {
russian("Создайте простую тритановую броню из слитков, просто и эффективно")
}
)
.requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.SIMPLE_TRITANIUM_HELMET))
.addCriterion("has_item1", criterion(MItems.SIMPLE_TRITANIUM_CHESTPLATE))
.addCriterion("has_item2", criterion(MItems.SIMPLE_TRITANIUM_PANTS))
.addCriterion("has_item3", criterion(MItems.SIMPLE_TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/simple_armor"), existingFileHelper)
val glass = AdvancementBuilder()
.parent(plate)
.display(

View File

@ -515,6 +515,11 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_PANTS, "Tritanium Leggings")
add(MItems.TRITANIUM_BOOTS, "Tritanium Boots")
add(MItems.SIMPLE_TRITANIUM_HELMET, "Simple Tritanium Helmet")
add(MItems.SIMPLE_TRITANIUM_CHESTPLATE, "Simple Tritanium Chestplate")
add(MItems.SIMPLE_TRITANIUM_PANTS, "Simple Tritanium Leggings")
add(MItems.SIMPLE_TRITANIUM_BOOTS, "Simple Tritanium Boots")
add(MItems.TRITANIUM_DUST, "Tritanium Dust")
add(MItems.TRITANIUM_INGOT, "Tritanium Ingot")
add(MItems.TRITANIUM_NUGGET, "Tritanium Nugget")

View File

@ -520,6 +520,11 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_PANTS, "Тритановые поножи")
add(MItems.TRITANIUM_BOOTS, "Тритановые ботинки")
add(MItems.SIMPLE_TRITANIUM_HELMET, "Простой тритановый шлем")
add(MItems.SIMPLE_TRITANIUM_CHESTPLATE, "Простой тритановый нагрудник")
add(MItems.SIMPLE_TRITANIUM_PANTS, "Простые тритановые поножи")
add(MItems.SIMPLE_TRITANIUM_BOOTS, "Простые тритановые ботинки")
add(MItems.TRITANIUM_DUST, "Тритановая пыль")
add(MItems.TRITANIUM_INGOT, "Тритановый слиток")
add(MItems.TRITANIUM_NUGGET, "Тритановый самородок")

View File

@ -204,6 +204,33 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
// простая броня
MatteryRecipe(MItems.SIMPLE_TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.SIMPLE_TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.SIMPLE_TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.SIMPLE_TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
// простые батарейки
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
.rowB(Tags.Items.DUSTS_REDSTONE)

View File

@ -99,6 +99,11 @@ fun addTags(tagsProvider: TagsProvider) {
.add("chestplates", MItems.TRITANIUM_CHESTPLATE)
.add("leggings", MItems.TRITANIUM_PANTS)
.add("boots", MItems.TRITANIUM_BOOTS)
.add("helmets", MItems.SIMPLE_TRITANIUM_HELMET)
.add("chestplates", MItems.SIMPLE_TRITANIUM_CHESTPLATE)
.add("leggings", MItems.SIMPLE_TRITANIUM_PANTS)
.add("boots", MItems.SIMPLE_TRITANIUM_BOOTS)
tagsProvider.items.forge("tools")
.add("swords", MItems.TRITANIUM_SWORD)
.add("axes", MItems.TRITANIUM_AXE)

View File

@ -47,7 +47,7 @@ import ru.dbotthepony.mc.otm.config.ServerConfig;
import ru.dbotthepony.mc.otm.config.ToolsConfig;
import ru.dbotthepony.mc.otm.core.math.Decimal;
import ru.dbotthepony.mc.otm.item.ExplosiveHammerItem;
import ru.dbotthepony.mc.otm.item.ItemTritaniumArmor;
import ru.dbotthepony.mc.otm.item.TritaniumArmorItem;
import ru.dbotthepony.mc.otm.item.QuantumBatteryItem;
import ru.dbotthepony.mc.otm.item.weapon.AbstractWeaponItem;
import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem;
@ -190,7 +190,7 @@ public final class OverdriveThatMatters {
EVENT_BUS.addListener(EventPriority.LOWEST, KillAsAndroidTrigger.INSTANCE::onKill);
EVENT_BUS.addListener(EventPriority.NORMAL, EnderTeleporterFeature.Companion::onEntityDeath);
EVENT_BUS.addListener(EventPriority.HIGH, ItemTritaniumArmor.Companion::onHurt);
EVENT_BUS.addListener(EventPriority.HIGH, TritaniumArmorItem.Companion::onHurt);
EVENT_BUS.addListener(EventPriority.NORMAL, ExplosiveHammerItem.Companion::onLeftClickBlock);

View File

@ -46,7 +46,9 @@ fun onMatteryTick(event: MatteryPlayerCapability.PostTick) {
val rand = event.level.random
val noSpacesuits = event.player.armorSlots.count { it.item !is SpaceSuit }
val yesTritanium = if (!ServerCompatConfig.AdAstra.TRITANIUM_ARMOR_PROTECTS_AGAINST_COSMIC_RAYS) 0.0 else event.player.armorSlots.count { it.item in MItems.TRITANIUM_ARMOR } * 0.75
val yesTritanium0 = if (!ServerCompatConfig.AdAstra.TRITANIUM_ARMOR_PROTECTS_AGAINST_COSMIC_RAYS) 0.0 else event.player.armorSlots.count { it.item in MItems.TRITANIUM_ARMOR } * 0.75
val yesTritanium1 = if (!ServerCompatConfig.AdAstra.TRITANIUM_ARMOR_PROTECTS_AGAINST_COSMIC_RAYS) 0.0 else event.player.armorSlots.count { it.item in MItems.SIMPLE_TRITANIUM_ARMOR } * 0.2
val yesTritanium = yesTritanium0 + yesTritanium1
if (rand.nextDouble() <= (noSpacesuits - yesTritanium) * ServerCompatConfig.AdAstra.ANDROID_COSMIC_RAYS_CHANCE) {
event.player.hurt(MRegistry.DAMAGE_COSMIC_RAYS, 1f)

View File

@ -0,0 +1,45 @@
package ru.dbotthepony.mc.otm.item
import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.item.ArmorItem
import net.minecraft.world.item.ArmorMaterial
import net.minecraft.world.item.crafting.Ingredient
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.MItemTags
private object SimpleTritaniumArmorMaterial : ArmorMaterial {
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
return when (p_40410_) {
EquipmentSlot.HEAD -> 380
EquipmentSlot.CHEST -> 590
EquipmentSlot.LEGS -> 500
EquipmentSlot.FEET -> 420
else -> throw IllegalArgumentException("yo dude what the fuck $p_40410_")
}
}
override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int {
return when (p_40411_) {
EquipmentSlot.FEET -> 2
EquipmentSlot.LEGS -> 6
EquipmentSlot.CHEST -> 7
EquipmentSlot.HEAD -> 2
else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_")
}
}
override fun getEnchantmentValue() = 9
override fun getEquipSound(): SoundEvent = SoundEvents.ARMOR_EQUIP_IRON
override fun getRepairIngredient(): Ingredient = Ingredient.of(MItemTags.TRITANIUM_INGOTS)
const val ID = "${OverdriveThatMatters.MOD_ID}:simple_tritanium_armor"
override fun getName(): String = ID
override fun getToughness() = 0.3f
override fun getKnockbackResistance() = 0f
}
class SimpleTritaniumArmorItem(slot: EquipmentSlot) : ArmorItem(SimpleTritaniumArmorMaterial, slot, Properties().stacksTo(1)) {
}

View File

@ -14,7 +14,6 @@ import net.minecraft.world.item.Rarity
import net.minecraft.world.item.crafting.Ingredient
import net.minecraftforge.client.extensions.common.IClientItemExtensions
import net.minecraftforge.event.entity.living.LivingAttackEvent
import net.minecraftforge.event.entity.living.LivingHurtEvent
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel
import ru.dbotthepony.mc.otm.registry.MItemTags
@ -24,33 +23,33 @@ import java.util.function.Consumer
private object TritaniumArmorMaterial : ArmorMaterial {
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
return when (p_40410_) {
EquipmentSlot.FEET -> 470
EquipmentSlot.LEGS -> 540
EquipmentSlot.CHEST -> 820
EquipmentSlot.HEAD -> 520
else -> throw IllegalArgumentException("yo dude what the fuck")
EquipmentSlot.CHEST -> 920
EquipmentSlot.LEGS -> 650
EquipmentSlot.FEET -> 540
else -> throw IllegalArgumentException("yo dude what the fuck $p_40410_")
}
}
override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int {
return when (p_40411_) {
EquipmentSlot.HEAD -> 4
EquipmentSlot.CHEST -> 9
EquipmentSlot.LEGS -> 7
EquipmentSlot.FEET -> 3
EquipmentSlot.LEGS -> 6
EquipmentSlot.CHEST -> 8
EquipmentSlot.HEAD -> 3
else -> throw IllegalArgumentException("yo dude what the fuck")
else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_")
}
}
override fun getEnchantmentValue() = 9
override fun getEquipSound(): SoundEvent = SoundEvents.ARMOR_EQUIP_IRON
override fun getRepairIngredient(): Ingredient = Ingredient.of(MItemTags.TRITANIUM_INGOTS)
override fun getRepairIngredient(): Ingredient = Ingredient.of(MItemTags.REINFORCED_TRITANIUM_PLATES)
const val ID = "${OverdriveThatMatters.MOD_ID}:tritanium_armor"
override fun getName(): String = ID
override fun getToughness() = 1f
override fun getKnockbackResistance() = 0.05f
override fun getKnockbackResistance() = 0.08f
}
private object TritaniumArmorRenderProperties : IClientItemExtensions {
@ -68,7 +67,7 @@ private object TritaniumArmorRenderProperties : IClientItemExtensions {
}
}
class ItemTritaniumArmor(slot: EquipmentSlot) : ArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
class TritaniumArmorItem(slot: EquipmentSlot) : ArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
super.initializeClient(consumer)
consumer.accept(TritaniumArmorRenderProperties)

View File

@ -141,6 +141,7 @@ internal fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
accept(MItems.TRITANIUM_INGOT_BLOCK)
accept(MItems.TRITANIUM_TOOLS)
accept(MItems.SIMPLE_TRITANIUM_ARMOR)
accept(MItems.TRITANIUM_ARMOR)
energized(MItems.ENERGY_SWORD)

View File

@ -8,7 +8,6 @@ import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.food.FoodProperties
import net.minecraft.world.item.*
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraftforge.common.ForgeTier
import net.minecraftforge.common.TierSortingRegistry
@ -205,10 +204,15 @@ object MItems {
::TRITANIUM_SHIELD,
)
val TRITANIUM_HELMET: ItemTritaniumArmor by registry.register(MNames.TRITANIUM_HELMET) { ItemTritaniumArmor(EquipmentSlot.HEAD) }
val TRITANIUM_CHESTPLATE: ItemTritaniumArmor by registry.register(MNames.TRITANIUM_CHESTPLATE) { ItemTritaniumArmor(EquipmentSlot.CHEST) }
val TRITANIUM_PANTS: ItemTritaniumArmor by registry.register(MNames.TRITANIUM_PANTS) { ItemTritaniumArmor(EquipmentSlot.LEGS) }
val TRITANIUM_BOOTS: ItemTritaniumArmor by registry.register(MNames.TRITANIUM_BOOTS) { ItemTritaniumArmor(EquipmentSlot.FEET) }
val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(EquipmentSlot.HEAD) }
val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(EquipmentSlot.CHEST) }
val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(EquipmentSlot.LEGS) }
val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(EquipmentSlot.FEET) }
val SIMPLE_TRITANIUM_HELMET: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_HELMET) { SimpleTritaniumArmorItem(EquipmentSlot.HEAD) }
val SIMPLE_TRITANIUM_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(EquipmentSlot.CHEST) }
val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(EquipmentSlot.LEGS) }
val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(EquipmentSlot.FEET) }
val TRITANIUM_ARMOR = SupplierList(
::TRITANIUM_HELMET,
@ -217,6 +221,13 @@ object MItems {
::TRITANIUM_BOOTS
)
val SIMPLE_TRITANIUM_ARMOR = SupplierList(
::SIMPLE_TRITANIUM_HELMET,
::SIMPLE_TRITANIUM_CHESTPLATE,
::SIMPLE_TRITANIUM_PANTS,
::SIMPLE_TRITANIUM_BOOTS
)
val EXPLOSIVE_HAMMER: ExplosiveHammerItem by registry.register("explosive_hammer") { ExplosiveHammerItem() }
val ENERGY_SWORD: Item by registry.register(MNames.ENERGY_SWORD) { EnergySwordItem() }

View File

@ -130,6 +130,11 @@ object MNames {
const val TRITANIUM_PANTS = "tritanium_pants"
const val TRITANIUM_BOOTS = "tritanium_boots"
const val SIMPLE_TRITANIUM_HELMET = "simple_tritanium_helmet"
const val SIMPLE_TRITANIUM_CHESTPLATE = "simple_tritanium_chestplate"
const val SIMPLE_TRITANIUM_PANTS = "simple_tritanium_pants"
const val SIMPLE_TRITANIUM_BOOTS = "simple_tritanium_boots"
// tools
const val TRITANIUM_SWORD = "tritanium_sword"
const val TRITANIUM_AXE = "tritanium_axe"