版本:1.14.4原版
1.使用/trigger指令来开关和切换计分板是否可行?如果可行,应该如何实现?
2.如何制作一个统计玩家使用任何工具挖掘方块数量的挖掘榜?
1.使用/trigger指令来开关和切换计分板是否可行?如果可行,应该如何实现?
2.如何制作一个统计玩家使用任何工具挖掘方块数量的挖掘榜?
本帖最后由 xmdhs 于 2019-11-27 20:03 编辑
什么意思?什么目的?
2. 只能用蠢办法咯。
复制代码
复制代码
1.使用/trigger指令来开关和切换计分板是否可行?如果可行,应该如何实现?
什么意思?什么目的?
2. 只能用蠢办法咯。
- # 加载一次
- scoreboard objectives add 0 dummy
- scoreboard objectives add 1 minecraft.used:minecraft.iron_pickaxe
- scoreboard objectives add 2 minecraft.used:minecraft.diamond_pickaxe
- scoreboard objectives add 3 minecraft.used:minecraft.golden_pickaxe
- scoreboard objectives add 4 minecraft.used:minecraft.stone_pickaxe
- scoreboard objectives add 5 minecraft.used:minecraft.wooden_pickaxe
- # 高频
- scoreboard players operation @a 0 = @a 1
- scoreboard players operation @a 0 += @a 2
- scoreboard players operation @a 0 += @a 3
- scoreboard players operation @a 0 += @a 4
- scoreboard players operation @a 0 += @a 5
xmdhs 发表于 2019-11-27 19:55
什么意思?什么目的?
2. 只能用蠢办法咯。
这种方法如果再加上铲子斧头等工具的话工程量和卡顿就会比较大。有没有简洁优雅点的?
leafcreeper 发表于 2019-11-27 20:09
这种方法如果再加上铲子斧头等工具的话工程量和卡顿就会比较大。有没有简洁优雅点的? ...
如果这种量你的电脑就受不了 那还是换电脑吧(计分板是属于能耗极低的命令)
但是更简单的方法……进度(
Jokey_钥匙 发表于 2019-11-27 20:43
如果这种量你的电脑就受不了 那还是换电脑吧(计分板是属于能耗极低的命令)
但是更简单的方法……进度( ...
能详细讲讲“更简单的方法”吗?
leafcreeper 发表于 2019-11-27 21:47
能详细讲讲“更简单的方法”吗?
1.13+用tags将工具分类 然后用进度检测是否有该类物品耐久损害
https://minecraft-zh.gamepedia.com/进度
第一个主要是想做什么应用呢?
举例下面这一个命令里:
/tellraw @p ["",{"text":"\n\n minecraft 1.14.4 test ","color":"green","bold":true},{"text":" > > > > > > \n","color":"yellow","bold":true},{"text":" 123 set to 1 ","color":"gray","clickEvent":{"action":"run_command","value":"/trigger test123 set 1"}},{"text":"|"},{"text":" 123 add 1 ","color":"dark_purple","clickEvent":{"action":"run_command","value":"/trigger test123 add 1"}},{"text":"|"},{"text":" 123 add 10 ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger test123 add 10"}},{"text":"|\n"},{"text":" 456 set to 1 ","color":"black","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 set 1"}},{"text":"|"},{"text":" 456 add 1 ","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 add 1"}},{"text":"|"},{"text":" 456 add 10 ","color":"dark_blue","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 add 10"}},{"text":"\n~~ ~~ ~~ ~~ ~~","color":"yellow","bold":true}]
有两个记分板 test123和test 456,玩家可以点按就能增加记分板项。但若要切换,比如按同样一段文字就从计分项test123转为test 456,再按一次又从test456转成test123,这样功能应需要用function达成。

