py2hackCraft2 1.1.44__tar.gz → 1.1.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py2hackCraft2
3
- Version: 1.1.44
3
+ Version: 1.1.45
4
4
  Summary: Python client library for hackCraft2
5
5
  Home-page: https://github.com/0x48lab/hackCraft2-python
6
6
  Author: masafumi_t
@@ -1358,6 +1358,156 @@ class Entity:
1358
1358
  self.client.send_call(self.uuid, "digX", [0, -1, 0])
1359
1359
  return str_to_bool(self.client.result)
1360
1360
 
1361
+ # ===== Sign Operations =====
1362
+
1363
+ def write_sign(self, text) -> bool:
1364
+ """
1365
+ 自分の前方の看板にテキストを書き込む
1366
+
1367
+ Args:
1368
+ text: 書き込むテキスト。文字列またはリスト(各要素が各行になる、最大4行)
1369
+
1370
+ Returns:
1371
+ bool: 操作が成功した場合はTrue、失敗した場合はFalse
1372
+
1373
+ Examples:
1374
+ 文字列で書き込む::
1375
+
1376
+ entity.write_sign("Hello World")
1377
+
1378
+ 複数行を書き込む::
1379
+
1380
+ entity.write_sign(["1行目", "2行目", "3行目", "4行目"])
1381
+ """
1382
+ if isinstance(text, list):
1383
+ text = '\n'.join(str(line) for line in text[:4])
1384
+ self.client.send_call(self.uuid, "setSign", [str(text), "front"])
1385
+ return str_to_bool(self.client.result)
1386
+
1387
+ def write_sign_up(self, text) -> bool:
1388
+ """
1389
+ 自分の真上の看板にテキストを書き込む
1390
+
1391
+ Args:
1392
+ text: 書き込むテキスト。文字列またはリスト(各要素が各行になる、最大4行)
1393
+
1394
+ Returns:
1395
+ bool: 操作が成功した場合はTrue、失敗した場合はFalse
1396
+ """
1397
+ if isinstance(text, list):
1398
+ text = '\n'.join(str(line) for line in text[:4])
1399
+ self.client.send_call(self.uuid, "setSign", [str(text), "up"])
1400
+ return str_to_bool(self.client.result)
1401
+
1402
+ def write_sign_down(self, text) -> bool:
1403
+ """
1404
+ 自分の真下の看板にテキストを書き込む
1405
+
1406
+ Args:
1407
+ text: 書き込むテキスト。文字列またはリスト(各要素が各行になる、最大4行)
1408
+
1409
+ Returns:
1410
+ bool: 操作が成功した場合はTrue、失敗した場合はFalse
1411
+ """
1412
+ if isinstance(text, list):
1413
+ text = '\n'.join(str(line) for line in text[:4])
1414
+ self.client.send_call(self.uuid, "setSign", [str(text), "down"])
1415
+ return str_to_bool(self.client.result)
1416
+
1417
+ def write_sign_at(self, loc: Location, text) -> bool:
1418
+ """
1419
+ 指定した座標の看板にテキストを書き込む
1420
+
1421
+ Args:
1422
+ loc (Location): 座標情報(LocationFactory.absolute/relative/localで生成)
1423
+ text: 書き込むテキスト。文字列またはリスト(各要素が各行になる、最大4行)
1424
+
1425
+ Returns:
1426
+ bool: 操作が成功した場合はTrue、失敗した場合はFalse
1427
+
1428
+ Examples:
1429
+ 相対座標で指定::
1430
+
1431
+ loc = LocationFactory.relative(0, 1, 0) # 1ブロック上
1432
+ entity.write_sign_at(loc, "相対座標のメッセージ")
1433
+
1434
+ ローカル座標で指定::
1435
+
1436
+ loc = LocationFactory.local(0, 0, 1) # 前方1ブロック
1437
+ entity.write_sign_at(loc, "ローカル座標のメッセージ")
1438
+
1439
+ 複数行を書き込む::
1440
+
1441
+ loc = LocationFactory.local(0, 0, 1)
1442
+ entity.write_sign_at(loc, ["1行目", "2行目", "3行目"])
1443
+ """
1444
+ if isinstance(text, list):
1445
+ text = '\n'.join(str(line) for line in text[:4])
1446
+ self.client.send_call(self.uuid, "setSignX", [str(text), loc.x, loc.y, loc.z, loc.cord])
1447
+ return str_to_bool(self.client.result)
1448
+
1449
+ def read_sign(self) -> str:
1450
+ """
1451
+ 自分の前方の看板のテキストを読み取る
1452
+
1453
+ Returns:
1454
+ str: 看板のテキスト(複数行の場合は改行で区切られた文字列)、看板がない場合は空文字列
1455
+
1456
+ Examples:
1457
+ テキストを読み取る::
1458
+
1459
+ text = entity.read_sign()
1460
+ print(text) # "1行目\\n2行目\\n..."
1461
+ """
1462
+ self.client.send_call(self.uuid, "getSign", ["front"])
1463
+ return self.client.result if self.client.result else ""
1464
+
1465
+ def read_sign_up(self) -> str:
1466
+ """
1467
+ 自分の真上の看板のテキストを読み取る
1468
+
1469
+ Returns:
1470
+ str: 看板のテキスト(複数行の場合は改行で区切られた文字列)、看板がない場合は空文字列
1471
+ """
1472
+ self.client.send_call(self.uuid, "getSign", ["up"])
1473
+ return self.client.result if self.client.result else ""
1474
+
1475
+ def read_sign_down(self) -> str:
1476
+ """
1477
+ 自分の真下の看板のテキストを読み取る
1478
+
1479
+ Returns:
1480
+ str: 看板のテキスト(複数行の場合は改行で区切られた文字列)、看板がない場合は空文字列
1481
+ """
1482
+ self.client.send_call(self.uuid, "getSign", ["down"])
1483
+ return self.client.result if self.client.result else ""
1484
+
1485
+ def read_sign_at(self, loc: Location) -> str:
1486
+ """
1487
+ 指定した座標の看板のテキストを読み取る
1488
+
1489
+ Args:
1490
+ loc (Location): 座標情報(LocationFactory.absolute/relative/localで生成)
1491
+
1492
+ Returns:
1493
+ str: 看板のテキスト(複数行の場合は改行で区切られた文字列)、看板がない場合は空文字列
1494
+
1495
+ Examples:
1496
+ 相対座標で指定::
1497
+
1498
+ loc = LocationFactory.relative(0, 1, 0) # 1ブロック上
1499
+ text = entity.read_sign_at(loc)
1500
+
1501
+ ローカル座標で指定::
1502
+
1503
+ loc = LocationFactory.local(0, 0, 1) # 前方1ブロック
1504
+ text = entity.read_sign_at(loc)
1505
+ """
1506
+ self.client.send_call(self.uuid, "getSignX", [loc.x, loc.y, loc.z, loc.cord])
1507
+ return self.client.result if self.client.result else ""
1508
+
1509
+ # ===== End Sign Operations =====
1510
+
1361
1511
  def attack(self) -> bool:
1362
1512
  """
1363
1513
  自分の前方を攻撃する
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py2hackCraft2
3
- Version: 1.1.44
3
+ Version: 1.1.45
4
4
  Summary: Python client library for hackCraft2
5
5
  Home-page: https://github.com/0x48lab/hackCraft2-python
6
6
  Author: masafumi_t
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="py2hackCraft2",
5
- version="v1.1.44",
5
+ version="v1.1.45",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "websocket-client>=1.6.0",
File without changes
File without changes