diff --git a/.gitignore b/.gitignore index e2f00c67..eb7d4e89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ ### Java template -target/ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* @@ -28,7 +27,7 @@ hs_err_pid* *.iws # IntelliJ -/out/ +#/out/ # JIRA plugin atlassian-ide-plugin.xml @@ -56,6 +55,9 @@ tmp/ # Editor detritus *.vim -*.swp +#*.swp tags -.vscode \ No newline at end of file +.vscode +.idea/encodings.xml +.idea/modules.xml +#target/ diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 6a84cbee..00000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -raspberryjuice \ No newline at end of file diff --git a/.idea/artifacts/RaspberryJuice_jar.xml b/.idea/artifacts/RaspberryJuice_jar.xml new file mode 100644 index 00000000..b2f227a3 --- /dev/null +++ b/.idea/artifacts/RaspberryJuice_jar.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/target/artifacts/RaspberryJuice_jar + + + + + \ No newline at end of file diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index 376dffc8..00000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b25fe5e0..bf1a7cd0 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,11 +6,11 @@ - + - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 0bb1b7a2..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f..35eb1ddf 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 4737db3f..de0adf5e 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,183 @@ # RaspberryJuice -A Bukkit plugin which implements the Minecraft Pi Socket API. +A Minecraft Bukkit plugin which connect to python program ## Commands ### Commands supported - - world.get/setBlock - - world.getBlockWithData - - world.setBlocks - - world.getPlayerIds - - world.getBlocks - - chat.post - - events.clear - - events.block.hits - - player.getTile - - player.setTile - - player.getPos - - player.setPos - - world.getHeight - - entity.getTile - - entity.setTile - - entity.getPos - - entity.setPos +#### world + - world.getBlock(x:int, y:int, z:int) -> str + - Get the block of the input position + + + - world.getBlocks(x1:int, y1:int, z1:int, x2:int, y2:int, z2:int) -> list + - Get the blocks of the input position range + + + - world.setBlock(x:int, y:int, z:int, block:str) -> None: + - Set the block of the input position + + + - world.setBlocks(x1:int, y1:int, z1:int, x2:int, y2:int, z2:int, block) -> None: + - Set the blocks of the input position range + + + - world.getHeight(x:int, z:int) -> int: + - Get highest position y of the block + + + - world.getPlayerEntityIds() -> list: + - Get the list of server players'id + + + - world.postToChat(*msg) -> None: + -Print message to minecraft chat + + + - world.setSign(x:int, y:int, z:int, signType:str, signDir:int, line1:str="", line2:str="", line3:str="", line4:str="") -> None: + - Set the stand sign of the input position + + + - world.setWallSign(x:int, y:int, z:int, signType:str, signDir:int, line1="",line2="",line3="",line4="") -> None: + - Set the wall sign of the input position + + + - world.spawnEntity(x:int, y:int, z:int, entityID:int) -> int: + - Spawn a entity of the input position + + + - world.createExplosion(x:int, y:int, z:int, power:int=4) -> None: + - Create a explosion of the input position + + + - world.getPlayerEntityId(name:str) -> int: + - Get the entity ID of input name + + + - world.create(address = "localhost", port = 4711): + - Connect your python program to Raspberryjuice + + + --- + +#### player + - player.getPos() -> Vec3: + - Get player's float position + + + - player.setPos(x:float, y:float, z:float) -> None: + - Set player's position with float + + + - player.getTilePos() -> Vec3: + - Get player's integer position + + - player.setTilePos(x:int, y:int, z:int) -> None: + -Set player's integer position + + + - player.getDirection() -> Vec3: + - Get player's direction + + + - player.setDirection(x:float, y:float, z:float) -> None: + - Set player's direction + + + - player.getRotation() -> float: + - Get player's rotation + + + - player.setRotation(yaw:float) -> None: + - Set player's rotation + + + - player.getPitch() -> float: + - Get player's pitch + + + - player.setPitch(pitch) -> None: + - Set player's pitch + + + - player.getFoodLevel() -> int: + - Get player's food level + + +- player.setFoodLevel(foodLevel:int) -> None: + - Set player's food level + + +- player.getHealth() -> float: + - Get player's health + + +- player.setHealth(health:float) -> None: + - Set player's health + + + - player.sendTitle(title:str, subTitle:str="", fadeIn:int=10, stay:int=70, fadeOut:int=20) -> None: + - Send a title to player + + --- + +#### entity + - entity.getPos(ID) -> Vec3: + - Get specific entity's float position + + + - entity.setPos(ID, x:float, y:float, z:float) -> None: + - Set specific entity's position with float + + + - entity.getTilePos(ID) -> Vec3: + - Get specific entity's integer position + + + - entity.setTilePos(ID, x:int, y:int, z:int) -> None: + - Set specific entity's position with integer + + + - entity.getDirection(ID) -> Vec3: + - Get specific entity's direction + + + - entity.setDirection(ID, x:float, y:float, z:float) -> None: + - Set specific entity's direction + + + - entity.getRotation(ID) -> float: + - Get specific entity's rotation + + + - entity.setRotation(ID, yaw) -> float: + - Set specific entity's rotation + + + - entity.getPitch(ID) -> float: + - Get specific entity's pitch + + + - entity.setPitch(ID, pitch) -> None: + - Set specific entity's pitch + + + - entity.getName(ID): + - Get specific entity's name ### Commands that can't be supported - Camera angles - -### Extra commands - - - getBlocks(x1,y1,z1,x2,y2,z2) has been implemented - - getDirection, getRotation, getPitch functions - get the 'direction' players and entities are facing - - setDirection, setRotation, setPitch functions - set the 'direction' players and entities are facing - - getPlayerId(playerName) - get the entity of a player by name - - pollChatPosts() - get events back for posts to the chat - - setSign(x,y,z,block type id,data,line1,line2,line3,line4) - - Wall signs (id=68 or block.SIGN_WALL.id) require data for facing direction 2=north, 3=south, 4=west, 5=east - - Standing signs (id=63 or block.SIGN_STANDING.id) require data for facing rotation (0-15) 0=south, 4=west, 8=north, 12=east - - spawnEntity(x,y,z,entity) - creates an entity and returns its entity id. see entity.py for list. - - getEntityTypes - returns all the entities supported by the server. - - entity.getName(id) - get a player name for entity id. Reverse of getPlayerId(playerName) - -Note - extra features are NOT guaranteed to be maintained in future releases, particularly if updates are made to the original Pi API which replace the functionality - + ## Config Modify config.yml: - port: 4711 - the default tcp port can be changed in config.yml - - location: RELATIVE - determine whether locations are RELATIVE to the spawn point (default like pi) or ABSOLUTE + - location: ABSOLUTE - determine whether locations are RELATIVE to the spawn point or ABSOLUTE - hitclick: RIGHT - determine whether hit events are triggered by LEFT clicks, RIGHT clicks or BOTH -## Libraries - -To use the extra features an modded version of the java and python libraries that were originally supplied by Mojang with the Pi is required, [github.com/zhuowei/RaspberryJuice/tree/master/src/main/resources/mcpi](https://github.com/zhuowei/RaspberryJuice/tree/master/src/main/resources/mcpi). - -You only need the modded libraries to use the extra features, the original libraries supplied with Minecraft Pi edition still work, you just wont be able to use the extra features - ## Build To build RaspberryJuice, [download and install Maven](https://maven.apache.org/install.html), clone the repository, run `mvn package': @@ -70,6 +190,7 @@ mvn package ## Version history + - 1.14 - Modify the command, change the block number identity to block name. - 1.11 - spawnEntity, setDirection, setRotation, setPitch - 1.10.1 - bug fixes - 1.10 - left, right, both hit clicks added to config.yml & fixed minor hit events bug diff --git a/jars/raspberryjuice-1.1.1.jar b/jars/raspberryjuice-1.1.1.jar deleted file mode 100644 index af008161..00000000 Binary files a/jars/raspberryjuice-1.1.1.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.1.jar b/jars/raspberryjuice-1.1.jar deleted file mode 100644 index 3a82f9a0..00000000 Binary files a/jars/raspberryjuice-1.1.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.10.1.jar b/jars/raspberryjuice-1.10.1.jar deleted file mode 100644 index ff19ccb9..00000000 Binary files a/jars/raspberryjuice-1.10.1.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.10.jar b/jars/raspberryjuice-1.10.jar deleted file mode 100644 index b516779d..00000000 Binary files a/jars/raspberryjuice-1.10.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.11.jar b/jars/raspberryjuice-1.11.jar deleted file mode 100644 index fd9eae35..00000000 Binary files a/jars/raspberryjuice-1.11.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.2.jar b/jars/raspberryjuice-1.2.jar deleted file mode 100644 index e04aab83..00000000 Binary files a/jars/raspberryjuice-1.2.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.3.jar b/jars/raspberryjuice-1.3.jar deleted file mode 100644 index 77c9e5da..00000000 Binary files a/jars/raspberryjuice-1.3.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.4.1.jar b/jars/raspberryjuice-1.4.1.jar deleted file mode 100644 index 309ab39c..00000000 Binary files a/jars/raspberryjuice-1.4.1.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.4.2.jar b/jars/raspberryjuice-1.4.2.jar deleted file mode 100644 index d08c16b3..00000000 Binary files a/jars/raspberryjuice-1.4.2.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.4.jar b/jars/raspberryjuice-1.4.jar deleted file mode 100644 index 5529bc53..00000000 Binary files a/jars/raspberryjuice-1.4.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.5.jar b/jars/raspberryjuice-1.5.jar deleted file mode 100644 index 33e9fc03..00000000 Binary files a/jars/raspberryjuice-1.5.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.6.jar b/jars/raspberryjuice-1.6.jar deleted file mode 100644 index 75bc13a8..00000000 Binary files a/jars/raspberryjuice-1.6.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.7.jar b/jars/raspberryjuice-1.7.jar deleted file mode 100644 index 3ee78b7e..00000000 Binary files a/jars/raspberryjuice-1.7.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.8.jar b/jars/raspberryjuice-1.8.jar deleted file mode 100644 index 69f90885..00000000 Binary files a/jars/raspberryjuice-1.8.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.9.1.jar b/jars/raspberryjuice-1.9.1.jar deleted file mode 100644 index d5ced17e..00000000 Binary files a/jars/raspberryjuice-1.9.1.jar and /dev/null differ diff --git a/jars/raspberryjuice-1.9.jar b/jars/raspberryjuice-1.9.jar deleted file mode 100644 index b2b1b854..00000000 Binary files a/jars/raspberryjuice-1.9.jar and /dev/null differ diff --git a/out/example/ChickenFly.py b/out/example/ChickenFly.py new file mode 100644 index 00000000..f9e7fd32 --- /dev/null +++ b/out/example/ChickenFly.py @@ -0,0 +1,21 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() + +import random, time + +# Get player position +x,y,z = mc.player.getPos() + +# Spawn a chicken on player's position,and record the chicken's entity id +chicken = mc.spawnEntity(x, y, z, 93) + +for i in range(30): + # Get player position + x,y,z = mc.player.getPos() + # Add a random number on x and z position + x += random.uniform(-3, 3) + z += random.uniform(-3, 3) + # Teleport chicken + mc.entity.setPos(chicken, x, y+3, z) + # Sleep 0.5 seconds + time.sleep(0.5) \ No newline at end of file diff --git a/out/example/SwordExplode.py b/out/example/SwordExplode.py new file mode 100644 index 00000000..69d12bae --- /dev/null +++ b/out/example/SwordExplode.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Oct 1 21:31:06 2019 + +@author: Eric +""" + +from mcpi.minecraft import Minecraft +mc = Minecraft.create() + +while True: + # Get list of events + hitBlocks = mc.events.pollBlockHits() + # If events not None + if hitBlocks: + # Get the first event + hitBlock = hitBlocks[0] + # Get the event position + x,y,z = hitBlock.pos + # Create a explosion on the position + mc.createExplosion(x, y, z) \ No newline at end of file diff --git a/out/example/example1.py b/out/example/example1.py new file mode 100644 index 00000000..0b8a804b --- /dev/null +++ b/out/example/example1.py @@ -0,0 +1,6 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() + +x,y,z = mc.player.getTilePos() + +mc.createExplosion(x,y,z) \ No newline at end of file diff --git a/out/example/randomTeleport.py b/out/example/randomTeleport.py new file mode 100644 index 00000000..db8aef40 --- /dev/null +++ b/out/example/randomTeleport.py @@ -0,0 +1,12 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() + +import random + +# Random position +x = random.randrange(-1000, 1000) +z = random.randrange(-1000, 1000) +y = mc.getHeight(x, z) + +# Teleport player +mc.player.setTilePos(x, y, z) diff --git a/out/example/setSingOnPlayerPos.py b/out/example/setSingOnPlayerPos.py new file mode 100644 index 00000000..496c997f --- /dev/null +++ b/out/example/setSingOnPlayerPos.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Oct 2 22:32:11 2019 + +@author: Eric +""" + +from mcpi.minecraft import Minecraft +mc = Minecraft.create() + +# Get player position +x,y,z = mc.player.getTilePos() +# Set a BIRCH_SIGN +mc.setSign(x,y,z, "BIRCH_SIGN", 0, "Hi", "I'm", "MinecraftDawn") \ No newline at end of file diff --git a/out/jar/RaspberryJuice.jar b/out/jar/RaspberryJuice.jar new file mode 100644 index 00000000..27bfb264 Binary files /dev/null and b/out/jar/RaspberryJuice.jar differ diff --git a/out/javadoc/allclasses-frame.html b/out/javadoc/allclasses-frame.html new file mode 100644 index 00000000..b8be34fc --- /dev/null +++ b/out/javadoc/allclasses-frame.html @@ -0,0 +1,28 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/out/javadoc/allclasses-noframe.html b/out/javadoc/allclasses-noframe.html new file mode 100644 index 00000000..bd157e90 --- /dev/null +++ b/out/javadoc/allclasses-noframe.html @@ -0,0 +1,28 @@ + + + + + +All Classes + + + + + +

All Classes

+ + + diff --git a/out/javadoc/constant-values.html b/out/javadoc/constant-values.html new file mode 100644 index 00000000..85ea9d87 --- /dev/null +++ b/out/javadoc/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values + + + + + + + + + + + +
+

Constant Field Values

+

Contents

+
+ + + + + + diff --git a/out/javadoc/deprecated-list.html b/out/javadoc/deprecated-list.html new file mode 100644 index 00000000..3201d350 --- /dev/null +++ b/out/javadoc/deprecated-list.html @@ -0,0 +1,122 @@ + + + + + +Deprecated List + + + + + + + + +
+ + + + + + + +
+ + +
+

Deprecated API

+

Contents

+
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/help-doc.html b/out/javadoc/help-doc.html new file mode 100644 index 00000000..dc375f74 --- /dev/null +++ b/out/javadoc/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help + + + + + + + + +
+ + + + + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-1.html b/out/javadoc/index-files/index-1.html new file mode 100644 index 00000000..d691b318 --- /dev/null +++ b/out/javadoc/index-files/index-1.html @@ -0,0 +1,135 @@ + + + + + +B-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

B

+
+
bindAddress - Variable in class net.zhuoweizhang.raspberryjuice.ServerListenerThread
+
 
+
blockBreakDetectionTools - Static variable in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
blockFaceToNotch(BlockFace) - Static method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
+
from CraftBukkit's org.bukkit.craftbukkit.block.CraftBlock.blockFactToNotch
+
+
blockLocationToRelative(Location) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-10.html b/out/javadoc/index-files/index-10.html new file mode 100644 index 00000000..6cf5b843 --- /dev/null +++ b/out/javadoc/index-files/index-10.html @@ -0,0 +1,133 @@ + + + + + +O-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

O

+
+
onChatPosted(AsyncPlayerChatEvent) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
onDisable() - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
onEnable() - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
onPlayerInteract(PlayerInteractEvent) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-11.html b/out/javadoc/index-files/index-11.html new file mode 100644 index 00000000..901605d0 --- /dev/null +++ b/out/javadoc/index-files/index-11.html @@ -0,0 +1,137 @@ + + + + + +P-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

P

+
+
parseRelativeBlockLocation(String, String, String) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
parseRelativeBlockLocation(String, String, String, float, float) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
parseRelativeLocation(String, String, String) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
parseRelativeLocation(String, String, String, float, float) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
pendingRemoval - Variable in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
plugin - Variable in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-12.html b/out/javadoc/index-files/index-12.html new file mode 100644 index 00000000..d13c231d --- /dev/null +++ b/out/javadoc/index-files/index-12.html @@ -0,0 +1,129 @@ + + + + + +Q-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

Q

+
+
queueChatPostedEvent(AsyncPlayerChatEvent) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
queuePlayerInteractEvent(PlayerInteractEvent) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-13.html b/out/javadoc/index-files/index-13.html new file mode 100644 index 00000000..149b4342 --- /dev/null +++ b/out/javadoc/index-files/index-13.html @@ -0,0 +1,139 @@ + + + + + +R-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

R

+
+
RaspberryJuicePlugin - Class in net.zhuoweizhang.raspberryjuice
+
 
+
RaspberryJuicePlugin() - Constructor for class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
RemoteSession - Class in net.zhuoweizhang.raspberryjuice
+
 
+
RemoteSession(RaspberryJuicePlugin, Socket) - Constructor for class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
run() - Method in class net.zhuoweizhang.raspberryjuice.ServerListenerThread
+
 
+
running - Variable in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
running - Variable in class net.zhuoweizhang.raspberryjuice.ServerListenerThread
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-14.html b/out/javadoc/index-files/index-14.html new file mode 100644 index 00000000..c18accaa --- /dev/null +++ b/out/javadoc/index-files/index-14.html @@ -0,0 +1,143 @@ + + + + + +S-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

S

+
+
send(Object) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
send(String) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
ServerListenerThread - Class in net.zhuoweizhang.raspberryjuice
+
 
+
ServerListenerThread(RaspberryJuicePlugin, SocketAddress) - Constructor for class net.zhuoweizhang.raspberryjuice.ServerListenerThread
+
 
+
serverSocket - Variable in class net.zhuoweizhang.raspberryjuice.ServerListenerThread
+
 
+
serverThread - Variable in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
sessions - Variable in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
setOrigin(Location) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
startThreads() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-15.html b/out/javadoc/index-files/index-15.html new file mode 100644 index 00000000..be99c071 --- /dev/null +++ b/out/javadoc/index-files/index-15.html @@ -0,0 +1,129 @@ + + + + + +T-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

T

+
+
tick() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
+
called from the server main thread
+
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-16.html b/out/javadoc/index-files/index-16.html new file mode 100644 index 00000000..3c11b4dd --- /dev/null +++ b/out/javadoc/index-files/index-16.html @@ -0,0 +1,143 @@ + + + + + +V-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

V

+
+
valueOf(String) - Static method in enum net.zhuoweizhang.raspberryjuice.HitClickType
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum net.zhuoweizhang.raspberryjuice.LocationType
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum net.zhuoweizhang.raspberryjuice.HitClickType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum net.zhuoweizhang.raspberryjuice.LocationType
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-2.html b/out/javadoc/index-files/index-2.html new file mode 100644 index 00000000..22d15f38 --- /dev/null +++ b/out/javadoc/index-files/index-2.html @@ -0,0 +1,153 @@ + + + + + +C-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

C

+
+
chatPostedQueue - Variable in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
checkBanned(RemoteSession) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
close() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
CmdEntity - Class in net.zhuoweizhang.raspberryjuice.cmd
+
 
+
CmdEntity(RemoteSession) - Constructor for class net.zhuoweizhang.raspberryjuice.cmd.CmdEntity
+
 
+
CmdEvent - Class in net.zhuoweizhang.raspberryjuice.cmd
+
 
+
CmdEvent(RemoteSession) - Constructor for class net.zhuoweizhang.raspberryjuice.cmd.CmdEvent
+
 
+
CmdPlayer - Class in net.zhuoweizhang.raspberryjuice.cmd
+
 
+
CmdPlayer(RemoteSession) - Constructor for class net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer
+
 
+
CmdWorld - Class in net.zhuoweizhang.raspberryjuice.cmd
+
 
+
CmdWorld(RemoteSession) - Constructor for class net.zhuoweizhang.raspberryjuice.cmd.CmdWorld
+
 
+
createCmdObject() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
CustomBlockFace - Class in net.zhuoweizhang.raspberryjuice
+
 
+
CustomBlockFace() - Constructor for class net.zhuoweizhang.raspberryjuice.CustomBlockFace
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-3.html b/out/javadoc/index-files/index-3.html new file mode 100644 index 00000000..ce539726 --- /dev/null +++ b/out/javadoc/index-files/index-3.html @@ -0,0 +1,133 @@ + + + + + +E-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

E

+
+
execute(String, String[]) - Method in class net.zhuoweizhang.raspberryjuice.cmd.CmdEntity
+
 
+
execute(String, String[]) - Method in class net.zhuoweizhang.raspberryjuice.cmd.CmdEvent
+
 
+
execute(String, String[]) - Method in class net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer
+
 
+
execute(World, String, String[]) - Method in class net.zhuoweizhang.raspberryjuice.cmd.CmdWorld
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-4.html b/out/javadoc/index-files/index-4.html new file mode 100644 index 00000000..f5ac5c43 --- /dev/null +++ b/out/javadoc/index-files/index-4.html @@ -0,0 +1,143 @@ + + + + + +G-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

G

+
+
getCurrentPlayer() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
getEntity(int) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
getHitClickType() - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
getHostPlayer() - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
getLocationType() - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
getNamedPlayer(String) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
getOrigin() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
getSignValueOf(String) - Static method in class net.zhuoweizhang.raspberryjuice.CustomBlockFace
+
 
+
getSocket() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-5.html b/out/javadoc/index-files/index-5.html new file mode 100644 index 00000000..fce3e3df --- /dev/null +++ b/out/javadoc/index-files/index-5.html @@ -0,0 +1,140 @@ + + + + + +H-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

H

+
+
handleCommand(String, String[]) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
handleConnection(RemoteSession) - Method in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
+
called when a new session is established.
+
+
handleLine(String) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
HitClickType - Enum in net.zhuoweizhang.raspberryjuice
+
+
Config option to determine whether hit events are triggered by LEFT clicks, RIGHT clicks (like the Pi) or BOTH + Set in the config.yml.
+
+
hostPlayer - Variable in class net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-6.html b/out/javadoc/index-files/index-6.html new file mode 100644 index 00000000..2206fac0 --- /dev/null +++ b/out/javadoc/index-files/index-6.html @@ -0,0 +1,129 @@ + + + + + +I-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

I

+
+
init() - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
interactEventQueue - Variable in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-7.html b/out/javadoc/index-files/index-7.html new file mode 100644 index 00000000..b77c73fd --- /dev/null +++ b/out/javadoc/index-files/index-7.html @@ -0,0 +1,127 @@ + + + + + +K-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

K

+
+
kick(String) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-8.html b/out/javadoc/index-files/index-8.html new file mode 100644 index 00000000..3c1320c5 --- /dev/null +++ b/out/javadoc/index-files/index-8.html @@ -0,0 +1,132 @@ + + + + + +L-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

L

+
+
locationToRelative(Location) - Method in class net.zhuoweizhang.raspberryjuice.RemoteSession
+
 
+
LocationType - Enum in net.zhuoweizhang.raspberryjuice
+
+
Config option to determine whether locations are relative to the spawn point (default like pi) or absolute + Set in the config.yml.
+
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index-files/index-9.html b/out/javadoc/index-files/index-9.html new file mode 100644 index 00000000..fd065532 --- /dev/null +++ b/out/javadoc/index-files/index-9.html @@ -0,0 +1,129 @@ + + + + + +N-Index + + + + + + + + +
+ + + + + + + +
+ + +
B C E G H I K L N O P Q R S T V  + + +

N

+
+
net.zhuoweizhang.raspberryjuice - package net.zhuoweizhang.raspberryjuice
+
 
+
net.zhuoweizhang.raspberryjuice.cmd - package net.zhuoweizhang.raspberryjuice.cmd
+
 
+
+B C E G H I K L N O P Q R S T V 
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/index.html b/out/javadoc/index.html new file mode 100644 index 00000000..0e000bb9 --- /dev/null +++ b/out/javadoc/index.html @@ -0,0 +1,75 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/CustomBlockFace.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/CustomBlockFace.html new file mode 100644 index 00000000..80962636 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/CustomBlockFace.html @@ -0,0 +1,269 @@ + + + + + +CustomBlockFace + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Class CustomBlockFace

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.CustomBlockFace
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CustomBlockFace
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      CustomBlockFace() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static org.bukkit.block.BlockFacegetSignValueOf(java.lang.String str) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CustomBlockFace

        +
        public CustomBlockFace()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getSignValueOf

        +
        public static org.bukkit.block.BlockFace getSignValueOf(java.lang.String str)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/HitClickType.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/HitClickType.html new file mode 100644 index 00000000..6f7d6bc1 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/HitClickType.html @@ -0,0 +1,353 @@ + + + + + +HitClickType + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Enum HitClickType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<HitClickType>
    • +
    • +
        +
      • net.zhuoweizhang.raspberryjuice.HitClickType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<HitClickType>
    +
    +
    +
    +
    public enum HitClickType
    +extends java.lang.Enum<HitClickType>
    +
    Config option to determine whether hit events are triggered by LEFT clicks, RIGHT clicks (like the Pi) or BOTH + Set in the config.yml.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      BOTH 
      LEFT 
      RIGHT 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static HitClickTypevalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static HitClickType[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static HitClickType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (HitClickType c : HitClickType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static HitClickType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/LocationType.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/LocationType.html new file mode 100644 index 00000000..80ec9c87 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/LocationType.html @@ -0,0 +1,341 @@ + + + + + +LocationType + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Enum LocationType

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • java.lang.Enum<LocationType>
    • +
    • +
        +
      • net.zhuoweizhang.raspberryjuice.LocationType
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable, java.lang.Comparable<LocationType>
    +
    +
    +
    +
    public enum LocationType
    +extends java.lang.Enum<LocationType>
    +
    Config option to determine whether locations are relative to the spawn point (default like pi) or absolute + Set in the config.yml.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Enum Constant Summary

      + + + + + + + + + + + +
      Enum Constants 
      Enum Constant and Description
      ABSOLUTE 
      RELATIVE 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static LocationTypevalueOf(java.lang.String name) +
      Returns the enum constant of this type with the specified name.
      +
      static LocationType[]values() +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Enum

        +clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        values

        +
        public static LocationType[] values()
        +
        Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
        +for (LocationType c : LocationType.values())
        +    System.out.println(c);
        +
        +
        +
        Returns:
        +
        an array containing the constants of this enum type, in the order they are declared
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static LocationType valueOf(java.lang.String name)
        +
        Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        +
        java.lang.NullPointerException - if the argument is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.html new file mode 100644 index 00000000..14148597 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.html @@ -0,0 +1,518 @@ + + + + + +RaspberryJuicePlugin + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Class RaspberryJuicePlugin

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.bukkit.plugin.PluginBase
    • +
    • +
        +
      • org.bukkit.plugin.java.JavaPlugin
      • +
      • +
          +
        • net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.event.Listener, org.bukkit.plugin.Plugin
    +
    +
    +
    +
    public class RaspberryJuicePlugin
    +extends org.bukkit.plugin.java.JavaPlugin
    +implements org.bukkit.event.Listener
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleancheckBanned(RemoteSession session) 
      org.bukkit.entity.EntitygetEntity(int id) 
      HitClickTypegetHitClickType() 
      org.bukkit.entity.PlayergetHostPlayer() 
      LocationTypegetLocationType() 
      org.bukkit.entity.PlayergetNamedPlayer(java.lang.String name) 
      voidhandleConnection(RemoteSession newSession) +
      called when a new session is established.
      +
      voidonChatPosted(org.bukkit.event.player.AsyncPlayerChatEvent event) 
      voidonDisable() 
      voidonEnable() 
      voidonPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) 
      +
        +
      • + + +

        Methods inherited from class org.bukkit.plugin.java.JavaPlugin

        +getClassLoader, getCommand, getConfig, getDataFolder, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onLoad, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString
      • +
      +
        +
      • + + +

        Methods inherited from class org.bukkit.plugin.PluginBase

        +equals, getName, hashCode
      • +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        blockBreakDetectionTools

        +
        public static final java.util.Set<org.bukkit.Material> blockBreakDetectionTools
        +
      • +
      + + + + + + + + + + + +
        +
      • +

        hostPlayer

        +
        public org.bukkit.entity.Player hostPlayer
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        RaspberryJuicePlugin

        +
        public RaspberryJuicePlugin()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getLocationType

        +
        public LocationType getLocationType()
        +
      • +
      + + + +
        +
      • +

        getHitClickType

        +
        public HitClickType getHitClickType()
        +
      • +
      + + + +
        +
      • +

        onEnable

        +
        public void onEnable()
        +
        +
        Specified by:
        +
        onEnable in interface org.bukkit.plugin.Plugin
        +
        Overrides:
        +
        onEnable in class org.bukkit.plugin.java.JavaPlugin
        +
        +
      • +
      + + + +
        +
      • +

        onPlayerInteract

        +
        public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
        +
      • +
      + + + +
        +
      • +

        onChatPosted

        +
        public void onChatPosted(org.bukkit.event.player.AsyncPlayerChatEvent event)
        +
      • +
      + + + +
        +
      • +

        handleConnection

        +
        public void handleConnection(RemoteSession newSession)
        +
        called when a new session is established.
        +
      • +
      + + + +
        +
      • +

        getNamedPlayer

        +
        public org.bukkit.entity.Player getNamedPlayer(java.lang.String name)
        +
      • +
      + + + +
        +
      • +

        getHostPlayer

        +
        public org.bukkit.entity.Player getHostPlayer()
        +
      • +
      + + + +
        +
      • +

        getEntity

        +
        public org.bukkit.entity.Entity getEntity(int id)
        +
      • +
      + + + +
        +
      • +

        checkBanned

        +
        public boolean checkBanned(RemoteSession session)
        +
      • +
      + + + +
        +
      • +

        onDisable

        +
        public void onDisable()
        +
        +
        Specified by:
        +
        onDisable in interface org.bukkit.plugin.Plugin
        +
        Overrides:
        +
        onDisable in class org.bukkit.plugin.java.JavaPlugin
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/RemoteSession.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/RemoteSession.html new file mode 100644 index 00000000..8019b76e --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/RemoteSession.html @@ -0,0 +1,687 @@ + + + + + +RemoteSession + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Class RemoteSession

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.RemoteSession
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class RemoteSession
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + + + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static intblockFaceToNotch(org.bukkit.block.BlockFace face) +
      from CraftBukkit's org.bukkit.craftbukkit.block.CraftBlock.blockFactToNotch
      +
      java.lang.StringblockLocationToRelative(org.bukkit.Location loc) 
      voidclose() 
      voidcreateCmdObject() 
      org.bukkit.entity.PlayergetCurrentPlayer() 
      org.bukkit.LocationgetOrigin() 
      java.net.SocketgetSocket() 
      protected voidhandleCommand(java.lang.String c, + java.lang.String[] args) 
      protected voidhandleLine(java.lang.String line) 
      voidinit() 
      voidkick(java.lang.String reason) 
      java.lang.StringlocationToRelative(org.bukkit.Location loc) 
      org.bukkit.LocationparseRelativeBlockLocation(java.lang.String xstr, + java.lang.String ystr, + java.lang.String zstr) 
      org.bukkit.LocationparseRelativeBlockLocation(java.lang.String xstr, + java.lang.String ystr, + java.lang.String zstr, + float pitch, + float yaw) 
      org.bukkit.LocationparseRelativeLocation(java.lang.String xstr, + java.lang.String ystr, + java.lang.String zstr) 
      org.bukkit.LocationparseRelativeLocation(java.lang.String xstr, + java.lang.String ystr, + java.lang.String zstr, + float pitch, + float yaw) 
      voidqueueChatPostedEvent(org.bukkit.event.player.AsyncPlayerChatEvent event) 
      voidqueuePlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent event) 
      voidsend(java.lang.Object a) 
      voidsend(java.lang.String a) 
      voidsetOrigin(org.bukkit.Location origin) 
      protected voidstartThreads() 
      voidtick() +
      called from the server main thread
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        running

        +
        public boolean running
        +
      • +
      + + + +
        +
      • +

        pendingRemoval

        +
        public boolean pendingRemoval
        +
      • +
      + + + + + + + +
        +
      • +

        interactEventQueue

        +
        public java.util.ArrayDeque<org.bukkit.event.player.PlayerInteractEvent> interactEventQueue
        +
      • +
      + + + +
        +
      • +

        chatPostedQueue

        +
        public java.util.ArrayDeque<org.bukkit.event.player.AsyncPlayerChatEvent> chatPostedQueue
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        RemoteSession

        +
        public RemoteSession(RaspberryJuicePlugin plugin,
        +                     java.net.Socket socket)
        +              throws java.io.IOException
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        init

        +
        public void init()
        +          throws java.io.IOException
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      + + + +
        +
      • +

        createCmdObject

        +
        public void createCmdObject()
        +
      • +
      + + + +
        +
      • +

        startThreads

        +
        protected void startThreads()
        +
      • +
      + + + +
        +
      • +

        getOrigin

        +
        public org.bukkit.Location getOrigin()
        +
      • +
      + + + +
        +
      • +

        setOrigin

        +
        public void setOrigin(org.bukkit.Location origin)
        +
      • +
      + + + +
        +
      • +

        getSocket

        +
        public java.net.Socket getSocket()
        +
      • +
      + + + +
        +
      • +

        queuePlayerInteractEvent

        +
        public void queuePlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent event)
        +
      • +
      + + + +
        +
      • +

        queueChatPostedEvent

        +
        public void queueChatPostedEvent(org.bukkit.event.player.AsyncPlayerChatEvent event)
        +
      • +
      + + + +
        +
      • +

        tick

        +
        public void tick()
        +
        called from the server main thread
        +
      • +
      + + + +
        +
      • +

        handleLine

        +
        protected void handleLine(java.lang.String line)
        +
      • +
      + + + +
        +
      • +

        handleCommand

        +
        protected void handleCommand(java.lang.String c,
        +                             java.lang.String[] args)
        +
      • +
      + + + +
        +
      • +

        getCurrentPlayer

        +
        public org.bukkit.entity.Player getCurrentPlayer()
        +
      • +
      + + + +
        +
      • +

        parseRelativeBlockLocation

        +
        public org.bukkit.Location parseRelativeBlockLocation(java.lang.String xstr,
        +                                                      java.lang.String ystr,
        +                                                      java.lang.String zstr)
        +
      • +
      + + + +
        +
      • +

        parseRelativeLocation

        +
        public org.bukkit.Location parseRelativeLocation(java.lang.String xstr,
        +                                                 java.lang.String ystr,
        +                                                 java.lang.String zstr)
        +
      • +
      + + + +
        +
      • +

        parseRelativeBlockLocation

        +
        public org.bukkit.Location parseRelativeBlockLocation(java.lang.String xstr,
        +                                                      java.lang.String ystr,
        +                                                      java.lang.String zstr,
        +                                                      float pitch,
        +                                                      float yaw)
        +
      • +
      + + + +
        +
      • +

        parseRelativeLocation

        +
        public org.bukkit.Location parseRelativeLocation(java.lang.String xstr,
        +                                                 java.lang.String ystr,
        +                                                 java.lang.String zstr,
        +                                                 float pitch,
        +                                                 float yaw)
        +
      • +
      + + + +
        +
      • +

        blockLocationToRelative

        +
        public java.lang.String blockLocationToRelative(org.bukkit.Location loc)
        +
      • +
      + + + +
        +
      • +

        locationToRelative

        +
        public java.lang.String locationToRelative(org.bukkit.Location loc)
        +
      • +
      + + + +
        +
      • +

        send

        +
        public void send(java.lang.Object a)
        +
      • +
      + + + +
        +
      • +

        send

        +
        public void send(java.lang.String a)
        +
      • +
      + + + +
        +
      • +

        close

        +
        public void close()
        +
      • +
      + + + +
        +
      • +

        kick

        +
        public void kick(java.lang.String reason)
        +
      • +
      + + + +
        +
      • +

        blockFaceToNotch

        +
        public static int blockFaceToNotch(org.bukkit.block.BlockFace face)
        +
        from CraftBukkit's org.bukkit.craftbukkit.block.CraftBlock.blockFactToNotch
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/ServerListenerThread.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/ServerListenerThread.html new file mode 100644 index 00000000..355e6063 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/ServerListenerThread.html @@ -0,0 +1,347 @@ + + + + + +ServerListenerThread + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice
+

Class ServerListenerThread

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.ServerListenerThread
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.lang.Runnable
    +
    +
    +
    +
    public class ServerListenerThread
    +extends java.lang.Object
    +implements java.lang.Runnable
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      java.net.SocketAddressbindAddress 
      booleanrunning 
      java.net.ServerSocketserverSocket 
      +
    • +
    + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidrun() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        serverSocket

        +
        public java.net.ServerSocket serverSocket
        +
      • +
      + + + +
        +
      • +

        bindAddress

        +
        public java.net.SocketAddress bindAddress
        +
      • +
      + + + +
        +
      • +

        running

        +
        public boolean running
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ServerListenerThread

        +
        public ServerListenerThread(RaspberryJuicePlugin plugin,
        +                            java.net.SocketAddress bindAddress)
        +                     throws java.io.IOException
        +
        +
        Throws:
        +
        java.io.IOException
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        run

        +
        public void run()
        +
        +
        Specified by:
        +
        run in interface java.lang.Runnable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.html new file mode 100644 index 00000000..7bec6f8d --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.html @@ -0,0 +1,271 @@ + + + + + +CmdEntity + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice.cmd
+

Class CmdEntity

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEntity
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CmdEntity
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidexecute(java.lang.String command, + java.lang.String[] args) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        execute

        +
        public void execute(java.lang.String command,
        +                    java.lang.String[] args)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.html new file mode 100644 index 00000000..27c2ab10 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.html @@ -0,0 +1,271 @@ + + + + + +CmdEvent + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice.cmd
+

Class CmdEvent

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEvent
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CmdEvent
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidexecute(java.lang.String command, + java.lang.String[] args) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        execute

        +
        public void execute(java.lang.String command,
        +                    java.lang.String[] args)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.html new file mode 100644 index 00000000..7d2c7aca --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.html @@ -0,0 +1,271 @@ + + + + + +CmdPlayer + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice.cmd
+

Class CmdPlayer

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CmdPlayer
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidexecute(java.lang.String command, + java.lang.String[] args) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        execute

        +
        public void execute(java.lang.String command,
        +                    java.lang.String[] args)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.html new file mode 100644 index 00000000..0d13d024 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.html @@ -0,0 +1,273 @@ + + + + + +CmdWorld + + + + + + + + + + + + +
+
net.zhuoweizhang.raspberryjuice.cmd
+

Class CmdWorld

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdWorld
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CmdWorld
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidexecute(org.bukkit.World world, + java.lang.String command, + java.lang.String[] args) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        execute

        +
        public void execute(org.bukkit.World world,
        +                    java.lang.String command,
        +                    java.lang.String[] args)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-frame.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-frame.html new file mode 100644 index 00000000..b45fa9b1 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-frame.html @@ -0,0 +1,23 @@ + + + + + +net.zhuoweizhang.raspberryjuice.cmd + + + + + +

net.zhuoweizhang.raspberryjuice.cmd

+
+

Classes

+ +
+ + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-summary.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-summary.html new file mode 100644 index 00000000..6d664c21 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-summary.html @@ -0,0 +1,152 @@ + + + + + +net.zhuoweizhang.raspberryjuice.cmd + + + + + + + + + + + +
+

Package net.zhuoweizhang.raspberryjuice.cmd

+
+
+ +
+ + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-tree.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-tree.html new file mode 100644 index 00000000..878ea299 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/cmd/package-tree.html @@ -0,0 +1,138 @@ + + + + + +net.zhuoweizhang.raspberryjuice.cmd Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package net.zhuoweizhang.raspberryjuice.cmd

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEntity
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEvent
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdWorld
    • +
    +
  • +
+
+ + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/package-frame.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-frame.html new file mode 100644 index 00000000..30e6f572 --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-frame.html @@ -0,0 +1,28 @@ + + + + + +net.zhuoweizhang.raspberryjuice + + + + + +

net.zhuoweizhang.raspberryjuice

+ + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/package-summary.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-summary.html new file mode 100644 index 00000000..bd4e7f7c --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-summary.html @@ -0,0 +1,177 @@ + + + + + +net.zhuoweizhang.raspberryjuice + + + + + + + + + + + +
+

Package net.zhuoweizhang.raspberryjuice

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    CustomBlockFace 
    RaspberryJuicePlugin 
    RemoteSession 
    ServerListenerThread 
    +
  • +
  • + + + + + + + + + + + + + + + + +
    Enum Summary 
    EnumDescription
    HitClickType +
    Config option to determine whether hit events are triggered by LEFT clicks, RIGHT clicks (like the Pi) or BOTH + Set in the config.yml.
    +
    LocationType +
    Config option to determine whether locations are relative to the spawn point (default like pi) or absolute + Set in the config.yml.
    +
    +
  • +
+
+ + + + + + diff --git a/out/javadoc/net/zhuoweizhang/raspberryjuice/package-tree.html b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-tree.html new file mode 100644 index 00000000..81be78cd --- /dev/null +++ b/out/javadoc/net/zhuoweizhang/raspberryjuice/package-tree.html @@ -0,0 +1,159 @@ + + + + + +net.zhuoweizhang.raspberryjuice Class Hierarchy + + + + + + + + + + + +
+

Hierarchy For Package net.zhuoweizhang.raspberryjuice

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • net.zhuoweizhang.raspberryjuice.CustomBlockFace
    • +
    • org.bukkit.plugin.PluginBase (implements org.bukkit.plugin.Plugin) +
        +
      • org.bukkit.plugin.java.JavaPlugin + +
      • +
      +
    • +
    • net.zhuoweizhang.raspberryjuice.RemoteSession
    • +
    • net.zhuoweizhang.raspberryjuice.ServerListenerThread (implements java.lang.Runnable)
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ + + + + + diff --git a/out/javadoc/overview-frame.html b/out/javadoc/overview-frame.html new file mode 100644 index 00000000..bacfaf21 --- /dev/null +++ b/out/javadoc/overview-frame.html @@ -0,0 +1,22 @@ + + + + + +Overview List + + + + + + + +

 

+ + diff --git a/out/javadoc/overview-summary.html b/out/javadoc/overview-summary.html new file mode 100644 index 00000000..2278eb9a --- /dev/null +++ b/out/javadoc/overview-summary.html @@ -0,0 +1,137 @@ + + + + + +Overview + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + +
Packages 
PackageDescription
net.zhuoweizhang.raspberryjuice 
net.zhuoweizhang.raspberryjuice.cmd 
+
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/overview-tree.html b/out/javadoc/overview-tree.html new file mode 100644 index 00000000..eec5a584 --- /dev/null +++ b/out/javadoc/overview-tree.html @@ -0,0 +1,164 @@ + + + + + +Class Hierarchy + + + + + + + + +
+ + + + + + + +
+ + +
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEntity
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdEvent
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer
    • +
    • net.zhuoweizhang.raspberryjuice.cmd.CmdWorld
    • +
    • net.zhuoweizhang.raspberryjuice.CustomBlockFace
    • +
    • org.bukkit.plugin.PluginBase (implements org.bukkit.plugin.Plugin) +
        +
      • org.bukkit.plugin.java.JavaPlugin + +
      • +
      +
    • +
    • net.zhuoweizhang.raspberryjuice.RemoteSession
    • +
    • net.zhuoweizhang.raspberryjuice.ServerListenerThread (implements java.lang.Runnable)
    • +
    +
  • +
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    • +
    +
  • +
