• 浏览量:610
  • 创建日期:1年前
  • 最后编辑:1年前
  • 编辑次数:2次

历史编辑记录更多
    最近参与编辑
    限制具有特殊标签物品的使用与攻击 (CanHit)

    定位

    Key: utility.canhit

    运行环境需求

    服务端需装   当服务器安装时客户端可选,否则需装

    原文

    Adds a new CanHit tag that affects melee attacks, bows, crossbows, and tridents. Also works on arrows and fireworks, in which case the restrictions will be AND'd with the restrictions of the bow or crossbow doing the firing. The tag must be a list of strings, which may contain UUIDs that match a specific entity or an entity type ID optionally prefixed with a ! to invert the match. If installed on the client, adds hit information to the tooltip. You can hide this information by creating an NBT byte set to 1 called "HideCanHit". For example, a sword that can only hit spiders: /give @p diamond_sword{CanHit:["spider"]} A sword that can hit anything but creepers: /give @p diamond_sword{CanHit:["!creeper"]}

    内容

    添加影响近战攻击、弓、弩和三叉戟的新 CanHit 标签。也适用于箭和烟花。如果安装在客户端上,则将命中信息添加到工具提示中。不过玩家可以通过创建一个名为“HideCanHit”的 NBT 字节设置为 1 来隐藏此信息。

    原理

    限制将进行射击或攻击的弓;弩以及其他物品进行“AND”的运算。标签必须是字符串列表,其中可能包含与特定实体或实体类型 ID 匹配的 UUID。

    简单解释

    例如,一把只能击中蜘蛛的剑:

    /give @p diamond_sword{CanHit:["spider"]}

    一把可以击中爬行者以外的任何东西的剑:

    /give @p diamond_sword{CanHit:["!creeper"]}
    • 拥有"canhit"标签的物品将只能打中标签上物品的实体,比如一只箭上有"canhit"标签并且标签里的实体类型只有蜘蛛,那么这只箭无论是通过手持攻击还是通过弓箭射出去也只能打中蜘蛛。当拥有"canhit"标签的物品攻击不在canhit标签下的实体时会导致攻击无效化。

    图例

    限制具有特殊标签物品的使用与攻击-第1张图片图例

    短评加载中..