@@ -2,22 +2,23 @@ package dev.zxq5.items
|
||||
|
||||
import dev.zxq5.Fantasysmp
|
||||
import dev.zxq5.items.ModItems.register
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.core.component.DataComponents
|
||||
import net.minecraft.resources.Identifier
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.sounds.SoundSource
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraft.util.Unit
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResult
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.EntityType
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.entity.projectile.hurtingprojectile.WitherSkull
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ToolMaterial
|
||||
import net.minecraft.world.item.component.BlocksAttacks
|
||||
import net.minecraft.world.item.equipment.*
|
||||
import net.minecraft.world.level.Level
|
||||
import java.util.Optional
|
||||
|
||||
|
||||
object Witherite {
|
||||
@@ -44,38 +45,62 @@ object Witherite {
|
||||
witherite_material_key,
|
||||
)
|
||||
|
||||
val WITHERITE_SWORD = register("witherite_sword", ::WitheriteSword,
|
||||
Item.Properties().sword(ToolMaterial.NETHERITE, 3.0F, -2.4F)
|
||||
val SHIELD = register("witherite_shield", ::Item,
|
||||
Item.Properties().component(DataComponents.BLOCKS_ATTACKS, BlocksAttacks(
|
||||
0.25f, // 5 tick warmup
|
||||
1.0f, // standard disable cooldown
|
||||
listOf(
|
||||
BlocksAttacks.DamageReduction(
|
||||
90.0f, // horizontalBlockingAngle — 90° arc each side (180° total, same as vanilla)
|
||||
Optional.empty(), // type — empty = blocks all damage types
|
||||
0.0f, // base — flat damage reduction
|
||||
1.0f // factor — multiplier (1.0 = block 100% of damage)
|
||||
)
|
||||
), // full block — check if this constant exists, else build the list manually
|
||||
BlocksAttacks.ItemDamageFunction.DEFAULT, // check for this constant too
|
||||
Optional.empty(), // no bypass
|
||||
Optional.empty(), // default block sound
|
||||
Optional.empty() // default disable sound
|
||||
))
|
||||
)
|
||||
val WITHERITE_HELMET = register(
|
||||
|
||||
val SWORD = register("witherite_sword", ::WitheriteSword,
|
||||
Item.Properties().sword(ToolMaterial.NETHERITE, 3F, -2.4F)
|
||||
)
|
||||
|
||||
val AXE = register("witherite_axe", ::Item,
|
||||
Item.Properties().axe(ToolMaterial.NETHERITE, 5F, -3F))
|
||||
|
||||
val HELMET = register(
|
||||
"witherite_helmet",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.HELMET)
|
||||
.durability(ArmorType.HELMET.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val WITHERITE_CHESTPLATE = register(
|
||||
val CHESTPLATE = register(
|
||||
"witherite_chestplate",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
.durability(ArmorType.CHESTPLATE.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val WITHERITE_LEGGINGS = register(
|
||||
val LEGGINGS = register(
|
||||
"witherite_leggings",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
.durability(ArmorType.LEGGINGS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val WITHERITE_BOOTS = register(
|
||||
val BOOTS = register(
|
||||
"witherite_boots",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
.durability(ArmorType.BOOTS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val ITEMS = listOf(WITHERITE_SWORD, WITHERITE_HELMET, WITHERITE_CHESTPLATE, WITHERITE_LEGGINGS, WITHERITE_BOOTS)
|
||||
val ITEMS = listOf(SWORD, AXE, SHIELD, HELMET, CHESTPLATE, LEGGINGS, BOOTS)
|
||||
val ARMOUR_SET = ArmorSet(HELMET, CHESTPLATE, LEGGINGS, BOOTS)
|
||||
|
||||
fun init() {}
|
||||
}
|
||||
@@ -86,6 +111,8 @@ class WitheriteSword(properties: Properties) : Item(properties) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
if (!user.isCrouching) return InteractionResult.PASS
|
||||
|
||||
val skull = WitherSkull(EntityType.WITHER_SKULL, level)
|
||||
skull.setPos(user.eyePosition)
|
||||
skull.deltaMovement = user.lookAngle
|
||||
|
||||
Reference in New Issue
Block a user