命令/attribute

命令/attribute

本文章所述内容仅适用于Java版。

attribute

需要的权限等级

2

限制条件

用于更改或读取属性。

目录

1 语法

1.1 具体用法

2 参数

3 结果

4 输出

5 示例

6 历史

7 导航

语法[编辑 | 编辑源代码]

attribute get []

attribute base get []

attribute base reset

attribute base set

attribute modifier add (add_value|add_multiplied_total|add_multiplied_base)

attribute modifier remove

attribute modifier value get []

具体用法[编辑 | 编辑源代码]

attribute ...

... get []

返回指定属性的总值。

... base get []

返回指定属性的基值。

... base reset

重置指定属性默认值。

... base set

用给定值覆盖指定属性的基值。

... modifier ...

... add (add_value|add_multiplied_total|add_multiplied_base)

如果已不存在具有相同命名空间ID的修饰符,则添加具有指定属性的属性修饰符。

... remove

删除具有指定命名空间ID的属性修饰符。

... value get []

返回具有指定命名空间ID的修饰符的值。

参数[编辑 | 编辑源代码]

:entity

应用属性的实体。注意只有生物才有属性。

必须为玩家名、目标选择器或UUID。且目标选择器必须为单一数量,否则此命令将无法解析。

:resource

指定属性的命名空间ID。

必须是一个注册在minecraft:attribute注册表的一个注册项的命名空间ID。

:double

用于/execute store result命令,将获取的值与该值相乘的数字后再储存(小数会被截断取整)。

必须为 双精度浮点数。

:resource_location

指定修饰符的命名空间ID。

必须为命名空间ID,将会在命令执行时根据此ID尝试获取一个未注册内容,或发送至客户端由客户端处理。

:string

指定该属性修饰符的名称。

必须为 字符串。且必须为单个词或者引号括起的字符串。单个词允许的字符包括:-、+、.、_、A-Z、a-z、0-9。引号可用'或",引号内的引号与\前须加上转义字符\。

:double

指定要使用的值。

必须为 双精度浮点数。

结果[编辑 | 编辑源代码]

命令触发条件Java版

任意命令不完整或参数未正确指定 无法解析

无法选出单个生物(指定的玩家必须在线上) 执行失败

指定实体不存在该属性(例如玩家没有minecraft:horse.jump_strength属性)

/... modifier add ...相同命名空间ID的修饰符已存在

/... modifier remove ... /... modifier value get ...不存在具有指定命名空间ID的修饰符

任意不符合以上所有条件执行成功

输出[编辑 | 编辑源代码]

命令版本条件成功次数/execute store success .../execute store result ...

任意Java版执行失败000

/... get []执行成功11指定属性的值 (乘以 <倍率>),小数会被截断取整)

/... base get []执行成功11指定属性的基值 (乘以 <倍率>),小数会被截断取整)

/... modifier value get []执行成功11指定属性修饰符的值 (乘以 <倍率>),小数会被截断取整)

/... base set .../... modifier add .../... modifier remove ...执行成功111

示例[编辑 | 编辑源代码]

将自己的基础护甲值设定为5:

/attribute @s minecraft:armor base set 5

将所有玩家的最大生命值设置为1(经典极限生存):

/execute as @a run attribute @s minecraft:max_health base set 1

为最近一个玩家的重力属性添加命名空间ID为test:antigravity的“反重力”属性修饰符。

/attribute @p minecraft:gravity modifier add test:antigravity -0.16 add_value

移除最近一个玩家的“反重力”属性修饰符test:antigravity。

/attribute @p minecraft:gravity modifier remove test:antigravity

将最近一个玩家的重力属性基值重置为默认值。

/attribute @p minecraft:gravity base reset

历史[编辑 | 编辑源代码]

Java版1.1620w17a加入了/attribute。1.18.21.18.2-pre3属性参数的参数类型从resource_location改为resource。1.20.524w09a更改了operation参数的可能值:add->add_value,multiply_base->add_multiplied_base,multiply->add_multiplied_total。1.2124w21a移除了修饰符的uuid和name参数,现在均以命名空间IDid取代。1.21.424w44a加入了用于重置实体的属性默认值的子命令。

导航[编辑 | 编辑源代码]

编命令

当前可用

clear

clone

damage

deop

difficulty

effect

enchant

execute

experience

xp

fill

function

gamemode

gamerule

give

help

kick

kill

list

locate

loot

me

op

particle

place

playsound

recipe

reload

ride

say

schedule

scoreboard

setblock

setworldspawn

spawnpoint

spreadplayers

stop

stopsound

summon

tag

msg

tell

w

tellraw

time

title

teleport

tp

transfer

weather

whitelist

仅Java版

advancement

attribute

ban

ban-ip

banlist

bossbar

data

datapack

debug

defaultgamemode

dialog

fetchprofile[新增:JE 1.21.9]

fillbiome

forceload

item

jfr

pardon

pardon-ip

perf

publish

random

return

rotate

save-all

save-off

save-on

seed

setidletimeout

spectate

team

teammsg

tm

test

tick

trigger

version

warden_spawn_tracker

waypoint

worldborder

仅基岩版

allowlist

changesetting

clearrealmevents

gametips

project

reloadconfig

reloadpacketlimitconfig

save

sendshowstoreoffer

仅教育版

classroommode

code

getchunkdata

getchunks

geteduclientinfo

geteduserverinfo

getspawnpoint

globalpause

resourceuri

takepicture

基岩版和教育版

?

ability

agent

aimassist

camera

camerashake

clearspawnpoint

closewebsocket

codebuilder_actorinfo

controlscheme

daylock

alwaysday

dedicatedwsserver

dialogue

enableencryption

event

fog

gametest

gettopsolidblock

hud

immutableworld

inputpermission

listd

mobevent

music

permission

ops

playanimation

querytarget

replaceitem

script

scriptevent

setmaxplayers

structure

testforblocks

testforblock

testfor

tickingarea

titleraw

toggledownfall

worldbuilder

wsserver

connect

已移除

placefeature

仅Java版

?

achievement

banip

blockdata

broadcast

entitydata

home

iron

locatebiome

replaceitem

setspawn

solid

stats

toggledownfall

testfor

testforblock

testforblocks

unban

wood

仅基岩版

clearfixedinv

mixer

resupply

set_movement_authority

setfixedinvslot

setfixedinvslots

simulationtype

volumearea

仅教育版

collect

dropall

move

position

tpagent

transfer

turn

基岩版和教育版

attack

createagent

destroy

detect

detectredstone

drop

executeasother

executeasself

getitemcount

getitemdetail

getitemspace

inspectdata

inspect

place

till

transferserver

相关推荐

App Store预览

App Store预览

06-28 👁️ 3436
PPT中如何实现动画层叠?如何设置动画顺序?
计算机主机网关的作用是什么意思,电脑网关是什么意思?
「樽」字笔顺详解,动画演示,字帖下载
南京(九五)硬盒多少钱一包 南京(九五)价格表和图片
怎么第一次牵女生的手?如何自然地牵起女孩的手?
任攀:五一廣場東漢簡牘所見赦贛等人劫詩林等案復原
走你: a slang term to cheer someone up
微信视频怎么转发

微信视频怎么转发

08-06 👁️ 8521