XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

MyDimension-Lord

【我的世界】我的维度附属模组:维度之主

公开
关注 0 Fork 0 Star 0
UTF-8
package com.xfestudio.mydimensionlord.platform;

import com.xfestudio.mydimensionlord.equipment.EquipmentRules;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;

public final class EquipmentCombat {
    private EquipmentCombat() {}
    public static boolean cooling(Player player, ItemStack stack) { return player.getCooldowns().isOnCooldown(stack.getItem()); }
    public static boolean hurt(Player player, LivingEntity target, float damage) { return target.hurt(player.damageSources().playerAttack(player), damage); }
    public static void spend(Player player, ItemStack stack, InteractionHand hand) {
        player.getCooldowns().addCooldown(stack.getItem(), EquipmentRules.SLASH_COOLDOWN);
        stack.hurtAndBreak(EquipmentRules.SLASH_DURABILITY_COST, player, broken -> broken.broadcastBreakEvent(hand));
    }
}