RaspberryJuice

插件

· 作者 _ForgeUser7056572

RaspberryJuice

0 本站下载 0 关注 更新于 9 年前

最新 RaspberryJuice v1.11 · 1.12

一键开服(送7天)

想在拥有完整功能版的 Minecraft 中尝试使用 Minecraft Pi API 进行编程吗?RaspberryJuice 为 Bukkit 服务器实现了 Minecraft Pi 模组开发 API。

该插件监听端口 4711,并支持大多数 Minecraft Pi 命令,这些命令的文档详见 。

该插件支持 Pi 版本附带的大多数 API 功能,大部分示例代码均可正常运行。

Minecraft Forums 讨论帖

目前已实现的命令:
world.getBlock
world.getBlockWithData
world.setBlock
world.setBlocks
world.getPlayerIds
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

额外功能(^):

已实现 getBlocks(x1,y1,z1,x2,y2,z2)
getDirection、getRotation、getPitch 函数 —— 获取玩家和实体所朝向的方向
getPlayerId(playerName) —— 通过名称获取玩家的实体信息
pollChatPosts() —— 获取发送到聊天栏的事件反馈
 

配置(位于 config.yml):
- port: 4711 - 默认 TCP 端口可在 config.yml 中修改
- location: RELATIVE - 确定位置是相对于出生点(默认行为,与 Pi 版一致)还是绝对坐标(ABSOLUTE)

-  hitclick: RIGHT - 确定命中事件是由左键点击、右键点击还是两者同时触发

^ 要使用额外功能,需要使用由 Mojang 随 Pi 版提供的原始 Java 和 Python 库的修改版,https:github.com/zhuowei/RaspberryJuice/tree/master/src/main/resources/mcpi。你只需在需要使用额外功能时才需要这些修改版的库;原始库仍然可以正常工作,只是无法使用额外功能。

示例:

此 Python 脚本会在出生点附近建造一道彩虹。将此示例放入 Minecraft Pi 预发布版的 api/python 目录中,在同一台计算机上启动服务器,然后运行 python name.py(将 name.py 替换为脚本的实际文件名)即可运行。

import mcpi.minecraft as minecraft
import mcpi.block as block
from math import *

colors = [14, 1, 4, 5, 3, 11, 10]

mc = minecraft.Minecraft.create() height = 60

mc.setBlocks(-64,0,0,64,height + len(colors),0,0) for x in range(0, 128): for colourindex in range(0, len(colors)): y = sin((x / 128.0) pi) height + colourindex mc.setBlock(x - 64, y, 0, block.WOOL.id, colors[len(colors) - 1 - colourindex])

结果:

更多示例请参阅 http:www.stuffaboutcode.com/p/minecraft.html

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源