ruhuasiyu
本帖最后由 SHEEP_REALMS 于 2021-10-16 10:59 编辑

指北针
添加了


如何安装
将north_compass.zip north_compass.zip (10.96 KB, 下载次数: 37) 放入存档datapacks文件夹,将north_compass_resources.zip north_compass_resources.zip (112.57 KB, 下载次数: 34) 放入资源包文件夹,进入游戏选择该资源包即可。
备用下载地址: https://github.com/ruhuasiyu/Cra ... apacks/NorthCompass

如何添加更多指北针

参考数据包本身已有的文件,将相应的文字stronghold替换掉即可。
注册物品:在north_compass/loot_tables中添加相应的json文件,例如village_compass.json。
  1. {
  2.         "pools": [
  3.                 {
  4.                         "rolls": 1,
  5.                         "entries": [
  6.                                 {
  7.                                         "type": "item",
  8.                                         "name": "minecraft:carrot_on_a_stick",
  9.                                         "functions": [
  10.                                                 {
  11.                                                         "function": "set_nbt",
  12.                                                         "tag": "{display:{Name:"{\\"translate\\":\\"item.north_compass.village_compass\\"}"},id:"north_compass:village_compass",CustomModelData:10870000,dict:["north_compass"],compassTarget:[0.0d,1.0d],HideFlags:63}"
  13.                                                 },
  14.                                                 {
  15.                                                         "function": "set_attributes",
  16.                                                         "modifiers": [
  17.                                                                 {
  18.                                                                         "name": "mainhand_attackSpeed",
  19.                                                                         "attribute": "generic.attackSpeed",
  20.                                                                         "operation": "addition",
  21.                                                                         "amount": -4,
  22.                                                                         "slot": "mainhand"
  23.                                                                 },
  24.                                                                 {
  25.                                                                         "name": "mainhand_attackSpeed",
  26.                                                                         "attribute": "generic.attackSpeed",
  27.                                                                         "operation": "addition",
  28.                                                                         "amount": -4,
  29.                                                                         "slot": "offhand"
  30.                                                                 }
  31.                                                         ]
  32.                                                 }
  33.                                         ]
  34.                                 }
  35.                         ]
  36.                 }
  37.         ]
  38. }
复制代码
结构地图:在north_compass/loot_tables/map中添加相应的json文件,例如village.json,将"destination": "Stronghold"改为"destination": "Village"。初始化判断:在north_compass/functions/target/main中添加相应的指令,例如
  1. execute as @s[nbt={SelectedItem:{tag:{id:"north_compass:village_compass"}}}] run function north_compass:target/village
复制代码
在north_compass/functions/target/off中添加相应的指令,例如
  1. execute as @s[nbt={Inventory:[{Slot:-106b,tag:{id:"north_compass:village_compass"}}]}] run function north_compass:target/village
复制代码
结构位置获取:在north_compass/functions/target中添加相应的函数文件,例如village.mcfunction。
  1. summon armor_stand ~ ~ ~ {Tags:["village_compass"],NoGravity:1b,Marker:1b}
  2. loot replace entity @e[type=minecraft:armor_stand,tag=village_compass,distance=..1,limit=1] weapon.mainhand loot north_compass:map/village
  3. execute store result score #targX NCface run data get entity @e[type=minecraft:armor_stand,tag=village_compass,distance=..1,limit=1] HandItems[0].tag.Decorations[0].x
  4. execute store result score #targZ NCface run data get entity @e[type=minecraft:armor_stand,tag=village_compass,distance=..1,limit=1] HandItems[0].tag.Decorations[0].z
  5. kill @e[type=minecraft:armor_stand,tag=village_compass,distance=..1,limit=1]
复制代码
合成:在north_compass/functions/tick中追加相应的指令,例如
  1. execute as @e[type=item,nbt={Item:{id:"minecraft:compass",Count:1b}}] at @s if entity @e[type=item,nbt={Item:{id:"minecraft:emerald",Count:1b}},distance=..1] run function north_compass:craft/village_compass
复制代码
在north_compass/functions/craft中添加相应的函数文件,例如village_compass.mcfunction。
  1. kill @s
  2. kill @e[type=item,nbt={Item:{id:"minecraft:ender_eye",Count:1b}},distance=..1,sort=nearest,limit=1]
  3. loot spawn ~ ~ ~ loot north_compass:stronghold_compass
复制代码
最后在资源包中assets/lang中添加相应的翻译文本即可。


v1.2  2019/07/24



来自群组: Nuclear Fusion

可还行(下次是不是吧指东(西)针做出来的呀)

Jokey_钥匙
当你们亲爱的版主都开始水帖子时.jpg

ruhuasiyu
小星啊啊啊 发表于 2019-7-15 11:21
可还行(下次是不是吧指东(西)针做出来的呀)

有考虑做 指要塞针 指末地城针 之类的东西……

Jokey_钥匙
execute store 可以更改玩家物品的数值?(震撼)
(突然觉得自己好烦( )


BlackCB.
好好的F3不用用什么指北针

爱心魔王FHC
为什么要反其道而行?

下一页 最后一页