0

I'm trying to make a minecraft clone in Python using Ursina but I have been stuck on one problem when removing water if a block is placed on top of it. Collisions are off for water but rest are and I've been stuck for a long time pls help! I add each block made into an list with all it's data like coords (x, y, z) and remove them from the list when they are deleted. My plan is to compare all the blocks in the list's xyz coords to all the water blocks xyz corrds and if they are the same then the water will be removed and deleted from the list. I've worked on this for a long time but the problem wont go away.

Full error message:

package_folder: C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-
packages\ursina
asset_folder: C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition
screen resolution: (1920, 1080)
Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
:display(error): The application requested harware acceleration, but your OpenGL
:display(error): driver, GDI Generic, only supports software rendering.
:display(error): You need to install a hardware-accelerated OpenGL driver, or,
:display(error): if you actually *want* to use a software renderer, then
:display(error): alter the hardware/software configuration in your Config.prc file.
:display(warning): Unable to load libtinydisplay.dll: Path not found
:display(warning): Unable to load libpandadx8.dll: Path not found
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
read obj at: C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition\assets\block.obj
read obj at: C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition\assets\arm.obj
info: development mode: True
application successfully started
info: changed aspect ratio: 1.778 -> 1.778
{'x': 0.0, 'y': 0.0, 'z': 7.0, 'position': Vec3(0, 0, 7), 'texture': grass_block.png}
{'x': 0.0, 'y': 1.0, 'z': 7.0, 'position': Vec3(0, 1, 7), 'texture': grass_block.png}
Assertion failed: !is_empty() at line 1045 of panda/src/pgraph/nodePath.cxx
Traceback (most recent call last):
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 49, in eventLoopTask
    self.doEvents()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 43, in doEvents
    processFunc(dequeueFunc())
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 99, in processEvent
    messenger.send(eventName, paramList)
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 337, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 422, in __dispatch
    result = method (*(extraArgs + sentArgs))
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 201, in input
    entity.input(key)
  File "C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition\game.py", line 189, in input
    'x': self.position.x,
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\entity.py", line 458, in position
    return Vec3(*self.getPos())
AssertionError: !is_empty() at line 1045 of panda/src/pgraph/nodePath.cxx
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition\game.py", line 525, in <module>
    app.run()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 239, in run
    super().run()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\ShowBase.py", line 3328, in run
    self.taskMgr.run()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\task\Task.py", line 553, in run
    self.step()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\task\Task.py", line 504, in step
    self.mgr.poll()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 49, in eventLoopTask
    self.doEvents()
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 43, in doEvents
    processFunc(dequeueFunc())
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 99, in processEvent
    messenger.send(eventName, paramList)
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 337, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 422, in __dispatch
    result = method (*(extraArgs + sentArgs))
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 201, in input
    entity.input(key)
  File "C:\Users\dyclo\OneDrive\Documents\VS Code Project\Minecraft Ursina Edition\game.py", line 189, in input
    'x': self.position.x,
  File "C:\Users\dyclo\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\entity.py", line 458, in position
    return Vec3(*self.getPos())
AssertionError: !is_empty() at line 1045 of panda/src/pgraph/nodePath.cxx

All my code:

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
import random


app = Ursina()


punch_sound   = Audio('assets/punch_sound',loop = False, autoplay = False)

block_pick = 1

start_chunk = 13

window.title = 'MINECRAFT: Bad Ursina Edition'
window.borderless = False
window.fullscreen = False
window.exit_button.visible = False
window.fps_counter.enabled = True

voxels = []


