|
刷怪笼mob_spawner
刷怪笼想必大家都知道就不多说了,我们直接来上指令:
/give @p mob_spawner 1 0 {BlockEntityTag:{MaxNearbyEntities:※最大容量※s,RequiredPlayerRange:※需求范围※s,SpawnRange:※生成范围※s,SpawnCount:※单次生成个数※s,MaxSpawnDelay:※最大等待时间※s,MinSpawnDelay:※最小等待时间※s,Delay:1s,SpawnData:{id:"xp_orb",Value:0},SpawnPotentials:[{Entity:{id:"※生成物1※"},Weight:3},{Entity:{id:"※生成物2※"},Weight:6}]}}
很浅显的指令相比大家都能看懂,但值得一提是Weight(权重)我们可以将之理解成【概率】那么每次刷怪笼产生怪物时生成物1被刷出的概率就为P=3/(3+6)=三分之一
很机械的指令啊,那么拿着这条刷怪笼的指令格式你是不是就能打遍天下无敌手了呢?
当然不是,作为一个富有创造力的指令玩家我们当然有将刷怪笼创造地更有【创造力】的能力
如果你在【基岩层】那你一定可以想得到刷怪笼可以用作RPG的野怪、小怪、Boss的生成,这里我就不加以演示了
如果你在【地表层】那你已经不局限于生物那么简单了,你可以利用它做出一个随机的经验刷怪笼来让玩家挂机
例如通过调节Value(经验值)和Weight(权重)来增加【创造性】:/give @p mob_spawner 1 0 {BlockEntityTag:{MaxNearbyEntities:100s,RequiredPlayerRange:10s,SpawnRange:10s,SpawnCount:1s,MaxSpawnDelay:100s,MinSpawnDelay:10s,Delay:1s,SpawnData:{id:"xp_orb",Value:0,Tags:["经验"]},SpawnPotentials:[{Entity:{id:"xp_orb",Value:100,Tags:["经验","100经验值"]},Weight:1},{Entity:{id:"xp_orb",Value:10,Tags:["经验","10经验值"]},Weight:5},{Entity:{id:"xp_orb",Value:1,Tags:["经验","1经验值"]},Weight:50}]}}
如果你在【大气层】这波你已经不再被外物的实用性所局限,刷怪笼平平无奇但也可以刷出美丽
我们可以通过让刷怪笼刷出不同颜色、形状、飞行高度的烟花,调整刷新速度和刷怪概率来做出一个美丽的烟花效果笼:/give @p mob_spawner 1 0 {BlockEntityTag:{MaxNearbyEntities:100s,RequiredPlayerRange:5000s,SpawnRange:100s,SpawnCount:1s,MaxSpawnDelay:5s,MinSpawnDelay:1s,Delay:5s,SpawnData:{id:"fireworks_rocket"},SpawnPotentials:[{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花1"],LifeTime:5,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:1b,Colors:[I;233,1173235]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花2"],LifeTime:10,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:2b,Colors:[I;11753235,6498163]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花3"],LifeTime:15,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:3b,Colors:[I;11355,9611365]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花4"],LifeTime:20,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:4b,Colors:[I;113235,6666]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花5"],LifeTime:25,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:5b,Colors:[I;165151,110073]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花6"],LifeTime:30,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:6b,Colors:[I;20981491,223235]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花7"],LifeTime:35,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:7b,Colors:[I;3392911,3311235]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花8"],LifeTime:40,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:8b,Colors:[I;44524065,41417105]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花9"],LifeTime:45,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:9b,Colors:[I;533011561,55481335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花10"],LifeTime:50,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:10b,Colors:[I;61651145,51103205]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花11"],LifeTime:50,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:1b,Colors:[I;63301151,9581335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花12"],LifeTime:45,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:3b,Explosions:[{Type:2b,Colors:[I;530561,6959135]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花13"],LifeTime:40,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:3b,Colors:[I;4501561,581335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花14"],LifeTime:35,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:4b,Colors:[I;33011561,55481335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花15"],LifeTime:30,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:5b,Colors:[I;31452261,1354535]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花16"],LifeTime:25,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:6b,Colors:[I;46311561,1581335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花17"],LifeTime:20,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:7b,Colors:[I;533011561,55481335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花18"],LifeTime:15,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:8b,Colors:[I;4301161,354335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花19"],LifeTime:10,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:9b,Colors:[I;3011561,4541335]}]}}}},Weight:1},{Entity:{id:"fireworks_rocket",Tags:["烟花","烟花20"],LifeTime:5,Life:0,FireworksItem:{id:"fireworks",Count:1b,tag:{Fireworks:{Flight:1b,Explosions:[{Type:10b,Colors:[I;13215561,4581335]}]}}}},Weight:1}]}}
如果这波你在【外太空层】那你一定可以感受到本文反复提到的一个词汇Weight(权重)也就是概率,这是在1.12.2左右的指令中绝无仅有的概念,概率意味着不确定性,不确定性意味着事件有随机发生的可能
这样理解那么刷怪笼也可以结合计分板变作一个指令的算法工具:/give @p mob_spawner 1 0 {BlockEntityTag:{MaxNearbyEntities:1s,SpawnCount:1s,RequiredPlayerRange:9999s,SpawnRange:0s,MaxSpawnDelay:2s,MinSpawnDelay:2s,Delay:0s,SpawnData:{id:"xp_orb"},SpawnPotentials:[{Entity:{id:"falling_block",Time:-9999,Block:command_block,Data:1,DropItem:0,Tags:["随机数0"],TileEntityData:{auto:1,Command:"/scoreboard players set random random 0"}},Weight:1},{Entity:{id:"falling_block",Time:-9999,Block:command_block,Data:1,DropItem:0,Tags:["随机数1"],TileEntityData:{auto:1,Command:"/scoreboard players set random random 1"}},Weight:1}]}}
我们通过调节生成范围为0这样可以使刷出的命令方块一定位于刷怪笼的正上方,调节刷新时间为固定时间,这样再在这个刷怪笼的正上方的正上方放上一个链式命令方块就可以填充下方刷出的命令方块为空气,这样我们就能将生成的随机数添加到计分板中从而进行调用实现游戏中最正规(并不是最方便)的随机算法
搞定!收工!awa~
|
|