Skip to content

Commit ba8df99

Browse files
0.0.22a_05
1 parent 642e7c4 commit ba8df99

Some content is hidden

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

66 files changed

+739
-454
lines changed

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ include screenshot.png
77
include LICENSE
88
include README.md
99

10-
recursive-include mc *.pyx *.pxd
11-
recursive-include resources *
10+
recursive-include mc *.pyx *.pxd *.ogg *.png
1211
recursive-exclude * *.pyc
1312
recursive-exclude * *.pyd
1413
recursive-exclude * *.html

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

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

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,25 @@
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.21a** as released on _**June 22, 2009**_.
7+
This project is currently recreating the **Multiplayer Classic** versions of Minecraft. The latest version is **Classic 0.0.22a_05** as released on _**June 29, 2009**_.
88

9-
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.0.21a).
9+
Learn more about this version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_0.0.22a_05).
1010

1111
Or the server version [here](https://minecraft.fandom.com/wiki/Java_Edition_Classic_server_1.8.2).
1212

13-
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.
13+
This project is organized so that every commit is strictly the finished Python version of the Java game of the same version number.
1414
This means that you can go back into this repository's commit history and see only the source code changes between versions of Minecraft,
1515
or you can compare branches and see the changes made between them. For any version this project covers,
1616
you can play it just by specifying the Minecraft version you want to play in the `pip install` command as demonstrated below.
1717

1818
### General Usage
1919

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

22-
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.0.21`.
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.
23+
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.
24+
25+
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.0.22a_05`.
2326

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

@@ -29,9 +32,12 @@ Run with the argument `-fullscreen` to open the window in fullscreen mode.
2932

3033
### Gameplay
3134

32-
This version features multiplayer, chat, more advanced terrain (including caves and expanding water tiles), level saving, and human mobs.
35+
This version features multiplayer, chat, caves, beaches, hill terrain, infinite liquid tiles, level saving, and human mobs.
36+
37+
Press *B* to open the inventory menu. Press *Enter* to set your spawn position, *R* to teleport to your spawn position,
38+
*Y* to invert the mouse, *G* to spawn a mob, *F* to toggle render distance, and *M* to mute audio.
3339

34-
Press *B* to open the inventory menu. Press *Enter* to set your 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.
40+
*Minecraft: Python Edition* should be compatible with any platform that supports OpenGL, modern Python 3, and Cython.
3541

3642
### Multiplayer
3743

@@ -44,8 +50,8 @@ Make sure `verify-names` is set to `false` in the server properties.
4450

4551
### Additional Notes
4652

47-
The resources directory contains all of the textures that this version uses. However,
48-
they are only there for convenience, as all of the texture buffers are already preloaded
53+
The `mc.resources` directory contains all of the textures and sounds that this version uses. However,
54+
the textures are only there for convenience, as all of the texture buffers are already preloaded
4955
in the `mc.Resources` module.
5056

5157
The *server* directory contains the unmodified, original Minecraft server build for this version.

mc/net/minecraft/Entity.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from mc.net.minecraft.level.liquid.Liquid import Liquid
2+
from mc.net.minecraft.level.tile.Tiles import SoundType, tiles
23
from mc.net.minecraft.phys.AABB import AABB
34

45
import random
@@ -22,6 +23,8 @@ class Entity:
2223
heightOffset = 0.0
2324
_bbWidth = 0.6
2425
bbHeight = 1.8
26+
__walkDist = 0.0
27+
makeStepSound = True
2528

2629
def __init__(self, level):
2730
self._level = level
@@ -107,6 +110,8 @@ def isFree(self, xa, ya, za):
107110
return False if len(self._level.getCubes(aABB)) > 0 else not self._level.containsAnyLiquid(aABB)
108111

109112
def move(self, xa, ya, za):
113+
xOrg = self.x
114+
zOrg = self.z
110115
xaOrg = xa
111116
yaOrg = ya
112117
zaOrg = za
@@ -141,6 +146,19 @@ def move(self, xa, ya, za):
141146
self.y = self.bb.y0 + self.heightOffset
142147
self.z = (self.bb.z0 + self.bb.z1) / 2.0
143148

149+
f13 = self.x - xOrg
150+
f1 = self.z - zOrg
151+
self.__walkDist = float(self.__walkDist + math.sqrt(f13 * f13 + f1 * f1) * 0.6)
152+
if self.makeStepSound:
153+
tile = self._level.getTile(int(self.x), int(self.y - 0.2 - self.heightOffset), int(self.z))
154+
if self.__walkDist > 1.0 and tile > 0:
155+
soundType = tiles.tiles[tile].soundType
156+
if soundType != SoundType.none:
157+
self.__walkDist -= float(int(self.__walkDist))
158+
self.playSound('step.' + soundType.name,
159+
soundType.getVolume() * 0.75,
160+
soundType.getPitch())
161+
144162
def isInWater(self):
145163
return self._level.containsLiquid(self.bb.grow(0.0, -0.4, 0.0), Liquid.water)
146164

@@ -180,10 +198,30 @@ def render(self, a):
180198
def setLevel(self, level):
181199
self._level = level
182200

201+
def playSound(self, name, volume, pitch):
202+
self._level.playSound(name, self.x, self.y - self.heightOffset, self.z, volume, pitch, self)
203+
183204
def moveTo(self, x, y, z, yRot, xRot):
184205
self.xo = self.x = x
185206
self.yo = self.y = y
186207
self.zo = self.z = z
187208
self.yRot = yRot
188209
self.xRot = xRot
189210
self.setPos(x, y, z)
211+
212+
def distanceTo(self, entity):
213+
x = self.x - entity.x
214+
y = self.y - entity.y
215+
z = self.z - entity.z
216+
return math.sqrt(x * x + y * y + z * z)
217+
218+
def getDistanceSq(self, x, y, z):
219+
x -= self.x
220+
y -= self.y
221+
z = z - self.z
222+
d = math.sqrt(x * x + y * y + z * z)
223+
d = 1.0 - d / 32.0
224+
if d < 0.0:
225+
d = 0.0
226+
227+
return d

0 commit comments

Comments
 (0)