custom items now use new builder DSL syntax, implementing first new set begins tmr
build / build (push) Failing after 3m16s
build / build (push) Failing after 3m16s
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
package dev.zxq5.items.sets
|
||||
|
||||
import dev.zxq5.items.core.ArmorSet
|
||||
import dev.zxq5.items.core.GenericGearSet
|
||||
import dev.zxq5.items.ModItems.register
|
||||
import net.minecraft.core.component.DataComponents
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.sounds.SoundSource
|
||||
import net.minecraft.util.Unit
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResult
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ToolMaterial
|
||||
import net.minecraft.world.item.component.UseCooldown
|
||||
import net.minecraft.world.item.equipment.*
|
||||
import net.minecraft.world.level.Level
|
||||
|
||||
|
||||
object Dragonite: GenericGearSet() {
|
||||
override val materialName = "dragonite"
|
||||
override val materialDefinition
|
||||
get() = super.materialDefinition.copy(assetId = materialKey)
|
||||
|
||||
val SWORD = register("dragonite_sword", ::DragoniteSword,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.component(DataComponents.USE_COOLDOWN, UseCooldown(2f))
|
||||
.sword(ToolMaterial.NETHERITE, 3.0F, -2.4F)
|
||||
)
|
||||
val HELMET = register(
|
||||
"dragonite_helmet",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.HELMET)
|
||||
.durability(ArmorType.HELMET.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val CHESTPLATE = register(
|
||||
"dragonite_chestplate",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
.component(DataComponents.GLIDER, Unit.INSTANCE)
|
||||
.durability(ArmorType.CHESTPLATE.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val LEGGINGS = register(
|
||||
"dragonite_leggings",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
.durability(ArmorType.LEGGINGS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val BOOTS = register(
|
||||
"dragonite_boots",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
.durability(ArmorType.BOOTS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val INGOT = register(
|
||||
"dragonite_ingot",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
)
|
||||
|
||||
val SCALE = register(
|
||||
"dragon_scale",
|
||||
::Item,
|
||||
Item.Properties()
|
||||
)
|
||||
|
||||
override val armorSet: ArmorSet = ArmorSet(HELMET, CHESTPLATE, LEGGINGS, BOOTS)
|
||||
override val items = listOf(SWORD, HELMET, CHESTPLATE, LEGGINGS, BOOTS, SCALE, INGOT)
|
||||
override fun onLoad() {}
|
||||
}
|
||||
|
||||
class DragoniteSword(properties: Properties) : Item(properties) {
|
||||
override fun use(level: Level, user: Player, hand: InteractionHand): InteractionResult {
|
||||
if (level.isClientSide || !Dragonite.fullSetEquippedBy(user)) return InteractionResult.PASS
|
||||
|
||||
val direction = user.lookAngle
|
||||
|
||||
val scale = if (user.isFallFlying) { 4.0 } else { 1.5 }
|
||||
user.deltaMovement = direction.scale(scale)
|
||||
user.hurtMarked = true
|
||||
|
||||
level.playSound(null, user.x, user.y, user.z,
|
||||
SoundEvents.ENDER_DRAGON_FLAP, SoundSource.PLAYERS, 1.0f, 1.0f)
|
||||
|
||||
// TODO("fix this broken ahh code. WHY TF DOES FABRIC HAVE NO DOCUMENTATION FOR BASICALLY ANYTHING.")
|
||||
// (level as? ServerLevel)?.sendParticles(
|
||||
// ParticleTypes.DRAGON_BREATH as ParticleOptions,
|
||||
// user.x, user.y, user.z,
|
||||
// 100, 0.5, 0.5, 0.5, 0.5
|
||||
// )
|
||||
|
||||
return InteractionResult.SUCCESS
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user