grass_texture = load_texture('assets/grass_block.png')
stone_texture = load_texture('assets/stone_block.png')
brick_texture = load_texture('assets/brick_block.png')
dirt_texture = load_texture('assets/dirt_block.png')
sky_texture  = load_texture('assets/skybox.png')
arm_texture  = load_texture('assets/arm_texture.png')
leaves_texture = load_texture('assets/oak_leaves.png')
log_texture = load_texture('assets/oak_log.png')
diamond_ore_texture = load_texture('assets/diamond_ore.png')
coal_ore_texture = load_texture('assets/coal_ore.png')
iron_ore_texture = load_texture('assets/iron_ore.png')
diamond_ore_block_texture = load_texture('assets/diamond_block.png')
coal_ore_block_texture = load_texture('assets/coal_block.png')
iron_ore_block_texture = load_texture('assets/iron_block.png')
oak_planks_texture = load_texture('assets/oak_planks.png')
crafting_table_texture = load_texture('assets/crafting_table.png')
cobblestone_texture = load_texture('assets/cobblestone.png')
sand_texture = load_texture('assets/sand.png')
cactus_texture = load_texture('assets/cactus.png')
water_texture = load_texture('assets/water.png')

def update():
    global block_pick
    global inventory

    if held_keys['left mouse'] or held_keys['right mouse']:
        hand.active()
    else:
        hand.passive()

    if held_keys['1'] and inventory: block_pick = 1
    if held_keys['2'] and inventory: block_pick = 2
    if held_keys['3'] and inventory: block_pick = 3
    if held_keys['4'] and inventory: block_pick = 4
    if held_keys['5'] and inventory: block_pick = 5
    if held_keys['6'] and inventory: block_pick = 6
    if held_keys['7'] and inventory: block_pick = 7
    if held_keys['8'] and inventory: block_pick = 8
    if held_keys['9'] and inventory: block_pick = 9
    if held_keys['1'] and inventory == False: block_pick = 10
    if held_keys['2'] and inventory == False: block_pick = 11
    if held_keys['3'] and inventory == False: block_pick = 12
    if held_keys['4'] and inventory == False: block_pick = 13
    if held_keys['5'] and inventory == False: block_pick = 14
    if held_keys['6'] and inventory == False: block_pick = 15
    if held_keys['7'] and inventory == False: block_pick = 16
    if held_keys['8'] and inventory == False: block_pick = 17
    if held_keys['9'] and inventory == False: block_pick = 18
    if held_keys['0'] and inventory == False: inventory = True

    if block_pick == 1: info.text = "Grass Block"

    if block_pick == 2: info.text = "Stone"

    if block_pick == 3: info.text = "Bricks"

    if block_pick == 4: info.text = "Dirt"

    if block_pick == 5: info.text = "Oak Log"

    if block_pick == 6: info.text = "Leaves"

    if block_pick == 7: info.text = "Oak Planks"

    if block_pick == 8: info.text = "Diamond Ore"
    
    if block_pick == 9: info.text = "Coal Ore"

    if block_pick == 10: info.text = "Iron Ore"

    if block_pick == 11: info.text = 'Crafting Table'

    if block_pick == 12: info.text = 'Cobblestone'
    
    if block_pick == 13: info.text = 'Diamond Block'

    if block_pick == 14: info.text = 'Coal Block'

    if block_pick == 15: info.text = 'Iron Block'

    if block_pick == 16: info.text = 'Sand'

    if block_pick == 17: info.text = 'Cactus'

    if block_pick == 18: info.text = 'Water'


    info.x = -0.1
    info.y = 0.46
    info.background = True
    info.visible = True



