---
# System prepended metadata

title: Minecraft Python 4A1

---

# Minecraft Python 4A1 

## :beginner: 安裝教學


**Step1:下載 minecraft java (若已下載好請跳過這步)**


:small_blue_diamond:網址:https://www.minecraft.net/zh-hant

![螢幕擷取畫面 2025-09-12 221016](https://hackmd.io/_uploads/H1seqiWsxg.png)
-> 選擇 登入方式Microsoft

輸入帳號:codepromi3@gmail.com

**Step2:下載安裝包**

windows安裝包:
https://drive.google.com/drive/folders/1XY8t92OyGbxXjXX3H00UAzTbgTGf7ZUr

mac安裝包:
https://drive.google.com/drive/folders/1zs-pnuly0B_JWx-AQntcJofK5s5Oi2Ly

備用python:https://www.python.org/downloads/

備用java:https://www.java.com/en/download/

**Step3:安裝java、python**

mac
![螢幕擷取畫面 2025-09-16 115619](https://hackmd.io/_uploads/HyjzewUjlx.png)
![螢幕擷取畫面 2025-09-16 115624](https://hackmd.io/_uploads/BysflPLjll.png)
windows

![螢幕擷取畫面 2025-09-16 115637](https://hackmd.io/_uploads/BJszeDLolx.png)
![螢幕擷取畫面 2025-09-16 115645](https://hackmd.io/_uploads/ryjGlwLslg.png)

**Step4:建置環境**

1.在桌面**Minecraft Tools**中執行**Start_Server**檔案

2.開啟minecraft **1.11.2版本!** 多人模式

3.開一個新的終端機安裝mcpi 套件：pip install mcpi 或 pip3 install mcpi

4.與Server同一個終端機

增加玩家權限 :  pex user <玩家名稱> add *

## :triangular_flag_on_post: 安裝VScode
https://code.visualstudio.com/download

## :triangular_flag_on_post: 測試程式碼 :point_down: 
    ```
    #匯入需要的工具
    import mcpi.minecraft as minecraft
    #連結Minecraft世界
    mc = minecraft.Minecraft.create()
    #取得目前位置
    pos = mc.player.getTilePos()
    #輸出到Minecraft世界
    mc.postToChat("Hello Minecraft!")
    mc.postToChat(pos)
    import mcpi.minecraft as minecraft
    
    mc = minecraft.Minecraft.create()
    pos = mc.player.getTilePos()
    mc.setBlock(pos.x + 1, pos.y, pos.z, 20)
    mc.setBlock(pos.x - 1, pos.y, pos.z, 20)
    mc.setBlock(pos.x, pos.y, pos.z + 1, 20)
    mc.setBlock(pos.x, pos.y, pos.z - 1, 20)
    
    ```

## 結束

