MC百科社群

标题: crt无法执行指令 [打印本页]

作者: 13082679913    时间: 2022-7-12 00:15
标题: crt无法执行指令
已经确定语法没有问题,并且该指令可以由命令方块执行,xyz参数的获取无问题./summon ebwizardry:zombie_minion x y z {HurtByTimestamp:0,ForgeData:{},Attributes:[{Base:0.05d,Name:"tconevo.flightSpeed"},{Base:1.0d,Name:"tconevo.damageTaken"},{Base:1.0d,Name:"tconevo.evasionChance"},{Base:20.0d,Modifiers:[{UUIDMost:-4357651666583928462L,UUIDLeast:-7108370477600628847L,Amount:0.0d,Operation:2,Name:"minion_health"}],Name:"generic.maxHealth"},{Base:0.0d,Modifiers:[{UUIDMost:-6736395602670039689L,UUIDLeast:-7837051283589603871L,Amount:0.016844706088883544d,Operation:0,Name:"Random spawn bonus"}],Name:"generic.knockbackResistance"},{Base:0.23000000417232513d,Name:"generic.movementSpeed"},{Base:2.0d,Name:"generic.armor"},{Base:0.0d,Name:"generic.armorToughness"},{Base:1.0d,Name:"forge.swimSpeed"},{Base:35.0d,Modifiers:[{UUIDMost:8402375910083087753L,UUIDLeast:-4941611569732524543L,Amount:0.041796937575788715d,Operation:1,Name:"Random spawn bonus"}],Name:"generic.followRange"},{Base:3.0d,Modifiers:[{UUIDMost:1307456006371886475L,UUIDLeast:-6297616897656562740L,Amount:0.6000000238418579d,Operation:2,Name:"potency"}],Name:"generic.attackDamage"},{Base:0.06138771432598736d,Name:"zombie.spawnReinforcements"}],lifetime:600,Invulnerable:0b,FallFlying:0b,PortalCooldown:0,AbsorptionAmount:0.0f,FallDistance:0.0f,DeathTime:0s,HandDropChances:[0.085f,0.085f],PersistenceRequired:0b,Motion:[0.0d,-0.0784000015258789d,0.0d],Leashed:0b,UUIDLeast:-9179886768920673614L,Health:20.0f,LeftHanded:0b,Air:300s,OnGround:1b,Dimension:0,Rotation:[6.2597885f,5.6333575f],UpdateBlocked:0b,HandItems:[{},{}],ArmorDropChances:[0.085f,0.085f,0.085f,0.085f],UUIDMost:5047602304662195424L,CustomName:"",Pos:[444.5d,1.0d,398.5d],CanBreakDoors:0b,Fire:-1s,ArmorItems:[{},{},{},{}],CanPickUpLoot:0b,casterUUIDLeast:-4932514037799396320L,HurtTime:0s,casterUUIDMost:-8815628375018491308L}




