py2hackCraft2 1.0.17__tar.gz → 1.0.19__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.1
2
2
  Name: py2hackCraft2
3
- Version: 1.0.17
3
+ Version: 1.0.19
4
4
  Summary: These are APIs that connect to the hackCraft2 server from Python to manipulate pets.
5
5
  Home-page: https://pypi.org/project/py2hackCraft2/
6
6
  Author: Masafumi Terazono
@@ -10,3 +10,7 @@ build:
10
10
  deploy:
11
11
  <command>
12
12
  twine upload --repository-url https://upload.pypi.org/legacy/ dist/* -u "__token__"
13
+
14
+ doc:
15
+ <command>
16
+ make html
@@ -154,12 +154,24 @@ class _WebSocketClient:
154
154
  self.send(json.dumps(message))
155
155
 
156
156
  class Coordinates:
157
+ """
158
+ 座標の基準を表すデータクラス
159
+ """
157
160
  world = ""
158
161
  relative = "~"
159
162
  local = "^"
160
163
 
161
164
  @dataclass
162
165
  class Location:
166
+ """
167
+ 座標を表すデータクラス。
168
+
169
+ Attributes:
170
+ x (str): X座標。
171
+ y (str): Y座標。
172
+ z (str): Z座標。
173
+ world (str): ワールド名。
174
+ """
163
175
  x: int
164
176
  y: int
165
177
  z: int
@@ -167,6 +179,22 @@ class Location:
167
179
 
168
180
  @dataclass
169
181
  class InteractEvent:
182
+ """
183
+ クリックイベントを表すデータクラス。
184
+
185
+ Attributes:
186
+ action (str): アクションの名前。
187
+ player (str): クリックしたプレイヤー名。
188
+ player_uuid (str): クリックしたプレイヤーの一意の識別子(UUID)。
189
+ event (str): アイテムに設定されている名前。
190
+ name (str): ブロックあるいはエンティティーの名前
191
+ type (str): ブロックあるいはエンティティーの種類。
192
+ data (int): ブロックのデータ値。
193
+ world (str): ブロックあるいはエンティティーのいたワールド名。
194
+ x (int): クリックした場所のワールドにおけるX座標。
195
+ y (int): クリックした場所のワールドにおけるY座標。
196
+ z (int): クリックした場所のワールドにおけるZ座標。
197
+ """
170
198
  action: str
171
199
  player: str
172
200
  player_uuid: str
@@ -588,6 +616,20 @@ class Entity:
588
616
  self.client.sendCall(self.uuid, "placeX", [x, y, z, cord, side, block])
589
617
  return str_to_bool(self.client.result)
590
618
 
619
+ def placeHere(self, x: int, y: int, z: int, block=None, side=None) -> bool :
620
+ """
621
+ 自分を中心に指定した座標にブロックを設置する。
622
+
623
+ Args:
624
+ x (int): X座標。
625
+ y (int): Y座標。
626
+ z (int): Z座標。
627
+ block (str): 設置するブロックの種類。
628
+ side (str): 設置する面。
629
+ """
630
+ self.client.sendCall(self.uuid, "placeX", [x, y, z, "^", side, block])
631
+ return str_to_bool(self.client.result)
632
+
591
633
  def place(self, side=None) -> bool :
592
634
  """
593
635
  自分の前方にブロックを設置する。
@@ -609,6 +651,31 @@ class Entity:
609
651
  self.client.sendCall(self.uuid, "placeDown")
610
652
  return str_to_bool(self.client.result, [side])
611
653
 
654
+ def useItemX(self, cord: Coordinates, x: int, y: int, z: int) -> bool :
655
+ """
656
+ 指定した座標にアイテムを使う
657
+
658
+ Args:
659
+ cord (Coordinates): 座標の種類('', '^', '~')。
660
+ x (int): X座標。
661
+ y (int): Y座標。
662
+ z (int): Z座標。
663
+ """
664
+ self.client.sendCall(self.uuid, "useItemX", [x, y, z, cord])
665
+ return str_to_bool(self.client.result)
666
+
667
+ def useItemHere(self, x: int, y: int, z: int) -> bool :
668
+ """
669
+ 自分を中心に指定した座標にアイテムを使う
670
+
671
+ Args:
672
+ x (int): X座標。
673
+ y (int): Y座標。
674
+ z (int): Z座標。
675
+ """
676
+ self.client.sendCall(self.uuid, "useItemX", [x, y, z, "^"])
677
+ return str_to_bool(self.client.result)
678
+
612
679
  def useItem(self) -> bool :
613
680
  """
