archiv:ef:ef2020_2022:minecraft:projekt:smantharebekkajehan:start:schlaraffenland-code:start

Schlaraffenland-Code


#Warning: 
#this takes really long time to run and Minecraft education doesn't make sense it's worse than scratch //sobs//
#A lot of empty space that still requires Raumplanung hehe


####keyss#####
height=7
boden=2 #150*ax150*a
l_field=150*boden
point=[0,100,100] #Anfang
point_h=[point[0],point[1]+height,point[1]] 
remove=False 
weather= CLEAR 
time= DAY 





#####FUNCTIONS#####
#===================== BASE ========================#

def land(m,boden,point,remove=False): #Material , 150*ax150*a 

    for i in range(boden):
        for n in range(boden): 
            von=[point[0],point[1],point[2]]
            to=[von[0]+150,von[1],von[2]+150]
            point=[to[0],point[1],point[2]]
            if remove == True:
                blocks.fill(AIR,world(von[0],von[1],von[2]),world(to[0],to[1],to[2]))
            else:
                blocks.fill(m,world(von[0],von[1],von[2]),world(to[0],to[1],to[2]))
        point=[point[0]-(150*boden),point[1],point[2]+150]


#======================= RAINBOW ======================#

def rainbow(r,d,boden,point,remove=False):
    point=[point[0],point[1],point[2]]
    center=point[0]+(150*boden/2) 
    builder.teleport_to(world(center,point[1]-29,point[2]))
    builder.set_origin()

    end=0.9*r
    start= 0-(end)

    while start <= end:
        builder.teleport_to_origin()
        x = Math.sqrt((r*r) - (start*start)) 

        builder.move(UP, x)
        builder.move(RIGHT, (start >> 0))
        colors= [0,14,0,14,0,14,0] 

        for i in range(len(colors)): 
            for k in range(d):
                if remove == True:
                    builder.place(AIR)
                else:
                    builder.place(blocks.block_with_data(WOOL, colors[i]))
                builder.move(UP, 1)
        start+=1

#====================== Building/Square =======================#


def building(m,boden,h,remove=False):
    for i in range(h):
        points=[point[0],point[1]+i,point[2]]
        a=point[0]+135 
        land(m,boden,points,remove)
    #stairs
    x=Math.round((150*boden/2)/5)
    stairs_cords=[a+x,point[1],point[2]+11]
    blocks.fill(AIR,world(a,point[1],point[2]),world(a+x,point[1]+h,point[2]+10))
    stairs(m,h,x,stairs_cords,remove)
    if remove==True:
        m_stairs=AIR
    else:
        m_stairs=RED_CONCRETE
    
    carpet_cords=[a+x/4,point[1],point[2]+11]
    stairs(m_stairs,h,-x/2,carpet_cords,remove)
    blocks.fill(m_stairs,world(a,point[1]-1,point[2]+3),world(a+x,point[1]-1,point[2]-130)) 
    blocks.fill(m_stairs,world(a+x/4,point[1]+h-1,point[2]+10),world(a+x/4+x/2,point[1]+h-1,point[2]+150))


#======================= STAIRS ======================#

def stairs(m, l, d, point, remove=False): #why Minecraft why
    point=[point[0],point[1]-1,point[2]-l]
    #it will only work if its turned into a list again evnethough it print a list --> will result in java script errors??
    
    builder.teleport_to(world(point[0],point[1],point[2]))
    builder.mark()
    
    for i in range(l):
        builder.move(UP, 1)
        builder.move(LEFT, d)
        builder.move(RIGHT, d)
        builder.move(BACK, 1) 
    if remove == False:
        builder.trace_path(m)
    else:
        builder.trace_path(AIR)

#======================= Sign ======================#

