@ -86,7 +86,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
|||||||
provider.generated(MItems.EXOPACK_PROBE)
|
provider.generated(MItems.EXOPACK_PROBE)
|
||||||
|
|
||||||
provider.handheld(MItems.TRITANIUM_TOOLS)
|
provider.handheld(MItems.TRITANIUM_TOOLS)
|
||||||
provider.generated(MItems.TRITANIUM_ARMOR)
|
provider.armorColored(MItems.TRITANIUM_ARMOR)
|
||||||
provider.armorWithTrims(MItems.SIMPLE_TRITANIUM_ARMOR)
|
provider.armorWithTrims(MItems.SIMPLE_TRITANIUM_ARMOR)
|
||||||
|
|
||||||
provider.handheld(MItems.CHEST_UPGRADER)
|
provider.handheld(MItems.CHEST_UPGRADER)
|
||||||
|
@ -105,6 +105,14 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
|||||||
fun armorWithTrims(vararg items: Item) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
fun armorWithTrims(vararg items: Item) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
||||||
fun armorWithTrims(items: Collection<Item>) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
fun armorWithTrims(items: Collection<Item>) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
||||||
|
|
||||||
|
fun armorColored(item: Item) = exec {
|
||||||
|
withExistingParent(item.registryName!!.path, GENERATED)
|
||||||
|
.texture("layer0", modLocation("item/${item.registryName!!.path}_base"))
|
||||||
|
.texture("layer1", modLocation("item/${item.registryName!!.path}_overlay"))
|
||||||
|
}
|
||||||
|
fun armorColored(vararg items: Item) = items.forEach { armorColored(it) }
|
||||||
|
fun armorColored(items: Collection<Item>) = items.forEach { armorColored(it) }
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val ARMOR_TRIM_MATERIALS = listOf("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst")
|
val ARMOR_TRIM_MATERIALS = listOf("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst")
|
||||||
val GENERATED = ResourceLocation("minecraft", "item/generated")
|
val GENERATED = ResourceLocation("minecraft", "item/generated")
|
||||||
|
@ -208,12 +208,22 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
|
|
||||||
// броня
|
// броня
|
||||||
MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
|
MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
|
||||||
|
.setUpgradeSource(Items.LEATHER_HELMET)
|
||||||
|
.addUpgradeOps(
|
||||||
|
UpgradeRecipe.Direct("display"),
|
||||||
|
UpgradeRecipe.Direct("Enchantments"),
|
||||||
|
)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_HELMET, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_HELMET, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
|
MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
|
||||||
|
.setUpgradeSource(Items.LEATHER_LEGGINGS)
|
||||||
|
.addUpgradeOps(
|
||||||
|
UpgradeRecipe.Direct("display"),
|
||||||
|
UpgradeRecipe.Direct("Enchantments"),
|
||||||
|
)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_LEGGINGS, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_LEGGINGS, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
@ -221,6 +231,11 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
|
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
|
||||||
|
.setUpgradeSource(Items.LEATHER_CHESTPLATE)
|
||||||
|
.addUpgradeOps(
|
||||||
|
UpgradeRecipe.Direct("display"),
|
||||||
|
UpgradeRecipe.Direct("Enchantments"),
|
||||||
|
)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_CHESTPLATE, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_CHESTPLATE, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
@ -228,6 +243,11 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
|
MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
|
||||||
|
.setUpgradeSource(Items.LEATHER_BOOTS)
|
||||||
|
.addUpgradeOps(
|
||||||
|
UpgradeRecipe.Direct("display"),
|
||||||
|
UpgradeRecipe.Direct("Enchantments"),
|
||||||
|
)
|
||||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_BOOTS, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_BOOTS, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||||
|
@ -3,20 +3,17 @@ package ru.dbotthepony.mc.otm.item.armor
|
|||||||
import net.minecraft.client.model.HumanoidModel
|
import net.minecraft.client.model.HumanoidModel
|
||||||
import net.minecraft.sounds.SoundEvent
|
import net.minecraft.sounds.SoundEvent
|
||||||
import net.minecraft.sounds.SoundEvents
|
import net.minecraft.sounds.SoundEvents
|
||||||
import net.minecraft.world.damagesource.DamageSource
|
|
||||||
import net.minecraft.world.damagesource.DamageTypes
|
import net.minecraft.world.damagesource.DamageTypes
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.entity.EquipmentSlot
|
import net.minecraft.world.entity.EquipmentSlot
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.item.ArmorItem
|
import net.minecraft.world.item.*
|
||||||
import net.minecraft.world.item.ArmorMaterial
|
|
||||||
import net.minecraft.world.item.ItemStack
|
|
||||||
import net.minecraft.world.item.Rarity
|
|
||||||
import net.minecraft.world.item.crafting.Ingredient
|
import net.minecraft.world.item.crafting.Ingredient
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions
|
||||||
import net.minecraftforge.event.entity.living.LivingAttackEvent
|
import net.minecraftforge.event.entity.living.LivingAttackEvent
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel
|
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel
|
||||||
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
@ -66,18 +63,28 @@ private object TritaniumArmorRenderProperties : IClientItemExtensions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TritaniumArmorItem(slot: Type) : ArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
|
class TritaniumArmorItem(slot: Type) : DyeableArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
|
||||||
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
||||||
super.initializeClient(consumer)
|
super.initializeClient(consumer)
|
||||||
consumer.accept(TritaniumArmorRenderProperties)
|
consumer.accept(TritaniumArmorRenderProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getArmorTexture(stack: ItemStack?, entity: Entity?, slot: EquipmentSlot?, type: String?): String {
|
override fun getArmorTexture(stack: ItemStack, entity: Entity, slot: EquipmentSlot, type: String?): String =
|
||||||
return TEXTURE_LOCATION
|
if (type.equals("overlay")) TEXTURE_LOCATION_OVERLAY else TEXTURE_LOCATION_BASE
|
||||||
|
|
||||||
|
override fun getColor(stack: ItemStack): Int {
|
||||||
|
val tag = stack.getTagElement("display")?: return TRITANIUM_COLOR
|
||||||
|
if (tag.contains("color", 99)) {
|
||||||
|
return tag.getInt("color")
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRITANIUM_COLOR
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TEXTURE_LOCATION = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor.png"
|
val TRITANIUM_COLOR = RGBAColor(157, 187, 204).toARGB()
|
||||||
|
const val TEXTURE_LOCATION_BASE = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor_base.png"
|
||||||
|
const val TEXTURE_LOCATION_OVERLAY = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor_overlay.png"
|
||||||
|
|
||||||
fun onHurt(event: LivingAttackEvent) {
|
fun onHurt(event: LivingAttackEvent) {
|
||||||
if (event.source.typeHolder().`is`(DamageTypes.SWEET_BERRY_BUSH) || event.source.msgId == "sweetBerryBush") {
|
if (event.source.typeHolder().`is`(DamageTypes.SWEET_BERRY_BUSH) || event.source.msgId == "sweetBerryBush") {
|
||||||
|
@ -5,11 +5,13 @@ import com.google.common.collect.Streams
|
|||||||
import net.minecraft.advancements.CriteriaTriggers
|
import net.minecraft.advancements.CriteriaTriggers
|
||||||
import net.minecraft.client.renderer.item.ItemProperties
|
import net.minecraft.client.renderer.item.ItemProperties
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.core.cauldron.CauldronInteraction
|
||||||
import net.minecraft.core.registries.Registries
|
import net.minecraft.core.registries.Registries
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.world.entity.EntityType
|
import net.minecraft.world.entity.EntityType
|
||||||
import net.minecraft.world.entity.ai.village.poi.PoiType
|
import net.minecraft.world.entity.ai.village.poi.PoiType
|
||||||
import net.minecraft.world.entity.ai.village.poi.PoiTypes
|
import net.minecraft.world.entity.ai.village.poi.PoiTypes
|
||||||
|
import net.minecraft.world.item.DyeableArmorItem
|
||||||
import net.minecraft.world.item.Items
|
import net.minecraft.world.item.Items
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.block.*
|
import net.minecraft.world.level.block.*
|
||||||
@ -318,7 +320,7 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeCommon(event: FMLCommonSetupEvent) {
|
private fun initializeCommon(event: FMLCommonSetupEvent) {
|
||||||
|
registerCauldronHandlers()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeClient(event: FMLClientSetupEvent) {
|
private fun initializeClient(event: FMLClientSetupEvent) {
|
||||||
@ -353,8 +355,15 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun registerCauldronHandlers() {
|
||||||
|
MItems.TRITANIUM_ARMOR.forEach { CauldronInteraction.WATER[it] = CauldronInteraction.DYED_ITEM }
|
||||||
|
}
|
||||||
|
|
||||||
private fun registerItemColorHandlers(event: RegisterColorHandlersEvent.Item) {
|
private fun registerItemColorHandlers(event: RegisterColorHandlersEvent.Item) {
|
||||||
event.register(DynamicFluidContainerModel.Colors(), MItems.FLUID_CAPSULE)
|
event.register(DynamicFluidContainerModel.Colors(), MItems.FLUID_CAPSULE)
|
||||||
|
event.register({ stack, layer -> if (layer == 0) (stack.item as DyeableArmorItem).getColor(stack) else -1 },
|
||||||
|
*MItems.TRITANIUM_ARMOR.toTypedArray()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
|
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
|
||||||
|
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |