Skip to content

Commit d99d170

Browse files
0.0.16a_02
1 parent c7e4e82 commit d99d170

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1488
-541
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ minecraft_python.egg-info
55
*.pyd
66
*.dat
77
*.bat
8+
!start server.bat
89
*.log
910
*.html
1011
*.prof
1112
*.c
1213
*.h
14+
*.so
15+
.DS_Store

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ install:
1212
CYTHONIZE=1 pip install .
1313

1414
install-from-source: dist
15-
pip install dist/minecraft-python-0.0.14a8.tar.gz
15+
pip install dist/minecraft-python-0.0.16a2.tar.gz
1616

1717
clean:
1818
$(RM) -r build dist src/*.egg-info

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
![Minecraft](/screenshot.png?raw=true)
44

5-
_**Minecraft: Python Edition**_ is a project that strives to recreate each and every old Minecraft version in Python using the **Pyglet** multimedia library and **Cython** for performance.
5+
_**Minecraft: Python Edition**_ is a project that strives to recreate each and every old Minecraft version in Python 3 using the **Pyglet** multimedia library and **Cython** for performance.
66

7-
This project is currently recreating the **Classic** versions of Minecraft. The latest version is **Classic 0.0.14a_08** as released on _**May 28, 2009**_.
7+
This project is currently recreating the **Multiplayer Classic** versions of Minecraft. The latest version is _**Classic 0.0.16a_02**_ as released on _**June 7, 2009**_.
88

9-
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.0.14a_08).
9+
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.0.16a_02).
10+
11+
Or the server version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_server_1.2).
1012

1113
This project is organized so that every commit is strictly the completed release of the Python version of the Java game of the same version number.
1214
This means that you can go back into this repository's commit history and see only the source code changes between versions of Minecraft.
@@ -16,7 +18,7 @@ For any version this project covers, you can play it just by specifying the Mine
1618

1719
*Pyglet* and *Cython* are required dependencies and can easily be installed with *pip*. Use the versions specified in `requirements.txt`.
1820

19-
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.0.14a_08`.
21+
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.0.16a_02`.
2022

2123
Alternatively, for a manual Cython build, run `python setup.py build_ext --inplace`.
2224

@@ -26,15 +28,23 @@ Run with the argument `-fullscreen` to open the window in fullscreen mode.
2628

2729
### Gameplay
2830

29-
This version features more advanced terrain (including caves and expanding water tiles), level saving, and human mobs.
30-
Use the number keys or the mouse scroll wheel to switch tiles.
31+
This version features multiplayer, chat, more advanced terrain (including caves and expanding water tiles), level saving, and human mobs.
3132

3233
Press *Esc* to pause. Press *Enter* to set spawn position, *R* to teleport to your spawn position, *Y* to invert the mouse, *G* to spawn a mob, and *F* to toggle render distance.
34+
Use the number keys or the mouse scroll wheel to switch tiles.
35+
36+
### Multiplayer
37+
38+
To launch the multiplayer game, run `python -m mc.net.minecraft.Minecraft -server [host:port] -user [username]`.
39+
40+
To host a server, follow the instructions in the `README.TXT` file in the *server* directory.
3341

3442
### Additional Notes
3543

3644
The resources directory contains all of the textures that this version uses. However,
3745
they are only there for convenience, as all of the texture buffers are already preloaded
3846
in the `net.Resources` module.
3947

48+
The *server* directory contains the unmodified, original Minecraft server build for this version.
49+
4050
This would have been much more challenging to work on without the great tools provided by [RetroMCP-Java](https://github.com/MCPHackers/RetroMCP-Java).

mc/Resources.py

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

mc/net/minecraft/ChatLine.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class ChatLine:
2+
3+
def __init__(self, string):
4+
self.message = string
5+
self.counter = 0

mc/net/minecraft/Entity.py

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from mc.net.minecraft.level.liquid.Liquid import Liquid
12
from mc.net.minecraft.phys.AABB import AABB
23

34
import random
@@ -27,19 +28,19 @@ def __init__(self, level):
2728
self.setPos(0.0, 0.0, 0.0)
2829

2930
def resetPos(self):
30-
x = self._level.xSpawn + 0.5
31-
y = self._level.ySpawn
32-
z = self._level.zSpawn + 0.5
33-
while y > 0.0:
34-
self.setPos(x, y, z)
35-
if len(self._level.getCubes(self.bb)) == 0:
36-
break
37-
38-
y += 1.0
39-
40-
self.xd = self.yd = self.zd = 0.0
41-
self.yRot = self._level.rotSpawn
42-
self.xRot = 0.0
31+
if self._level:
32+
x = self._level.xSpawn + 0.5
33+
y = self._level.ySpawn
34+
z = self._level.zSpawn + 0.5
35+
while y > 0.0:
36+
self.setPos(x, y, z)
37+
if len(self._level.getCubes(self.bb)) == 0:
38+
break
39+
y += 1.0
40+
41+
self.xd = self.yd = self.zd = 0.0
42+
self.yRot = self._level.rotSpawn
43+
self.xRot = 0.0
4344

4445
def remove(self):
4546
self.removed = True
@@ -48,14 +49,31 @@ def setSize(self, w, h):
4849
self._bbWidth = w
4950
self.bbHeight = h
5051

51-
def setPos(self, x, y, z):
52+
def setPos(self, x, y=None, z=None):
53+
if x and y is None:
54+
playerMove = x
55+
if playerMove.moving:
56+
self.setPos(playerMove.x, playerMove.y, playerMove.z)
57+
else:
58+
self.setPos(self.x, self.y, self.z)
59+
60+
if playerMove.rotating:
61+
self._setRot(playerMove.yRot, playerMove.xRot)
62+
else:
63+
self._setRot(self.yRot, self.xRot)
64+
return
65+
5266
self.x = x
5367
self.y = y
5468
self.z = z
5569
w = self._bbWidth / 2.0
5670
h = self.bbHeight / 2.0
5771
self.bb = AABB(x - w, y - h, z - w, x + w, y + h, z + w)
5872

73+
def _setRot(self, yRot, xRot):
74+
self.yRot = yRot
75+
self.xRot = xRot
76+
5977
def turn(self, xo, yo):
6078
orgXRot = self.xRot
6179
orgYRot = self.yRot
@@ -124,10 +142,10 @@ def move(self, xa, ya, za):
124142
self.z = (self.bb.z0 + self.bb.z1) / 2.0
125143

126144
def isInWater(self):
127-
return self._level.containsLiquid(self.bb.grow(0.0, -0.4, 0.0), 1)
145+
return self._level.containsLiquid(self.bb.grow(0.0, -0.4, 0.0), Liquid.water)
128146

129147
def isInLava(self):
130-
return self._level.containsLiquid(self.bb, 2)
148+
return self._level.containsLiquid(self.bb, Liquid.lava)
131149

132150
def moveRelative(self, xa, za, speed):
133151
dist = math.sqrt(xa * xa + za * za)
@@ -161,3 +179,11 @@ def render(self, a):
161179

162180
def setLevel(self, level):
163181
self._level = level
182+
183+
def moveTo(self, x, y, z, xRot, yRot):
184+
self.xo = self.x = x
185+
self.yo = self.y = y
186+
self.zo = self.z = z
187+
self.xRot = xRot
188+
self.yRot = yRot
189+
self.setPos(x, y, z)

0 commit comments

Comments
 (0)