第二个,
进度里面似乎不能放标签组tag,例如#minecraft:ore;另外用各种工具、徒手都能挖矿,还是决定以身上物品变更为判断依据来写。
建立记分板:
/scoreboard objectives add 123 dummy {"text":"haveoneore"}
接着是放在.minecraft\saves\1_14_4TEST_world\datapacks\minetestpack\data\quicktest\advancements\mine路径中的进度a.json里面的内容:
复制代码
当持有物品有任一以下原矿时,自动达成此进度。
gold_ore、 iron_ore、 coal_ore、 lapis_ore、 diamond_ore、 redstone_ore、 emerald_ore、 nether_quartz_ore
可以直接执行命令给自己此进度测试:
/advancement grant @p only quicktest:mine/a
当达成这个进度时,会自动启动一次.minecraft\saves\1_14_4TEST_world\datapacks\minetestpack\data\quicktest\functions路径中的count.mcfunction。里面的内容:
复制代码
里面基本上就是放置想要执行的记分板计算或其他命令,最后加上消除进度以重新侦测。
挖掘榜就每个玩家用相同记分板(如上面例子中的123),并在侧边栏显示就会自动排序了。
最后标绿色的字可改动,记得里面内容也要一同跟着改就行。
举例下面这一个命令里:
/tellraw @p ["",{"text":"\n\n minecraft 1.14.4 test ","color":"green","bold":true},{"text":" > > > > > > \n","color":"yellow","bold":true},{"text":" 123 set to 1 ","color":"gray","clickEvent":{"action":"run_command","value":"/trigger test123 set 1"}},{"text":"|"},{"text":" 123 add 1 ","color":"dark_purple","clickEvent":{"action":"run_command","value":"/trigger test123 add 1"}},{"text":"|"},{"text":" 123 add 10 ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger test123 add 10"}},{"text":"|\n"},{"text":" 456 set to 1 ","color":"black","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 set 1"}},{"text":"|"},{"text":" 456 add 1 ","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 add 1"}},{"text":"|"},{"text":" 456 add 10 ","color":"dark_blue","bold":true,"clickEvent":{"action":"run_command","value":"/trigger test456 add 10"}},{"text":"\n~~ ~~ ~~ ~~ ~~","color":"yellow","bold":true}]
有两个记分板 test123和test 456,玩家可以点按就能增加记分板项。但若要切换,比如按同样一段文字就从计分项test123转为test 456,再按一次又从test456转成test123,这样功能应需要用function达成。

第二个,
进度里面似乎不能放标签组tag,例如#minecraft:ore;另外用各种工具、徒手都能挖矿,还是决定以身上物品变更为判断依据来写。
建立记分板:
/scoreboard objectives add 123 dummy {"text":"haveoneore"}
接着是放在.minecraft\saves\1_14_4TEST_world\datapacks\minetestpack\data\quicktest\advancements\mine路径中的进度a.json里面的内容:
- {
- "display": {
- "icon": {
- "item": "minecraft:diamond_pickaxe"
- },
- "title": {"translate":"收集成功!"},
- "description": {"translate":"得到一块原矿"},
- "background": "minecraft:textures/block/barrel_top.png",
- "show_toast": false,
- "announce_to_chat": true,
- "frame": "task",
- "hidden": false
- },
- "rewards": {
- "function": "quicktest:count"
- },
- "criteria": {
- "1": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:gold_ore"
- }
- ]
- }
- },
- "2": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:iron_ore"
- }
- ]
- }
- },
- "3": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:coal_ore"
- }
- ]
- }
- },
- "4": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:lapis_ore"
- }
- ]
- }
- },
- "5": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:diamond_ore"
- }
- ]
- }
- },
- "6": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:redstone_ore"
- }
- ]
- }
- },
- "7": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:emerald_ore"
- }
- ]
- }
- },
- "8": {
- "trigger": "minecraft:inventory_changed",
- "conditions": {
- "items": [
- {
- "item": "minecraft:nether_quartz_ore"
- }
- ]
- }
- }
- },
- "requirements": [
- [
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8"
- ]
- ]
- }
当持有物品有任一以下原矿时,自动达成此进度。
gold_ore、 iron_ore、 coal_ore、 lapis_ore、 diamond_ore、 redstone_ore、 emerald_ore、 nether_quartz_ore
可以直接执行命令给自己此进度测试:
/advancement grant @p only quicktest:mine/a
当达成这个进度时,会自动启动一次.minecraft\saves\1_14_4TEST_world\datapacks\minetestpack\data\quicktest\functions路径中的count.mcfunction。里面的内容:
- scoreboard objectives setdisplay sidebar 123
- scoreboard players add @s 123 1
- advancement revoke @s only quicktest:mine/a
里面基本上就是放置想要执行的记分板计算或其他命令,最后加上消除进度以重新侦测。
挖掘榜就每个玩家用相同记分板(如上面例子中的123),并在侧边栏显示就会自动排序了。
最后标绿色的字可改动,记得里面内容也要一同跟着改就行。
execute trigger分数为指定值得玩家execute盔甲架执行关闭切换计分板的指令咯。
方块掉落同时检测没有标志的方块给方块上一个防伪标志,每上一次防伪标志就给最近玩家+1分,已有比如HideFlags:1的方块不检测不转化
然而还是楼上几位比较精确,这个容易出bug,有的时候省事是暂时的,修复bug和漏洞才是真的麻烦
方块掉落同时检测没有标志的方块给方块上一个防伪标志,每上一次防伪标志就给最近玩家+1分,已有比如HideFlags:1的方块不检测不转化
然而还是楼上几位比较精确,这个容易出bug,有的时候省事是暂时的,修复bug和漏洞才是真的麻烦