Problem: nothing happens - georeperage

10 views
Skip to first unread message

Space_rod ytb

unread,
Jun 10, 2020, 5:55:57 AM6/10/20
to Adventures in Minecraft Forum

Hello my name is Pierre , I am French

I follow the method " Apprendre a coder en Python avec Minecraft ". version python 3.6 , start serveur , Minecraft 1 . 12

My pc : Windows 10 , Ryzen 5 3400G , 8G ram , GeForce GTX 1660

My PROBLEM:

exercice 1 (p 61 ): Use of georeferencing. No worries with the program below:

import mcpi.minecraft as minecraft
import time
mc = minecraft.Minecraft.create()
X1 = -51
Z1 = 865
X2 = -41
Z2 = 875

impot = 0

while True:
    time.sleep(1)
    pos = mc.player.getTilePos()
    if pos.x>X1 and pos.x<X2 and pos.z>Z1 and pos.z<Z2:
      
        mc.postToChat("Tu dois la somme de :" + str(impot))
       

exercice 2 (p 63 ): addition of coordinates and constants

import mcpi.minecraft as minecraft
import time
mc = minecraft.Minecraft.create()
X1 = -51
Z1 = 865
X2 = -41
Z2 = 875

ABRI_X = X2 + 2
ABRI_Y = 200
ABRI_Z = Z2 + 2
impot = 0
dansEnclos = 3
while True:
    time.sleep(1)
    pos = mc.player.getTilePos()
    if pos.x>X1 and pos.x<X2 and pos.z>Z1 and pos.z<Z2:
        impot = impot+1
        mc.postToChat("Tu dois la somme de :" + str(impot))
        dansEnclos = dansEnclos+1
else: # en dehors de l'enclos
    dansEnclos = 0
if dansEnclos>3:
    mc.postToChat("tu es trop lent !")
    mc.player.setPos(ABRI_X, ABRI_Y, ABRI_Z)

the 2nd program should get me out of the enclosure after 3 seconds but nothing happens.

Thanks for your help

Pierre


Reply all
Reply to author
Forward
0 new messages