diff --git a/README.md b/README.md
index 4737db3f..15c680f9 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,6 @@ A Bukkit plugin which implements the Minecraft Pi Socket API.
### Commands supported
- world.get/setBlock
- - world.getBlockWithData
- world.setBlocks
- world.getPlayerIds
- world.getBlocks
@@ -35,9 +34,8 @@ A Bukkit plugin which implements the Minecraft Pi Socket API.
- 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
+ - setSign(x,y,z,material,facing,line1,line2,line3,line4)
+ - Facing direction can be NORTH, SOUTH, EAST, WEST...
- 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)
diff --git a/pom.xml b/pom.xml
index fe1282ed..525c190e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
org.bukkit
bukkit
- 1.12.2-R0.1-SNAPSHOT
+ 1.14.4-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java b/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java
index 4b855bdb..5e7dd7b7 100644
--- a/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java
+++ b/src/main/java/net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin.java
@@ -18,10 +18,10 @@ public class RaspberryJuicePlugin extends JavaPlugin implements Listener {
public static final Set blockBreakDetectionTools = EnumSet.of(
Material.DIAMOND_SWORD,
- Material.GOLD_SWORD,
+ Material.GOLDEN_SWORD,
Material.IRON_SWORD,
Material.STONE_SWORD,
- Material.WOOD_SWORD);
+ Material.WOODEN_SWORD);
public ServerListenerThread serverThread;
diff --git a/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java b/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java
index 5c0acbbe..d4689810 100644
--- a/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java
+++ b/src/main/java/net/zhuoweizhang/raspberryjuice/RemoteSession.java
@@ -7,6 +7,7 @@
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.block.*;
+import org.bukkit.block.data.Rotatable;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.util.Vector;
@@ -146,7 +147,7 @@ protected void handleCommand(String c, String[] args) {
// world.getBlock
if (c.equals("world.getBlock")) {
Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]);
- send(world.getBlockTypeIdAt(loc));
+ send(world.getBlockAt(loc).getType().name());
// world.getBlocks
} else if (c.equals("world.getBlocks")) {
@@ -154,23 +155,19 @@ protected void handleCommand(String c, String[] args) {
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));
+ System.out.println("args are " + args[0] + ", " + args[1] + ", " + args[2]);
+ System.out.println("relative location is " + loc.toString());
+ updateBlock(world, loc, args[3]);
// 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);
+ String blockType = args[6];
+ setCuboid(loc1, loc2, blockType);
// world.getPlayerIds
} else if (c.equals("world.getPlayerIds")) {
@@ -473,15 +470,15 @@ protected void handleCommand(String c, String[] args) {
} 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);
- }
+ String blockType = args[3];
+ String facingDirection = args[4];
+
+ updateBlock(thisBlock, blockType);
//plugin.getLogger().info("Creating sign at " + loc);
+ if ( thisBlock.getBlockData() instanceof Rotatable) {
+ Rotatable rotatable = (Rotatable) thisBlock.getBlockData();
+ rotatable.setRotation(BlockFace.valueOf(facingDirection));
+ }
if ( thisBlock.getState() instanceof Sign ) {
Sign sign = (Sign) thisBlock.getState();
for ( int i = 5; i-5 < 4 && i < args.length; i++) {
@@ -493,17 +490,15 @@ protected void handleCommand(String c, String[] args) {
// 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])));
+ Entity entity = world.spawnEntity(loc, EntityType.valueOf(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());
+ if ( entityType.isSpawnable() && !entityType.name().isEmpty() ) {
+ bdr.append(entityType.name());
bdr.append("|");
}
}
@@ -524,7 +519,7 @@ protected void handleCommand(String c, String[] args) {
}
// create a cuboid of lots of blocks
- private void setCuboid(Location pos1, Location pos2, int blockType, byte data) {
+ 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();
@@ -537,7 +532,7 @@ private void setCuboid(Location pos1, Location pos2, int blockType, byte data) {
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);
+ updateBlock(world, x, y, z, blockType);
}
}
}
@@ -559,7 +554,7 @@ private String getBlocks(Location pos1, Location pos2) {
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() + ",");
+ blockData.append(world.getBlockAt(x, y, z).getType().name() + ",");
}
}
}
@@ -568,20 +563,20 @@ private String getBlocks(Location pos1, Location pos2) {
}
// updates a block
- private void updateBlock(World world, Location loc, int blockType, byte blockData) {
+ private void updateBlock(World world, Location loc, String blockType) {
Block thisBlock = world.getBlockAt(loc);
- updateBlock(thisBlock, blockType, blockData);
+ updateBlock(thisBlock, blockType);
}
- private void updateBlock(World world, int x, int y, int z, int blockType, byte blockData) {
+ private void updateBlock(World world, int x, int y, int z, String blockType) {
Block thisBlock = world.getBlockAt(x,y,z);
- updateBlock(thisBlock, blockType, blockData);
+ updateBlock(thisBlock, blockType);
}
- private void updateBlock(Block thisBlock, int blockType, byte blockData) {
+ private void updateBlock(Block thisBlock, String blockType) {
// check to see if the block is different - otherwise leave it
- if ((thisBlock.getTypeId() != blockType) || (thisBlock.getData() != blockData)) {
- thisBlock.setTypeIdAndData(blockType, blockData, true);
+ if ((thisBlock.getType().name() != blockType)) {
+ thisBlock.setType(Material.valueOf(blockType), true);
}
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 46a97e03..40eb573e 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: BOTH
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
index 07083745..e17141cd 100644
--- a/src/main/resources/mcpi/api/java/src-api/pi/Block.java
+++ b/src/main/resources/mcpi/api/java/src-api/pi/Block.java
@@ -7,41 +7,26 @@
*/
public class Block {
- final int id, data;
+ final int id;
- Block(int id, int data) {
+ Block(int id) {
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);
+ return new Block(id);
}
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;
+ return (id << 8);
}
@Override
@@ -54,15 +39,9 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return id + (data == 0 ? "" : "," + data);
+ return id;
}
- /**
- * 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),
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
index dd2330eb..82b3ea7f 100644
--- a/src/main/resources/mcpi/api/java/src-api/pi/Color.java
+++ b/src/main/resources/mcpi/api/java/src-api/pi/Color.java
@@ -12,8 +12,4 @@ public enum Color {
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/Minecraft.java b/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java
index c9c2ef84..9786f4ff 100644
--- a/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java
+++ b/src/main/resources/mcpi/api/java/src-api/pi/Minecraft.java
@@ -69,14 +69,6 @@ public Block getBlock(Vec position) {
return Block.decode(receive());
}
- /**
- * Get a block
- */
- public Block getBlockWithData(Vec position) {
- send("world.getBlock", position);
- return Block.decodeWithData(receive());
- }
-
/**
* Set a block
*/
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
index 6be42ad8..9ee56155 100644
--- 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
@@ -31,7 +31,7 @@ static void drawChristmasTree(Minecraft mc, Vec p) {
// 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));
+ drawDisc(mc, p.add(0, h, 0), tree[tree.length - i - 1], Block.LEAVES);
h++;
}
diff --git a/src/main/resources/mcpi/api/python/modded/mcpi/block.py b/src/main/resources/mcpi/api/python/modded/mcpi/block.py
deleted file mode 100644
index b64bc6c1..00000000
--- a/src/main/resources/mcpi/api/python/modded/mcpi/block.py
+++ /dev/null
@@ -1,133 +0,0 @@
-class Block:
- """Minecraft PI block description. Can be sent to Minecraft.setBlock/s"""
- def __init__(self, id, data=0):
- self.id = id
- self.data = data
-
- def __cmp__(self, rhs):
- return hash(self) - hash(rhs)
-
- def __eq__(self, rhs):
- return self.id == rhs.id and self.data == rhs.data
-
- def __hash__(self):
- return (self.id << 8) + self.data
-
- def withData(self, data):
- return Block(self.id, data)
-
- def __iter__(self):
- """Allows a Block to be sent whenever id [and data] is needed"""
- return iter((self.id, self.data))
-
- def __repr__(self):
- return "Block(%d, %d)"%(self.id, self.data)
-
-AIR = Block(0)
-STONE = Block(1)
-GRASS = Block(2)
-DIRT = Block(3)
-COBBLESTONE = Block(4)
-WOOD_PLANKS = Block(5)
-SAPLING = Block(6)
-BEDROCK = Block(7)
-WATER_FLOWING = Block(8)
-WATER = WATER_FLOWING
-WATER_STATIONARY = Block(9)
-LAVA_FLOWING = Block(10)
-LAVA = LAVA_FLOWING
-LAVA_STATIONARY = Block(11)
-SAND = Block(12)
-GRAVEL = Block(13)
-GOLD_ORE = Block(14)
-IRON_ORE = Block(15)
-COAL_ORE = Block(16)
-WOOD = Block(17)
-LEAVES = Block(18)
-GLASS = Block(20)
-LAPIS_LAZULI_ORE = Block(21)
-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)
-MUSHROOM_BROWN = Block(39)
-MUSHROOM_RED = Block(40)
-GOLD_BLOCK = Block(41)
-IRON_BLOCK = Block(42)
-STONE_SLAB_DOUBLE = Block(43)
-STONE_SLAB = Block(44)
-BRICK_BLOCK = Block(45)
-TNT = Block(46)
-BOOKSHELF = Block(47)
-MOSS_STONE = Block(48)
-OBSIDIAN = Block(49)
-TORCH = Block(50)
-FIRE = Block(51)
-STAIRS_WOOD = Block(53)
-CHEST = Block(54)
-DIAMOND_ORE = Block(56)
-DIAMOND_BLOCK = Block(57)
-CRAFTING_TABLE = Block(58)
-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)
-CACTUS = Block(81)
-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/modded/mcpi/entity.py b/src/main/resources/mcpi/api/python/modded/mcpi/entity.py
deleted file mode 100644
index b78a4850..00000000
--- a/src/main/resources/mcpi/api/python/modded/mcpi/entity.py
+++ /dev/null
@@ -1,102 +0,0 @@
-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/api/python/modded/mcpi/minecraft.py b/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py
index bffb491d..bf02b82e 100644
--- a/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py
+++ b/src/main/resources/mcpi/api/python/modded/mcpi/minecraft.py
@@ -1,8 +1,6 @@
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
@@ -28,9 +26,6 @@
- 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):
@@ -53,7 +48,7 @@ def getTilePos(self, id):
def setTilePos(self, id, *args):
"""Set entity tile position (entityId:int) => Vec3"""
- self.conn.send(self.pkg + b".setTile", id, intFloor(*args))
+ self.conn.send(self.pkg + b".setTile", id, args)
def setDirection(self, id, *args):
"""Set entity direction (entityId:int, x,y,z)"""
@@ -176,32 +171,24 @@ def __init__(self, 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(","))))
+ """Get block (x,y,z) => material:string"""
+ return self.conn.sendReceive(b"world.getBlock", args)
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))
+ """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [material:string]"""
+ s = self.conn.sendReceive(b"world.getBlocks", 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))
+ self.conn.send(b"world.setBlock", 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))
+ self.conn.send(b"world.setBlocks", 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
+ """Set a sign (x,y,z,material,facing,[line1,line2,line3,line4])
@author: Tim Cummings https://www.triptera.com.au/wordpress/"""
lines = []
flatargs = []
@@ -209,15 +196,15 @@ def setSign(self, *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)
+ self.conn.send(b"world.setSign",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)))
+ return int(self.conn.sendReceive(b"world.spawnEntity", args))
def getHeight(self, *args):
"""Get the height of the world (x,z) => int"""
- return int(self.conn.sendReceive(b"world.getHeight", intFloor(args)))
+ return int(self.conn.sendReceive(b"world.getHeight", args))
def getPlayerEntityIds(self):
"""Get the entity ids of the connected players => [id:int]"""
diff --git a/src/main/resources/mcpi/api/python/original/mcpi/block.py b/src/main/resources/mcpi/api/python/original/mcpi/block.py
deleted file mode 100644
index 52c85023..00000000
--- a/src/main/resources/mcpi/api/python/original/mcpi/block.py
+++ /dev/null
@@ -1,97 +0,0 @@
-class Block:
- """Minecraft PI block description. Can be sent to Minecraft.setBlock/s"""
- def __init__(self, id, data=0):
- self.id = id
- self.data = data
-
- def __cmp__(self, rhs):
- return hash(self) - hash(rhs)
-
- def __eq__(self, rhs):
- return self.id == rhs.id and self.data == rhs.data
-
- def __hash__(self):
- return (self.id << 8) + self.data
-
- def withData(self, data):
- return Block(self.id, data)
-
- def __iter__(self):
- """Allows a Block to be sent whenever id [and data] is needed"""
- return iter((self.id, self.data))
-
- def __repr__(self):
- return "Block(%d, %d)"%(self.id, self.data)
-
-AIR = Block(0)
-STONE = Block(1)
-GRASS = Block(2)
-DIRT = Block(3)
-COBBLESTONE = Block(4)
-WOOD_PLANKS = Block(5)
-SAPLING = Block(6)
-BEDROCK = Block(7)
-WATER_FLOWING = Block(8)
-WATER = WATER_FLOWING
-WATER_STATIONARY = Block(9)
-LAVA_FLOWING = Block(10)
-LAVA = LAVA_FLOWING
-LAVA_STATIONARY = Block(11)
-SAND = Block(12)
-GRAVEL = Block(13)
-GOLD_ORE = Block(14)
-IRON_ORE = Block(15)
-COAL_ORE = Block(16)
-WOOD = Block(17)
-LEAVES = Block(18)
-GLASS = Block(20)
-LAPIS_LAZULI_ORE = Block(21)
-LAPIS_LAZULI_BLOCK = Block(22)
-SANDSTONE = Block(24)
-BED = Block(26)
-COBWEB = Block(30)
-GRASS_TALL = Block(31)
-WOOL = Block(35)
-FLOWER_YELLOW = Block(37)
-FLOWER_CYAN = Block(38)
-MUSHROOM_BROWN = Block(39)
-MUSHROOM_RED = Block(40)
-GOLD_BLOCK = Block(41)
-IRON_BLOCK = Block(42)
-STONE_SLAB_DOUBLE = Block(43)
-STONE_SLAB = Block(44)
-BRICK_BLOCK = Block(45)
-TNT = Block(46)
-BOOKSHELF = Block(47)
-MOSS_STONE = Block(48)
-OBSIDIAN = Block(49)
-TORCH = Block(50)
-FIRE = Block(51)
-STAIRS_WOOD = Block(53)
-CHEST = Block(54)
-DIAMOND_ORE = Block(56)
-DIAMOND_BLOCK = Block(57)
-CRAFTING_TABLE = Block(58)
-FARMLAND = Block(60)
-FURNACE_INACTIVE = Block(61)
-FURNACE_ACTIVE = Block(62)
-DOOR_WOOD = Block(64)
-LADDER = Block(65)
-STAIRS_COBBLESTONE = Block(67)
-DOOR_IRON = Block(71)
-REDSTONE_ORE = Block(73)
-SNOW = Block(78)
-ICE = Block(79)
-SNOW_BLOCK = Block(80)
-CACTUS = Block(81)
-CLAY = Block(82)
-SUGAR_CANE = Block(83)
-FENCE = Block(85)
-GLOWSTONE_BLOCK = Block(89)
-BEDROCK_INVISIBLE = Block(95)
-STONE_BRICK = Block(98)
-GLASS_PANE = Block(102)
-MELON = Block(103)
-FENCE_GATE = Block(107)
-GLOWING_OBSIDIAN = Block(246)
-NETHER_REACTOR_CORE = Block(247)
diff --git a/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py b/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py
index 1d1f293d..ff5b4c4d 100644
--- a/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py
+++ b/src/main/resources/mcpi/api/python/original/mcpi/minecraft.py
@@ -1,7 +1,6 @@
from .connection import Connection
from .vec3 import Vec3
from .event import BlockEvent
-from .block import Block
import math
from .util import flatten
@@ -18,9 +17,6 @@
@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):
@@ -43,7 +39,7 @@ def getTilePos(self, id):
def setTilePos(self, id, *args):
"""Set entity tile position (entityId:int) => Vec3"""
- self.conn.send(self.pkg + b".setTile", id, intFloor(*args))
+ self.conn.send(self.pkg + b".setTile", id, args)
def setting(self, setting, status):
"""Set a player setting (setting, status). keys: autojump"""
@@ -119,31 +115,27 @@ def __init__(self, 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)))
+ """Get block (x,y,z) => material:string"""
+ return self.conn.sendReceive(b"world.getBlock", 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)))
+ """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [material:string]"""
+ return self.conn.sendReceive(b"world.getBlocks", args)
def setBlock(self, *args):
"""Set block (x,y,z,id,[data])"""
- self.conn.send(b"world.setBlock", intFloor(args))
+ self.conn.send(b"world.setBlock", 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))
+ self.conn.send(b"world.setBlocks", args)
def getHeight(self, *args):
"""Get the height of the world (x,z) => int"""
- return int(self.conn.sendReceive(b"world.getHeight", intFloor(args)))
+ return int(self.conn.sendReceive(b"world.getHeight", args))
def getPlayerEntityIds(self):
"""Get the entity ids of the connected players => [id:int]"""
diff --git a/src/main/resources/test/Test.py b/src/main/resources/test/Test.py
index 87598f83..c08d2aa0 100644
--- a/src/main/resources/test/Test.py
+++ b/src/main/resources/test/Test.py
@@ -4,9 +4,6 @@
import original.mcpi.minecraft as minecraft
import modded.mcpi.minecraft as minecraftmodded
-import original.mcpi.block as block
-import modded.mcpi.block as blockmodded
-import modded.mcpi.entity as entitymodded
import time
import math
@@ -28,13 +25,18 @@ def runBlockTests(mc):
"GLOWSTONE_BLOCK","GLASS_PANE","LIT_PUMPKIN","END_STONE","EMERALD_ORE","GLOWING_OBSIDIAN","ICE",
"SNOW_BLOCK","MYCELIUM","NETHER_BRICK","NETHER_REACTOR_CORE"]
fences=["FENCE","FENCE_NETHER_BRICK","FENCE_SPRUCE","FENCE_BIRCH","FENCE_JUNGLE","FENCE_DARK_OAK","FENCE_ACACIA"]
- woods=["WOOD_PLANKS"]
- trees=["WOOD","LEAVES"]
- trees2=["LEAVES2"] #options are acacia and dark oak
+ woods=["ACACIA_PLANKS","BIRCH_PLANKS","DARK_OAK_PLANKS","JUNGLE_PLANKS","OAK_PLANKS","SPRUCE_PLANKS"]
+ trees=["ACACIA_LOG","BIRCH_LOG","DARK_OAK_LOG","JUNGLE_LOG","OAK_LOG","SPRUCE_LOG","ACACIA_LEAVES","BIRCH_LEAVES","DARK_OAK_LEAVES",
+ "JUNGLE_LEAVES","OAK_LEAVES","SPRUCE_LEAVES"]
plants=["DEAD_BUSH","FLOWER_CYAN","FLOWER_YELLOW","SUGAR_CANE"]
liquids=["WATER","LAVA"]
beds=["BED"]
- coloureds=["WOOL","STAINED_GLASS"]
+ coloureds=["BLACK_WOOL","BLUE_WOOL","BROWN_WOOL","CYAN_WOOL","GRAY_WOOL","GREEN_WOOL","LIGHT_BLUE_WOOL","LIGHT_GRAY_WOOL",
+ "LIME_WOOL","MAGENTA_WOOL","ORANGE_WOOL","PINK_WOOL","PURPLE_WOOL","RED_WOOL","WHITE_WOOL","YELLOW_WOOL",
+ "BLACK_STAINED_GLASS","BLUE_STAINED_GLASS","BROWN_STAINED_GLASS","CYAN_STAINED_GLASS","GRAY_STAINED_GLASS",
+ "GREEN_STAINED_GLASS","LIGHT_BLUE_STAINED_GLASS","LIGHT_GRAY_STAINED_GLASS","LIME_STAINED_GLASS","MAGENTA_STAINED_GLASS",
+ "ORANGE_STAINED_GLASS","PINK_STAINED_GLASS","PURPLE_STAINED_GLASS","RED_STAINED_GLASS","WHITE_STAINED_GLASS",
+ "YELLOW_STAINED_GLASS"]
flats=["RAIL","RAIL_POWERED","RAIL_DETECTOR","RAIL_ACTIVATOR","TRAPDOOR","TRAPDOOR_IRON"]
slabs=["STONE_SLAB","STONE_SLAB_DOUBLE","WOODEN_SLAB"]
torches=["TORCH","TORCH_REDSTONE"]
@@ -44,14 +46,15 @@ def runBlockTests(mc):
doors=["DOOR_WOOD","DOOR_IRON","DOOR_SPRUCE","DOOR_BIRCH","DOOR_JUNGLE","DOOR_ACACIA","DOOR_DARK_OAK"]
gates=["FENCE_GATE"]
wallmounts=["SIGN_WALL","LADDER","CHEST","FURNACE_INACTIVE","FURNACE_ACTIVE"]
- saplings=["SAPLING"]
- tallgrasses=["GRASS_TALL"]
+ saplings=["ACACIA_SAPLING","BIRCH_SAPLING","DARK_OAK_SAPLING","JUNGLE_SAPLING","OAK_SAPLING","SPRUCE_SAPLING"]
+ tallgrasses=["TALL_GRASS"]
stonebricks=["STONE_BRICK"]
snowblocks=["SNOW"]
sandstones=["SANDSTONE"]
cacti=["CACTUS"]
mushrooms=["MUSHROOM_BROWN","MUSHROOM_RED"]
-
+ facings=["SOUTH","SOUTH_WEST","WEST","NORTH_WEST","NORTH","NORTH_EAST","EAST","SOUTH_EAST"]
+
# location for platform showing all block types
xtest = 0
ytest = 50
@@ -61,36 +64,28 @@ def runBlockTests(mc):
# note some blocks have different names but same ids so they only have to be tested once per id
# create a map of ids to names so can see which ones haven't been tested by name
untested=set()
- blockmap={}
- for varname in dir(blockmodded):
- var=getattr(blockmodded,varname)
+ tested=set()
+ for varname in dir(blocks):
try:
- # check var has data and id and add id to untested set
- var.data
- untested.add(var.id)
- try:
- names=blockmap[var.id]
- names.append(varname)
- except KeyError:
- blockmap[var.id]=[varname]
+ untested.add(varname)
except AttributeError:
#only interested in objects with an id and data which behave like Blocks
pass
- signmount=blockmodded.STONE
- sign=blockmodded.SIGN_STANDING.withData(12)
- signid=sign.id
+ signmount="STONE"
+ signface="SOUTH_WEST"
+ sign="SIGN_STANDING"
x=xtest
y=ytest-1
z=ztest
- mc.setBlocks(x,y,z,x+100,y,z+100,blockmodded.STONE)
+ mc.setBlocks(x,y,z,x+100,y,z+100,"STONE")
time.sleep(1)
#clear the area in segments, otherwise it breaks the server
#clearing area
- #mc.setBlocks(x,y+1,z,x+100,y+50,z+100,blockmodded.AIR)
+ #mc.setBlocks(x,y+1,z,x+100,y+50,z+100,"AIR")
for y_inc in range(1, 10):
- mc.setBlocks(x,y+y_inc,z,x+100,y+y_inc,z+100,blockmodded.AIR)
+ mc.setBlocks(x,y+y_inc,z,x+100,y+y_inc,z+100,"AIR")
time.sleep(2)
mc.player.setTilePos(xtest, ytest, ztest)
time.sleep(1)
@@ -98,345 +93,278 @@ def runBlockTests(mc):
y=ytest
z=ztest+10
for key in solids + gases + flats + fences:
- b = getattr(blockmodded,key)
z += 1
mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
time.sleep(1)
x=xtest+20
z=ztest+10
for key in trees:
- for data in range(16):
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
- for key in trees2:
- for data in [0,1,4,5,8,9,12,13]:
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ z += 1
+ mc.setBlock(x-1,y,z,signmount)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in woods + stonebricks:
- for data in range(4):
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ z += 1
+ mc.setBlock(x-1,y,z,signmount)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in sandstones:
- for data in range(3):
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ z += 1
+ mc.setBlock(x-1,y,z,signmount)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in saplings + tallgrasses:
- for data in range(4):
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y-1,z,blockmodded.DIRT)
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ z += 1
+ mc.setBlock(x-1,y,z,signmount)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y-1,z,"DIRT")
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in plants:
- b = getattr(blockmodded,key)
z += 1
mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y-1,z,blockmodded.DIRT)
- mc.setBlock(x+1,y-2,z,blockmodded.DIRT)
- mc.setBlock(x+1,y-1,z,blockmodded.WATER)
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y-1,z,"DIRT")
+ mc.setBlock(x+1,y-2,z,"DIRT")
+ mc.setBlock(x+1,y-1,z,"WATER")
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in cacti:
- b = getattr(blockmodded,key)
z += 1
mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
# cactus has to be on sand and away from other blocks
- mc.setBlock(x+1,y-2,z,blockmodded.DIRT)
- mc.setBlock(x+1,y-1,z,blockmodded.SAND)
+ mc.setBlock(x+1,y-2,z,"DIRT")
+ mc.setBlock(x+1,y-1,z,"SAND")
mc.setBlock(x+1,y,z,b)
- untested.discard(b.id)
+ untested.discard(key)
for key in mushrooms:
- b = getattr(blockmodded,key)
z += 1
mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlocks(x-3,y+3,z-3,x+3,y+3,z+3,blockmodded.STONE)
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,signface,"facing=" + signface,"material=" + key)
+ mc.setBlocks(x-3,y+3,z-3,x+3,y+3,z+3,"STONE")
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
time.sleep(1)
x=xtest+30
z=ztest+10
for key in coloureds:
- for data in range(16):
- b = getattr(blockmodded,key).withData(data)
- z += 1
- mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ z += 1
+ mc.setBlock(x-1,y,z,signmount)
+ mc.setSign(x-1,y+1,z,sign,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in beds:
#RaspberryJuice can't do coloured beds
- b = getattr(blockmodded,key)
z += 10
mc.setBlock(x-1,y,z,signmount)
mc.setBlock(x+1,y,z,signmount)
mc.setBlock(x,y,z-1,signmount)
mc.setBlock(x,y,z+1,signmount)
- mc.setSign(x-1,y+1,z,signid,4,key,"id=" + str(b.id),"head=11","foot=3")
- mc.setSign(x+1,y+1,z,signid,12,key,"id=" + str(b.id),"head=9","foot=1")
- mc.setSign(x,y+1,z-1,signid,8,key,"id=" + str(b.id),"head=8","foot=0")
- mc.setSign(x,y+1,z+1,signid,0,key,"id=" + str(b.id),"head=10","foot=2")
- mc.setBlock(x+3,y,z,b.id,1)
- mc.setBlock(x+2,y,z,b.id,9)
- mc.setBlock(x-3,y,z,b.id,3)
- mc.setBlock(x-2,y,z,b.id,11)
- mc.setBlock(x,y,z-3,b.id,0)
- mc.setBlock(x,y,z-2,b.id,8)
- mc.setBlock(x,y,z+3,b.id,2)
- mc.setBlock(x,y,z+2,b.id,10)
- untested.discard(b.id)
- b=blockmodded.SIGN_STANDING
- mc.setSign (x-2,y,z-5,b.id,15,"SIGN_STANDING","id=" + str(b.id),"data=15","rotation")
- mc.setSign (x-4,y,z-4,b.id,14,"SIGN_STANDING","id=" + str(b.id),"data=14","rotation")
- mc.setSign (x-5,y,z-2,b.id,13,"SIGN_STANDING","id=" + str(b.id),"data=13","rotation")
- mc.setSign (x-6,y,z ,b.id,12,"SIGN_STANDING","id=" + str(b.id),"data=12","rotation")
- mc.setSign (x-5,y,z+2,b.id,11,"SIGN_STANDING","id=" + str(b.id),"data=11","rotation")
- mc.setSign (x-4,y,z+4,b.id,10,"SIGN_STANDING","id=" + str(b.id),"data=10","rotation")
- mc.setSign (x-2,y,z+5,b.id, 9,"SIGN_STANDING","id=" + str(b.id),"data= 9","rotation")
- mc.setSign (x ,y,z+6,b.id, 8,"SIGN_STANDING","id=" + str(b.id),"data= 8","rotation")
- mc.setSign (x+2,y,z+5,b.id, 7,"SIGN_STANDING","id=" + str(b.id),"data= 7","rotation")
- mc.setSign (x+4,y,z+4,b.id, 6,"SIGN_STANDING","id=" + str(b.id),"data= 6","rotation")
- mc.setSign (x+5,y,z+2,b.id, 5,"SIGN_STANDING","id=" + str(b.id),"data= 5","rotation")
- mc.setSign (x+6,y,z ,b.id, 4,"SIGN_STANDING","id=" + str(b.id),"data= 4","rotation")
- mc.setSign (x+5,y,z-2,b.id, 3,"SIGN_STANDING","id=" + str(b.id),"data= 3","rotation")
- mc.setSign (x+4,y,z-4,b.id, 2,"SIGN_STANDING","id=" + str(b.id),"data= 2","rotation")
- mc.setSign (x+2,y,z-5,b.id, 1,"SIGN_STANDING","id=" + str(b.id),"data= 1","rotation")
- mc.setSign (x ,y,z-6,b.id, 0,"SIGN_STANDING","id=" + str(b.id),"data= 0","rotation")
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,sign,"WEST","material=" + sign,"facing=WEST","head=11","foot=3")
+ mc.setSign(x+1,y+1,z,sign,"EAST","material=" + sign,"facing=EAST","head=9","foot=1")
+ mc.setSign(x,y+1,z-1,sign,"NORTH","material=" + sign,"facing=NORTH","head=8","foot=0")
+ mc.setSign(x,y+1,z+1,sign,"SOUTH","material=" + sign,"facing=SOUTH","head=10","foot=2")
+ mc.setBlock(x+3,y,z,key)
+ mc.setBlock(x+2,y,z,key)
+ mc.setBlock(x-3,y,z,key)
+ mc.setBlock(x-2,y,z,key)
+ mc.setBlock(x,y,z-3,key)
+ mc.setBlock(x,y,z-2,key)
+ mc.setBlock(x,y,z+3,key)
+ mc.setBlock(x,y,z+2,key)
+ untested.discard(key)
+ mc.setSign (x-2,y,z-5,"SIGN_STANDING","SOUTH_SOUTH_EAST","facing=SOUTH_SOUTH_EAST","rotation")
+ mc.setSign (x-4,y,z-4,"SIGN_STANDING","SOUTH_EAST", "facing=SOUTH_EAST", "rotation")
+ mc.setSign (x-5,y,z-2,"SIGN_STANDING","EAST_SOUTH_EAST", "facing=EAST_SOUTH_EAST", "rotation")
+ mc.setSign (x-6,y,z ,"SIGN_STANDING","EAST", "facing=EAST", "rotation")
+ mc.setSign (x-5,y,z+2,"SIGN_STANDING","EAST_NORTH_EAST", "facing=EAST_NORTH_EAST", "rotation")
+ mc.setSign (x-4,y,z+4,"SIGN_STANDING","NORTH_EAST", "facing=NORTH_EAST", "rotation")
+ mc.setSign (x-2,y,z+5,"SIGN_STANDING","NORTH_NORTH_EAST","facing=NORTH_NORTH_EAST","rotation")
+ mc.setSign (x ,y,z+6,"SIGN_STANDING","NORTH", "facing=NORTH", "rotation")
+ mc.setSign (x+2,y,z+5,"SIGN_STANDING","NORTH_NORTH_WEST","facing=NORTH_NORTH_WEST","rotation")
+ mc.setSign (x+4,y,z+4,"SIGN_STANDING","NORTH_WEST", "facing=NORTH_WEST", "rotation")
+ mc.setSign (x+5,y,z+2,"SIGN_STANDING","WEST_NORTH_WEST", "facing=WEST_NORTH_WEST", "rotation")
+ mc.setSign (x+6,y,z ,"SIGN_STANDING","WEST", "facing=WEST", "rotation")
+ mc.setSign (x+5,y,z-2,"SIGN_STANDING","WEST_SOUTH_WEST", "facing=WEST_SOUTH_WEST", "rotation")
+ mc.setSign (x+4,y,z-4,"SIGN_STANDING","SOUTH_WEST", "facing=SOUTH_WEST", "rotation")
+ mc.setSign (x+2,y,z-5,"SIGN_STANDING","SOUTH_SOUTH_WEST","facing=SOUTH_SOUTH_WEST","rotation")
+ mc.setSign (x ,y,z-6,"SIGN_STANDING","SOUTH", "facing=SOUTH", "rotation")
+ untested.discard(key)
time.sleep(1)
x=xtest+40
z=ztest+10
for key in liquids:
z += 1
- mc.setBlocks(x-1,y,z,x+1,y,z+10,blockmodded.STONE)
- b = getattr(blockmodded,key + "_STATIONARY")
+ mc.setBlocks(x-1,y,z,x+1,y,z+10,"STONE")
z += 1
- mc.setSign(x-1,y+1,z,sign,key+"_STATIONARY","id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
- for data in range(8):
- b = getattr(blockmodded,key).withData(data)
+ mc.setSign(x-1,y+1,z,sign,signface,"facing=" + signface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
+ for newface in facings:
z += 1
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,newface,"facing=" + newface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
for key in snowblocks:
z += 1
- mc.setBlocks(x-1,y,z,x-1,y,z+8,blockmodded.STONE)
- for data in range(8):
- b = getattr(blockmodded,key).withData(data)
+ mc.setBlocks(x-1,y,z,x-1,y,z+8,"STONE")
+ for newface in facings:
z += 1
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,newface,"facing=" + newface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
time.sleep(1)
x=xtest+50
z=ztest+10
for key in slabs:
- for data in range(8):
- b = getattr(blockmodded,key).withData(data)
+ for newface in facings:
z += 1
mc.setBlock(x-1,y,z,signmount)
- mc.setSign(x-1,y+1,z,sign,key,"id=" + str(b.id),"data=" + str(b.data))
- mc.setBlock(x,y,z,b)
- untested.discard(b.id)
+ mc.setSign(x-1,y+1,z,key,newface,"facing=" + newface,"material=" + key)
+ mc.setBlock(x,y,z,key)
+ untested.discard(key)
time.sleep(1)
x=xtest+60
y=ytest
z=ztest+10
- wallsignid=blockmodded.SIGN_WALL.id
+ wallsign="SIGN_WALL"
for key in wallmounts:
- b = getattr(blockmodded,key)
mc.setBlock(x,y,z,signmount)
mc.setBlock(x,y+1,z,signmount)
#north
- mc.setBlock(x,y,z-1,b.id,2)
- mc.setSign(x,y+1,z-1,wallsignid,2,key,"id=" + str(b.id),"data=2","north")
+ mc.setBlock(x,y,z-1,key)
+ mc.setSign(x,y+1,z-1,wallsign,"NORTH","north")
#south
- mc.setBlock(x,y,z+1,b.id,3)
- mc.setSign(x,y+1,z+1,wallsignid,3,key,"id=" + str(b.id),"data=3","south")
+ mc.setBlock(x,y,z+1,key)
+ mc.setSign(x,y+1,z+1,wallsign,"SOUTH","south")
#west
- mc.setBlock(x-1,y,z,b.id,4)
- mc.setSign(x-1,y+1,z,wallsignid,4,key,"id=" + str(b.id),"data=4","west")
+ mc.setBlock(x-1,y,z,key)
+ mc.setSign(x-1,y+1,z,wallsign,"WEST","west")
#east
- mc.setBlock(x+1,y,z,b.id,5)
- mc.setSign(x+1,y+1,z,wallsignid,5,key,"id=" + str(b.id),"data=5","east")
+ mc.setBlock(x+1,y,z,key)
+ mc.setSign(x+1,y+1,z,wallsign,"EAST","east")
y+=2
- untested.discard(b.id)
- #untested.discard(wallsignid)
+ untested.discard(key)
+ #untested.discard(wallsign)
time.sleep(1)
x=xtest+60
y=ytest
z=ztest+20
for key in torches:
- b = getattr(blockmodded,key)
mc.setBlocks(x,y,z,x,y+2,z,signmount)
#north
- mc.setBlock(x,y,z-1,b.id,4)
- mc.setSign(x,y+1,z-1,wallsignid,2,key,"id=" + str(b.id),"data=4","north")
+ mc.setBlock(x,y,z-1,key)
+ mc.setSign(x,y+1,z-1,wallsign,"NORTH","facing=NORTH")
#south
- mc.setBlock(x,y,z+1,b.id,3)
- mc.setSign(x,y+1,z+1,wallsignid,3,key,"id=" + str(b.id),"data=3","south")
+ mc.setBlock(x,y,z+1,key)
+ mc.setSign(x,y+1,z+1,wallsign,"SOUTH","facing=SOUTH")
#west
- mc.setBlock(x-1,y,z,b.id,2)
- mc.setSign(x-1,y+1,z,wallsignid,4,key,"id=" + str(b.id),"data=2","west")
+ mc.setBlock(x-1,y,z,key)
+ mc.setSign(x-1,y+1,z,wallsign,"WEST","facing=WEST")
#east
- mc.setBlock(x+1,y,z,b.id,1)
- mc.setSign(x+1,y+1,z,wallsignid,5,key,"id=" + str(b.id),"data=1","east")
+ mc.setBlock(x+1,y,z,key)
+ mc.setSign(x+1,y+1,z,wallsign,"EAST","facing=EAST")
#up
- mc.setBlock(x,y+3,z,b.id,5)
- mc.setSign(x+1,y+2,z,wallsignid,5,key,"id=" + str(b.id),"data=5","up")
+ mc.setBlock(x,y+3,z,key)
+ mc.setSign(x+1,y+2,z,wallsign,"UP","facing=UP")
z+=10
- untested.discard(b.id)
+ untested.discard(key)
time.sleep(1)
x=xtest+70
y=ytest
z=ztest+10
for key in doors:
- b = getattr(blockmodded,key)
mc.setBlocks(x,y,z,x+3,y+2,z+3,signmount)
- mc.setBlocks(x+1,y,z+1,x+2,y+1,z+2,blockmodded.AIR)
- mc.setBlock(x+1,y ,z ,b.id,1)
- mc.setBlock(x+1,y+1,z ,b.id,9)
- mc.setBlock(x+2,y ,z ,b.id,1)
- mc.setBlock(x+2,y+1,z ,b.id,8)
- mc.setBlock(x ,y ,z+1,b.id,0)
- mc.setBlock(x ,y+1,z+1,b.id,8)
- mc.setBlock(x ,y ,z+2,b.id,0)
- mc.setBlock(x ,y+1,z+2,b.id,9)
- mc.setBlock(x+3,y ,z+1,b.id,2)
- mc.setBlock(x+3,y+1,z+1,b.id,9)
- mc.setBlock(x+3,y ,z+2,b.id,2)
- mc.setBlock(x+3,y+1,z+2,b.id,8)
- mc.setBlock(x+1,y ,z+3,b.id,3)
- mc.setBlock(x+1,y+1,z+3,b.id,8)
- mc.setBlock(x+2,y ,z+3,b.id,3)
- mc.setBlock(x+2,y+1,z+3,b.id,9)
- mc.setSign (x ,y ,z-1,wallsignid,2,key,"id=" + str(b.id),"data=1")
- mc.setSign (x ,y+1,z-1,wallsignid,2,key,"id=" + str(b.id),"data=9")
- mc.setSign (x+3,y ,z-1,wallsignid,2,key,"id=" + str(b.id),"data=1")
- mc.setSign (x+3,y+1,z-1,wallsignid,2,key,"id=" + str(b.id),"data=8")
- mc.setSign (x-1,y ,z ,wallsignid,4,key,"id=" + str(b.id),"data=0")
- mc.setSign (x-1,y+1,z ,wallsignid,4,key,"id=" + str(b.id),"data=8")
- mc.setSign (x-1,y ,z+3,wallsignid,4,key,"id=" + str(b.id),"data=0")
- mc.setSign (x-1,y+1,z+3,wallsignid,4,key,"id=" + str(b.id),"data=9")
- mc.setSign (x+4,y ,z ,wallsignid,5,key,"id=" + str(b.id),"data=2")
- mc.setSign (x+4,y+1,z ,wallsignid,5,key,"id=" + str(b.id),"data=9")
- mc.setSign (x+4,y ,z+3,wallsignid,5,key,"id=" + str(b.id),"data=2")
- mc.setSign (x+4,y+1,z+3,wallsignid,5,key,"id=" + str(b.id),"data=8")
- mc.setSign (x ,y ,z+4,wallsignid,3,key,"id=" + str(b.id),"data=3")
- mc.setSign (x ,y+1,z+4,wallsignid,3,key,"id=" + str(b.id),"data=8")
- mc.setSign (x+3,y ,z+4,wallsignid,3,key,"id=" + str(b.id),"data=3")
- mc.setSign (x+3,y+1,z+4,wallsignid,3,key,"id=" + str(b.id),"data=9")
+ mc.setBlocks(x+1,y,z+1,x+2,y+1,z+2,"AIR")
+ mc.setBlock(x+1,y ,z ,key)
+ mc.setBlock(x+1,y+1,z ,key)
+ mc.setBlock(x+2,y ,z ,key)
+ mc.setBlock(x+2,y+1,z ,key)
+ mc.setBlock(x ,y ,z+1,key)
+ mc.setBlock(x ,y+1,z+1,key)
+ mc.setBlock(x ,y ,z+2,key)
+ mc.setBlock(x ,y+1,z+2,key)
+ mc.setBlock(x+3,y ,z+1,key)
+ mc.setBlock(x+3,y+1,z+1,key)
+ mc.setBlock(x+3,y ,z+2,key)
+ mc.setBlock(x+3,y+1,z+2,key)
+ mc.setBlock(x+1,y ,z+3,key)
+ mc.setBlock(x+1,y+1,z+3,key)
+ mc.setBlock(x+2,y ,z+3,key)
+ mc.setBlock(x+2,y+1,z+3,key)
y+=3
- untested.discard(b.id)
+ untested.discard(key)
for key in gates:
- b = getattr(blockmodded,key)
- mc.setBlocks(x,y,z,x+3,y,z+3,blockmodded.AIR)
- mc.setBlock(x+1,y ,z ,b.id,0)
- mc.setBlock(x+2,y ,z ,b.id,0)
- mc.setBlock(x ,y ,z+1,b.id,1)
- mc.setBlock(x ,y ,z+2,b.id,1)
- mc.setBlock(x+3,y ,z+1,b.id,1)
- mc.setBlock(x+3,y ,z+2,b.id,1)
- mc.setBlock(x+1,y ,z+3,b.id,0)
- mc.setBlock(x+2,y ,z+3,b.id,0)
+ mc.setBlocks(x,y,z,x+3,y,z+3,"AIR")
+ mc.setBlock(x+1,y ,z ,key)
+ mc.setBlock(x+2,y ,z ,key)
+ mc.setBlock(x ,y ,z+1,key)
+ mc.setBlock(x ,y ,z+2,key)
+ mc.setBlock(x+3,y ,z+1,key)
+ mc.setBlock(x+3,y ,z+2,key)
+ mc.setBlock(x+1,y ,z+3,key)
+ mc.setBlock(x+2,y ,z+3,key)
mc.setBlock(x,y,z,signmount)
mc.setBlock(x+3,y,z,signmount)
mc.setBlock(x,y,z+3,signmount)
mc.setBlock(x+3,y,z+3,signmount)
- mc.setSign (x ,y ,z-1,wallsignid,2,key,"id=" + str(b.id),"data=0")
- mc.setSign (x+3,y ,z-1,wallsignid,2,key,"id=" + str(b.id),"data=0")
- mc.setSign (x-1,y ,z ,wallsignid,4,key,"id=" + str(b.id),"data=1")
- mc.setSign (x-1,y ,z+3,wallsignid,4,key,"id=" + str(b.id),"data=1")
- mc.setSign (x+4,y ,z ,wallsignid,5,key,"id=" + str(b.id),"data=1")
- mc.setSign (x+4,y ,z+3,wallsignid,5,key,"id=" + str(b.id),"data=1")
- mc.setSign (x ,y ,z+4,wallsignid,3,key,"id=" + str(b.id),"data=0")
- mc.setSign (x+3,y ,z+4,wallsignid,3,key,"id=" + str(b.id),"data=0")
y+=3
- untested.discard(b.id)
+ untested.discard(key)
time.sleep(1)
x=xtest+70
y=ytest
z=ztest+20
for key in stairs:
- b = getattr(blockmodded,key)
mc.setBlocks(x+1,y,z-1,x+3,y+11,z-3,signmount)
- mc.setBlock(x+1,y ,z ,b.id,0)
- mc.setBlock(x+2,y+1,z ,b.id,0)
- mc.setBlock(x+3,y+2,z ,b.id,0)
+ mc.setBlock(x+1,y ,z ,key)
+ mc.setBlock(x+2,y+1,z ,key)
+ mc.setBlock(x+3,y+2,z ,key)
mc.setBlock(x+4,y+2,z ,signmount)
- mc.setBlock(x+4,y+3,z-1,b.id,3)
- mc.setBlock(x+4,y+4,z-2,b.id,3)
- mc.setBlock(x+4,y+5,z-3,b.id,3)
+ mc.setBlock(x+4,y+3,z-1,key)
+ mc.setBlock(x+4,y+4,z-2,key)
+ mc.setBlock(x+4,y+5,z-3,key)
mc.setBlock(x+4,y+5,z-4,signmount)
- mc.setBlock(x+3,y+6,z-4,b.id,1)
- mc.setBlock(x+2,y+7,z-4,b.id,1)
- mc.setBlock(x+1,y+8,z-4,b.id,1)
+ mc.setBlock(x+3,y+6,z-4,key)
+ mc.setBlock(x+2,y+7,z-4,key)
+ mc.setBlock(x+1,y+8,z-4,key)
mc.setBlock(x ,y+8,z-4,signmount)
- mc.setBlock(x ,y+9,z-3,b.id,2)
- mc.setBlock(x ,y+10,z-2,b.id,2)
- mc.setBlock(x ,y+11,z-1,b.id,2)
+ mc.setBlock(x ,y+9,z-3,key)
+ mc.setBlock(x ,y+10,z-2,key)
+ mc.setBlock(x ,y+11,z-1,key)
mc.setBlock(x ,y+11,z ,signmount)
- mc.setBlock(x+1,y-1,z ,b.id,5)
- mc.setBlock(x+2,y ,z ,b.id,5)
- mc.setBlock(x+3,y+1,z ,b.id,5)
- mc.setBlock(x+4,y+2,z-1,b.id,6)
- mc.setBlock(x+4,y+3,z-2,b.id,6)
- mc.setBlock(x+4,y+4,z-3,b.id,6)
- mc.setBlock(x+3,y+5,z-4,b.id,4)
- mc.setBlock(x+2,y+6,z-4,b.id,4)
- mc.setBlock(x+1,y+7,z-4,b.id,4)
- mc.setBlock(x ,y+8,z-3,b.id,7)
- mc.setBlock(x ,y+9,z-2,b.id,7)
- mc.setBlock(x ,y+10,z-1,b.id,7)
- mc.setSign (x+2,y+2 ,z ,wallsignid,3,key,"id=" + str(b.id),"data=0")
- mc.setSign (x+3,y ,z ,wallsignid,3,key,"id=" + str(b.id),"data=5")
- mc.setSign (x+4,y+5 ,z-2,wallsignid,5,key,"id=" + str(b.id),"data=3")
- mc.setSign (x+4,y+3 ,z-3,wallsignid,5,key,"id=" + str(b.id),"data=6")
- mc.setSign (x+2,y+8 ,z-4,wallsignid,2,key,"id=" + str(b.id),"data=1")
- mc.setSign (x+1,y+6 ,z-4,wallsignid,2,key,"id=" + str(b.id),"data=4")
- mc.setSign (x ,y+11,z-2,wallsignid,4,key,"id=" + str(b.id),"data=2")
- mc.setSign (x ,y+9 ,z-1,wallsignid,4,key,"id=" + str(b.id),"data=7")
+ mc.setBlock(x+1,y-1,z ,key)
+ mc.setBlock(x+2,y ,z ,key)
+ mc.setBlock(x+3,y+1,z ,key)
+ mc.setBlock(x+4,y+2,z-1,key)
+ mc.setBlock(x+4,y+3,z-2,key)
+ mc.setBlock(x+4,y+4,z-3,key)
+ mc.setBlock(x+3,y+5,z-4,key)
+ mc.setBlock(x+2,y+6,z-4,key)
+ mc.setBlock(x+1,y+7,z-4,key)
+ mc.setBlock(x ,y+8,z-3,key)
+ mc.setBlock(x ,y+9,z-2,key)
+ mc.setBlock(x ,y+10,z-1,key)
y+=12
- untested.discard(b.id)
+ untested.discard(key)
#Display list of all blocks which did not get tested
- for id in untested:
- untest="Untested block " + str(id)
- for varname in blockmap[id]:
- untest+=" " + varname
+ for name in untested:
+ untest="Untested block " + name
mc.postToChat(untest)
mc.postToChat("runBlockTests() complete")
@@ -468,17 +396,17 @@ def runEntityTests(mc):
xtest = 50
ytest = 50
ztest = 50
- air=blockmodded.AIR
- wall=blockmodded.GLASS
- roof=blockmodded.STONE
- floor=blockmodded.STONE
- fence=blockmodded.FENCE
- signmount=blockmodded.STONE
- sign=blockmodded.SIGN_STANDING.withData(4)
- signid=sign.id
- torch=blockmodded.TORCH.withData(5)
- rail=blockmodded.RAIL
- wallsignid=blockmodded.SIGN_WALL.id
+ air="AIR"
+ wall="GLASS"
+ roof="STONE"
+ floor="STONE"
+ fence="FENCE"
+ signmount="STONE"
+ signface="WEST"
+ sign=sign
+ torch="TORCH".withData(5)
+ rail="RAIL"
+ wallsign="SIGN_WALL"
mc.postToChat("runEntityTests(): Creating test entities at x=" + str(xtest) + " y=" + str(ytest) + " z=" + str(ztest))
#mc.setBlocks(xtest,ytest-1,ztest,xtest+100,ytest+50,ztest+100,air)
@@ -496,7 +424,7 @@ def runEntityTests(mc):
x=xtest
y=ytest
z=ztest + r
- id=mc.spawnEntity(x,y,z,entitymodded.VILLAGER)
+ id=mc.spawnEntity(x,y,z,"VILLAGER")
theta = 0
while theta <= 2 * math.pi:
time.sleep(1)
@@ -538,7 +466,7 @@ def runEntityTests(mc):
x += 10
e = getattr(entitymodded,key)
mc.setBlock(x+2,y,z,signmount)
- mc.setSign(x+2,y+1,z,sign,key,"id=" + str(e.id))
+ mc.setSign(x+2,y+1,z,key,signface,"id=" + str(e.id))
mc.spawnEntity(x,y,z,e)
untested.discard(e.id)
for key in hangers:
@@ -548,7 +476,7 @@ def runEntityTests(mc):
x += 10
e = getattr(entitymodded,key)
mc.setBlocks(x+2,y,z-1,x+2,y+2,z+1,signmount)
- mc.setSign(x+1,y,z,wallsignid,4,key,"id=" + str(e.id))
+ mc.setSign(x+1,y,z,wallsign,4,key,"id=" + str(e.id))
mc.spawnEntity(x+1,y+2,z,e)
untested.discard(e.id)
z = ztest - 4
@@ -563,7 +491,7 @@ def runEntityTests(mc):
mc.setBlocks(x-2,y,z-2,x+2,y,z+2,fence)
mc.setBlocks(x-1,y,z-1,x+1,y,z+1,air)
mc.setBlock(x-3,y,z-1,torch)
- mc.setSign(x-3,y,z,wallsignid,4,key,"id=" + str(e.id))
+ mc.setSign(x-3,y,z,wallsign,4,key,"id=" + str(e.id))
mc.spawnEntity(x,y,z,e)
untested.discard(e.id)
x+=10
@@ -576,8 +504,8 @@ def runEntityTests(mc):
x += 10
e = getattr(entitymodded,key)
mc.setBlock(x+2,y,z,signmount)
- mc.setSign(x+2,y+1,z,sign,key,"id=" + str(e.id))
- mc.setBlock(x+2,y,z-1,torch.id,4)
+ mc.setSign(x+2,y+1,z,key,signface,"id=" + str(e.id))
+ mc.setBlock(x+2,y,z-1,torch.id)
mc.setBlocks(x,y,z-1,x,y,z+1,rail)
mc.spawnEntity(x,y,z,e)
untested.discard(e.id)
@@ -589,10 +517,10 @@ def runEntityTests(mc):
x += 10
e = getattr(entitymodded,key)
mc.setBlock(x+2,y,z,signmount)
- mc.setSign(x+2,y+1,z,sign,key,"id=" + str(e.id))
- mc.setBlock(x+2,y,z-1,torch.id,2)
+ mc.setSign(x+2,y+1,z,key,signface,"id=" + str(e.id))
+ mc.setBlock(x+2,y,z-1,torch.id)
mc.setBlocks(x-2,y-2,z-3,x+2,y-1,z+2,floor)
- mc.setBlocks(x-1,y-1,z-2,x+1,y-1,z+1,blockmodded.WATER_STATIONARY)
+ mc.setBlocks(x-1,y-1,z-2,x+1,y-1,z+1,"WATER_STATIONARY")
mc.spawnEntity(x,y,z,e)
untested.discard(e.id)
@@ -610,7 +538,7 @@ def runEntityTests(mc):
mc.setBlocks(x-2,y-1,z,x+6,y-1,z+4,floor)
mc.setBlocks(x+1,y,z+1,x+3,y+3,z+3,air)
mc.setBlock(x-1,y,z+1,torch)
- mc.setSign(x-1,y,z+2,sign,key,"id=" + str(e.id))
+ mc.setSign(x-1,y,z+2,key,signface,"id=" + str(e.id))
mc.spawnEntity(x+2,y,z+2,e)
untested.discard(e.id)
@@ -624,7 +552,7 @@ def runEntityTests(mc):
mc.setBlocks(x,y+21,z,x+20,y+21,z+20,roof)
mc.setBlocks(x-5,y-1,z-1,x+20,y-1,z+21,floor)
mc.setBlocks(x+1,y,z+1,x+19,y+20,z+19,air)
- mc.setSign(x-1,y,z+2,sign,key,"id=" + str(e.id))
+ mc.setSign(x-1,y,z+2,key,signface,"id=" + str(e.id))
mc.spawnEntity(x+10,y+5,z+10,e)
untested.discard(e.id)
z += 20
@@ -634,19 +562,19 @@ def runEntityTests(mc):
time.sleep(1)
for key in bosses:
e = getattr(entitymodded,key)
- mc.setBlocks(x,y,z,x+20,y+20,z+20,blockmodded.BEDROCK)
- mc.setBlocks(x,y+21,z,x+20,y+21,z+20,blockmodded.BEDROCK)
- mc.setBlocks(x-5,y-1,z-1,x+20,y-1,z+21,blockmodded.BEDROCK)
+ mc.setBlocks(x,y,z,x+20,y+20,z+20,"BEDROCK")
+ mc.setBlocks(x,y+21,z,x+20,y+21,z+20,"BEDROCK")
+ mc.setBlocks(x-5,y-1,z-1,x+20,y-1,z+21,"BEDROCK")
mc.setBlocks(x+1,y,z+1,x+19,y+20,z+19,air)
mc.setBlocks(x+1,y,z+8,x+19,y,z+12,torch)
mc.setBlocks(x+1,y+10,z+2,x+1,y+15,z+18,torch.id,1)
mc.setBlocks(x+19,y+10,z+2,x+19,y+15,z+18,torch.id,2)
mc.setBlocks(x+1,y+10,z+19,x+19,y+15,z+19,torch.id,4)
mc.setBlocks(x+1,y+10,z+1,x+19,y+15,z+1,torch.id,3)
- mc.setBlocks(x,y,z+9,x+3,y+3,z+11,blockmodded.BEDROCK)
+ mc.setBlocks(x,y,z+9,x+3,y+3,z+11,"BEDROCK")
mc.setBlocks(x+4,y,z+9,x+19,y+3,z+11,wall)
mc.setBlocks(x,y,z+10,x+19,y+2,z+10,air)
- mc.setSign(x-1,y,z+2,sign,key,"id=" + str(e.id))
+ mc.setSign(x-1,y,z+2,key,signface,"id=" + str(e.id))
mc.spawnEntity(x+10,y+5,z+10,e)
untested.discard(e.id)
z += 20
@@ -659,8 +587,8 @@ def runEntityTests(mc):
mc.setBlocks(x,y,z,x+20,y+20,z+20,wall)
mc.setBlocks(x,y+21,z,x+20,y+21,z+20,roof)
mc.setBlocks(x-5,y-1,z-1,x+20,y-1,z+21,floor)
- mc.setBlocks(x+1,y,z+1,x+19,y+20,z+19,blockmodded.WATER_STATIONARY)
- mc.setSign(x-1,y,z+2,sign,key,"id=" + str(e.id))
+ mc.setBlocks(x+1,y,z+1,x+19,y+20,z+19,"WATER_STATIONARY")
+ mc.setSign(x-1,y,z+2,key,signface,"id=" + str(e.id))
mc.spawnEntity(x+10,y,z+10,e)
untested.discard(e.id)
z += 20
@@ -711,20 +639,15 @@ def runTests(mc, library="Standard library", extended=False):
mc.postToChat("block below is - " + str(below))
- #getBlockWithData
- blockBelow = mc.getBlockWithData(pos.x, pos.y-1, pos.z)
- mc.postToChat("block data below is = " + str(blockBelow.data))
-
-
#setBlock no data
- mc.setBlock(pos.x,pos.y+2,pos.z, block.GOLD_BLOCK.id)
+ mc.setBlock(pos.x,pos.y+2,pos.z, "GOLD_BLOCK")
#setBlock with data
- mc.setBlock(pos.x,pos.y+3,pos.z, block.WOOL.id, 1)
+ mc.setBlock(pos.x,pos.y+3,pos.z, "BLUE_WOOL")
#setBlocks
mc.setBlocks(pos.x,pos.y + 10,pos.z,
pos.x + 5, pos.y + 15, pos.z + 5,
- block.WOOL.id, 5)
+ "BLUE_WOOL")
#getBlocks
if extended:
@@ -771,8 +694,8 @@ def runTests(mc, library="Standard library", extended=False):
if extended:
entity_types = mc.getEntityTypes()
- mc.postToChat("The last found was entity: id=" + str(entity_types[-1].id) + " name=" + entity_types[-1].name)
- mc.spawnEntity(tilePos.x + 2, tilePos.y + 2, tilePos.x + 2, entitymodded.CREEPER)
+ mc.postToChat("The last found was entity: name=" + entity_types[-1])
+ mc.spawnEntity(tilePos.x + 2, tilePos.y + 2, tilePos.x + 2, "CREEPER")
mc.postToChat("Creeper spawned")
mc.postToChat("Post To Chat - Run full block and entity test Y/N?")
diff --git a/src/main/resources/test/modded/mcpi/block.py b/src/main/resources/test/modded/mcpi/block.py
deleted file mode 100644
index b64bc6c1..00000000
--- a/src/main/resources/test/modded/mcpi/block.py
+++ /dev/null
@@ -1,133 +0,0 @@
-class Block:
- """Minecraft PI block description. Can be sent to Minecraft.setBlock/s"""
- def __init__(self, id, data=0):
- self.id = id
- self.data = data
-
- def __cmp__(self, rhs):
- return hash(self) - hash(rhs)
-
- def __eq__(self, rhs):
- return self.id == rhs.id and self.data == rhs.data
-
- def __hash__(self):
- return (self.id << 8) + self.data
-
- def withData(self, data):
- return Block(self.id, data)
-
- def __iter__(self):
- """Allows a Block to be sent whenever id [and data] is needed"""
- return iter((self.id, self.data))
-
- def __repr__(self):
- return "Block(%d, %d)"%(self.id, self.data)
-
-AIR = Block(0)
-STONE = Block(1)
-GRASS = Block(2)
-DIRT = Block(3)
-COBBLESTONE = Block(4)
-WOOD_PLANKS = Block(5)
-SAPLING = Block(6)
-BEDROCK = Block(7)
-WATER_FLOWING = Block(8)
-WATER = WATER_FLOWING
-WATER_STATIONARY = Block(9)
-LAVA_FLOWING = Block(10)
-LAVA = LAVA_FLOWING
-LAVA_STATIONARY = Block(11)
-SAND = Block(12)
-GRAVEL = Block(13)
-GOLD_ORE = Block(14)
-IRON_ORE = Block(15)
-COAL_ORE = Block(16)
-WOOD = Block(17)
-LEAVES = Block(18)
-GLASS = Block(20)
-LAPIS_LAZULI_ORE = Block(21)
-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)
-MUSHROOM_BROWN = Block(39)
-MUSHROOM_RED = Block(40)
-GOLD_BLOCK = Block(41)
-IRON_BLOCK = Block(42)
-STONE_SLAB_DOUBLE = Block(43)
-STONE_SLAB = Block(44)
-BRICK_BLOCK = Block(45)
-TNT = Block(46)
-BOOKSHELF = Block(47)
-MOSS_STONE = Block(48)
-OBSIDIAN = Block(49)
-TORCH = Block(50)
-FIRE = Block(51)
-STAIRS_WOOD = Block(53)
-CHEST = Block(54)
-DIAMOND_ORE = Block(56)
-DIAMOND_BLOCK = Block(57)
-CRAFTING_TABLE = Block(58)
-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)
-CACTUS = Block(81)
-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/test/modded/mcpi/entity.py b/src/main/resources/test/modded/mcpi/entity.py
deleted file mode 100644
index b78a4850..00000000
--- a/src/main/resources/test/modded/mcpi/entity.py
+++ /dev/null
@@ -1,102 +0,0 @@
-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/test/modded/mcpi/minecraft.py b/src/main/resources/test/modded/mcpi/minecraft.py
index bffb491d..0f63ea8e 100644
--- a/src/main/resources/test/modded/mcpi/minecraft.py
+++ b/src/main/resources/test/modded/mcpi/minecraft.py
@@ -1,8 +1,6 @@
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
@@ -28,9 +26,6 @@
- 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):
@@ -53,7 +48,7 @@ def getTilePos(self, id):
def setTilePos(self, id, *args):
"""Set entity tile position (entityId:int) => Vec3"""
- self.conn.send(self.pkg + b".setTile", id, intFloor(*args))
+ self.conn.send(self.pkg + b".setTile", id, args)
def setDirection(self, id, *args):
"""Set entity direction (entityId:int, x,y,z)"""
@@ -176,32 +171,24 @@ def __init__(self, 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(","))))
+ """Get block (x,y,z) => material:string"""
+ return self.conn.sendReceive(b"world.getBlock", args)
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(","))
+ """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [material:string]"""
+ s = self.conn.sendReceive(b"world.getBlocks", args)
+ return s.split(",")
def setBlock(self, *args):
"""Set block (x,y,z,id,[data])"""
- self.conn.send(b"world.setBlock", intFloor(args))
+ self.conn.send(b"world.setBlock", 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))
+ self.conn.send(b"world.setBlocks", 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
+ """Set a sign (x,y,z,material,facing,[line1,line2,line3,line4])
@author: Tim Cummings https://www.triptera.com.au/wordpress/"""
lines = []
flatargs = []
@@ -209,15 +196,15 @@ def setSign(self, *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)
+ self.conn.send(b"world.setSign",flatargs[0:4] + lines)
def spawnEntity(self, *args):
"""Spawn entity (x,y,z,id,[data])"""
- return int(self.conn.sendReceive(b"world.spawnEntity", intFloor(args)))
+ return int(self.conn.sendReceive(b"world.spawnEntity", args))
def getHeight(self, *args):
"""Get the height of the world (x,z) => int"""
- return int(self.conn.sendReceive(b"world.getHeight", intFloor(args)))
+ return int(self.conn.sendReceive(b"world.getHeight", args))
def getPlayerEntityIds(self):
"""Get the entity ids of the connected players => [id:int]"""
@@ -245,10 +232,10 @@ def setting(self, setting, status):
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"""
+ """Return a list of strings 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]
+ return [e[:e.find(",")] for e in types]
@staticmethod
diff --git a/src/main/resources/test/original/mcpi/block.py b/src/main/resources/test/original/mcpi/block.py
deleted file mode 100644
index 52c85023..00000000
--- a/src/main/resources/test/original/mcpi/block.py
+++ /dev/null
@@ -1,97 +0,0 @@
-class Block:
- """Minecraft PI block description. Can be sent to Minecraft.setBlock/s"""
- def __init__(self, id, data=0):
- self.id = id
- self.data = data
-
- def __cmp__(self, rhs):
- return hash(self) - hash(rhs)
-
- def __eq__(self, rhs):
- return self.id == rhs.id and self.data == rhs.data
-
- def __hash__(self):
- return (self.id << 8) + self.data
-
- def withData(self, data):
- return Block(self.id, data)
-
- def __iter__(self):
- """Allows a Block to be sent whenever id [and data] is needed"""
- return iter((self.id, self.data))
-
- def __repr__(self):
- return "Block(%d, %d)"%(self.id, self.data)
-
-AIR = Block(0)
-STONE = Block(1)
-GRASS = Block(2)
-DIRT = Block(3)
-COBBLESTONE = Block(4)
-WOOD_PLANKS = Block(5)
-SAPLING = Block(6)
-BEDROCK = Block(7)
-WATER_FLOWING = Block(8)
-WATER = WATER_FLOWING
-WATER_STATIONARY = Block(9)
-LAVA_FLOWING = Block(10)
-LAVA = LAVA_FLOWING
-LAVA_STATIONARY = Block(11)
-SAND = Block(12)
-GRAVEL = Block(13)
-GOLD_ORE = Block(14)
-IRON_ORE = Block(15)
-COAL_ORE = Block(16)
-WOOD = Block(17)
-LEAVES = Block(18)
-GLASS = Block(20)
-LAPIS_LAZULI_ORE = Block(21)
-LAPIS_LAZULI_BLOCK = Block(22)
-SANDSTONE = Block(24)
-BED = Block(26)
-COBWEB = Block(30)
-GRASS_TALL = Block(31)
-WOOL = Block(35)
-FLOWER_YELLOW = Block(37)
-FLOWER_CYAN = Block(38)
-MUSHROOM_BROWN = Block(39)
-MUSHROOM_RED = Block(40)
-GOLD_BLOCK = Block(41)
-IRON_BLOCK = Block(42)
-STONE_SLAB_DOUBLE = Block(43)
-STONE_SLAB = Block(44)
-BRICK_BLOCK = Block(45)
-TNT = Block(46)
-BOOKSHELF = Block(47)
-MOSS_STONE = Block(48)
-OBSIDIAN = Block(49)
-TORCH = Block(50)
-FIRE = Block(51)
-STAIRS_WOOD = Block(53)
-CHEST = Block(54)
-DIAMOND_ORE = Block(56)
-DIAMOND_BLOCK = Block(57)
-CRAFTING_TABLE = Block(58)
-FARMLAND = Block(60)
-FURNACE_INACTIVE = Block(61)
-FURNACE_ACTIVE = Block(62)
-DOOR_WOOD = Block(64)
-LADDER = Block(65)
-STAIRS_COBBLESTONE = Block(67)
-DOOR_IRON = Block(71)
-REDSTONE_ORE = Block(73)
-SNOW = Block(78)
-ICE = Block(79)
-SNOW_BLOCK = Block(80)
-CACTUS = Block(81)
-CLAY = Block(82)
-SUGAR_CANE = Block(83)
-FENCE = Block(85)
-GLOWSTONE_BLOCK = Block(89)
-BEDROCK_INVISIBLE = Block(95)
-STONE_BRICK = Block(98)
-GLASS_PANE = Block(102)
-MELON = Block(103)
-FENCE_GATE = Block(107)
-GLOWING_OBSIDIAN = Block(246)
-NETHER_REACTOR_CORE = Block(247)
diff --git a/src/main/resources/test/original/mcpi/minecraft.py b/src/main/resources/test/original/mcpi/minecraft.py
index 1d1f293d..370488a2 100644
--- a/src/main/resources/test/original/mcpi/minecraft.py
+++ b/src/main/resources/test/original/mcpi/minecraft.py
@@ -1,7 +1,6 @@
from .connection import Connection
from .vec3 import Vec3
from .event import BlockEvent
-from .block import Block
import math
from .util import flatten
@@ -18,9 +17,6 @@
@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):
@@ -43,7 +39,7 @@ def getTilePos(self, id):
def setTilePos(self, id, *args):
"""Set entity tile position (entityId:int) => Vec3"""
- self.conn.send(self.pkg + b".setTile", id, intFloor(*args))
+ self.conn.send(self.pkg + b".setTile", id, args)
def setting(self, setting, status):
"""Set a player setting (setting, status). keys: autojump"""
@@ -119,31 +115,26 @@ def __init__(self, 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(","))))
+ """Get block (x,y,z) => material:string"""
+ return self.conn.sendReceive(b"world.getBlock", args)
"""
@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)))
+ """Get a cuboid of blocks (x0,y0,z0,x1,y1,z1) => [material:string]"""
+ return self.conn.sendReceive(b"world.getBlocks", args)
def setBlock(self, *args):
"""Set block (x,y,z,id,[data])"""
- self.conn.send(b"world.setBlock", intFloor(args))
+ self.conn.send(b"world.setBlock", 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))
+ self.conn.send(b"world.setBlocks", args)
def getHeight(self, *args):
"""Get the height of the world (x,z) => int"""
- return int(self.conn.sendReceive(b"world.getHeight", intFloor(args)))
+ return int(self.conn.sendReceive(b"world.getHeight", args))
def getPlayerEntityIds(self):
"""Get the entity ids of the connected players => [id:int]"""