Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f6acab783 | |||
| 5d856dc66b | |||
| cf85af9a77 | |||
| 4710083a46 | |||
| 8c1f3c3bf5 | |||
| 3598ef42db | |||
| 3f0d905503 | |||
| c6c483b639 | |||
| f891d44951 | |||
| f8e839f1d9 | |||
| 1b9f443d76 | |||
| 1487b76348 | |||
| d1c347352d | |||
| cb972cbd06 | |||
| f08e5e4eca | |||
| 9c4688575c | |||
| 9589d99610 |
24
.github/workflows/gdmc.yml
vendored
Normal file
24
.github/workflows/gdmc.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Linux arm64
|
||||
run-name: Run genaration
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Pip
|
||||
run: |
|
||||
apt update
|
||||
apt install python3-virtualenv libgl1-mesa-glx -y
|
||||
virtualenv --python=python3 pythonenv
|
||||
source pythonenv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
source pythonenv/bin/activate
|
||||
python3 main.py
|
||||
3
House.py
3
House.py
@@ -2,6 +2,7 @@ from time import sleep
|
||||
from gdpc import Editor, Block, geometry
|
||||
import numpy as np
|
||||
import math
|
||||
import config
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
@@ -1250,7 +1251,7 @@ class House:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
buildArea = editor.getBuildArea()
|
||||
coordinates_min = [min(buildArea.begin[i], buildArea.last[i])
|
||||
for i in range(3)]
|
||||
|
||||
2
config.py
Normal file
2
config.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def getHost():
|
||||
return "http://gdmc.ale-pri.com:9000"
|
||||
3
main.py
3
main.py
@@ -24,6 +24,7 @@ from buildings.Building import Building
|
||||
from utils.functions import *
|
||||
from utils.Enums import DIRECTION
|
||||
import time
|
||||
import config
|
||||
|
||||
|
||||
def main():
|
||||
@@ -32,7 +33,7 @@ def main():
|
||||
rectangle_house_mountain, rectangle_building, skeleton_highway, skeleton_mountain, road_grid = world_maker()
|
||||
time_world_maker = time.time() - start_time
|
||||
print(f"[TIME] World_maker {time_world_maker}")
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
buildArea = editor.getBuildArea()
|
||||
origin = ((buildArea.begin).x, (buildArea.begin).z)
|
||||
center = (abs(buildArea.begin.x - buildArea.end.x) / 2,
|
||||
|
||||
12
main69.py
Normal file
12
main69.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from gdpc import Editor, Block, geometry
|
||||
|
||||
editor = Editor(host="http://gdmc.ale-pri.com:9000", buffering=True)
|
||||
|
||||
# Get a block
|
||||
block = editor.getBlock((0,48,0))
|
||||
|
||||
# Place a block
|
||||
editor.placeBlock((0,80,0), Block("stone"))
|
||||
|
||||
# Build a cube
|
||||
geometry.placeCuboid(editor, (0,80,2), (2,82,4), Block("oak_planks"))
|
||||
@@ -5,6 +5,7 @@ from skan.csr import skeleton_to_csgraph
|
||||
from collections import Counter
|
||||
from PIL import Image
|
||||
import random
|
||||
import config
|
||||
|
||||
from gdpc import Editor
|
||||
|
||||
@@ -141,7 +142,7 @@ class Skeleton:
|
||||
Returns:
|
||||
image: 2D path of the skeleton on top of the heightmap.
|
||||
"""
|
||||
editor = Editor()
|
||||
editor = Editor(host=config.getHost())
|
||||
|
||||
buildArea = editor.getBuildArea()
|
||||
buildRect = buildArea.toRect()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ from gdpc import Block as place
|
||||
import numpy as np
|
||||
import networks.legacy_roads.maths as maths
|
||||
import math
|
||||
import config
|
||||
|
||||
import networks.legacy_roads.tools as tools
|
||||
|
||||
@@ -506,7 +507,7 @@ def irlToMc(coordinates):
|
||||
|
||||
heightmap = Image.open('./world_maker/data/heightmap.png')
|
||||
|
||||
editor = Editor()
|
||||
editor = Editor(host=config.getHost())
|
||||
buildArea = editor.getBuildArea()
|
||||
xMin = (editor.getBuildArea().begin).x
|
||||
yMin = (editor.getBuildArea().begin).y
|
||||
@@ -549,7 +550,7 @@ def setRoads(skeleton):
|
||||
for i in range(len(housesCoordinates)):
|
||||
pos = housesCoordinates[i]
|
||||
# print(pos, "pos0")
|
||||
editor = Editor()
|
||||
editor = Editor(host=config.getHost())
|
||||
xMin = (editor.getBuildArea().begin).x
|
||||
yMin = (editor.getBuildArea().begin).y
|
||||
zMin = (editor.getBuildArea().begin).z
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from gdpc import Block as place
|
||||
from gdpc import Editor
|
||||
import config
|
||||
import networks.legacy_roads.maths as maths
|
||||
|
||||
|
||||
USE_BATCHING = True
|
||||
editor = Editor(buffering=True, caching=True, multithreading=True)
|
||||
editor = Editor(host= config.getHost(), buffering=True, caching=True, multithreading=True)
|
||||
|
||||
|
||||
def setBlock(block, xyz):
|
||||
|
||||
@@ -4,6 +4,7 @@ import networks.roads.lanes.Lane as Lane
|
||||
import networks.roads.lines.Line as Line
|
||||
import json
|
||||
import random
|
||||
import config
|
||||
|
||||
from gdpc import Editor, Block, geometry
|
||||
|
||||
@@ -15,7 +16,7 @@ class Road:
|
||||
self.width = 10 # TODO
|
||||
|
||||
def place_roads(self):
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
|
||||
self.resolution, self.distance = curve_tools.resolution_distance(
|
||||
self.coordinates, 12)
|
||||
|
||||
@@ -12,6 +12,7 @@ from gdpc import Block, Editor, geometry
|
||||
from scipy.ndimage import gaussian_filter1d
|
||||
import numpy as np
|
||||
import random
|
||||
import config
|
||||
|
||||
from PIL import Image
|
||||
|
||||
@@ -279,7 +280,7 @@ class Road:
|
||||
self.segment_total_line_output[i].x, reference[self.segment_total_line_output[i].nearest(Point3D.to_2d(reference, 'y'), True)[0]].y, self.segment_total_line_output[i].y), Block("black_concrete")))
|
||||
|
||||
def place(self):
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
for i in range(len(self.output_block)):
|
||||
editor.placeBlock(self.output_block[i][0],
|
||||
self.output_block[i][1])
|
||||
|
||||
@@ -196,7 +196,7 @@ class Skeleton:
|
||||
image: 2D path of the skeleton on top of the heightmap.
|
||||
"""
|
||||
print("[Skeleton] Start mapping the skeleton...")
|
||||
# editor = Editor()
|
||||
# editor = Editor(config)
|
||||
|
||||
# buildArea = editor.getBuildArea()
|
||||
# buildRect = buildArea.toRect()
|
||||
|
||||
@@ -2,6 +2,7 @@ from gdpc import Editor, geometry, lookup
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
from world_maker.Block import Block
|
||||
import config
|
||||
|
||||
waterBiomes = [
|
||||
"minecraft:ocean",
|
||||
@@ -26,7 +27,7 @@ waterBlocks = [
|
||||
class World:
|
||||
def __init__(self):
|
||||
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
buildArea = editor.getBuildArea()
|
||||
|
||||
self.coordinates_min = [
|
||||
@@ -72,7 +73,7 @@ class World:
|
||||
Use already created volume to get block data.
|
||||
"""
|
||||
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
if self.volume[coordinates[0] - self.coordinates_min[0]][coordinates[1] - self.coordinates_min[1]][
|
||||
coordinates[2] - self.coordinates_min[2]] == None:
|
||||
self.volume[coordinates[0] - self.coordinates_min[0]][coordinates[1] - self.coordinates_min[1]][
|
||||
@@ -99,7 +100,7 @@ class World:
|
||||
Scan the world with no optimization. Not tested on large areas.
|
||||
"""
|
||||
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
|
||||
for x in range(self.coordinates_min[0], self.coordinates_max[0] + 1):
|
||||
for y in range(self.coordinates_min[1], self.coordinates_max[1] + 1):
|
||||
@@ -112,7 +113,7 @@ class World:
|
||||
Generate all needed datas for the generator : heightmap, watermap, and preset the volume with data from the heightmap.
|
||||
"""
|
||||
|
||||
editor = Editor()
|
||||
editor = Editor(host=config.getHost())
|
||||
buildArea = editor.getBuildArea()
|
||||
buildRect = buildArea.toRect()
|
||||
|
||||
@@ -179,7 +180,7 @@ class World:
|
||||
|
||||
def propagate(self, coordinates, scanned=[]):
|
||||
i = 0
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
if self.isInVolume(coordinates):
|
||||
Block = self.getBlockFromCoordinates(coordinates)
|
||||
self.getNeighbors(Block)
|
||||
@@ -212,7 +213,7 @@ class World:
|
||||
Args:
|
||||
mask (image): white or black image : combined watermap smoothed and sobel smoothed.
|
||||
"""
|
||||
editor = Editor()
|
||||
editor = Editor(host=config.getHost())
|
||||
buildArea = editor.getBuildArea()
|
||||
buildRect = buildArea.toRect()
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@ from gdpc import Editor, Block, geometry, lookup
|
||||
from PIL import Image as img
|
||||
from PIL.Image import Image
|
||||
from skimage import morphology
|
||||
import config
|
||||
|
||||
from world_maker.data_analysis import handle_import_image
|
||||
|
||||
|
||||
def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask: Union[str, Image]):
|
||||
print("[Remove tree] Starting...")
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
build_area = editor.getBuildArea()
|
||||
build_rectangle = build_area.toRect()
|
||||
|
||||
@@ -44,7 +45,7 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask
|
||||
def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Image], mask: Union[str, Image]):
|
||||
|
||||
print("[Smooth terrain] Starting...")
|
||||
editor = Editor(buffering=True)
|
||||
editor = Editor(host=config.getHost(), buffering=True)
|
||||
build_area = editor.getBuildArea()
|
||||
build_rectangle = build_area.toRect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user