Skip to content

Instantly share code, notes, and snippets.

@richardbwest
Created February 22, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save richardbwest/416c8fd124ead2b9d2c10f1af94abc4c to your computer and use it in GitHub Desktop.
Save richardbwest/416c8fd124ead2b9d2c10f1af94abc4c to your computer and use it in GitHub Desktop.
import mcpi.minecraft as minecraft
import mcpi.block as block
import time,math
mc = minecraft.Minecraft.create()
mc.postToChat("Rainbow World")
pos = mc.player.getTilePos()
#red, orange,yellow,green,blue,indigo,violet
rainbow = [14,1,4,13,11,10,2]
radius = 30
#for i in range(16):
# mc.setBlock(pos.x,pos.y + 2,pos.z + i,block.WOOL.id,i)
for angle in range(360):
for i in range(len(rainbow)):
x = pos.x + (radius - i) * math.cos(angle*math.pi/180)
y = 0 + (radius - i) * math.sin(angle*math.pi/180)
mc.setBlock(x,y,pos.z,block.WOOL.id,rainbow[i])
time.sleep(0.2)
@fredericpierron
Copy link

Hi,
Are you sure about the y formula? y = 0 + (radius - i) why are you adding 0 to (radius -i)? instead of writing solely (radius - i)?
Fred

@richardbwest
Copy link
Author

richardbwest commented Oct 1, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment