Skip to content

Commit bcaa5a0

Browse files
0.24_SURVIVAL_TEST_03 (0.24)
1 parent edff4c4 commit bcaa5a0

File tree

151 files changed

+5436
-2768
lines changed

Some content is hidden

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

151 files changed

+5436
-2768
lines changed

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.22a5.tar.gz
15+
pip install dist/minecraft-python-0.24.tar.gz
1616

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

README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
_**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 **Multiplayer Classic** versions of Minecraft. The latest version is **Classic 0.0.23a_01** as released on _**July 11, 2009**_.
7+
This project is currently recreating the **Survival Test Classic** versions of Minecraft. The latest version is **Classic 0.24_SURVIVAL_TEST_03** as released on _**September 1, 2009**_.
88

9-
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.0.23a_01).
10-
11-
Or the server version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_server_1.8.2).
9+
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.24_SURVIVAL_TEST_03).
1210

1311
This project is organized so that every commit is strictly the finished Python version of the Java game of the same version number.
1412
This means that you can go back into this repository's commit history and see only the source code changes between versions of Minecraft,
@@ -19,10 +17,10 @@ you can play it just by specifying the Minecraft version you want to play in the
1917

2018
*Pyglet*, *Cython*, *Pillow*, and *PyOgg* are required dependencies and can easily be installed with *pip*. Use the versions specified in `requirements.txt`.
2119

22-
This version features block sounds and music, and for audio to work you need either *PyOgg* which is recommended, or FFmpeg which is installed on the system.
20+
For audio to work you will either need *PyOgg* which is recommended, or FFmpeg which is installed on the system.
2321
GStreamer is also supported on Linux through the *gst-python* library. PyOgg requires that your system have one of the *Opus*, *FLAC*, or *Vorbis* codecs. OpenAL is required.
2422

25-
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.0.23a_01`.
23+
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.24`.
2624

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

@@ -32,25 +30,20 @@ Run with the argument `-fullscreen` to open the window in fullscreen mode.
3230

3331
### Gameplay
3432

35-
This version features multiplayer, chat, caves, beaches, hill terrain, infinite liquid tiles, level saving, options, and human mobs.
36-
37-
Press *B* to open the inventory menu, *G* to spawn a human mob. Press *Esc* to pause and see other controls.
33+
This version features early mob enemies and basic combat. Press Tab to launch arrows at enemies.
3834

39-
### Multiplayer
35+
There are pigs, but they don't drop anything. Creepers, zombies, and skeletons all attack the same, but creepers explode upon death.
4036

41-
To launch the multiplayer game, run `python -m mc.net.minecraft.Minecraft -server <host:port> -user <username> -mppass [password]`.
37+
To heal, pick up brown mushrooms and right click to eat. Red mushrooms are poisonous and will take damage.
4238

43-
Press *Tab* in-game to view connected players.
39+
### Multiplayer
4440

45-
To host a server, follow the instructions in the `README.TXT` file in the *server* directory.
46-
Make sure `verify-names` is set to `false` in the server properties.
41+
Since this is a Survival version of Classic, multiplayer support is disabled.
4742

4843
### Additional Notes
4944

5045
The `mc.resources` directory contains all of the textures and sounds that this version uses. However,
5146
the textures are only there for convenience, as all of the texture buffers are already preloaded
5247
in the `mc.Resources` module.
5348

54-
The *server* directory contains the unmodified, original Minecraft server build for this version.
55-
5649
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: 13 additions & 3 deletions
Large diffs are not rendered by default.

mc/cCompatibilityShims.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ cdef class Random:
44

55
cdef float randFloatM(self, float multiply)
66
cdef float randFloat(self)
7-
cdef int randInt(self, int limit)
7+
cdef int nextInt(self, int limit)

mc/cCompatibilityShims.pyx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
11
# cython: language_level=3
22

3+
cimport cython
4+
35
from libc.stdlib cimport srand, rand, RAND_MAX
46
from libc.time cimport time
57

8+
cdef bint Random_seeded = False
9+
610
cdef class Random:
711

12+
property seeded:
13+
14+
def __get__(self):
15+
return Random_seeded
16+
17+
def __set__(self, x):
18+
global Random_seeded
19+
Random_seeded = x
20+
821
def __init__(self, seed=0):
9-
if seed == 0:
10-
srand(time(NULL))
11-
else:
12-
srand(seed)
22+
if not self.seeded:
23+
if seed == 0:
24+
srand(time(NULL))
25+
else:
26+
srand(seed)
27+
28+
self.seeded = True
1329

1430
cdef float randFloatM(self, float multiply):
1531
return self.randFloat() * multiply
1632

1733
cdef float randFloat(self):
1834
return rand() / <float>RAND_MAX
1935

20-
cdef int randInt(self, int limit):
21-
cdef int divisor, retval
36+
@cython.cdivision(True)
37+
cdef int nextInt(self, int limit):
38+
cdef double scaleFactor
39+
cdef int value
40+
41+
if not isinstance(limit, int) or limit <= 0:
42+
raise ValueError('limit must be a positive integer')
2243

23-
divisor = RAND_MAX // (limit + 1)
24-
retval = limit + 1
25-
while retval > limit:
26-
retval = rand() // divisor
44+
scaleFactor = limit / (RAND_MAX + 1.0)
45+
value = <int>(rand() * scaleFactor)
2746

28-
return retval
47+
return value

mc/net/minecraft/Entity.pxd

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# cython: language_level=3
2+
3+
from mc.net.minecraft.phys.AABB cimport AABB
4+
5+
cdef class Entity:
6+
7+
cdef:
8+
public float x
9+
public float y
10+
public float z
11+
public float xo
12+
public float yo
13+
public float zo
14+
public float xd
15+
public float yd
16+
public float zd
17+
public float yRot
18+
public float xRot
19+
public float yRotO
20+
public float xRotO
21+
22+
public object level
23+
public AABB bb
24+
public bint onGround
25+
public bint horizontalCollision
26+
public bint collision
27+
public bint slide
28+
public bint removed
29+
30+
public float heightOffset
31+
public float bbWidth
32+
public float bbHeight
33+
public float walkDistO
34+
public float walkDist
35+
public bint makeStepSound
36+
public float fallDistance
37+
int __nextStep
38+
public object blockMap
39+
public float xOld
40+
public float yOld
41+
public float zOld
42+
43+
cpdef tick(self)
44+
cpdef bint isFree(self, float xa, float ya, float za)
45+
cpdef move(self, float xa, float ya, float za)
46+
cdef _causeFallDamage(self, float distance)
47+
cdef bint isInWater(self)
48+
cdef bint isInLava(self)
49+
cdef moveRelative(self, float xa, float za, float speed)
50+
cpdef float getBrightness(self, float a)
51+
cpdef render(self, textures, float translation)
52+
cdef push(self, entity)

0 commit comments

Comments
 (0)