class Voxel(Button):
    def __init__(self, position = (0,0,0), texture = grass_texture, collision = True):
        super().__init__(
            parent = scene,
            position = position,
            model = 'assets/block',
            origin_y = 0.5,
            texture = texture,
            collision = collision,
            color = color.color(0,0,random.uniform(0.9,1)),
            scale = 0.5)

        voxels.append({
            'x': self.position.x,
            'y': self.position.y,
            'z': self.position.z,
            'position': self.position,
            'texture': texture
        })

    def input(self,key):
        global inventory
        if key == 'b' and inventory: inventory = False
        if self.hovered:
            if key == 'right mouse down':
                punch_sound.play()
                if block_pick == 1: voxel = Voxel(position = self.position + mouse.normal, texture = grass_texture)
                if block_pick == 2: voxel = Voxel(position = self.position + mouse.normal, texture = stone_texture)
                if block_pick == 3: voxel = Voxel(position = self.position + mouse.normal, texture = brick_texture)
                if block_pick == 4: voxel = Voxel(position = self.position + mouse.normal, texture = dirt_texture)
                if block_pick == 5: voxel = Voxel(position = self.position + mouse.normal, texture = log_texture)
                if block_pick == 6: voxel = Voxel(position = self.position + mouse.normal, texture = leaves_texture)
                if block_pick == 7: voxel = Voxel(position = self.position + mouse.normal, texture = oak_planks_texture)
                if block_pick == 8: voxel = Voxel(position = self.position + mouse.normal, texture = diamond_ore_texture)
                if block_pick == 9: voxel = Voxel(position = self.position + mouse.normal, texture = coal_ore_texture)
                if block_pick == 10: voxel = Voxel(position = self.position + mouse.normal, texture = iron_ore_texture)
                if block_pick == 11: voxel = Voxel(position = self.position + mouse.normal, texture = crafting_table_texture)
                if block_pick == 12: voxel = Voxel(position = self.position + mouse.normal, texture = cobblestone_texture)
                if block_pick == 13: voxel = Voxel(position = self.position + mouse.normal, texture = diamond_ore_block_texture)
                if block_pick == 14: voxel = Voxel(position = self.position + mouse.normal, texture = coal_ore_block_texture)
                if block_pick == 15: voxel = Voxel(position = self.position + mouse.normal, texture = iron_ore_block_texture)
                if block_pick == 16: voxel = Voxel(position = self.position + mouse.normal, texture = sand_texture)
                if block_pick == 17: voxel = Voxel(position = self.position + mouse.normal, texture = cactus_texture)
                if block_pick == 18: voxel = Voxel(position = self.position + mouse.normal, texture = water_texture, collision = False)

                index = voxels.index({
                    'x': self.position.x,
                    'y': self.position.y,
                    'z': self.position.z,
                    'position': self.position,
                    'texture': self.texture
                })

                print(voxels[index])

            if key == 'left mouse down':
                punch_sound.play()
                index = voxels.index({
                    'x': self.position.x,
                    'y': self.position.y,
                    'z': self.position.z,
                    'position': self.position,
                    'texture': self.texture
                })

                print(voxels[index])
                del voxels[index]
                destroy(self)

            for i in range(len(voxels)):
                index = voxels.index({
                    'x': self.position.x,
                    'y': self.position.y,
                    'z': self.position.z,
                    'position': self.position,
                    'texture': self.texture
                })
                if self.texture == "water.png" and Vec3(index.x, index.y, index.z) == i.position:

                    print(voxels[index])
                    del voxels[index]
                    destroy(self)

class Sky(Entity):
    def __init__(self):
        super().__init__(
            parent = scene,
            model = 'sphere',
            texture = sky_texture,
            scale = 300,
            double_sided = True)

class Hand(Entity):
    def __init__(self):
        super().__init__(
            parent = camera.ui,
            model = 'assets/arm',
            texture = 'assets/arm_texture',
            scale = 0.2,
            rotation = Vec3(150,-10,0),
            position = Vec2(0.4,-0.6))

    def active(self):
        self.position = Vec2(0.3,-0.5)

    def passive(self):
        self.position = Vec2(0.4,-0.6)

def spawn_chunk(start_chunk, chunks_spawned):
    if random.uniform(0,8) >= 4:
        print("Chose plains chunks")
        if random.uniform(0,8) >= 4:
            y = 1
        else:
            y = 0
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z))
                if random.uniform(0,16) > 15.5:
                    tree_position_x = x + start_chunk
                    tree_position_y = 0 + y + 1
                    tree_position_z = z
                    tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x + start_chunk,-2 + y,z), texture = stone_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)


        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x + start_chunk,-2 + y,z), texture = stone_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x,0 + y,z + start_chunk))
                if random.uniform(0,16) > 15.5:
                    tree_position_x = x + start_chunk
                    tree_position_y = 0 + y + 1
                    tree_position_z = z
                    tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-2):
                    voxel = Voxel(position = (x,-1 + y,z + start_chunk), texture = dirt_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x,-2 + y,z + start_chunk), texture = stone_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)

        if random.uniform(0,8) > 4:
            y = 1
        else:
            y = 0
    
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z + start_chunk))
                if random.uniform(0,16) > 15.5:
                    tree_position_x = x + start_chunk
                    tree_position_y = 0 + y + 1
                    tree_position_z = z
                    tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-2):
                    voxel = Voxel(position = (x + start_chunk,-1 + y,z + start_chunk), texture = dirt_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x + start_chunk,-2 + y,z + start_chunk), texture = stone_texture)
                    if random.uniform(0,16) > 15.5:
                        tree_position_x = x + start_chunk
                        tree_position_y = 0 + y + 1
                        tree_position_z = z
                        tree(tree_position_x, tree_position_y, tree_position_z)
    elif random.uniform(0,8) <= 5:
        print("Chosse desert")
        if random.uniform(0,8) >= 4:
            y = 1
        else:
            y = 0
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z), texture = sand_texture)
                if random.uniform(0,16) > 15.5:
                    cactus_position_x = x + start_chunk
                    cactus_position_y = 0 + y + 1
                    cactus_position_z = z
                    cactus(cactus_position_x, cactus_position_y, cactus_position_z)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x,0 + y,z + start_chunk), texture = sand_texture)
                if random.uniform(0,16) > 15.5:
                    cactus_position_x = x + start_chunk
                    cactus_position_y = 0 + y + 1
                    cactus_position_z = z
                    cactus(cactus_position_x, cactus_position_y, cactus_position_z)

        if random.uniform(0,8) > 4:
            y = 1
        else:
            y = 0
    
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z + start_chunk), texture = sand_texture)
                if random.uniform(0,16) > 15.5:
                    cactus_position_x = x + start_chunk
                    cactus_position_y = 0 + y + 1
                    cactus_position_z = z
                    cactus(cactus_position_x, cactus_position_y, cactus_position_z)
    else:
        print("Chosse stone plains")
        if random.uniform(0,8) >= 4:
            y = 1
        else:
            y = 0
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z),texture = stone_texture)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x + start_chunk,-2 + y,z), texture = stone_texture)


        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                for y in range(-7):
                    voxel = Voxel(position = (x + start_chunk,-2 + y,z), texture = stone_texture)

        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x,0 + y,z + start_chunk), texture = stone_texture)


        if random.uniform(0,8) > 4:
            y = 1
        else:
            y = 0
    
        for z in range(13 * chunks_spawned):
            for x in range(13 * chunks_spawned):
                voxel = Voxel(position = (x + start_chunk,0 + y,z + start_chunk), texture = stone_texture)

    print("Spawned chunks")

def input(key):
    if key == "m":
        print("Quit game. Hope you had fun!")
        exit()

    if key == "x":
        global start_chunk
        global chunks_spawned
        spawn_chunk(start_chunk, chunks_spawned)
        chunks_spawned += 1
        start_chunk = start_chunk + 11

    if key == "c":
        cactus(player.x + 2, player.y, player.z + 2)

    if key == "z":
        tree(player.x + 2, player.y, player.z + 2)

