Skip to content

Commit

Permalink
πŸ› Finalize, nbt import
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Feb 10, 2025
1 parent 2bbb074 commit 162c705
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/craftground/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from enum import Enum
import threading
from typing import Tuple, Optional, TypedDict, Union, List, Any, Dict
import weakref

import gymnasium as gym
import numpy as np
Expand Down Expand Up @@ -144,6 +145,8 @@ def __init__(
self.render_action,
)

weakref.finalize(self, self.close)

def reset(
self,
*,
Expand Down
2 changes: 1 addition & 1 deletion src/craftground/nbt/models/entity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass
from typing import Optional
from nbt_dataclass import (
from ..nbt_dataclass import (
NBTBase,
NBTByte,
NBTCompound,
Expand Down
4 changes: 2 additions & 2 deletions src/craftground/nbt/models/structure.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Optional
from models.entity import EntityNBT
from nbt_dataclass import (
from ..models.entity import EntityNBT
from ..nbt_dataclass import (
NBTBase,
NBTCompound,
NBTDouble,
Expand Down
2 changes: 1 addition & 1 deletion src/craftground/nbt/nbt_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Tuple

import numpy as np
from nbt_dataclass import (
from .nbt_dataclass import (
NBTBase,
NBTByte,
NBTByteArray,
Expand Down
8 changes: 4 additions & 4 deletions src/craftground/nbt/structure_editor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List, Optional, Dict, Tuple
from models.structure import BlockNBT, PaletteNBT, StructureEntityNBT, StructureNBT
from models.entity import EntityNBT, ItemEntityNBT, ItemNBT
from nbt_dataclass import NBTCompound, NBTInt, NBTShort, NBTString
from nbt_io import read_nbt, write_nbt
from .models.structure import BlockNBT, PaletteNBT, StructureEntityNBT, StructureNBT
from .models.entity import ItemEntityNBT, ItemNBT
from .nbt_dataclass import NBTCompound, NBTInt, NBTShort, NBTString
from .nbt_io import read_nbt, write_nbt


class Structure:
Expand Down

0 comments on commit 162c705

Please sign in to comment.