def sign(m1,m2,boden,point,remove=False):
    border=RED_CONCRETE
    bg= WHITE_CONCRETE
    if remove == True :
        border=AIR
        bg=AIR
        m1=AIR
        m2=AIR

    point=[point[0],point[1],point[2]]
    ht=30
    a=(150*boden/2)+ht
    cord_txt=[point[0]+a, point[1]+ht, point[2]-2]

    
    blocks.fill(bg,world(cord_txt[0]+10,cord_txt[1]+(ht/2)+5, cord_txt[2]+1),world(cord_txt[0]-2*ht, cord_txt[1]-ht/2, cord_txt[2]+1))

    #Border x --> have same x,y,z as bg
    blocks.fill(border,world(cord_txt[0]+10, cord_txt[1]+(ht/2)+5, point[2]+1),world(cord_txt[0]-2*ht, cord_txt[1]+(ht/2)+5+2, cord_txt[2]-1))
    blocks.fill(border,world(cord_txt[0]+10, cord_txt[1]-(ht/2), point[2]+1),world(cord_txt[0]-2*ht, cord_txt[1]-12, cord_txt[2]-1))
    #Border y
    blocks.fill(border,world(cord_txt[0]+10, cord_txt[1]+(ht/2)+7, point[2]+1),world(cord_txt[0]+13, cord_txt[1]-(ht/2), cord_txt[2]-1))
    blocks.fill(border,world(cord_txt[0]-60, cord_txt[1]+(ht/2)+7, point[2]+1),world(cord_txt[0]-63, cord_txt[1]-(ht/2), cord_txt[2]-1))

    #Text
    blocks.print("< o u o >", m1, world(cord_txt[0], cord_txt[1]+10, cord_txt[2]), WEST) #-1 bring to front , +1 to back
    blocks.print("Lehmann's", m2, world(cord_txt[0], cord_txt[1], cord_txt[2]), WEST)
    blocks.print("Wonderland",m1,world(cord_txt[0]+2, cord_txt[1]-10, cord_txt[2]),WEST)


#======================= Marshmallow ======================#

def Marshmallow(point, m1, m2, h, remove=False):  # h = length Material: STRIPPED_SPRUCE_WOOD, WHITE_CONCRETE
    point=[point[0],point[1],point[2]]

    if remove == True:
        m1=AIR
        m2=AIR

    l=h/2; b=l/3*2  # b = width, l = length

    #Stab
    blocks.fill(m1,
    world (point[0], point[1], point[2]),
    world (point[0], point[1]+h, point[2]))
    #Marshmallow
    blocks.fill(m2,
    world(point[0]-(b/2), point[1]+h, point[2]-(b/2)),
    world(point[0]+(b/2), point[1]+h+l, point[2]+(b/2)))


#======================= Lolipop ======================#

def lolipop(m1,m2,point, l,remove=False):
    point=[point[0], point[1], point[2]]
    if remove == True:
        m1=AIR
        m2=AIR

    for i in range(l):
        if (i%2)==0:
            blocks.place(m1, world(point[0], i+point[1], point[2]))
        else:
            blocks.place(m2, world(point[0], i+point[1], point[2]))

    l_2=l/2

    for a in range(l_2):
        if (a%2)==0:
            blocks.place(m1, world(point[0]+a, l+point[1], point[2]))
        else:
            blocks.place(m2, world(a+point[0],l+point[1], point[2]))

    l_3=l/4

    for b in range(l_3):
        if (b%2)==0:
            blocks.place(m1, world(point[0]+l_2, l+point[1]-b, point[2]))
        else:
            blocks.place(m2, world(point[0]+l_2,l+point[1]-b, point[2]))

#======================= Candy pink trees ======================#

def zuckerwatte(point, m1, m2, zipfel, remove=False): #Koordinaten, WHITE_CONCRETE, PINK_WOOL, Zipfel

    point=[point[0], point[1], point[2]]

    if remove == True:
        m1=AIR
        m2=AIR

    #Stab

    for a in range(3):
        blocks.place(m1, world(point[0], point[1] + a, point[2]))

    #Zuckerwatte

    for b in range(3):
        blocks.place(m2, world(point[0]-1 + b, point[1] + 3, point[2]-1))
        blocks.place(m2, world(point[0]-1 + b, point[1] + 3, point[2]))
        blocks.place(m2, world(point[0]-1 + b, point[1] + 3, point[2]+1))

    for cycle in range(10):
        h=cycle+point[1]+4
        for c in range(5):
            blocks.place(m2, world(point[0]-2 + c, h, point[2]-2))
            blocks.place(m2, world(point[0]-2 + c, h, point[2]-1))
            blocks.place(m2, world(point[0]-2 + c, h, point[2]))
            blocks.place(m2, world(point[0]-2 + c, h, point[2]+1))
            blocks.place(m2, world(point[0]-2 + c, h, point[2]+2))

    for d in range(3):
        blocks.place(m2, world(point[0]-1 + d, point[1] + 14, point[2]-1))
        blocks.place(m2, world(point[0]-1 + d, point[1] + 14, point[2]))
        blocks.place(m2, world(point[0]-1 + d, point[1] + 14, point[2]+1))

    #Zipfel ja oder nein

    if zipfel == 1:
        blocks.place(m2, world(point[0], point[1] + 15, point[2]))

