HHZJ
版本1.12.2
有没有什么Mod可以单独调整空手攻击力或者禁用空手攻击?
如果没有,
如何使用Crt编写?
import crafttweaker.event.PlayerAttackEntityEvent;
import crafttweaker.event.IEventCancelable;
import crafttweaker.entity.IEntity;
import crafttweaker.player.IPlayer;
import crafttweaker.item.IItemStack;
import crafttweaker.entity.IEntityLivingBase;

events.onPlayerAttackEntity(function(event as PlayerAttackEntityEvent){
    var entity as IEntity = event.target;
        var player as IPlayer = event.player;
    if(!isNull(entity.definition)){
                if(!isNull(player.mainHandHeldItem)){
            event.cancel();
                }
        }
});
这段脚本能禁用,但功能反过来了(拿着物品不能攻击,空手能攻击)

minecraftLYC
虽然我没有找到模组,但是原版的命令就能实现: 先检测谁空手,再给空手的人虚弱。

无敌三脚猫
if(!isNull(player.mainHandHeldItem))
这段,去掉感叹号

HHZJ
无敌三脚猫 发表于 2022-7-27 08:55
if(!isNull(player.mainHandHeldItem))
这段,去掉感叹号

有没有可以修改伤害的参数?

Leo-qian
匠魂生存模组可以使空手攻击没伤害
https://www.mcmod.cn/class/2378.html
但是有很多其他的限制

无敌三脚猫
HHZJ 发表于 2022-7-27 09:23
有没有可以修改伤害的参数?

在PlayerAttackEntityEvent这个事件里是没法改的
可以用EntityLivingHurtEvent,也可以用EntityLivingDamageEvent,后一个事件触发得更迟,是在装备耐久消耗之后触发
这两个事件都可以改amount的值
记得要先判断伤害来源是否是玩家,不然所有伤害都会被改

HHZJ
无敌三脚猫 发表于 2022-7-27 16:18
在PlayerAttackEntityEvent这个事件里是没法改的
可以用EntityLivingHurtEvent,也可以用EntityLivingDam ...

好吧,谢谢

第一页 上一页 下一页 最后一页