Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/XenonLab-Studio/TerraCraft
/ functions
Functions
129 in github.com/XenonLab-Studio/TerraCraft
⨍
Functions
129
◇
Types & classes
16
↓ 37 callers
Method
add_block
Add a block with the given `texture` and `position` to the world. Parameters ---------- position : tuple of len 3
game/world.py:319
↓ 19 callers
Function
_tex_coords
Return a list of the texture squares for the top, bottom and side.
game/blocks.py:45
↓ 9 callers
Method
get
(self, item, default)
game/savemanager.py:115
↓ 8 callers
Function
grad3
(hash, x, y, z)
libs/perlin.py:326
↓ 7 callers
Function
lerp
(t, a, b)
libs/perlin.py:322
↓ 7 callers
Function
sectorize
Returns a tuple representing the sector for the given `position` :param position: tuple of len 3 :return: tuple of len 3 representing the sec
game/utilities.py:63
↓ 6 callers
Method
_enqueue
Add `func` to the internal queue.
game/world.py:519
↓ 6 callers
Method
timestamp_print
(txt)
game/savemanager.py:63
↓ 5 callers
Method
_create_plus
(self, chunk, x, y, z, block)
game/genworld.py:306
↓ 5 callers
Method
change_scene
Change to a specific Scene, by it's class name. When changing to a new Scene, any Window event handlers that are defined on the new S
game/scenemanager.py:68
↓ 5 callers
Method
empty
Returns True if given `position` does not contain block. If `must_be_loaded` is True, this returns False if the block is not yet loaded.
game/world.py:296
↓ 5 callers
Method
set_exclusive_mouse
If `exclusive` is True, the game will capture the mouse, if False the game will ignore the mouse.
game/scenes.py:283
↓ 4 callers
Method
_iter_xz
Iterate all the xz block positions from a sector
game/genworld.py:159
↓ 3 callers
Function
_tex_coord
Return the bounding vertices of the texture square.
game/blocks.py:35
↓ 3 callers
Method
add_scene
Add a Scene instance to the manager. :param scene_instance: An instace of a `Scene`.
game/scenemanager.py:61
↓ 3 callers
Method
contains_y_range
True if the horizontal plan between `ymin` and `ymax` is inside this sector.
game/world.py:96
↓ 3 callers
Method
noise3
Generate a noise 3D.
game/noise.py:80
↓ 3 callers
Method
play
Play a sound effect on the next available channel :param source: A pyglet audio Source :param position: Optional spacial position for
game/scenes.py:68
↓ 3 callers
Method
randomize
Randomize the permutation table used by the noise functions. This makes them generate a different noise pattern for the same inputs.
libs/perlin.py:113
↓ 2 callers
Method
_create_box
(self, chunk, x, y, z, block)
game/genworld.py:313
↓ 2 callers
Method
_dequeue
Pop the top function from the internal queue and call it.
game/world.py:525
↓ 2 callers
Method
_get_biome
(self, x, z)
game/genworld.py:237
↓ 2 callers
Method
_highlight_save_slot
(self)
game/scenes.py:149
↓ 2 callers
Method
check_face_full
(self, face)
game/world.py:146
↓ 2 callers
Method
check_neighbors
Check all blocks surrounding `position` and ensure their visual state is current. This means hiding blocks that are not exposed and e
game/world.py:199
↓ 2 callers
Method
contains_y
True if the horizontal plan `y` is inside this sector.
game/world.py:92
↓ 2 callers
Function
cube_vertices
Return the vertices of the Block at position x, y, z with size 2*n. :param x: int or float of the Block's x position :param y: int or float of
game/utilities.py:37
↓ 2 callers
Method
empty
Return false if there is no block at this position in this chunk
game/world.py:112
↓ 2 callers
Method
exposed
Returns False if given `position` is surrounded on all 6 sides by blocks, True otherwise.
game/world.py:190
↓ 2 callers
Method
generate
Generate a specific sector of the world and place all the blocks
game/genworld.py:176
↓ 2 callers
Method
get_block
Return a block from this position. If no blocks, None is returned.
game/world.py:385
↓ 2 callers
Method
get_sight_vector
Returns the current line of sight vector indicating the direction the player is looking.
game/scenes.py:291
↓ 2 callers
Method
has_save_game
Returns True if the save path and file exist.
game/savemanager.py:66
↓ 2 callers
Method
hit_test
Line of sight search from current position. If a block is intersected it is returned, along with the block previously in the line of
game/world.py:269
↓ 2 callers
Method
is_face_full
Check if one of the face of this section is full of blocks. The direction is a normalized vector from `FACES`.
game/world.py:80
↓ 2 callers
Function
iter_neighbors
Iterate all the positions neighboring this position
game/world.py:44
↓ 2 callers
Method
noise2
Generate a noise 2D.
game/noise.py:60
↓ 2 callers
Function
normalize
Accepts `position` of arbitrary precision clamps it. :param position: tuple of len 3 :return: tuple of ints of len 3, representing a block po
game/utilities.py:53
↓ 2 callers
Method
register_sector
Add a new sector to this world definition.
game/world.py:423
↓ 2 callers
Method
remove_block
Remove the block at the given `position`. Parameters ---------- position : tuple of len 3 The (x, y, z) position
game/world.py:345
↓ 2 callers
Method
request_sector
Compute the content of a sector asynchronously and return the result to a callback already specified to this generator.
game/genworld.py:147
↓ 1 callers
Method
_create_coconut_tree
(self, chunk, x, y, z, height)
game/genworld.py:365
↓ 1 callers
Method
_create_default_tree
(self, chunk, x, y, z, height)
game/genworld.py:318
↓ 1 callers
Method
_create_fir_tree
(self, chunk, x, y, z, height)
game/genworld.py:340
↓ 1 callers
Method
_generate_clouds
Generate clouds at this `self.y_cloud`.
game/genworld.py:386
↓ 1 callers
Method
_generate_enclosure
Generate an enclosure with unbreakable blocks on the floor and and on the side.
game/genworld.py:197
↓ 1 callers
Method
_generate_floor
Generate a standard floor at a specific height
game/genworld.py:224
↓ 1 callers
Method
_generate_random_map
(self, chunk)
game/genworld.py:245
↓ 1 callers
Method
_generate_trees
Generate trees in the map For now it do not generate trees between 2 sectors, and use rand instead of a procedural generation.
game/genworld.py:259
↓ 1 callers
Method
_generate_underworld
(self, chunk)
game/genworld.py:417
↓ 1 callers
Method
_get_stone
Returns the expected mineral at a specific location. The input location have to be already known as a stone location.
game/genworld.py:401
↓ 1 callers
Method
_iter_xyz
Iterate all the xyz block positions from a sector
game/genworld.py:167
↓ 1 callers
Method
_update
Private implementation of the `update()` method. This is where most of the motion logic lives, along with gravity and collision detection.
game/scenes.py:416
↓ 1 callers
Method
collide
Checks to see if the player at the given `position` and `height` is colliding with any blocks in the world. Parameters -----
game/scenes.py:449
↓ 1 callers
Method
contains
True if the position `pos` is inside this sector.
game/world.py:86
↓ 1 callers
Method
count_blocks
Return the number of blocks in this model
game/world.py:244
↓ 1 callers
Method
draw_focused_block
Draw black edges around the block that is currently under the crosshairs.
game/scenes.py:728
↓ 1 callers
Method
draw_label
Draw the label in the top left of the screen.
game/scenes.py:741
↓ 1 callers
Method
get_focus_block
(self)
game/scenes.py:723
↓ 1 callers
Method
get_motion_vector
Returns the current motion vector indicating the velocity of the player. Returns ------- vector : tuple of len 3
game/scenes.py:308
↓ 1 callers
Method
hide_sector
Ensure all blocks in the given sector that should be hidden are removed from the canvas.
game/world.py:494
↓ 1 callers
Method
init_player_on_summit
Make sure the sector containing the actor is loaded and the player is on top of it.
game/scenes.py:351
↓ 1 callers
Method
is_sector_visible
Check if a sector is visible. For now only check if no from a sector position.
game/world.py:479
↓ 1 callers
Method
load_world
(self, model)
game/savemanager.py:71
↓ 1 callers
Function
main
()
main.py:42
↓ 1 callers
Method
on_resize
Event handler for the Window.on_resize event. Called when the window is resized to a new `width` and `height`.
game/scenes.py:694
↓ 1 callers
Method
on_resize
(self, width, height)
game/scenes.py:782
↓ 1 callers
Method
process_queue
Process the entire queue while taking periodic breaks. This allows the game loop to run smoothly. The queue contains calls to _show_b
game/world.py:532
↓ 1 callers
Method
save_world
(self, model)
game/savemanager.py:92
↓ 1 callers
Method
set_callback
Set a callback called when a new sector is computed
game/genworld.py:143
↓ 1 callers
Function
setup_fog
Configure the OpenGL fog properties.
game/graphics.py:41
↓ 1 callers
Function
setup_opengl
Basic OpenGL configuration.
game/graphics.py:60
↓ 1 callers
Method
show_only_sectors
Update the shown sectors. Show the ones which are not part of the list, and hide the others.
game/world.py:504
↓ 1 callers
Method
show_sector
Ensure all blocks in the given sector that should be shown are drawn to the canvas.
game/world.py:458
↓ 1 callers
Method
update_shown_sectors
Update shown sectors according to the actual frustum. A sector is a contiguous x, y sub-region of world. Sectors are used to speed up
game/scenes.py:514
Method
__eq__
(self, other)
game/graphics.py:129
Method
__getitem__
(self, item)
game/savemanager.py:109
Method
__hash__
(self)
game/graphics.py:126
Method
__init__
A class for Blocks :param name: The name of the Block material. :param tex_coords: The texture coordinates for this material.
game/blocks.py:62
Method
__init__
(self, position)
game/world.py:59
Method
__init__
(self, batch, group)
game/world.py:217
Method
__init__
(self, frequency=1.0, octaves=1, lacunarity=2.0, persistence=0.5)
game/noise.py:51
Method
__init__
(self)
game/genworld.py:47
Method
__init__
(self, window)
game/scenemanager.py:41
Method
__init__
(self, window, texture, order=0)
game/graphics.py:87
Method
__init__
SaveManager handles saving/loading of worlds and options. An internal dictionary (self._data) holds persistent data such as options,
game/savemanager.py:43
Method
__init__
(self, channels=5)
game/scenes.py:54
Method
__init__
(self, window)
game/scenes.py:113
Method
__init__
(self, window)
game/scenes.py:192
Method
__init__
(self, window)
game/scenes.py:756
Method
__init__
Initialize the noise generator. With no arguments, the default period and permutation table are used (256). The default permutation ta
libs/perlin.py:71
Method
__repr__
(self)
game/graphics.py:135
Method
__setitem__
(self, key, item)
game/savemanager.py:112
Method
add_block
Add a block to this chunk only if the `position` is part of this chunk.
game/world.py:120
Method
add_terrain_map
Add a new entry to the height map lookup table. `height` will be the height at this part of the height map. and `terrains
game/genworld.py:101
Method
blocks_from_face
Iterate all blocks from a face
game/world.py:101
Method
exposed
Returns False if given `position` is surrounded on all 6 sides by blocks, True otherwise.
game/world.py:307
Method
generator
(self)
game/world.py:249
Method
get_biome
Return the biome at a location of the map plus the first empty place.
game/genworld.py:268
Method
get_block
Return the block stored at this position of this sector. Else None.
game/world.py:116
next →
1–100 of 129, ranked by callers