merge wall #1

Open
Steev wants to merge 2 commits from wall into main
12 changed files with 220 additions and 2 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.11 (pythonProject)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
</modules>
</component>
</project>

10
.idea/pythonProject.iml generated Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,2 +0,0 @@
# pyblock-exporer

22
WallWithDoor.py Normal file
View File

@ -0,0 +1,22 @@
from pyblockworld import World
from wall import Wall
class WallWithDoor(Wall):
__windowBlock:str
def __init__(self, x:float, y:float, z:float, block:str, window:str, world:World, width:int=10, height:int=5, rotated:bool=False):
super().__init__(x, y, z, block, world, width, height, rotated)
self.__windowBlock = window
def build(self):
super().build()
x = super().getX()
y = super().getY() + 2
z = super().getZ() / 2
super().getWorld().setBlocks(
x,
y,
z,
x,
y + 2,
z,
self.__windowBlock)

37
WallWithWindow.py Normal file
View File

@ -0,0 +1,37 @@
from pyblockworld import World
from wall import Wall
class WallWithWindow(Wall):
__windowBlock:str
def __init__(self, x:float, y:float, z:float, block:str, window:str, world:World, width:int=10, height:int=5):
super().__init__(x, y, z, block, world, width, height)
self.__windowBlock = window
def build(self):
super().build()
if super().getLength() < 6:
x = super().getX()
y = super().getY() + 2
z = super().getZ() + 2
super().getWorld().setBlocks(
x,
y,
z,
x,
y + 1,
z + 2,
self.__windowBlock)
else:
x = super().getX()
y = super().getY() + 2
z = super().getZ() + 3
super().getWorld().setBlocks(
x,
y,
z,
x,
y + (super().getHeight()-4),
z + (super().getLength()-(super().getLength()/2)),
self.__windowBlock)

28
main.py Normal file
View File

@ -0,0 +1,28 @@
from pyblockworld import World
import WallWithDoor
import wall
import WallWithWindow
import roof
# Nun werden beim Drücken der Taste ein paar Blöcke platziert.
def b_key_pressed(world: World):
x, y, z = world.player_position()
wall1 = wall.Wall(x=x, y=y, z=z, world=world, block="default:brick")
wall2 = wall.Wall(x=x, y=y, z=z, world=world, rotated=True, block="default:brick")
wall3 = WallWithWindow.WallWithWindow(x=x+10, y=y, z=z, block="default:brick", window="default:grass", world=world)
roof1 = roof.Roof(x, y + 5, z, "default:brick", world)
print("wall1 constructed")
wall1.build()
print("wall2 constructed")
wall2.build()
print("wall3 constructed")
wall3.build()
print("wall4 constructed")
roof1.build()
world = World()
world.build_key_pressed = b_key_pressed
world.run()

37
roof.py Normal file
View File

@ -0,0 +1,37 @@
from pyblockworld import World
class Roof:
__width:int
__height:int
__x:float
__y:float
__z:float
__world:World
__block:str
def __init__(self, x:float, y:float, z:float, block:str, world:World, height=10, width=10):
self.__x = x
self.__y = y
self.__z = z
self.__width = width
self.__height = height
self.__world = world
self.__block = block
def build(self):
self.__world.setBlocks(self.__x, self.__y, self.__z, self.__x + self.__width, self.__y, self.__z + self.__height, self.__block)
def getWidth(self):
return self.__width
def getHeight(self):
return self.__height
def getX(self):
return self.__x
def getY(self):
return self.__y
def getZ(self):
return self.__z

51
wall.py Normal file
View File

@ -0,0 +1,51 @@
from pyblockworld import World
class Wall:
__length:int
__width:int
__height:int
__rotated:bool
__x:float
__y:float
__z:float
__world:World
__block:str
def __init__(self, x:float, y:float, z:float, block:str, world:World, length=10, width=10, height=5, rotated=False):
self.__width = width
self.__length = length
self.__height = height
self.__x = x
self.__y = y - 1
self.__z = z
self.__world = world
self.__rotated = rotated
self.__block = block
def build(self):
if self.__rotated:
self.__world.setBlocks(self.__x, self.__y, self.__z, self.__x + self.__width, self.__y + self.__height, self.__z, self.__block)
else:
self.__world.setBlocks(self.__x, self.__y, self.__z, self.__x, self.__y + self.__height, self.__z + self.__length, self.__block)
def getWidth(self):
return self.__width
def getHeight(self):
return self.__height
def getLength(self):
return self.__length
def getWorld(self):
return self.__world
def getX(self):
return self.__x
def getY(self):
return self.__y
def getZ(self):
return self.__z
def getRotated(self):
return self.__rotated