村民任意交易编辑器说明书 |
您所在的位置:网站首页 › 村民职业对应的物品 › 村民任意交易编辑器说明书 |
该数据包可以修改村民的交易栏,最大9栏。同时可以设置交易次数,是否返还经验,返还经验的值。 演示视频传送门:AV90831996 食用方法: function vtc:edit让最近一名村民进入编辑状态 function vtc:return让最近一名进入编辑状态的村民恢复状态 进入编辑状态的村民会有粒子效果指引,同时在村民脚下两格的位置的箱子会显示出村民的交易栏 在箱子内就是村民的交易栏编辑界面。每列对应村民的每一交易栏 每一行分别代表:交易所需第一个物品,交易所需第二个物品,交易可得物品 如何改变最大交易次数: 1. trigger VTC-MAXUSES add/set 设置最大交易次数 2. function vtc:settings/mu+num 来编辑你要设置的交易栏 例如编辑第一个栏最大交易次数为5 trigger VTC-MAXUSES set 5 function vtc:s/mu1 (vtc:settings可以用vtc:s代替) 编辑第三个栏最大交易次数为6 trigger VTC-MAXUSES set 6 function vtc:s/mu3 在编辑完毕后VTC-MAXUSE的分数不会清除 如何改变返还经验的值 1. trigger VTC-XP add/set 设置返还的经验值 2. function vtc:s/xp+num 来编辑你要设置的交易栏 例如编辑第一个栏返还经验值为15 trigger VTC-XP set 15 function vtc:s/xp1 如何改变是否返还经验 1. trigger VTC-REWARDEXP add/set 设置分数 小于等于0,关闭,大于等于1,开启 2. function vtc:s/re+num 来编辑你要设置的交易栏 例子操作完全相同,不进行举例
data\minecraft\tags\functions\load.json { "replace": false, "values": [ "vtc:load" ] }
data\miencraft\tags\functions\tick.json { "replace": false, "values": [ "vtc:main" ] }
data\vtc\functions\load.mcfunction:增加三个触发器 scoreboard objectives add VTC-MAXUSES trigger scoreboard objectives add VTC-REWARDEXP trigger scoreboard objectives add VTC-XP trigger
data\vtc\functions\main.mcfunction:随时对玩家开启三个触发器,如果需要对玩家加上现在在@a后加上选择器。令带有VTC-Tag的村民执行vtc:change/vtc-start execute as @e[tag=VTC-Tag] at @s run function vtc:change/vtc-start scoreboard players enable @a VTC-XP scoreboard players enable @a VTC-REWARDEXP scoreboard players enable @a VTC-MAXUSES data\vtc\functions\edit.mcfunction:执行vtc:trigger/new/tag function vtc:trigger/new/tag
data\vtc\functions\trigger\new\tag.mcfunction:令半径10内最近一名没进入编辑状态村民加上VTC-Tag和VTC-Start的标签,有这个标签的村民会因为vtc:main进入编辑状态。同时为了在编辑状态时村民不会乱跑,加上NoAI的nbt,但原先就有这个nbt的村民不进行更改,改而增加上VTC-NoAI标签,在最后回复的时候不改变该村民的NoAI状态 execute unless entity @e[type=villager,sort=nearest,distance=..10,tag=!VTC-Tag] run tellraw @s "\u00a76周围没有可用村民" execute as @e[type=villager,limit=1,sort=nearest,distance=..10,tag=!VTC-Tag] at @s run tag @s add VTC-Start execute as @e[type=villager,limit=1,sort=nearest,distance=..10,tag=!VTC-Tag,nbt={NoAI:1b}] at @s run tag @s add VTC-NoAI execute as @e[type=villager,limit=1,sort=nearest,distance=..10,tag=!VTC-Tag] at @s run tag @s add VTC-Tag
data\vtc\functions\change\vtc-start.mcfunction:显示粒子,每tick将脚下两格的箱子内容编辑为自身的交易栏。检测脚下有箱子的在编辑状态村民执行vtc:change/vtc-changing
particle minecraft:sneeze ~ ~ ~ 0 0.5 0 0 1 data merge entity @s {NoAI:1b}
execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:0b}] merge from entity @s Offers.Recipes[0].buy execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:9b}] merge from entity @s Offers.Recipes[0].buyB execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:18b}] merge from entity @s Offers.Recipes[0].sell
execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:1b}] merge from entity @s Offers.Recipes[1].buy execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:10b}] merge from entity @s Offers.Recipes[1].buyB execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:19b}] merge from entity @s Offers.Recipes[1].sell ...... execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:8b}] merge from entity @s Offers.Recipes[8].buy execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:17b}] merge from entity @s Offers.Recipes[8].buyB execute as @s[type=villager,tag=VTC-Start] at @s run data modify block ~ ~-1.1 ~ Items[{Slot:26b}] merge from entity @s Offers.Recipes[8].sell
tag @s[type=villager,tag=VTC-Start] add VTC-Changing tag @s[type=villager,tag=VTC-Start] remove VTC-Start
execute as @s[type=villager,tag=VTC-Changing] at @s unless block ~ ~-1.1 ~ chest run tag @s add VTC-Start execute as @s[type=villager,tag=VTC-Changing] at @s unless block ~ ~-1.1 ~ chest run tag @s remove VTC-Changing
execute as @s[type=villager,tag=VTC-Changing] at @s run function vtc:change/vtc-changing
data\vtc\functions\change\vtc-changing.mcfunction:检测箱子的第三行,如果存在物品才可在交易栏中生效。第三行的物品存在时,根据列数,对不同的交易栏进行编辑。首先新建一个交易栏,也是为了防止交易栏不存在,然后执行vtc-change/vtc+num将箱子内的物品编辑进村民的对应交易栏,而在最后空的交易栏会自动被Minecraft删除。就形成了交易栏永远不会留空同时整齐排序的情况。 execute as @e[type=villager,tag=VTC-Changing] at @s if data block ~ ~-1.1 ~ {Items:[{Slot:18b}]} unless data entity @s Offers.Recipes[0] run data modify entity @s Offers.Recipes append value {buyB:{},buy:{},sell:{}} execute as @e[type=villager,tag=VTC-Changing] at @s if data entity @s Offers.Recipes[0] if block ~ ~-1.1 ~ chest run function vtc:change/vtc1
execute as @e[type=villager,tag=VTC-Changing] at @s if data block ~ ~-1.1 ~ {Items:[{Slot:19b}]} unless data entity @s Offers.Recipes[1] run data modify entity @s Offers.Recipes append value {buyB:{},buy:{},sell:{}} execute as @e[type=villager,tag=VTC-Changing] at @s if data entity @s Offers.Recipes[1] if block ~ ~-1.1 ~ chest run function vtc:change/vtc2 …… execute as @e[type=villager,tag=VTC-Changing] at @s if data block ~ ~-1.1 ~ {Items:[{Slot:26b}]} unless data entity @s Offers.Recipes[8] run data modify entity @s Offers.Recipes append value {buyB:{},buy:{},sell:{}} execute as @e[type=villager,tag=VTC-Changing] at @s if data entity @s Offers.Recipes[8] if block ~ ~-1.1 ~ chest run function vtc:change/vtc9
execute as @e[type=villager,tag=VTC-Changing] at @s run data remove entity @s Offers.Recipes[{sell:{id:"minecraft:air"}}] execute as @e[type=villager,tag=VTC-Changing] at @s if data entity @s Offers.Recipes[9] run data remove entity @s Offers.Recipes[9]
data\vtc\functions\change\vtc1.mcfunction:把对应列数的物品存储进村民对应的交易栏中,然后我们再根据村民的交易栏再次更新一次箱子 execute run data modify entity @s Offers.Recipes[0].buy set from block ~ ~-1.1 ~ Items[{Slot:0b}] execute unless data block ~ ~-1.1 ~ {Items:[{Slot:0b}]} run data modify entity @s Offers.Recipes[0].buy set value {} execute run data modify entity @s Offers.Recipes[0].buyB set from block ~ ~-1.1 ~ Items[{Slot:9b}] execute unless data block ~ ~-1.1 ~ {Items:[{Slot:9b}]} run data modify entity @s Offers.Recipes[0].buyB set value {} execute run data modify entity @s Offers.Recipes[0].sell set from block ~ ~-1.1 ~ Items[{Slot:18b}] execute unless data block ~ ~-1.1 ~ {Items:[{Slot:18b}]} run data modify entity @s Offers.Recipes[0].sell set value {}
execute run data modify block ~ ~-1.1 ~ Items[{Slot:0b}] merge from entity @s Offers.Recipes[0].buy execute run data modify block ~ ~-1.1 ~ Items[{Slot:9b}] merge from entity @s Offers.Recipes[0].buyB execute run data modify block ~ ~-1.1 ~ Items[{Slot:18b}] merge from entity @s Offers.Recipes[0].sell
除了主要的编辑所需的命令外,还有编辑村民最大交易次数,是否返还经验,返还经验的值的命令 村民最大交易次数nbt的路径:Offers.Recipes[x].maxUses类型:整数 村民是否返还经验nbt的路劲:Offers.Recipes[x].rewardExp类型:布尔值(0b/1b,true/false) 村民返还经验的值nbt的路劲:Offers.Recipes[x].xp类型:整数
村民的交易栏的nbt:{Offers:{Recipes:[{maxUses:x,xp:xb,buy:{id:””,Count:xb},buyB:{id:””,Count:xb},sell:{id:””,Count:xb}},{},{},{},{}]}} 路径:Offers.Recipes[x].buy
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |