@@ -17,17 +17,16 @@ 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.BlocksAttacks
|
||||
import net.minecraft.world.item.component.UseCooldown
|
||||
import net.minecraft.world.item.equipment.*
|
||||
import net.minecraft.world.level.Level
|
||||
import java.util.Optional
|
||||
|
||||
|
||||
object Dragonite {
|
||||
const val BASE_DURABILITY = 40;
|
||||
val witherite_material_key: ResourceKey<EquipmentAsset> = ResourceKey.create<EquipmentAsset>(
|
||||
val MATERIAL: ResourceKey<EquipmentAsset> = ResourceKey.create<EquipmentAsset>(
|
||||
EquipmentAssets.ROOT_ID,
|
||||
Identifier.fromNamespaceAndPath(Fantasysmp.MOD_ID, "dragon")
|
||||
Identifier.fromNamespaceAndPath(Fantasysmp.MOD_ID, "dragonite")
|
||||
)
|
||||
|
||||
val armorMaterial = ArmorMaterial(
|
||||
@@ -44,39 +43,49 @@ object Dragonite {
|
||||
3.0f,
|
||||
0.1f,
|
||||
ItemTags.REPAIRS_NETHERITE_ARMOR,
|
||||
witherite_material_key,
|
||||
MATERIAL,
|
||||
)
|
||||
|
||||
val SWORD = register("dragon_sword", ::DragoniteSword,
|
||||
val SWORD = register("dragonite_sword", ::DragoniteSword,
|
||||
Item.Properties()
|
||||
.enchantable(armorMaterial.enchantmentValue)
|
||||
.component(DataComponents.USE_COOLDOWN, UseCooldown(0.0f))
|
||||
.sword(ToolMaterial.NETHERITE, 3.0F, -2.4F)
|
||||
)
|
||||
val HELMET = register(
|
||||
"dragon_helmet",
|
||||
"dragonite_helmet",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.HELMET)
|
||||
Item.Properties()
|
||||
.enchantable(Witherite.armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.HELMET)
|
||||
.durability(ArmorType.HELMET.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val CHESTPLATE = register(
|
||||
"dragon_chestplate",
|
||||
"dragonite_chestplate",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
Item.Properties()
|
||||
.enchantable(Witherite.armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.CHESTPLATE)
|
||||
.component(DataComponents.GLIDER, Unit.INSTANCE)
|
||||
.durability(ArmorType.CHESTPLATE.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val LEGGINGS = register(
|
||||
"dragon_leggings",
|
||||
"dragonite_leggings",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
Item.Properties()
|
||||
.enchantable(Witherite.armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.LEGGINGS)
|
||||
.durability(ArmorType.LEGGINGS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
val BOOTS = register(
|
||||
"dragon_boots",
|
||||
"dragonite_boots",
|
||||
::Item,
|
||||
Item.Properties().humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
Item.Properties()
|
||||
.enchantable(Witherite.armorMaterial.enchantmentValue)
|
||||
.humanoidArmor(armorMaterial , ArmorType.BOOTS)
|
||||
.durability(ArmorType.BOOTS.getDurability(armorMaterial.durability))
|
||||
)
|
||||
|
||||
|
||||
@@ -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