From dfc9be7b0842939ced2d3413c26061e460ad982f Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 9 Sep 2024 20:46:12 +0100 Subject: [PATCH] test: add tests for overloaded Dimension.get_block_at function --- .../tests/on_player_join/test_block.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/endstone_test/tests/on_player_join/test_block.py diff --git a/src/endstone_test/tests/on_player_join/test_block.py b/src/endstone_test/tests/on_player_join/test_block.py new file mode 100644 index 0000000..4cf4313 --- /dev/null +++ b/src/endstone_test/tests/on_player_join/test_block.py @@ -0,0 +1,23 @@ +from babel import Locale +from endstone import Player, Server, GameMode +from endstone.plugin import Plugin +import pytest + + +@pytest.fixture +def server(player: Player) -> Server: + return player.server + + +def test_get_block_at_xyz(player: Player) -> None: + location = player.location + block = player.dimension.get_block_at(location.block_x, -64, location.block_z) + assert block.type == "minecraft:bedrock" + block = player.dimension.get_block_at(location.block_x, 320, location.block_z) + assert block.type == "minecraft:air" + + +def test_get_block_at_location(player: Player) -> None: + location = player.location + block = player.dimension.get_block_at(location) + assert block.data.type == block.type