Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Version 1.14 #84

Open
wants to merge 83 commits into
base: 1_14_4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
2e83b27
init(1.12.2)
MinecraftDawn Jul 11, 2019
cec5f99
1.14
MinecraftDawn Jul 13, 2019
da40e1b
可以使用setblock(但須處理打錯字問題)
MinecraftDawn Jul 14, 2019
50d9198
可以使用setblock(需處理錯字問題,大小寫已解決)
MinecraftDawn Jul 14, 2019
d32f21a
設置Python的功能
MinecraftDawn Jul 15, 2019
af58017
新增getRotation、setRotation
MinecraftDawn Jul 17, 2019
1240cce
pyhon (getPitch、setPitch)
MinecraftDawn Jul 18, 2019
dc8186d
setSign (尚未完成)
MinecraftDawn Jul 20, 2019
7111e7d
setSign (尚未完成)
MinecraftDawn Jul 21, 2019
4af8b9f
將mcpi(modded)的檔案整合至mcpi(origin)
MinecraftDawn Jul 25, 2019
bb4133f
將mcpi(modded)的檔案整合至mcpi(origin)
MinecraftDawn Jul 25, 2019
d571b4d
修改getBlock、getBlocks的回傳型態,由int轉為string
MinecraftDawn Jul 25, 2019
22a4fe9
修改PostToChat及Minecraft.py方法參數,並加入型態
MinecraftDawn Jul 26, 2019
1c3c466
嘗試能讓告示牌方向轉變(尚未完成)
MinecraftDawn Jul 28, 2019
2d40003
可以生成多種告示牌(方向尚未設定完整)
MinecraftDawn Jul 29, 2019
4e7cbbb
可以生成多種告示牌(方向尚未設定完整)
MinecraftDawn Jul 29, 2019
25d8f46
可以生成多種告示牌(方向已設定完成)
MinecraftDawn Jul 30, 2019
4ebbf7d
可以生成多種告示牌(方向尚未設定完整)
MinecraftDawn Jul 30, 2019
122f5a8
可以生成多種告示牌(方向尚未設定完整)
MinecraftDawn Jul 30, 2019
7735183
可以設置貼在牆上的告示牌
MinecraftDawn Jul 31, 2019
a12eb88
可設置貼在牆上的告示牌
MinecraftDawn Jul 31, 2019
06b7c25
out
MinecraftDawn Jul 31, 2019
2122d0b
修改plugin.yml版本
MinecraftDawn Jul 31, 2019
5c2e5ee
createExplosion
MinecraftDawn Aug 1, 2019
5cf7636
Update README.md
MinecraftDawn Aug 3, 2019
af7133b
修改README.MD指令略覽部分
MinecraftDawn Aug 5, 2019
5c59017
更改插件為Maven架構
MinecraftDawn Aug 7, 2019
c255633
移除out資料夾
MinecraftDawn Aug 7, 2019
5b79f7a
sendTitle
MinecraftDawn Aug 7, 2019
df32291
README.MD新增sendTitle
MinecraftDawn Aug 7, 2019
2caacc7
新增函式參數DataType
MinecraftDawn Aug 9, 2019
5110ff9
修改Java RemoteSession.java架構
MinecraftDawn Aug 10, 2019
eaae959
Update README.md
MinecraftDawn Aug 10, 2019
969d27c
新增錯誤訊息
MinecraftDawn Aug 10, 2019
a890c3d
Merge remote-tracking branch 'origin/master'
MinecraftDawn Aug 10, 2019
94f1d01
將RemoteSession的world相關功能移動至CmdWorld
MinecraftDawn Aug 11, 2019
153b4b2
移除getBlockWithData功能(1.13後沒有Data)
MinecraftDawn Aug 11, 2019
d6b01fd
將setBlock/setBlocks的Data移除
MinecraftDawn Aug 11, 2019
8ef701e
修改註解
MinecraftDawn Aug 11, 2019
08cc470
修改README.md 添加Method用法
MinecraftDawn Aug 12, 2019
38bd68d
修改README.md方法須加入的參數
MinecraftDawn Aug 13, 2019
7ac496a
將方法加入回傳值
MinecraftDawn Aug 13, 2019
499758b
增加方法說明
MinecraftDawn Aug 15, 2019
e92b4c4
增加方法說明
MinecraftDawn Aug 16, 2019
a53c23f
增加方法說明
MinecraftDawn Aug 17, 2019
0fd446c
增加方法說明
MinecraftDawn Aug 17, 2019
6520779
修改版本號1.14-04
MinecraftDawn Aug 17, 2019
e2ec81d
Edit file path
MinecraftDawn Aug 21, 2019
dd26ee8
git ignore
MinecraftDawn Aug 23, 2019
408cffd
add out file
MinecraftDawn Aug 23, 2019
d5d2f01
Edit README.md
MinecraftDawn Aug 25, 2019
10667c7
Modify I/O stream encoding to utf8
MinecraftDawn Aug 25, 2019
d369efb
Modify I/O stream encoding to utf8
MinecraftDawn Aug 25, 2019
e956588
Edit except message language from chinese to english
MinecraftDawn Aug 26, 2019
63312a4
add fail message
MinecraftDawn Aug 28, 2019
104c028
use CmdWorld.java process command of world
MinecraftDawn Aug 31, 2019
1685f85
add cmdEntity,cmdEvent,cmdPlayer,cmdWorld Object in remoteSesstion's …
MinecraftDawn Sep 5, 2019
c0294c2
add example py file
MinecraftDawn Sep 6, 2019
cc01ba6
example - explosion
MinecraftDawn Sep 7, 2019
2ca0a13
Modify return datatype of getBlocks
MinecraftDawn Sep 8, 2019
8083c3e
Remove unuse variable
MinecraftDawn Sep 9, 2019
c537f74
fix bug of entity.getName
MinecraftDawn Sep 9, 2019
ba4e474
add player.getFoodLevel method
MinecraftDawn Sep 9, 2019
21aca86
Add player.setFoodLevel
MinecraftDawn Sep 10, 2019
c17ec05
remove test code
MinecraftDawn Sep 10, 2019
e8ade86
edit language of sign name error message
MinecraftDawn Sep 11, 2019
e3bc106
Add player.getHealth method
MinecraftDawn Sep 11, 2019
c854fd9
Add player.setHealth method
MinecraftDawn Sep 12, 2019
c4edd3c
Midify READMD.md method
MinecraftDawn Sep 13, 2019
173e910
Modify version to 1.14-07
MinecraftDawn Sep 14, 2019
2f9d6ef
Modify comment from chinese to english
MinecraftDawn Sep 17, 2019
86fdcf2
add comment of command
MinecraftDawn Sep 24, 2019
b2c0911
remove Conversion
MinecraftDawn Sep 24, 2019
878940a
Rebuild project and javadoc
MinecraftDawn Sep 25, 2019
a2f1760
Add chickenFly.py example
MinecraftDawn Sep 30, 2019
f82ca14
Add SwordExplode.py example and modify config.yml, hitclick from RIGH…
MinecraftDawn Oct 1, 2019
cbf2af5
Add setSignOnPlayer.py example
MinecraftDawn Oct 2, 2019
1f6c5b3
Add randomTeleport.py example
MinecraftDawn Oct 8, 2019
15c657e
add arrow hit event
MinecraftDawn Mar 10, 2021
9bfb57a
add arrow hit event
MinecraftDawn Mar 10, 2021
2277d9d
change encoding to utf8
MinecraftDawn Jul 27, 2021
534ff55
fix arrow shot not block error
MinecraftDawn Oct 6, 2021
aabaf72
fix mistake queue error
MinecraftDawn Jan 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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*
Expand Down Expand Up @@ -28,7 +27,7 @@ hs_err_pid*
*.iws

