This commit is contained in:
bvn13 2024-12-08 00:58:04 +03:00
parent d6a06aa697
commit fecc16731f
7 changed files with 60 additions and 13 deletions

3
.gitignore vendored
View File

@ -103,3 +103,6 @@ __pycache__/
# miney # miney
tmp tmp
Minetest Minetest
samples/
samples/**

View File

@ -0,0 +1,12 @@
from miney.minetest import Minetest
mt = Minetest(server='bvn13.me', port=29999, playername='bvn13')
print("Connected to", mt)
for tool_type in mt.tool:
print(tool_type)
for type in mt.node.type:
print(type)

View File

@ -1,7 +1,7 @@
from miney.minetest import Minetest from miney.minetest import Minetest
mt = Minetest(server='127.0.0.1', port=29999, playername='bvn13') mt = Minetest(server='bvn13.me', port=29999, playername='bvn13')
print("Connected to", mt) print("Connected to", mt)

View File

@ -1,8 +0,0 @@
"""
This example shows a simple chatbot, that listens on commands but also on any messages.
"""
from miney import Minetest
mt = Minetest()

View File

@ -0,0 +1,44 @@
from miney.minetest import Minetest
def build_it(mt, px, py, pz, name):
mt.node.set(nodes={
"x": px,
"y": py,
"z": pz
}, name=name)
def build_tree(mt, px, py, pz):
print("Building tree")
for i in range(0, 10):
build_it(mt, px, py + i, pz, "mcl_trees:stripped_oak")
print("Trunk is done")
print("Building leaves")
for i in range(3, 11):
print(f"Building leaves at {i}")
volume = 12 - i
for x in range(int(-volume / 2 - 1), int(volume / 2 + 1)):
for z in range(int(-volume / 2 - 1), int(volume / 2 + 1)):
if not (x == 0 and z == 0):
build_it(mt, px + x, py + i, pz + z, "mcl_trees:leaves_dark_oak")
print("Leaves are done")
def main():
mt = Minetest(server='bvn13.me', port=29999, playername='bvn13')
print("Connected to", mt)
players = mt.player
if len(players):
for player in players:
if player.name == 'bvn13':
pp = player.position
px = pp["x"]
py = pp["y"]
pz = pp["z"]
build_tree(mt, px + 1, py, pz + 1)
else:
raise Exception("There is no player with name bvn13 on server")
main()

View File

@ -1,4 +0,0 @@
import miney
mt = miney.Minetest