def tree(tree_position_x, tree_position_y, tree_position_z):
    voxel = Voxel(position = (tree_position_x,tree_position_y,tree_position_z), texture = log_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 1,tree_position_z), texture = log_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 2,tree_position_z), texture = log_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 3,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 3,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 2,tree_position_y + 3,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 1,tree_position_y + 3,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 2,tree_position_y + 3,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 3,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 3,tree_position_z + 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 3,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 2,tree_position_y + 3,tree_position_z + 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 2,tree_position_y + 3,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 3,tree_position_z + 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 3,tree_position_z - 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 3,tree_position_z - 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 3,tree_position_z - 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 2,tree_position_y + 3,tree_position_z - 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 2,tree_position_y + 3,tree_position_z - 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 3,tree_position_z - 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 2,tree_position_y + 3,tree_position_z - 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 1,tree_position_y + 3,tree_position_z - 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 2,tree_position_y + 3,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 1,tree_position_y + 3,tree_position_z + 2), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 4,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 4,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 1,tree_position_y + 4,tree_position_z), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 4,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x,tree_position_y + 4,tree_position_z - 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 4,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x - 1,tree_position_y + 4,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 4,tree_position_z + 1), texture = leaves_texture)
    voxel = Voxel(position = (tree_position_x + 1,tree_position_y + 4,tree_position_z - 1), texture = leaves_texture)

def cactus(cactus_position_x, cactus_position_y, cactus_position_z):
    voxel = Voxel(position = (cactus_position_x, cactus_position_y, cactus_position_z), texture = cactus_texture)
    cactus_height = int(random.uniform(2, 8))
    for number in range(0, cactus_height):
        voxel = Voxel(position = (cactus_position_x, cactus_position_y + number, cactus_position_z), texture = cactus_texture)

def texture_update():

    grass_texture = load_texture('assets/grass_block.png')
    stone_texture = load_texture('assets/stone_block.png')
    brick_texture = load_texture('assets/brick_block.png')
    dirt_texture = load_texture('assets/dirt_block.png')
    sky_texture  = load_texture('assets/skybox.png')
    arm_texture  = load_texture('assets/arm_texture.png')
    leaves_texture = load_texture('assets/oak_leaves.png')
    log_texture = load_texture('assets/oak_log.png')
    diamond_ore_texture = load_texture('assets/diamond_ore.png')
    coal_ore_texture = load_texture('assets/coal_ore.png')
    iron_ore_texture = load_texture('assets/iron_ore.png')
    diamond_ore_block_texture = load_texture('assets/diamond_block.png')
    coal_ore_block_texture = load_texture('assets/coal_block.png')
    iron_ore_block_texture = load_texture('assets/iron_block.png')
    oak_planks_texture = load_texture('assets/oak_planks.png')
    crafting_table_texture = load_texture('assets/crafting_table.png')
    cobblestone_texture = load_texture('assets/cobblestone.png')
    sand_texture = load_texture('assets/sand.png')
    cactus_texture = load_texture('assets/cactus.png')
    water_texture = load_texture('assets/water.png')



y = 0
    
for z in range(13):
    for x in range(13):
        voxel = Voxel(position = (x,0 + y,z))
        if random.uniform(0,16) > 15.5:
                tree_position_x = x
                tree_position_y = 0 + y + 1
                tree_position_z = z
                tree(tree_position_x, tree_position_y, tree_position_z)


for z in range(13):
    for x in range(13):
        for y in range(2):
            voxel = Voxel(position = (x,-1,z), texture = dirt_texture)


for z in range(13):
    for x in range(13):
        for y in range(7):
            voxel = Voxel(position = (x,-2,z), texture = stone_texture)



block_pick = 1

global inventory
inventory = True

player = FirstPersonController()
sky = Sky()
hand = Hand()

Text.size = 0.05
Text.default_resolution = 1080 * Text.size
info = Text()

texture_update()

chunks_spawned = 1

app.run()

Important code:

    for i in range(len(voxels)):
        index = voxels.index({
            'x': self.position.x,
            'y': self.position.y,
            'z': self.position.z,
            'position': self.position,
            'texture': self.texture
        })
        if self.texture == "water.png" and Vec3(index.x, index.y, index.z) == i.position:

            print(voxels[index])
            del voxels[index]
            destroy(self)

1 Answers1

0

i haved a similar problem while i tried to del a list of enemies , instead of del func could you use ursina build in invoke?

invoke(destroy,obj_to_destroy)