# IntelliJ
/out/
#/out/

# JIRA plugin
atlassian-ide-plugin.xml
Expand Down Expand Up @@ -56,6 +55,9 @@ tmp/

# Editor detritus
*.vim
*.swp
#*.swp
tags
.vscode
.vscode
.idea/encodings.xml
.idea/modules.xml
#target/
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

8 changes: 8 additions & 0 deletions .idea/artifacts/RaspberryJuice_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions .idea/codeStyleSettings.xml

This file was deleted.

4 changes: 2 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

205 changes: 163 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -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':
Expand All @@ -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
Expand Down
Binary file removed jars/raspberryjuice-1.1.1.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.1.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.10.1.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.10.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.11.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.2.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.3.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.4.1.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.4.2.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.4.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.5.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.6.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.7.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.8.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.9.1.jar
Binary file not shown.
Binary file removed jars/raspberryjuice-1.9.jar
Binary file not shown.
21 changes: 21 additions & 0 deletions out/example/ChickenFly.py
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions out/example/SwordExplode.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions out/example/example1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from mcpi.minecraft import Minecraft
mc = Minecraft.create()

x,y,z = mc.player.getTilePos()

mc.createExplosion(x,y,z)
12 changes: 12 additions & 0 deletions out/example/randomTeleport.py
Original file line number Diff line number Diff line change
@@ -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)
Loading