Last active
March 10, 2016 23:36
-
-
Save Arcensoth/8252a59c764e14881559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This demo script prints out a command that summons a spawner minecart with 10 | |
# spawn potentials, each of which is a command block minecart. Each of these | |
# command block minecarts is numbered `i` from 1 to 10, with a progressively | |
# greater spawn probability of `i / 55` and a command that prints a message | |
# including `i`. Note the absolute position of the spawned command block | |
# minecarts, and the relative position (offset) of the initial spawner minecart. | |
spawn_potentials = [] | |
for i in range(1, 11): | |
spawn_potentials.append(SpawnPotential( | |
entity=MinecartCommandBlock( | |
command=SayCommand( | |
message='Hello %d!' % i), | |
pos=Position(0, 64, 0)), | |
weight=i)) | |
spawner_cart = MinecartSpawner( | |
spawn_potentials=spawn_potentials, | |
spawn_count=1, | |
spawn_range=0, | |
delay=-1, | |
min_spawn_delay=20, | |
max_spawn_delay=20, | |
max_nearby_entities=100, | |
required_player_range=10) | |
summon_command = SummonCommand( | |
entity=spawner_cart, | |
position=Offset(0, 1, 0)) | |
print(summon_command) | |
# Output: | |
# summon MinecartSpawner ~0 ~1 ~0 {SpawnRange:0s,SpawnCount:1s,MinSpawnDelay:20s,Delay:-1s,MaxSpawnDelay:20s,MaxNearbyEntities:100s,SpawnPotentials:[{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 1!},Weight:1},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 2!},Weight:2},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 3!},Weight:3},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 4!},Weight:4},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 5!},Weight:5},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 6!},Weight:6},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 7!},Weight:7},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 8!},Weight:8},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 9!},Weight:9},{Entity:{Pos:[0.0d,64.0d,0.0d],id:MinecartCommandBlock,Command:say Hello 10!},Weight:10}],id:MinecartSpawner,RequiredPlayerRange:10s} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment