py2hackCraft2 1.0.16__tar.gz → 1.0.18__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.
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/PKG-INFO +1 -1
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft/modules.py +100 -28
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft2.egg-info/PKG-INFO +1 -1
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/setup.py +1 -1
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/README.md +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft/__init__.py +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft/material.py +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft2.egg-info/SOURCES.txt +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft2.egg-info/dependency_links.txt +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft2.egg-info/requires.txt +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/py2hackCraft2.egg-info/top_level.txt +0 -0
- {py2hackcraft2-1.0.16 → py2hackcraft2-1.0.18}/setup.cfg +0 -0
|
@@ -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
|
|
@@ -480,7 +508,7 @@ class Entity:
|
|
|
480
508
|
"""
|
|
481
509
|
if(len(self.positions) > 0):
|
|
482
510
|
pos = self.positions.pop()
|
|
483
|
-
self.teleport(pos
|
|
511
|
+
self.teleport(pos)
|
|
484
512
|
return True
|
|
485
513
|
else:
|
|
486
514
|
return False
|
|
@@ -573,38 +601,79 @@ class Entity:
|
|
|
573
601
|
"""
|
|
574
602
|
self.client.sendCall(self.uuid, "turn", [degrees])
|
|
575
603
|
|
|
576
|
-
def placeX(self, x, y, z,
|
|
604
|
+
def placeX(self, cord: Coordinates, x: int, y: int, z: int, block=None, side=None) -> bool :
|
|
577
605
|
"""
|
|
578
606
|
指定した座標にブロックを設置する。
|
|
579
607
|
|
|
608
|
+
Args:
|
|
609
|
+
cord (Coordinates): 座標の種類('', '^', '~')。
|
|
610
|
+
x (int): X座標。
|
|
611
|
+
y (int): Y座標。
|
|
612
|
+
z (int): Z座標。
|
|
613
|
+
block (str): 設置するブロックの種類。
|
|
614
|
+
side (str): 設置する面。
|
|
615
|
+
"""
|
|
616
|
+
self.client.sendCall(self.uuid, "placeX", [x, y, z, cord, side, block])
|
|
617
|
+
return str_to_bool(self.client.result)
|
|
618
|
+
|
|
619
|
+
def placeHere(self, x: int, y: int, z: int, block=None, side=None) -> bool :
|
|
620
|
+
"""
|
|
621
|
+
自分を中心に指定した座標にブロックを設置する。
|
|
622
|
+
|
|
580
623
|
Args:
|
|
581
624
|
x (int): X座標。
|
|
582
625
|
y (int): Y座標。
|
|
583
626
|
z (int): Z座標。
|
|
584
|
-
|
|
627
|
+
block (str): 設置するブロックの種類。
|
|
628
|
+
side (str): 設置する面。
|
|
585
629
|
"""
|
|
586
|
-
self.client.sendCall(self.uuid, "placeX", [x, y, z,
|
|
630
|
+
self.client.sendCall(self.uuid, "placeX", [x, y, z, "^", side, block])
|
|
587
631
|
return str_to_bool(self.client.result)
|
|
588
632
|
|
|
589
|
-
def place(self) -> bool :
|
|
633
|
+
def place(self, side=None) -> bool :
|
|
590
634
|
"""
|
|
591
635
|
自分の前方にブロックを設置する。
|
|
592
636
|
"""
|
|
593
637
|
self.client.sendCall(self.uuid, "placeFront")
|
|
594
|
-
return str_to_bool(self.client.result)
|
|
638
|
+
return str_to_bool(self.client.result, [side])
|
|
595
639
|
|
|
596
|
-
def placeUp(self) -> bool :
|
|
640
|
+
def placeUp(self, side=None) -> bool :
|
|
597
641
|
"""
|
|
598
642
|
自分の真上にブロックを設置する。
|
|
599
643
|
"""
|
|
600
644
|
self.client.sendCall(self.uuid, "placeUp")
|
|
601
|
-
return str_to_bool(self.client.result)
|
|
645
|
+
return str_to_bool(self.client.result, [side])
|
|
602
646
|
|
|
603
|
-
def placeDown(self) -> bool :
|
|
647
|
+
def placeDown(self, side=None) -> bool :
|
|
604
648
|
"""
|
|
605
649
|
自分の真下にブロックを設置する。
|
|
606
650
|
"""
|
|
607
651
|
self.client.sendCall(self.uuid, "placeDown")
|
|
652
|
+
return str_to_bool(self.client.result, [side])
|
|
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, "^"])
|
|
608
677
|
return str_to_bool(self.client.result)
|
|
609
678
|
|
|
610
679
|
def useItem(self) -> bool :
|
|
@@ -628,19 +697,6 @@ class Entity:
|
|
|
628
697
|
self.client.sendCall(self.uuid, "useItemDown")
|
|
629
698
|
return str_to_bool(self.client.result)
|
|
630
699
|
|
|
631
|
-
def useItemX(self, x, y, z, cord) -> bool :
|
|
632
|
-
"""
|
|
633
|
-
指定した座標にアイテムを使う
|
|
634
|
-
|
|
635
|
-
Args:
|
|
636
|
-
x (int): X座標。
|
|
637
|
-
y (int): Y座標。
|
|
638
|
-
z (int): Z座標。
|
|
639
|
-
cord (str): 座標の種類('', '^', '~')。
|
|
640
|
-
"""
|
|
641
|
-
self.client.sendCall(self.uuid, "useItemX", [x, y, z, cord])
|
|
642
|
-
return str_to_bool(self.client.result)
|
|
643
|
-
|
|
644
700
|
def harvest(self) -> bool :
|
|
645
701
|
"""
|
|
646
702
|
自分の位置のブロックを収穫する。
|
|
@@ -676,15 +732,15 @@ class Entity:
|
|
|
676
732
|
self.client.sendCall(self.uuid, "digDown")
|
|
677
733
|
return str_to_bool(self.client.result)
|
|
678
734
|
|
|
679
|
-
def digX(self, x, y, z
|
|
735
|
+
def digX(self, cord: Coordinates, x : int, y: int, z: int) -> bool :
|
|
680
736
|
"""
|
|
681
737
|
指定した座標のブロックを壊す。
|
|
682
738
|
|
|
683
739
|
Args:
|
|
740
|
+
cord (Coordinates): 座標の種類('', '^', '~')。
|
|
684
741
|
x (int): X座標。
|
|
685
742
|
y (int): Y座標。
|
|
686
743
|
z (int): Z座標。
|
|
687
|
-
cord (str): 座標の種類('', '^', '~')。
|
|
688
744
|
"""
|
|
689
745
|
self.client.sendCall(self.uuid, "digX", [x, y, z, cord])
|
|
690
746
|
return str_to_bool(self.client.result)
|
|
@@ -772,15 +828,15 @@ class Entity:
|
|
|
772
828
|
"""
|
|
773
829
|
self.client.sendCall(self.uuid, "sendChat", [message])
|
|
774
830
|
|
|
775
|
-
def inspectX(self, x: int, y: int, z: int
|
|
831
|
+
def inspectX(self, cord: Coordinates, x: int, y: int, z: int) -> Block :
|
|
776
832
|
"""
|
|
777
833
|
指定された座標のブロックを調べる。
|
|
778
834
|
|
|
779
835
|
Args:
|
|
836
|
+
cord (Coordinates): 座標の種類('', '^', '~')。
|
|
780
837
|
x (int): X座標。
|
|
781
838
|
y (int): Y座標。
|
|
782
839
|
z (int): Z座標。
|
|
783
|
-
cord (str): 座標の種類('', '^', '~')。
|
|
784
840
|
Returns:
|
|
785
841
|
Block: 調べたブロックの情報。
|
|
786
842
|
"""
|
|
@@ -788,6 +844,21 @@ class Entity:
|
|
|
788
844
|
block = Block(** json.loads(self.client.result))
|
|
789
845
|
return block
|
|
790
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
|
+
|
|
791
862
|
def inspect(self) -> Block :
|
|
792
863
|
"""
|
|
793
864
|
自分のいる場所のブロックを調べる。
|
|
@@ -889,7 +960,7 @@ class Entity:
|
|
|
889
960
|
自分と真上のターゲットとの距離を調べる。
|
|
890
961
|
"""
|
|
891
962
|
self.client.sendCall(self.uuid, "getTargetDistanceUp")
|
|
892
|
-
return self.client.result
|
|
963
|
+
return float(self.client.result)
|
|
893
964
|
|
|
894
965
|
def getDistanceDown(self) -> float :
|
|
895
966
|
"""
|
|
@@ -907,9 +978,10 @@ class Entity:
|
|
|
907
978
|
|
|
908
979
|
def setBlock(self, cord: Coordinates, x: int, y: int, z: int, block: str, data: int = 0):
|
|
909
980
|
"""
|
|
910
|
-
|
|
981
|
+
指定された座標にブロックを設置する。(クリエイティブ)
|
|
911
982
|
|
|
912
983
|
Args:
|
|
984
|
+
cord (Coordinates): 座標の種類('', '^', '~')。
|
|
913
985
|
x (int): 絶対的なX座標。
|
|
914
986
|
y (int): 絶対的なY座標。
|
|
915
987
|
z (int): 絶対的なZ座標。
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|