大家应该知道一个标签(生物用的)叫ActiveEffect
我们可以直接在这里写效果而不用使用effect命令
但是,今天我在问答版看见有人问关于ActiveEffect中的snowless没有效果之后,我就去研究,现在终于知道原因了
ActiveEffect是不会改变他的Attribute的!!!
现在我就用一个例子来证明
我先生成一个村民,指令为
复制代码
然后再利用entitydata命令拿取他的NBT
命令:/entitydata @e[type=Villager] {}
他的输出省去“[时间] The data tag did not change: ”就是他的NBT了
NBT:
复制代码然后再生成一个普通的村民,然后用effect @e[type=Villager] snowless 9999 22 来给予他相同的效果以下是那个村民的NBT:复制代码
我们来看看重要的部分:
直接更改NBT的村民的ActiveEffect:
ActiveEffects:[0:{Ambient:0b,ShowParticles:1b,Duration:19918,Id:2b,Amplifier:22b}]
用effect指令来给效果的ActiveEffect:
ActiveEffects:[0:{Ambient:0b,ShowParticles:0b,Duration:199727,Id:2b,Amplifier:22b}]
可以看见都是一样的,所以问题不在ActiveEffect那里
然后我们来看看他们的Attribute(控制生物的属性)
我们直接去看关于速度的属性
直接更改NBT的村民:
Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Name:"generic.movementSpeed"},3:{Base:16.0d,Name:"generic.followRange"}]
用effect指令的村民:
Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Modifiers:[0:{UUIDMost:8144722948526719024L,UUIDLeast:-7778190119041365872L,Amount:-3.450000137090683d,Operation:2,Name:"potion.moveSlowdown 22"}],Name:"generic.movementSpeed"},3:{Base:16.0d,Modifiers:[0:{UUIDMost:-1290823998764662103L,UUIDLeast:-8215617727904454336L,Amount:0.021778346721541594d,Operation:1,Name:"Random spawn bonus"}]
可以看到,直接更改NBT的村民是没有了一个modifier叫做“potion.moveSlowdown 22”的
这里就是原因!
ActiveEffect并不会自动更改生物的Attribute,所以用关于Attribute的效果时需要小心,建议使用effect指令
可以参考:wiki Attribute的页面(英文):http://minecraft.gamepedia.com/Attribute
来自群组: Command Block Logic
我们可以直接在这里写效果而不用使用effect命令
但是,今天我在问答版看见有人问关于ActiveEffect中的snowless没有效果之后,我就去研究,现在终于知道原因了
ActiveEffect是不会改变他的Attribute的!!!
现在我就用一个例子来证明
我先生成一个村民,指令为
- /summon Villager ~ ~1 ~ {ActiveEffects:[{Id:2b,Amplifier:22b,Duration:19980,ShowParticles:0b}]}
然后再利用entitydata命令拿取他的NBT
命令:/entitydata @e[type=Villager] {}
他的输出省去“[时间] The data tag did not change: ”就是他的NBT了
NBT:
- {HurtByTimestamp:0,Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Name:"generic.movementSpeed"},3:{Base:16.0d,Name:"generic.followRange"}],Riches:0,Invulnerable:0b,ForcedAge:0,PortalCooldown:0,AbsorptionAmount:0.0f,FallDistance:0.0f,DeathTime:0s,DropChances:[0:0.085f,1:0.085f,2:0.085f,3:0.085f,4:0.085f],PersistenceRequired:0b,HealF:20.0f,Age:0,Motion:[0:-0.043455198862501335d,1:-0.0784000015258789d,2:0.09215833894352461d],Leashed:0b,UUIDLeast:-9133569816296279006L,Health:20s,Air:300s,OnGround:1b,Dimension:0,Rotation:[0:29.474579f,1:0.0f],Profession:0,UUIDMost:9045509589925446476L,Equipment:[0:{},1:{},2:{},3:{},4:{}],Pos:[0:0.31159822625468636d,1:64.0d,2:-1.446661254397289d],Fire:-1s,CanPickUpLoot:1b,HurtTime:0s,CareerLevel:0,ActiveEffects:[0:{Ambient:0b,ShowParticles:0b,Duration:19918,Id:2b,Amplifier:22b}],Career:0,Inventory:[],Willing:0b}
- {HurtByTimestamp:0,Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Modifiers:[0:{UUIDMost:8144722948526719024L,UUIDLeast:-7778190119041365872L,Amount:-3.450000137090683d,Operation:2,Name:"potion.moveSlowdown 22"}],Name:"generic.movementSpeed"},3:{Base:16.0d,Modifiers:[0:{UUIDMost:-1290823998764662103L,UUIDLeast:-8215617727904454336L,Amount:0.021778346721541594d,Operation:1,Name:"Random spawn bonus"}],Name:"generic.followRange"}],Riches:0,Invulnerable:0b,ForcedAge:0,PortalCooldown:0,AbsorptionAmount:0.0f,FallDistance:0.0f,DeathTime:0s,DropChances:[0:0.085f,1:0.085f,2:0.085f,3:0.085f,4:0.085f],PersistenceRequired:0b,HealF:20.0f,Age:0,Motion:[0:0.0d,1:-0.0784000015258789d,2:0.0d],Leashed:0b,UUIDLeast:-5535759365293048511L,Health:20s,Air:300s,OnGround:1b,Dimension:0,Rotation:[0:-131.82574f,1:0.0f],Profession:4,UUIDMost:-5496550935593991573L,Equipment:[0:{},1:{},2:{},3:{},4:{}],Pos:[0:-2.5d,1:64.0d,2:-2.5d],Fire:-1s,CanPickUpLoot:1b,HurtTime:0s,CareerLevel:0,ActiveEffects:[0:{Ambient:0b,ShowParticles:0b,Duration:199727,Id:2b,Amplifier:22b}],Career:0,Inventory:[],Willing:0b}
我们来看看重要的部分:
直接更改NBT的村民的ActiveEffect:
ActiveEffects:[0:{Ambient:0b,ShowParticles:1b,Duration:19918,Id:2b,Amplifier:22b}]
用effect指令来给效果的ActiveEffect:
ActiveEffects:[0:{Ambient:0b,ShowParticles:0b,Duration:199727,Id:2b,Amplifier:22b}]
可以看见都是一样的,所以问题不在ActiveEffect那里
然后我们来看看他们的Attribute(控制生物的属性)
我们直接去看关于速度的属性
直接更改NBT的村民:
Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Name:"generic.movementSpeed"},3:{Base:16.0d,Name:"generic.followRange"}]
用effect指令的村民:
Attributes:[0:{Base:20.0d,Name:"generic.maxHealth"},1:{Base:0.0d,Name:"generic.knockbackResistance"},2:{Base:0.5d,Modifiers:[0:{UUIDMost:8144722948526719024L,UUIDLeast:-7778190119041365872L,Amount:-3.450000137090683d,Operation:2,Name:"potion.moveSlowdown 22"}],Name:"generic.movementSpeed"},3:{Base:16.0d,Modifiers:[0:{UUIDMost:-1290823998764662103L,UUIDLeast:-8215617727904454336L,Amount:0.021778346721541594d,Operation:1,Name:"Random spawn bonus"}]
可以看到,直接更改NBT的村民是没有了一个modifier叫做“potion.moveSlowdown 22”的
这里就是原因!
ActiveEffect并不会自动更改生物的Attribute,所以用关于Attribute的效果时需要小心,建议使用effect指令
可以参考:wiki Attribute的页面(英文):http://minecraft.gamepedia.com/Attribute
来自群组: Command Block Logic
太奇妙,看不懂
果然是这样 看了下wiki 确实有5种药水效果是通过改属性来生效的
potion.moveSpeed or potion.moveSpeed # (where # is the potion's amplifier) Fixed value of 0.2* when under the Speed effect, multiplied by the effect's level (amplifier + 1). generic.movementSpeed (Operation 2; All living entities; UUID 91AEAA56-376B-4498-935B-2F7F68070635)
potion.moveSlowdown or potion.moveSlowdown # (where # is the potion's amplifier) Fixed value of -0.15* when under the Slowness effect, multiplied by the effect's level. generic.movementSpeed (Operation 2; All living entities; UUID 7107DE5E-7CE8-4030-940E-514C1F160890)
potion.damageBoost or potion.damageBoost # (where # is the potion's amplifier) Fixed value of 1.3 when under the Strength effect, multiplied by the effect's level. generic.attackDamage (Operation 2; All living entities; UUID 648D7064-6A60-4F59-8ABE-C2C23A6DD7A9)
potion.weakness or potion.weakness # (where # is the potion's amplifier) Fixed value of -0.5 when under the Weakness effect, multiplied by the effect's level. generic.attackDamage (Operation 0; All living entities; UUID 22653B89-116E-49DC-9B6B-9971489B5BE5)
potion.healthBoost # (where # is the potion's amplifier. May be 0.) Fixed value of 4 when under the Health Boost effect, multiplied by the effect's level. generic.maxHealth (Operation 0; All living entities; UUID 5D6F0BA2-1186-46AC-B896-C61C5CEE99CC)
这些属性修饰的UUID和名字都是写在代码里的 估计是为了去掉他们时方便吧
原来拿着没指定属性修饰的剑也有伤害加成也是游戏加了属性修饰
但不是在物品上加的 而是在拿着它的生物身上加的
对于指定了的剑就不在身上再加一份了
potion.moveSpeed or potion.moveSpeed # (where # is the potion's amplifier) Fixed value of 0.2* when under the Speed effect, multiplied by the effect's level (amplifier + 1). generic.movementSpeed (Operation 2; All living entities; UUID 91AEAA56-376B-4498-935B-2F7F68070635)
potion.moveSlowdown or potion.moveSlowdown # (where # is the potion's amplifier) Fixed value of -0.15* when under the Slowness effect, multiplied by the effect's level. generic.movementSpeed (Operation 2; All living entities; UUID 7107DE5E-7CE8-4030-940E-514C1F160890)
potion.damageBoost or potion.damageBoost # (where # is the potion's amplifier) Fixed value of 1.3 when under the Strength effect, multiplied by the effect's level. generic.attackDamage (Operation 2; All living entities; UUID 648D7064-6A60-4F59-8ABE-C2C23A6DD7A9)
potion.weakness or potion.weakness # (where # is the potion's amplifier) Fixed value of -0.5 when under the Weakness effect, multiplied by the effect's level. generic.attackDamage (Operation 0; All living entities; UUID 22653B89-116E-49DC-9B6B-9971489B5BE5)
potion.healthBoost # (where # is the potion's amplifier. May be 0.) Fixed value of 4 when under the Health Boost effect, multiplied by the effect's level. generic.maxHealth (Operation 0; All living entities; UUID 5D6F0BA2-1186-46AC-B896-C61C5CEE99CC)
这些属性修饰的UUID和名字都是写在代码里的 估计是为了去掉他们时方便吧
原来拿着没指定属性修饰的剑也有伤害加成也是游戏加了属性修饰
但不是在物品上加的 而是在拿着它的生物身上加的
对于指定了的剑就不在身上再加一份了
不错虽然没懂
宛如发现了一个新世界