#======================= Keks ======================#

def Keks(point,l,m1,m2,remove=False): #l = Breite, m1 = Keks-Farbe, m2 = Creme-Farbe

    point=[point[0],point[1],point[2]]

    if remove == True:
        m1=AIR
        m2=AIR

    d=point[1]+(l/15)  #Keks-Dicke
    c=(l/8)            #Creme-Dicke
    blocks.fill(m1, world(point[0], point[1], point[2]), world (point[0]+l,d, point[2]+l))
    blocks.fill(m1, world(point[0], d+c, point[2]), world(point[0]+l, d+c+(l/15), point[2]+l))
    blocks.fill(m2, world(point[0], d, point[2]), world(point[0]+l, d+c, point[2]+l))

#======================= Donut ======================#

def donut(point, r, m1, m2, m3, m4, remove=False): #Koordinaten, Radius, Materialien
    point=[point[0], point[1], point[2]]

    if remove == True:
       m1 = AIR
       m2 = AIR
       m3 = AIR
       m4 = AIR

    #Dicke
    d1 = r*0.1
    d2 = r*0.2
    d3 = r*0.3
    d4 = r*0.125
    #Gebäck
    for a in range(d1):
        shapes.circle(m1,
            world(point[0], point[1]-a, point[2]),
            r,
            Axis.Y,
            ShapeOperation.REPLACE)

    for b in range(d2):
        shapes.circle(m1,
            world(point[0], point[1]-d1-b, point[2]),
            r-1,
            Axis.Y,
            ShapeOperation.REPLACE)

    #Glassur
    for c in range(d3):
        shapes.circle(m2,
            world(point[0], point[1]+d1+c, point[2]),
            r,
            Axis.Y,
            ShapeOperation.REPLACE)
    for d in range(d4):
        shapes.circle(m2,
            world(point[0], point[1]+d1+d3+d, point[2]),
            r-1,
            Axis.Y,
            ShapeOperation.REPLACE)

    #Verzierung
    distance_from_side= point[1]+d1+d3+d4+1
    l_spark=[]
    for i in range(20):
        a = (Math.random()*(3.14)*2) #Just get a random angle :>
        randz=randint(point[2]+(Math.sin(a)*r),point[2]-(Math.sin(a)*r))
        randx=randint(point[0]+(Math.cos(a)*r),point[0]-(Math.cos(a)*r))
        color=[m3, m4] #colors
        #dicke=[distance_from_side+1,distance_from_side]
        cr=color[randint(0,len(color)-1)]
        #cd=dicke[randint(0,len(dicke)-1)]
        cd=distance_from_side
        blocks.place(cr, world(randx, cd, randz))
        l_spark.append([randx,cd, randz])

    #Loch
    L = d1+d2+d3+d4+2
    r_loch=r/3
    for f in range(L):
        y_loch=point[1]-d1-d2+f
        shapes.circle(AIR,
            world(point[0], y_loch, point[2]),
            r_loch,
            Axis.Y,
            ShapeOperation.REPLACE)

    return l_spark


#======================= Chocolate bar ======================#