作者: Leo_Qina    时间: 2022-7-12 00:15
这样?
  1. import crafttweaker.events.IEventManager;
  2. import crafttweaker.event.PlayerLoggedInEvent;

  3. import crafttweaker.server.IServer;

  4. import crafttweaker.command.ICommandManager;


  5. events.onPlayerLoggedIn(function(event as PlayerLoggedInEvent) {//事件可选
  6.     server.commandManager.executeCommand(server,'summon ebwizardry:zombie_minion '~x~' '~y~' '~z~' {HurtByTimestamp:0,ForgeData:{},Attributes:[{Base:0.05d,Name:"tconevo.flightSpeed"},{Base:1.0d,Name:"tconevo.damageTaken"},{Base:1.0d,Name:"tconevo.evasionChance"},{Base:20.0d,Modifiers:[{UUIDMost:-4357651666583928462L,UUIDLeast:-7108370477600628847L,Amount:0.0d,Operation:2,Name:"minion_health"}],Name:"generic.maxHealth"},{Base:0.0d,Modifiers:[{UUIDMost:-6736395602670039689L,UUIDLeast:-7837051283589603871L,Amount:0.016844706088883544d,Operation:0,Name:"Random spawn bonus"}],Name:"generic.knockbackResistance"},{Base:0.23000000417232513d,Name:"generic.movementSpeed"},{Base:2.0d,Name:"generic.armor"},{Base:0.0d,Name:"generic.armorToughness"},{Base:1.0d,Name:"forge.swimSpeed"},{Base:35.0d,Modifiers:[{UUIDMost:8402375910083087753L,UUIDLeast:-4941611569732524543L,Amount:0.041796937575788715d,Operation:1,Name:"Random spawn bonus"}],Name:"generic.followRange"},{Base:3.0d,Modifiers:[{UUIDMost:1307456006371886475L,UUIDLeast:-6297616897656562740L,Amount:0.6000000238418579d,Operation:2,Name:"potency"}],Name:"generic.attackDamage"},{Base:0.06138771432598736d,Name:"zombie.spawnReinforcements"}],lifetime:600,Invulnerable:0b,FallFlying:0b,PortalCooldown:0,AbsorptionAmount:0.0f,FallDistance:0.0f,DeathTime:0s,HandDropChances:[0.085f,0.085f],PersistenceRequired:0b,Motion:[0.0d,-0.0784000015258789d,0.0d],Leashed:0b,UUIDLeast:-9179886768920673614L,Health:20.0f,LeftHanded:0b,Air:300s,OnGround:1b,Dimension:0,Rotation:[6.2597885f,5.6333575f],UpdateBlocked:0b,HandItems:[{},{}],ArmorDropChances:[0.085f,0.085f,0.085f,0.085f],UUIDMost:5047602304662195424L,CustomName:"",Pos:[444.5d,1.0d,398.5d],CanBreakDoors:0b,Fire:-1s,ArmorItems:[{},{},{},{}],CanPickUpLoot:0b,casterUUIDLeast:-4932514037799396320L,HurtTime:0s,casterUUIDMost:-8815628375018491308L}');
  7. });
复制代码

作者: 13082679913    时间: 2022-7-12 10:35
Leo_Qina 发表于 2022-7-12 08:58
这样?

可以了!之前用的是双引号,问一下大佬是怎么回事
作者: Leo_Qina    时间: 2022-7-12 12:02
双引号内的是指令的内容,是字符串格式的,但是你的xyz是三个变量啊,不是字符串,所以不能放在双引号里面,~这个符号就是连接变量和字符串
作者: Leo_Qina    时间: 2022-7-12 12:03
其实单引号和双引号在CrT里面都是一样的效果,但是为了规避与指令内容中的双引号冲突,所以最外面用了单引号
作者: 13082679913    时间: 2022-7-12 13:12
Leo_Qina 发表于 2022-7-12 12:03
其实单引号和双引号在CrT里面都是一样的效果,但是为了规避与指令内容中的双引号冲突,所以最外面用了单引 ...

原来xyz是用的双引号"~x~" "~y~" "~z~",最外面也用双引号,没有发生问题,不太明白,不过问题解决了
作者: Leo_Qina    时间: 2022-7-12 13:53
本帖最后由 Leo_Qina 于 2022-7-12 13:55 编辑

我试了一下全用双引号会报错诶,而且看你这话你好像理解错这个引号的意思了,xyz是变量,本身是不需要用引号包起来的,只需要用~和旁边的字符串连接,在xyz中间的几个引号代表了两个空格的字符串。

(6HX4S4[P%K~YEC8$F{{M6K.png (10.73 KB, 下载次数: 65)

有个语法高亮是不是会好理解一点

有个语法高亮是不是会好理解一点

作者: 13082679913    时间: 2022-7-12 15:07
本帖最后由 13082679913 于 2022-7-12 15:09 编辑
Leo_Qina 发表于 2022-7-12 13:53
我试了一下全用双引号会报错诶,而且看你这话你好像理解错这个引号的意思了,xyz是变量,本身是不需要用引 ...

原来用的这个summon不报错:
"/summon ebwizardry:zombie_minion "~x~" "~y~" "~z
加了个nbt就坏了。
有可能是漏了个引号

作者: Leo_Qina    时间: 2022-7-12 15:09
就是这样,因为nbt里面的格式用的是双引号,和外面的双引号会有冲突,所以建议你除了nbt之外的引号都用单引号比较保险




欢迎光临 MC百科社群 (https://bbs.mcmod.cn/) MC百科|最大的MineCraft中文模组百科