py2hackCraft2 1.0.14__tar.gz → 1.0.16__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.14
3
+ Version: 1.0.16
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
@@ -8,6 +8,7 @@ Author-email: masafumi_t@0x48lab.com
8
8
  License: MIT
9
9
  Keywords: hackCraft2
10
10
  Description-Content-Type: text/markdown
11
+ Requires-Dist: websocket-client
11
12
 
12
13
  ## 概要
13
14
 
@@ -311,8 +311,15 @@ class Player:
311
311
  result = self.client.result
312
312
  if(result is None):
313
313
  raise ValueError("Entity '%s' not found" % name)
314
+
314
315
 
315
- return Entity(self.client, self.world, result)
316
+ entity = Entity(self.client, self.world, result)
317
+ #ロールバックできるように設定
318
+ self.client.send(json.dumps({
319
+ "type": "start",
320
+ "data": {"entity": entity.uuid}
321
+ }))
322
+ return entity
316
323
 
317
324
  class Inventory:
318
325
  """
@@ -386,6 +393,9 @@ class Entity:
386
393
  self.uuid = uuid
387
394
  self.positions = []
388
395
 
396
+ def reset(self):
397
+ self.client.sendCall(self.uuid, "restoreArea")
398
+
389
399
  def waitForPlayerChat(self):
390
400
  """
391
401
  チャットを受信するまでまつ
@@ -548,6 +558,12 @@ class Entity:
548
558
  self.client.sendCall(self.uuid, "addForce", [x, y, z])
549
559
  return str_to_bool(self.client.result)
550
560
 
561
+ def jump(self, degrees: int):
562
+ """
563
+ ジャンプさせる。
564
+ """
565
+ self.client.sendCall(self.uuid, "jump")
566
+
551
567
  def turn(self, degrees: int):
552
568
  """
553
569
  自分を回転させる。
@@ -557,11 +573,17 @@ class Entity:
557
573
  """
558
574
  self.client.sendCall(self.uuid, "turn", [degrees])
559
575
 
560
- def placeHere(self, x, y, z) -> bool :
576
+ def placeX(self, x, y, z, cord) -> bool :
561
577
  """
562
- 自分を中心に指定した座標にブロックを設置する。
578
+ 指定した座標にブロックを設置する。
579
+
580
+ Args:
581
+ x (int): X座標。
582
+ y (int): Y座標。
583
+ z (int): Z座標。
584
+ cord (str): 座標の種類('', '^', '~')。
563
585
  """
564
- self.client.sendCall(self.uuid, "placeX", [x, y, z])
586
+ self.client.sendCall(self.uuid, "placeX", [x, y, z, cord])
565
587
  return str_to_bool(self.client.result)
566
588
 
567
589
  def place(self) -> bool :
@@ -606,11 +628,17 @@ class Entity:
606
628
  self.client.sendCall(self.uuid, "useItemDown")
607
629
  return str_to_bool(self.client.result)
608
630
 
609
- def useItemHere(self, x, y, z) -> bool :
631
+ def useItemX(self, x, y, z, cord) -> bool :
610
632
  """
611
- 自分を中心に指定した座標にアイテムを使う
633
+ 指定した座標にアイテムを使う
634
+
635
+ Args:
636
+ x (int): X座標。
637
+ y (int): Y座標。
638
+ z (int): Z座標。
639
+ cord (str): 座標の種類('', '^', '~')。
612
640
  """
613
- self.client.sendCall(self.uuid, "useItemX", [x, y, z])
641
+ self.client.sendCall(self.uuid, "useItemX", [x, y, z, cord])
614
642
  return str_to_bool(self.client.result)
615
643
 
616
644
  def harvest(self) -> bool :
@@ -648,11 +676,17 @@ class Entity:
648
676
  self.client.sendCall(self.uuid, "digDown")
649
677
  return str_to_bool(self.client.result)
650
678
 
651
- def digHere(self, x, y, z) -> bool :
679
+ def digX(self, x, y, z, cord) -> bool :
652
680
  """
653
- 自分を中心に指定した座標のブロックを壊す。
681
+ 指定した座標のブロックを壊す。
682
+
683
+ Args:
684
+ x (int): X座標。
685
+ y (int): Y座標。
686
+ z (int): Z座標。
687
+ cord (str): 座標の種類('', '^', '~')。
654
688
  """
655
- self.client.sendCall(self.uuid, "digX", [x, y, z])
689
+ self.client.sendCall(self.uuid, "digX", [x, y, z, cord])
656
690
  return str_to_bool(self.client.result)
657
691
 
658
692
  def action(self) -> bool :
@@ -719,7 +753,7 @@ class Entity:
719
753
  self.client.sendCall(self.uuid, "dropItem", [slot1])
720
754
  return str_to_bool(self.client.result)
721
755
 
722
- def holdItem(self, slot: int) -> bool :
756
+ def grabItem(self, slot: int) -> bool :
723
757
  """
724
758
  自分のインベントリのアイテムを手に持たせる。
725
759
 
@@ -738,18 +772,19 @@ class Entity:
738
772
  """
739
773
  self.client.sendCall(self.uuid, "sendChat", [message])
740
774
 
741
- def inspectHere(self, x: int, y: int, z: int) -> Block :
775
+ def inspectX(self, x: int, y: int, z: int, cord: str) -> Block :
742
776
  """
743
- 自分を中心に指定された座標のブロックを調べる。
777
+ 指定された座標のブロックを調べる。
744
778
 
745
779
  Args:
746
780
  x (int): X座標。
747
781
  y (int): Y座標。
748
782
  z (int): Z座標。
783
+ cord (str): 座標の種類('', '^', '~')。
749
784
  Returns:
750
785
  Block: 調べたブロックの情報。
751
786
  """
752
- self.client.sendCall(self.uuid, "inspect", [x, y, z])
787
+ self.client.sendCall(self.uuid, "inspect", [x, y, z, cord])
753
788
  block = Block(** json.loads(self.client.result))
754
789
  return block
755
790
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2hackCraft2
3
- Version: 1.0.14
3
+ Version: 1.0.16
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
@@ -8,6 +8,7 @@ Author-email: masafumi_t@0x48lab.com
8
8
  License: MIT
9
9
  Keywords: hackCraft2
10
10
  Description-Content-Type: text/markdown
11
+ Requires-Dist: websocket-client
11
12
 
12
13
  ## 概要
13
14
 
@@ -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.14",
8
+ version="1.0.16",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "websocket-client" # websocketライブラリの追加
File without changes
File without changes