def Schokolade(point,m,b, remove=False):  # b = Breite, m = Material BROWN_CONCRETE
    point=[point[0], point[1], point[2]]
    if remove==True:
        m=AIR

    h=2*b; d=b/10   # h = Höhe, d = Dicke

    # Hauptstück
    blocks.fill(m,
    world(point[0], point[1], point[2]),
    world(point[0]+b, point[1]+h, point[2]+d))

    # Taefeli rechts 1. Reihe (v. unten)
    blocks.fill(m,
    world(point[0]+(b/10), point[1]+(h/20), point[2]),
    world(point[0]+(b/2)-(b/10), point[1]+(h/4)-(h/20), point[2]-d))

    # Taefeli rechts 2. Reihe
    blocks.fill(m,
    world(point[0]+(b/10), point[1]+(h/4)+(h/20), point[2]),
    world(point[0]+(b/2)-(b/10), point[1]+(2*h/4)-(h/20), point[2]-d))

    # Taefeli rechts 3. Reihe
    blocks.fill(m,
    world(point[0]+(b/10), point[1]+(2*h/4)+(h/20), point[2]),
    world(point[0]+(b/2)-(b/10), point[1]+(3*h/4)-(h/20), point[2]-d))

    # Taefeli rechts 4. Reihe
    blocks.fill(m,
    world(point[0]+(b/10), point[1]+(3*h/4)+(h/20), point[2]),
    world(point[0]+(b/2)-(b/10), point[1]+h-(h/20), point[2]-d))

    # Taefeli links 1. Reihe
    blocks.fill(m,
    world(point[0]+b-(b/10), point[1]+(h/20), point[2]),
    world(point[0]+(b/2)+(b/10), point[1]+(h/4)-(h/20), point[2]-d))

    # Taefeli links 2. Reihe
    blocks.fill(m,
    world(point[0]+b-(b/10), point[1]+(h/4)+(h/20), point[2]),
    world(point[0]+(b/2)+(b/10), point[1]+(2*h/4)-(h/20), point[2]-d))

    # Taefeli links 3. Reihe
    blocks.fill(m,
    world(point[0]+b-(b/10), point[1]+(2*h/4)+(h/20), point[2]),
    world(point[0]+(b/2)+(b/10), point[1]+(3*h/4)-(h/20), point[2]-d))

    # Taefeli links 4. Reihe
    blocks.fill(m,
    world(point[0]+b-(b/10), point[1]+(3*h/4)+(h/20), point[2]),
    world(point[0]+(b/2)+(b/10), point[1]+h-(h/20), point[2]-d))




###CODES###

#World settings
gameplay.set_weather(weather)
gameplay.time_set(gameplay.time(time))
#teleport player
player.teleport(world(point[0]+150, point[1], point[2]-100))

building(WHITE_CONCRETE,boden,height,remove)
rainbow(50,2,boden,point_h,remove) #rainbow enternce radius 50
sign(RED_CONCRETE,GOLD_BLOCK,boden,point_h,remove)


#======================= Keks ======================#

point_keks=[
    [point_h[0],point_h[1],point_h[2]],#right bottom corner (start point)
    [point_h[0]+l_field/2-(50/2),point_h[1],point_h[2]+l_field/2], #Center #(50/2) 50 is l of keks
    [point_h[0]+l_field-50,point_h[1],point_h[2]], #left bottom corner
    [point_h[0],point_h[1],point_h[2]+l_field-50], #right top corner
    [point_h[0]+l_field-50,point_h[1],point_h[2]+l_field-50]  #left top corner
    ] #x=right,left - y=up,down - z=front, forward

for i in range(len(point_keks)):
    Keks(point_keks[i],50,BROWN_CONCRETE,WHITE_CONCRETE,remove)


#======================= Boden changer ======================#
"""
blocks.fill(PINK_GLAZED_TERRACOTTA,
            world(point_h[0],point_h[1]-1,point_h[2]),
            world(point_h[0]+141,point_h[1]-1,point_h[2]+150))
"""
#======================= LOOP sky colors ======================#

c_sky= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
for n in range(150):
    x_cord=randint(point_h[0], point_h[0]+l_field)
    y_cord=randint(point_h[1], point_h[1]+130)
    z_cord=randint(point_h[2], point_h[2]+l_field)
    rgb=randint(0,len(c_sky))
    blocks.place(blocks.block_with_data(WOOL, c_sky[rgb]),world(x_cord,y_cord,z_cord))

#======================= Cake ======================#