+
+ +
+ + + + + + + +
+ + + + diff --git a/out/javadoc/package-list b/out/javadoc/package-list new file mode 100644 index 00000000..bfcc9c0a --- /dev/null +++ b/out/javadoc/package-list @@ -0,0 +1,2 @@ +net.zhuoweizhang.raspberryjuice +net.zhuoweizhang.raspberryjuice.cmd diff --git a/out/javadoc/script.js b/out/javadoc/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/out/javadoc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/out/javadoc/stylesheet.css b/out/javadoc/stylesheet.css new file mode 100644 index 00000000..98055b22 --- /dev/null +++ b/out/javadoc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/__init__.py b/out/mcpi/__init__.py similarity index 100% rename from src/main/resources/mcpi/api/python/modded/mcpi/__init__.py rename to out/mcpi/__init__.py diff --git a/src/main/resources/mcpi/api/python/original/mcpi/block.py b/out/mcpi/block.py similarity index 100% rename from src/main/resources/mcpi/api/python/original/mcpi/block.py rename to out/mcpi/block.py diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/connection.py b/out/mcpi/connection.py similarity index 90% rename from src/main/resources/mcpi/api/python/modded/mcpi/connection.py rename to out/mcpi/connection.py index ab078e88..dd337bd4 100644 --- a/src/main/resources/mcpi/api/python/modded/mcpi/connection.py +++ b/out/mcpi/connection.py @@ -53,8 +53,9 @@ def _send(self, s): def receive(self): """Receives data. Note that the trailing newline '\n' is trimmed""" s = self.socket.makefile("r").readline().rstrip("\n") - if s == Connection.RequestFailed: - raise RequestError("%s failed"%self.lastSent.strip()) + checkFail = s.split(",") + if checkFail[0] == Connection.RequestFailed: + raise RequestError("%s failed! Cause: %s" % (self.lastSent.strip(),checkFail[-1])) return s def sendReceive(self, *data): diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/entity.py b/out/mcpi/entity.py similarity index 100% rename from src/main/resources/mcpi/api/python/modded/mcpi/entity.py rename to out/mcpi/entity.py diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/event.py b/out/mcpi/event.py similarity index 94% rename from src/main/resources/mcpi/api/python/modded/mcpi/event.py rename to out/mcpi/event.py index ccf023bd..436cfa1b 100644 --- a/src/main/resources/mcpi/api/python/modded/mcpi/event.py +++ b/out/mcpi/event.py @@ -41,5 +41,4 @@ def __repr__(self): @staticmethod def Post(entityId, message): - return ChatEvent(ChatEvent.POST, entityId, message) - + return ChatEvent(ChatEvent.POST, entityId, message) \ No newline at end of file diff --git a/out/mcpi/minecraft.py b/out/mcpi/minecraft.py new file mode 100644 index 00000000..df8422c7 --- /dev/null +++ b/out/mcpi/minecraft.py @@ -0,0 +1,323 @@ +from .connection import Connection +from .vec3 import Vec3 +from .event import BlockEvent, ChatEvent +#from .entity import Entity +#from .block import Block +from .util import flatten +from warnings import warn + +""" Minecraft PI low level api v0.1_1 + + Note: many methods have the parameter *arg. This solution makes it + simple to allow different types, and variable number of arguments. + The actual magic is a mix of flatten_parameters() and __iter__. Example: + A Cube class could implement __iter__ to work in Minecraft.setBlocks(c, id). + + (Because of this, it's possible to "erase" arguments. CmdPlayer removes + entityId, by injecting [] that flattens to nothing) + + @author: Aron Nieminen, Mojang AB""" + + +def intFloor(*args): + return [int(x) for x in flatten(args)] + +class CmdPositioner: + """Methods for setting and getting positions""" + def __init__(self, connection, packagePrefix): + self.conn = connection + self.pkg = packagePrefix + + def getPos(self, ID) -> Vec3: + """Get entity position (entityId:int) => Vec3""" + s = self.conn.sendReceive(self.pkg + b".getPos", ID) + return Vec3(*list(map(float, s.split(",")))) + + def setPos(self, ID, x:float, y:float, z:float) -> None: + """Set entity position (entityId:int, x,y,z)""" + self.conn.send(self.pkg + b".setPos", ID, x, y, z) + + def getTilePos(self, ID) -> Vec3: + """Get entity tile position (entityId:int) => Vec3""" + s = self.conn.sendReceive(self.pkg + b".getTile", ID) + return Vec3(*list(map(int, s.split(",")))) + + def setTilePos(self, ID, x:int, y:int, z:int) -> None: + """Set entity tile position (entityId:int) => Vec3""" + self.conn.send(self.pkg + b".setTile", ID, x, y, z) + + def getDirection(self, ID) -> Vec3: + """取得玩家視線方向""" + s = self.conn.sendReceive(self.pkg + b".getDirection", id) + return Vec3(*list(s.split(","))) + + def setDirection(self, ID, x:float, y:float, z:float) -> None: + """設置玩家視線方向""" + self.conn.send(self.pkg + b".setDirection", ID, x, y, z) + + def getRotation(self, ID) -> float: + """取得玩家轉向""" + s = self.conn.sendReceive(self.pkg + b".getRotation", ID) + return float(s) + + def setRotation(self, ID, yaw) -> float: + """設置玩家轉向""" + self.conn.send(self.pkg + b".setRotation", ID, yaw) + + def getPitch(self, ID) -> float: + """取得玩家俯仰""" + s = self.conn.sendReceive(self.pkg + b".getPitch", ID) + return float(s) + + def setPitch(self, ID, pitch) -> None: + """設置玩家俯仰""" + self.conn.send(self.pkg + b".setPitch", ID, pitch) + + def setting(self, setting, status): + """Set a player setting (setting, status). keys: autojump""" + self.conn.send(self.pkg + b".setting", setting, 1 if bool(status) else 0) + + +class CmdEntity(CmdPositioner): + """Methods for entities""" + def __init__(self, connection): + CmdPositioner.__init__(self, connection, b"entity") + + def getName(self, ID): + """Get the list name of the player with entity id => [name:str] + + Also can be used to find name of entity if entity is not a player.""" + return self.conn.sendReceive(b"entity.getName", ID) + + +class CmdPlayer(CmdPositioner): + """Methods for the host (Raspberry Pi) player""" + def __init__(self, connection): + CmdPositioner.__init__(self, connection, b"player") + self.conn = connection + + def getPos(self) -> Vec3: + return CmdPositioner.getPos(self, []) + def setPos(self, x:float, y:float, z:float) -> None: + return CmdPositioner.setPos(self, [], x, y, z) + def getTilePos(self) -> Vec3: + return CmdPositioner.getTilePos(self, []) + def setTilePos(self, x:int, y:int, z:int) -> None: + return CmdPositioner.setTilePos(self, [], x, y, z) + def getDirection(self) -> Vec3: + return CmdPositioner.getDirection(self, []) + def setDirection(self, x:float, y:float, z:float) -> None: + return CmdPositioner.setDirection(self, [], x, y, z) + def getRotation(self) -> float: + return CmdPositioner.getRotation(self, []) + def setRotation(self, yaw) -> None: + return CmdPositioner.setRotation(self, [], yaw) + def getPitch(self) -> float: + return CmdPositioner.getPitch(self, []) + def setPitch(self, pitch) -> None: + return CmdPositioner.setPitch(self, [], pitch) + + def getFoodLevel(self) -> int: + return self.conn.sendReceive(self.pkg + b".getFoodLevel", []) + + def setFoodLevel(self, foodLevel:int) -> None: + self.conn.send(self.pkg + b".setFoodLevel", foodLevel) + + def getHealth(self) -> float: + return self.conn.sendReceive(self.pkg + b".getHealth", []) + + def setHealth(self, health:float) -> None: + self.conn.send(self.pkg + b".setHealth", [], health) + + def sendTitle(self, title:str, subTitle:str="", fadeIn:int=10, stay:int=70, fadeOut:int=20) -> None: + self.conn.send(self.pkg + b".sendTitle", id, title, subTitle, fadeIn, stay, fadeOut) + +class CmdCamera: + def __init__(self, connection): + self.conn = connection + + def setNormal(self, *args) -> None: + """Set camera mode to normal Minecraft view ([entityId])""" + self.conn.send(b"camera.mode.setNormal", args) + + def setFixed(self) -> None: + """Set camera mode to fixed view""" + self.conn.send(b"camera.mode.setFixed") + + def setFollow(self, *args) -> None: + """Set camera mode to follow an entity ([entityId])""" + self.conn.send(b"camera.mode.setFollow", args) + + def setPos(self, x:float, y:float, z:float) -> None: + """Set camera entity position (x,y,z)""" + self.conn.send(b"camera.setPos", x, y, z) + + +class CmdEvents: + """Events""" + def __init__(self, connection): + self.conn = connection + + def clearAll(self): + """Clear all old events""" + self.conn.send(b"events.clear") + + def pollBlockHits(self): + """Only triggered by sword => [BlockEvent]""" + s = self.conn.sendReceive(b"events.block.hits") + events = [e for e in s.split("|") if e] + return [BlockEvent.Hit(*list(map(int, e.split(",")))) for e in events] + + def pollChatPosts(self): + """Triggered by posts to chat => [ChatEvent]""" + s = self.conn.sendReceive(b"events.chat.posts") + events = [e for e in s.split("|") if e] + return [ChatEvent.Post(int(e[:e.find(",")]), e[e.find(",") + 1:]) for e in events] + + +class Minecraft: + """The main class to interact with a running instance of Minecraft Pi.""" + def __init__(self, connection): + self.conn = connection + + self.camera = CmdCamera(connection) + self.entity = CmdEntity(connection) + self.player = CmdPlayer(connection) + self.events = CmdEvents(connection) + + def getBlock(self, x:int, y:int, z:int) -> str: + """Get block (x,y,z) => id:int""" + return self.conn.sendReceive(b"world.getBlock", x, y, z) + + def getBlocks(self, x1:int, y1:int, z1:int, x2:int, y2:int, z2:int) -> list: + """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [id:int]""" + blocks = self.conn.sendReceive(b"world.getBlocks", x1, y1, z1, x2, y2, z2) + arr1d = blocks.split(',') + + xSize = abs(x1 - x2) + 1 + ySize = abs(y1 - y2) + 1 + zSize = abs(z1 - z2) + 1 + totalSize = xSize * ySize * zSize + arr3d = [] + + if len(arr1d) != totalSize: + warn('Get number of blocks is incomplete') + + for i in range(0,totalSize,xSize*ySize): + curArr = [] + for j in range(0,xSize*ySize,xSize): + curArr.append(arr1d[i+j:i+j+xSize]) + arr3d.append(curArr) + return arr3d + + def setBlock(self, x:int, y:int, z:int, block:str) -> None: + """Set block (x,y,z,id,[data])""" + self.conn.send(b"world.setBlock", x, y, z, block) + + def setBlocks(self, x1:int, y1:int, z1:int, x2:int, y2:int, z2:int, block) -> None: + """Set a cuboid of blocks (x1,y1,z1,x2,y2,z2,id,[data])""" + self.conn.send(b"world.setBlocks", x1, y1, z1, x2, y2, z2, block) + + def getHeight(self, x:int, z:int) -> int: + """Get the height of the world (x,z) => int""" + return self.conn.sendReceive(b"world.getHeight", x, z) + + def getPlayerEntityIds(self) -> list: + """Get the entity ids of the connected players => [id:int]""" + ids = self.conn.sendReceive(b"world.getPlayerIds") + return list(map(int, ids.split("|"))) + +# def saveCheckpoint(self): +# """Save a checkpoint that can be used for restoring the world""" +# self.conn.send(b"world.checkpoint.save") + +# def restoreCheckpoint(self): +# """Restore the world state to the checkpoint""" +# self.conn.send(b"world.checkpoint.restore") + + def postToChat(self, *msg) -> None: + """Post a message to the game chat""" + self.conn.send(b"chat.post", msg) + + # TODO:修改成一個py檔處理Sign + def setSign(self, x:int, y:int, z:int, signType:str, signDir:int, line1:str="", line2:str="", line3:str="", line4:str="") -> None: + minecraftSignsType = ["SPRUCE_SIGN","ACACIA_SIGN","BIRCH_SIGN","DARK_OAK_SIGN","JUNGLE_SIGN","OAK_SIGN"] + + # ["SPRUCE_WALL_SIGN","ACACIA_WALL_SIGN","BIRCH_WALL_SIGN","DARK_OAK_WALL_SIGN","JUNGLE_WALL_SIGN","OAK_WALL_SIGN"] + minecraftSignsDir = {0:'SOUTH', + 1:'SOUTH_SOUTH_WEST', + 2:'SOUTH_WEST', + 3:'WEST_SOUTH_WEST', + 4:'WEST', + 5:'WEST_NORTH_WEST', + 6:'NORTH_WEST', + 7:'NORTH_NORTH_WEST', + 8:'NORTH', + 9:'NORTH_NORTH_EAST', + 10:'NORTH_EAST', + 11:'EAST_NORTH_EAST', + 12:'EAST', + 13:'EAST_SOUTH_EAST', + 14:'SOUTH_EAST', + 15:'SOUTH_SOUTH_EAST' + } + + if type(signDir) == int: + if 0 <= signDir < 16: + signDir = minecraftSignsDir.get(signDir) + elif type(signDir) == str: + for k,v in minecraftSignsDir.items(): + if signDir == v: + break + else: + signDir = minecraftSignsDir.get(0) + + signType = signType.upper() + if signType not in minecraftSignsType: raise Exception("Sign name error") + self.conn.send(b"world.setSign", x, y, z , signType, signDir, line1 ,line2 ,line3 ,line4) + + def setWallSign(self, x:int, y:int, z:int, signType:str, signDir:int, line1="",line2="",line3="",line4="") -> None: + minecraftSignsType = ["SPRUCE_WALL_SIGN","ACACIA_WALL_SIGN","BIRCH_WALL_SIGN","DARK_OAK_WALL_SIGN","JUNGLE_WALL_SIGN","OAK_WALL_SIGN"] + + minecraftSignsDir = {0:'SOUTH', + 1:'WEST', + 2:'NORTH', + 3:'EAST'} + + if type(signDir) == int: + if 0 <= signDir < 4: + signDir = minecraftSignsDir.get(signDir) + elif type(signDir) == str: + for k,v in minecraftSignsDir.items(): + if signDir == v: + break + else: + signDir = minecraftSignsDir.get(0) + + signType = signType.upper() + if signType not in minecraftSignsType: raise Exception("Sign name error") + self.conn.send(b"world.setWallSign", x, y, z , signType, signDir, line1 ,line2 ,line3 ,line4) + + def spawnEntity(self, x:int, y:int, z:int, entityID:int) -> int: + """Spawn entity (x,y,z,id,[data])""" + return int(self.conn.sendReceive(b"world.spawnEntity", x, y, z, entityID)) + + def createExplosion(self, x:int, y:int, z:int, power:int=4) -> None: + self.conn.send(b"world.createExplosion", x, y, z, power) + + def getPlayerEntityId(self, name:str) -> int: + """Get the entity id of the named player => [id:int]""" + return int(self.conn.sendReceive(b"world.getPlayerId", name)) + + def setting(self, setting, status): + """Set a world setting (setting, status). keys: world_immutable, nametags_visible""" + self.conn.send(b"world.setting", setting, 1 if bool(status) else 0) + + @staticmethod + def create(address = "localhost", port = 4711): + return Minecraft(Connection(address, port)) + + +if __name__ == "__main__": + mc = Minecraft.create() + mc.postToChat("Hello, Minecraft!") diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/util.py b/out/mcpi/util.py similarity index 100% rename from src/main/resources/mcpi/api/python/modded/mcpi/util.py rename to out/mcpi/util.py diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/vec3.py b/out/mcpi/vec3.py similarity index 100% rename from src/main/resources/mcpi/api/python/modded/mcpi/vec3.py rename to out/mcpi/vec3.py diff --git a/pom.xml b/pom.xml index fe1282ed..12efbafd 100644 --- a/pom.xml +++ b/pom.xml @@ -1,64 +1,37 @@ - + + 4.0.0 - net.zhuoweizhang - raspberryjuice - 1.11 - RaspberryJuice - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - + + com.minecraftdawn + RaspberryJuice + 1.0-SNAPSHOT - - - - src/main/resources - - mcpi/**/** - test/**/** - - - org.apache.maven.plugins maven-compiler-plugin - 2.0.2 - 1.6 - 1.6 + 6 + 6 + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + - org.bukkit - bukkit - 1.12.2-R0.1-SNAPSHOT + org.spigotmc + spigot-api + 1.14-R0.1-SNAPSHOT provided - - - - info.cukes - cucumber-testng - 1.2.5 - test - - - info.cukes - cucumber-java - 1.2.5 - test - - - org.jmockit - jmockit - 1.23 - test - - + \ No newline at end of file diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/CustomBlockFace.java b/src/main/java/net/zhuoweizhang/raspberryjuice/CustomBlockFace.java new file mode 100644 index 00000000..200fd627 --- /dev/null +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/CustomBlockFace.java @@ -0,0 +1,29 @@ +package net.zhuoweizhang.raspberryjuice; + +import org.bukkit.Material; +import org.bukkit.block.BlockFace; + +public class CustomBlockFace { + + //TODO + public static BlockFace getSignValueOf(String str){ + //NORTH + //NORTH_NORTH_EAST + //NORTH_EAST + //EAST_NORTH_EAST + //EAST + //EAST_SOUTH_EAST + //SOUTH_EAST + //SOUTH_SOUTH_EAST + //SOUTH + //SOUTH_SOUTH_WEST + //SOUTH_WEST + //WEST_SOUTH_WEST + //WEST + //WEST_NORTH_WEST + //NORTH_WEST + //NORTH_NORTH_WEST + + return null; + } +} diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java b/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java index 4b855bdb..e4c9fd0a 100644 --- a/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java @@ -1,27 +1,31 @@ package net.zhuoweizhang.raspberryjuice; -import java.net.*; -import java.util.*; - -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; +import java.net.InetSocketAddress; +import java.util.*; + public class RaspberryJuicePlugin extends JavaPlugin implements Listener { public static final Set blockBreakDetectionTools = EnumSet.of( Material.DIAMOND_SWORD, - Material.GOLD_SWORD, - Material.IRON_SWORD, - Material.STONE_SWORD, - Material.WOOD_SWORD); + Material.GOLDEN_SWORD, + Material.IRON_SWORD, + Material.STONE_SWORD, + Material.WOODEN_SWORD + ); public ServerListenerThread serverThread; @@ -32,25 +36,27 @@ public class RaspberryJuicePlugin extends JavaPlugin implements Listener { private LocationType locationType; private HitClickType hitClickType; + public LocationType getLocationType() { return locationType; } + public HitClickType getHitClickType() { return hitClickType; } public void onEnable() { //save a copy of the default config.yml if one is not there - this.saveDefaultConfig(); - //get port from config.yml + this.saveDefaultConfig(); + //get port from config.yml int port = this.getConfig().getInt("port"); getLogger().info("Using port " + Integer.toString(port)); - + //get location type (ABSOLUTE or RELATIVE) from config.yml String location = this.getConfig().getString("location").toUpperCase(); try { locationType = LocationType.valueOf(location); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { getLogger().warning("warning - location value in config.yml should be ABSOLUTE or RELATIVE - '" + location + "' found"); locationType = LocationType.valueOf("RELATIVE"); } @@ -60,7 +66,7 @@ public void onEnable() { String hitClick = this.getConfig().getString("hitclick").toUpperCase(); try { hitClickType = HitClickType.valueOf(hitClick); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { getLogger().warning("warning - hitclick value in config.yml should be LEFT, RIGHT or BOTH - '" + hitClick + "' found"); hitClickType = HitClickType.valueOf("RIGHT"); } @@ -68,7 +74,7 @@ public void onEnable() { //setup session array sessions = new ArrayList(); - + //create new tcp listener thread try { serverThread = new ServerListenerThread(this, new InetSocketAddress(port)); @@ -85,12 +91,13 @@ public void onEnable() { getServer().getScheduler().scheduleSyncRepeatingTask(this, new TickHandler(), 1, 1); } - @EventHandler(ignoreCancelled=true) + @EventHandler(ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { // only react to events which are of the correct type - switch(hitClickType) { + switch (hitClickType) { case BOTH: - if ((event.getAction() != Action.RIGHT_CLICK_BLOCK) && (event.getAction() != Action.LEFT_CLICK_BLOCK)) return; + if ((event.getAction() != Action.RIGHT_CLICK_BLOCK) && (event.getAction() != Action.LEFT_CLICK_BLOCK)) + return; break; case LEFT: if (event.getAction() != Action.LEFT_CLICK_BLOCK) return; @@ -103,35 +110,44 @@ public void onPlayerInteract(PlayerInteractEvent event) { if (currentTool == null || !blockBreakDetectionTools.contains(currentTool.getType())) { return; } - for (RemoteSession session: sessions) { + for (RemoteSession session : sessions) { session.queuePlayerInteractEvent(event); } } - @EventHandler(ignoreCancelled=true) + @EventHandler(ignoreCancelled = true) public void onChatPosted(AsyncPlayerChatEvent event) { //debug //getLogger().info("Chat event fired"); - for (RemoteSession session: sessions) { + for (RemoteSession session : sessions) { session.queueChatPostedEvent(event); } } - /** called when a new session is established. */ + @EventHandler(ignoreCancelled = true) + public void onArrowHit(ProjectileHitEvent event){ + for (RemoteSession session : sessions) { + session.queueArrowHitEvent(event); + } + } + + /** + * called when a new session is established. + */ public void handleConnection(RemoteSession newSession) { if (checkBanned(newSession)) { getLogger().warning("Kicking " + newSession.getSocket().getRemoteSocketAddress() + " because the IP address has been banned."); newSession.kick("You've been banned from this server!"); return; } - synchronized(sessions) { + synchronized (sessions) { sessions.add(newSession); } } public Player getNamedPlayer(String name) { if (name == null) return null; - for(Player player : Bukkit.getOnlinePlayers()) { + for (Player player : Bukkit.getOnlinePlayers()) { if (name.equals(player.getPlayerListName())) { return player; } @@ -141,7 +157,7 @@ public Player getNamedPlayer(String name) { public Player getHostPlayer() { if (hostPlayer != null) return hostPlayer; - for(Player player : Bukkit.getOnlinePlayers()) { + for (Player player : Bukkit.getOnlinePlayers()) { return player; } return null; @@ -149,7 +165,7 @@ public Player getHostPlayer() { //get entity by id - DONE to be compatible with the pi it should be changed to return an entity not a player... public Entity getEntity(int id) { - for (Player p: getServer().getOnlinePlayers()) { + for (Player p : getServer().getOnlinePlayers()) { if (p.getEntityId() == id) { return p; } @@ -174,7 +190,7 @@ public boolean checkBanned(RemoteSession session) { public void onDisable() { getServer().getScheduler().cancelTasks(this); - for (RemoteSession session: sessions) { + for (RemoteSession session : sessions) { try { session.close(); } catch (Exception e) { @@ -197,7 +213,7 @@ public void onDisable() { private class TickHandler implements Runnable { public void run() { Iterator sI = sessions.iterator(); - while(sI.hasNext()) { + while (sI.hasNext()) { RemoteSession s = sI.next(); if (s.pendingRemoval) { s.close(); diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java b/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java index 5c0acbbe..b887bf8d 100644 --- a/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java @@ -1,781 +1,482 @@ package net.zhuoweizhang.raspberryjuice; -import java.io.*; -import java.net.*; -import java.util.*; - +import net.zhuoweizhang.raspberryjuice.cmd.CmdEntity; +import net.zhuoweizhang.raspberryjuice.cmd.CmdEvent; +import net.zhuoweizhang.raspberryjuice.cmd.CmdPlayer; +import net.zhuoweizhang.raspberryjuice.cmd.CmdWorld; import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.block.*; -import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.util.Vector; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.io.*; +import java.net.Socket; +import java.util.ArrayDeque; public class RemoteSession { - private final LocationType locationType; - - private Location origin; - - private Socket socket; - - private BufferedReader in; - - private BufferedWriter out; - - private Thread inThread; - - private Thread outThread; - - private ArrayDeque inQueue = new ArrayDeque(); - - private ArrayDeque outQueue = new ArrayDeque(); - - public boolean running = true; - - public boolean pendingRemoval = false; - - public RaspberryJuicePlugin plugin; - - protected ArrayDeque interactEventQueue = new ArrayDeque(); - - protected ArrayDeque chatPostedQueue = new ArrayDeque(); - - private int maxCommandsPerTick = 9000; - - private boolean closed = false; - - private Player attachedPlayer = null; - - public RemoteSession(RaspberryJuicePlugin plugin, Socket socket) throws IOException { - this.socket = socket; - this.plugin = plugin; - this.locationType = plugin.getLocationType(); - init(); - } - - public void init() throws IOException { - socket.setTcpNoDelay(true); - socket.setKeepAlive(true); - socket.setTrafficClass(0x10); - this.in = new BufferedReader(new InputStreamReader(socket.getInputStream())); - this.out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); - startThreads(); - plugin.getLogger().info("Opened connection to" + socket.getRemoteSocketAddress() + "."); - } - - protected void startThreads() { - inThread = new Thread(new InputThread()); - inThread.start(); - outThread = new Thread(new OutputThread()); - outThread.start(); - } - - - public Location getOrigin() { - return origin; - } - - public void setOrigin(Location origin) { - this.origin = origin; - } - - public Socket getSocket() { - return socket; - } - - public void queuePlayerInteractEvent(PlayerInteractEvent event) { - //plugin.getLogger().info(event.toString()); - interactEventQueue.add(event); - } - - public void queueChatPostedEvent(AsyncPlayerChatEvent event) { - //plugin.getLogger().info(event.toString()); - chatPostedQueue.add(event); - } - - /** called from the server main thread */ - public void tick() { - if (origin == null) { - switch (locationType) { - case ABSOLUTE: - this.origin = new Location(plugin.getServer().getWorlds().get(0), 0, 0, 0); - break; - case RELATIVE: - this.origin = plugin.getServer().getWorlds().get(0).getSpawnLocation(); - break; - default: - throw new IllegalArgumentException("Unknown location type " + locationType); - } - } - int processedCount = 0; - String message; - while ((message = inQueue.poll()) != null) { - handleLine(message); - processedCount++; - if (processedCount >= maxCommandsPerTick) { - plugin.getLogger().warning("Over " + maxCommandsPerTick + - " commands were queued - deferring " + inQueue.size() + " to next tick"); - break; - } - } - - if (!running && inQueue.size() <= 0) { - pendingRemoval = true; - } - } - - protected void handleLine(String line) { - //System.out.println(line); - String methodName = line.substring(0, line.indexOf("(")); - //split string into args, handles , inside " i.e. "," - String[] args = line.substring(line.indexOf("(") + 1, line.length() - 1).split(","); - //System.out.println(methodName + ":" + Arrays.toString(args)); - handleCommand(methodName, args); - } - - protected void handleCommand(String c, String[] args) { - - try { - // get the server - Server server = plugin.getServer(); - - // get the world - World world = origin.getWorld(); - - // world.getBlock - if (c.equals("world.getBlock")) { - Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]); - send(world.getBlockTypeIdAt(loc)); - - // world.getBlocks - } else if (c.equals("world.getBlocks")) { - Location loc1 = parseRelativeBlockLocation(args[0], args[1], args[2]); - Location loc2 = parseRelativeBlockLocation(args[3], args[4], args[5]); - send(getBlocks(loc1, loc2)); - - // world.getBlockWithData - } else if (c.equals("world.getBlockWithData")) { - Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]); - send(world.getBlockTypeIdAt(loc) + "," + world.getBlockAt(loc).getData()); - - // world.setBlock - } else if (c.equals("world.setBlock")) { - Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]); - updateBlock(world, loc, Integer.parseInt(args[3]), (args.length > 4? Byte.parseByte(args[4]) : (byte) 0)); - - // world.setBlocks - } else if (c.equals("world.setBlocks")) { - Location loc1 = parseRelativeBlockLocation(args[0], args[1], args[2]); - Location loc2 = parseRelativeBlockLocation(args[3], args[4], args[5]); - int blockType = Integer.parseInt(args[6]); - byte data = args.length > 7? Byte.parseByte(args[7]) : (byte) 0; - setCuboid(loc1, loc2, blockType, data); - - // world.getPlayerIds - } else if (c.equals("world.getPlayerIds")) { - StringBuilder bdr = new StringBuilder(); - Collection players = Bukkit.getOnlinePlayers(); - if (players.size() > 0) { - for (Player p: players) { - bdr.append(p.getEntityId()); - bdr.append("|"); - } - bdr.deleteCharAt(bdr.length()-1); - send(bdr.toString()); - } else { - send("Fail"); - } - - // world.getPlayerId - } else if (c.equals("world.getPlayerId")) { - Player p = plugin.getNamedPlayer(args[0]); - if (p != null) { - send(p.getEntityId()); - } else { - plugin.getLogger().info("Player [" + args[0] + "] not found."); - send("Fail"); - } - // entity.getListName - } else if (c.equals("entity.getName")) { - Entity e = plugin.getEntity(Integer.parseInt(args[0])); - if (e == null) { - plugin.getLogger().info("Player (or Entity) [" + args[0] + "] not found in entity.getName."); - } else if (e instanceof Player) { - Player p = (Player) e; - //sending list name because plugin.getNamedPlayer() uses list name - send(p.getPlayerListName()); - } else if (e != null) { - send(e.getName()); - } - - // chat.post - } else if (c.equals("chat.post")) { - //create chat message from args as it was split by , - String chatMessage = ""; - int count; - for(count=0;count 0) { - b.append("|"); - } - } - send(b.toString()); - - // events.chat.posts - } else if (c.equals("events.chat.posts")) { - StringBuilder b = new StringBuilder(); - AsyncPlayerChatEvent event; - while ((event = chatPostedQueue.poll()) != null) { - b.append(event.getPlayer().getEntityId()); - b.append(","); - b.append(event.getMessage()); - if (chatPostedQueue.size() > 0) { - b.append("|"); - } - } - send(b.toString()); - - // player.getTile - } else if (c.equals("player.getTile")) { - Player currentPlayer = getCurrentPlayer(); - send(blockLocationToRelative(currentPlayer.getLocation())); - - // player.setTile - } else if (c.equals("player.setTile")) { - String x = args[0], y = args[1], z = args[2]; - Player currentPlayer = getCurrentPlayer(); - //get players current location, so when they are moved we will use the same pitch and yaw (rotation) - Location loc = currentPlayer.getLocation(); - currentPlayer.teleport(parseRelativeBlockLocation(x, y, z, loc.getPitch(), loc.getYaw())); - - // player.getAbsPos - } else if (c.equals("player.getAbsPos")) { - Player currentPlayer = getCurrentPlayer(); - send(currentPlayer.getLocation()); - - // player.setAbsPos - } else if (c.equals("player.setAbsPos")) { - String x = args[0], y = args[1], z = args[2]; - Player currentPlayer = getCurrentPlayer(); - //get players current location, so when they are moved we will use the same pitch and yaw (rotation) - Location loc = currentPlayer.getLocation(); - loc.setX(Double.parseDouble(x)); - loc.setY(Double.parseDouble(y)); - loc.setZ(Double.parseDouble(z)); - currentPlayer.teleport(loc); - - // player.getPos - } else if (c.equals("player.getPos")) { - Player currentPlayer = getCurrentPlayer(); - send(locationToRelative(currentPlayer.getLocation())); - - // player.setPos - } else if (c.equals("player.setPos")) { - String x = args[0], y = args[1], z = args[2]; - Player currentPlayer = getCurrentPlayer(); - //get players current location, so when they are moved we will use the same pitch and yaw (rotation) - Location loc = currentPlayer.getLocation(); - currentPlayer.teleport(parseRelativeLocation(x, y, z, loc.getPitch(), loc.getYaw())); - - // player.setDirection - } else if (c.equals("player.setDirection")) { - Double x = Double.parseDouble(args[0]); - Double y = Double.parseDouble(args[1]); - Double z = Double.parseDouble(args[2]); - Player currentPlayer = getCurrentPlayer(); - Location loc = currentPlayer.getLocation(); - loc.setDirection(new Vector(x, y, z)); - currentPlayer.teleport(loc); - - // player.getDirection - } else if (c.equals("player.getDirection")) { - Player currentPlayer = getCurrentPlayer(); - send(currentPlayer.getLocation().getDirection().toString()); - - // player.setRotation - } else if (c.equals("player.setRotation")) { - Float yaw = Float.parseFloat(args[0]); - Player currentPlayer = getCurrentPlayer(); - Location loc = currentPlayer.getLocation(); - loc.setYaw(yaw); - currentPlayer.teleport(loc); - - // player.getRotation - } else if (c.equals("player.getRotation")) { - Player currentPlayer = getCurrentPlayer(); - float yaw = currentPlayer.getLocation().getYaw(); - // turn bukkit's 0 - -360 to positive numbers - if (yaw < 0) yaw = yaw * -1; - send(yaw); - - // player.setPitch - } else if (c.equals("player.setPitch")) { - Float pitch = Float.parseFloat(args[0]); - Player currentPlayer = getCurrentPlayer(); - Location loc = currentPlayer.getLocation(); - loc.setPitch(pitch); - currentPlayer.teleport(loc); - - // player.getPitch - } else if (c.equals("player.getPitch")) { - Player currentPlayer = getCurrentPlayer(); - send(currentPlayer.getLocation().getPitch()); - - // world.getHeight - } else if (c.equals("world.getHeight")) { - send(world.getHighestBlockYAt(parseRelativeBlockLocation(args[0], "0", args[1])) - origin.getBlockY()); - - // entity.getTile - } else if (c.equals("entity.getTile")) { - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - send(blockLocationToRelative(entity.getLocation())); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.setTile - } else if (c.equals("entity.setTile")) { - String x = args[1], y = args[2], z = args[3]; - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - //get entity's current location, so when they are moved we will use the same pitch and yaw (rotation) - Location loc = entity.getLocation(); - entity.teleport(parseRelativeBlockLocation(x, y, z, loc.getPitch(), loc.getYaw())); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.getPos - } else if (c.equals("entity.getPos")) { - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - //Player entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - send(locationToRelative(entity.getLocation())); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.setPos - } else if (c.equals("entity.setPos")) { - String x = args[1], y = args[2], z = args[3]; - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - //get entity's current location, so when they are moved we will use the same pitch and yaw (rotation) - Location loc = entity.getLocation(); - entity.teleport(parseRelativeLocation(x, y, z, loc.getPitch(), loc.getYaw())); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.setDirection - } else if (c.equals("entity.setDirection")) { - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - Double x = Double.parseDouble(args[1]); - Double y = Double.parseDouble(args[2]); - Double z = Double.parseDouble(args[3]); - Location loc = entity.getLocation(); - loc.setDirection(new Vector(x, y, z)); - entity.teleport(loc); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - } - - // entity.getDirection - } else if (c.equals("entity.getDirection")) { - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - send(entity.getLocation().getDirection().toString()); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.setRotation - } else if (c.equals("entity.setRotation")) { - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - Float yaw = Float.parseFloat(args[1]); - Location loc = entity.getLocation(); - loc.setYaw(yaw); - entity.teleport(loc); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - } - - // entity.getRotation - } else if (c.equals("entity.getRotation")) { - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - send(entity.getLocation().getYaw()); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // entity.setPitch - } else if (c.equals("entity.setPitch")) { - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - Float pitch = Float.parseFloat(args[1]); - Location loc = entity.getLocation(); - loc.setPitch(pitch); - entity.teleport(loc); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - } - - // entity.getPitch - } else if (c.equals("entity.getPitch")) { - //get entity based on id - Entity entity = plugin.getEntity(Integer.parseInt(args[0])); - if (entity != null) { - send(entity.getLocation().getPitch()); - } else { - plugin.getLogger().info("Entity [" + args[0] + "] not found."); - send("Fail"); - } - - // world.setSign - } else if (c.equals("world.setSign")) { - Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]); - Block thisBlock = world.getBlockAt(loc); - //blockType should be 68 for wall sign or 63 for standing sign - int blockType = Integer.parseInt(args[3]); - //facing direction for wall sign : 2=north, 3=south, 4=west, 5=east - //rotation 0 - to 15 for standing sign : 0=south, 4=west, 8=north, 12=east - byte blockData = Byte.parseByte(args[4]); - if ((thisBlock.getTypeId() != blockType) || (thisBlock.getData() != blockData)) { - thisBlock.setTypeIdAndData(blockType, blockData, true); - } - //plugin.getLogger().info("Creating sign at " + loc); - if ( thisBlock.getState() instanceof Sign ) { - Sign sign = (Sign) thisBlock.getState(); - for ( int i = 5; i-5 < 4 && i < args.length; i++) { - sign.setLine(i-5, args[i]); - } - sign.update(); - } - - // world.spawnEntity - } else if (c.equals("world.spawnEntity")) { - Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]); - Entity entity = world.spawnEntity(loc, EntityType.fromId(Integer.parseInt(args[3]))); - send(entity.getEntityId()); - - // world.getEntityTypes - } else if (c.equals("world.getEntityTypes")) { - StringBuilder bdr = new StringBuilder(); - for (EntityType entityType : EntityType.values()) { - if ( entityType.isSpawnable() && entityType.getTypeId() >= 0 ) { - bdr.append(entityType.getTypeId()); - bdr.append(","); - bdr.append(entityType.toString()); - bdr.append("|"); - } - } - send(bdr.toString()); - - // not a command which is supported - } else { - plugin.getLogger().warning(c + " is not supported."); - send("Fail"); - } - } catch (Exception e) { - - plugin.getLogger().warning("Error occured handling command"); - e.printStackTrace(); - send("Fail"); - - } - } - - // create a cuboid of lots of blocks - private void setCuboid(Location pos1, Location pos2, int blockType, byte data) { - int minX, maxX, minY, maxY, minZ, maxZ; - World world = pos1.getWorld(); - minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); - maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); - minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); - maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); - minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); - maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); - - for (int x = minX; x <= maxX; ++x) { - for (int z = minZ; z <= maxZ; ++z) { - for (int y = minY; y <= maxY; ++y) { - updateBlock(world, x, y, z, blockType, data); - } - } - } - } - - // get a cuboid of lots of blocks - private String getBlocks(Location pos1, Location pos2) { - StringBuilder blockData = new StringBuilder(); - - int minX, maxX, minY, maxY, minZ, maxZ; - World world = pos1.getWorld(); - minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); - maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); - minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); - maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); - minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); - maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); - - for (int y = minY; y <= maxY; ++y) { - for (int x = minX; x <= maxX; ++x) { - for (int z = minZ; z <= maxZ; ++z) { - blockData.append(new Integer(world.getBlockTypeIdAt(x, y, z)).toString() + ","); - } - } - } - - return blockData.substring(0, blockData.length() > 0 ? blockData.length() - 1 : 0); // We don't want last comma - } - - // updates a block - private void updateBlock(World world, Location loc, int blockType, byte blockData) { - Block thisBlock = world.getBlockAt(loc); - updateBlock(thisBlock, blockType, blockData); - } - - private void updateBlock(World world, int x, int y, int z, int blockType, byte blockData) { - Block thisBlock = world.getBlockAt(x,y,z); - updateBlock(thisBlock, blockType, blockData); - } - - private void updateBlock(Block thisBlock, int blockType, byte blockData) { - // check to see if the block is different - otherwise leave it - if ((thisBlock.getTypeId() != blockType) || (thisBlock.getData() != blockData)) { - thisBlock.setTypeIdAndData(blockType, blockData, true); - } - } - - // gets the current player - public Player getCurrentPlayer() { - Player player = attachedPlayer; - // if the player hasnt already been retreived for this session, go and get it. - if (player == null) { - player = plugin.getHostPlayer(); - attachedPlayer = player; - } - return player; - } - - public Location parseRelativeBlockLocation(String xstr, String ystr, String zstr) { - int x = (int) Double.parseDouble(xstr); - int y = (int) Double.parseDouble(ystr); - int z = (int) Double.parseDouble(zstr); - return parseLocation(origin.getWorld(), x, y, z, origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()); - } - - public Location parseRelativeLocation(String xstr, String ystr, String zstr) { - double x = Double.parseDouble(xstr); - double y = Double.parseDouble(ystr); - double z = Double.parseDouble(zstr); - return parseLocation(origin.getWorld(), x, y, z, origin.getX(), origin.getY(), origin.getZ()); - } - - public Location parseRelativeBlockLocation(String xstr, String ystr, String zstr, float pitch, float yaw) { - Location loc = parseRelativeBlockLocation(xstr, ystr, zstr); - loc.setPitch(pitch); - loc.setYaw(yaw); - return loc; - } - - public Location parseRelativeLocation(String xstr, String ystr, String zstr, float pitch, float yaw) { - Location loc = parseRelativeLocation(xstr, ystr, zstr); - loc.setPitch(pitch); - loc.setYaw(yaw); - return loc; - } - - public String blockLocationToRelative(Location loc) { - return parseLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()); - } - - public String locationToRelative(Location loc) { - return parseLocation(loc.getX(), loc.getY(), loc.getZ(), origin.getX(), origin.getY(), origin.getZ()); - } - - private String parseLocation(double x, double y, double z, double originX, double originY, double originZ) { - return (x - originX) + "," + (y - originY) + "," + (z - originZ); - } - - private Location parseLocation(World world, double x, double y, double z, double originX, double originY, double originZ) { - return new Location(world, originX + x, originY + y, originZ + z); - } - - private String parseLocation(int x, int y, int z, int originX, int originY, int originZ) { - return (x - originX) + "," + (y - originY) + "," + (z - originZ); - } - - private Location parseLocation(World world, int x, int y, int z, int originX, int originY, int originZ) { - return new Location(world, originX + x, originY + y, originZ + z); - } - - public void send(Object a) { - send(a.toString()); - } - - public void send(String a) { - if (pendingRemoval) return; - synchronized(outQueue) { - outQueue.add(a); - } - } - - public void close() { - if (closed) return; - running = false; - pendingRemoval = true; - - //wait for threads to stop - try { - inThread.join(2000); - outThread.join(2000); - } - catch (InterruptedException e) { - plugin.getLogger().warning("Failed to stop in/out thread"); - e.printStackTrace(); - } - - try { - socket.close(); - } catch (Exception e) { - e.printStackTrace(); - } - plugin.getLogger().info("Closed connection to" + socket.getRemoteSocketAddress() + "."); - } - - public void kick(String reason) { - try { - out.write(reason); - out.flush(); - } catch (Exception e) { - } - close(); - } - - /** socket listening thread */ - private class InputThread implements Runnable { - public void run() { - plugin.getLogger().info("Starting input thread"); - while (running) { - try { - String newLine = in.readLine(); - //System.out.println(newLine); - if (newLine == null) { - running = false; - } else { - inQueue.add(newLine); - //System.out.println("Added to in queue"); - } - } catch (Exception e) { - // if its running raise an error - if (running) { - if (e.getMessage().equals("Connection reset")) { - plugin.getLogger().info("Connection reset"); - } else { - e.printStackTrace(); - } - running = false; - } - } - } - //close in buffer - try { - in.close(); - } catch (Exception e) { - plugin.getLogger().warning("Failed to close in buffer"); - e.printStackTrace(); - } - } - } - - private class OutputThread implements Runnable { - public void run() { - plugin.getLogger().info("Starting output thread!"); - while (running) { - try { - String line; - while((line = outQueue.poll()) != null) { - out.write(line); - out.write('\n'); - } - out.flush(); - Thread.yield(); - Thread.sleep(1L); - } catch (Exception e) { - // if its running raise an error - if (running) { - e.printStackTrace(); - running = false; - } - } - } - //close out buffer - try { - out.close(); - } catch (Exception e) { - plugin.getLogger().warning("Failed to close out buffer"); - e.printStackTrace(); - } - } - } - - /** from CraftBukkit's org.bukkit.craftbukkit.block.CraftBlock.blockFactToNotch */ - public static int blockFaceToNotch(BlockFace face) { - switch (face) { - case DOWN: - return 0; - case UP: - return 1; - case NORTH: - return 2; - case SOUTH: - return 3; - case WEST: - return 4; - case EAST: - return 5; - default: - return 7; // Good as anything here, but technically invalid - } - } + private final LocationType locationType; + + private Location origin; + + private Socket socket; + + private BufferedReader in; + + private BufferedWriter out; + + private Thread inThread; + + private Thread outThread; + + private ArrayDeque inQueue = new ArrayDeque(); + + private ArrayDeque outQueue = new ArrayDeque(); + + public boolean running = true; + + public boolean pendingRemoval = false; + + public RaspberryJuicePlugin plugin; + + public ArrayDeque interactEventQueue = new ArrayDeque(); + + public ArrayDeque arrowHitEventQueue = new ArrayDeque(); + + public ArrayDeque chatPostedQueue = new ArrayDeque(); + + private int maxCommandsPerTick = 9000; + + private boolean closed = false; + + private Player attachedPlayer = null; + + private CmdEntity cmdEntity; + private CmdEvent cmdEvent; + private CmdPlayer cmdPlayer; + private CmdWorld cmdWorld; + + public RemoteSession(RaspberryJuicePlugin plugin, Socket socket) throws IOException { + this.socket = socket; + this.plugin = plugin; + this.locationType = plugin.getLocationType(); + init(); + createCmdObject(); + } + + public void init() throws IOException { + socket.setTcpNoDelay(true); + socket.setKeepAlive(true); + socket.setTrafficClass(0x10); + this.in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "utf-8")); + this.out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "utf-8")); + startThreads(); + plugin.getLogger().info("Opened connection to" + socket.getRemoteSocketAddress() + "."); + } + + public void createCmdObject(){ + cmdEntity = new CmdEntity(this); + cmdEvent = new CmdEvent(this); + cmdPlayer = new CmdPlayer(this); + cmdWorld = new CmdWorld(this); + + } + + protected void startThreads() { + inThread = new Thread(new InputThread()); + inThread.start(); + outThread = new Thread(new OutputThread()); + outThread.start(); + } + + + public Location getOrigin() { + return origin; + } + + public void setOrigin(Location origin) { + this.origin = origin; + } + + public Socket getSocket() { + return socket; + } + + public void queuePlayerInteractEvent(PlayerInteractEvent event) { + //plugin.getLogger().info(event.toString()); + interactEventQueue.add(event); + } + + public void queueChatPostedEvent(AsyncPlayerChatEvent event) { + //plugin.getLogger().info(event.toString()); + chatPostedQueue.add(event); + } + + public void queueArrowHitEvent(ProjectileHitEvent event){ + arrowHitEventQueue.add(event); + } + + /** + * called from the server main thread + */ + public void tick() { + if (origin == null) { + switch (locationType) { + case ABSOLUTE: + this.origin = new Location(plugin.getServer().getWorlds().get(0), 0, 0, 0); + break; + case RELATIVE: + this.origin = plugin.getServer().getWorlds().get(0).getSpawnLocation(); + break; + default: + throw new IllegalArgumentException("Unknown location type " + locationType); + } + } + int processedCount = 0; + String message; + while ((message = inQueue.poll()) != null) { + handleLine(message); + processedCount++; + if (processedCount >= maxCommandsPerTick) { + plugin.getLogger().warning("Over " + maxCommandsPerTick + + " commands were queued - deferring " + inQueue.size() + " to next tick"); + break; + } + } + + if (!running && inQueue.size() <= 0) { + pendingRemoval = true; + } + } + + protected void handleLine(String line) { + //System.out.println(line); + String methodName = line.substring(0, line.indexOf("(")); + //split string into args, handles , inside " i.e. "," + String[] args = line.substring(line.indexOf("(") + 1, line.length() - 1).split(","); + //System.out.println(methodName + ":" + Arrays.toString(args)); + handleCommand(methodName, args); + } + + protected void handleCommand(String c, String[] args) { + + try { + // get the server + Server server = plugin.getServer(); + + // get the world + World world = origin.getWorld(); + + // 分割命令 + String[] cmd = c.split("[.]", 2); + + if (cmd[0].equals("player")) { + cmdPlayer.execute(cmd[1], args); + + } else if (cmd[0].equals("entity")) { + cmdEntity.execute(cmd[1], args); + + } else if (cmd[0].equals("world")) { +// new CmdWorld(this).execute(world, cmd[1], args); + cmdWorld.execute(world, cmd[1], args); + + } else if (cmd[0].equals("events")) { + cmdEvent.execute(cmd[1], args); + + // chat.post + } else if (c.equals("chat.post")) { + //create chat message from args as it was split by , + String chatMessage = ""; + int count; + for (count = 0; count < args.length; count++) { + chatMessage = chatMessage + args[count] + " "; + } + chatMessage = chatMessage.substring(0, chatMessage.length() - 1); + server.broadcastMessage(chatMessage); + + // not a command which is supported + } else { + plugin.getLogger().warning(c + " is not supported."); + send("Fail," + c + " is not supported."); + } + } catch (Exception e) { + + plugin.getLogger().warning("Error occured handling command"); + e.printStackTrace(); + send("Fail,Please check out minecraft server console"); + + } + } + + // create a cuboid of lots of blocks + private void setCuboid(Location pos1, Location pos2, String blockType, byte data) { + int minX, maxX, minY, maxY, minZ, maxZ; + World world = pos1.getWorld(); + minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + + for (int x = minX; x <= maxX; ++x) { + for (int z = minZ; z <= maxZ; ++z) { + for (int y = minY; y <= maxY; ++y) { + updateBlock(world, x, y, z, blockType, data); + } + } + } + } + + // get a cuboid of lots of blocks + private String getBlocks(Location pos1, Location pos2) { + StringBuilder blockData = new StringBuilder(); + + int minX, maxX, minY, maxY, minZ, maxZ; + World world = pos1.getWorld(); + minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + + for (int y = minY; y <= maxY; ++y) { + for (int x = minX; x <= maxX; ++x) { + for (int z = minZ; z <= maxZ; ++z) { + blockData.append(world.getBlockAt(x, y, z).getType().name() + ","); + } + } + } + + return blockData.substring(0, blockData.length() > 0 ? blockData.length() - 1 : 0); // We don't want last comma + } + + // updates a block + private void updateBlock(World world, Location loc, String blockType, byte blockData) { + Block thisBlock = world.getBlockAt(loc); + updateBlock(thisBlock, blockType, blockData); + } + + private void updateBlock(World world, int x, int y, int z, String blockType, byte blockData) { + Block thisBlock = world.getBlockAt(x, y, z); + updateBlock(thisBlock, blockType, blockData); + } + + private void updateBlock(Block thisBlock, String blockType, byte blockData) { + // check to see if the block is different - otherwise leave it + blockType = blockType.toUpperCase(); + if ((thisBlock.getType() != Material.valueOf(blockType))) { + thisBlock.setType(Material.valueOf(blockType.toUpperCase())); +// thisBlock.setTypeIdAndData(blockType, blockData, true); + } + } + + // gets the current player + public Player getCurrentPlayer() { + if (!serverHasPlayer()) { + send("Fail,There are no players in the server."); + return null; + } + Player player = attachedPlayer; + // if the player hasnt already been retreived for this session, go and get it. + if (player == null) { + player = plugin.getHostPlayer(); + attachedPlayer = player; + } + return player; + } + + private boolean serverHasPlayer() { + return !Bukkit.getOnlinePlayers().isEmpty(); + } + + public Location parseRelativeBlockLocation(String xstr, String ystr, String zstr) { + int x = (int) Double.parseDouble(xstr); + int y = (int) Double.parseDouble(ystr); + int z = (int) Double.parseDouble(zstr); + return parseLocation(origin.getWorld(), x, y, z, origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()); + } + + public Location parseRelativeLocation(String xstr, String ystr, String zstr) { + double x = Double.parseDouble(xstr); + double y = Double.parseDouble(ystr); + double z = Double.parseDouble(zstr); + return parseLocation(origin.getWorld(), x, y, z, origin.getX(), origin.getY(), origin.getZ()); + } + + public Location parseRelativeBlockLocation(String xstr, String ystr, String zstr, float pitch, float yaw) { + Location loc = parseRelativeBlockLocation(xstr, ystr, zstr); + loc.setPitch(pitch); + loc.setYaw(yaw); + return loc; + } + + public Location parseRelativeLocation(String xstr, String ystr, String zstr, float pitch, float yaw) { + Location loc = parseRelativeLocation(xstr, ystr, zstr); + loc.setPitch(pitch); + loc.setYaw(yaw); + return loc; + } + + public String blockLocationToRelative(Location loc) { + return parseLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()); + } + + public String locationToRelative(Location loc) { + return parseLocation(loc.getX(), loc.getY(), loc.getZ(), origin.getX(), origin.getY(), origin.getZ()); + } + + private String parseLocation(double x, double y, double z, double originX, double originY, double originZ) { + return (x - originX) + "," + (y - originY) + "," + (z - originZ); + } + + private Location parseLocation(World world, double x, double y, double z, double originX, double originY, double originZ) { + return new Location(world, originX + x, originY + y, originZ + z); + } + + private String parseLocation(int x, int y, int z, int originX, int originY, int originZ) { + return (x - originX) + "," + (y - originY) + "," + (z - originZ); + } + + private Location parseLocation(World world, int x, int y, int z, int originX, int originY, int originZ) { + return new Location(world, originX + x, originY + y, originZ + z); + } + + public void send(Object a) { + send(a.toString()); + } + + public void send(String a) { + if (pendingRemoval) return; + synchronized (outQueue) { + outQueue.add(a); + } + } + + public void close() { + if (closed) return; + running = false; + pendingRemoval = true; + + //wait for threads to stop + try { + inThread.join(2000); + outThread.join(2000); + } catch (InterruptedException e) { + plugin.getLogger().warning("Failed to stop in/out thread"); + e.printStackTrace(); + } + + try { + socket.close(); + } catch (Exception e) { + e.printStackTrace(); + } + plugin.getLogger().info("Closed connection to" + socket.getRemoteSocketAddress() + "."); + } + + public void kick(String reason) { + try { + out.write(reason); + out.flush(); + } catch (Exception e) { + } + close(); + } + + /** + * socket listening thread + */ + private class InputThread implements Runnable { + public void run() { + plugin.getLogger().info("Starting input thread"); + while (running) { + try { + String newLine = in.readLine(); + //System.out.println(newLine); + if (newLine == null) { + running = false; + } else { + inQueue.add(newLine); + //System.out.println("Added to in queue"); + } + } catch (Exception e) { + // if its running raise an error + if (running) { + if (e.getMessage().equals("Connection reset")) { + plugin.getLogger().info("Connection reset"); + } else { + e.printStackTrace(); + } + running = false; + } + } + } + //close in buffer + try { + in.close(); + } catch (Exception e) { + plugin.getLogger().warning("Failed to close in buffer"); + e.printStackTrace(); + } + } + } + + private class OutputThread implements Runnable { + public void run() { + plugin.getLogger().info("Starting output thread!"); + while (running) { + try { + String line; + while ((line = outQueue.poll()) != null) { + out.write(line); + out.write('\n'); + } + out.flush(); + Thread.yield(); + Thread.sleep(1L); + } catch (Exception e) { + // if its running raise an error + if (running) { + e.printStackTrace(); + running = false; + } + } + } + //close out buffer + try { + out.close(); + } catch (Exception e) { + plugin.getLogger().warning("Failed to close out buffer"); + e.printStackTrace(); + } + } + } + + /** + * from CraftBukkit's org.bukkit.craftbukkit.block.CraftBlock.blockFactToNotch + */ + public static int blockFaceToNotch(BlockFace face) { + switch (face) { + case DOWN: + return 0; + case UP: + return 1; + case NORTH: + return 2; + case SOUTH: + return 3; + case WEST: + return 4; + case EAST: + return 5; + default: + return 7; // Good as anything here, but technically invalid + } + } } diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.java b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.java new file mode 100644 index 00000000..3e56ad8b --- /dev/null +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEntity.java @@ -0,0 +1,111 @@ +package net.zhuoweizhang.raspberryjuice.cmd; + +import net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin; +import net.zhuoweizhang.raspberryjuice.RemoteSession; +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class CmdEntity { + private final String preFix = "entity."; + private RemoteSession session; + private RaspberryJuicePlugin plugin; + + public CmdEntity(RemoteSession session) { + this.session = session; + + this.plugin = session.plugin; + } + + public void execute(String command, String[] args) { + + //get entity based on id + Entity entity = plugin.getEntity(Integer.parseInt(args[0])); + + if (entity == null) { + plugin.getLogger().info("Entity [" + args[0] + "] not found."); + session.send("Fail,This entity identity not exist"); + } + + // entity.getTile + if (command.equals("getTile")) { + + session.send(session.blockLocationToRelative(entity.getLocation())); + + // entity.setTile + } else if (command.equals("setTile")) { + String x = args[1], y = args[2], z = args[3]; + Location loc = entity.getLocation(); + + entity.teleport(session.parseRelativeBlockLocation(x, y, z, loc.getPitch(), loc.getYaw())); + + // entity.getPos + } else if (command.equals("getPos")) { + + session.send(session.locationToRelative(entity.getLocation())); + + // entity.setPos + } else if (command.equals("setPos")) { + String x = args[1], y = args[2], z = args[3]; + Location loc = entity.getLocation(); + + entity.teleport(session.parseRelativeLocation(x, y, z, loc.getPitch(), loc.getYaw())); + + // entity.setDirection + } else if (command.equals("setDirection")) { + Double x = Double.parseDouble(args[1]); + Double y = Double.parseDouble(args[2]); + Double z = Double.parseDouble(args[3]); + Location loc = entity.getLocation(); + + loc.setDirection(new Vector(x, y, z)); + entity.teleport(loc); + + // entity.getDirection + } else if (command.equals("getDirection")) { + + session.send(entity.getLocation().getDirection().toString()); + + // entity.setRotation + } else if (command.equals("setRotation")) { + Float yaw = Float.parseFloat(args[1]); + Location loc = entity.getLocation(); + + loc.setYaw(yaw); + entity.teleport(loc); + + // entity.getRotation + } else if (command.equals("getRotation")) { + + session.send(entity.getLocation().getYaw()); + + // entity.setPitch + } else if (command.equals("setPitch")) { + Float pitch = Float.parseFloat(args[1]); + Location loc = entity.getLocation(); + + loc.setPitch(pitch); + entity.teleport(loc); + + // entity.getPitch + } else if (command.equals("getPitch")) { + session.send(entity.getLocation().getPitch()); + + // entity.getListName + } else if (command.equals("getName")) { + if (entity instanceof Player) { + Player p = (Player) entity; + //sending list name because plugin.getNamedPlayer() uses list name + session.send(p.getPlayerListName()); + } else { + session.send(entity.getName()); + } + + } else { + session.plugin.getLogger().warning(preFix + command + " is not supported."); + session.send("Fail," + preFix + command + " is not supported."); + } + + } +} diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.java b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.java new file mode 100644 index 00000000..d42fe3b3 --- /dev/null +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdEvent.java @@ -0,0 +1,76 @@ +package net.zhuoweizhang.raspberryjuice.cmd; + +import net.zhuoweizhang.raspberryjuice.RemoteSession; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class CmdEvent { + private final String preFix = "events."; + private RemoteSession session; + + public CmdEvent(RemoteSession session) { + this.session = session; + } + + public void execute(String command, String[] args) { + // events.clear + if (command.equals("clear")) { + session.interactEventQueue.clear(); + session.chatPostedQueue.clear(); + + // events.block.hits + } else if (command.equals("block.hits")) { + StringBuilder b = new StringBuilder(); + PlayerInteractEvent event; + while ((event = session.interactEventQueue.poll()) != null) { + Block block = event.getClickedBlock(); + Location loc = block.getLocation(); + b.append(session.blockLocationToRelative(loc)); + b.append(","); + b.append(session.blockFaceToNotch(event.getBlockFace())); + b.append(","); + b.append(event.getPlayer().getEntityId()); + if (session.interactEventQueue.size() > 0) { + b.append("|"); + } + } + session.send(b.toString()); + + // events.chat.posts + } else if (command.equals("chat.posts")) { + StringBuilder b = new StringBuilder(); + AsyncPlayerChatEvent event; + while ((event = session.chatPostedQueue.poll()) != null) { + b.append(event.getPlayer().getEntityId()); + b.append(","); + b.append(event.getMessage()); + if (session.chatPostedQueue.size() > 0) { + b.append("|"); + } + } + session.send(b.toString()); + + } else if(command.equals("arrow.hits")){ + StringBuilder b = new StringBuilder(); + ProjectileHitEvent event; + while ((event = session.arrowHitEventQueue.poll()) != null) { + Block block = event.getHitBlock(); + if(block == null) continue; + Location loc = block.getLocation(); + b.append(session.blockLocationToRelative(loc)); + b.append(","); + b.append(event.getEntity().getEntityId()); + if (session.arrowHitEventQueue.size() > 0) { + b.append("|"); + } + } + session.send(b.toString()); + } else{ + session.plugin.getLogger().warning(preFix + command + " is not supported."); + session.send("Fail," + preFix + command + " is not supported."); + } + } +} diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.java b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.java new file mode 100644 index 00000000..ca7153f6 --- /dev/null +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdPlayer.java @@ -0,0 +1,165 @@ +package net.zhuoweizhang.raspberryjuice.cmd; + +import net.zhuoweizhang.raspberryjuice.RemoteSession; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class CmdPlayer { + private final String preFix = "player."; + private RemoteSession session; + + public CmdPlayer(RemoteSession session) { + this.session = session; + } + + private boolean serverHasPlayer() { + return !Bukkit.getOnlinePlayers().isEmpty(); + } + + private Player getCurrentPlayer() { + if (!serverHasPlayer()) { + session.send("Fail,There are no players in the server."); + return null; + } else { + for (Player player : Bukkit.getServer().getOnlinePlayers()) { + return player; + } + } + return null; + } + + public void execute(String command, String[] args) { + + Player currentPlayer = getCurrentPlayer(); + if (currentPlayer == null) { + session.send("Fail,There are no players in the server."); + return; + } + + // player.getTile + if (command.equals("getTile")) { + + session.send(session.blockLocationToRelative(currentPlayer.getLocation())); + + // player.setTile + } else if (command.equals("setTile")) { + String x = args[0], y = args[1], z = args[2]; + + //get players current location, so when they are moved we will use the same pitch and yaw (rotation) + Location loc = currentPlayer.getLocation(); + currentPlayer.teleport(session.parseRelativeBlockLocation(x, y, z, loc.getPitch(), loc.getYaw())); + + // player.getAbsPos + } else if (command.equals("getAbsPos")) { + + session.send(currentPlayer.getLocation()); + + // player.setAbsPos + } else if (command.equals("setAbsPos")) { + String x = args[0], y = args[1], z = args[2]; + + //get players current location, so when they are moved we will use the same pitch and yaw (rotation) + Location loc = currentPlayer.getLocation(); + loc.setX(Double.parseDouble(x)); + loc.setY(Double.parseDouble(y)); + loc.setZ(Double.parseDouble(z)); + currentPlayer.teleport(loc); + + // player.getPos + } else if (command.equals("getPos")) { + + session.send(session.locationToRelative(currentPlayer.getLocation())); + + // player.setPos + } else if (command.equals("setPos")) { + String x = args[0], y = args[1], z = args[2]; + + //get players current location, so when they are moved we will use the same pitch and yaw (rotation) + Location loc = currentPlayer.getLocation(); + currentPlayer.teleport(session.parseRelativeLocation(x, y, z, loc.getPitch(), loc.getYaw())); + + // player.setDirection + } else if (command.equals("setDirection")) { + Double x = Double.parseDouble(args[0]); + Double y = Double.parseDouble(args[1]); + Double z = Double.parseDouble(args[2]); + + Location loc = currentPlayer.getLocation(); + loc.setDirection(new Vector(x, y, z)); + currentPlayer.teleport(loc); + + // player.getDirection + } else if (command.equals("getDirection")) { + + session.send(currentPlayer.getLocation().getDirection().toString()); + + // player.setRotation + } else if (command.equals("setRotation")) { + Float yaw = Float.parseFloat(args[0]); + + Location loc = currentPlayer.getLocation(); + loc.setYaw(yaw); + currentPlayer.teleport(loc); + + // player.getRotation + } else if (command.equals("getRotation")) { + + float yaw = currentPlayer.getLocation().getYaw(); + // turn bukkit's 0 - -360 to positive numbers + if (yaw < 0) yaw = yaw * -1; + session.send(yaw); + + // player.setPitch + } else if (command.equals("setPitch")) { + Float pitch = Float.parseFloat(args[0]); + + Location loc = currentPlayer.getLocation(); + loc.setPitch(pitch); + currentPlayer.teleport(loc); + + // player.getPitch + } else if (command.equals("getPitch")) { + + session.send(currentPlayer.getLocation().getPitch()); + + // player.getFoodLevel + } else if (command.equals("getFoodLevel")) { + + session.send(currentPlayer.getFoodLevel()); + + // player.setFoodLevel + } else if (command.equals("setFoodLevel")) { + Integer foodLevel = Integer.parseInt(args[0]); + + currentPlayer.setFoodLevel(foodLevel); + + // player.getHealth + } else if(command.equals("getHealth")) { + + session.send(currentPlayer.getHealth()); + + // player.setHealth + } else if(command.equals("setHealth")){ + Double health = Double.parseDouble(args[0]); + + currentPlayer.setHealth(health); + + // player.sendTitle + } else if (command.equals("sendTitle")) { + + String title = args[0]; + String subTitle = args[1]; + Integer fadeIn = Integer.parseInt(args[2]); + Integer stay = Integer.parseInt(args[3]); + Integer fadeOut = Integer.parseInt(args[4]); + currentPlayer.sendTitle(title, subTitle, fadeIn, stay, fadeOut); + + } else { + session.plugin.getLogger().warning(preFix + command + " is not supported."); + session.send("Fail," + preFix + command + " is not supported."); + } + } + +} diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.java b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.java new file mode 100644 index 00000000..2717f126 --- /dev/null +++ b/src/main/java/net/zhuoweizhang/raspberryjuice/cmd/CmdWorld.java @@ -0,0 +1,226 @@ +package net.zhuoweizhang.raspberryjuice.cmd; + +import net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin; +import net.zhuoweizhang.raspberryjuice.RemoteSession; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; +import org.bukkit.block.data.type.WallSign; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import java.util.Collection; + +public class CmdWorld { + private final String preFix = "world."; + private RemoteSession session; + private RaspberryJuicePlugin plugin; + + public CmdWorld(RemoteSession session) { + this.session = session; + this.plugin = session.plugin; + } + + public void execute(World world, String command, String[] args) { + + // world.getBlock + if (command.equals("getBlock")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + + session.send(world.getBlockAt(loc).getType().name()); + + // world.getBlocks + } else if (command.equals("getBlocks")) { + Location loc1 = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Location loc2 = session.parseRelativeBlockLocation(args[3], args[4], args[5]); + + session.send(getBlocks(loc1, loc2)); + + // world.setBlock + } else if (command.equals("setBlock")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + + updateBlock(world, loc, args[3]); + + // world.setBlocks + } else if (command.equals("setBlocks")) { + Location loc1 = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Location loc2 = session.parseRelativeBlockLocation(args[3], args[4], args[5]); + String blockType = args[6]; + + setCuboid(loc1, loc2, blockType); + + // world.getPlayerIds + } else if (command.equals("getPlayerIds")) { + StringBuilder bdr = new StringBuilder(); + Collection players = Bukkit.getOnlinePlayers(); + if (players.size() > 0) { + for (Player p : players) { + bdr.append(p.getEntityId()); + bdr.append("|"); + } + bdr.deleteCharAt(bdr.length() - 1); + session.send(bdr.toString()); + } else { + session.send("Fail," + "There are no players in the server."); + } + + // world.getPlayerId + } else if (command.equals("getPlayerId")) { + Player p = plugin.getNamedPlayer(args[0]); + if (p != null) { + session.send(p.getEntityId()); + } else { + plugin.getLogger().info("Player [" + args[0] + "] not found."); + session.send("Fail," + "T he player not exist"); + } + + // world.getHeight + } else if (command.equals("getHeight")) { + session.send(world.getHighestBlockYAt(session.parseRelativeBlockLocation(args[0], "0", args[1]))); + + } + // world.setSign + else if (command.equals("setSign")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Block thisBlock = world.getBlockAt(loc); + + thisBlock.setType(Material.valueOf(args[3])); + + org.bukkit.block.data.type.Sign s = (org.bukkit.block.data.type.Sign) thisBlock.getBlockData(); + s.setRotation(BlockFace.valueOf(args[4])); + thisBlock.setBlockData(s); + + BlockState signState = thisBlock.getState(); + + if (signState instanceof Sign) { + Sign sign = (Sign) signState; + + for (int i = 5; i - 5 < 4 && i < args.length; i++) { + sign.setLine(i - 5, args[i]); + } + sign.update(); + } + + + } else if (command.equals("setWallSign")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Block thisBlock = world.getBlockAt(loc); + thisBlock.setType(Material.valueOf(args[3])); + + WallSign s = (WallSign) thisBlock.getBlockData(); + s.setFacing(BlockFace.valueOf(args[4])); + thisBlock.setBlockData(s); + + BlockState signState = thisBlock.getState(); + + if (signState instanceof Sign) { + Sign sign = (Sign) signState; + + for (int i = 5; i - 5 < 4 && i < args.length; i++) { + sign.setLine(i - 5, args[i]); + } + sign.update(); + } + + // world.spawnEntity + } else if (command.equals("spawnEntity")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Entity entity = world.spawnEntity(loc, EntityType.fromId(Integer.parseInt(args[3]))); + session.send(entity.getEntityId()); + + // world.explode + } else if (command.equals("createExplosion")) { + Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]); + Float power = Float.parseFloat(args[3]); + + world.createExplosion(loc, power); + + // world.getEntityTypes + } else if (command.equals("getEntityTypes")) { + StringBuilder bdr = new StringBuilder(); + for (EntityType entityType : EntityType.values()) { + if (entityType.isSpawnable() && entityType.getTypeId() >= 0) { + bdr.append(entityType.getTypeId()); + bdr.append(","); + bdr.append(entityType.toString()); + bdr.append("|"); + } + } + session.send(bdr.toString()); + + } else { + session.plugin.getLogger().warning(preFix + command + " is not supported."); + session.send("Fail," + preFix + command + " is not supported."); + } + } + + // create a cuboid of lots of blocks + private void setCuboid(Location pos1, Location pos2, String blockType) { + int minX, maxX, minY, maxY, minZ, maxZ; + World world = pos1.getWorld(); + minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + + for (int x = minX; x <= maxX; ++x) { + for (int z = minZ; z <= maxZ; ++z) { + for (int y = minY; y <= maxY; ++y) { + updateBlock(world, x, y, z, blockType); + } + } + } + } + + // get a cuboid of lots of blocks + private String getBlocks(Location pos1, Location pos2) { + StringBuilder blockData = new StringBuilder(); + + int minX, maxX, minY, maxY, minZ, maxZ; + World world = pos1.getWorld(); + minX = pos1.getBlockX() < pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + maxX = pos1.getBlockX() >= pos2.getBlockX() ? pos1.getBlockX() : pos2.getBlockX(); + minY = pos1.getBlockY() < pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + maxY = pos1.getBlockY() >= pos2.getBlockY() ? pos1.getBlockY() : pos2.getBlockY(); + minZ = pos1.getBlockZ() < pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + maxZ = pos1.getBlockZ() >= pos2.getBlockZ() ? pos1.getBlockZ() : pos2.getBlockZ(); + + for (int y = minY; y <= maxY; ++y) { + for (int x = minX; x <= maxX; ++x) { + for (int z = minZ; z <= maxZ; ++z) { + blockData.append(world.getBlockAt(x, y, z).getType().name() + ","); + } + } + } + + return blockData.substring(0, blockData.length() > 0 ? blockData.length() - 1 : 0); // We don't want last comma + } + + // updates a block + private void updateBlock(World world, Location loc, String blockType) { + Block thisBlock = world.getBlockAt(loc); + updateBlock(thisBlock, blockType); + } + + private void updateBlock(World world, int x, int y, int z, String blockType) { + Block thisBlock = world.getBlockAt(x, y, z); + updateBlock(thisBlock, blockType); + } + + private void updateBlock(Block thisBlock, String blockType) { + // check to see if the block is different - otherwise leave it + blockType = blockType.toUpperCase(); + if ((thisBlock.getType() != Material.valueOf(blockType))) { + thisBlock.setType(Material.valueOf(blockType.toUpperCase())); + } + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 46a97e03..5fd14ef8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,7 +2,7 @@ port: 4711 # Determine whether locations are RELATIVE to the spawn point (default like pi) or ABSOLUTE -location: RELATIVE +location: ABSOLUTE # Determine whether hit events are triggered by LEFT clicks, RIGHT clicks or BOTH -hitclick: RIGHT \ No newline at end of file +hitclick: LEFT \ No newline at end of file diff --git a/src/main/resources/mcpi/api/python/original/mcpi/__init__.py b/src/main/resources/mcpi/__init__.py similarity index 100% rename from src/main/resources/mcpi/api/python/original/mcpi/__init__.py rename to src/main/resources/mcpi/__init__.py diff --git a/src/main/resources/mcpi/api/java/HOW_TO_RUN_DEMOS.txt b/src/main/resources/mcpi/api/java/HOW_TO_RUN_DEMOS.txt deleted file mode 100644 index 0cf53f03..00000000 --- a/src/main/resources/mcpi/api/java/HOW_TO_RUN_DEMOS.txt +++ /dev/null @@ -1,8 +0,0 @@ -Use one of the lines below to run a demo. [host] is an optional ip-address. - -java -cp McPiDemos.jar pi.demo.LoopDemo [host] -java -cp McPiDemos.jar pi.demo.LowLevelDemo [host] -java -cp McPiDemos.jar pi.demo.TextDemo [host] -java -cp McPiDemos.jar pi.demo.TurtleDemo [host] - -java -cp McPiDemos.jar pi.demo.sokoban.Sokoban [host] diff --git a/src/main/resources/mcpi/api/java/McPi.jar b/src/main/resources/mcpi/api/java/McPi.jar deleted file mode 100644 index 7118ab8e..00000000 Binary files a/src/main/resources/mcpi/api/java/McPi.jar and /dev/null differ diff --git a/src/main/resources/mcpi/api/java/McPiDemos.jar b/src/main/resources/mcpi/api/java/McPiDemos.jar deleted file mode 100644 index cded4d08..00000000 Binary files a/src/main/resources/mcpi/api/java/McPiDemos.jar and /dev/null differ diff --git a/src/main/resources/mcpi/api/java/doc/allclasses-frame.html b/src/main/resources/mcpi/api/java/doc/allclasses-frame.html deleted file mode 100644 index 95f4938d..00000000 --- a/src/main/resources/mcpi/api/java/doc/allclasses-frame.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -All Classes (Minecraft Pi Edition, Java API) - - - - - - - - - - - -All Classes -
- - - - - -
Block -
-BlockEvent -
-BlockHitEvent -
-Color -
-Item -
-Minecraft -
-Text -
-Tools -
-Turtle -
-Vec -
-Vec.Unit -
-VecFloat -
-
- - - diff --git a/src/main/resources/mcpi/api/java/doc/allclasses-noframe.html b/src/main/resources/mcpi/api/java/doc/allclasses-noframe.html deleted file mode 100644 index e3cdb78b..00000000 --- a/src/main/resources/mcpi/api/java/doc/allclasses-noframe.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -All Classes (Minecraft Pi Edition, Java API) - - - - - - - - - - - -All Classes -
- - - - - -
Block -
-BlockEvent -
-BlockHitEvent -
-Color -
-Item -
-Minecraft -
-Text -
-Tools -
-Turtle -
-Vec -
-Vec.Unit -
-VecFloat -
-
- - - diff --git a/src/main/resources/mcpi/api/java/doc/constant-values.html b/src/main/resources/mcpi/api/java/doc/constant-values.html deleted file mode 100644 index af5892f3..00000000 --- a/src/main/resources/mcpi/api/java/doc/constant-values.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Constant Field Values (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Constant Field Values

-
-
-Contents - - - - - - -
-pi.*
- -

- - - - - - - - - - - - - - - - - -
pi.Vec
-public static final intMAX_Y127
-public static final intMIN_Y-128
- -

- -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/deprecated-list.html b/src/main/resources/mcpi/api/java/doc/deprecated-list.html deleted file mode 100644 index a754ff8c..00000000 --- a/src/main/resources/mcpi/api/java/doc/deprecated-list.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - -Deprecated List (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Deprecated API

-
-
-Contents
    -
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/index.html b/src/main/resources/mcpi/api/java/doc/index.html deleted file mode 100644 index 2fdfe5a0..00000000 --- a/src/main/resources/mcpi/api/java/doc/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -Minecraft Pi Edition, Java API - - - - - - - - - - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to<A HREF="overview-summary.html">Non-frame version.</A> - - - diff --git a/src/main/resources/mcpi/api/java/doc/overview-frame.html b/src/main/resources/mcpi/api/java/doc/overview-frame.html deleted file mode 100644 index a6537ec7..00000000 --- a/src/main/resources/mcpi/api/java/doc/overview-frame.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -Overview List (Minecraft Pi Edition, Java API) - - - - - - - - - - - - - - - -
-
- - - - - -
All Classes -

- -Packages -
-pi -
-pi.event -
-pi.tool -
-

- -

-  - - diff --git a/src/main/resources/mcpi/api/java/doc/overview-summary.html b/src/main/resources/mcpi/api/java/doc/overview-summary.html deleted file mode 100644 index bbd5bdf2..00000000 --- a/src/main/resources/mcpi/api/java/doc/overview-summary.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - -Overview (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -


- -
-
-

-Minecraft Pi Edition - Java API -

-
- - - - - - - - - - - - - - - - - -
-Api
piProtocol classes
pi.eventUse to react on events in the game
pi.toolTools with higher level functionality
- -


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/package-list b/src/main/resources/mcpi/api/java/doc/package-list deleted file mode 100644 index 582d0c9b..00000000 --- a/src/main/resources/mcpi/api/java/doc/package-list +++ /dev/null @@ -1,3 +0,0 @@ -pi -pi.event -pi.tool diff --git a/src/main/resources/mcpi/api/java/doc/pi/Block.html b/src/main/resources/mcpi/api/java/doc/pi/Block.html deleted file mode 100644 index 00fd3fb7..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Block.html +++ /dev/null @@ -1,1534 +0,0 @@ - - - - - - - -Block (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Block

-
-Object
-  extended by pi.Block
-
-
-
-
public class Block
extends Object
- - -

-A Minecraft Block description -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
-static BlockAIR - -
-           
-static BlockBED - -
-           
-static BlockBEDROCK - -
-           
-static BlockBEDROCK_INVISIBLE - -
-           
-static BlockBOOKSHELF - -
-           
-static BlockBRICK_BLOCK - -
-           
-static BlockCACTUS - -
-           
-static BlockCHEST - -
-           
-static BlockCLAY - -
-           
-static BlockCOAL_ORE - -
-           
-static BlockCOBBLESTONE - -
-           
-static BlockCOBWEB - -
-           
-static BlockCRAFTING_TABLE - -
-           
-static BlockDIAMOND_BLOCK - -
-           
-static BlockDIAMOND_ORE - -
-           
-static BlockDIRT - -
-           
-static BlockDOOR_IRON - -
-           
-static BlockDOOR_WOOD - -
-           
-static BlockFARMLAND - -
-           
-static BlockFENCE - -
-           
-static BlockFENCE_GATE - -
-           
-static BlockFIRE - -
-           
-static BlockFLOWER_CYAN - -
-           
-static BlockFLOWER_YELLOW - -
-           
-static BlockFURNACE_ACTIVE - -
-           
-static BlockFURNACE_INACTIVE - -
-           
-static BlockGLASS - -
-           
-static BlockGLASS_PANE - -
-           
-static BlockGLOWING_OBSIDIAN - -
-           
-static BlockGLOWSTONE_BLOCK - -
-           
-static BlockGOLD_BLOCK - -
-           
-static BlockGOLD_ORE - -
-           
-static BlockGRASS - -
-           
-static BlockGRASS_TALL - -
-           
-static BlockGRAVEL - -
-           
-static BlockICE - -
-           
-static BlockIRON_BLOCK - -
-           
-static BlockIRON_ORE - -
-           
-static BlockLADDER - -
-           
-static BlockLAPIS_LAZULI_BLOCK - -
-           
-static BlockLAPIS_LAZULI_ORE - -
-           
-static BlockLAVA - -
-           
-static BlockLAVA_FLOWING - -
-           
-static BlockLAVA_STATIONARY - -
-           
-static BlockLEAVES - -
-           
-static BlockMELON - -
-           
-static BlockMOSS_STONE - -
-           
-static BlockMUSHROOM_BROWN - -
-           
-static BlockMUSHROOM_RED - -
-           
-static BlockNETHER_REACTOR_CORE - -
-           
-static BlockOBSIDIAN - -
-           
-static BlockREDSTONE_ORE - -
-           
-static BlockSAND - -
-           
-static BlockSANDSTONE - -
-           
-static BlockSAPLING - -
-           
-static BlockSNOW - -
-           
-static BlockSNOW_BLOCK - -
-           
-static BlockSTAIRS_COBBLESTONE - -
-           
-static BlockSTAIRS_WOOD - -
-           
-static BlockSTONE - -
-           
-static BlockSTONE_BRICK - -
-           
-static BlockSTONE_SLAB - -
-           
-static BlockSTONE_SLAB_DOUBLE - -
-           
-static BlockSUGAR_CANE - -
-           
-static BlockTNT - -
-           
-static BlockTORCH - -
-           
-static BlockWATER - -
-           
-static BlockWATER_FLOWING - -
-           
-static BlockWATER_STATIONARY - -
-           
-static BlockWOOD - -
-           
-static BlockWOOD_PLANKS - -
-           
-static BlockWOOL - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- booleanequals(Object obj) - -
-           
- inthashCode() - -
-           
-static Blockid(int id) - -
-          Get a block with and withId (use a constant like Block.TNT)
- StringtoString() - -
-           
- BlockwithData(int data) - -
-          Get a block with extra data
-static Blockwool(Color color) - -
-          Get a wool block of a specific color
- - - - - - - -
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-AIR

-
-public static final Block AIR
-
-
-
-
-
- -

-STONE

-
-public static final Block STONE
-
-
-
-
-
- -

-GRASS

-
-public static final Block GRASS
-
-
-
-
-
- -

-DIRT

-
-public static final Block DIRT
-
-
-
-
-
- -

-COBBLESTONE

-
-public static final Block COBBLESTONE
-
-
-
-
-
- -

-WOOD_PLANKS

-
-public static final Block WOOD_PLANKS
-
-
-
-
-
- -

-SAPLING

-
-public static final Block SAPLING
-
-
-
-
-
- -

-BEDROCK

-
-public static final Block BEDROCK
-
-
-
-
-
- -

-WATER_FLOWING

-
-public static final Block WATER_FLOWING
-
-
-
-
-
- -

-WATER

-
-public static final Block WATER
-
-
-
-
-
- -

-WATER_STATIONARY

-
-public static final Block WATER_STATIONARY
-
-
-
-
-
- -

-LAVA_FLOWING

-
-public static final Block LAVA_FLOWING
-
-
-
-
-
- -

-LAVA

-
-public static final Block LAVA
-
-
-
-
-
- -

-LAVA_STATIONARY

-
-public static final Block LAVA_STATIONARY
-
-
-
-
-
- -

-SAND

-
-public static final Block SAND
-
-
-
-
-
- -

-GRAVEL

-
-public static final Block GRAVEL
-
-
-
-
-
- -

-GOLD_ORE

-
-public static final Block GOLD_ORE
-
-
-
-
-
- -

-IRON_ORE

-
-public static final Block IRON_ORE
-
-
-
-
-
- -

-COAL_ORE

-
-public static final Block COAL_ORE
-
-
-
-
-
- -

-WOOD

-
-public static final Block WOOD
-
-
-
-
-
- -

-LEAVES

-
-public static final Block LEAVES
-
-
-
-
-
- -

-GLASS

-
-public static final Block GLASS
-
-
-
-
-
- -

-LAPIS_LAZULI_ORE

-
-public static final Block LAPIS_LAZULI_ORE
-
-
-
-
-
- -

-LAPIS_LAZULI_BLOCK

-
-public static final Block LAPIS_LAZULI_BLOCK
-
-
-
-
-
- -

-SANDSTONE

-
-public static final Block SANDSTONE
-
-
-
-
-
- -

-BED

-
-public static final Block BED
-
-
-
-
-
- -

-COBWEB

-
-public static final Block COBWEB
-
-
-
-
-
- -

-GRASS_TALL

-
-public static final Block GRASS_TALL
-
-
-
-
-
- -

-WOOL

-
-public static final Block WOOL
-
-
-
-
-
- -

-FLOWER_YELLOW

-
-public static final Block FLOWER_YELLOW
-
-
-
-
-
- -

-FLOWER_CYAN

-
-public static final Block FLOWER_CYAN
-
-
-
-
-
- -

-MUSHROOM_BROWN

-
-public static final Block MUSHROOM_BROWN
-
-
-
-
-
- -

-MUSHROOM_RED

-
-public static final Block MUSHROOM_RED
-
-
-
-
-
- -

-GOLD_BLOCK

-
-public static final Block GOLD_BLOCK
-
-
-
-
-
- -

-IRON_BLOCK

-
-public static final Block IRON_BLOCK
-
-
-
-
-
- -

-STONE_SLAB_DOUBLE

-
-public static final Block STONE_SLAB_DOUBLE
-
-
-
-
-
- -

-STONE_SLAB

-
-public static final Block STONE_SLAB
-
-
-
-
-
- -

-BRICK_BLOCK

-
-public static final Block BRICK_BLOCK
-
-
-
-
-
- -

-TNT

-
-public static final Block TNT
-
-
-
-
-
- -

-BOOKSHELF

-
-public static final Block BOOKSHELF
-
-
-
-
-
- -

-MOSS_STONE

-
-public static final Block MOSS_STONE
-
-
-
-
-
- -

-OBSIDIAN

-
-public static final Block OBSIDIAN
-
-
-
-
-
- -

-TORCH

-
-public static final Block TORCH
-
-
-
-
-
- -

-FIRE

-
-public static final Block FIRE
-
-
-
-
-
- -

-STAIRS_WOOD

-
-public static final Block STAIRS_WOOD
-
-
-
-
-
- -

-CHEST

-
-public static final Block CHEST
-
-
-
-
-
- -

-DIAMOND_ORE

-
-public static final Block DIAMOND_ORE
-
-
-
-
-
- -

-DIAMOND_BLOCK

-
-public static final Block DIAMOND_BLOCK
-
-
-
-
-
- -

-CRAFTING_TABLE

-
-public static final Block CRAFTING_TABLE
-
-
-
-
-
- -

-FARMLAND

-
-public static final Block FARMLAND
-
-
-
-
-
- -

-FURNACE_INACTIVE

-
-public static final Block FURNACE_INACTIVE
-
-
-
-
-
- -

-FURNACE_ACTIVE

-
-public static final Block FURNACE_ACTIVE
-
-
-
-
-
- -

-DOOR_WOOD

-
-public static final Block DOOR_WOOD
-
-
-
-
-
- -

-LADDER

-
-public static final Block LADDER
-
-
-
-
-
- -

-STAIRS_COBBLESTONE

-
-public static final Block STAIRS_COBBLESTONE
-
-
-
-
-
- -

-DOOR_IRON

-
-public static final Block DOOR_IRON
-
-
-
-
-
- -

-REDSTONE_ORE

-
-public static final Block REDSTONE_ORE
-
-
-
-
-
- -

-SNOW

-
-public static final Block SNOW
-
-
-
-
-
- -

-ICE

-
-public static final Block ICE
-
-
-
-
-
- -

-SNOW_BLOCK

-
-public static final Block SNOW_BLOCK
-
-
-
-
-
- -

-CACTUS

-
-public static final Block CACTUS
-
-
-
-
-
- -

-CLAY

-
-public static final Block CLAY
-
-
-
-
-
- -

-SUGAR_CANE

-
-public static final Block SUGAR_CANE
-
-
-
-
-
- -

-FENCE

-
-public static final Block FENCE
-
-
-
-
-
- -

-GLOWSTONE_BLOCK

-
-public static final Block GLOWSTONE_BLOCK
-
-
-
-
-
- -

-BEDROCK_INVISIBLE

-
-public static final Block BEDROCK_INVISIBLE
-
-
-
-
-
- -

-STONE_BRICK

-
-public static final Block STONE_BRICK
-
-
-
-
-
- -

-GLASS_PANE

-
-public static final Block GLASS_PANE
-
-
-
-
-
- -

-MELON

-
-public static final Block MELON
-
-
-
-
-
- -

-FENCE_GATE

-
-public static final Block FENCE_GATE
-
-
-
-
-
- -

-GLOWING_OBSIDIAN

-
-public static final Block GLOWING_OBSIDIAN
-
-
-
-
-
- -

-NETHER_REACTOR_CORE

-
-public static final Block NETHER_REACTOR_CORE
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-id

-
-public static Block id(int id)
-
-
Get a block with and withId (use a constant like Block.TNT) -

-

-
-
-
-
- -

-withData

-
-public Block withData(int data)
-
-
Get a block with extra data -

-

-
-
-
-
- -

-hashCode

-
-public int hashCode()
-
-
-
Overrides:
hashCode in class Object
-
-
-
-
-
-
- -

-equals

-
-public boolean equals(Object obj)
-
-
-
Overrides:
equals in class Object
-
-
-
-
-
-
- -

-toString

-
-public String toString()
-
-
-
Overrides:
toString in class Object
-
-
-
-
-
-
- -

-wool

-
-public static Block wool(Color color)
-
-
Get a wool block of a specific color -

-

-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Color.html b/src/main/resources/mcpi/api/java/doc/pi/Color.html deleted file mode 100644 index 6653a288..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Color.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - - -Color (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Enum Color

-
-Object
-  extended by Enum<Color>
-      extended by pi.Color
-
-
-
All Implemented Interfaces:
java.io.Serializable, Comparable<Color>
-
-
-
-
public enum Color
extends Enum<Color>
- - -

-Colors -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Enum Constant Summary
BLACK - -
-           
BLUE - -
-           
BROWN - -
-           
CYAN - -
-           
GRAY - -
-           
GREEN - -
-           
LIGHT_BLUE - -
-           
LIGHT_GRAY - -
-           
LIME - -
-           
MAGENTA - -
-           
ORANGE - -
-           
PINK - -
-           
PURPLE - -
-           
RED - -
-           
WHITE - -
-           
YELLOW - -
-           
-  - - - - - - - - - - - - - - - -
-Method Summary
-static ColorvalueOf(String name) - -
-          Returns the enum constant of this type with the specified name.
-static Color[]values() - -
-          Returns an array containing the constants of this enum type, in -the order they are declared.
- - - - - - - -
Methods inherited from class Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
- - - - - - - -
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Enum Constant Detail
- -

-WHITE

-
-public static final Color WHITE
-
-
-
-
-
- -

-ORANGE

-
-public static final Color ORANGE
-
-
-
-
-
- -

-MAGENTA

-
-public static final Color MAGENTA
-
-
-
-
-
- -

-LIGHT_BLUE

-
-public static final Color LIGHT_BLUE
-
-
-
-
-
- -

-YELLOW

-
-public static final Color YELLOW
-
-
-
-
-
- -

-LIME

-
-public static final Color LIME
-
-
-
-
-
- -

-PINK

-
-public static final Color PINK
-
-
-
-
-
- -

-GRAY

-
-public static final Color GRAY
-
-
-
-
-
- -

-LIGHT_GRAY

-
-public static final Color LIGHT_GRAY
-
-
-
-
-
- -

-CYAN

-
-public static final Color CYAN
-
-
-
-
-
- -

-PURPLE

-
-public static final Color PURPLE
-
-
-
-
-
- -

-BLUE

-
-public static final Color BLUE
-
-
-
-
-
- -

-BROWN

-
-public static final Color BROWN
-
-
-
-
-
- -

-GREEN

-
-public static final Color GREEN
-
-
-
-
-
- -

-RED

-
-public static final Color RED
-
-
-
-
-
- -

-BLACK

-
-public static final Color BLACK
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-values

-
-public static Color[] values()
-
-
Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
-for (Color c : Color.values())
-    System.out.println(c);
-
-

-

- -
Returns:
an array containing the constants of this enum type, in -the order they are declared
-
-
-
- -

-valueOf

-
-public static Color valueOf(String name)
-
-
Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.) -

-

-
Parameters:
name - the name of the enum constant to be returned. -
Returns:
the enum constant with the specified name -
Throws: -
IllegalArgumentException - if this enum type has no constant -with the specified name -
NullPointerException - if the argument is null
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Item.html b/src/main/resources/mcpi/api/java/doc/pi/Item.html deleted file mode 100644 index 8af6ab07..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Item.html +++ /dev/null @@ -1,1129 +0,0 @@ - - - - - - - -Item (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Item

-
-Object
-  extended by pi.Item
-
-
-
-
public class Item
extends Object
- - -

-A Minecraft Item description (no use yet) -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
-static ItemARROW - -
-           
-static ItemBONE - -
-           
-static ItemBOOK - -
-           
-static ItemBOW - -
-           
-static ItemBOWL - -
-           
-static ItemCAMERA - -
-           
-static ItemCLAY - -
-           
-static ItemCLAY_BRICK - -
-           
-static ItemCLOCK - -
-           
-static ItemCOAL - -
-           
-static ItemCOMPASS - -
-           
-static ItemDIAMOND - -
-           
-static ItemDIAMOND_AXE - -
-           
-static ItemDIAMOND_PICKAXE - -
-           
-static ItemDIAMOND_SHOVEL - -
-           
-static ItemDIAMOND_SWORD - -
-           
-static ItemDYE - -
-           
-static ItemEGG - -
-           
-static ItemFEATHER - -
-           
-static ItemFLINT - -
-           
-static ItemGLOWSTONE_DUST - -
-           
-static ItemGOLD_AXE - -
-           
-static ItemGOLD_INGOT - -
-           
-static ItemGOLD_PICKAXE - -
-           
-static ItemGOLD_SHOVEL - -
-           
-static ItemGOLD_SWORD - -
-           
-static ItemGUNPOWDER - -
-           
-static ItemIRON_AXE - -
-           
-static ItemIRON_DOOR - -
-           
-static ItemIRON_INGOT - -
-           
-static ItemIRON_PICKAXE - -
-           
-static ItemIRON_SHOVEL - -
-           
-static ItemIRON_SWORD - -
-           
-static ItemLEATHER - -
-           
-static ItemPAPER - -
-           
-static ItemSHEARS - -
-           
-static ItemSIGN - -
-           
-static ItemSLIMEBALL - -
-           
-static ItemSNOWBALL - -
-           
-static ItemSTICK - -
-           
-static ItemSTONE_AXE - -
-           
-static ItemSTONE_PICKAXE - -
-           
-static ItemSTONE_SHOVEL - -
-           
-static ItemSTONE_SWORD - -
-           
-static ItemSTRING - -
-           
-static ItemSUGAR - -
-           
-static ItemSUGAR_CANE - -
-           
-static ItemWHEAT - -
-           
-static ItemWOODEN_AXE - -
-           
-static ItemWOODEN_DOOR - -
-           
-static ItemWOODEN_PICKAXE - -
-           
-static ItemWOODEN_SHOVEL - -
-           
-static ItemWOODEN_SWORD - -
-           
-  - - - - - - - - - - - - - - - - - - - -
-Method Summary
- booleanequals(Object obj) - -
-           
- inthashCode() - -
-           
- StringtoString() - -
-           
- - - - - - - -
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-IRON_SHOVEL

-
-public static final Item IRON_SHOVEL
-
-
-
-
-
- -

-IRON_PICKAXE

-
-public static final Item IRON_PICKAXE
-
-
-
-
-
- -

-IRON_AXE

-
-public static final Item IRON_AXE
-
-
-
-
-
- -

-BOW

-
-public static final Item BOW
-
-
-
-
-
- -

-ARROW

-
-public static final Item ARROW
-
-
-
-
-
- -

-COAL

-
-public static final Item COAL
-
-
-
-
-
- -

-DIAMOND

-
-public static final Item DIAMOND
-
-
-
-
-
- -

-IRON_INGOT

-
-public static final Item IRON_INGOT
-
-
-
-
-
- -

-GOLD_INGOT

-
-public static final Item GOLD_INGOT
-
-
-
-
-
- -

-IRON_SWORD

-
-public static final Item IRON_SWORD
-
-
-
-
-
- -

-WOODEN_SWORD

-
-public static final Item WOODEN_SWORD
-
-
-
-
-
- -

-WOODEN_SHOVEL

-
-public static final Item WOODEN_SHOVEL
-
-
-
-
-
- -

-WOODEN_PICKAXE

-
-public static final Item WOODEN_PICKAXE
-
-
-
-
-
- -

-WOODEN_AXE

-
-public static final Item WOODEN_AXE
-
-
-
-
-
- -

-STONE_SWORD

-
-public static final Item STONE_SWORD
-
-
-
-
-
- -

-STONE_SHOVEL

-
-public static final Item STONE_SHOVEL
-
-
-
-
-
- -

-STONE_PICKAXE

-
-public static final Item STONE_PICKAXE
-
-
-
-
-
- -

-STONE_AXE

-
-public static final Item STONE_AXE
-
-
-
-
-
- -

-DIAMOND_SWORD

-
-public static final Item DIAMOND_SWORD
-
-
-
-
-
- -

-DIAMOND_SHOVEL

-
-public static final Item DIAMOND_SHOVEL
-
-
-
-
-
- -

-DIAMOND_PICKAXE

-
-public static final Item DIAMOND_PICKAXE
-
-
-
-
-
- -

-DIAMOND_AXE

-
-public static final Item DIAMOND_AXE
-
-
-
-
-
- -

-STICK

-
-public static final Item STICK
-
-
-
-
-
- -

-BOWL

-
-public static final Item BOWL
-
-
-
-
-
- -

-GOLD_SWORD

-
-public static final Item GOLD_SWORD
-
-
-
-
-
- -

-GOLD_SHOVEL

-
-public static final Item GOLD_SHOVEL
-
-
-
-
-
- -

-GOLD_PICKAXE

-
-public static final Item GOLD_PICKAXE
-
-
-
-
-
- -

-GOLD_AXE

-
-public static final Item GOLD_AXE
-
-
-
-
-
- -

-STRING

-
-public static final Item STRING
-
-
-
-
-
- -

-FEATHER

-
-public static final Item FEATHER
-
-
-
-
-
- -

-GUNPOWDER

-
-public static final Item GUNPOWDER
-
-
-
-
-
- -

-FLINT

-
-public static final Item FLINT
-
-
-
-
-
- -

-WHEAT

-
-public static final Item WHEAT
-
-
-
-
-
- -

-SIGN

-
-public static final Item SIGN
-
-
-
-
-
- -

-WOODEN_DOOR

-
-public static final Item WOODEN_DOOR
-
-
-
-
-
- -

-IRON_DOOR

-
-public static final Item IRON_DOOR
-
-
-
-
-
- -

-SNOWBALL

-
-public static final Item SNOWBALL
-
-
-
-
-
- -

-LEATHER

-
-public static final Item LEATHER
-
-
-
-
-
- -

-CLAY_BRICK

-
-public static final Item CLAY_BRICK
-
-
-
-
-
- -

-CLAY

-
-public static final Item CLAY
-
-
-
-
-
- -

-SUGAR_CANE

-
-public static final Item SUGAR_CANE
-
-
-
-
-
- -

-PAPER

-
-public static final Item PAPER
-
-
-
-
-
- -

-BOOK

-
-public static final Item BOOK
-
-
-
-
-
- -

-SLIMEBALL

-
-public static final Item SLIMEBALL
-
-
-
-
-
- -

-EGG

-
-public static final Item EGG
-
-
-
-
-
- -

-COMPASS

-
-public static final Item COMPASS
-
-
-
-
-
- -

-CLOCK

-
-public static final Item CLOCK
-
-
-
-
-
- -

-GLOWSTONE_DUST

-
-public static final Item GLOWSTONE_DUST
-
-
-
-
-
- -

-DYE

-
-public static final Item DYE
-
-
-
-
-
- -

-BONE

-
-public static final Item BONE
-
-
-
-
-
- -

-SUGAR

-
-public static final Item SUGAR
-
-
-
-
-
- -

-SHEARS

-
-public static final Item SHEARS
-
-
-
-
-
- -

-CAMERA

-
-public static final Item CAMERA
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-hashCode

-
-public int hashCode()
-
-
-
Overrides:
hashCode in class Object
-
-
-
-
-
-
- -

-equals

-
-public boolean equals(Object obj)
-
-
-
Overrides:
equals in class Object
-
-
-
-
-
-
- -

-toString

-
-public String toString()
-
-
-
Overrides:
toString in class Object
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Camera.html b/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Camera.html deleted file mode 100644 index c928199c..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Camera.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - -Minecraft.Camera (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Minecraft.Camera

-
-Object
-  extended by pi.Minecraft.Camera
-
-
-
Enclosing class:
Minecraft
-
-
-
-
public class Minecraft.Camera
extends Object
- - -

-Control the camera in the game we're connected to -

- -

-


- -

- - - - - - - - - - - -
-Constructor Summary
Minecraft.Camera() - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- voidsetFixed() - -
-           
- voidsetNormal() - -
-           
- voidsetNormal(int mobEntityId) - -
-           
- voidsetPosition(VecFloat position) - -
-           
- voidsetThirdPerson() - -
-           
- voidsetThirdPerson(int entityId) - -
-           
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Constructor Detail
- -

-Minecraft.Camera

-
-public Minecraft.Camera()
-
-
- - - - - - - - -
-Method Detail
- -

-setNormal

-
-public void setNormal()
-
-
-
-
-
-
- -

-setNormal

-
-public void setNormal(int mobEntityId)
-
-
-
-
-
-
- -

-setThirdPerson

-
-public void setThirdPerson()
-
-
-
-
-
-
- -

-setThirdPerson

-
-public void setThirdPerson(int entityId)
-
-
-
-
-
-
- -

-setFixed

-
-public void setFixed()
-
-
-
-
-
-
- -

-setPosition

-
-public void setPosition(VecFloat position)
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Entities.html b/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Entities.html deleted file mode 100644 index 4abd09ac..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Entities.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - -Minecraft.Entities (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Minecraft.Entities

-
-Object
-  extended by pi.Minecraft.Entities
-
-
-
Enclosing class:
Minecraft
-
-
-
-
public class Minecraft.Entities
extends Object
- - -

-Methods for entities -

- -

-


- -

- - - - - - - - - - - -
-Constructor Summary
Minecraft.Entities() - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- VecFloatgetExactPosition(int entityId) - -
-           
- VecgetPosition(int entityId) - -
-           
- voidsetExactPosition(VecFloat pos) - -
-           
- voidsetPosition(int entityId, - Vec tile) - -
-           
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Constructor Detail
- -

-Minecraft.Entities

-
-public Minecraft.Entities()
-
-
- - - - - - - - -
-Method Detail
- -

-getPosition

-
-public Vec getPosition(int entityId)
-
-
-
-
-
-
- -

-setPosition

-
-public void setPosition(int entityId,
-                        Vec tile)
-
-
-
-
-
-
- -

-getExactPosition

-
-public VecFloat getExactPosition(int entityId)
-
-
-
-
-
-
- -

-setExactPosition

-
-public void setExactPosition(VecFloat pos)
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Events.html b/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Events.html deleted file mode 100644 index 420a1cd6..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Events.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - -Minecraft.Events (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Minecraft.Events

-
-Object
-  extended by pi.Minecraft.Events
-
-
-
Enclosing class:
Minecraft
-
-
-
-
public class Minecraft.Events
extends Object
- - -

-Events -

- -

-


- -

- - - - - - - - - - - -
-Constructor Summary
Minecraft.Events() - -
-           
-  - - - - - - - - - - - - - - - -
-Method Summary
- voidclearAll() - -
-          Clear all old events
- List<BlockHitEvent>pollBlockHits() - -
-          Only triggered by sword
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Constructor Detail
- -

-Minecraft.Events

-
-public Minecraft.Events()
-
-
- - - - - - - - -
-Method Detail
- -

-clearAll

-
-public void clearAll()
-
-
Clear all old events -

-

-
-
-
-
- -

-pollBlockHits

-
-public List<BlockHitEvent> pollBlockHits()
-
-
Only triggered by sword -

-

-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Player.html b/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Player.html deleted file mode 100644 index d3a11cbd..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.Player.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - -Minecraft.Player (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Minecraft.Player

-
-Object
-  extended by pi.Minecraft.Player
-
-
-
Enclosing class:
Minecraft
-
-
-
-
public class Minecraft.Player
extends Object
- - -

-Methods for the player in the connected game -

- -

-


- -

- - - - - - - - - - - -
-Constructor Summary
Minecraft.Player() - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- VecFloatgetExactPosition() - -
-           
- VecgetPosition() - -
-           
- voidsetExactPosition(VecFloat position) - -
-           
- voidsetPosition(Vec position) - -
-           
- voidsetting(String key, - boolean value) - -
-          Keys: autojump, Values: true/false
For example to disable - automatic jumping: - mc.player.setting("autojump", false);
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Constructor Detail
- -

-Minecraft.Player

-
-public Minecraft.Player()
-
-
- - - - - - - - -
-Method Detail
- -

-getPosition

-
-public Vec getPosition()
-
-
-
-
-
-
- -

-setPosition

-
-public void setPosition(Vec position)
-
-
-
-
-
-
- -

-getExactPosition

-
-public VecFloat getExactPosition()
-
-
-
-
-
-
- -

-setExactPosition

-
-public void setExactPosition(VecFloat position)
-
-
-
-
-
-
- -

-setting

-
-public void setting(String key,
-                    boolean value)
-
-
Keys: autojump, Values: true/false
For example to disable - automatic jumping: - mc.player.setting("autojump", false); -

-

-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.html b/src/main/resources/mcpi/api/java/doc/pi/Minecraft.html deleted file mode 100644 index c8f81e52..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Minecraft.html +++ /dev/null @@ -1,657 +0,0 @@ - - - - - - - -Minecraft (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Minecraft

-
-Object
-  extended by pi.Minecraft
-
-
-
-
public class Minecraft
extends Object
- - -

-The main class to interact with a running instance of Minecraft Pi. - -

Example:   - Minecraft.connect().setBlock(0, 2, 0, Block.GOLD_ORE) -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - -
-Nested Class Summary
- classMinecraft.Camera - -
-          Control the camera in the game we're connected to
- classMinecraft.Entities - -
-          Methods for entities
- classMinecraft.Events - -
-          Events
- classMinecraft.Player - -
-          Methods for the player in the connected game
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
- Minecraft.Cameracamera - -
-           
- Minecraft.Entitiesentities - -
-           
- Minecraft.Eventsevents - -
-           
- Minecraft.Playerplayer - -
-           
- Toolstools - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- voidautoFlush(boolean auto) - -
-          If auto is false, commands are kept in a buffer until they are flushed - with flush() or the buffer fills up.
Default is to automatically - flush each command separately.
-static Minecraftconnect() - -
-          Connect to a local mcpi game
-static Minecraftconnect(String host) - -
-          Connect to a remote mcpi game
-static Minecraftconnect(String[] args) - -
-          Connect with string args
-protected  voidfinalize() - -
-           
- voidflush() - -
-          Flush commands that are buffered, not needed, unless autoFlush(false).
- BlockgetBlock(Vec position) - -
-          Get a block
- BlockgetBlockWithData(Vec position) - -
-          Get a block
- intgetHeight(int x, - int z) - -
-          Get the height of the world (last Y that isn't solid from top-down)
- int[]getPlayerEntityIds() - -
-          Get the entity ids of the connected players
- voidpostToChat(String message) - -
-          Post a message to the game chat
- voidrestoreCheckpoint() - -
-          Restore the world state to the checkpoint
- voidsaveCheckpoint() - -
-          Save a checkpoint that can be used for restoring the world
- voidsetBlock(int x, - int y, - int z, - Block block) - -
-          Set a block
- voidsetBlock(Vec position, - Block block) - -
-          Set a block
- voidsetBlocks(int x1, - int y1, - int z1, - int x2, - int y2, - int z2, - Block block) - -
-          Set a cuboid of blocks
- voidsetBlocks(Vec begin, - Vec end, - Block block) - -
-          Set a cuboid of blocks
- voidsetting(String key, - boolean value) - -
-          Keys: "world_immutable", "nametags_visible"
- - - - - - - -
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-camera

-
-public final Minecraft.Camera camera
-
-
-
-
-
- -

-player

-
-public final Minecraft.Player player
-
-
-
-
-
- -

-entities

-
-public final Minecraft.Entities entities
-
-
-
-
-
- -

-events

-
-public final Minecraft.Events events
-
-
-
-
-
- -

-tools

-
-public final Tools tools
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-connect

-
-public static Minecraft connect()
-
-
Connect to a local mcpi game -

-

-
-
-
-
- -

-connect

-
-public static Minecraft connect(String host)
-
-
Connect to a remote mcpi game -

-

-
-
-
-
- -

-connect

-
-public static Minecraft connect(String[] args)
-
-
Connect with string args -

-

-
Parameters:
args - an array with optional host, port
-
-
-
- -

-getBlock

-
-public Block getBlock(Vec position)
-
-
Get a block -

-

-
-
-
-
- -

-getBlockWithData

-
-public Block getBlockWithData(Vec position)
-
-
Get a block -

-

-
-
-
-
- -

-setBlock

-
-public void setBlock(int x,
-                     int y,
-                     int z,
-                     Block block)
-
-
Set a block -

-

-
-
-
-
- -

-setBlock

-
-public void setBlock(Vec position,
-                     Block block)
-
-
Set a block -

-

-
-
-
-
- -

-setBlocks

-
-public void setBlocks(int x1,
-                      int y1,
-                      int z1,
-                      int x2,
-                      int y2,
-                      int z2,
-                      Block block)
-
-
Set a cuboid of blocks -

-

-
-
-
-
- -

-setBlocks

-
-public void setBlocks(Vec begin,
-                      Vec end,
-                      Block block)
-
-
Set a cuboid of blocks -

-

-
-
-
-
- -

-getHeight

-
-public int getHeight(int x,
-                     int z)
-
-
Get the height of the world (last Y that isn't solid from top-down) -

-

-
-
-
-
- -

-getPlayerEntityIds

-
-public int[] getPlayerEntityIds()
-
-
Get the entity ids of the connected players -

-

-
-
-
-
- -

-setting

-
-public void setting(String key,
-                    boolean value)
-
-
Keys: "world_immutable", "nametags_visible" -

-

-
-
-
-
- -

-saveCheckpoint

-
-public void saveCheckpoint()
-
-
Save a checkpoint that can be used for restoring the world -

-

-
-
-
-
- -

-restoreCheckpoint

-
-public void restoreCheckpoint()
-
-
Restore the world state to the checkpoint -

-

-
-
-
-
- -

-postToChat

-
-public void postToChat(String message)
-
-
Post a message to the game chat -

-

-
-
-
-
- -

-autoFlush

-
-public void autoFlush(boolean auto)
-
-
If auto is false, commands are kept in a buffer until they are flushed - with flush() or the buffer fills up.
Default is to automatically - flush each command separately. -

-

-
-
-
-
- -

-flush

-
-public void flush()
-
-
Flush commands that are buffered, not needed, unless autoFlush(false). -

-

-
-
-
-
- -

-finalize

-
-protected void finalize()
-                 throws Throwable
-
-
-
Overrides:
finalize in class Object
-
-
- -
Throws: -
Throwable
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Vec.Unit.html b/src/main/resources/mcpi/api/java/doc/pi/Vec.Unit.html deleted file mode 100644 index 3b8dc399..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Vec.Unit.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - -Vec.Unit (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Vec.Unit

-
-Object
-  extended by pi.Vec
-      extended by pi.Vec.Unit
-
-
-
Enclosing class:
Vec
-
-
-
-
public static class Vec.Unit
extends Vec
- - -

-A vector with length=1 -

- -

-


- -

- - - - - - - -
-Nested Class Summary
- - - - - - - -
Nested classes/interfaces inherited from class pi.Vec
Vec.Unit
-  - - - - - - - - - - - - - - - - - - - -
-Field Summary
-static Vec.UnitX - -
-           
-static Vec.UnitY - -
-           
-static Vec.UnitZ - -
-           
- - - - - - - -
Fields inherited from class pi.Vec
MAX_Y, MIN_Y, x, y, z, ZERO
-  - - - - - - - - - - - -
-Method Summary
- Vec.Unitneg() - -
-          Negate (multiply with -1)
- - - - - - - -
Methods inherited from class pi.Vec
add, add, dot, equals, hashCode, mul, sub, toString, xyz
- - - - - - - -
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-X

-
-public static final Vec.Unit X
-
-
-
-
-
- -

-Y

-
-public static final Vec.Unit Y
-
-
-
-
-
- -

-Z

-
-public static final Vec.Unit Z
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-neg

-
-public Vec.Unit neg()
-
-
Description copied from class: Vec
-
Negate (multiply with -1) -

-

-
Overrides:
neg in class Vec
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/Vec.html b/src/main/resources/mcpi/api/java/doc/pi/Vec.html deleted file mode 100644 index 4f3e7f23..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/Vec.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - - - - -Vec (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class Vec

-
-Object
-  extended by pi.Vec
-
-
-
Direct Known Subclasses:
Vec.Unit
-
-
-
-
public class Vec
extends Object
- - -

-


- -

- - - - - - - - - - - -
-Nested Class Summary
-static classVec.Unit - -
-          A vector with length=1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
-static intMAX_Y - -
-           
-static intMIN_Y - -
-           
- intx - -
-           
- inty - -
-           
- intz - -
-           
-static VecZERO - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- Vecadd(int x, - int y, - int z) - -
-          Add
- Vecadd(Vec v) - -
-          Add
- intdot(Vec v) - -
-          Scalar product
- booleanequals(Object obj) - -
-           
- inthashCode() - -
-           
- Vecmul(int s) - -
-          Multiply with integer (scale)
- Vecneg() - -
-          Negate (multiply with -1)
- Vecsub(Vec v) - -
-          Subtract
- StringtoString() - -
-           
-static Vecxyz(int x, - int y, - int z) - -
-          Create
- - - - - - - -
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-ZERO

-
-public static final Vec ZERO
-
-
-
-
-
- -

-MIN_Y

-
-public static final int MIN_Y
-
-
-
See Also:
Constant Field Values
-
-
- -

-MAX_Y

-
-public static final int MAX_Y
-
-
-
See Also:
Constant Field Values
-
-
- -

-x

-
-public final int x
-
-
-
-
-
- -

-y

-
-public final int y
-
-
-
-
-
- -

-z

-
-public final int z
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-xyz

-
-public static Vec xyz(int x,
-                      int y,
-                      int z)
-
-
Create -

-

-
-
-
-
- -

-add

-
-public Vec add(Vec v)
-
-
Add -

-

-
-
-
-
- -

-add

-
-public Vec add(int x,
-               int y,
-               int z)
-
-
Add -

-

-
-
-
-
- -

-sub

-
-public Vec sub(Vec v)
-
-
Subtract -

-

-
-
-
-
- -

-mul

-
-public Vec mul(int s)
-
-
Multiply with integer (scale) -

-

-
-
-
-
- -

-neg

-
-public Vec neg()
-
-
Negate (multiply with -1) -

-

-
-
-
-
- -

-dot

-
-public int dot(Vec v)
-
-
Scalar product -

-

-
-
-
-
- -

-hashCode

-
-public int hashCode()
-
-
-
Overrides:
hashCode in class Object
-
-
-
-
-
-
- -

-equals

-
-public boolean equals(Object obj)
-
-
-
Overrides:
equals in class Object
-
-
-
-
-
-
- -

-toString

-
-public final String toString()
-
-
-
Overrides:
toString in class Object
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/VecFloat.html b/src/main/resources/mcpi/api/java/doc/pi/VecFloat.html deleted file mode 100644 index 9af17a07..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/VecFloat.html +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - -VecFloat (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi -
-Class VecFloat

-
-Object
-  extended by pi.VecFloat
-
-
-
-
public class VecFloat
extends Object
- - -

-A vector of three floats -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - -
-Field Summary
- floatx - -
-           
- floaty - -
-           
- floatz - -
-           
-static VecFloatZERO - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- VecFloatadd(VecFloat v) - -
-          Add
- floatdot(VecFloat v) - -
-          Scalar product
- floatlength() - -
-          Length
- floatlengthSq() - -
-          length * length
- VecFloatmul(float s) - -
-          Multiply with a float (scale)
- VecFloatneg() - -
-          Negate (multiply with -1)
- VecFloatnormalized() - -
-          Get a vector in the same direction but with length 1
- VecFloatsub(VecFloat v) - -
-          Subtract
- StringtoString() - -
-           
-static VecFloatxyz(float x, - float y, - float z) - -
-          Create
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-ZERO

-
-public static final VecFloat ZERO
-
-
-
-
-
- -

-x

-
-public final float x
-
-
-
-
-
- -

-y

-
-public final float y
-
-
-
-
-
- -

-z

-
-public final float z
-
-
-
-
- - - - - - - - -
-Method Detail
- -

-xyz

-
-public static VecFloat xyz(float x,
-                           float y,
-                           float z)
-
-
Create -

-

-
-
-
-
- -

-add

-
-public VecFloat add(VecFloat v)
-
-
Add -

-

-
-
-
-
- -

-sub

-
-public VecFloat sub(VecFloat v)
-
-
Subtract -

-

-
-
-
-
- -

-mul

-
-public VecFloat mul(float s)
-
-
Multiply with a float (scale) -

-

-
-
-
-
- -

-neg

-
-public VecFloat neg()
-
-
Negate (multiply with -1) -

-

-
-
-
-
- -

-dot

-
-public float dot(VecFloat v)
-
-
Scalar product -

-

-
-
-
-
- -

-normalized

-
-public VecFloat normalized()
-
-
Get a vector in the same direction but with length 1 -

-

-
-
-
-
- -

-length

-
-public float length()
-
-
Length -

-

-
-
-
-
- -

-lengthSq

-
-public float lengthSq()
-
-
length * length -

-

-
-
-
-
- -

-toString

-
-public final String toString()
-
-
-
Overrides:
toString in class Object
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Block.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Block.html deleted file mode 100644 index de665e53..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Block.html +++ /dev/null @@ -1,784 +0,0 @@ - - - - - - - -Uses of Class pi.Block (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Block

-
- - - - - - - - - - - - - -
-Packages that use Block
piProtocol classes 
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Block in pi
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Fields in pi declared as Block
-static BlockBlock.AIR - -
-           
-static BlockBlock.BED - -
-           
-static BlockBlock.BEDROCK - -
-           
-static BlockBlock.BEDROCK_INVISIBLE - -
-           
-static BlockBlock.BOOKSHELF - -
-           
-static BlockBlock.BRICK_BLOCK - -
-           
-static BlockBlock.CACTUS - -
-           
-static BlockBlock.CHEST - -
-           
-static BlockBlock.CLAY - -
-           
-static BlockBlock.COAL_ORE - -
-           
-static BlockBlock.COBBLESTONE - -
-           
-static BlockBlock.COBWEB - -
-           
-static BlockBlock.CRAFTING_TABLE - -
-           
-static BlockBlock.DIAMOND_BLOCK - -
-           
-static BlockBlock.DIAMOND_ORE - -
-           
-static BlockBlock.DIRT - -
-           
-static BlockBlock.DOOR_IRON - -
-           
-static BlockBlock.DOOR_WOOD - -
-           
-static BlockBlock.FARMLAND - -
-           
-static BlockBlock.FENCE - -
-           
-static BlockBlock.FENCE_GATE - -
-           
-static BlockBlock.FIRE - -
-           
-static BlockBlock.FLOWER_CYAN - -
-           
-static BlockBlock.FLOWER_YELLOW - -
-           
-static BlockBlock.FURNACE_ACTIVE - -
-           
-static BlockBlock.FURNACE_INACTIVE - -
-           
-static BlockBlock.GLASS - -
-           
-static BlockBlock.GLASS_PANE - -
-           
-static BlockBlock.GLOWING_OBSIDIAN - -
-           
-static BlockBlock.GLOWSTONE_BLOCK - -
-           
-static BlockBlock.GOLD_BLOCK - -
-           
-static BlockBlock.GOLD_ORE - -
-           
-static BlockBlock.GRASS - -
-           
-static BlockBlock.GRASS_TALL - -
-           
-static BlockBlock.GRAVEL - -
-           
-static BlockBlock.ICE - -
-           
-static BlockBlock.IRON_BLOCK - -
-           
-static BlockBlock.IRON_ORE - -
-           
-static BlockBlock.LADDER - -
-           
-static BlockBlock.LAPIS_LAZULI_BLOCK - -
-           
-static BlockBlock.LAPIS_LAZULI_ORE - -
-           
-static BlockBlock.LAVA - -
-           
-static BlockBlock.LAVA_FLOWING - -
-           
-static BlockBlock.LAVA_STATIONARY - -
-           
-static BlockBlock.LEAVES - -
-           
-static BlockBlock.MELON - -
-           
-static BlockBlock.MOSS_STONE - -
-           
-static BlockBlock.MUSHROOM_BROWN - -
-           
-static BlockBlock.MUSHROOM_RED - -
-           
-static BlockBlock.NETHER_REACTOR_CORE - -
-           
-static BlockBlock.OBSIDIAN - -
-           
-static BlockBlock.REDSTONE_ORE - -
-           
-static BlockBlock.SAND - -
-           
-static BlockBlock.SANDSTONE - -
-           
-static BlockBlock.SAPLING - -
-           
-static BlockBlock.SNOW - -
-           
-static BlockBlock.SNOW_BLOCK - -
-           
-static BlockBlock.STAIRS_COBBLESTONE - -
-           
-static BlockBlock.STAIRS_WOOD - -
-           
-static BlockBlock.STONE - -
-           
-static BlockBlock.STONE_BRICK - -
-           
-static BlockBlock.STONE_SLAB - -
-           
-static BlockBlock.STONE_SLAB_DOUBLE - -
-           
-static BlockBlock.SUGAR_CANE - -
-           
-static BlockBlock.TNT - -
-           
-static BlockBlock.TORCH - -
-           
-static BlockBlock.WATER - -
-           
-static BlockBlock.WATER_FLOWING - -
-           
-static BlockBlock.WATER_STATIONARY - -
-           
-static BlockBlock.WOOD - -
-           
-static BlockBlock.WOOD_PLANKS - -
-           
-static BlockBlock.WOOL - -
-           
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi that return Block
- BlockMinecraft.getBlock(Vec position) - -
-          Get a block
- BlockMinecraft.getBlockWithData(Vec position) - -
-          Get a block
-static BlockBlock.id(int id) - -
-          Get a block with and withId (use a constant like Block.TNT)
- BlockBlock.withData(int data) - -
-          Get a block with extra data
-static BlockBlock.wool(Color color) - -
-          Get a wool block of a specific color
-  -

- - - - - - - - - - - - - - - - - - - - - -
Methods in pi with parameters of type Block
- voidMinecraft.setBlock(int x, - int y, - int z, - Block block) - -
-          Set a block
- voidMinecraft.setBlock(Vec position, - Block block) - -
-          Set a block
- voidMinecraft.setBlocks(int x1, - int y1, - int z1, - int x2, - int y2, - int z2, - Block block) - -
-          Set a cuboid of blocks
- voidMinecraft.setBlocks(Vec begin, - Vec end, - Block block) - -
-          Set a cuboid of blocks
-  -

- - - - - -
-Uses of Block in pi.tool
-  -

- - - - - - - - - - - - - -
Methods in pi.tool with parameters of type Block
- TurtleTurtle.block(Block block) - -
-           
- TextText.with(Block block) - -
-          Set the block type to use for drawing
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Color.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Color.html deleted file mode 100644 index 52dedabd..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Color.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Uses of Class pi.Color (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Color

-
- - - - - - - - - -
-Packages that use Color
piProtocol classes 
-  -

- - - - - -
-Uses of Color in pi
-  -

- - - - - - - - - - - - - -
Methods in pi that return Color
-static ColorColor.valueOf(String name) - -
-          Returns the enum constant of this type with the specified name.
-static Color[]Color.values() - -
-          Returns an array containing the constants of this enum type, in -the order they are declared.
-  -

- - - - - - - - - -
Methods in pi with parameters of type Color
-static BlockBlock.wool(Color color) - -
-          Get a wool block of a specific color
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Item.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Item.html deleted file mode 100644 index 5056a350..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Item.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - - -Uses of Class pi.Item (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Item

-
- - - - - - - - - -
-Packages that use Item
piProtocol classes 
-  -

- - - - - -
-Uses of Item in pi
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Fields in pi declared as Item
-static ItemItem.ARROW - -
-           
-static ItemItem.BONE - -
-           
-static ItemItem.BOOK - -
-           
-static ItemItem.BOW - -
-           
-static ItemItem.BOWL - -
-           
-static ItemItem.CAMERA - -
-           
-static ItemItem.CLAY - -
-           
-static ItemItem.CLAY_BRICK - -
-           
-static ItemItem.CLOCK - -
-           
-static ItemItem.COAL - -
-           
-static ItemItem.COMPASS - -
-           
-static ItemItem.DIAMOND - -
-           
-static ItemItem.DIAMOND_AXE - -
-           
-static ItemItem.DIAMOND_PICKAXE - -
-           
-static ItemItem.DIAMOND_SHOVEL - -
-           
-static ItemItem.DIAMOND_SWORD - -
-           
-static ItemItem.DYE - -
-           
-static ItemItem.EGG - -
-           
-static ItemItem.FEATHER - -
-           
-static ItemItem.FLINT - -
-           
-static ItemItem.GLOWSTONE_DUST - -
-           
-static ItemItem.GOLD_AXE - -
-           
-static ItemItem.GOLD_INGOT - -
-           
-static ItemItem.GOLD_PICKAXE - -
-           
-static ItemItem.GOLD_SHOVEL - -
-           
-static ItemItem.GOLD_SWORD - -
-           
-static ItemItem.GUNPOWDER - -
-           
-static ItemItem.IRON_AXE - -
-           
-static ItemItem.IRON_DOOR - -
-           
-static ItemItem.IRON_INGOT - -
-           
-static ItemItem.IRON_PICKAXE - -
-           
-static ItemItem.IRON_SHOVEL - -
-           
-static ItemItem.IRON_SWORD - -
-           
-static ItemItem.LEATHER - -
-           
-static ItemItem.PAPER - -
-           
-static ItemItem.SHEARS - -
-           
-static ItemItem.SIGN - -
-           
-static ItemItem.SLIMEBALL - -
-           
-static ItemItem.SNOWBALL - -
-           
-static ItemItem.STICK - -
-           
-static ItemItem.STONE_AXE - -
-           
-static ItemItem.STONE_PICKAXE - -
-           
-static ItemItem.STONE_SHOVEL - -
-           
-static ItemItem.STONE_SWORD - -
-           
-static ItemItem.STRING - -
-           
-static ItemItem.SUGAR - -
-           
-static ItemItem.SUGAR_CANE - -
-           
-static ItemItem.WHEAT - -
-           
-static ItemItem.WOODEN_AXE - -
-           
-static ItemItem.WOODEN_DOOR - -
-           
-static ItemItem.WOODEN_PICKAXE - -
-           
-static ItemItem.WOODEN_SHOVEL - -
-           
-static ItemItem.WOODEN_SWORD - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Camera.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Camera.html deleted file mode 100644 index 14cf6f2f..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Camera.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.Minecraft.Camera (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Minecraft.Camera

-
- - - - - - - - - -
-Packages that use Minecraft.Camera
piProtocol classes 
-  -

- - - - - -
-Uses of Minecraft.Camera in pi
-  -

- - - - - - - - - -
Fields in pi declared as Minecraft.Camera
- Minecraft.CameraMinecraft.camera - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Entities.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Entities.html deleted file mode 100644 index 0e43eba0..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Entities.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.Minecraft.Entities (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Minecraft.Entities

-
- - - - - - - - - -
-Packages that use Minecraft.Entities
piProtocol classes 
-  -

- - - - - -
-Uses of Minecraft.Entities in pi
-  -

- - - - - - - - - -
Fields in pi declared as Minecraft.Entities
- Minecraft.EntitiesMinecraft.entities - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Events.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Events.html deleted file mode 100644 index e7fa858e..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Events.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.Minecraft.Events (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Minecraft.Events

-
- - - - - - - - - -
-Packages that use Minecraft.Events
piProtocol classes 
-  -

- - - - - -
-Uses of Minecraft.Events in pi
-  -

- - - - - - - - - -
Fields in pi declared as Minecraft.Events
- Minecraft.EventsMinecraft.events - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Player.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Player.html deleted file mode 100644 index d0c09500..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.Player.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.Minecraft.Player (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Minecraft.Player

-
- - - - - - - - - -
-Packages that use Minecraft.Player
piProtocol classes 
-  -

- - - - - -
-Uses of Minecraft.Player in pi
-  -

- - - - - - - - - -
Fields in pi declared as Minecraft.Player
- Minecraft.PlayerMinecraft.player - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.html deleted file mode 100644 index 59e541d1..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Minecraft.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - -Uses of Class pi.Minecraft (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Minecraft

-
- - - - - - - - - - - - - -
-Packages that use Minecraft
piProtocol classes 
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Minecraft in pi
-  -

- - - - - - - - - - - - - - - - - -
Methods in pi that return Minecraft
-static MinecraftMinecraft.connect() - -
-          Connect to a local mcpi game
-static MinecraftMinecraft.connect(String host) - -
-          Connect to a remote mcpi game
-static MinecraftMinecraft.connect(String[] args) - -
-          Connect with string args
-  -

- - - - - -
-Uses of Minecraft in pi.tool
-  -

- - - - - - - - - - - -
Constructors in pi.tool with parameters of type Minecraft
Tools(Minecraft world) - -
-           
Turtle(Minecraft mc) - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.Unit.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.Unit.html deleted file mode 100644 index 24c33218..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.Unit.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - -Uses of Class pi.Vec.Unit (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Vec.Unit

-
- - - - - - - - - - - - - - - - - -
-Packages that use Vec.Unit
piProtocol classes 
pi.eventUse to react on events in the game 
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Vec.Unit in pi
-  -

- - - - - - - - - - - - - - - - - -
Fields in pi declared as Vec.Unit
-static Vec.UnitVec.Unit.X - -
-           
-static Vec.UnitVec.Unit.Y - -
-           
-static Vec.UnitVec.Unit.Z - -
-           
-  -

- - - - - - - - - -
Methods in pi that return Vec.Unit
- Vec.UnitVec.Unit.neg() - -
-           
-  -

- - - - - -
-Uses of Vec.Unit in pi.event
-  -

- - - - - - - - - -
Fields in pi.event declared as Vec.Unit
- Vec.UnitBlockHitEvent.surfaceDirection - -
-           
-  -

- - - - - - - - -
Constructors in pi.event with parameters of type Vec.Unit
BlockHitEvent(Vec position, - Vec.Unit surfaceDirection, - int entityId) - -
-           
-  -

- - - - - -
-Uses of Vec.Unit in pi.tool
-  -

- - - - - - - - - -
Methods in pi.tool with parameters of type Vec.Unit
- TextText.withOrientation(Vec.Unit u, - Vec.Unit v) - -
-          Set the orientation of the text
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.html deleted file mode 100644 index db032020..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/Vec.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - -Uses of Class pi.Vec (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.Vec

-
- - - - - - - - - - - - - - - - - -
-Packages that use Vec
piProtocol classes 
pi.eventUse to react on events in the game 
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Vec in pi
-  -

- - - - - - - - - -
Subclasses of Vec in pi
-static classVec.Unit - -
-          A vector with length=1
-  -

- - - - - - - - - -
Fields in pi declared as Vec
-static VecVec.ZERO - -
-           
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi that return Vec
- VecVec.add(int x, - int y, - int z) - -
-          Add
- VecVec.add(Vec v) - -
-          Add
- VecMinecraft.Player.getPosition() - -
-           
- VecMinecraft.Entities.getPosition(int entityId) - -
-           
- VecVec.mul(int s) - -
-          Multiply with integer (scale)
- VecVec.neg() - -
-          Negate (multiply with -1)
- VecVec.sub(Vec v) - -
-          Subtract
-static VecVec.xyz(int x, - int y, - int z) - -
-          Create
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi with parameters of type Vec
- VecVec.add(Vec v) - -
-          Add
- intVec.dot(Vec v) - -
-          Scalar product
- BlockMinecraft.getBlock(Vec position) - -
-          Get a block
- BlockMinecraft.getBlockWithData(Vec position) - -
-          Get a block
- voidMinecraft.setBlock(Vec position, - Block block) - -
-          Set a block
- voidMinecraft.setBlocks(Vec begin, - Vec end, - Block block) - -
-          Set a cuboid of blocks
- voidMinecraft.Entities.setPosition(int entityId, - Vec tile) - -
-           
- voidMinecraft.Player.setPosition(Vec position) - -
-           
- VecVec.sub(Vec v) - -
-          Subtract
-  -

- - - - - -
-Uses of Vec in pi.event
-  -

- - - - - - - - - -
Fields in pi.event declared as Vec
- VecBlockEvent.position - -
-           
-  -

- - - - - - - - - - - -
Constructors in pi.event with parameters of type Vec
BlockEvent(Vec position) - -
-           
BlockHitEvent(Vec position, - Vec.Unit surfaceDirection, - int entityId) - -
-           
-  -

- - - - - -
-Uses of Vec in pi.tool
-  -

- - - - - - - - - - - - - -
Methods in pi.tool with parameters of type Vec
- TextText.at(Vec pos) - -
-          Set the position of the text
- TurtleTurtle.setHome(Vec home) - -
-          Set the turtle setHome pos
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/class-use/VecFloat.html b/src/main/resources/mcpi/api/java/doc/pi/class-use/VecFloat.html deleted file mode 100644 index e4d39ec0..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/class-use/VecFloat.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - -Uses of Class pi.VecFloat (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.VecFloat

-
- - - - - - - - - -
-Packages that use VecFloat
piProtocol classes 
-  -

- - - - - -
-Uses of VecFloat in pi
-  -

- - - - - - - - - -
Fields in pi declared as VecFloat
-static VecFloatVecFloat.ZERO - -
-           
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi that return VecFloat
- VecFloatVecFloat.add(VecFloat v) - -
-          Add
- VecFloatMinecraft.Player.getExactPosition() - -
-           
- VecFloatMinecraft.Entities.getExactPosition(int entityId) - -
-           
- VecFloatVecFloat.mul(float s) - -
-          Multiply with a float (scale)
- VecFloatVecFloat.neg() - -
-          Negate (multiply with -1)
- VecFloatVecFloat.normalized() - -
-          Get a vector in the same direction but with length 1
- VecFloatVecFloat.sub(VecFloat v) - -
-          Subtract
-static VecFloatVecFloat.xyz(float x, - float y, - float z) - -
-          Create
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi with parameters of type VecFloat
- VecFloatVecFloat.add(VecFloat v) - -
-          Add
- floatVecFloat.dot(VecFloat v) - -
-          Scalar product
- voidMinecraft.Player.setExactPosition(VecFloat position) - -
-           
- voidMinecraft.Entities.setExactPosition(VecFloat pos) - -
-           
- voidMinecraft.Camera.setPosition(VecFloat position) - -
-           
- VecFloatVecFloat.sub(VecFloat v) - -
-          Subtract
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/BlockEvent.html b/src/main/resources/mcpi/api/java/doc/pi/event/BlockEvent.html deleted file mode 100644 index b8d78fdd..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/BlockEvent.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - -BlockEvent (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi.event -
-Class BlockEvent

-
-Object
-  extended by pi.event.BlockEvent
-
-
-
Direct Known Subclasses:
BlockHitEvent
-
-
-
-
public abstract class BlockEvent
extends Object
- - -

-


- -

- - - - - - - - - - - -
-Field Summary
- Vecposition - -
-           
-  - - - - - - - - - - -
-Constructor Summary
BlockEvent(Vec position) - -
-           
-  - - - - - - - -
-Method Summary
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-position

-
-public final Vec position
-
-
-
-
- - - - - - - - -
-Constructor Detail
- -

-BlockEvent

-
-public BlockEvent(Vec position)
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/BlockHitEvent.html b/src/main/resources/mcpi/api/java/doc/pi/event/BlockHitEvent.html deleted file mode 100644 index 59a030e4..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/BlockHitEvent.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - -BlockHitEvent (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi.event -
-Class BlockHitEvent

-
-Object
-  extended by pi.event.BlockEvent
-      extended by pi.event.BlockHitEvent
-
-
-
-
public class BlockHitEvent
extends BlockEvent
- - -

-


- -

- - - - - - - - - - - - - - - -
-Field Summary
- intentityId - -
-           
- Vec.UnitsurfaceDirection - -
-           
- - - - - - - -
Fields inherited from class pi.event.BlockEvent
position
-  - - - - - - - - - - -
-Constructor Summary
BlockHitEvent(Vec position, - Vec.Unit surfaceDirection, - int entityId) - -
-           
-  - - - - - - - -
-Method Summary
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-surfaceDirection

-
-public final Vec.Unit surfaceDirection
-
-
-
-
-
- -

-entityId

-
-public final int entityId
-
-
-
-
- - - - - - - - -
-Constructor Detail
- -

-BlockHitEvent

-
-public BlockHitEvent(Vec position,
-                     Vec.Unit surfaceDirection,
-                     int entityId)
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockEvent.html b/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockEvent.html deleted file mode 100644 index 4b7389af..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockEvent.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.event.BlockEvent (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.event.BlockEvent

-
- - - - - - - - - -
-Packages that use BlockEvent
pi.eventUse to react on events in the game 
-  -

- - - - - -
-Uses of BlockEvent in pi.event
-  -

- - - - - - - - - -
Subclasses of BlockEvent in pi.event
- classBlockHitEvent - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockHitEvent.html b/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockHitEvent.html deleted file mode 100644 index a3d94aca..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/class-use/BlockHitEvent.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.event.BlockHitEvent (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.event.BlockHitEvent

-
- - - - - - - - - -
-Packages that use BlockHitEvent
piProtocol classes 
-  -

- - - - - -
-Uses of BlockHitEvent in pi
-  -

- - - - - - - - - -
Methods in pi that return types with arguments of type BlockHitEvent
- List<BlockHitEvent>Minecraft.Events.pollBlockHits() - -
-          Only triggered by sword
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/package-frame.html b/src/main/resources/mcpi/api/java/doc/pi/event/package-frame.html deleted file mode 100644 index 76bd981c..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/package-frame.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -pi.event (Minecraft Pi Edition, Java API) - - - - - - - - - - - -pi.event - - - - -
-Classes  - -
-BlockEvent -
-BlockHitEvent
- - - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/package-summary.html b/src/main/resources/mcpi/api/java/doc/pi/event/package-summary.html deleted file mode 100644 index 0e489423..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/package-summary.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -pi.event (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-

-Package pi.event -

-Use to react on events in the game -

-See: -
-          Description -

- - - - - - - - - - - - - -
-Class Summary
BlockEvent 
BlockHitEvent 
-  - -

-

-Package pi.event Description -

- -

-Use to react on events in the game -

- -

-

-
-
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/event/package-use.html b/src/main/resources/mcpi/api/java/doc/pi/event/package-use.html deleted file mode 100644 index 7da764e1..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/event/package-use.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - -Uses of Package pi.event (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Package
pi.event

-
- - - - - - - - - - - - - -
-Packages that use pi.event
piProtocol classes 
pi.eventUse to react on events in the game 
-  -

- - - - - - - - -
-Classes in pi.event used by pi
BlockHitEvent - -
-           
-  -

- - - - - - - - -
-Classes in pi.event used by pi.event
BlockEvent - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/package-frame.html b/src/main/resources/mcpi/api/java/doc/pi/package-frame.html deleted file mode 100644 index 0949c8d1..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/package-frame.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -pi (Minecraft Pi Edition, Java API) - - - - - - - - - - - -pi - - - - -
-Classes  - -
-Block -
-Item -
-Minecraft -
-Vec -
-Vec.Unit -
-VecFloat
- - - - - - -
-Enums  - -
-Color
- - - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/package-summary.html b/src/main/resources/mcpi/api/java/doc/pi/package-summary.html deleted file mode 100644 index 663c2c38..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/package-summary.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - -pi (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-

-Package pi -

-Protocol classes -

-See: -
-          Description -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Class Summary
BlockA Minecraft Block description
ItemA Minecraft Item description (no use yet)
MinecraftThe main class to interact with a running instance of Minecraft Pi.
Vec 
Vec.UnitA vector with length=1
VecFloatA vector of three floats
-  - -

- - - - - - - - - -
-Enum Summary
ColorColors
-  - -

-

-Package pi Description -

- -

-Protocol classes -

- -

-

-
-
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/package-use.html b/src/main/resources/mcpi/api/java/doc/pi/package-use.html deleted file mode 100644 index 7bab0764..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/package-use.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - -Uses of Package pi (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Package
pi

-
- - - - - - - - - - - - - - - - - -
-Packages that use pi
piProtocol classes 
pi.eventUse to react on events in the game 
pi.toolTools with higher level functionality 
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Classes in pi used by pi
Block - -
-          A Minecraft Block description
Color - -
-          Colors
Item - -
-          A Minecraft Item description (no use yet)
Minecraft - -
-          The main class to interact with a running instance of Minecraft Pi.
Minecraft.Camera - -
-          Control the camera in the game we're connected to
Minecraft.Entities - -
-          Methods for entities
Minecraft.Events - -
-          Events
Minecraft.Player - -
-          Methods for the player in the connected game
Vec - -
-           
Vec.Unit - -
-          A vector with length=1
VecFloat - -
-          A vector of three floats
-  -

- - - - - - - - - - - -
-Classes in pi used by pi.event
Vec - -
-           
Vec.Unit - -
-          A vector with length=1
-  -

- - - - - - - - - - - - - - - - - -
-Classes in pi used by pi.tool
Block - -
-          A Minecraft Block description
Minecraft - -
-          The main class to interact with a running instance of Minecraft Pi.
Vec - -
-           
Vec.Unit - -
-          A vector with length=1
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/Text.html b/src/main/resources/mcpi/api/java/doc/pi/tool/Text.html deleted file mode 100644 index e88fd0c5..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/Text.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - -Text (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi.tool -
-Class Text

-
-Object
-  extended by pi.tool.Text
-
-
-
-
public class Text
extends Object
- - -

-A tool to draw text in the Minecraft world.
Example: - - text.with("Arial", 18).xyz2(Vec.xyz(0, 2, 0)).draw("Hello, world!"). - -

- -

-


- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- Textat(Vec pos) - -
-          Set the position of the text
- voiddraw(String text) - -
-          Draw a text with the current settings in the Minecraft world
- Textwith(Block block) - -
-          Set the block type to use for drawing
- Textwith(String fontName, - int fontSizeInPoints) - -
-          Set the font
- TextwithOrientation(Vec.Unit u, - Vec.Unit v) - -
-          Set the orientation of the text
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Method Detail
- -

-at

-
-public Text at(Vec pos)
-
-
Set the position of the text -

-

-
-
-
-
- -

-with

-
-public Text with(Block block)
-
-
Set the block type to use for drawing -

-

-
-
-
-
- -

-with

-
-public Text with(String fontName,
-                 int fontSizeInPoints)
-
-
Set the font -

-

-
-
-
-
- -

-withOrientation

-
-public Text withOrientation(Vec.Unit u,
-                            Vec.Unit v)
-
-
Set the orientation of the text -

-

-
-
-
-
- -

-draw

-
-public void draw(String text)
-
-
Draw a text with the current settings in the Minecraft world -

-

-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/Tools.html b/src/main/resources/mcpi/api/java/doc/pi/tool/Tools.html deleted file mode 100644 index 17b8ae01..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/Tools.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - -Tools (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi.tool -
-Class Tools

-
-Object
-  extended by pi.tool.Tools
-
-
-
-
public class Tools
extends Object
- - -

-


- -

- - - - - - - - - - - - - - - -
-Field Summary
- Texttext - -
-           
- Turtleturtle - -
-           
-  - - - - - - - - - - -
-Constructor Summary
Tools(Minecraft world) - -
-           
-  - - - - - - - -
-Method Summary
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Field Detail
- -

-text

-
-public final Text text
-
-
-
-
-
- -

-turtle

-
-public final Turtle turtle
-
-
-
-
- - - - - - - - -
-Constructor Detail
- -

-Tools

-
-public Tools(Minecraft world)
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/Turtle.html b/src/main/resources/mcpi/api/java/doc/pi/tool/Turtle.html deleted file mode 100644 index 5d7c3035..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/Turtle.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - -Turtle (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
- -

- -pi.tool -
-Class Turtle

-
-Object
-  extended by pi.tool.Turtle
-
-
-
-
public class Turtle
extends Object
- - -

-A turtle that can be used for shouldPlaceBlock -

- -

-


- -

- - - - - - - - - - - -
-Constructor Summary
Turtle(Minecraft mc) - -
-           
-  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Method Summary
- Turtlearound() - -
-          Turn 180 degrees
- Turtleback(int steps) - -
-           
- Turtleblock(Block block) - -
-           
- Turtledown(int steps) - -
-           
- Turtleforward(int steps) - -
-           
- Turtlehome() - -
-          Move the turtle to setHome with default orientation
- Turtlejump(int dx, - int dy, - int dz) - -
-          Jump without placing blocks
- Turtleleft() - -
-          Turn 90 degrees CCW
- Turtleoff() - -
-          Stop shouldPlaceBlock
- Turtleon() - -
-          Start shouldPlaceBlock
- Turtleright() - -
-          Turn 90 degrees CW
- TurtlesetHome(Vec home) - -
-          Set the turtle setHome pos
- Turtleup(int steps) - -
-           
- - - - - - - -
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-  -

- - - - - - - - -
-Constructor Detail
- -

-Turtle

-
-public Turtle(Minecraft mc)
-
-
- - - - - - - - -
-Method Detail
- -

-setHome

-
-public Turtle setHome(Vec home)
-
-
Set the turtle setHome pos -

-

-
-
-
-
- -

-home

-
-public Turtle home()
-
-
Move the turtle to setHome with default orientation -

-

-
-
-
-
- -

-on

-
-public Turtle on()
-
-
Start shouldPlaceBlock -

-

-
-
-
-
- -

-off

-
-public Turtle off()
-
-
Stop shouldPlaceBlock -

-

-
-
-
-
- -

-block

-
-public Turtle block(Block block)
-
-
-
-
-
-
- -

-jump

-
-public Turtle jump(int dx,
-                   int dy,
-                   int dz)
-
-
Jump without placing blocks -

-

-
-
-
-
- -

-left

-
-public Turtle left()
-
-
Turn 90 degrees CCW -

-

-
-
-
-
- -

-right

-
-public Turtle right()
-
-
Turn 90 degrees CW -

-

-
-
-
-
- -

-around

-
-public Turtle around()
-
-
Turn 180 degrees -

-

-
-
-
-
- -

-forward

-
-public Turtle forward(int steps)
-
-
-
-
-
-
- -

-back

-
-public Turtle back(int steps)
-
-
-
-
-
-
- -

-up

-
-public Turtle up(int steps)
-
-
-
-
-
-
- -

-down

-
-public Turtle down(int steps)
-
-
-
-
-
- -
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Text.html b/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Text.html deleted file mode 100644 index 74dd48c4..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Text.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - -Uses of Class pi.tool.Text (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.tool.Text

-
- - - - - - - - - -
-Packages that use Text
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Text in pi.tool
-  -

- - - - - - - - - -
Fields in pi.tool declared as Text
- TextTools.text - -
-           
-  -

- - - - - - - - - - - - - - - - - - - - - -
Methods in pi.tool that return Text
- TextText.at(Vec pos) - -
-          Set the position of the text
- TextText.with(Block block) - -
-          Set the block type to use for drawing
- TextText.with(String fontName, - int fontSizeInPoints) - -
-          Set the font
- TextText.withOrientation(Vec.Unit u, - Vec.Unit v) - -
-          Set the orientation of the text
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Tools.html b/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Tools.html deleted file mode 100644 index 53c19791..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Tools.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Uses of Class pi.tool.Tools (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.tool.Tools

-
- - - - - - - - - -
-Packages that use Tools
piProtocol classes 
-  -

- - - - - -
-Uses of Tools in pi
-  -

- - - - - - - - - -
Fields in pi declared as Tools
- ToolsMinecraft.tools - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Turtle.html b/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Turtle.html deleted file mode 100644 index 062c1b13..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/class-use/Turtle.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - -Uses of Class pi.tool.Turtle (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Class
pi.tool.Turtle

-
- - - - - - - - - -
-Packages that use Turtle
pi.toolTools with higher level functionality 
-  -

- - - - - -
-Uses of Turtle in pi.tool
-  -

- - - - - - - - - -
Fields in pi.tool declared as Turtle
- TurtleTools.turtle - -
-           
-  -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Methods in pi.tool that return Turtle
- TurtleTurtle.around() - -
-          Turn 180 degrees
- TurtleTurtle.back(int steps) - -
-           
- TurtleTurtle.block(Block block) - -
-           
- TurtleTurtle.down(int steps) - -
-           
- TurtleTurtle.forward(int steps) - -
-           
- TurtleTurtle.home() - -
-          Move the turtle to setHome with default orientation
- TurtleTurtle.jump(int dx, - int dy, - int dz) - -
-          Jump without placing blocks
- TurtleTurtle.left() - -
-          Turn 90 degrees CCW
- TurtleTurtle.off() - -
-          Stop shouldPlaceBlock
- TurtleTurtle.on() - -
-          Start shouldPlaceBlock
- TurtleTurtle.right() - -
-          Turn 90 degrees CW
- TurtleTurtle.setHome(Vec home) - -
-          Set the turtle setHome pos
- TurtleTurtle.up(int steps) - -
-           
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/package-frame.html b/src/main/resources/mcpi/api/java/doc/pi/tool/package-frame.html deleted file mode 100644 index 8e4c377e..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/package-frame.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -pi.tool (Minecraft Pi Edition, Java API) - - - - - - - - - - - -pi.tool - - - - -
-Classes  - -
-Text -
-Tools -
-Turtle
- - - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/package-summary.html b/src/main/resources/mcpi/api/java/doc/pi/tool/package-summary.html deleted file mode 100644 index 34dd19b7..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/package-summary.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -pi.tool (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-

-Package pi.tool -

-Tools with higher level functionality -

-See: -
-          Description -

- - - - - - - - - - - - - - - - - -
-Class Summary
TextA tool to draw text in the Minecraft world.
Tools 
TurtleA turtle that can be used for shouldPlaceBlock
-  - -

-

-Package pi.tool Description -

- -

-Tools with higher level functionality -

- -

-

-
-
- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/pi/tool/package-use.html b/src/main/resources/mcpi/api/java/doc/pi/tool/package-use.html deleted file mode 100644 index 991e292b..00000000 --- a/src/main/resources/mcpi/api/java/doc/pi/tool/package-use.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - -Uses of Package pi.tool (Minecraft Pi Edition, Java API) - - - - - - - - - - - - -
- -
-
-

-Uses of Package
pi.tool

-
- - - - - - - - - - - - - -
-Packages that use pi.tool
piProtocol classes 
pi.toolTools with higher level functionality 
-  -

- - - - - - - - -
-Classes in pi.tool used by pi
Tools - -
-           
-  -

- - - - - - - - - - - -
-Classes in pi.tool used by pi.tool
Text - -
-          A tool to draw text in the Minecraft world.
Turtle - -
-          A turtle that can be used for shouldPlaceBlock
-  -

-


- -
- - - diff --git a/src/main/resources/mcpi/api/java/doc/resources/inherit.gif b/src/main/resources/mcpi/api/java/doc/resources/inherit.gif deleted file mode 100644 index c814867a..00000000 Binary files a/src/main/resources/mcpi/api/java/doc/resources/inherit.gif and /dev/null differ diff --git a/src/main/resources/mcpi/api/java/doc/stylesheet.css b/src/main/resources/mcpi/api/java/doc/stylesheet.css deleted file mode 100644 index 58651373..00000000 --- a/src/main/resources/mcpi/api/java/doc/stylesheet.css +++ /dev/null @@ -1,602 +0,0 @@ -body { - background-color: #ffffff; - color: #333; - font-family: "Helvetica", "Arial", sans-serif; - font-size: 100%; - margin: 0; -} - -a:link, a:visited { - text-decoration: none; - color: #4c6b87; -} - -a:hover, a:focus { - text-decoration: none; - color: #bb7a2a; -} - -a:active { - text-decoration: none; - color: #4c6b87; -} - -a[name] { - color: #353833; -} - -a[name]:hover { - text-decoration: none; - color: #353833; -} - -pre { - font-size: 1.3em; -} - -h1 { - font-size: 1.8em; -} - -h2 { - font-size: 1.5em; -} - -h3 { - font-size: 1.4em; -} - -h4 { - font-size: 1.3em; -} - -h5 { - font-size: 1.2em; -} - -h6 { - font-size: 1.1em; -} - -ul { - list-style-type: disc; -} - -code, tt { - font-size: 1.2em; -} - -dt code { - font-size: 1.2em; -} - -table tr td dt code { - font-size: 1.2em; - vertical-align: top; -} - -sup { - font-size: .6em; -} - -/* -Document title and Copyright styles -*/ - -.clear { - clear: both; - height: 0px; - overflow: hidden; -} - -.aboutLanguage { - float: right; - padding: 0px 21px; - font-size: .8em; - z-index: 200; - margin-top: -7px; -} - -.legalCopy { - margin-left: .5em; -} - -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color: #FFFFFF; - text-decoration: none; -} - -.bar a:hover, .bar a:focus { - color: #bb7a2a; -} - -.tab { - background-color: #0066FF; - background-image: url(resources/titlebar.gif); - background-position: left top; - background-repeat: no-repeat; - color: #ffffff; - padding: 8px; - width: 5em; - font-weight: bold; -} - -/* -Navigation bar styles -*/ - -.bar { - background-image: url(resources/background.gif); - background-repeat: repeat-x; - color: #FFFFFF; - padding: .8em .5em .4em .8em; - height: auto; - - -/*height - -:1.8em;*/ - font-size: 1em; - margin: 0; -} - -.topNav { - background-image: url(resources/background.gif); - background-repeat: repeat-x; - color: #FFFFFF; - float: left; - padding: 0; - width: 100%; - clear: right; - height: 2.8em; - padding-top: 10px; - overflow: hidden; -} - -.bottomNav { - margin-top: 10px; - background-image: url(resources/background.gif); - background-repeat: repeat-x; - color: #FFFFFF; - float: left; - padding: 0; - width: 100%; - clear: right; - height: 2.8em; - padding-top: 10px; - overflow: hidden; -} - -.subNav { - background-color: #dee3e9; - border-bottom: 1px solid #9eadc0; - float: left; - width: 100%; - overflow: hidden; -} - -.subNav div { - clear: left; - float: left; - padding: 0 0 6px 6px; -} - -ul.navList, ul.subNavList { - float: left; - margin: 0 25px 0 0; - padding: 0; -} - -ul.navList li { - list-style: none; - float: left; - padding: 3px 6px; -} - -ul.subNavList li { - list-style: none; - float: left; - font-size: 90%; -} - -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color: #FFFFFF; - text-decoration: none; -} - -.topNav a:hover, .bottomNav a:hover { - text-decoration: none; - color: #bb7a2a; -} - -.navBarCell1Rev { - background-image: url(resources/tab.gif); - background-color: #a88834; - color: #FFFFFF; - margin: auto 5px; - border: 1px solid #c9aa44; -} - -.header, .footer { - clear: both; - margin: 0 20px; - padding: 5px 0 0 0; -} - -.indexHeader { - margin: 10px; - position: relative; -} - -.indexHeader h1 { - font-size: 1.3em; -} - -.title { - color: #2c4557; - margin: 10px 0; -} - -.subTitle { - margin: 5px 0 0 0; -} - -.header ul { - margin: 0 0 25px 0; - padding: 0; -} - -.footer ul { - margin: 20px 0 5px 0; -} - -.header ul li, .footer ul li { - list-style: none; - font-size: 1.2em; -} - -/* -Heading styles -*/ - -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color: #dee3e9; - border-top: 1px solid #9eadc0; - border-bottom: 1px solid #9eadc0; - margin: 0 0 6px -8px; - padding: 2px 5px; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color: #dee3e9; - border-top: 1px solid #9eadc0; - border-bottom: 1px solid #9eadc0; - margin: 0 0 6px -8px; - padding: 2px 5px; -} - -ul.blockList ul.blockList li.blockList h3 { - padding: 0; - margin: 15px 0; -} - -ul.blockList li.blockList h2 { - padding: 0px 0 20px 0; -} - -/* -Page layout container styles -*/ - -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear: both; - padding: 10px 20px; - position: relative; -} - -.indexContainer { - margin: 10px; - position: relative; - font-size: 1.0em; -} - -.indexContainer h2 { - font-size: 1.1em; - padding: 0 0 3px 0; -} - -.indexContainer ul { - margin: 0; - padding: 0; -} - -.indexContainer ul li { - list-style: none; - margin-bottom: 2px; -} - -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size: 1.1em; - font-weight: bold; - margin: 10px 0 0 0; - color: #4E4E4E; -} - -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin: 10px 0 10px 20px; -} - -.serializedFormContainer dl.nameValue dt { - margin-left: 1px; - font-size: 1.1em; - display: inline; - font-weight: bold; -} - -.serializedFormContainer dl.nameValue dd { - margin: 0 0 0 1px; - font-size: 1.1em; - display: inline; -} - -/* -List styles -*/ - -ul.horizontal li { - display: inline; - font-size: 0.9em; -} - -ul.inheritance { - margin: 0; - padding: 0; -} - -ul.inheritance li { - display: inline; - list-style: none; -} - -ul.inheritance li ul.inheritance { - margin-left: 15px; - padding-left: 15px; - padding-top: 1px; -} - -ul.blockList, ul.blockListLast { - margin: 10px 0 10px 0; - padding: 0; -} - -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style: none; - margin-bottom: 25px; -} - -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding: 0 0 8px 8px; - background-color: #ffffff; - border: 1px solid #9eadc0; - border-top: none; -} - -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left: 0; - padding-left: 0; - padding-bottom: 15px; - border: none; - border-bottom: 1px solid #9eadc0; -} - -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style: none; - border-bottom: none; - padding-bottom: 0; -} - -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top: 0; - margin-bottom: 1px; -} - -/* -Table styles -*/ - -.contentContainer table, .classUseContainer table, .constantValuesContainer table { - border-bottom: 1px solid #9eadc0; - width: 100%; -} - -.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { - width: 100%; -} - -.contentContainer .description table, .contentContainer .details table { - border-bottom: none; -} - -.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td { - vertical-align: top; - padding-right: 20px; -} - -.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, -.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, -.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, -.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { - padding-right: 3px; -} - -.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { - position: relative; - text-align: left; - background-repeat: no-repeat; - color: #FFFFFF; - font-weight: bold; - clear: none; - overflow: hidden; - padding: 0px; - margin: 0px; -} - -caption a:link, caption a:hover, caption a:active, caption a:visited { - color: #FFFFFF; -} - -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - white-space: nowrap; - padding-top: 8px; - padding-left: 8px; - display: block; - float: left; - background-image: url(resources/titlebar.gif); - height: 18px; -} - -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - width: 10px; - background-image: url(resources/titlebar_end.gif); - background-repeat: no-repeat; - background-position: top right; - position: relative; - float: left; -} - -ul.blockList ul.blockList li.blockList table { - margin: 0 0 12px 0px; - width: 100%; -} - -.tableSubHeadingColor { - background-color: #EEEEFF; -} - -.altColor { - background-color: #eeeeef; -} - -.rowColor { - background-color: #ffffff; -} - -.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { - text-align: left; - padding: 6px 3px 6px 7px; -} - -th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - background: #dee3e9; - border-top: 1px solid #9eadc0; - border-bottom: 1px solid #9eadc0; - text-align: left; - padding: 6px 3px 6px 7px; -} - -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight: bold; -} - -td.colFirst, th.colFirst { - border-left: 1px solid #9eadc0; - white-space: nowrap; -} - -td.colLast, th.colLast { - border-right: 1px solid #9eadc0; -} - -td.colOne, th.colOne { - border-right: 1px solid #9eadc0; - border-left: 1px solid #9eadc0; -} - -table.overviewSummary { - padding: 0px; - margin-left: 0px; -} - -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, -table.overviewSummary td.colOne, table.overviewSummary th.colOne { - width: 25%; - vertical-align: middle; -} - -table.packageSummary td.colFirst, table.overviewSummary th.colFirst { - width: 25%; - vertical-align: middle; -} - -/* -Content styles -*/ - -.description pre { - margin-top: 0; -} - -.deprecatedContent { - margin: 0; - padding: 10px 0; -} - -.docSummary { - padding: 0; -} - -.sourceLineNo { - color: green; - padding: 0 30px 0 0; -} - -h1.hidden { - visibility: hidden; - overflow: hidden; - font-size: .9em; -} - -.block { - display: block; - margin: 3px 0 0 0; -} - -.strong { - font-weight: bold; -} - -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, table.overviewSummary td.colOne, table.overviewSummary -th.colOne { - width: 5%; -} - -table.overviewSummary td.colFirst code { - float: right; -} - -table.overviewSummary .block { - padding-left: 3em; -} - -table.overviewSummary .block .block { - padding-left: 0em; -} - -table.overviewSummary, table.packageSummary { - border-collapse: collapse; -} - -table.overviewSummary td, table.packageSummary td { - -} - -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, -td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover { - font-weight: normal; -} - -td.colOne strong a:link, td.colOne strong a:active, td.colOne strong a:visited, td.colOne strong a:hover, td.colFirst strong -a:link, td.colFirst strong a:active, td.colFirst strong a:visited, td.colFirst strong a:hover, td.colLast strong a:link, -td.colLast strong a:active, td.colLast strong a:visited, td.colLast strong a:hover { - font-weight: bold; -} diff --git a/src/main/resources/mcpi/api/java/lib/McPi.jar b/src/main/resources/mcpi/api/java/lib/McPi.jar deleted file mode 100644 index 7118ab8e..00000000 Binary files a/src/main/resources/mcpi/api/java/lib/McPi.jar and /dev/null differ diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Block.java b/src/main/resources/mcpi/api/java/src-api/pi/Block.java deleted file mode 100644 index 07083745..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Block.java +++ /dev/null @@ -1,140 +0,0 @@ -package pi; - -/** - * A Minecraft Block description - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Block { - - final int id, data; - - Block(int id, int data) { - this.id = id; - this.data = data & 0xf; - } - - /** - * Get a block with and withId (use a constant like Block.TNT) - */ - public static Block id(int id) { - return new Block(id, 0); - } - - /** - * Get a block with extra data - */ - public Block withData(int data) { - return new Block(id, data); - } - - static Block decode(String s) { - return id(Integer.parseInt(s)); - } - - static Block decodeWithData(String s) { - String[] ss = s.split(","); - int id = Integer.parseInt(ss[0]); - int data = Integer.parseInt(ss[1]); - return new Block(id, data); - } - - @Override - public int hashCode() { - return (id << 8) + data; - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof Block)) { - return false; - } - return hashCode() == ((Block) obj).hashCode(); - } - - @Override - public String toString() { - return id + (data == 0 ? "" : "," + data); - } - - /** - * Get a wool block of a specific color - */ - public static Block wool(Color color) { - return WOOL.withData(color.woolColorData); - } - // Predefined blocks - public static final Block // - AIR = id(0), - STONE = id(1), - GRASS = id(2), - DIRT = id(3), - COBBLESTONE = id(4), - WOOD_PLANKS = id(5), - SAPLING = id(6), - BEDROCK = id(7), - WATER_FLOWING = id(8), - WATER = WATER_FLOWING, - WATER_STATIONARY = id(9), - LAVA_FLOWING = id(10), - LAVA = LAVA_FLOWING, - LAVA_STATIONARY = id(11), - SAND = id(12), - GRAVEL = id(13), - GOLD_ORE = id(14), - IRON_ORE = id(15), - COAL_ORE = id(16), - WOOD = id(17), - LEAVES = id(18), - GLASS = id(20), - LAPIS_LAZULI_ORE = id(21), - LAPIS_LAZULI_BLOCK = id(22), - SANDSTONE = id(24), - BED = id(26), - COBWEB = id(30), - GRASS_TALL = id(31), - WOOL = id(35), - FLOWER_YELLOW = id(37), - FLOWER_CYAN = id(38), - MUSHROOM_BROWN = id(39), - MUSHROOM_RED = id(40), - GOLD_BLOCK = id(41), - IRON_BLOCK = id(42), - STONE_SLAB_DOUBLE = id(43), - STONE_SLAB = id(44), - BRICK_BLOCK = id(45), - TNT = id(46), - BOOKSHELF = id(47), - MOSS_STONE = id(48), - OBSIDIAN = id(49), - TORCH = id(50), - FIRE = id(51), - STAIRS_WOOD = id(53), - CHEST = id(54), - DIAMOND_ORE = id(56), - DIAMOND_BLOCK = id(57), - CRAFTING_TABLE = id(58), - FARMLAND = id(60), - FURNACE_INACTIVE = id(61), - FURNACE_ACTIVE = id(62), - DOOR_WOOD = id(64), - LADDER = id(65), - STAIRS_COBBLESTONE = id(67), - DOOR_IRON = id(71), - REDSTONE_ORE = id(73), - SNOW = id(78), - ICE = id(79), - SNOW_BLOCK = id(80), - CACTUS = id(81), - CLAY = id(82), - SUGAR_CANE = id(83), - FENCE = id(85), - GLOWSTONE_BLOCK = id(89), - BEDROCK_INVISIBLE = id(95), - STONE_BRICK = id(98), - GLASS_PANE = id(102), - MELON = id(103), - FENCE_GATE = id(107), - GLOWING_OBSIDIAN = id(246), - NETHER_REACTOR_CORE = id(247); -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Color.java b/src/main/resources/mcpi/api/java/src-api/pi/Color.java deleted file mode 100644 index dd2330eb..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Color.java +++ /dev/null @@ -1,19 +0,0 @@ -package pi; - -/** - * Colors - * - * @author Daniel Frisk, twitter:danfrisk - */ -public enum Color { - - WHITE, ORANGE, MAGENTA, LIGHT_BLUE, - YELLOW, LIME, PINK, GRAY, - LIGHT_GRAY, CYAN, PURPLE, BLUE, - BROWN, GREEN, RED, BLACK; - - /** - * the block DATA for the color - */ - final int woolColorData = ordinal(); -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Connection.java b/src/main/resources/mcpi/api/java/src-api/pi/Connection.java deleted file mode 100644 index d5ad20d8..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Connection.java +++ /dev/null @@ -1,124 +0,0 @@ -package pi; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.Socket; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Connection to a Minecraft Pi game - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Connection { - - Socket socket; - BufferedWriter out; - BufferedReader in; - boolean autoFlush = true; - - Connection(String host, int port) { - Log.info("Connecting to " + host + ":" + port); - if (host != null) { - try { - this.socket = new Socket(host, port); - socket.setTcpNoDelay(true); - socket.setKeepAlive(true); - socket.setTrafficClass(0x10); - this.in = new BufferedReader(new InputStreamReader(socket.getInputStream())); - this.out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); - } catch (IOException e) { - throw new ConnectionException("Couldn't connect to Minecraft, is it running?"); - } - } - Log.info("Connected"); - } - - void send(Object... parts) { - try { - drain(in); - for (int i = 0; i < parts.length; i++) { - out.write(parts[i].toString()); - if (i == 0) { - out.write('('); - } else if (i < parts.length - 1) { - out.write(','); - } - } - out.write(")\n"); - if (autoFlush) { - flush(); - } - } catch (IOException e) { - throw new ConnectionException(e); - } - } - - void flush() { - try { - out.flush(); - } catch (IOException e) { - throw new ConnectionException(e); - } - } - - void drain(BufferedReader in) throws IOException { - while (in.ready()) { - int c = in.read(); - System.err.print((char) c); - } - } - - String receive() { - try { - return in.readLine(); - } catch (IOException e) { - throw new ConnectionException(e); - } - } - - void close() { - close(in, out); - try { - socket.close(); - } catch (IOException _) { - } - } - - void close(Closeable... cs) { - for (Closeable c : cs) { - try { - if (c != null) { - c.close(); - } - } catch (IOException _) { - } - } - } - - void autoFlush(boolean flush) { - this.autoFlush = flush; - if (flush) { - flush(); - } - } - - /** - * - */ - static class ConnectionException extends RuntimeException { - - ConnectionException(String message) { - super(message); - } - - ConnectionException(Throwable cause) { - super(cause); - } - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/EventFactory.java b/src/main/resources/mcpi/api/java/src-api/pi/EventFactory.java deleted file mode 100644 index a6df8125..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/EventFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -package pi; - -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; -import static pi.Vec.Unit.*; -import pi.event.BlockHitEvent; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class EventFactory { - - static List createBlockHitEvents(String eventList) { - List events = new ArrayList(); - - if (!eventList.isEmpty()) { - for (String event : eventList.split("\\|")) { - Scanner s = new Scanner(event).useDelimiter(","); - Vec position = Vec.xyz(s.nextInt(), s.nextInt(), s.nextInt()); - Vec.Unit surfaceDirection = faceIdxToDirection(s.nextInt()); - int entityId = s.nextInt(); - events.add(new BlockHitEvent(position, surfaceDirection, entityId)); - } - } - - return events; - } - - static Unit faceIdxToDirection(int faceIdx) { - Unit[] faceDirs = {Y.neg(), Y, Z.neg(), Z, X.neg(), X}; - return faceDirs[faceIdx]; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Item.java b/src/main/resources/mcpi/api/java/src-api/pi/Item.java deleted file mode 100644 index 715fe5cd..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Item.java +++ /dev/null @@ -1,96 +0,0 @@ -package pi; - -/** - * A Minecraft Item description (no use yet) - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Item { - - final int id; - - Item(int id) { - this.id = id; - } - - static Item id(int id) { - return new Item(id); - } - - static Item decode(String s) { - return id(Integer.parseInt(s)); - } - - @Override - public int hashCode() { - return id; - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof Item)) { - return false; - } - return id == ((Item) obj).id; - } - - @Override - public String toString() { - return Integer.toString(id); - } - // Predefined items - public static final Item // - IRON_SHOVEL = id(256), - IRON_PICKAXE = id(257), - IRON_AXE = id(258), - BOW = id(261), - ARROW = id(262), - COAL = id(263), - DIAMOND = id(264), - IRON_INGOT = id(265), - GOLD_INGOT = id(266), - IRON_SWORD = id(267), - WOODEN_SWORD = id(268), - WOODEN_SHOVEL = id(269), - WOODEN_PICKAXE = id(270), - WOODEN_AXE = id(271), - STONE_SWORD = id(272), - STONE_SHOVEL = id(273), - STONE_PICKAXE = id(274), - STONE_AXE = id(275), - DIAMOND_SWORD = id(276), - DIAMOND_SHOVEL = id(277), - DIAMOND_PICKAXE = id(278), - DIAMOND_AXE = id(279), - STICK = id(280), - BOWL = id(281), - GOLD_SWORD = id(283), - GOLD_SHOVEL = id(284), - GOLD_PICKAXE = id(285), - GOLD_AXE = id(286), - STRING = id(287), - FEATHER = id(288), - GUNPOWDER = id(289), - FLINT = id(292), - WHEAT = id(296), - SIGN = id(323), - WOODEN_DOOR = id(324), - IRON_DOOR = id(330), - SNOWBALL = id(332), - LEATHER = id(334), - CLAY_BRICK = id(336), - CLAY = id(337), - SUGAR_CANE = id(338), - PAPER = id(339), - BOOK = id(340), - SLIMEBALL = id(341), - EGG = id(344), - COMPASS = id(345), - CLOCK = id(347), - GLOWSTONE_DUST = id(348), - DYE = id(351), - BONE = id(352), - SUGAR = id(353), - SHEARS = id(359), - CAMERA = id(456); -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Log.java b/src/main/resources/mcpi/api/java/src-api/pi/Log.java deleted file mode 100644 index d80f23a1..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Log.java +++ /dev/null @@ -1,22 +0,0 @@ -package pi; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Log { - - static void debug(String s) { - if (false) { - System.out.println(s); - } - } - - static void info(String s) { - System.out.println(s); - } - - static void error(String s) { - System.err.println(s); - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java b/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java deleted file mode 100644 index c9c2ef84..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java +++ /dev/null @@ -1,297 +0,0 @@ -package pi; - -import java.util.Arrays; -import java.util.List; -import pi.event.BlockHitEvent; -import pi.tool.Tools; - -/** - * The main class to interact with a running instance of Minecraft Pi. - * - *

Example:   - * Minecraft.connect().setBlock(0, 2, 0, Block.GOLD_ORE) - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Minecraft { - - Connection connection; - static final int DEFAULT_PORT = 4711; - // - public final Camera camera = new Camera(); - public final Player player = new Player(); - public final Entities entities = new Entities(); - public final Events events = new Events(); - public final Tools tools = new Tools(this); - - Minecraft(Connection connection) { - this.connection = connection; - } - - /** - * Connect to a local mcpi game - */ - public static Minecraft connect() { - return connect("127.0.0.1"); - } - - /** - * Connect to a remote mcpi game - */ - public static Minecraft connect(String host) { - return connect(host, DEFAULT_PORT); - } - - /** - * Connect to mcpi on a specific host/port - */ - static Minecraft connect(String host, int port) { - return new Minecraft(new Connection(host, port)); - } - - /** - * Connect with string args - * - * @param args an array with optional host, port - */ - public static Minecraft connect(String[] args) { - System.err.println(Arrays.asList(args)); - String host = args.length >= 1 ? args[0] : "127.0.0.1"; - int port = args.length >= 2 ? Integer.parseInt(args[1]) : Minecraft.DEFAULT_PORT; - return Minecraft.connect(host, port); - } - - /** - * Get a block - */ - public Block getBlock(Vec position) { - send("world.getBlock", position); - return Block.decode(receive()); - } - - /** - * Get a block - */ - public Block getBlockWithData(Vec position) { - send("world.getBlock", position); - return Block.decodeWithData(receive()); - } - - /** - * Set a block - */ - public void setBlock(int x, int y, int z, Block block) { - setBlock(Vec.xyz(x, y, z), block); - } - - /** - * Set a block - */ - public void setBlock(Vec position, Block block) { - send("world.setBlock", position, block); - } - - /** - * Set a cuboid of blocks - */ - public void setBlocks(int x1, int y1, int z1, int x2, int y2, int z2, Block block) { - setBlocks(Vec.xyz(x1, y1, z1), Vec.xyz(x2, y2, z2), block); - } - - /** - * Set a cuboid of blocks - */ - public void setBlocks(Vec begin, Vec end, Block block) { - send("world.setBlocks", begin, end, block); - } - - /** - * Get the height of the world (last Y that isn't solid from top-down) - */ - public int getHeight(int x, int z) { - send("world.getHeight", x, z); - return Integer.parseInt(receive()); - } - - /** - * Get the entity ids of the connected players - */ - public int[] getPlayerEntityIds() { - send("world.getPlayerIds"); - String[] strIds = receive().split("|"); - int[] ids = new int[strIds.length]; - for (int i = 0; i < ids.length; i++) { - ids[i] = Integer.parseInt(strIds[i]); - } - return ids; - } - - /** - * Keys: "world_immutable", "nametags_visible" - */ - public void setting(String key, boolean value) { - send("world.setting", key, value == false ? 0 : 1); - } - - /** - * Save a checkpoint that can be used for restoring the world - */ - public void saveCheckpoint() { - send("world.checkpoint.save"); - } - - /** - * Restore the world state to the checkpoint - */ - public void restoreCheckpoint() { - send("world.checkpoint.restore"); - } - - /** - * Post a message to the game chat - */ - public void postToChat(String message) { - send("chat.post", message); - } - - /** - * If auto is false, commands are kept in a buffer until they are flushed - * with flush() or the buffer fills up.
Default is to automatically - * flush each command separately. - */ - public void autoFlush(boolean auto) { - connection.autoFlush(auto); - } - - /** - * Flush commands that are buffered, not needed, unless autoFlush(false). - */ - public void flush() { - connection.flush(); - } - - /** - * Methods for the player in the connected game - */ - public class Player { - - public Vec getPosition() { - send("player.getTile"); - return Vec.decode(receive()); - } - - public void setPosition(Vec position) { - send("player.setTile", position); - } - - public VecFloat getExactPosition() { - send("player.getPos"); - return VecFloat.decode(receive()); - } - - public void setExactPosition(VecFloat position) { - send("player.setPos", position); - } - - /** - * Keys: autojump, Values: true/false
For example to disable - * automatic jumping: - * mc.player.setting("autojump", false); - */ - public void setting(String key, boolean value) { - send("player.setting", key, value == false ? 0 : 1); - } - } - - /** - * Methods for entities - */ - public class Entities { - - public Vec getPosition(int entityId) { - send("entity.getTile", entityId); - return Vec.decode(receive()); - } - - public void setPosition(int entityId, Vec tile) { - send("entity.setTile", entityId, tile); - } - - public VecFloat getExactPosition(int entityId) { - send("entity.getPos", entityId); - return VecFloat.decode(receive()); - } - - public void setExactPosition(VecFloat pos) { - send("entity.setPos"); - } - } - - /** - * Control the camera in the game we're connected to - */ - public class Camera { - - public void setNormal() { - send("camera.mode.setNormal"); - } - - public void setNormal(int mobEntityId) { - send("camera.mode.setNormal", mobEntityId); - } - - public void setThirdPerson() { - send("camera.mode.setFollow"); - } - - public void setThirdPerson(int entityId) { - send("camera.mode.setFollow", entityId); - } - - public void setFixed() { - send("camera.mode.setFixed"); - } - - public void setPosition(VecFloat position) { - send("camera.setPos", position); - } - } - - /** - * Events - */ - public class Events { - - /** - * Clear all old events - */ - public void clearAll() { - send("events.clear"); - } - - /** - * Only triggered by sword - */ - public List pollBlockHits() { - send("events.block.hits"); - return EventFactory.createBlockHitEvents(receive()); - } - } - - void send(Object... parts) { - connection.send(parts); - } - - String receive() { - if (!connection.autoFlush) { - throw new IllegalStateException("Methods that return data aren't supported with autoflush off!"); - } - return connection.receive(); - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - connection.close(); - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/Vec.java b/src/main/resources/mcpi/api/java/src-api/pi/Vec.java deleted file mode 100644 index d3429bf6..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/Vec.java +++ /dev/null @@ -1,111 +0,0 @@ -package pi; - -import java.util.Scanner; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Vec { - - public final static Vec ZERO = new Vec(0, 0, 0); - public final static int MIN_Y = -128, MAX_Y = 127; - public final int x, y, z; - - Vec(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Create - */ - public static Vec xyz(int x, int y, int z) { - return new Vec(x, y, z); - } - - /** - * Add - */ - public Vec add(Vec v) { - return xyz(x + v.x, y + v.y, z + v.z); - } - - /** - * Add - */ - public Vec add(int x, int y, int z) { - return xyz(this.x + x, this.y + y, this.z + z); - } - - /** - * Subtract - */ - public Vec sub(Vec v) { - return xyz(x - v.x, y - v.y, z - v.z); - } - - /** - * Multiply with integer (scale) - */ - public Vec mul(int s) { - return xyz(s * x, s * y, s * z); - } - - /** - * Negate (multiply with -1) - */ - public Vec neg() { - return xyz(-x, -y, -z); - } - - /** - * Scalar product - */ - public int dot(Vec v) { - return x * v.x + y * v.y + z * v.z; - } - - @Override - public int hashCode() { - return x | (y << 20) | (z << 10); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof Vec)) { - return false; - } - return hashCode() == ((Vec) obj).hashCode(); - } - - @Override - public final String toString() { - return x + "," + y + "," + z; - } - - static Vec decode(String encoded) { - Scanner s = new Scanner(encoded).useDelimiter("\\,"); - return xyz(s.nextInt(), s.nextInt(), s.nextInt()); - } - - /** - * A vector with length=1 - */ - public static class Unit extends Vec { - - public final static Unit X = new Unit(1, 0, 0); - public final static Unit Y = new Unit(0, 1, 0); - public final static Unit Z = new Unit(0, 0, 1); - - Unit(int x, int y, int z) { - super(x, y, z); - } - - @Override - public Unit neg() { - return new Unit(-x, -y, -z); - } - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/VecFloat.java b/src/main/resources/mcpi/api/java/src-api/pi/VecFloat.java deleted file mode 100644 index ccfcb840..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/VecFloat.java +++ /dev/null @@ -1,100 +0,0 @@ -package pi; - -import java.util.Scanner; - -/** - * A vector of three floats - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class VecFloat { - - public static final VecFloat ZERO = new VecFloat(0, 0, 0); - public final float x, y, z; - - VecFloat(float x, float y, float z) { - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Create - */ - public static VecFloat xyz(float x, float y, float z) { - return new VecFloat(x, y, z); - } - - /** - * Add - */ - public VecFloat add(VecFloat v) { - return xyz(x + v.x, y + v.y, z + v.z); - } - - /** - * Subtract - */ - public VecFloat sub(VecFloat v) { - return xyz(x - v.x, y - v.y, z - v.z); - } - - /** - * Multiply with a float (scale) - */ - public VecFloat mul(float s) { - return xyz(s * x, s * y, s * z); - } - - /** - * Negate (multiply with -1) - */ - public VecFloat neg() { - return mul(-1); - } - - /** - * Scalar product - */ - public float dot(VecFloat v) { - return x * v.x + y * v.y + z * v.z; - } - - /** - * Cross product - */ - VecFloat cross(VecFloat v) { - throw new UnsupportedOperationException("not implemented yet"); - } - - /** - * Get a vector in the same direction but with length 1 - */ - public VecFloat normalized() { - return mul(1f / length()); - } - - /** - * Length - */ - public float length() { - return (float) Math.sqrt(lengthSq()); - } - - /** - * length * length - */ - public float lengthSq() { - return dot(this); - } - - static VecFloat decode(String encoded) { - Scanner s = new Scanner(encoded).useDelimiter("\\,"); - return xyz(s.nextFloat(), s.nextFloat(), s.nextFloat()); - } - - @Override - public final String toString() { - return x + "," + y + "," + z; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockAddedEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/BlockAddedEvent.java deleted file mode 100644 index 850f6c2e..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockAddedEvent.java +++ /dev/null @@ -1,14 +0,0 @@ -package pi.event; - -import pi.Vec; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class BlockAddedEvent extends BlockEvent { - - public BlockAddedEvent(Vec position) { - super(position); - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/BlockEvent.java deleted file mode 100644 index d7b70152..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package pi.event; - -import pi.Vec; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public abstract class BlockEvent { - - public final Vec position; - - public BlockEvent(Vec position) { - this.position = position; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockHitEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/BlockHitEvent.java deleted file mode 100644 index 9a725edb..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockHitEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package pi.event; - -import pi.Vec; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class BlockHitEvent extends BlockEvent { - - public final Vec.Unit surfaceDirection; - public final int entityId; - - public BlockHitEvent(Vec position, Vec.Unit surfaceDirection, int entityId) { - super(position); - this.surfaceDirection = surfaceDirection; - this.entityId = entityId; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockRemovedEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/BlockRemovedEvent.java deleted file mode 100644 index d81eef32..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/BlockRemovedEvent.java +++ /dev/null @@ -1,14 +0,0 @@ -package pi.event; - -import pi.Vec; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class BlockRemovedEvent extends BlockEvent { - - public BlockRemovedEvent(Vec position) { - super(position); - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/ChatMessageEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/ChatMessageEvent.java deleted file mode 100644 index e09b4af8..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/ChatMessageEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package pi.event; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class ChatMessageEvent { - -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/EntityEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/EntityEvent.java deleted file mode 100644 index f02b5fc0..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/EntityEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package pi.event; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -abstract class EntityEvent { - -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerConnectEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerConnectEvent.java deleted file mode 100644 index 36389156..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerConnectEvent.java +++ /dev/null @@ -1,14 +0,0 @@ -package pi.event; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class PlayerConnectEvent extends PlayerEvent { - - public final int entityId; - - public PlayerConnectEvent(int entityId) { - this.entityId = entityId; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerEvent.java b/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerEvent.java deleted file mode 100644 index d90740da..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/PlayerEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package pi.event; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -abstract class PlayerEvent { - -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/event/package.html b/src/main/resources/mcpi/api/java/src-api/pi/event/package.html deleted file mode 100644 index b1909ed8..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/event/package.html +++ /dev/null @@ -1,3 +0,0 @@ - - Use to react on events in the game - diff --git a/src/main/resources/mcpi/api/java/src-api/pi/package.html b/src/main/resources/mcpi/api/java/src-api/pi/package.html deleted file mode 100644 index 28d932a2..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/package.html +++ /dev/null @@ -1,3 +0,0 @@ - - Protocol classes - diff --git a/src/main/resources/mcpi/api/java/src-api/pi/tool/Csg.java b/src/main/resources/mcpi/api/java/src-api/pi/tool/Csg.java deleted file mode 100644 index d66344c0..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/tool/Csg.java +++ /dev/null @@ -1,10 +0,0 @@ -package pi.tool; - -/** - * Constructive Solid Geometry tool - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Csg { - -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/tool/Text.java b/src/main/resources/mcpi/api/java/src-api/pi/tool/Text.java deleted file mode 100644 index 1ae53140..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/tool/Text.java +++ /dev/null @@ -1,94 +0,0 @@ -package pi.tool; - -import java.awt.*; -import java.awt.geom.*; -import java.awt.image.*; -import pi.*; - -/** - * A tool to draw text in the Minecraft world.
Example: - * - * text.with("Arial", 18).xyz2(Vec.xyz(0, 2, 0)).draw("Hello, world!"). - * - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Text { - - Minecraft minecraft; - // - Vec basePos = Vec.xyz(0, 1, 0); - Font font = Font.decode("SansSerif-PLAIN-9"); - Vec u = Vec.Unit.X, v = Vec.Unit.Y; - Block block = Block.WOOD_PLANKS; - - Text(Minecraft minecraft) { - this.minecraft = minecraft; - } - - /** - * Set the position of the text - */ - public Text at(Vec pos) { - this.basePos = pos; - return this; - } - - /** - * Set the block type to use for drawing - */ - public Text with(Block block) { - this.block = block; - return this; - } - - /** - * Set the font - */ - public Text with(String fontName, int fontSizeInPoints) { - this.font = new Font(fontName, Font.PLAIN, fontSizeInPoints); - return this; - } - - /** - * Set the orientation of the text - */ - public Text withOrientation(Vec.Unit u, Vec.Unit v) { - if (u.equals(v)) { - throw new IllegalArgumentException("u and v can't be equal!"); - } - this.u = u; - this.v = v; - return this; - } - - /** - * Draw a text with the current settings in the Minecraft world - */ - public void draw(String text) { - BufferedImage img = createImage(text); - final int w = img.getWidth(), h = img.getHeight(); - for (int j = h - 1; j >= 0; j--) { - for (int i = 0; i < w; i++) { - if ((img.getRGB(i, j) & 1) == 1) { - Vec relativeBlockPos = u.mul(i).add(v.mul((h - j))); - Vec blockPos = basePos.add(relativeBlockPos); - minecraft.setBlock(blockPos, block); - } - } - } - } - - private BufferedImage createImage(String text) { - BufferedImage buf = new BufferedImage(1000, 200, BufferedImage.TYPE_BYTE_BINARY); - Graphics2D g = buf.createGraphics(); - - g.setFont(font); - FontMetrics fm = g.getFontMetrics(); - g.drawString(text, 1, 1 + fm.getAscent()); - Rectangle2D bounds = fm.getStringBounds(text, g); - buf = buf.getSubimage(0, 0, (int) bounds.getWidth() + 1, (int) bounds.getHeight() + 1); - g.dispose(); - return buf; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/tool/Tools.java b/src/main/resources/mcpi/api/java/src-api/pi/tool/Tools.java deleted file mode 100644 index 6433fb75..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/tool/Tools.java +++ /dev/null @@ -1,18 +0,0 @@ -package pi.tool; - -import pi.Minecraft; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Tools { - - public final Text text; - public final Turtle turtle; - - public Tools(Minecraft world) { - this.text = new Text(world); - this.turtle = new Turtle(world); - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/tool/Turtle.java b/src/main/resources/mcpi/api/java/src-api/pi/tool/Turtle.java deleted file mode 100644 index 7862d081..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/tool/Turtle.java +++ /dev/null @@ -1,124 +0,0 @@ -package pi.tool; - -import pi.*; -import static pi.Vec.xyz; - -/** - * A turtle that can be used for shouldPlaceBlock - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Turtle { - - Minecraft minecraft; - // - Vec home = Vec.ZERO; - Vec pos = Vec.ZERO, dir = Vec.Unit.X; - Block block = Block.WOOD_PLANKS; - boolean shouldPlaceBlock = false; - - public Turtle(Minecraft mc) { - this.minecraft = mc; - } - - /** - * Set the turtle setHome pos - */ - public Turtle setHome(Vec home) { - this.home = home; - return this; - } - - /** - * Move the turtle to setHome with default orientation - */ - public Turtle home() { - this.pos = Vec.ZERO; - this.dir = Vec.Unit.X; - return this; - } - - /** - * Start shouldPlaceBlock - */ - public Turtle on() { - this.shouldPlaceBlock = true; - placeBlock(); - return this; - } - - /** - * Stop shouldPlaceBlock - */ - public Turtle off() { - this.shouldPlaceBlock = false; - return this; - } - - public Turtle block(Block block) { - this.block = block; - return this; - } - - void placeBlock() { - if (shouldPlaceBlock) { - minecraft.setBlock(home.add(pos), block); - } - } - - /** - * Jump without placing blocks - */ - public Turtle jump(int dx, int dy, int dz) { - pos = pos.add(dx, dy, dz); - return this; - } - - /** - * Turn 90 degrees CCW - */ - public Turtle left() { - this.dir = xyz(dir.z, 0, -dir.x); - return this; - } - - /** - * Turn 90 degrees CW - */ - public Turtle right() { - this.dir = xyz(-dir.z, 0, dir.x); - return this; - } - - /** - * Turn 180 degrees - */ - public Turtle around() { - this.dir = xyz(-dir.x, 0, -dir.z); - return this; - } - - public Turtle forward(int steps) { - return move(steps, dir); - } - - public Turtle back(int steps) { - return move(steps, dir.neg()); - } - - public Turtle up(int steps) { - return move(steps, Vec.Unit.Y); - } - - public Turtle down(int steps) { - return move(steps, Vec.Unit.Y.neg()); - } - - Turtle move(int steps, Vec d) { - while (steps-- > 0) { - this.pos = pos.add(d); - placeBlock(); - } - return this; - } -} diff --git a/src/main/resources/mcpi/api/java/src-api/pi/tool/package.html b/src/main/resources/mcpi/api/java/src-api/pi/tool/package.html deleted file mode 100644 index e31aeafd..00000000 --- a/src/main/resources/mcpi/api/java/src-api/pi/tool/package.html +++ /dev/null @@ -1,3 +0,0 @@ - - Tools with higher level functionality - diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/ChristmasTreeDemo.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/ChristmasTreeDemo.java deleted file mode 100644 index 6be42ad8..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/ChristmasTreeDemo.java +++ /dev/null @@ -1,64 +0,0 @@ -package pi.demo; - -import pi.*; -import static pi.Vec.xyz; - -/** - * Build a big christmas tree! - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class ChristmasTreeDemo { - // - static double[] tree = {// - 0.5, 1, 1.5, 2, 2.6, 3, 4, 5, 6,// - 4, 5, 6, 7, 8, 8.6,// - 7, 8, 9, 10, 10.6,// - 9, 10, 11, 12, 13}; - - public static void main(String[] args) { - Minecraft mc = Minecraft.connect(args); - drawChristmasTree(mc, Vec.ZERO); - } - - static void drawChristmasTree(Minecraft mc, Vec p) { - // Clear area and add snow on the ground - Vec v = xyz(20, 0, 20); - mc.setBlocks(v.neg(), v.add(0, 50, 0), Block.AIR); - mc.setBlocks(v.neg(), v, Block.SNOW_BLOCK); - - int h = 6; - - // Draw "branches" - for (int i = 0; i < tree.length; i++) { - drawDisc(mc, p.add(0, h, 0), tree[tree.length - i - 1], Block.LEAVES.withData(1)); - h++; - } - - // Draw trunk - mc.setBlocks(p.add(-1, 0, 0), p.add(1, h - 6, 0), Block.WOOD); - mc.setBlocks(p.add(0, 0, -1), p.add(0, h - 6, 1), Block.WOOD); - - // Draw star - drawStar(mc, p.add(0, h, 0)); - } - - static void drawDisc(Minecraft mc, Vec p, double r, Block b) { - int rr = (int) Math.ceil(r); - for (int j = -rr; j <= rr; j++) { - for (int i = -rr; i <= rr; i++) { - double diff = i * i + j * j - r * r; - if (diff <= 0) { - mc.setBlock(p.add(i, 0, j), b); - } - } - } - } - - private static void drawStar(Minecraft mc, Vec p) { - double[] radii = {0, 0, 1, 2, 1, 0}; - for (int i = 0; i < radii.length; i++) { - drawDisc(mc, p.add(0, i, 0), radii[i], Block.GOLD_BLOCK); - } - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/DigitalClock.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/DigitalClock.java deleted file mode 100644 index 1f8168bf..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/DigitalClock.java +++ /dev/null @@ -1,30 +0,0 @@ -package pi.demo; - -import java.text.DateFormat; -import java.util.Date; -import pi.Minecraft; -import pi.tool.Text; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class DigitalClock { - public static void main(String[] args) { - //Text textTool = Minecraft.connect(args).tools.text; - - String lastTime = ""; - DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT); - while (true) { - String time = timeFormatter.format(new Date()); - if (!time.equals(lastTime)) { - System.out.println(time); - lastTime = time; - } - try { - Thread.sleep(100); - } catch (InterruptedException _) { - } - } - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/LoopDemo.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/LoopDemo.java deleted file mode 100644 index c8672dda..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/LoopDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package pi.demo; - -import static pi.Block.*; -import pi.Minecraft; -import pi.Vec; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class LoopDemo { - public static void main(String[] args) { - Minecraft mc = Minecraft.connect(args); - - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - mc.setBlock(Vec.xyz(i, 2, j), IRON_BLOCK); - } - } - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/LowLevelDemo.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/LowLevelDemo.java deleted file mode 100644 index 6b793d5e..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/LowLevelDemo.java +++ /dev/null @@ -1,41 +0,0 @@ -package pi.demo; - -import static pi.Block.*; -import pi.Minecraft; -import static pi.Vec.xyz; - -/** - * Manipulate blocks with the low level api - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class LowLevelDemo { - - public static void main(String[] args) { - createPool(Minecraft.connect(args)); - } - - static void createPool(Minecraft mc) { - final int height = 0; - - final int r = 7; - // Build a kind of half sphere pool - for (int k = -r; k <= height; k++) { - for (int j = -r; j <= r; j++) { - for (int i = -r; i <= r; i++) { - if (i * i + j * j + k * k < r * r) { - mc.setBlock(xyz(i, k, j), WATER_STATIONARY); - } else { - mc.setBlock(xyz(i, k, j), STONE); - } - } - } - } - - // Set air above pool - mc.setBlocks(xyz(r, height + 1, -r), xyz(-r, height + 30, r), AIR); - - // Drop the player in the pool - mc.player.setPosition(xyz(0, 10, 0)); - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/TextDemo.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/TextDemo.java deleted file mode 100644 index 4792fb0f..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/TextDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package pi.demo; - -import pi.Minecraft; -import pi.tool.Text; -import static pi.Block.*; -import static pi.Vec.Unit.*; -import static pi.Vec.xyz; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class TextDemo { - - public static void main(String[] args) { - Text textTool = Minecraft.connect(args).tools.text; - - // Just draw a text - textTool.at(xyz(0, 0, 20)).draw("pi"); - - // Symbols are fun (skull and bones, arrr!) - textTool.at(xyz(0, 0, 35)).with("Wingdings", 50).with(STONE).draw("\u2620"); - - // More settings - textTool.at(xyz(0, 10, 0)).with("Arial", 12).with(SAND).withOrientation(X, Z).draw("fun!"); - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/TurtleDemo.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/TurtleDemo.java deleted file mode 100644 index c17fe217..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/TurtleDemo.java +++ /dev/null @@ -1,52 +0,0 @@ -package pi.demo; - -import pi.*; -import pi.tool.Turtle; -import static pi.Block.*; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class TurtleDemo { - public static void main(String[] args) { - Turtle turtle = Minecraft.connect(args).tools.turtle; - - int width = 9, depth = 5, height = 3; - drawHouse(turtle, width, depth, height); - } - - /** - * Draw a square house at turtle setHome - * - * @param turtle the turtle to use for drawing - * @param width the width of the house - * @param height the height of the walls - */ - private static void drawHouse(Turtle turtle, int width, int depth, int height) { - width--; - - // Floor - - // Walls - turtle.home().off().up(1).block(BRICK_BLOCK).on(); - for (int i = 0; i < height; i++) { - turtle.forward(depth).right(). - forward(width).right(). - forward(depth).right(). - forward(width).right(); - turtle.up(1); - } - - // Roof - turtle.jump(0, 0, -1).block(WOOD); - for (int s = depth; s >= 0; s -= 2) { - turtle.forward(s).right().forward(width + 2).right() - .forward(s).right().forward(width + 2).right(); - turtle.jump(1, 1, 0); - } - - // Door - turtle.home().block(AIR).off().up(1).right().forward(width / 2).on().up(1); - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/Usage.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/Usage.java deleted file mode 100644 index 8fe5ed00..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/Usage.java +++ /dev/null @@ -1,11 +0,0 @@ -package pi.demo; - -/** - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Usage { - public static void main(String[] args) { - System.out.println("Read the file HOW_TO_RUN.txt in the McPiDemos directory"); - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level.java deleted file mode 100644 index 62d89d3c..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level.java +++ /dev/null @@ -1,54 +0,0 @@ -package pi.demo.sokoban; - -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; - -/** - * A Sokoban level - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Level { - int number; - String name; - LevelTile[][] tiles; - int width, height; - - Level(String data, int number) { - this.number = number; - Scanner s = new Scanner(data); - this.name = s.nextLine(); - List rows = new ArrayList(); - while (s.hasNextLine()) { - LevelTile[] row = parseRow(s.nextLine()); - this.width = Math.max(width, row.length); - rows.add(row); - } - this.height = rows.size(); - tiles = rows.toArray(new LevelTile[height][]); - } - - LevelTile get(Position p) { - LevelTile[] row = tiles[p.j]; - return (p.i < row.length) ? row[p.i] : LevelTile.EMPTY; - } - - private static LevelTile[] parseRow(String line) { - List row = new ArrayList(); - for (char c : line.toCharArray()) { - row.add(LevelTile.from(c)); - } - return row.toArray(new LevelTile[row.size()]); - } - - static List loadLevels() { - List levels = new ArrayList(); - Scanner s = new Scanner(Level.class.getResourceAsStream("Level_Data")); - s.useDelimiter("#").next(); - while (s.hasNext()) { - levels.add(new Level(s.next(), levels.size() + 1)); - } - return levels; - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/LevelTile.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/LevelTile.java deleted file mode 100644 index e556565b..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/LevelTile.java +++ /dev/null @@ -1,24 +0,0 @@ -package pi.demo.sokoban; - -/** - * Level tile - * - * @author Daniel Frisk, twitter:danfrisk - */ -enum LevelTile { - EMPTY(' '), WALL('='), PLAYER('p'), STONE('s'), TARGET('t'), TARGET_AND_STONE('T'); - private char id; - - private LevelTile(char id) { - this.id = id; - } - - static LevelTile from(char id) { - for (LevelTile t : values()) { - if (t.id == id) { - return t; - } - } - throw new RuntimeException("Unknown id: " + id); - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level_Data b/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level_Data deleted file mode 100644 index f2eff4ed..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Level_Data +++ /dev/null @@ -1,49 +0,0 @@ -= wall, p player, s stone, t target - -#Too easy -============ -= p s t= -============ -#Still easy -============ -= t= -= = - = s= - = p = - ========== -#Just work -========== -=t s t= -= = -=s s p= -= = -=t s t= -========== -#Not hard - ===== - = ==== - = = = - == ps t= -=== ===t= -= s = =t= -= s = === -= = -===== -#centimoves -======== -= = = -= = =st= -= st= -= = =st= -= = = -===== p= - ==== -#harder now? -======= -= t = -= = = = -= sps = -= = =t= -= T = -======= - diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Position.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Position.java deleted file mode 100644 index 2815abc3..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Position.java +++ /dev/null @@ -1,47 +0,0 @@ -package pi.demo.sokoban; - -import pi.Vec; - -/** - * A position in a Sokoban level - * - * @author Daniel Frisk, twitter:danfrisk - */ -class Position { - final int i, j; - - private Position(int i, int j) { - this.i = i; - this.j = j; - } - - static Position uv(int i, int j) { - return new Position(i, j); - } - - static Position fromWorld(Vec v) { - return new Position(v.x, v.z); - } - - Vec toWorld(int height) { - return Vec.xyz(i, height, j); - } - - @Override - public int hashCode() { - return (i << 16) + j; - } - - @Override - public boolean equals(Object obj) { - if ((obj == null) || !(obj instanceof Position)) { - return false; - } - return hashCode() == ((Position) obj).hashCode(); - } - - @Override - public String toString() { - return i + "," + j; - } -} diff --git a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Sokoban.java b/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Sokoban.java deleted file mode 100644 index 365e4267..00000000 --- a/src/main/resources/mcpi/api/java/src-demos/pi/demo/sokoban/Sokoban.java +++ /dev/null @@ -1,128 +0,0 @@ -package pi.demo.sokoban; - -import java.util.*; -import static pi.Block.*; -import pi.*; -import pi.event.BlockHitEvent; - -/** - * Sokoban game for Minecraft - * - * @author Daniel Frisk, twitter:danfrisk - */ -public class Sokoban { - Minecraft mc; - // - List levels = Level.loadLevels(); - Level level; - // - PositionSet walls = new PositionSet(), targets = new PositionSet(), stones = new PositionSet(); - - public Sokoban(Minecraft minecraft) { - this.mc = minecraft; - } - - /** - * - */ - public static void main(String[] args) { - new Sokoban(Minecraft.connect(args)).run(); - } - - public void run() { - mc.postToChat("Sokoban!"); - mc.camera.setNormal(); - mc.setting("immutable", true); - - while (true) { - if (stones.equals(targets)) { - if (level != null) { - mc.postToChat("Level finished!"); - sleep(2000); - } - int ni = level == null ? 0 : level.number >= levels.size() ? 0 : level.number; - startLevel(levels.get(ni)); - } - - List hits = mc.events.pollBlockHits(); - if (!hits.isEmpty()) { - BlockHitEvent ev = hits.iterator().next(); - onBlockHit(ev.position, ev.surfaceDirection.neg()); - } - - sleep(80); - } - } - - void startLevel(Level level) { - this.level = level; - - walls.clear(); - targets.clear(); - stones.clear(); - - // Clear the ground - mc.setBlocks(Position.uv(0, 0).toWorld(0), - Position.uv(level.width - 1, level.height - 1).toWorld(10), - AIR); - - mc.setBlocks(Position.uv(0, 0).toWorld(-1), - Position.uv(level.width - 1, level.height - 1).toWorld(-1), - SANDSTONE); - - // Set level blocks and teleport the player - for (int v = 0; v < level.height; v++) { - for (int u = 0; u < level.width; u++) { - Position pos = Position.uv(u, v); - - LevelTile t = level.get(pos); - if (LevelTile.EMPTY == t) { - continue; - } - if (LevelTile.WALL == t) { - walls.add(pos); - mc.setBlocks(pos.toWorld(0), pos.toWorld(2), STONE); - } - if (LevelTile.PLAYER == t) { - mc.player.setPosition(pos.toWorld(2)); - } - if (LevelTile.TARGET == t || LevelTile.TARGET_AND_STONE == t) { - targets.add(pos); - mc.setBlock(pos.toWorld(-1), wool(Color.LIGHT_BLUE)); - } - if (LevelTile.STONE == t || LevelTile.TARGET_AND_STONE == t) { - stones.add(pos); - mc.setBlock(pos.toWorld(0), IRON_BLOCK); - } - } - } - - mc.events.clearAll(); - mc.postToChat("Level " + level.number + " - " + level.name); - } - - void onBlockHit(Vec position, Vec.Unit direction) { - Position from = Position.fromWorld(position); - Position to = Position.fromWorld(position.add(direction)); - if (!from.equals(to) && !walls.contains(to) && !stones.contains(to)) { - if (stones.remove(from)) { - stones.add(to); - mc.setBlock(to.toWorld(0), targets.contains(to) ? GOLD_BLOCK : IRON_BLOCK); - mc.setBlock(position, AIR); - } - } - } - - void sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException _) { - } - } - - /** - * - */ - private static class PositionSet extends HashSet { - } -} diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py b/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py deleted file mode 100644 index bffb491d..00000000 --- a/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py +++ /dev/null @@ -1,261 +0,0 @@ -from .connection import Connection -from .vec3 import Vec3 -from .event import BlockEvent, ChatEvent -from .entity import Entity -from .block import Block -import math -from .util import flatten - -""" Minecraft PI low level api v0.1_1 - - Note: many methods have the parameter *arg. This solution makes it - simple to allow different types, and variable number of arguments. - The actual magic is a mix of flatten_parameters() and __iter__. Example: - A Cube class could implement __iter__ to work in Minecraft.setBlocks(c, id). - - (Because of this, it's possible to "erase" arguments. CmdPlayer removes - entityId, by injecting [] that flattens to nothing) - - @author: Aron Nieminen, Mojang AB""" - -""" Updated to include functionality provided by RaspberryJuice: -- getBlocks() -- getDirection() -- getPitch() -- getRotation() -- getPlayerEntityId() -- pollChatPosts() -- setSign() -- spawnEntity()""" - -def intFloor(*args): - return [int(math.floor(x)) for x in flatten(args)] - -class CmdPositioner: - """Methods for setting and getting positions""" - def __init__(self, connection, packagePrefix): - self.conn = connection - self.pkg = packagePrefix - - def getPos(self, id): - """Get entity position (entityId:int) => Vec3""" - s = self.conn.sendReceive(self.pkg + b".getPos", id) - return Vec3(*list(map(float, s.split(",")))) - - def setPos(self, id, *args): - """Set entity position (entityId:int, x,y,z)""" - self.conn.send(self.pkg + b".setPos", id, args) - - def getTilePos(self, id): - """Get entity tile position (entityId:int) => Vec3""" - s = self.conn.sendReceive(self.pkg + b".getTile", id) - return Vec3(*list(map(int, s.split(",")))) - - def setTilePos(self, id, *args): - """Set entity tile position (entityId:int) => Vec3""" - self.conn.send(self.pkg + b".setTile", id, intFloor(*args)) - - def setDirection(self, id, *args): - """Set entity direction (entityId:int, x,y,z)""" - self.conn.send(self.pkg + b".setDirection", id, args) - - def getDirection(self, id): - """Get entity direction (entityId:int) => Vec3""" - s = self.conn.sendReceive(self.pkg + b".getDirection", id) - return Vec3(*map(float, s.split(","))) - - def setRotation(self, id, yaw): - """Set entity rotation (entityId:int, yaw)""" - self.conn.send(self.pkg + b".setRotation", id, yaw) - - def getRotation(self, id): - """get entity rotation (entityId:int) => float""" - return float(self.conn.sendReceive(self.pkg + b".getRotation", id)) - - def setPitch(self, id, pitch): - """Set entity pitch (entityId:int, pitch)""" - self.conn.send(self.pkg + b".setPitch", id, pitch) - - def getPitch(self, id): - """get entity pitch (entityId:int) => float""" - return float(self.conn.sendReceive(self.pkg + b".getPitch", id)) - - def setting(self, setting, status): - """Set a player setting (setting, status). keys: autojump""" - self.conn.send(self.pkg + b".setting", setting, 1 if bool(status) else 0) - -class CmdEntity(CmdPositioner): - """Methods for entities""" - def __init__(self, connection): - CmdPositioner.__init__(self, connection, b"entity") - - def getName(self, id): - """Get the list name of the player with entity id => [name:str] - - Also can be used to find name of entity if entity is not a player.""" - return self.conn.sendReceive(b"entity.getName", id) - - -class CmdPlayer(CmdPositioner): - """Methods for the host (Raspberry Pi) player""" - def __init__(self, connection): - CmdPositioner.__init__(self, connection, b"player") - self.conn = connection - - def getPos(self): - return CmdPositioner.getPos(self, []) - def setPos(self, *args): - return CmdPositioner.setPos(self, [], args) - def getTilePos(self): - return CmdPositioner.getTilePos(self, []) - def setTilePos(self, *args): - return CmdPositioner.setTilePos(self, [], args) - def setDirection(self, *args): - return CmdPositioner.setDirection(self, [], args) - def getDirection(self): - return CmdPositioner.getDirection(self, []) - def setRotation(self, yaw): - return CmdPositioner.setRotation(self, [], yaw) - def getRotation(self): - return CmdPositioner.getRotation(self, []) - def setPitch(self, pitch): - return CmdPositioner.setPitch(self, [], pitch) - def getPitch(self): - return CmdPositioner.getPitch(self, []) - -class CmdCamera: - def __init__(self, connection): - self.conn = connection - - def setNormal(self, *args): - """Set camera mode to normal Minecraft view ([entityId])""" - self.conn.send(b"camera.mode.setNormal", args) - - def setFixed(self): - """Set camera mode to fixed view""" - self.conn.send(b"camera.mode.setFixed") - - def setFollow(self, *args): - """Set camera mode to follow an entity ([entityId])""" - self.conn.send(b"camera.mode.setFollow", args) - - def setPos(self, *args): - """Set camera entity position (x,y,z)""" - self.conn.send(b"camera.setPos", args) - - -class CmdEvents: - """Events""" - def __init__(self, connection): - self.conn = connection - - def clearAll(self): - """Clear all old events""" - self.conn.send(b"events.clear") - - def pollBlockHits(self): - """Only triggered by sword => [BlockEvent]""" - s = self.conn.sendReceive(b"events.block.hits") - events = [e for e in s.split("|") if e] - return [BlockEvent.Hit(*list(map(int, e.split(",")))) for e in events] - - def pollChatPosts(self): - """Triggered by posts to chat => [ChatEvent]""" - s = self.conn.sendReceive(b"events.chat.posts") - events = [e for e in s.split("|") if e] - return [ChatEvent.Post(int(e[:e.find(",")]), e[e.find(",") + 1:]) for e in events] - -class Minecraft: - """The main class to interact with a running instance of Minecraft Pi.""" - def __init__(self, connection): - self.conn = connection - - self.camera = CmdCamera(connection) - self.entity = CmdEntity(connection) - self.player = CmdPlayer(connection) - self.events = CmdEvents(connection) - - def getBlock(self, *args): - """Get block (x,y,z) => id:int""" - return int(self.conn.sendReceive(b"world.getBlock", intFloor(args))) - - def getBlockWithData(self, *args): - """Get block with data (x,y,z) => Block""" - ans = self.conn.sendReceive(b"world.getBlockWithData", intFloor(args)) - return Block(*list(map(int, ans.split(",")))) - - def getBlocks(self, *args): - """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [id:int]""" - s = self.conn.sendReceive(b"world.getBlocks", intFloor(args)) - return map(int, s.split(",")) - - def setBlock(self, *args): - """Set block (x,y,z,id,[data])""" - self.conn.send(b"world.setBlock", intFloor(args)) - - def setBlocks(self, *args): - """Set a cuboid of blocks (x0,y0,z0,x1,y1,z1,id,[data])""" - self.conn.send(b"world.setBlocks", intFloor(args)) - - def setSign(self, *args): - """Set a sign (x,y,z,id,data,[line1,line2,line3,line4]) - - Wall signs (id=68) require data for facing direction 2=north, 3=south, 4=west, 5=east - Standing signs (id=63) require data for facing rotation (0-15) 0=south, 4=west, 8=north, 12=east - @author: Tim Cummings https://www.triptera.com.au/wordpress/""" - lines = [] - flatargs = [] - for arg in flatten(args): - flatargs.append(arg) - for flatarg in flatargs[5:]: - lines.append(flatarg.replace(",",";").replace(")","]").replace("(","[")) - self.conn.send(b"world.setSign",intFloor(flatargs[0:5]) + lines) - - def spawnEntity(self, *args): - """Spawn entity (x,y,z,id,[data])""" - return int(self.conn.sendReceive(b"world.spawnEntity", intFloor(args))) - - def getHeight(self, *args): - """Get the height of the world (x,z) => int""" - return int(self.conn.sendReceive(b"world.getHeight", intFloor(args))) - - def getPlayerEntityIds(self): - """Get the entity ids of the connected players => [id:int]""" - ids = self.conn.sendReceive(b"world.getPlayerIds") - return list(map(int, ids.split("|"))) - - def getPlayerEntityId(self, name): - """Get the entity id of the named player => [id:int]""" - return int(self.conn.sendReceive(b"world.getPlayerId", name)) - - def saveCheckpoint(self): - """Save a checkpoint that can be used for restoring the world""" - self.conn.send(b"world.checkpoint.save") - - def restoreCheckpoint(self): - """Restore the world state to the checkpoint""" - self.conn.send(b"world.checkpoint.restore") - - def postToChat(self, msg): - """Post a message to the game chat""" - self.conn.send(b"chat.post", msg) - - def setting(self, setting, status): - """Set a world setting (setting, status). keys: world_immutable, nametags_visible""" - self.conn.send(b"world.setting", setting, 1 if bool(status) else 0) - - def getEntityTypes(self): - """Return a list of Entity objects representing all the entity types in Minecraft""" - s = self.conn.sendReceive(b"world.getEntityTypes") - types = [t for t in s.split("|") if t] - return [Entity(int(e[:e.find(",")]), e[e.find(",") + 1:]) for e in types] - - - @staticmethod - def create(address = "localhost", port = 4711): - return Minecraft(Connection(address, port)) - - -if __name__ == "__main__": - mc = Minecraft.create() - mc.postToChat("Hello, Minecraft!") diff --git a/src/main/resources/mcpi/api/python/original/mcpi/event.py b/src/main/resources/mcpi/api/python/original/mcpi/event.py deleted file mode 100644 index 68193bc9..00000000 --- a/src/main/resources/mcpi/api/python/original/mcpi/event.py +++ /dev/null @@ -1,23 +0,0 @@ -from .vec3 import Vec3 - -class BlockEvent: - """An Event related to blocks (e.g. placed, removed, hit)""" - HIT = 0 - - def __init__(self, type, x, y, z, face, entityId): - self.type = type - self.pos = Vec3(x, y, z) - self.face = face - self.entityId = entityId - - def __repr__(self): - sType = { - BlockEvent.HIT: "BlockEvent.HIT" - }.get(self.type, "???") - - return "BlockEvent(%s, %d, %d, %d, %d, %d)"%( - sType,self.pos.x,self.pos.y,self.pos.z,self.face,self.entityId); - - @staticmethod - def Hit(x, y, z, face, entityId): - return BlockEvent(BlockEvent.HIT, x, y, z, face, entityId) diff --git a/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py b/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py deleted file mode 100644 index 1d1f293d..00000000 --- a/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py +++ /dev/null @@ -1,176 +0,0 @@ -from .connection import Connection -from .vec3 import Vec3 -from .event import BlockEvent -from .block import Block -import math -from .util import flatten - -""" Minecraft PI low level api v0.1_1 - - Note: many methods have the parameter *arg. This solution makes it - simple to allow different types, and variable number of arguments. - The actual magic is a mix of flatten_parameters() and __iter__. Example: - A Cube class could implement __iter__ to work in Minecraft.setBlocks(c, id). - - (Because of this, it's possible to "erase" arguments. CmdPlayer removes - entityId, by injecting [] that flattens to nothing) - - @author: Aron Nieminen, Mojang AB""" - - -def intFloor(*args): - return [int(math.floor(x)) for x in flatten(args)] - -class CmdPositioner: - """Methods for setting and getting positions""" - def __init__(self, connection, packagePrefix): - self.conn = connection - self.pkg = packagePrefix - - def getPos(self, id): - """Get entity position (entityId:int) => Vec3""" - s = self.conn.sendReceive(self.pkg + b".getPos", id) - return Vec3(*list(map(float, s.split(",")))) - - def setPos(self, id, *args): - """Set entity position (entityId:int, x,y,z)""" - self.conn.send(self.pkg + b".setPos", id, args) - - def getTilePos(self, id): - """Get entity tile position (entityId:int) => Vec3""" - s = self.conn.sendReceive(self.pkg + b".getTile", id) - return Vec3(*list(map(int, s.split(",")))) - - def setTilePos(self, id, *args): - """Set entity tile position (entityId:int) => Vec3""" - self.conn.send(self.pkg + b".setTile", id, intFloor(*args)) - - def setting(self, setting, status): - """Set a player setting (setting, status). keys: autojump""" - self.conn.send(self.pkg + b".setting", setting, 1 if bool(status) else 0) - - -class CmdEntity(CmdPositioner): - """Methods for entities""" - def __init__(self, connection): - CmdPositioner.__init__(self, connection, b"entity") - - -class CmdPlayer(CmdPositioner): - """Methods for the host (Raspberry Pi) player""" - def __init__(self, connection): - CmdPositioner.__init__(self, connection, b"player") - self.conn = connection - - def getPos(self): - return CmdPositioner.getPos(self, []) - def setPos(self, *args): - return CmdPositioner.setPos(self, [], args) - def getTilePos(self): - return CmdPositioner.getTilePos(self, []) - def setTilePos(self, *args): - return CmdPositioner.setTilePos(self, [], args) - -class CmdCamera: - def __init__(self, connection): - self.conn = connection - - def setNormal(self, *args): - """Set camera mode to normal Minecraft view ([entityId])""" - self.conn.send(b"camera.mode.setNormal", args) - - def setFixed(self): - """Set camera mode to fixed view""" - self.conn.send(b"camera.mode.setFixed") - - def setFollow(self, *args): - """Set camera mode to follow an entity ([entityId])""" - self.conn.send(b"camera.mode.setFollow", args) - - def setPos(self, *args): - """Set camera entity position (x,y,z)""" - self.conn.send(b"camera.setPos", args) - - -class CmdEvents: - """Events""" - def __init__(self, connection): - self.conn = connection - - def clearAll(self): - """Clear all old events""" - self.conn.send(b"events.clear") - - def pollBlockHits(self): - """Only triggered by sword => [BlockEvent]""" - s = self.conn.sendReceive(b"events.block.hits") - events = [e for e in s.split("|") if e] - return [BlockEvent.Hit(*list(map(int, e.split(",")))) for e in events] - - -class Minecraft: - """The main class to interact with a running instance of Minecraft Pi.""" - def __init__(self, connection): - self.conn = connection - - self.camera = CmdCamera(connection) - self.entity = CmdEntity(connection) - self.player = CmdPlayer(connection) - self.events = CmdEvents(connection) - - def getBlock(self, *args): - """Get block (x,y,z) => id:int""" - return int(self.conn.sendReceive(b"world.getBlock", intFloor(args))) - - def getBlockWithData(self, *args): - """Get block with data (x,y,z) => Block""" - ans = self.conn.sendReceive(b"world.getBlockWithData", intFloor(args)) - return Block(*list(map(int, ans.split(",")))) - """ - @TODO - """ - def getBlocks(self, *args): - """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [id:int]""" - return int(self.conn.sendReceive(b"world.getBlocks", intFloor(args))) - - def setBlock(self, *args): - """Set block (x,y,z,id,[data])""" - self.conn.send(b"world.setBlock", intFloor(args)) - - def setBlocks(self, *args): - """Set a cuboid of blocks (x0,y0,z0,x1,y1,z1,id,[data])""" - self.conn.send(b"world.setBlocks", intFloor(args)) - - def getHeight(self, *args): - """Get the height of the world (x,z) => int""" - return int(self.conn.sendReceive(b"world.getHeight", intFloor(args))) - - def getPlayerEntityIds(self): - """Get the entity ids of the connected players => [id:int]""" - ids = self.conn.sendReceive(b"world.getPlayerIds") - return list(map(int, ids.split("|"))) - - def saveCheckpoint(self): - """Save a checkpoint that can be used for restoring the world""" - self.conn.send(b"world.checkpoint.save") - - def restoreCheckpoint(self): - """Restore the world state to the checkpoint""" - self.conn.send(b"world.checkpoint.restore") - - def postToChat(self, msg): - """Post a message to the game chat""" - self.conn.send(b"chat.post", msg) - - def setting(self, setting, status): - """Set a world setting (setting, status). keys: world_immutable, nametags_visible""" - self.conn.send(b"world.setting", setting, 1 if bool(status) else 0) - - @staticmethod - def create(address = "localhost", port = 4711): - return Minecraft(Connection(address, port)) - - -if __name__ == "__main__": - mc = Minecraft.create() - mc.postToChat("Hello, Minecraft!") diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/block.py b/src/main/resources/mcpi/block.py similarity index 71% rename from src/main/resources/mcpi/api/python/modded/mcpi/block.py rename to src/main/resources/mcpi/block.py index b64bc6c1..52c85023 100644 --- a/src/main/resources/mcpi/api/python/modded/mcpi/block.py +++ b/src/main/resources/mcpi/block.py @@ -49,11 +49,8 @@ def __repr__(self): LAPIS_LAZULI_BLOCK = Block(22) SANDSTONE = Block(24) BED = Block(26) -RAIL_POWERED = Block(27) -RAIL_DETECTOR = Block(28) COBWEB = Block(30) GRASS_TALL = Block(31) -DEAD_BUSH = Block(32) WOOL = Block(35) FLOWER_YELLOW = Block(37) FLOWER_CYAN = Block(38) @@ -78,15 +75,11 @@ def __repr__(self): FARMLAND = Block(60) FURNACE_INACTIVE = Block(61) FURNACE_ACTIVE = Block(62) -SIGN_STANDING = Block(63) DOOR_WOOD = Block(64) LADDER = Block(65) -RAIL = Block(66) STAIRS_COBBLESTONE = Block(67) -SIGN_WALL = Block(68) DOOR_IRON = Block(71) REDSTONE_ORE = Block(73) -TORCH_REDSTONE = Block(76) SNOW = Block(78) ICE = Block(79) SNOW_BLOCK = Block(80) @@ -94,40 +87,11 @@ def __repr__(self): CLAY = Block(82) SUGAR_CANE = Block(83) FENCE = Block(85) -PUMPKIN = Block(86) -NETHERRACK = Block(87) -SOUL_SAND = Block(88) GLOWSTONE_BLOCK = Block(89) -LIT_PUMPKIN = Block(91) -STAINED_GLASS = Block(95) BEDROCK_INVISIBLE = Block(95) -TRAPDOOR = Block(96) STONE_BRICK = Block(98) GLASS_PANE = Block(102) MELON = Block(103) FENCE_GATE = Block(107) -STAIRS_BRICK = Block(108) -STAIRS_STONE_BRICK = Block(109) -MYCELIUM = Block(110) -NETHER_BRICK = Block(112) -FENCE_NETHER_BRICK = Block(113) -STAIRS_NETHER_BRICK = Block(114) -END_STONE = Block(121) -WOODEN_SLAB = Block(126) -STAIRS_SANDSTONE = Block(128) -EMERALD_ORE = Block(129) -RAIL_ACTIVATOR = Block(157) -LEAVES2 = Block(161) -TRAPDOOR_IRON = Block(167) -FENCE_SPRUCE = Block(188) -FENCE_BIRCH = Block(189) -FENCE_JUNGLE = Block(190) -FENCE_DARK_OAK = Block(191) -FENCE_ACACIA = Block(192) -DOOR_SPRUCE = Block(193) -DOOR_BIRCH = Block(194) -DOOR_JUNGLE = Block(195) -DOOR_ACACIA = Block(196) -DOOR_DARK_OAK = Block(197) GLOWING_OBSIDIAN = Block(246) NETHER_REACTOR_CORE = Block(247) diff --git a/src/main/resources/mcpi/api/python/original/mcpi/connection.py b/src/main/resources/mcpi/connection.py similarity index 90% rename from src/main/resources/mcpi/api/python/original/mcpi/connection.py rename to src/main/resources/mcpi/connection.py index ab078e88..dd337bd4 100644 --- a/src/main/resources/mcpi/api/python/original/mcpi/connection.py +++ b/src/main/resources/mcpi/connection.py @@ -53,8 +53,9 @@ def _send(self, s): def receive(self): """Receives data. Note that the trailing newline '\n' is trimmed""" s = self.socket.makefile("r").readline().rstrip("\n") - if s == Connection.RequestFailed: - raise RequestError("%s failed"%self.lastSent.strip()) + checkFail = s.split(",") + if checkFail[0] == Connection.RequestFailed: + raise RequestError("%s failed! Cause: %s" % (self.lastSent.strip(),checkFail[-1])) return s def sendReceive(self, *data): diff --git a/src/main/resources/mcpi/entity.py b/src/main/resources/mcpi/entity.py new file mode 100644 index 00000000..b78a4850 --- /dev/null +++ b/src/main/resources/mcpi/entity.py @@ -0,0 +1,102 @@ +class Entity: + '''Minecraft PI entity description. Can be sent to Minecraft.spawnEntity''' + + def __init__(self, id, name = None): + self.id = id + self.name = name + + def __cmp__(self, rhs): + return hash(self) - hash(rhs) + + def __eq__(self, rhs): + return self.id == rhs.id + + def __hash__(self): + return self.id + + def __iter__(self): + '''Allows an Entity to be sent whenever id is needed''' + return iter((self.id,)) + + def __repr__(self): + return 'Entity(%d)'%(self.id) + +EXPERIENCE_ORB = Entity(2, "EXPERIENCE_ORB") +AREA_EFFECT_CLOUD = Entity(3, "AREA_EFFECT_CLOUD") +ELDER_GUARDIAN = Entity(4, "ELDER_GUARDIAN") +WITHER_SKELETON = Entity(5, "WITHER_SKELETON") +STRAY = Entity(6, "STRAY") +EGG = Entity(7, "EGG") +LEASH_HITCH = Entity(8, "LEASH_HITCH") +PAINTING = Entity(9, "PAINTING") +ARROW = Entity(10, "ARROW") +SNOWBALL = Entity(11, "SNOWBALL") +FIREBALL = Entity(12, "FIREBALL") +SMALL_FIREBALL = Entity(13, "SMALL_FIREBALL") +ENDER_PEARL = Entity(14, "ENDER_PEARL") +ENDER_SIGNAL = Entity(15, "ENDER_SIGNAL") +THROWN_EXP_BOTTLE = Entity(17, "THROWN_EXP_BOTTLE") +ITEM_FRAME = Entity(18, "ITEM_FRAME") +WITHER_SKULL = Entity(19, "WITHER_SKULL") +PRIMED_TNT = Entity(20, "PRIMED_TNT") +HUSK = Entity(23, "HUSK") +SPECTRAL_ARROW = Entity(24, "SPECTRAL_ARROW") +SHULKER_BULLET = Entity(25, "SHULKER_BULLET") +DRAGON_FIREBALL = Entity(26, "DRAGON_FIREBALL") +ZOMBIE_VILLAGER = Entity(27, "ZOMBIE_VILLAGER") +SKELETON_HORSE = Entity(28, "SKELETON_HORSE") +ZOMBIE_HORSE = Entity(29, "ZOMBIE_HORSE") +ARMOR_STAND = Entity(30, "ARMOR_STAND") +DONKEY = Entity(31, "DONKEY") +MULE = Entity(32, "MULE") +EVOKER_FANGS = Entity(33, "EVOKER_FANGS") +EVOKER = Entity(34, "EVOKER") +VEX = Entity(35, "VEX") +VINDICATOR = Entity(36, "VINDICATOR") +ILLUSIONER = Entity(37, "ILLUSIONER") +MINECART_COMMAND = Entity(40, "MINECART_COMMAND") +BOAT = Entity(41, "BOAT") +MINECART = Entity(42, "MINECART") +MINECART_CHEST = Entity(43, "MINECART_CHEST") +MINECART_FURNACE = Entity(44, "MINECART_FURNACE") +MINECART_TNT = Entity(45, "MINECART_TNT") +MINECART_HOPPER = Entity(46, "MINECART_HOPPER") +MINECART_MOB_SPAWNER = Entity(47, "MINECART_MOB_SPAWNER") +CREEPER = Entity(50, "CREEPER") +SKELETON = Entity(51, "SKELETON") +SPIDER = Entity(52, "SPIDER") +GIANT = Entity(53, "GIANT") +ZOMBIE = Entity(54, "ZOMBIE") +SLIME = Entity(55, "SLIME") +GHAST = Entity(56, "GHAST") +PIG_ZOMBIE = Entity(57, "PIG_ZOMBIE") +ENDERMAN = Entity(58, "ENDERMAN") +CAVE_SPIDER = Entity(59, "CAVE_SPIDER") +SILVERFISH = Entity(60, "SILVERFISH") +BLAZE = Entity(61, "BLAZE") +MAGMA_CUBE = Entity(62, "MAGMA_CUBE") +ENDER_DRAGON = Entity(63, "ENDER_DRAGON") +WITHER = Entity(64, "WITHER") +BAT = Entity(65, "BAT") +WITCH = Entity(66, "WITCH") +ENDERMITE = Entity(67, "ENDERMITE") +GUARDIAN = Entity(68, "GUARDIAN") +SHULKER = Entity(69, "SHULKER") +PIG = Entity(90, "PIG") +SHEEP = Entity(91, "SHEEP") +COW = Entity(92, "COW") +CHICKEN = Entity(93, "CHICKEN") +SQUID = Entity(94, "SQUID") +WOLF = Entity(95, "WOLF") +MUSHROOM_COW = Entity(96, "MUSHROOM_COW") +SNOWMAN = Entity(97, "SNOWMAN") +OCELOT = Entity(98, "OCELOT") +IRON_GOLEM = Entity(99, "IRON_GOLEM") +HORSE = Entity(100, "HORSE") +RABBIT = Entity(101, "RABBIT") +POLAR_BEAR = Entity(102, "POLAR_BEAR") +LLAMA = Entity(103, "LLAMA") +LLAMA_SPIT = Entity(104, "LLAMA_SPIT") +PARROT = Entity(105, "PARROT") +VILLAGER = Entity(120, "VILLAGER") +ENDER_CRYSTAL = Entity(200, "ENDER_CRYSTAL") \ No newline at end of file diff --git a/src/main/resources/mcpi/event.py b/src/main/resources/mcpi/event.py new file mode 100644 index 00000000..5bec5cba --- /dev/null +++ b/src/main/resources/mcpi/event.py @@ -0,0 +1,65 @@ +from .vec3 import Vec3 + +class BlockEvent: + """An Event related to blocks (e.g. placed, removed, hit)""" + HIT = 0 + + def __init__(self, type, x, y, z, face, entityId): + self.type = type + self.pos = Vec3(x, y, z) + self.face = face + self.entityId = entityId + + def __repr__(self): + sType = { + BlockEvent.HIT: "BlockEvent.HIT" + }.get(self.type, "???") + + return "BlockEvent(%s, %d, %d, %d, %d, %d)"%( + sType,self.pos.x,self.pos.y,self.pos.z,self.face,self.entityId); + + @staticmethod + def Hit(x, y, z, face, entityId): + return BlockEvent(BlockEvent.HIT, x, y, z, face, entityId) + +class ArrowHitEvent: + """An Event related to blocks (e.g. placed, removed, hit)""" + HIT = 0 + + def __init__(self, type, x, y, z, entityId): + self.type = type + self.pos = Vec3(x, y, z) + self.entityId = entityId + + def __repr__(self): + sType = { + ArrowHitEvent.HIT: "ArrowHitEvent.HIT" + }.get(self.type, "???") + + return "BlockEvent(%s, %d, %d, %d, %d)"%( + sType,self.pos.x,self.pos.y,self.pos.z,self.entityId); + + @staticmethod + def Hit(x, y, z, entityId): + return ArrowHitEvent(ArrowHitEvent.HIT, x, y, z, entityId) + +class ChatEvent: + """An Event related to chat (e.g. posts)""" + POST = 0 + + def __init__(self, type, entityId, message): + self.type = type + self.entityId = entityId + self.message = message + + def __repr__(self): + sType = { + ChatEvent.POST: "ChatEvent.POST" + }.get(self.type, "???") + + return "ChatEvent(%s, %d, %s)"%( + sType,self.entityId,self.message); + + @staticmethod + def Post(entityId, message): + return ChatEvent(ChatEvent.POST, entityId, message) \ No newline at end of file diff --git a/src/main/resources/mcpi/minecraft.py b/src/main/resources/mcpi/minecraft.py new file mode 100644 index 00000000..ec92b6b2 --- /dev/null +++ b/src/main/resources/mcpi/minecraft.py @@ -0,0 +1,329 @@ +from .connection import Connection +from .vec3 import Vec3 +from .event import BlockEvent, ChatEvent, ArrowHitEvent +#from .entity import Entity +#from .block import Block +from .util import flatten +from warnings import warn + +""" Minecraft PI low level api v0.1_1 + + Note: many methods have the parameter *arg. This solution makes it + simple to allow different types, and variable number of arguments. + The actual magic is a mix of flatten_parameters() and __iter__. Example: + A Cube class could implement __iter__ to work in Minecraft.setBlocks(c, id). + + (Because of this, it's possible to "erase" arguments. CmdPlayer removes + entityId, by injecting [] that flattens to nothing) + + @author: Aron Nieminen, Mojang AB""" + + +def intFloor(*args): + return [int(x) for x in flatten(args)] + +class CmdPositioner: + """Methods for setting and getting positions""" + def __init__(self, connection, packagePrefix): + self.conn = connection + self.pkg = packagePrefix + + def getPos(self, ID) -> Vec3: + """Get entity position (entityId:int) => Vec3""" + s = self.conn.sendReceive(self.pkg + b".getPos", ID) + return Vec3(*list(map(float, s.split(",")))) + + def setPos(self, ID, x:float, y:float, z:float) -> None: + """Set entity position (entityId:int, x,y,z)""" + self.conn.send(self.pkg + b".setPos", ID, x, y, z) + + def getTilePos(self, ID) -> Vec3: + """Get entity tile position (entityId:int) => Vec3""" + s = self.conn.sendReceive(self.pkg + b".getTile", ID) + return Vec3(*list(map(int, s.split(",")))) + + def setTilePos(self, ID, x:int, y:int, z:int) -> None: + """Set entity tile position (entityId:int) => Vec3""" + self.conn.send(self.pkg + b".setTile", ID, x, y, z) + + def getDirection(self, ID) -> Vec3: + """Get direction of the entity""" + s = self.conn.sendReceive(self.pkg + b".getDirection", id) + return Vec3(*list(s.split(","))) + + def setDirection(self, ID, x:float, y:float, z:float) -> None: + """Set direction of the entity""" + self.conn.send(self.pkg + b".setDirection", ID, x, y, z) + + def getRotation(self, ID) -> float: + """Get rotation if the entity""" + s = self.conn.sendReceive(self.pkg + b".getRotation", ID) + return float(s) + + def setRotation(self, ID, yaw) -> float: + """Set rotation if the entity""" + self.conn.send(self.pkg + b".setRotation", ID, yaw) + + def getPitch(self, ID) -> float: + """Get pitch if the entity""" + s = self.conn.sendReceive(self.pkg + b".getPitch", ID) + return float(s) + + def setPitch(self, ID, pitch) -> None: + """Set pitch if the entity""" + self.conn.send(self.pkg + b".setPitch", ID, pitch) + + def setting(self, setting, status): + """Set a player setting (setting, status). keys: autojump""" + self.conn.send(self.pkg + b".setting", setting, 1 if bool(status) else 0) + + +class CmdEntity(CmdPositioner): + """Methods for entities""" + def __init__(self, connection): + CmdPositioner.__init__(self, connection, b"entity") + + def getName(self, ID): + """Get the list name of the player with entity id => [name:str] + + Also can be used to find name of entity if entity is not a player.""" + return self.conn.sendReceive(b"entity.getName", ID) + + +class CmdPlayer(CmdPositioner): + """Methods for the host (Raspberry Pi) player""" + def __init__(self, connection): + CmdPositioner.__init__(self, connection, b"player") + self.conn = connection + + def getPos(self) -> Vec3: + return CmdPositioner.getPos(self, []) + def setPos(self, x:float, y:float, z:float) -> None: + return CmdPositioner.setPos(self, [], x, y, z) + def getTilePos(self) -> Vec3: + return CmdPositioner.getTilePos(self, []) + def setTilePos(self, x:int, y:int, z:int) -> None: + return CmdPositioner.setTilePos(self, [], x, y, z) + def getDirection(self) -> Vec3: + return CmdPositioner.getDirection(self, []) + def setDirection(self, x:float, y:float, z:float) -> None: + return CmdPositioner.setDirection(self, [], x, y, z) + def getRotation(self) -> float: + return CmdPositioner.getRotation(self, []) + def setRotation(self, yaw) -> None: + return CmdPositioner.setRotation(self, [], yaw) + def getPitch(self) -> float: + return CmdPositioner.getPitch(self, []) + def setPitch(self, pitch) -> None: + return CmdPositioner.setPitch(self, [], pitch) + + def getFoodLevel(self) -> int: + return self.conn.sendReceive(self.pkg + b".getFoodLevel", []) + + def setFoodLevel(self, foodLevel:int) -> None: + self.conn.send(self.pkg + b".setFoodLevel", foodLevel) + + def getHealth(self) -> float: + return self.conn.sendReceive(self.pkg + b".getHealth", []) + + def setHealth(self, health:float) -> None: + self.conn.send(self.pkg + b".setHealth", [], health) + + def sendTitle(self, title:str, subTitle:str="", fadeIn:int=10, stay:int=70, fadeOut:int=20) -> None: + self.conn.send(self.pkg + b".sendTitle", id, title, subTitle, fadeIn, stay, fadeOut) + +class CmdCamera: + def __init__(self, connection): + self.conn = connection + + def setNormal(self, *args) -> None: + """Set camera mode to normal Minecraft view ([entityId])""" + self.conn.send(b"camera.mode.setNormal", args) + + def setFixed(self) -> None: + """Set camera mode to fixed view""" + self.conn.send(b"camera.mode.setFixed") + + def setFollow(self, *args) -> None: + """Set camera mode to follow an entity ([entityId])""" + self.conn.send(b"camera.mode.setFollow", args) + + def setPos(self, x:float, y:float, z:float) -> None: + """Set camera entity position (x,y,z)""" + self.conn.send(b"camera.setPos", x, y, z) + + +class CmdEvents: + """Events""" + def __init__(self, connection): + self.conn = connection + + def clearAll(self): + """Clear all old events""" + self.conn.send(b"events.clear") + + def pollBlockHits(self): + """Only triggered by sword => [BlockEvent]""" + s = self.conn.sendReceive(b"events.block.hits") + events = [e for e in s.split("|") if e] + return [BlockEvent.Hit(*list(map(int, e.split(",")))) for e in events] + + def pollArrowHits(self): + """Only triggered by sword => [BlockEvent]""" + s = self.conn.sendReceive(b"events.arrow.hits") + events = [e for e in s.split("|") if e] + return [ArrowHitEvent.Hit(*list(map(int, e.split(",")))) for e in events] + + def pollChatPosts(self): + """Triggered by posts to chat => [ChatEvent]""" + s = self.conn.sendReceive(b"events.chat.posts") + events = [e for e in s.split("|") if e] + return [ChatEvent.Post(int(e[:e.find(",")]), e[e.find(",") + 1:]) for e in events] + + +class Minecraft: + """The main class to interact with a running instance of Minecraft Pi.""" + def __init__(self, connection): + self.conn = connection + + self.camera = CmdCamera(connection) + self.entity = CmdEntity(connection) + self.player = CmdPlayer(connection) + self.events = CmdEvents(connection) + + def getBlock(self, x:int, y:int, z:int) -> str: + """Get block (x,y,z) => id:int""" + return self.conn.sendReceive(b"world.getBlock", x, y, z) + + def getBlocks(self, x1:int, y1:int, z1:int, x2:int, y2:int, z2:int) -> list: + """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [id:int]""" + blocks = self.conn.sendReceive(b"world.getBlocks", x1, y1, z1, x2, y2, z2) + arr1d = blocks.split(',') + + xSize = abs(x1 - x2) + 1 + ySize = abs(y1 - y2) + 1 + zSize = abs(z1 - z2) + 1 + totalSize = xSize * ySize * zSize + arr3d = [] + + if len(arr1d) != totalSize: + warn('Get number of blocks is incomplete') + + for i in range(0,totalSize,xSize*ySize): + curArr = [] + for j in range(0,xSize*ySize,xSize): + curArr.append(arr1d[i+j:i+j+xSize]) + arr3d.append(curArr) + return arr3d + + def setBlock(self, x:int, y:int, z:int, block:str) -> None: + """Set block (x,y,z,id,[data])""" + self.conn.send(b"world.setBlock", x, y, z, block) + + def setBlocks(self, x1:int, y1:int, z1:int, x2:int, y2:int, z2:int, block) -> None: + """Set a cuboid of blocks (x1,y1,z1,x2,y2,z2,id,[data])""" + self.conn.send(b"world.setBlocks", x1, y1, z1, x2, y2, z2, block) + + def getHeight(self, x:int, z:int) -> int: + """Get the height of the world (x,z) => int""" + return self.conn.sendReceive(b"world.getHeight", x, z) + + def getPlayerEntityIds(self) -> list: + """Get the entity ids of the connected players => [id:int]""" + ids = self.conn.sendReceive(b"world.getPlayerIds") + return list(map(int, ids.split("|"))) + +# def saveCheckpoint(self): +# """Save a checkpoint that can be used for restoring the world""" +# self.conn.send(b"world.checkpoint.save") + +# def restoreCheckpoint(self): +# """Restore the world state to the checkpoint""" +# self.conn.send(b"world.checkpoint.restore") + + def postToChat(self, *msg) -> None: + """Post a message to the game chat""" + self.conn.send(b"chat.post", msg) + + # TODO:修改成一個py檔處理Sign + def setSign(self, x:int, y:int, z:int, signType:str, signDir:int, line1:str="", line2:str="", line3:str="", line4:str="") -> None: + minecraftSignsType = ["SPRUCE_SIGN","ACACIA_SIGN","BIRCH_SIGN","DARK_OAK_SIGN","JUNGLE_SIGN","OAK_SIGN"] + + # ["SPRUCE_WALL_SIGN","ACACIA_WALL_SIGN","BIRCH_WALL_SIGN","DARK_OAK_WALL_SIGN","JUNGLE_WALL_SIGN","OAK_WALL_SIGN"] + minecraftSignsDir = {0:'SOUTH', + 1:'SOUTH_SOUTH_WEST', + 2:'SOUTH_WEST', + 3:'WEST_SOUTH_WEST', + 4:'WEST', + 5:'WEST_NORTH_WEST', + 6:'NORTH_WEST', + 7:'NORTH_NORTH_WEST', + 8:'NORTH', + 9:'NORTH_NORTH_EAST', + 10:'NORTH_EAST', + 11:'EAST_NORTH_EAST', + 12:'EAST', + 13:'EAST_SOUTH_EAST', + 14:'SOUTH_EAST', + 15:'SOUTH_SOUTH_EAST' + } + + if type(signDir) == int: + if 0 <= signDir < 16: + signDir = minecraftSignsDir.get(signDir) + elif type(signDir) == str: + for k,v in minecraftSignsDir.items(): + if signDir == v: + break + else: + signDir = minecraftSignsDir.get(0) + + signType = signType.upper() + if signType not in minecraftSignsType: raise Exception("Sign name error") + self.conn.send(b"world.setSign", x, y, z , signType, signDir, line1 ,line2 ,line3 ,line4) + + def setWallSign(self, x:int, y:int, z:int, signType:str, signDir:int, line1="",line2="",line3="",line4="") -> None: + minecraftSignsType = ["SPRUCE_WALL_SIGN","ACACIA_WALL_SIGN","BIRCH_WALL_SIGN","DARK_OAK_WALL_SIGN","JUNGLE_WALL_SIGN","OAK_WALL_SIGN"] + + minecraftSignsDir = {0:'SOUTH', + 1:'WEST', + 2:'NORTH', + 3:'EAST'} + + if type(signDir) == int: + if 0 <= signDir < 4: + signDir = minecraftSignsDir.get(signDir) + elif type(signDir) == str: + for k,v in minecraftSignsDir.items(): + if signDir == v: + break + else: + signDir = minecraftSignsDir.get(0) + + signType = signType.upper() + if signType not in minecraftSignsType: raise Exception("Sign name error") + self.conn.send(b"world.setWallSign", x, y, z , signType, signDir, line1 ,line2 ,line3 ,line4) + + def spawnEntity(self, x:int, y:int, z:int, entityID:int) -> int: + """Spawn entity (x,y,z,id,[data])""" + return int(self.conn.sendReceive(b"world.spawnEntity", x, y, z, entityID)) + + def createExplosion(self, x:int, y:int, z:int, power:int=4) -> None: + self.conn.send(b"world.createExplosion", x, y, z, power) + + def getPlayerEntityId(self, name:str) -> int: + """Get the entity id of the named player => [id:int]""" + return int(self.conn.sendReceive(b"world.getPlayerId", name)) + + def setting(self, setting, status): + """Set a world setting (setting, status). keys: world_immutable, nametags_visible""" + self.conn.send(b"world.setting", setting, 1 if bool(status) else 0) + + @staticmethod + def create(address = "localhost", port = 4711): + return Minecraft(Connection(address, port)) + + +if __name__ == "__main__": + mc = Minecraft.create() + mc.postToChat("Hello, Minecraft!") diff --git a/src/main/resources/mcpi/api/python/original/mcpi/util.py b/src/main/resources/mcpi/util.py similarity index 76% rename from src/main/resources/mcpi/api/python/original/mcpi/util.py rename to src/main/resources/mcpi/util.py index 9791072e..c3ef4412 100644 --- a/src/main/resources/mcpi/api/python/original/mcpi/util.py +++ b/src/main/resources/mcpi/util.py @@ -11,8 +11,8 @@ def flatten_parameters_to_bytestring(l): def _misc_to_bytes(m): """ - Convert an arbitrary object into a string encoded as a CP437 series of bytes. + Convert an arbitrary object into a string encoded as a UTF8 series of bytes. See `Connection.send` for more details. """ - return str(m).encode("cp437") + return str(m).encode("utf8") diff --git a/src/main/resources/mcpi/api/python/original/mcpi/vec3.py b/src/main/resources/mcpi/vec3.py similarity index 100% rename from src/main/resources/mcpi/api/python/original/mcpi/vec3.py rename to src/main/resources/mcpi/vec3.py diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4271bc56..533d6295 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,8 @@ -author: Zhuowei +author: [Zhuowei,MinecraftDawn] database: false description: Implementation of the Minecraft PI modding API main: net.zhuoweizhang.raspberryjuice.RaspberryJuicePlugin name: RaspberryJuice startup: postworld -version: '1.11' +version: '1.14-0.6' +api-version: 1.13 \ No newline at end of file diff --git a/src/test/java/net/zhuoweizhang/raspberryjuice/SessionStepDefs.java b/src/test/java/net/zhuoweizhang/raspberryjuice/SessionStepDefs.java deleted file mode 100644 index 9b66940e..00000000 --- a/src/test/java/net/zhuoweizhang/raspberryjuice/SessionStepDefs.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.zhuoweizhang.raspberryjuice; - -import cucumber.api.java.en.And; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import mockit.Mock; -import mockit.MockUp; -import mockit.Mocked; -import org.bukkit.Location; -import org.bukkit.World; -//import org.bukkit.craftbukkit.v1_9_R1.CraftWorld; -import org.testng.Assert; - -import java.net.Socket; - -public class SessionStepDefs { - - @Mocked - private World world; - - private RemoteSession remoteSession; - private LocationType locationType; - private Location requestedPosition; - private String locationAsString; - private Location location; - - - @Given("^The location type (.*)$") - public void theLocationType(String type) throws Throwable { - locationType = LocationType.valueOf(type); - - RaspberryJuicePlugin plugin = new MockUp() { - @Mock - public LocationType getLocationType() { - return locationType; - } - }.getMockInstance(); - - Socket socket = new MockUp() { - }.getMockInstance(); - - new MockUp() { - @Mock - public void init() { - //Avoid the real init as it errors out and we don't need it for our tests - } - }; - - remoteSession = new RemoteSession(plugin, socket); - } - - @And("^a spawn point of (.*), (.*), (.*)$") - public void aSpawnPointOf(double x, double y, double z) throws Throwable { - Location origin = new Location(world, x, y, z); - remoteSession.setOrigin(origin); - } - - @And("^a location point of (\\d+), (\\d+), (-?\\d+)$") - public void aLocationPointOf(int x, int y, int z) throws Throwable { - requestedPosition = new Location(world, x, y, z); - } - - @When("^a request for a relative location is made$") - public void aRequestForARelativeLocationIsMade() throws Throwable { - locationAsString = remoteSession.locationToRelative(requestedPosition); - } - - @Then("^the relative location should have co-ordinates (.*), (.*), (.*)$") - public void theRelativeLocationShouldHaveCoOrdinates(String x, String y, String z) throws Throwable { - String[] split = locationAsString.split(","); - Assert.assertEquals(split[0], x); - Assert.assertEquals(split[1], y); - Assert.assertEquals(split[2], z); - } - - @When("^a request for a relative block location is made at (.*), (.*), (.*)$") - public void aRequestForARelativeBlockLocationIsMade(String x, String y, String z) throws Throwable { - location = remoteSession.parseRelativeBlockLocation(x, y, z); - } - - @Then("^the block location should have co-ordinates (.*), (.*), (.*)$") - public void theBlockLocationShouldHaveCoOrdinates(int x, int y, int z) throws Throwable { - Assert.assertEquals(location.getBlockX(), x); - Assert.assertEquals(location.getBlockY(), y); - Assert.assertEquals(location.getBlockZ(), z); - } - - @When("^a request for a relative location is made at (.*), (.*), (.*)$") - public void aRequestForARelativeLocationIsMade(String x, String y, String z) throws Throwable { - location = remoteSession.parseRelativeLocation(x, y, z); - } - - @Then("^the location should have co-ordinates (.*), (.*), (.*)$") - public void theLocationShouldHaveCoOrdinates(double x, double y, double z) throws Throwable { - Assert.assertEquals(location.getX(), x); - Assert.assertEquals(location.getY(), y); - Assert.assertEquals(location.getZ(), z); - } -} diff --git a/src/test/resources/net/zhuoweizhang/raspberryjuice/remotesession.feature b/src/test/resources/net/zhuoweizhang/raspberryjuice/remotesession.feature deleted file mode 100644 index f988cf93..00000000 --- a/src/test/resources/net/zhuoweizhang/raspberryjuice/remotesession.feature +++ /dev/null @@ -1,44 +0,0 @@ -Feature: Calculate the relative locations as different config options and pi/bukkit can provide different locations - - Scenario Outline: Test the locationToRelative function - - Given The location type - And a spawn point of , , - And a location point of 20, 3, -5 - When a request for a relative location is made - Then the relative location should have co-ordinates , , - - Examples: - | LocationType | SpawnX | SpawnY | SpawnZ | LocationX | LocationY | LocationZ | - | RELATIVE | 0 | 0 | 0 | 20.0 | 3.0 | -5.0 | - | RELATIVE | -100 | 50 | 100 | 120.0 | -47.0 | -105.0 | - | ABSOLUTE | 0 | 0 | 0 | 20.0 | 3.0 | -5.0 | - | ABSOLUTE | -100 | 50 | 100 | 20.0 | 3.0 | -5.0 | - - Scenario Outline: Determine the location of co-ordinates relative to a block - - Given The location type - And a spawn point of , , - When a request for a relative block location is made at 32, 69, -100 - Then the block location should have co-ordinates , , - - Examples: - | LocationType | SpawnX | SpawnY | SpawnZ | LocationX | LocationY | LocationZ | - | RELATIVE | 0 | 0 | 0 | 32 | 69 | -100 | - | RELATIVE | -100 | 50 | 100 | -68 | 119 | 0 | - | ABSOLUTE | 0 | 0 | 0 | 32 | 69 | -100 | - | ABSOLUTE | -100 | 50 | 100 | 32 | 69 | -100 | - - Scenario Outline: Determine the location of co-ordinates - - Given The location type - And a spawn point of , , - When a request for a relative location is made at 32, 69, -100 - Then the location should have co-ordinates , , - - Examples: - | LocationType | SpawnX | SpawnY | SpawnZ | LocationX | LocationY | LocationZ | - | RELATIVE | 0 | 0 | 0 | 32 | 69 | -100 | - | RELATIVE | -100 | 50 | 100 | -68 | 119 | 0 | - | ABSOLUTE | 0 | 0 | 0 | 32 | 69 | -100 | - | ABSOLUTE | -100 | 50 | 100 | 32 | 69 | -100 |