614
681
  自分の前方にアイテムを使う
@@ -630,19 +697,6 @@ class Entity:
630
697
  self.client.sendCall(self.uuid, "useItemDown")
631
698
  return str_to_bool(self.client.result)
632
699
 
633
- def useItemX(self, cord: Coordinates, x: int, y: int, z: int) -> bool :
634
- """
635
- 指定した座標にアイテムを使う
636
-
637
- Args:
638
- cord (Coordinates): 座標の種類('', '^', '~')。
639
- x (int): X座標。
640
- y (int): Y座標。
641
- z (int): Z座標。
642
- """
643
- self.client.sendCall(self.uuid, "useItemX", [x, y, z, cord])
644
- return str_to_bool(self.client.result)
645
-
646
700
  def harvest(self) -> bool :
647
701
  """
648
702
  自分の位置のブロックを収穫する。
@@ -790,6 +844,21 @@ class Entity:
790
844
  block = Block(** json.loads(self.client.result))
791
845
  return block
792
846
 
847
+ def inspectHere(self, x: int, y: int, z: int) -> Block :
848
+ """
849
+ 自分を中心に指定された座標のブロックを調べる。
850
+
851
+ Args:
852
+ x (int): X座標。
853
+ y (int): Y座標。
854
+ z (int): Z座標。
855
+ Returns:
856
+ Block: 調べたブロックの情報。
857
+ """
858
+ self.client.sendCall(self.uuid, "inspect", [x, y, z, "^"])
859
+ block = Block(** json.loads(self.client.result))
860
+ return block
861
+
793
862
  def inspect(self) -> Block :
794
863
  """
795
864
  自分のいる場所のブロックを調べる。
@@ -868,6 +937,34 @@ class Entity:
868
937
  self.client.sendCall(self.uuid, "isBlockedDown")
869
938
  return str_to_bool(self.client.result)
870
939
 
940
+
941
+ def canDig(self) -> bool :
942
+ """
943
+ 自分の前方のブロックが壊せるかどうか調べる。
944
+ Returns:
945
+ bool: 調べた結果。
946
+ """
947
+ self.client.sendCall(self.uuid, "isCanDigFront")
948
+ return str_to_bool(self.client.result)
949
+
950
+ def canDigUp(self) -> bool :
951
+ """
952
+ 自分の上のブロックが壊せるかどうか調べる。
953
+ Returns:
954
+ bool: 調べた結果。
955
+ """
956
+ self.client.sendCall(self.uuid, "isCanDigUp")
957
+ return str_to_bool(self.client.result)
958
+
959
+ def canDigDown(self) -> bool :
960
+ """
961
+ 自分の下のブロックが壊せるかどうか調べる。
962
+ Returns:
963
+ bool: 調べた結果。
964
+ """
965
+ self.client.sendCall(self.uuid, "isCanDigDown")
966
+ return str_to_bool(self.client.result)
967
+
871
968
  def lookAtTarget(self, uuid) -> bool:
872
969
  """
873
970
  指定されたエンティティを見る。
@@ -909,7 +1006,7 @@ class Entity:
909
1006
 
910
1007
  def setBlock(self, cord: Coordinates, x: int, y: int, z: int, block: str, data: int = 0):
911
1008
  """
912
- 指定された座標にブロックを設置する。
1009
+ 指定された座標にブロックを設置する。(クリエイティブ)
913
1010
 
914
1011
  Args:
915
1012
  cord (Coordinates): 座標の種類('', '^', '~')。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2hackCraft2
3
- Version: 1.0.17
3
+ Version: 1.0.19
4
4
  Summary: These are APIs that connect to the hackCraft2 server from Python to manipulate pets.
5
5
  Home-page: https://pypi.org/project/py2hackCraft2/
6
6
  Author: Masafumi Terazono
@@ -5,7 +5,7 @@ long_description = (this_directory / "py2hackCraft/README.md").read_text()
5
5
 
6
6
  setup(
7
7
  name="py2hackCraft2",
8
- version="1.0.17",
8
+ version="1.0.19",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "websocket-client" # websocketライブラリの追加
File without changes