point_donut=[
    [point_h[0],point_h[1]-3,point_h[2]+70,20], #20 radius cake big
    [point_h[0],point_h[1]+10,point_h[2]+70,10], #10 radius cake small
    #==============#
    [point_h[0]+l_field-30,point_h[1]-3,point_h[2]+70,30],
    [point_h[0]+l_field-30,point_h[1]+15,point_h[2]+70,20],
    [point_h[0]+l_field-30,point_h[1]+25,point_h[2]+70,10],
    #==============#
    [point_h[0]+30,point_h[1]+5,point_h[2]+110,30],
    [point_h[0]+30,point_h[1]+20,point_h[2]+110,20],
    [point_h[0]+30,point_h[1]+40,point_h[2]+110,10],
    #==============#
    [point_h[0]+l_field-20,point_h[1]-3,point_h[2]+120,20],
    [point_h[0]+l_field-20,point_h[1]+10,point_h[2]+120,10],
    ] #x=right,left - y=up,down - z=front, forward

for i in range(len(point_donut)):
    donut(point_donut[i], point_donut[i][3], BROWN_TERRACOTTA,WHITE_TERRACOTTA,WOOL,PINK_WOOL, remove) #rbig=20, rsmall=10


#======================= RAINBOW ======================#

point_rainbow=[point_h[0],point_h[1]-20,point_h[2]+l_field/2]
rainbow(100,2,boden,point_rainbow,remove) #rainbow enternce radius 50

#======================= CHCOOLATE ======================#

point_choco=[ #Chocolate walls
    [point_h[0],point_h[1],point_h[2]+l_field/2,30],
    [point_h[0]+30,point_h[1],point_h[2]+l_field/2,20],
    #==========#
    [point_h[0]+l_field-30,point_h[1],point_h[2]+l_field/2,30],
    [point_h[0]+l_field-50,point_h[1],point_h[2]+l_field/2,20],
    #=========#
    [point_h[0],point_h[1],point_h[2]+l_field,50],
    [point_h[0]+50,point_h[1],point_h[2]+l_field,50],
    [point_h[0]+100,point_h[1],point_h[2]+l_field,40],
    [point_h[0]+140,point_h[1],point_h[2]+l_field,50],
    [point_h[0]+190,point_h[1],point_h[2]+l_field,40],
    [point_h[0]+230,point_h[1],point_h[2]+l_field,50],
    ]

for i in range(len(point_choco)):
    Schokolade(point_choco[i], BROWN_CONCRETE,point_choco[i][3],remove)




#======================= loli======================#

"""
point_loli=[
    [point_h[0],point_h[1],point_h[2]+100,50],
    [point_h[0]+20,point_h[1],point_h[2]+120,40],
    [point_h[0]+5,point_h[1],point_h[2]+115,20],
    [point_h[0]+10,point_h[1],point_h[2]+130,10],
    ]

for i in range(len(point_loli)):
    lolipop(WHITE_TERRACOTTA,RED_CONCRETE,point_loli[i], point_loli[i][3],remove)
"""


#======================= LOOP for tress all over ======================#

for i in range(2):
    x_cord=randint(point_h[0]+70, point_h[0]+l_field)
    z_cord=randint(point_h[2], point_h[2]+l_field)
    which=randint(1,3)
    point_loop=[x_cord,point_h[1],z_cord]
    if blocks.test_for_block(AIR, world(x_cord,point_h[1],z_cord)) == True and which ==1:
        zuckerwatte(point_loop, WHITE_CONCRETE, PINK_WOOL,20,remove)
    if blocks.test_for_block(AIR, world(x_cord,point_h[1],z_cord)) == True and which ==2:
        lolipop(RED_CONCRETE,WHITE_CONCRETE,point_loop, 7,remove)
    if blocks.test_for_block(AIR, world(x_cord,point_h[1],z_cord)) == True and which ==3:
        Marshmallow(point_loop, BROWN_CONCRETE,WHITE_CONCRETE, 10)



zurück

  • archiv/ef/ef2020_2022/minecraft/projekt/smantharebekkajehan/start/schlaraffenland-code/start.txt
  • Zuletzt geändert: 2022/08/27 18:13
  • von lehmannr