Skip to content

Commit b6d41bb

Browse files
0.31 20100125 (0.31.20100125)
1 parent 019c4cc commit b6d41bb

39 files changed

+416
-139
lines changed

Makefile

+1-1
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.31.20100124.post2.tar.gz
15+
pip install dist/minecraft-python-0.31.20100125.tar.gz
1616

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

README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
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

77
The project is currently working on the Indev versions of Minecraft.
8-
The latest version is **Indev 0.31 20100124-2** as released on _**January 24, 2010**_.
8+
The latest version is **Indev 0.31 20100125** as released on _**January 25, 2010**_.
99

10-
This version has the Indev mossy cobblestone spawn house which contains chests with all of the items available in this version.
11-
It also has level file saving, the bow and arrow, advanced liquid spread, and powerful TNT explosion blasts.
10+
This version adds torch, fire, and lava blob particles to the game.
11+
Features from previous Indev versions include the Indev mossy cobblestone spawn house which contains chests
12+
with all of the items available in this version, NBT level file saving,
13+
tools including flint and steel and the bow and arrow, torches, advanced liquid spread, TNT explosives, and the MD3 Rana mobs.
1214

13-
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.31.20100124-2`.
15+
To easily install this version of *Minecraft: Python Edition*, just run `python -m pip install minecraft-python==0.31.20100125`.
1416

15-
You can learn more about this version [on the Minecraft wiki.](https://minecraft.wiki/w/Java_Edition_Indev_0.31_20100124-2)
17+
You can learn more about this version [on the Minecraft wiki.](https://minecraft.wiki/w/Java_Edition_Indev_0.31_20100125)
1618

1719
### Organization
1820

@@ -48,11 +50,11 @@ You can specify the world theme as *Normal* or *Hell* (lava and dirt instead of
4850

4951
Levels can be saved to a single *.mclevel* NBT file in the pause menu. The level files are perfectly compatible with Java and vice versa.
5052

51-
The only mobs around are the MD3 Ranas, but they don't drop anything when killed. Apples will restore health.
53+
The only mobs around are the Ranas, but they don't drop anything when killed. Apples will restore health.
5254

5355
![Isometric screenshot](/map.png?raw=true)
5456

55-
*An isometric screenshot of a small and long Inland map generated by the game.*
57+
*An isometric screenshot of a Hell map generated by the game.*
5658

5759
### Additional Notes
5860

map.png

-2.59 MB
Loading

mc/JavaUtils.pxd

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ cimport cython
44

55
cpdef unsigned long long getMillis()
66
cdef double signum(double val)
7+
cdef unsigned int floatToRawIntBits(float x)
78

89
cdef class Random:
910

@@ -82,7 +83,7 @@ cdef class IntBuffer(Buffer):
8283
object __dataPtr
8384

8485
cpdef inline put(self, int value)
85-
cdef putInts(self, int* src, int offset, int length)
86+
cdef putInts(self, int[:] src, int offset, int length)
8687
cpdef inline int get(self)
8788
cpdef inline int getAt(self, int idx)
8889
cdef inline __getDataPtr(self)

mc/JavaUtils.pyx

+10-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ cpdef unsigned long long getMillis():
2020
cdef double signum(double val):
2121
return (0 < val) - (val < 0)
2222

23+
cdef unsigned int floatToRawIntBits(float x):
24+
cdef unsigned int y = 0
25+
memcpy(&y, &x, 4)
26+
return y
27+
2328
cdef class Random:
2429

2530
def __init__(self):
@@ -398,7 +403,7 @@ cdef class IntBuffer(Buffer):
398403
self[self.nextPutIndex()] = value
399404
return self
400405

401-
cdef putInts(self, int* src, int offset, int length):
406+
cdef putInts(self, int[:] src, int offset, int length):
402407
cdef int i, rem
403408

404409
assert self.checkBounds(offset, length, length)
@@ -408,8 +413,7 @@ cdef class IntBuffer(Buffer):
408413
raise Exception
409414

410415
cdef int[:] dest = self.__array[self._position + offset:self._position + offset + length]
411-
for i in range(length):
412-
dest[i] = src[i]
416+
dest[:length] = src[:length]
413417

414418
self._position += length
415419

@@ -433,6 +437,9 @@ cdef class IntBuffer(Buffer):
433437
def glDrawElements(self, int mode, int count, int type):
434438
gl.glDrawElements(mode, count, type, self.__getDataPtr())
435439

440+
def glInterleavedArrays(self, int format, int stride):
441+
gl.glInterleavedArrays(format, stride, self.__getDataPtr())
442+
436443
cdef class FloatBuffer(Buffer):
437444

438445
def __init__(self, capacity):
@@ -547,9 +554,6 @@ cdef class FloatBuffer(Buffer):
547554
def glTexCoordPointer(self, int size, int type, int stride):
548555
gl.glTexCoordPointer(size, type, stride, self.__getDataPtr())
549556

550-
def glInterleavedArrays(self, int format, int stride):
551-
gl.glInterleavedArrays(format, stride, self.__getDataPtr())
552-
553557
def glMultMatrix(self):
554558
gl.glMultMatrixf(self.__getDataPtr())
555559

mc/Resources.py

+1-1
Large diffs are not rendered by default.

mc/net/minecraft/client/Minecraft.py

+3
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ def __runTick(self):
585585
self.renderGlobal.updateClouds()
586586
self.theWorld.updateEntities()
587587
self.theWorld.tick()
588+
self.theWorld.randomDisplayUpdates(int(self.thePlayer.posX),
589+
int(self.thePlayer.posY),
590+
int(self.thePlayer.posZ))
588591
self.effectRenderer.updateEffects()
589592

590593
def generateLevel(self, size, shape, levelType, theme):

mc/net/minecraft/client/controller/PlayerControllerSP.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ def __init__(self, mc):
2121
blocks.stone, blocks.grass, blocks.cobblestone, blocks.planks, blocks.sapling,
2222
blocks.bedrock, blocks.sand, blocks.gravel, blocks.oreGold, blocks.oreIron,
2323
blocks.oreCoal, blocks.wood, blocks.leaves, blocks.sponge, blocks.glass,
24-
blocks.clothRed, blocks.clothOrange, blocks.clothYellow, blocks.clothChartreuse,
25-
blocks.clothGreen, blocks.clothSpringGreen, blocks.clothCyan, blocks.clothCapri,
26-
blocks.clothUltramarine, blocks.clothViolet, blocks.clothPurple, blocks.clothMagenta,
27-
blocks.clothRose, blocks.clothDarkGray, blocks.clothGray, blocks.clothWhite,
2824
blocks.plantYellow, blocks.plantRed, blocks.mushroomBrown, blocks.mushroomRed,
2925
blocks.blockGold, blocks.blockSteel, blocks.stairSingle, blocks.brick, blocks.tnt,
3026
blocks.bookShelf, blocks.cobblestoneMossy, blocks.obsidian, blocks.torch,
3127
blocks.waterSource, blocks.lavaSource, blocks.chest
3228
)
29+
self.__woolChestArray = (
30+
blocks.clothRed, blocks.clothOrange, blocks.clothYellow,
31+
blocks.clothChartreuse, blocks.clothGreen, blocks.clothSpringGreen,
32+
blocks.clothCyan, blocks.clothCapri, blocks.clothUltramarine,
33+
blocks.clothViolet, blocks.clothPurple, blocks.clothMagenta,
34+
blocks.clothRose, blocks.clothDarkGray, blocks.clothGray, blocks.clothWhite
35+
)
3336

3437
def openInventory(self):
3538
self._mc.displayGuiScreen(GuiInventory(self._mc.thePlayer.inventory))
@@ -63,6 +66,8 @@ def flipPlayer(self, player):
6366
tntChest1 = self._mc.theWorld.getBlockTileEntity(x - 1, y - 1, z + 2)
6467
self._mc.theWorld.setBlockWithNotify(x, y - 1, z + 2, blocks.chest.blockID)
6568
tntChest2 = self._mc.theWorld.getBlockTileEntity(x, y - 1, z + 2)
69+
self._mc.theWorld.setBlockWithNotify(x + 2, y - 1, z + 1, blocks.chest.blockID)
70+
woolChest = self._mc.theWorld.getBlockTileEntity(x + 2, y - 1, z + 1)
6671
slot = 0
6772
for i in range(256, 1024):
6873
if items.itemsList[i]:
@@ -86,6 +91,13 @@ def flipPlayer(self, player):
8691
else:
8792
blocksChest1.setInventorySlotContents(slot, stack)
8893

94+
for slot in range(min(len(self.__woolChestArray), 54)):
95+
stack = ItemStack(
96+
self.__woolChestArray[slot],
97+
items.itemsList[self.__woolChestArray[slot].blockID].getItemStackLimit()
98+
)
99+
woolChest.setInventorySlotContents(slot, stack)
100+
89101
def sendBlockRemoved(self, x, y, z):
90102
block = self._mc.theWorld.getBlockId(x, y, z)
91103
change = super().sendBlockRemoved(x, y, z)

mc/net/minecraft/client/effect/EntityBubbleFX.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ def __init__(self, world, x, y, z, xr, yr, zr):
1111
self._particleBlue = 1.0
1212
self._particleTextureIndex = 32
1313
self.setSize(0.02, 0.02)
14+
self._particleScale *= self._rand.nextFloat() * 0.6 + 0.2
1415
self._motionX1 = xr * 0.2 + (random() * 2.0 - 1.0) * 0.02
1516
self._motionY1 = yr * 0.2 + (random() * 2.0 - 1.0) * 0.02
1617
self._motionZ1 = zr * 0.2 + (random() * 2.0 - 1.0) * 0.02
1718
self._particleMaxAge = int(8.0 / (random() * 0.8 + 0.2))
1819

19-
def renderParticle(self, t, a, xa, ya, za, xa2, ya2):
20-
super().renderParticle(t, a, xa, ya, za, xa2, ya2)
21-
2220
def onEntityUpdate(self):
2321
self.prevPosX = self.posX
2422
self.prevPosY = self.posY

mc/net/minecraft/client/effect/EntityDiggingFX.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def __init__(self, world, x, y, z, xr, yr, zr, block):
77
self._particleTextureIndex = block.blockIndexInTexture
88
self._particleGravity = block.blockParticleGravity
99
self._particleRed = self._particleGreen = self._particleBlue = 0.6
10+
self._particleScale /= 2.0
1011

1112
def getFXLayer(self):
1213
return 1
@@ -20,7 +21,7 @@ def renderParticle(self, t, a, xa, ya, za, xa2, ya2):
2021
x = self.prevPosX + (self.posX - self.prevPosX) * a
2122
y = self.prevPosY + (self.posY - self.prevPosY) * a
2223
z = self.prevPosZ + (self.posZ - self.prevPosZ) * a
23-
br = self.getBrightness()
24+
br = self.getBrightness(a)
2425
t.setColorOpaque_F(br * self._particleRed, br * self._particleGreen, br * self._particleBlue)
2526
t.addVertexWithUV(x - xa * r - xa2 * r, y - ya * r, z - za * r - ya2 * r, u0, v1)
2627
t.addVertexWithUV(x - xa * r + xa2 * r, y + ya * r, z - za * r + ya2 * r, u0, v0)

mc/net/minecraft/client/effect/EntityExplodeFX.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from mc.net.minecraft.client.effect.EntityFX import EntityFX
2-
from mc.JavaUtils import Random, random
2+
from mc.JavaUtils import random
33

44
class EntityExplodeFX(EntityFX):
55

mc/net/minecraft/client/effect/EntityFX.pyx

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cdef class EntityFX(Entity):
3232
self._particleTextureJitterX = self._rand.nextFloat() * 3.0
3333
self._particleTextureJitterY = self._rand.nextFloat() * 3.0
3434

35-
self._particleScale = self._rand.nextFloat() * 0.5 + 0.5
35+
self._particleScale = (self._rand.nextFloat() * 0.5 + 0.5) * 2.0
3636

3737
self._particleMaxAge = <int>(4 // (self._rand.nextFloat() * 0.9 + 0.1))
3838
self._particleAge = 0
@@ -83,10 +83,9 @@ cdef class EntityFX(Entity):
8383
y = self.prevPosY + (self.posY - self.prevPosY) * a
8484
z = self.prevPosZ + (self.posZ - self.prevPosZ) * a
8585

86-
br = self.getBrightness()
86+
br = self.getBrightness(a)
8787
t.setColorOpaque_F(self._particleRed * br, self._particleGreen * br,
8888
self._particleBlue * br)
89-
9089
t.addVertexWithUV(x - xa * r - xa2 * r, y - ya * r,
9190
z - za * r - ya2 * r, u0, v1)
9291
t.addVertexWithUV(x - xa * r + xa2 * r, y + ya * r,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from mc.net.minecraft.client.effect.EntityFX import EntityFX
2+
from mc.JavaUtils import random
3+
4+
class EntityFlameFX(EntityFX):
5+
6+
def __init__(self, world, x, y, z):
7+
super().__init__(world, x, y, z, 0.0, 0.0, 0.0)
8+
self._motionX1 *= 0.01
9+
self._motionY1 *= 0.01
10+
self._motionZ1 *= 0.01
11+
self._rand.nextFloat()
12+
self._rand.nextFloat()
13+
self._rand.nextFloat()
14+
self._rand.nextFloat()
15+
self._rand.nextFloat()
16+
self._rand.nextFloat()
17+
self.__flameScale = self._particleScale
18+
self._particleRed = self._particleGreen = self._particleBlue = 1.0
19+
self._particleMaxAge = int(8.0 / (random() * 0.8 + 0.2)) + 4
20+
self.noClip = True
21+
self._particleTextureIndex = 48
22+
23+
def renderParticle(self, t, a, xa, ya, za, xa2, ya2):
24+
age = (self._particleAge + a) / self._particleMaxAge
25+
self._particleScale = self.__flameScale * (1.0 - age * age * 0.5)
26+
super().renderParticle(t, a, xa, ya, za, xa2, ya2)
27+
28+
def getBrightness(self, a):
29+
age = min(max((self._particleAge + a) / self._particleMaxAge, 0.0), 1.0)
30+
return super().getBrightness(a) * age + (1.0 - age)
31+
32+
def onEntityUpdate(self):
33+
self.prevPosX = self.posX
34+
self.prevPosY = self.posY
35+
self.prevPosZ = self.posZ
36+
self._particleAge += 1
37+
if self._particleAge - 1 >= self._particleMaxAge:
38+
self.setEntityDead()
39+
40+
self.moveEntity(self._motionX1, self._motionY1, self._motionZ1)
41+
self._motionX1 *= 0.96
42+
self._motionY1 *= 0.96
43+
self._motionZ1 *= 0.96
44+
if self.onGround:
45+
self._motionX1 *= 0.7
46+
self._motionZ1 *= 0.7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from mc.net.minecraft.client.effect.EntityFX import EntityFX
2+
from mc.JavaUtils import random
3+
4+
class EntityLavaFX(EntityFX):
5+
6+
def __init__(self, world, x, y, z):
7+
super().__init__(world, x, y, z, 0.0, 0.0, 0.0)
8+
self._motionX1 *= 0.8
9+
self._motionY1 *= 0.8
10+
self._motionZ1 *= 0.8
11+
self._motionY1 = self._rand.nextFloat() * 0.4 + 0.05
12+
self._particleRed = self._particleGreen = self._particleBlue = 1.0
13+
self._particleScale *= self._rand.nextFloat() * 2.0 + 0.2
14+
self.__lavaScale = self._particleScale
15+
self._particleMaxAge = int(16.0 / (random() * 0.8 + 0.2))
16+
self.noClip = False
17+
self._particleTextureIndex = 49
18+
19+
def getBrightness(self, a):
20+
return 1.0
21+
22+
def renderParticle(self, t, a, xa, ya, za, xa2, ya2):
23+
age = (self._particleAge + a) / self._particleMaxAge
24+
self._particleScale = self.__lavaScale * (1.0 - age * age)
25+
super().renderParticle(t, a, xa, ya, za, xa2, ya2)
26+
27+
def onEntityUpdate(self):
28+
self.prevPosX = self.posX
29+
self.prevPosY = self.posY
30+
self.prevPosZ = self.posZ
31+
self._particleAge += 1
32+
if self._particleAge - 1 >= self._particleMaxAge:
33+
self.setEntityDead()
34+
35+
age = self._particleAge / self._particleMaxAge
36+
if self._rand.nextFloat() > age:
37+
self._worldObj.spawnParticle(
38+
'smoke', self.posX, self.posY, self.posZ,
39+
self._motionX1, self._motionY1, self._motionZ1
40+
)
41+
42+
self._motionY1 -= 0.03
43+
self.moveEntity(self._motionX1, self._motionY1, self._motionZ1)
44+
self._motionX1 *= 0.999
45+
self._motionY1 *= 0.999
46+
self._motionZ1 *= 0.999
47+
if self.onGround:
48+
self._motionX1 *= 0.7
49+
self._motionZ1 *= 0.7

mc/net/minecraft/client/effect/EntitySmokeFX.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __init__(self, world, x, y, z):
1111
self._particleRed = random() * 0.3
1212
self._particleGreen = self._particleRed
1313
self._particleBlue = self._particleRed
14+
self._particleScale *= 12.0 / 16.0
1415
self._particleMaxAge = int(8.0 / (random() * 0.8 + 0.2))
1516
self.noClip = True
1617

mc/net/minecraft/client/gui/GuiChest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ def __init__(self, upperChestInventory, lowerChestInventory):
2525
self._slotsList.append(Slot(self, upperChestInventory, row,
2626
8 + row * 18, yOffset + 161))
2727

28-
def _drawStrings(self):
28+
def _drawGuiContainerForegroundLayer(self):
2929
self._fontRenderer.drawString(self.__lowerChestInventory.getInvName(),
3030
8, 6, 4210752)
3131
self._fontRenderer.drawString(self.__upperChestInventory.getInvName(),
3232
8, self.ySize - 96 + 2, 4210752)
3333

34-
def _drawRows(self):
34+
def _drawGuiContainerBackgroundLayer(self):
3535
tex = self._mc.renderEngine.getTexture('gui/container.png')
3636
gl.glColor4f(1.0, 1.0, 1.0, 1.0)
3737
gl.glBindTexture(gl.GL_TEXTURE_2D, tex)

mc/net/minecraft/client/gui/GuiInventory.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def drawScreen(self, xm, ym):
3838
self._drawGradientRect(0, 0, self.width, self.height, 1610941696, -1607454624)
3939
w = (self.width - self.xSize) // 2
4040
h = (self.height - self.ySize) // 2
41-
self._drawRows()
41+
self._drawGuiContainerBackgroundLayer()
4242
gl.glPushMatrix()
4343
gl.glRotatef(180.0, 1.0, 0.0, 0.0)
4444
RenderHelper.enableStandardItemLighting()
@@ -86,18 +86,18 @@ def drawScreen(self, xm, ym):
8686
RenderHelper.disableStandardItemLighting()
8787
gl.glDisable(gl.GL_LIGHTING)
8888
gl.glDisable(gl.GL_DEPTH_TEST)
89-
self._drawStrings()
89+
self._drawGuiContainerForegroundLayer()
9090
gl.glEnable(gl.GL_LIGHTING)
9191
gl.glEnable(gl.GL_DEPTH_TEST)
9292
gl.glPopMatrix()
9393

94-
def _drawStrings(self):
94+
def _drawGuiContainerForegroundLayer(self):
9595
self._fontRenderer.drawString('PLAYER NAME', 84, 8, 4210752)
9696
self._fontRenderer.drawString('ATK: 100', 84, 24, 4210752)
9797
self._fontRenderer.drawString('DEF: 100', 84, 32, 4210752)
9898
self._fontRenderer.drawString('SPD: 100', 84, 40, 4210752)
9999

100-
def _drawRows(self):
100+
def _drawGuiContainerBackgroundLayer(self):
101101
tex = self._mc.renderEngine.getTexture('gui/inventory.png')
102102
gl.glColor4f(1.0, 1.0, 1.0, 1.0)
103103
gl.glBindTexture(gl.GL_TEXTURE_2D, tex)

mc/net/minecraft/client/render/EntityRenderer.py

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ def updateCameraAndRender(self, alpha):
191191
gl.glTranslatef(-((i << 1) - 1) * 0.07, 0.0, 0.0)
192192

193193
fov = 70.0
194+
if self.__mc.thePlayer.isInsideOfMaterial():
195+
fov = 60.0
196+
194197
if self.__mc.thePlayer.health <= 0:
195198
t = self.__mc.thePlayer.deathTime + alpha
196199
fov /= (1.0 - 500.0 / (t + 500.0)) * 2.0 + 1.0

0 commit comments

Comments
 (0)