Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| gf2:projekte:2023:minecraft:2d1gruppe1 [2024/01/23 21:31] – knuppa | gf2:projekte:2023:minecraft:2d1gruppe1 [2024/03/08 21:05] (aktuell) – marroc | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | {{ : | ||
| -**Idee:** Zoo mit verschiedenen Bereichen (je nach Tierart) | -**Idee:** Zoo mit verschiedenen Bereichen (je nach Tierart) | ||
| Zeile 17: | Zeile 18: | ||
| - | <code python> | ||
| - | < | ||
| + | **Definition für unsere Eingangshäuschen** | ||
| + | <code python> | ||
| + | < | ||
| def haus(): | def haus(): | ||
| blocks.fill(PLANKS_DARK_OAK, | blocks.fill(PLANKS_DARK_OAK, | ||
| Zeile 36: | Zeile 38: | ||
| blocks.place(FLOWER_POT, | blocks.place(FLOWER_POT, | ||
| blocks.place(FLOWER_POT, | blocks.place(FLOWER_POT, | ||
| + | </ | ||
| ** | ** | ||
| Definition für unseren Eingangsbereich** | Definition für unseren Eingangsbereich** | ||
| + | <code python> | ||
| def eingang(): | def eingang(): | ||
| blocks.fill(PLANKS_DARK_OAK, | blocks.fill(PLANKS_DARK_OAK, | ||
| Zeile 45: | Zeile 48: | ||
| blocks.fill(PLANKS_OAK, | blocks.fill(PLANKS_OAK, | ||
| blocks.fill(PLANKS_OAK, | blocks.fill(PLANKS_OAK, | ||
| + | </ | ||
| ** | ** | ||
| Definition für unsere Ställe** | Definition für unsere Ställe** | ||
| - | + | <code python> | |
| def hütte(x, | def hütte(x, | ||
| blocks.fill(PLANKS_DARK_OAK, | blocks.fill(PLANKS_DARK_OAK, | ||
| Zeile 55: | Zeile 59: | ||
| blocks.fill(PLANKS_DARK_OAK, | blocks.fill(PLANKS_DARK_OAK, | ||
| blocks.place(DARK_OAK_DOOR, | blocks.place(DARK_OAK_DOOR, | ||
| + | </ | ||
| **Definition für unsere Mauer, welche den Zoo umschliesst** | **Definition für unsere Mauer, welche den Zoo umschliesst** | ||
| + | <code python> | ||
| def mauer(x, | def mauer(x, | ||
| blocks.fill(PLANKS_DARK_OAK, | blocks.fill(PLANKS_DARK_OAK, | ||
| - | + | </ | |
| **Definition für unsere Gehege (Gitter)** | **Definition für unsere Gehege (Gitter)** | ||
| + | <code python> | ||
| def gehege(x, | def gehege(x, | ||
| blocks.fill(IRON_BARS, | blocks.fill(IRON_BARS, | ||
| blocks.fill(IRON_BARS, | blocks.fill(IRON_BARS, | ||
| - | + | </ | |
| **Definition für unsere Gehege (Holzbereich)** | **Definition für unsere Gehege (Holzbereich)** | ||
| + | <code python> | ||
| def zaun(x, | def zaun(x, | ||
| blocks.fill(JUNGLE_FENCE, | blocks.fill(JUNGLE_FENCE, | ||
| blocks.fill(JUNGLE_FENCE, | blocks.fill(JUNGLE_FENCE, | ||
| - | + | </ | |
| **Definition für unsere Voliere** | **Definition für unsere Voliere** | ||
| + | <code python> | ||
| def voliere(x, | def voliere(x, | ||
| blocks.fill(GLASS_PANE, | blocks.fill(GLASS_PANE, | ||
| blocks.fill(GRASS, | blocks.fill(GRASS, | ||
| blocks.fill(GLASS, | blocks.fill(GLASS, | ||
| - | | + | </ |
| **Definition für den Picknickbereich (Tische)** | **Definition für den Picknickbereich (Tische)** | ||
| - | + | <code python> | |
| def tisch(x, | def tisch(x, | ||
| a=0 | a=0 | ||
| Zeile 92: | Zeile 97: | ||
| x=x+1 | x=x+1 | ||
| blocks.place(JUNGLE_SAPLING, | blocks.place(JUNGLE_SAPLING, | ||
| - | | + | </ |
| | | ||
| - | + | <code python> | |
| def spawn(tier, | def spawn(tier, | ||
| - | agent.teleport(world(x, | + | |
| - | | + | agent.set_item(tier, |
| - | | + | agent.set_slot(1) |
| - | | + | a=0 |
| - | | + | while(a< |
| - | | + | agent.place(FORWARD) |
| - | | + | a=a+1 |
| - | + | </ | |
| + | **EIngangsbereich** | ||
| + | <code python> | ||
| haus() | haus() | ||
| spawn(SPAWN_VILLAGER, | spawn(SPAWN_VILLAGER, | ||
| Zeile 111: | Zeile 117: | ||
| blocks.print(" | blocks.print(" | ||
| blocks.print(" | blocks.print(" | ||
| - | " | + | </ |
| + | |||
| + | **Gittergehege** | ||
| + | <code python> | ||
| gehege(36, | gehege(36, | ||
| gehege(26, | gehege(26, | ||
| gehege(36, | gehege(36, | ||
| gehege(47, -60, -10, -50, 31) | gehege(47, -60, -10, -50, 31) | ||
| - | + | </ | |
| - | "Ställe" | + | **Ställe** |
| + | <code python> | ||
| hütte(53, | hütte(53, | ||
| hütte(53, | hütte(53, | ||
| hütte(53, | hütte(53, | ||
| hütte(85, | hütte(85, | ||
| - | + | </ | |
| - | "Holzzäune" | + | **Holzzäune** |
| + | <code python> | ||
| zaun(0, | zaun(0, | ||
| zaun(-14, | zaun(-14, | ||
| Zeile 129: | Zeile 140: | ||
| zaun(-14, | zaun(-14, | ||
| zaun(0, | zaun(0, | ||
| - | + | </ | |
| - | "Umrandung" | + | **Umrandung** |
| + | <code python> | ||
| mauer(2, | mauer(2, | ||
| mauer(-29, | mauer(-29, | ||
| Zeile 138: | Zeile 150: | ||
| mauer(89, | mauer(89, | ||
| mauer(53, | mauer(53, | ||
| - | mauer(54, | + | mauer(54, |
| mauer(89, -60, -61, 0, -42) | mauer(89, -60, -61, 0, -42) | ||
| mauer(46, | mauer(46, | ||
| mauer(15, | mauer(15, | ||
| - | mauer(85, | + | mauer(85, |
| - | + | </ | |
| - | "Mitarbeitertür" | + | **Mitarbeitertür** |
| + | <code python> | ||
| blocks.fill(AIR, | blocks.fill(AIR, | ||
| blocks.place(OAK_DOOR, | blocks.place(OAK_DOOR, | ||
| - | + | </ | |
| - | "Papageienhaus" | + | **Papageienhaus** |
| + | <code python> | ||
| voliere(-2, | voliere(-2, | ||
| + | </ | ||
| - | + | **Aquarium** | |
| - | "Aquarium" | + | <code python> |
| - | + | ||
| blocks.fill(BLACKSTONE, | blocks.fill(BLACKSTONE, | ||
| blocks.fill(SAND, | blocks.fill(SAND, | ||
| blocks.fill(AIR, | blocks.fill(AIR, | ||
| - | + | ||
| blocks.fill(GLASS_PANE, | blocks.fill(GLASS_PANE, | ||
| Zeile 170: | Zeile 184: | ||
| blocks.fill(GLASS_PANE, | blocks.fill(GLASS_PANE, | ||
| blocks.fill(GLASS_PANE, | blocks.fill(GLASS_PANE, | ||
| - | + | </ | |
| - | "Dach des weges" | + | **Dach des weges** |
| + | <code python> | ||
| blocks.fill(GLASS, | blocks.fill(GLASS, | ||
| blocks.fill(GLASS, | blocks.fill(GLASS, | ||
| blocks.fill(GLASS, | blocks.fill(GLASS, | ||
| blocks.fill(GLASS, | blocks.fill(GLASS, | ||
| - | + | </ | |
| - | "Boden des Weges" | + | **Boden des Weges** |
| + | <code python> | ||
| blocks.fill(PRISMARINE, | blocks.fill(PRISMARINE, | ||
| blocks.fill(PRISMARINE, | blocks.fill(PRISMARINE, | ||
| Zeile 188: | Zeile 204: | ||
| blocks.print(" | blocks.print(" | ||
| - | + | </ | |
| - | + | **Picknickbbereich** | |
| + | <code python> | ||
| tisch(20, | tisch(20, | ||
| tisch(20, | tisch(20, | ||
| Zeile 210: | Zeile 227: | ||
| tisch(30, | tisch(30, | ||
| - | + | </ | |
| - | "Tiere" | + | **Tiere** |
| - | + | <code python> | |
| - | + | ||
| spawn(SPAWN_PARROT, | spawn(SPAWN_PARROT, | ||
| spawn(SPAWN_PANDA, | spawn(SPAWN_PANDA, | ||
| Zeile 225: | Zeile 241: | ||
| spawn(SPAWN_PIG, | spawn(SPAWN_PIG, | ||
| spawn(SPAWN_TROPICAL_FISH, | spawn(SPAWN_TROPICAL_FISH, | ||
| - | spawn(SPAWN_PUFFERFISH, | ||
| spawn(SPAWN_SALMON, | spawn(SPAWN_SALMON, | ||
| spawn(SPAWN_DOLPHIN, | spawn(SPAWN_DOLPHIN, | ||
| Zeile 231: | Zeile 246: | ||
| spawn(SPAWN_SQUID, | spawn(SPAWN_SQUID, | ||
| spawn(SPAWN_GLOW_SQUID, | spawn(SPAWN_GLOW_SQUID, | ||
| - | spawn(SPAWN_AXOLOTL, 80, -5, -52, -28) | + | </ |
| - | ** | + | |
| - | # Die folgende Funktion testet, ob ein Gold Klumpen in der Truhe ist.** | + | **Bäume** |
| + | <code python> | ||
| + | blocks.place(BAMBOO,world(53,-60,-18)) | ||
| + | blocks.place(BAMBOO, | ||
| + | blocks.place(BAMBOO, | ||
| + | blocks.place(BAMBOO,world(63, | ||
| + | blocks.place(BAMBOO, | ||
| + | blocks.place(BAMBOO, | ||
| + | blocks.place(BAMBOO, | ||
| + | blocks.place(OAK_SAPLING, | ||
| - | **# Sie gibt true oder false als Rückgabewert, | + | blocks.place(OAK_SAPLING, |
| + | blocks.place(OAK_SAPLING, | ||
| + | blocks.place(OAK_SAPLING, | ||
| + | blocks.place(OAK_SAPLING, | ||
| + | |||
| + | blocks.place(CHERRY_SAPLING, | ||
| + | |||
| + | blocks.place(CHERRY_SAPLING, | ||
| + | blocks.place(CHERRY_SAPLING, | ||
| + | </ | ||
| + | |||
| + | **Dies ist unser zweiter Teil unseres Projektes. Das ist der Interaktive Teil, welche unseren Eingangsbereich, | ||
| + | <code python> | ||
| + | # Die folgende Funktion testet, ob ein Gold Klumpen in der Truhe ist. | ||
| + | |||
| + | # Sie gibt true oder false als Rückgabewert, | ||
| def isGoldinChest(x, | def isGoldinChest(x, | ||
| - | |||
| blocks.fill(CHEST, | blocks.fill(CHEST, | ||
| - | |||
| goldFound = False | goldFound = False | ||
| # Agent weit weg teleportieren und alles wegschmeissen | # Agent weit weg teleportieren und alles wegschmeissen | ||
| - | agent.teleport(world(110,-60,110),NORTH) | + | agent.teleport(world(50,-60,50),NORTH) |
| - | + | ||
| agent.drop_all(FORWARD) | agent.drop_all(FORWARD) | ||
| Zeile 254: | Zeile 290: | ||
| # Agenten zur Kiste teleportieren | # Agenten zur Kiste teleportieren | ||
| - | |||
| agent.teleport(world(a, | agent.teleport(world(a, | ||
| Zeile 260: | Zeile 295: | ||
| agent.destroy(FORWARD) | agent.destroy(FORWARD) | ||
| - | |||
| agent.collect_all() | agent.collect_all() | ||
| - | |||
| for slotNumber in range(1, | for slotNumber in range(1, | ||
| - | |||
| itemID = agent.get_item_detail(slotNumber) | itemID = agent.get_item_detail(slotNumber) | ||
| - | |||
| if (itemID == 371): | if (itemID == 371): | ||
| - | |||
| goldFound = True | goldFound = True | ||
| - | |||
| return goldFound | return goldFound | ||
| - | ** | ||
| - | # Die folgende Funktion testet, ob ein Gold Klumpen in der zweiten Truhe ist.** | ||
| - | ** | ||
| - | # Sie gibt true oder false als Rückgabewert, | ||
| - | def isGoldinChest2(x, | ||
| - | blocks.place(CHEST, | ||
| - | |||
| - | goldFound = False | ||
| - | |||
| - | # Agent weit weg teleportieren und alles wegschmeissen | ||
| - | |||
| - | agent.teleport(world(110, | ||
| - | |||
| - | agent.drop_all(FORWARD) | ||
| - | |||
| - | # Kiste kopieren (sie steht bei (x,y,z)) | ||
| - | |||
| - | blocks.clone(world(x, | ||
| - | |||
| - | # Agenten zur Kiste teleportieren | ||
| - | |||
| - | agent.teleport(world(a, | ||
| - | |||
| - | # Kiste zerstören und Objekte aufsammeln | ||
| - | |||
| - | agent.destroy(FORWARD) | ||
| - | |||
| - | agent.collect_all() | ||
| - | |||
| - | for slotNumber in range(1, | ||
| - | |||
| - | itemID = agent.get_item_detail(slotNumber) | ||
| - | |||
| - | if (itemID == 371): | ||
| - | |||
| - | goldFound = True | ||
| - | |||
| - | return goldFound | ||
| - | **# Es wird geschaut ob ein Goldklumpen in der kiste ist das ergibt dann ein true oder false Rückgabewert und das kann weiter gebraucht werden.** | + | # Es wird geschaut ob ein Goldklumpen in der kiste ist das ergibt dann ein true oder false Rückgabewert und das kann weiter gebraucht werden. |
| def Payforpotion(x, | def Payforpotion(x, | ||
| - | | + | |
| - | | + | |
| | | ||
| - | |||
| # Agent weit weg teleportieren und alles wegschmeissen | # Agent weit weg teleportieren und alles wegschmeissen | ||
| - | | + | |
| - | + | ||
| | | ||
| Zeile 330: | Zeile 318: | ||
| # Agenten zur Kiste teleportieren | # Agenten zur Kiste teleportieren | ||
| - | |||
| | | ||
| # Kiste zerstören und Objekte aufsammeln | # Kiste zerstören und Objekte aufsammeln | ||
| - | |||
| | | ||
| - | |||
| | | ||
| - | + | | |
| for slotNumber in range(1, | for slotNumber in range(1, | ||
| - | |||
| | | ||
| - | |||
| if (itemID == 371): | if (itemID == 371): | ||
| - | |||
| | | ||
| - | |||
| | | ||
| - | **# Definition dafür das alle slots in einer Kiste mit luft ersetzt werden können. | + | # Definition dafür das alle slots in einer Kiste mit luft ersetzt werden können. |
| - | ** | + | |
| def replaceSlotsinChestAir(x, | def replaceSlotsinChestAir(x, | ||
| for k in range(27): | for k in range(27): | ||
| player.execute("/ | player.execute("/ | ||
| - | **# Definition dafür | + | # Definition dafür |
| def giveNightVisionPotion(x, | def giveNightVisionPotion(x, | ||
| - | for k in range(27): | + | for k in range(1): |
| player.execute("/ | player.execute("/ | ||
| - | ** | ||
| - | # Nun können wir ein Mal pro Sekunde testen, ob ein Goldklumpen in der Truhe ist** | + | |
| + | # Nun können wir ein Mal pro Sekunde testen, ob ein Goldklumpen in der Truhe ist | ||
| def on_forever(): | def on_forever(): | ||
| - | + | | |
| - | | + | |
| - | + | ||
| player.say(" | player.say(" | ||
| - | |||
| replaceSlotsinChestAir(8, | replaceSlotsinChestAir(8, | ||
| - | |||
| for i in range(4): | for i in range(4): | ||
| - | |||
| for j in range(3): | for j in range(3): | ||
| blocks.fill(AIR, | blocks.fill(AIR, | ||
| - | |||
| else: | else: | ||
| - | |||
| for i in range(4): | for i in range(4): | ||
| - | |||
| for j in range(3): | for j in range(3): | ||
| - | |||
| blocks.fill(BLOCK_OF_STRIPPED_BAMBOO, | blocks.fill(BLOCK_OF_STRIPPED_BAMBOO, | ||
| - | | + | loops.pause(1000) |
| - | | + | |
| | | ||
| def on_forever2(): | def on_forever2(): | ||
| - | + | | |
| - | | + | |
| - | + | ||
| player.say(" | player.say(" | ||
| - | + | | |
| - | | + | |
| - | + | ||
| for i in range(6): | for i in range(6): | ||
| - | |||
| for j in range(3): | for j in range(3): | ||
| - | | ||
| blocks.fill(AIR, | blocks.fill(AIR, | ||
| - | |||
| else: | else: | ||
| - | |||
| for i in range(6): | for i in range(6): | ||
| - | |||
| for j in range(3): | for j in range(3): | ||
| - | | ||
| blocks.fill(BLOCK_OF_STRIPPED_BAMBOO, | blocks.fill(BLOCK_OF_STRIPPED_BAMBOO, | ||
| - | + | | |
| - | | + | |
| def on_forever3(): | def on_forever3(): | ||
| - | if (Payforpotion(9, | + | if (Payforpotion(9, |
| - | + | ||
| player.say(" | player.say(" | ||
| - | |||
| giveNightVisionPotion(9, | giveNightVisionPotion(9, | ||
| - | | ||
| else: | else: | ||
| replaceSlotsinChestAir(9, | replaceSlotsinChestAir(9, | ||
| - | | ||
| - | | ||
| - | | ||
| loops.pause(1000) | loops.pause(1000) | ||
| + | |||
| + | def on_forever4(): | ||
| + | on_forever() | ||
| + | on_forever2() | ||
| + | on_forever3() | ||
| + | |||
| + | loops.forever(on_forever4) | ||
| + | | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| - | loops.forever(on_forever) | ||
| - | loops.forever(on_forever2) | ||
| - | loops.forever(on_forever3) | ||