gamerule
需要的权限等级
Java版:2基岩版:1
限制条件
启用作弊(仅对于某些规则)[仅基岩版]
设置或查询游戏规则。
目录
1 语法
2 参数
3 结果
4 输出
5 示例
6 历史
7 导航
语法[编辑 | 编辑源代码]
Java版
gamerule <规则名称> [
参数在Java版中区分大小写。
基岩版
gamerule
gamerule
gamerule
参数在基岩版中输入时不区分大小写。
参数[编辑 | 编辑源代码]
主条目:游戏规则 § 游戏规则列表
JE:<规则名称>
BE:rule: BoolGameRule:enum或rule: IntGameRule:enum
指定要设置或查询的游戏规则。只有某些预设的游戏规则会影响游戏玩法(见预设游戏规则)。
JE:
BE:value: Boolean:enum或value: int:int
指定将游戏规则设置的值。只有true或false指定预设的游戏规则会真正影响游戏玩法,但是对于maxEntityCramming[仅Java版]、randomTickSpeed、spawnRadius、playersSleepingPercentage、functionCommandLimit[仅基岩版]和maxCommandChainLength,任何整数(-2147483648~2147483647)都会影响游戏玩法(见预设游戏规则)。
结果[编辑 | 编辑源代码]
命令触发条件Java版基岩版
任意参数未正确指定 无法解析 无法解析
不符合以上所有条件执行成功
输出[编辑 | 编辑源代码]
命令版本条件成功次数/execute store success .../execute store result ...
任意Java版执行成功11该游戏规则在命令执行后的数值(true为1,false为0)
基岩版执行失败0N/AN/A
执行成功1N/AN/A
示例[编辑 | 编辑源代码]
停止昼夜更替: gamerule doDaylightCycle false
停止自然恢复生命值: gamerule naturalRegeneration false
禁止苦力怕、恶魂等生物改变方块: gamerule mobGriefing false
停止天气变化: gamerule doWeatherCycle false
在玩家死亡时保留物品栏: gamerule keepInventory true
防止TNT爆炸:gamerule tntExplodes false
防止玩家互相攻击:[仅基岩版]gamerule pvp false
屏蔽命令方块执行成功后在控制台显示的文本内容:gamerule commandBlockOutput false
设置玩家重生半径为25格:gamerule spawnRadius 25
设置一格之内最大实体堆叠数量为100:gamerule maxEntityCramming 100
历史[编辑 | 编辑源代码]
Java版1.4.212w32a加入了/gamerule。1.814w29a加入了创建虚拟规则的能力。1.1317w45a不再接受未知值(自定义游戏规则)。现在会对值进行类型检查。携带版1.0.51.0.5.0加入了/gamerule。基岩版?不再接受未知值(自定义游戏规则)。
导航[编辑 | 编辑源代码]
查
论
编命令
当前可用
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
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
仅基岩版
aimassist
allowlist
changesetting
clearrealmevents
controlscheme
gametips
project
reloadconfig
save
sendshowstoreoffer
仅教育版
classroommode
code
getchunkdata
getchunks
geteduclientinfo
geteduserverinfo
getspawnpoint
globalpause
takepicture
基岩版和教育版
?
ability
agent
camera
camerashake
clearspawnpoint
codebuilder_actorinfo
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
locatebiome
replaceitem
setspawn
solid
stats
toggledownfall
testfor
testforblock
testforblocks
unban
仅基岩版
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