@@ -16,6 +16,7 @@ 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.component.UseCooldown
|
||||
import net.minecraft.world.item.equipment.*
|
||||
import net.minecraft.world.level.Level
|
||||
import java.util.Optional
|
||||
@@ -65,37 +66,51 @@ object Witherite {
|
||||
)
|
||||
|
||||
val SWORD = register("witherite_sword", ::WitheriteSword,
|
||||
Item.Properties().sword(ToolMaterial.NETHERITE, 3F, -2.4F)
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.component(DataComponents.USE_COOLDOWN, UseCooldown(0.0f))
|
||||
.sword(ToolMaterial.NETHERITE, 3F, -2.4F)
|
||||
)
|
||||
|
||||
val AXE = register("witherite_axe", ::Item,
|
||||
Item.Properties().axe(ToolMaterial.NETHERITE, 5F, -3F))
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.axe(ToolMaterial.NETHERITE, 5F, -3F))
|
||||
|
||||
|
||||
val HELMET = register(
|
||||
"witherite_helmet",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.HELMET)
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.durability(ArmorType.HELMET.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val CHESTPLATE = register(
|
||||
"witherite_chestplate",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
.durability(ArmorType.CHESTPLATE.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val LEGGINGS = register(
|
||||
"witherite_leggings",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
.durability(ArmorType.LEGGINGS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val BOOTS = register(
|
||||
"witherite_boots",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
.durability(ArmorType.BOOTS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
@@ -110,14 +125,19 @@ class WitheriteSword(properties: Properties) : Item(properties) {
|
||||
if (level.isClientSide) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
if (!user.isCrouching) return InteractionResult.PASS
|
||||
|
||||
val stack = user.getItemInHand(hand)
|
||||
if (user.cooldowns.isOnCooldown(stack)) return InteractionResult.PASS
|
||||
|
||||
val skull = WitherSkull(EntityType.WITHER_SKULL, level)
|
||||
skull.setPos(user.eyePosition)
|
||||
skull.deltaMovement = user.lookAngle
|
||||
level.addFreshEntity(skull)
|
||||
skull.playSound(SoundEvents.WITHER_SHOOT)
|
||||
|
||||
user.cooldowns.addCooldown(stack, 25)
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user