From ff18400535e617cb5eac86897bf400bd61848927 Mon Sep 17 00:00:00 2001 From: narroo Date: Mon, 28 Apr 2014 15:35:26 -0400 Subject: Added some E_META_* values to BlockID.h --- src/BlockID.h | 140 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 20 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index a227245aa..4949ac528 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -401,6 +401,14 @@ enum /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Block metas: + // E_BLOCK_BED metas: + E_BLOCK_BED_SOUTH = 0, + E_BLOCK_BED_WEST = 1, + E_BLOCK_BED_NORTH = 2, + E_BLOCK_BED_EAST = 3, + E_BLOCK_BED_OCCUPIED = 4, + E_BLOCK_BED_BED_HEAD = 8, + // E_BLOCK_BIG_FLOWER metas E_META_BIG_FLOWER_SUNFLOWER = 0, E_META_BIG_FLOWER_LILAC = 1, @@ -447,14 +455,17 @@ enum E_META_DROPSPENSER_FACING_XP = 5, // E_BLOCK_DOUBLE_STONE_SLAB metas: - E_META_DOUBLE_STONE_SLAB_STONE = 0, - E_META_DOUBLE_STONE_SLAB_SANDSTONE = 1, - E_META_DOUBLE_STONE_SLAB_WOODEN = 2, - E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, - E_META_DOUBLE_STONE_SLAB_BRICK = 4, - E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, - E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, - E_META_DOUBLE_STONE_SLAB_STONE_SECRET = 7, + E_META_DOUBLE_STONE_SLAB_STONE = 0, + E_META_DOUBLE_STONE_SLAB_SANDSTONE = 1, + E_META_DOUBLE_STONE_SLAB_WOODEN = 2, + E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, + E_META_DOUBLE_STONE_SLAB_BRICK = 4, + E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, + E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, + E_META_DOUBLE_STONE_SLAB_QUARTZ = 7, + E_META_DOUBLE_STONE_SLAB_SMOOTH_STONE = 8, + E_META_DOUBLE_STONE_SLAB_SMOOTH_SANDSTONE = 9, + E_META_DOUBLE_STONE_SLAB_TILE_QUARTZ = 10, // E_BLOCK_FLOWER metas E_META_FLOWER_POPPY = 0, @@ -483,6 +494,28 @@ enum E_META_LEAVES_CONIFER = 1, E_META_LEAVES_BIRCH = 2, E_META_LEAVES_JUNGLE = 3, + E_META_LEAVES_APPLE_NO_DECAY = 4, + E_META_LEAVES_CONIFER_NO_DECAY = 5, + E_META_LEAVES_BIRCH_NO_DECAY = 6, + E_META_LEAVES_JUNGLE_NO_DECAY = 7, + E_META_LEAVES_APPLE_CHECK_DECAY = 8, + E_META_LEAVES_CONIFER_CHECK_DECAY = 9, + E_META_LEAVES_BIRCH_CHECK_DECAY = 10, + E_META_LEAVES_JUNGLE_CHECK_DECAY = 11, + E_META_LEAVES_APPLE_NO_DECAY_AND_CHECK_DECAY = 12, + E_META_LEAVES_CONIFER_NO_DECAY_AND_CHECK_DECAY = 13, + E_META_LEAVES_BIRCH_NO_DECAY_AND_CHECK_DECAY = 14, + E_META_LEAVES_JUNGLE_NO_DECAY_AND_CHECK_DECAY = 15, + + // E_BLOCK_LEAVES meta cont. (Block ID 161): + E_META_LEAVES_ACACIA = 0, + E_META_LEAVES_DARK_OAK = 1, + E_META_LEAVES_ACACIA_NO_DECAY = 4, + E_META_LEAVES_DARK_OAK_NO_DECAY = 5, + E_META_LEAVES_ACACIA_CHECK_DECAY = 8, + E_META_LEAVES_DARK_OAK_CHECK_DECAY = 9, + E_META_LEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, + E_META_LEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, // E_BLOCK_LOG metas: E_META_LOG_APPLE = 0, @@ -498,11 +531,23 @@ enum E_META_NEW_LOG_ACACIA_WOOD = 0, E_META_NEW_LOG_DARK_OAK_WOOD = 1, + // E_BLOCK_PISTON metas: + E_META_PISTON_DOWN = 0, + E_META_PISTON_UP = 1, + E_META_PISTON_NORTH = 2, + E_META_PISTON_SOUTH = 3, + E_META_PISTON_WEST = 4, + E_META_PISTON_EAST = 5, + E_META_PISTON_HEAD_STICKY = 8, + E_META_PISTON_EXTENDED = 8, + // E_BLOCK_PLANKS metas: E_META_PLANKS_APPLE = 0, E_META_PLANKS_CONIFER = 1, E_META_PLANKS_BIRCH = 2, E_META_PLANKS_JUNGLE = 3, + E_META_PLANKS_ACACIA = 4, + E_META_PLANKS_DARK_OAK= 5, // E_BLOCK_(XXX_WEIGHTED)_PRESSURE_PLATE metas: E_META_PRESSURE_PLATE_RAISED = 0, @@ -611,15 +656,31 @@ enum E_META_STAINED_GLASS_PANE_RED = 14, E_META_STAINED_GLASS_PANE_BLACK = 15, + // E_BLOCK_STAIRS metas: + E_BLOCK_STAIRS_EAST = 0, + E_BLOCK_STAIRS_WEST = 1, + E_BLOCK_STAIRS_SOUTH = 2, + E_BLOCK_STAIRS_NORTH = 3, + E_BLOCK_STAIRS_UPSIDE_DOWN = 4, + + // E_BLOCK_STONE metas: + E_META_STONE_STONE = 0, + E_META_STONE_GRANITE = 1, + E_META_STONE_POLISHED_GRANITE = 2, + E_META_STONE_DIORITE = 3, + E_META_STONE_POLISHED_DIORITE = 4, + E_META_STONE_ANDESITE = 5, + E_META_STONE_POLISHED_ANDESITE = 6, + // E_BLOCK_STONE_SLAB metas: - E_META_STONE_SLAB_STONE = 0, - E_META_STONE_SLAB_SANDSTONE = 1, - E_META_STONE_SLAB_PLANKS = 2, - E_META_STONE_SLAB_COBBLESTONE = 3, - E_META_STONE_SLAB_BRICK = 4, - E_META_STONE_SLAB_STONE_BRICK = 5, - E_META_STONE_SLAB_NETHER_BRICK = 6, - E_META_STONE_SLAB_STONE_SECRET = 7, + E_META_STONE_SLAB_STONE = 0, + E_META_STONE_SLAB_SANDSTONE = 1, + E_META_STONE_SLAB_PLANKS = 2, + E_META_STONE_SLAB_COBBLESTONE = 3, + E_META_STONE_SLAB_BRICK = 4, + E_META_STONE_SLAB_STONE_BRICK = 5, + E_META_STONE_SLAB_NETHER_BRICK = 6, + E_META_STONE_SLAB_QUARTZ = 7, // E_BLOCK_STONE_BRICKS metas: E_META_STONE_BRICK_NORMAL = 0, @@ -628,9 +689,10 @@ enum E_META_STONE_BRICK_ORNAMENT = 3, // E_BLOCK_TALL_GRASS metas: - E_META_TALL_GRASS_DEAD_SHRUB = 0, - E_META_TALL_GRASS_GRASS = 1, - E_META_TALL_GRASS_FERN = 2, + E_META_TALL_GRASS_DEAD_SHRUB = 0, + E_META_TALL_GRASS_GRASS = 1, + E_META_TALL_GRASS_FERN = 2, + E_META_TALL_GRASS_BIOME = 3, // E_BLOCK_TORCH, E_BLOCK_REDSTONE_TORCH_OFF, E_BLOCK_REDSTONE_TORCH_ON metas: E_META_TORCH_EAST = 1, // east face of the block, pointing east @@ -642,7 +704,43 @@ enum E_META_TORCH_XP = 2, // Torch attached to the XP side of its block E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block - + + // E_BLOCK_WOOD metas: + E_BLOCK_WOOD_OAK_UP_DOWN = 0, + E_BLOCK_WOOD_SPRUCE_UP_DOWN = 1, + E_BLOCK_WOOD_BIRCH_UP_DOWN = 2, + E_BLOCK_WOOD_JUNGLE_UP_DOWN = 3, + E_BLOCK_WOOD_OAK_EAST_WEST = 4, + E_BLOCK_WOOD_SPRUCE_EAST_WEST = 5, + E_BLOCK_WOOD_BIRCH_EAST_WEST = 6, + E_BLOCK_WOOD_JUNGLE_EAST_WEST = 7, + E_BLOCK_WOOD_OAK_NORTH_SOUTH = 8, + E_BLOCK_WOOD_SPRUCE_NORTH_SOUTH = 9, + E_BLOCK_WOOD_BIRCH_NORTH_SOUTH = 10, + E_BLOCK_WOOD_JUNGLE_NORTH_SOUTH = 11, + E_BLOCK_WOOD_OAK_BARK_ONLY = 12, + E_BLOCK_WOOD_SPRUCE_BARK_ONLY = 13, + E_BLOCK_WOOD_BIRCH_BARK_ONLY = 14, + E_BLOCK_WOOD_JUNGLE_BARK_ONLY = 15, + + // E_BLOCK_WOOD metas cont. (Block ID 162): + E_BLOCK_WOOD_ACACIA_UP_DOWN = 0, + E_BLOCK_WOOD_DARK_OAK_UP_DOWN = 1, + E_BLOCK_WOOD_ACACIA_UP_DOWN = 2, + E_BLOCK_WOOD_DARK_OAK_UP_DOWN = 3, + E_BLOCK_WOOD_ACACIA_EAST_WEST = 4, + E_BLOCK_WOOD_DARK_OAK_EAST_WEST = 5, + E_BLOCK_WOOD_ACACIA_EAST_WEST = 6, + E_BLOCK_WOOD_DARK_OAK_EAST_WEST = 7, + E_BLOCK_WOOD_ACACIA_NORTH_SOUTH = 8, + E_BLOCK_WOOD_DARK_OAK_NORTH_SOUTH = 9, + E_BLOCK_WOOD_ACACIA_NORTH_SOUTH = 10, + E_BLOCK_WOOD_DARK_OAK_NORTH_SOUTH = 11, + E_BLOCK_WOOD_ACACIA_BARK_ONLY = 12, + E_BLOCK_WOOD_DARK_OAK_BARK_ONLY = 13, + E_BLOCK_WOOD_ACACIA_BARK_ONLY = 14, + E_BLOCK_WOOD_DARK_OAK_BARK_ONLY = 15, + // E_BLOCK_WOODEN_DOUBLE_SLAB metas: E_META_WOODEN_DOUBLE_SLAB_APPLE = 0, E_META_WOODEN_DOUBLE_SLAB_CONIFER = 1, @@ -658,6 +756,8 @@ enum E_META_WOODEN_SLAB_JUNGLE = 3, E_META_WOODEN_SLAB_ACACIA = 4, E_META_WOODEN_SLAB_DARK_OAK = 5, + E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, + E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, // E_BLOCK_WOOL metas: E_META_WOOL_WHITE = 0, -- cgit v1.2.3 From f4fa3985b55a98d8c6a404df24bfd5a8ba5056c0 Mon Sep 17 00:00:00 2001 From: narroo Date: Mon, 28 Apr 2014 15:49:34 -0400 Subject: Fixed Formmating --- src/BlockID.h | 138 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index 4949ac528..8cc3f6397 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -455,17 +455,17 @@ enum E_META_DROPSPENSER_FACING_XP = 5, // E_BLOCK_DOUBLE_STONE_SLAB metas: - E_META_DOUBLE_STONE_SLAB_STONE = 0, - E_META_DOUBLE_STONE_SLAB_SANDSTONE = 1, - E_META_DOUBLE_STONE_SLAB_WOODEN = 2, - E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, - E_META_DOUBLE_STONE_SLAB_BRICK = 4, - E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, - E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, - E_META_DOUBLE_STONE_SLAB_QUARTZ = 7, - E_META_DOUBLE_STONE_SLAB_SMOOTH_STONE = 8, - E_META_DOUBLE_STONE_SLAB_SMOOTH_SANDSTONE = 9, - E_META_DOUBLE_STONE_SLAB_TILE_QUARTZ = 10, + E_META_DOUBLE_STONE_SLAB_STONE = 0, + E_META_DOUBLE_STONE_SLAB_SANDSTON = 1, + E_META_DOUBLE_STONE_SLAB_WOODEN = 2, + E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, + E_META_DOUBLE_STONE_SLAB_BRICK = 4, + E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, + E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, + E_META_DOUBLE_STONE_SLAB_QUARTZ = 7, + E_META_DOUBLE_STONE_SLAB_SMOOTH_STONE = 8, + E_META_DOUBLE_STONE_SLAB_SMOOTH_SANDSTONE = 9, + E_META_DOUBLE_STONE_SLAB_TILE_QUARTZ = 10, // E_BLOCK_FLOWER metas E_META_FLOWER_POPPY = 0, @@ -508,14 +508,14 @@ enum E_META_LEAVES_JUNGLE_NO_DECAY_AND_CHECK_DECAY = 15, // E_BLOCK_LEAVES meta cont. (Block ID 161): - E_META_LEAVES_ACACIA = 0, - E_META_LEAVES_DARK_OAK = 1, - E_META_LEAVES_ACACIA_NO_DECAY = 4, - E_META_LEAVES_DARK_OAK_NO_DECAY = 5, - E_META_LEAVES_ACACIA_CHECK_DECAY = 8, - E_META_LEAVES_DARK_OAK_CHECK_DECAY = 9, - E_META_LEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, - E_META_LEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, + E_META_LEAVES_ACACIA = 0, + E_META_LEAVES_DARK_OAK = 1, + E_META_LEAVES_ACACIA_NO_DECAY = 4, + E_META_LEAVES_DARK_OAK_NO_DECAY = 5, + E_META_LEAVES_ACACIA_CHECK_DECAY = 8, + E_META_LEAVES_DARK_OAK_CHECK_DECAY = 9, + E_META_LEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, + E_META_LEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, // E_BLOCK_LOG metas: E_META_LOG_APPLE = 0, @@ -532,14 +532,14 @@ enum E_META_NEW_LOG_DARK_OAK_WOOD = 1, // E_BLOCK_PISTON metas: - E_META_PISTON_DOWN = 0, - E_META_PISTON_UP = 1, - E_META_PISTON_NORTH = 2, - E_META_PISTON_SOUTH = 3, - E_META_PISTON_WEST = 4, - E_META_PISTON_EAST = 5, - E_META_PISTON_HEAD_STICKY = 8, - E_META_PISTON_EXTENDED = 8, + E_META_PISTON_DOWN = 0, + E_META_PISTON_UP = 1, + E_META_PISTON_NORTH = 2, + E_META_PISTON_SOUTH = 3, + E_META_PISTON_WEST = 4, + E_META_PISTON_EAST = 5, + E_META_PISTON_HEAD_STICKY = 8, + E_META_PISTON_EXTENDED = 8, // E_BLOCK_PLANKS metas: E_META_PLANKS_APPLE = 0, @@ -657,30 +657,30 @@ enum E_META_STAINED_GLASS_PANE_BLACK = 15, // E_BLOCK_STAIRS metas: - E_BLOCK_STAIRS_EAST = 0, - E_BLOCK_STAIRS_WEST = 1, - E_BLOCK_STAIRS_SOUTH = 2, - E_BLOCK_STAIRS_NORTH = 3, - E_BLOCK_STAIRS_UPSIDE_DOWN = 4, + E_BLOCK_STAIRS_EAST = 0, + E_BLOCK_STAIRS_WEST = 1, + E_BLOCK_STAIRS_SOUTH = 2, + E_BLOCK_STAIRS_NORTH = 3, + E_BLOCK_STAIRS_UPSIDE_DOWN = 4, // E_BLOCK_STONE metas: - E_META_STONE_STONE = 0, - E_META_STONE_GRANITE = 1, - E_META_STONE_POLISHED_GRANITE = 2, - E_META_STONE_DIORITE = 3, - E_META_STONE_POLISHED_DIORITE = 4, - E_META_STONE_ANDESITE = 5, - E_META_STONE_POLISHED_ANDESITE = 6, + E_META_STONE_STONE = 0, + E_META_STONE_GRANITE = 1, + E_META_STONE_POLISHED_GRANITE = 2, + E_META_STONE_DIORITE = 3, + E_META_STONE_POLISHED_DIORITE = 4, + E_META_STONE_ANDESITE = 5, + E_META_STONE_POLISHED_ANDESITE = 6, // E_BLOCK_STONE_SLAB metas: - E_META_STONE_SLAB_STONE = 0, - E_META_STONE_SLAB_SANDSTONE = 1, - E_META_STONE_SLAB_PLANKS = 2, - E_META_STONE_SLAB_COBBLESTONE = 3, - E_META_STONE_SLAB_BRICK = 4, - E_META_STONE_SLAB_STONE_BRICK = 5, - E_META_STONE_SLAB_NETHER_BRICK = 6, - E_META_STONE_SLAB_QUARTZ = 7, + E_META_STONE_SLAB_STONE = 0, + E_META_STONE_SLAB_SANDSTONE = 1, + E_META_STONE_SLAB_PLANKS = 2, + E_META_STONE_SLAB_COBBLESTONE = 3, + E_META_STONE_SLAB_BRICK = 4, + E_META_STONE_SLAB_STONE_BRICK = 5, + E_META_STONE_SLAB_NETHER_BRICK = 6, + E_META_STONE_SLAB_QUARTZ = 7, // E_BLOCK_STONE_BRICKS metas: E_META_STONE_BRICK_NORMAL = 0, @@ -689,10 +689,10 @@ enum E_META_STONE_BRICK_ORNAMENT = 3, // E_BLOCK_TALL_GRASS metas: - E_META_TALL_GRASS_DEAD_SHRUB = 0, - E_META_TALL_GRASS_GRASS = 1, - E_META_TALL_GRASS_FERN = 2, - E_META_TALL_GRASS_BIOME = 3, + E_META_TALL_GRASS_DEAD_SHRUB = 0, + E_META_TALL_GRASS_GRASS = 1, + E_META_TALL_GRASS_FERN = 2, + E_META_TALL_GRASS_BIOME = 3, // E_BLOCK_TORCH, E_BLOCK_REDSTONE_TORCH_OFF, E_BLOCK_REDSTONE_TORCH_ON metas: E_META_TORCH_EAST = 1, // east face of the block, pointing east @@ -706,22 +706,22 @@ enum E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block // E_BLOCK_WOOD metas: - E_BLOCK_WOOD_OAK_UP_DOWN = 0, - E_BLOCK_WOOD_SPRUCE_UP_DOWN = 1, - E_BLOCK_WOOD_BIRCH_UP_DOWN = 2, - E_BLOCK_WOOD_JUNGLE_UP_DOWN = 3, - E_BLOCK_WOOD_OAK_EAST_WEST = 4, - E_BLOCK_WOOD_SPRUCE_EAST_WEST = 5, - E_BLOCK_WOOD_BIRCH_EAST_WEST = 6, - E_BLOCK_WOOD_JUNGLE_EAST_WEST = 7, - E_BLOCK_WOOD_OAK_NORTH_SOUTH = 8, - E_BLOCK_WOOD_SPRUCE_NORTH_SOUTH = 9, - E_BLOCK_WOOD_BIRCH_NORTH_SOUTH = 10, - E_BLOCK_WOOD_JUNGLE_NORTH_SOUTH = 11, - E_BLOCK_WOOD_OAK_BARK_ONLY = 12, - E_BLOCK_WOOD_SPRUCE_BARK_ONLY = 13, - E_BLOCK_WOOD_BIRCH_BARK_ONLY = 14, - E_BLOCK_WOOD_JUNGLE_BARK_ONLY = 15, + E_BLOCK_WOOD_OAK_UP_DOWN = 0, + E_BLOCK_WOOD_SPRUCE_UP_DOWN = 1, + E_BLOCK_WOOD_BIRCH_UP_DOWN = 2, + E_BLOCK_WOOD_JUNGLE_UP_DOWN = 3, + E_BLOCK_WOOD_OAK_EAST_WEST = 4, + E_BLOCK_WOOD_SPRUCE_EAST_WEST = 5, + E_BLOCK_WOOD_BIRCH_EAST_WEST = 6, + E_BLOCK_WOOD_JUNGLE_EAST_WEST = 7, + E_BLOCK_WOOD_OAK_NORTH_SOUTH = 8, + E_BLOCK_WOOD_SPRUCE_NORTH_SOUTH = 9, + E_BLOCK_WOOD_BIRCH_NORTH_SOUTH = 10, + E_BLOCK_WOOD_JUNGLE_NORTH_SOUTH = 11, + E_BLOCK_WOOD_OAK_BARK_ONLY = 12, + E_BLOCK_WOOD_SPRUCE_BARK_ONLY = 13, + E_BLOCK_WOOD_BIRCH_BARK_ONLY = 14, + E_BLOCK_WOOD_JUNGLE_BARK_ONLY = 15, // E_BLOCK_WOOD metas cont. (Block ID 162): E_BLOCK_WOOD_ACACIA_UP_DOWN = 0, @@ -756,8 +756,8 @@ enum E_META_WOODEN_SLAB_JUNGLE = 3, E_META_WOODEN_SLAB_ACACIA = 4, E_META_WOODEN_SLAB_DARK_OAK = 5, - E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, - E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, + E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, + E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, // E_BLOCK_WOOL metas: E_META_WOOL_WHITE = 0, -- cgit v1.2.3 From a1b3e51aba7346f1a4cd7a1555cc8b9cd73b59e0 Mon Sep 17 00:00:00 2001 From: narroo Date: Tue, 20 May 2014 11:10:22 -0400 Subject: Fixed some E_META_*** Names --- src/BlockID.h | 138 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 67 insertions(+), 71 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index 8cc3f6397..32943ea67 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -490,38 +490,34 @@ enum E_META_HOPPER_FACING_XP = 5, // E_BLOCK_LEAVES metas: - E_META_LEAVES_APPLE = 0, - E_META_LEAVES_CONIFER = 1, - E_META_LEAVES_BIRCH = 2, - E_META_LEAVES_JUNGLE = 3, - E_META_LEAVES_APPLE_NO_DECAY = 4, - E_META_LEAVES_CONIFER_NO_DECAY = 5, - E_META_LEAVES_BIRCH_NO_DECAY = 6, - E_META_LEAVES_JUNGLE_NO_DECAY = 7, - E_META_LEAVES_APPLE_CHECK_DECAY = 8, - E_META_LEAVES_CONIFER_CHECK_DECAY = 9, - E_META_LEAVES_BIRCH_CHECK_DECAY = 10, - E_META_LEAVES_JUNGLE_CHECK_DECAY = 11, - E_META_LEAVES_APPLE_NO_DECAY_AND_CHECK_DECAY = 12, - E_META_LEAVES_CONIFER_NO_DECAY_AND_CHECK_DECAY = 13, - E_META_LEAVES_BIRCH_NO_DECAY_AND_CHECK_DECAY = 14, - E_META_LEAVES_JUNGLE_NO_DECAY_AND_CHECK_DECAY = 15, + E_META_NEWLEAVES_APPLE = 0, + E_META_NEWLEAVES_CONIFER = 1, + E_META_NEWLEAVES_BIRCH = 2, + E_META_NEWLEAVES_JUNGLE = 3, + E_META_NEWLEAVES_APPLE_NO_DECAY = 4, + E_META_NEWLEAVES_CONIFER_NO_DECAY = 5, + E_META_NEWLEAVES_BIRCH_NO_DECAY = 6, + E_META_NEWLEAVES_JUNGLE_NO_DECAY = 7, + E_META_NEWLEAVES_APPLE_CHECK_DECAY = 8, + E_META_NEWLEAVES_CONIFER_CHECK_DECAY = 9, + E_META_NEWLEAVES_BIRCH_CHECK_DECAY = 10, + E_META_NEWLEAVES_JUNGLE_CHECK_DECAY = 11, // E_BLOCK_LEAVES meta cont. (Block ID 161): - E_META_LEAVES_ACACIA = 0, - E_META_LEAVES_DARK_OAK = 1, - E_META_LEAVES_ACACIA_NO_DECAY = 4, - E_META_LEAVES_DARK_OAK_NO_DECAY = 5, - E_META_LEAVES_ACACIA_CHECK_DECAY = 8, - E_META_LEAVES_DARK_OAK_CHECK_DECAY = 9, - E_META_LEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, - E_META_LEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, + E_META_NEWLEAVES_ACACIA = 0, + E_META_NEWLEAVES_DARK_OAK = 1, + E_META_NEWLEAVES_ACACIA_NO_DECAY = 4, + E_META_NEWLEAVES_DARK_OAK_NO_DECAY = 5, + E_META_NEWLEAVES_ACACIA_CHECK_DECAY = 8, + E_META_NEWLEAVES_DARK_OAK_CHECK_DECAY = 9, + E_META_NEWLEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, + E_META_NEWLEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, // E_BLOCK_LOG metas: - E_META_LOG_APPLE = 0, - E_META_LOG_CONIFER = 1, - E_META_LOG_BIRCH = 2, - E_META_LOG_JUNGLE = 3, + E_META_NEWLOG_APPLE = 0, + E_META_NEWLOG_CONIFER = 1, + E_META_NEWLOG_BIRCH = 2, + E_META_NEWLOG_JUNGLE = 3, // E_BLOCK_NEW_LEAVES metas E_META_NEW_LEAVES_ACACIA_WOOD = 0, @@ -534,10 +530,10 @@ enum // E_BLOCK_PISTON metas: E_META_PISTON_DOWN = 0, E_META_PISTON_UP = 1, - E_META_PISTON_NORTH = 2, - E_META_PISTON_SOUTH = 3, - E_META_PISTON_WEST = 4, - E_META_PISTON_EAST = 5, + E_META_PISTON_ZM = 2, + E_META_PISTON_ZP = 3, + E_META_PISTON_XM = 4, + E_META_PISTON_XP = 5, E_META_PISTON_HEAD_STICKY = 8, E_META_PISTON_EXTENDED = 8, @@ -657,10 +653,10 @@ enum E_META_STAINED_GLASS_PANE_BLACK = 15, // E_BLOCK_STAIRS metas: - E_BLOCK_STAIRS_EAST = 0, - E_BLOCK_STAIRS_WEST = 1, - E_BLOCK_STAIRS_SOUTH = 2, - E_BLOCK_STAIRS_NORTH = 3, + E_BLOCK_STAIRS_XP = 0, + E_BLOCK_STAIRS_XM = 1, + E_BLOCK_STAIRS_ZP = 2, + E_BLOCK_STAIRS_ZM = 3, E_BLOCK_STAIRS_UPSIDE_DOWN = 4, // E_BLOCK_STONE metas: @@ -705,41 +701,41 @@ enum E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block - // E_BLOCK_WOOD metas: - E_BLOCK_WOOD_OAK_UP_DOWN = 0, - E_BLOCK_WOOD_SPRUCE_UP_DOWN = 1, - E_BLOCK_WOOD_BIRCH_UP_DOWN = 2, - E_BLOCK_WOOD_JUNGLE_UP_DOWN = 3, - E_BLOCK_WOOD_OAK_EAST_WEST = 4, - E_BLOCK_WOOD_SPRUCE_EAST_WEST = 5, - E_BLOCK_WOOD_BIRCH_EAST_WEST = 6, - E_BLOCK_WOOD_JUNGLE_EAST_WEST = 7, - E_BLOCK_WOOD_OAK_NORTH_SOUTH = 8, - E_BLOCK_WOOD_SPRUCE_NORTH_SOUTH = 9, - E_BLOCK_WOOD_BIRCH_NORTH_SOUTH = 10, - E_BLOCK_WOOD_JUNGLE_NORTH_SOUTH = 11, - E_BLOCK_WOOD_OAK_BARK_ONLY = 12, - E_BLOCK_WOOD_SPRUCE_BARK_ONLY = 13, - E_BLOCK_WOOD_BIRCH_BARK_ONLY = 14, - E_BLOCK_WOOD_JUNGLE_BARK_ONLY = 15, - - // E_BLOCK_WOOD metas cont. (Block ID 162): - E_BLOCK_WOOD_ACACIA_UP_DOWN = 0, - E_BLOCK_WOOD_DARK_OAK_UP_DOWN = 1, - E_BLOCK_WOOD_ACACIA_UP_DOWN = 2, - E_BLOCK_WOOD_DARK_OAK_UP_DOWN = 3, - E_BLOCK_WOOD_ACACIA_EAST_WEST = 4, - E_BLOCK_WOOD_DARK_OAK_EAST_WEST = 5, - E_BLOCK_WOOD_ACACIA_EAST_WEST = 6, - E_BLOCK_WOOD_DARK_OAK_EAST_WEST = 7, - E_BLOCK_WOOD_ACACIA_NORTH_SOUTH = 8, - E_BLOCK_WOOD_DARK_OAK_NORTH_SOUTH = 9, - E_BLOCK_WOOD_ACACIA_NORTH_SOUTH = 10, - E_BLOCK_WOOD_DARK_OAK_NORTH_SOUTH = 11, - E_BLOCK_WOOD_ACACIA_BARK_ONLY = 12, - E_BLOCK_WOOD_DARK_OAK_BARK_ONLY = 13, - E_BLOCK_WOOD_ACACIA_BARK_ONLY = 14, - E_BLOCK_WOOD_DARK_OAK_BARK_ONLY = 15, + // E_META_LOG metas: + E_META_NEWLOG_OAK_UP_DOWN = 0, + E_META_NEWLOG_SPRUCE_UP_DOWN = 1, + E_META_NEWLOG_BIRCH_UP_DOWN = 2, + E_META_NEWLOG_JUNGLE_UP_DOWN = 3, + E_META_NEWLOG_OAK_X = 4, + E_META_NEWLOG_SPRUCE_X = 5, + E_META_NEWLOG_BIRCH_X = 6, + E_META_NEWLOG_JUNGLE_X = 7, + E_META_NEWLOG_OAK_Z = 8, + E_META_NEWLOG_SPRUCE_Z = 9, + E_META_NEWLOG_BIRCH_Z = 10, + E_META_NEWLOG_JUNGLE_Z = 11, + E_META_NEWLOG_OAK_BARK_ONLY = 12, + E_META_NEWLOG_SPRUCE_BARK_ONLY = 13, + E_META_NEWLOG_BIRCH_BARK_ONLY = 14, + E_META_NEWLOG_JUNGLE_BARK_ONLY = 15, + + // E_META_NEWLOG metas cont. (Block ID 162): + E_META_NEWLOG_ACACIA_UP_DOWN = 0, + E_META_NEWLOG_DARK_OAK_UP_DOWN = 1, + E_META_NEWLOG_ACACIA_UP_DOWN = 2, + E_META_NEWLOG_DARK_OAK_UP_DOWN = 3, + E_META_NEWLOG_ACACIA_X = 4, + E_META_NEWLOG_DARK_OAK_X = 5, + E_META_NEWLOG_ACACIA_X = 6, + E_META_NEWLOG_DARK_OAK_X = 7, + E_META_NEWLOG_ACACIA_Z = 8, + E_META_NEWLOG_DARK_OAK_Z = 9, + E_META_NEWLOG_ACACIA_Z = 10, + E_META_NEWLOG_DARK_OAK_Z = 11, + E_META_NEWLOG_ACACIA_BARK_ONLY = 12, + E_META_NEWLOG_DARK_OAK_BARK_ONLY = 13, + E_META_NEWLOG_ACACIA_BARK_ONLY = 14, + E_META_NEWLOG_DARK_OAK_BARK_ONLY = 15, // E_BLOCK_WOODEN_DOUBLE_SLAB metas: E_META_WOODEN_DOUBLE_SLAB_APPLE = 0, -- cgit v1.2.3 From 6aa3c5ece86d864e4dac8f2632500bfc0e4dd89d Mon Sep 17 00:00:00 2001 From: narroo Date: Sat, 7 Jun 2014 20:24:31 -0400 Subject: Fixed E_META_...Typos in BlockID.h --- src/BlockID.h | 10 --- src/Blocks/BlockLeaves.h | 4 +- src/Generating/Trees.cpp | 156 +++++++++++++++++++++++------------------------ 3 files changed, 80 insertions(+), 90 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index 32943ea67..4f6b1afcc 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -510,8 +510,6 @@ enum E_META_NEWLEAVES_DARK_OAK_NO_DECAY = 5, E_META_NEWLEAVES_ACACIA_CHECK_DECAY = 8, E_META_NEWLEAVES_DARK_OAK_CHECK_DECAY = 9, - E_META_NEWLEAVES_ACACIA_NO_DECAY_CHECK_DECAY = 12, - E_META_NEWLEAVES_DARK_OAK_NO_DECAY_CHECK_DECAY = 13, // E_BLOCK_LOG metas: E_META_NEWLOG_APPLE = 0, @@ -722,20 +720,12 @@ enum // E_META_NEWLOG metas cont. (Block ID 162): E_META_NEWLOG_ACACIA_UP_DOWN = 0, E_META_NEWLOG_DARK_OAK_UP_DOWN = 1, - E_META_NEWLOG_ACACIA_UP_DOWN = 2, - E_META_NEWLOG_DARK_OAK_UP_DOWN = 3, E_META_NEWLOG_ACACIA_X = 4, E_META_NEWLOG_DARK_OAK_X = 5, - E_META_NEWLOG_ACACIA_X = 6, - E_META_NEWLOG_DARK_OAK_X = 7, E_META_NEWLOG_ACACIA_Z = 8, E_META_NEWLOG_DARK_OAK_Z = 9, - E_META_NEWLOG_ACACIA_Z = 10, - E_META_NEWLOG_DARK_OAK_Z = 11, E_META_NEWLOG_ACACIA_BARK_ONLY = 12, E_META_NEWLOG_DARK_OAK_BARK_ONLY = 13, - E_META_NEWLOG_ACACIA_BARK_ONLY = 14, - E_META_NEWLOG_DARK_OAK_BARK_ONLY = 15, // E_BLOCK_WOODEN_DOUBLE_SLAB metas: E_META_WOODEN_DOUBLE_SLAB_APPLE = 0, diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index d21227b07..d9d1bdb7e 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -47,7 +47,7 @@ public: } // 1 % chance of dropping an apple, if the leaves' type is Apple Leaves - if ((a_BlockMeta & 3) == E_META_LEAVES_APPLE) + if ((a_BlockMeta & 3) == E_META_NEWLEAVES_APPLE) { if (rand.NextInt(101) == 0) { @@ -64,7 +64,7 @@ public: // 0.5% chance of dropping an apple, if the leaves' type is Apple Leaves: NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); cFastRandom rand; - if (((Meta & 3) == E_META_LEAVES_APPLE) && (rand.NextInt(201) == 100)) + if (((Meta & 3) == E_META_NEWLEAVES_APPLE) && (rand.NextInt(201) == 100)) { cItems Drops; Drops.push_back(cItem(E_ITEM_RED_APPLE, 1, 0)); diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 4909587b1..5a71cf13c 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -304,31 +304,31 @@ void GetSmallAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a // Trunk: for (int i = 0; i < Height; i++) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_APPLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_APPLE)); } int Hei = a_BlockY + Height; // 2 BigO2 + corners layers: for (int i = 0; i < 2; i++) { - PushCoordBlocks (a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - PushCornerBlocks(a_BlockX, Hei, a_BlockZ, a_Seq, a_Noise, 0x5000000 - i * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LOG, E_META_LOG_APPLE)); + PushCoordBlocks (a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + PushCornerBlocks(a_BlockX, Hei, a_BlockZ, a_Seq, a_Noise, 0x5000000 - i * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_APPLE)); Hei++; } // for i - 2* // Optional BigO1 + corners layer: if ((Random & 1) == 0) { - PushCoordBlocks (a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - PushCornerBlocks(a_BlockX, Hei, a_BlockZ, a_Seq, a_Noise, 0x6000000, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LOG, E_META_LOG_APPLE)); + PushCoordBlocks (a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + PushCornerBlocks(a_BlockX, Hei, a_BlockZ, a_Seq, a_Noise, 0x6000000, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_APPLE)); Hei++; } // Top plus: - PushCoordBlocks(a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_APPLE)); + PushCoordBlocks(a_BlockX, Hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE)); } @@ -355,25 +355,25 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois // The entire trunk, out of logs: for (int i = Height - 1; i >= 0; --i) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_BIRCH)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_BIRCH)); } int h = a_BlockY + Height; // Top layer - just the Plus: - PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH)); // There's no log at this layer + PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH)); // There's no log at this layer h--; // Second layer - log, Plus and maybe Corners: - PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); + PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); h--; // Third and fourth layers - BigO2 and maybe 2*Corners: for (int Row = 0; Row < 2; Row++) { - PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); + PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); h--; } // for Row - 2* } @@ -411,25 +411,25 @@ void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_ // The entire trunk, out of logs: for (int i = Height - 1; i >= 0; --i) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_BIRCH)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_BIRCH)); } int h = a_BlockY + Height; // Top layer - just the Plus: - PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH)); // There's no log at this layer + PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH)); // There's no log at this layer h--; // Second layer - log, Plus and maybe Corners: - PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); + PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); h--; // Third and fourth layers - BigO2 and maybe 2*Corners: for (int Row = 0; Row < 2; Row++) { - PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); - PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); + PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); + PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_NEWLEAVES_BIRCH); h--; } // for Row - 2* } @@ -476,15 +476,15 @@ void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi // Clear trunk blocks: for (int i = 0; i < Height; i++) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); } Height += a_BlockY; // Optional size-1 bottom leaves layer: if ((MyRandom & 1) == 0) { - PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); Height++; } MyRandom >>= 1; @@ -500,30 +500,30 @@ void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi case 0: case 1: { - PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); Height += 2; break; } case 2: { - PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); Height += 2; break; } case 3: { - PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - PushCoordBlocks(a_BlockX, Height + 2, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); - a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 2, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + PushCoordBlocks(a_BlockX, Height, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + PushCoordBlocks(a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + PushCoordBlocks(a_BlockX, Height + 2, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, Height + 2, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); Height += 3; break; } @@ -534,17 +534,17 @@ void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi if ((MyRandom & 1) == 0) { // (0, 1, 0) top: - a_LogBlocks.push_back (sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); - PushCoordBlocks (a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 2, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); + a_LogBlocks.push_back (sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); + PushCoordBlocks (a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 2, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); } else { // (1, 0) top: - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); - PushCoordBlocks (a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); + PushCoordBlocks (a_BlockX, Height + 1, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, Height + 1, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); } } @@ -574,16 +574,16 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise // The entire trunk, out of logs: for (int i = TrunkHeight; i >= 0; --i) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_CONIFER)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_CONIFER)); } int h = a_BlockY + TrunkHeight + 2; // Top layer - just a single leaves block: - a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); h--; // One more layer is above the trunk, push the central leaves: - a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER)); // Layers expanding in size, then collapsing again: // LOGD("Generating %d layers of pine leaves, SameSizeMax = %d", NumLeavesLayers, SameSizeMax); @@ -596,7 +596,7 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise break; } ASSERT((size_t)LayerSize < ARRAYCOUNT(BigOs)); - PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigOs[LayerSize].Coords, BigOs[LayerSize].Count, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER); + PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigOs[LayerSize].Coords, BigOs[LayerSize].Count, E_BLOCK_LEAVES, E_META_NEWLEAVES_CONIFER); h--; } } @@ -623,7 +623,7 @@ void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois for (int i = 0; i < Height; i++) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_APPLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_APPLE)); } int hei = a_BlockY + Height - 2; @@ -633,17 +633,17 @@ void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois // The lower two leaves layers are BigO3 with log in the middle and possibly corners: for (int i = 0; i < 2; i++) { - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_APPLE); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); hei++; } // for i - 2* // The upper two leaves layers are BigO2 with leaves in the middle and possibly corners: for (int i = 0; i < 2; i++) { - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_APPLE); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_APPLE)); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE)); hei++; } // for i - 2* } @@ -657,15 +657,15 @@ void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois a_OtherBlocks.reserve(3 + ARRAYCOUNT(BigO2) + ARRAYCOUNT(BigO1)); int hei = a_BlockY; - a_LogBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE)); - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); + a_LogBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); hei++; - a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_APPLE)); - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_APPLE); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE)); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE); hei++; - a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_APPLE)); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_APPLE)); } @@ -709,10 +709,10 @@ void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & for (int i = 0; i < Height; i++) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE)); - a_LogBlocks.push_back(sSetBlock(a_BlockX + 1, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE)); - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ + 1, E_BLOCK_LOG, E_META_LOG_JUNGLE)); - a_LogBlocks.push_back(sSetBlock(a_BlockX + 1, a_BlockY + i, a_BlockZ + 1, E_BLOCK_LOG, E_META_LOG_JUNGLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX + 1, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ + 1, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX + 1, a_BlockY + i, a_BlockZ + 1, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); } int hei = a_BlockY + Height - 2; @@ -722,15 +722,15 @@ void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & // The lower two leaves layers are BigO4 with log in the middle and possibly corners: for (int i = 0; i < 2; i++) { - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO4, ARRAYCOUNT(BigO4), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO4, ARRAYCOUNT(BigO4), E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); hei++; } // for i - 2* // The top leaves layer is a BigO3 with leaves in the middle and possibly corners: - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE)); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE)); } @@ -762,7 +762,7 @@ void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & for (int i = 0; i < Height; i++) { - a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE)); + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_NEWLOG_JUNGLE)); } int hei = a_BlockY + Height - 3; @@ -772,22 +772,22 @@ void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & // The lower two leaves layers are BigO3 with log in the middle and possibly corners: for (int i = 0; i < 2; i++) { - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); hei++; } // for i - 2* // Two layers of BigO2 leaves, possibly with corners: for (int i = 0; i < 1; i++) { - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); hei++; } // for i - 2* // Top plus, all leaves: - PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); - a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE)); + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE); + a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_NEWLEAVES_JUNGLE)); } -- cgit v1.2.3 From 0019d17a11e2e5cd8ec066a321b8636ed9c3e9a3 Mon Sep 17 00:00:00 2001 From: narroo Date: Wed, 2 Jul 2014 16:35:03 -0400 Subject: Spacing fixes and a few more BLOCK_META constants. --- src/BlockID.h | 283 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 152 insertions(+), 131 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index 4f6b1afcc..655c8c712 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -401,13 +401,20 @@ enum /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Block metas: + // E_BLOCK_ANVIL metas + E_BLOCK_ANVIL_Z = 0, + E_BLOCK_ANVIL_X = 1, + E_BLOCK_ANVIL_NO_DAMAGE = 0, + E_BLOCK_ANVIL_LOW_DAMAGE = 4, + E_BLOCK_ANVIL_HIGH_DAMAGE = 8, + // E_BLOCK_BED metas: - E_BLOCK_BED_SOUTH = 0, - E_BLOCK_BED_WEST = 1, - E_BLOCK_BED_NORTH = 2, - E_BLOCK_BED_EAST = 3, - E_BLOCK_BED_OCCUPIED = 4, - E_BLOCK_BED_BED_HEAD = 8, + E_BLOCK_BED_ZP = 0, + E_BLOCK_BED_XM = 1, + E_BLOCK_BED_ZM = 2, + E_BLOCK_BED_XP = 3, + E_BLOCK_BED_OCCUPIED = 4, + E_BLOCK_BED_BED_HEAD = 8, // E_BLOCK_BIG_FLOWER metas E_META_BIG_FLOWER_SUNFLOWER = 0, @@ -417,6 +424,20 @@ enum E_META_BIG_FLOWER_ROSE_BUSH = 4, E_META_BIG_FLOWER_PEONY = 5, + // E_BLOCK_BREWING_STAND metas + E_META_BREWING_STAND_FILLED_SLOT_XP = 1, + E_META_BREWING_STAND_FILLED_SLOT_XM_ZP = 2, + E_META_BREWING_STAND_FILLED_SLOT_XM_ZM = 4, + + // E_BLOCK_BUTTON metas + E_BLOCK_BUTTON_YM = 0, + E_BLOCK_BUTTON_XP = 1, + E_BLOCK_BUTTON_XM = 2, + E_BLOCK_BUTTON_ZP = 3, + E_BLOCK_BUTTON_ZM = 4, + E_BLOCK_BUTTON_YP = 5, + E_BLOCK_BUTTON_PRESSED = 8, + // E_BLOCK_CARPET metas: E_META_CARPET_WHITE = 0, E_META_CARPET_ORANGE = 1, @@ -455,17 +476,17 @@ enum E_META_DROPSPENSER_FACING_XP = 5, // E_BLOCK_DOUBLE_STONE_SLAB metas: - E_META_DOUBLE_STONE_SLAB_STONE = 0, - E_META_DOUBLE_STONE_SLAB_SANDSTON = 1, - E_META_DOUBLE_STONE_SLAB_WOODEN = 2, - E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, - E_META_DOUBLE_STONE_SLAB_BRICK = 4, - E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, - E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, - E_META_DOUBLE_STONE_SLAB_QUARTZ = 7, - E_META_DOUBLE_STONE_SLAB_SMOOTH_STONE = 8, - E_META_DOUBLE_STONE_SLAB_SMOOTH_SANDSTONE = 9, - E_META_DOUBLE_STONE_SLAB_TILE_QUARTZ = 10, + E_META_DOUBLE_STONE_SLAB_STONE = 0, + E_META_DOUBLE_STONE_SLAB_SANDSTON = 1, + E_META_DOUBLE_STONE_SLAB_WOODEN = 2, + E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3, + E_META_DOUBLE_STONE_SLAB_BRICK = 4, + E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5, + E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6, + E_META_DOUBLE_STONE_SLAB_QUARTZ = 7, + E_META_DOUBLE_STONE_SLAB_SMOOTH_STONE = 8, + E_META_DOUBLE_STONE_SLAB_SMOOTH_SANDSTONE = 9, + E_META_DOUBLE_STONE_SLAB_TILE_QUARTZ = 10, // E_BLOCK_FLOWER metas E_META_FLOWER_POPPY = 0, @@ -478,8 +499,8 @@ enum E_META_FLOWER_OXEYE_DAISY = 8, // E_BLOCK_JUKEBOX metas - E_META_JUKEBOX_OFF = 0, - E_META_JUKEBOX_ON = 1, + E_META_JUKEBOX_OFF = 0, + E_META_JUKEBOX_ON = 1, // E_BLOCK_HOPPER metas: E_META_HOPPER_FACING_YM = 0, @@ -490,26 +511,26 @@ enum E_META_HOPPER_FACING_XP = 5, // E_BLOCK_LEAVES metas: - E_META_NEWLEAVES_APPLE = 0, - E_META_NEWLEAVES_CONIFER = 1, - E_META_NEWLEAVES_BIRCH = 2, - E_META_NEWLEAVES_JUNGLE = 3, - E_META_NEWLEAVES_APPLE_NO_DECAY = 4, - E_META_NEWLEAVES_CONIFER_NO_DECAY = 5, - E_META_NEWLEAVES_BIRCH_NO_DECAY = 6, - E_META_NEWLEAVES_JUNGLE_NO_DECAY = 7, - E_META_NEWLEAVES_APPLE_CHECK_DECAY = 8, + E_META_NEWLEAVES_APPLE = 0, + E_META_NEWLEAVES_CONIFER = 1, + E_META_NEWLEAVES_BIRCH = 2, + E_META_NEWLEAVES_JUNGLE = 3, + E_META_NEWLEAVES_APPLE_NO_DECAY = 4, + E_META_NEWLEAVES_CONIFER_NO_DECAY = 5, + E_META_NEWLEAVES_BIRCH_NO_DECAY = 6, + E_META_NEWLEAVES_JUNGLE_NO_DECAY = 7, + E_META_NEWLEAVES_APPLE_CHECK_DECAY = 8, E_META_NEWLEAVES_CONIFER_CHECK_DECAY = 9, - E_META_NEWLEAVES_BIRCH_CHECK_DECAY = 10, - E_META_NEWLEAVES_JUNGLE_CHECK_DECAY = 11, + E_META_NEWLEAVES_BIRCH_CHECK_DECAY = 10, + E_META_NEWLEAVES_JUNGLE_CHECK_DECAY = 11, // E_BLOCK_LEAVES meta cont. (Block ID 161): - E_META_NEWLEAVES_ACACIA = 0, - E_META_NEWLEAVES_DARK_OAK = 1, + E_META_NEWLEAVES_ACACIA = 0, + E_META_NEWLEAVES_DARK_OAK = 1, E_META_NEWLEAVES_ACACIA_NO_DECAY = 4, E_META_NEWLEAVES_DARK_OAK_NO_DECAY = 5, - E_META_NEWLEAVES_ACACIA_CHECK_DECAY = 8, - E_META_NEWLEAVES_DARK_OAK_CHECK_DECAY = 9, + E_META_NEWLEAVES_ACACIA_CHECK_DECAY = 8, + E_META_NEWLEAVES_DARK_OAK_CHECK_DECAY = 9, // E_BLOCK_LOG metas: E_META_NEWLOG_APPLE = 0, @@ -522,47 +543,47 @@ enum E_META_NEW_LEAVES_DARK_OAK_WOOD = 1, // E_BLOCK_NEW_LOG metas - E_META_NEW_LOG_ACACIA_WOOD = 0, - E_META_NEW_LOG_DARK_OAK_WOOD = 1, + E_META_NEW_LOG_ACACIA_WOOD = 0, + E_META_NEW_LOG_DARK_OAK_WOOD = 1, // E_BLOCK_PISTON metas: - E_META_PISTON_DOWN = 0, - E_META_PISTON_UP = 1, - E_META_PISTON_ZM = 2, - E_META_PISTON_ZP = 3, - E_META_PISTON_XM = 4, - E_META_PISTON_XP = 5, - E_META_PISTON_HEAD_STICKY = 8, - E_META_PISTON_EXTENDED = 8, + E_META_PISTON_DOWN = 0, + E_META_PISTON_U = 1, + E_META_PISTON_ZM = 2, + E_META_PISTON_ZP = 3, + E_META_PISTON_XM = 4, + E_META_PISTON_XP = 5, + E_META_PISTON_HEAD_STICKY = 8, + E_META_PISTON_EXTENDED = 8, // E_BLOCK_PLANKS metas: - E_META_PLANKS_APPLE = 0, - E_META_PLANKS_CONIFER = 1, - E_META_PLANKS_BIRCH = 2, - E_META_PLANKS_JUNGLE = 3, - E_META_PLANKS_ACACIA = 4, - E_META_PLANKS_DARK_OAK= 5, + E_META_PLANKS_APPLE = 0, + E_META_PLANKS_CONIFER = 1, + E_META_PLANKS_BIRCH = 2, + E_META_PLANKS_JUNGLE = 3, + E_META_PLANKS_ACACIA = 4, + E_META_PLANKS_DARK_OAK = 5, // E_BLOCK_(XXX_WEIGHTED)_PRESSURE_PLATE metas: - E_META_PRESSURE_PLATE_RAISED = 0, + E_META_PRESSURE_PLATE_RAISED = 0, E_META_PRESSURE_PLATE_DEPRESSED = 1, // E_BLOCK_QUARTZ_BLOCK metas: - E_META_QUARTZ_NORMAL = 0, + E_META_QUARTZ_NORMAL = 0, E_META_QUARTZ_CHISELLED = 1, - E_META_QUARTZ_PILLAR = 2, + E_META_QUARTZ_PILLAR = 2, // E_BLOCK_RAIL metas - E_META_RAIL_ZM_ZP = 0, - E_META_RAIL_XM_XP = 1, - E_META_RAIL_ASCEND_XP = 2, - E_META_RAIL_ASCEND_XM = 3, - E_META_RAIL_ASCEND_ZM = 4, - E_META_RAIL_ASCEND_ZP = 5, - E_META_RAIL_CURVED_ZP_XP = 6, - E_META_RAIL_CURVED_ZP_XM = 7, - E_META_RAIL_CURVED_ZM_XM = 8, - E_META_RAIL_CURVED_ZM_XP = 9, + E_META_RAIL_ZM_ZP = 0, + E_META_RAIL_XM_XP = 1, + E_META_RAIL_ASCEND_XP = 2, + E_META_RAIL_ASCEND_XM = 3, + E_META_RAIL_ASCEND_ZM = 4, + E_META_RAIL_ASCEND_ZP = 5, + E_META_RAIL_CURVED_ZP_XP = 6, + E_META_RAIL_CURVED_ZP_XM = 7, + E_META_RAIL_CURVED_ZM_XM = 8, + E_META_RAIL_CURVED_ZM_XP = 9, // E_BLOCK_SAND metas: E_META_SAND_NORMAL = 0, @@ -651,42 +672,42 @@ enum E_META_STAINED_GLASS_PANE_BLACK = 15, // E_BLOCK_STAIRS metas: - E_BLOCK_STAIRS_XP = 0, - E_BLOCK_STAIRS_XM = 1, - E_BLOCK_STAIRS_ZP = 2, - E_BLOCK_STAIRS_ZM = 3, + E_BLOCK_STAIRS_XP = 0, + E_BLOCK_STAIRS_XM = 1, + E_BLOCK_STAIRS_ZP = 2, + E_BLOCK_STAIRS_ZM = 3, E_BLOCK_STAIRS_UPSIDE_DOWN = 4, // E_BLOCK_STONE metas: - E_META_STONE_STONE = 0, - E_META_STONE_GRANITE = 1, - E_META_STONE_POLISHED_GRANITE = 2, - E_META_STONE_DIORITE = 3, - E_META_STONE_POLISHED_DIORITE = 4, - E_META_STONE_ANDESITE = 5, - E_META_STONE_POLISHED_ANDESITE = 6, + E_META_STONE_STONE = 0, + E_META_STONE_GRANITE = 1, + E_META_STONE_POLISHED_GRANITE = 2, + E_META_STONE_DIORITE = 3, + E_META_STONE_POLISHED_DIORITE = 4, + E_META_STONE_ANDESITE = 5, + E_META_STONE_POLISHED_ANDESITE = 6, // E_BLOCK_STONE_SLAB metas: - E_META_STONE_SLAB_STONE = 0, - E_META_STONE_SLAB_SANDSTONE = 1, - E_META_STONE_SLAB_PLANKS = 2, - E_META_STONE_SLAB_COBBLESTONE = 3, - E_META_STONE_SLAB_BRICK = 4, - E_META_STONE_SLAB_STONE_BRICK = 5, - E_META_STONE_SLAB_NETHER_BRICK = 6, - E_META_STONE_SLAB_QUARTZ = 7, + E_META_STONE_SLAB_STONE = 0, + E_META_STONE_SLAB_SANDSTONE = 1, + E_META_STONE_SLAB_PLANKS = 2, + E_META_STONE_SLAB_COBBLESTONE = 3, + E_META_STONE_SLAB_BRICK = 4, + E_META_STONE_SLAB_STONE_BRICK = 5, + E_META_STONE_SLAB_NETHER_BRICK = 6, + E_META_STONE_SLAB_QUARTZ = 7, // E_BLOCK_STONE_BRICKS metas: - E_META_STONE_BRICK_NORMAL = 0, - E_META_STONE_BRICK_MOSSY = 1, - E_META_STONE_BRICK_CRACKED = 2, - E_META_STONE_BRICK_ORNAMENT = 3, + E_META_STONE_BRICK_NORMAL = 0, + E_META_STONE_BRICK_MOSSY = 1, + E_META_STONE_BRICK_CRACKED = 2, + E_META_STONE_BRICK_ORNAMENT = 3, // E_BLOCK_TALL_GRASS metas: - E_META_TALL_GRASS_DEAD_SHRUB = 0, - E_META_TALL_GRASS_GRASS = 1, - E_META_TALL_GRASS_FERN = 2, - E_META_TALL_GRASS_BIOME = 3, + E_META_TALL_GRASS_DEAD_SHRUB = 0, + E_META_TALL_GRASS_GRASS = 1, + E_META_TALL_GRASS_FERN = 2, + E_META_TALL_GRASS_BIOME = 3, // E_BLOCK_TORCH, E_BLOCK_REDSTONE_TORCH_OFF, E_BLOCK_REDSTONE_TORCH_ON metas: E_META_TORCH_EAST = 1, // east face of the block, pointing east @@ -694,56 +715,56 @@ enum E_META_TORCH_SOUTH = 3, E_META_TORCH_NORTH = 4, E_META_TORCH_FLOOR = 5, - E_META_TORCH_XM = 1, // Torch attached to the XM side of its block - E_META_TORCH_XP = 2, // Torch attached to the XP side of its block - E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block - E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block + E_META_TORCH_XM = 1, // Torch attached to the XM side of its block + E_META_TORCH_XP = 2, // Torch attached to the XP side of its block + E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block + E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block // E_META_LOG metas: - E_META_NEWLOG_OAK_UP_DOWN = 0, - E_META_NEWLOG_SPRUCE_UP_DOWN = 1, - E_META_NEWLOG_BIRCH_UP_DOWN = 2, - E_META_NEWLOG_JUNGLE_UP_DOWN = 3, - E_META_NEWLOG_OAK_X = 4, - E_META_NEWLOG_SPRUCE_X = 5, - E_META_NEWLOG_BIRCH_X = 6, - E_META_NEWLOG_JUNGLE_X = 7, - E_META_NEWLOG_OAK_Z = 8, - E_META_NEWLOG_SPRUCE_Z = 9, - E_META_NEWLOG_BIRCH_Z = 10, - E_META_NEWLOG_JUNGLE_Z = 11, - E_META_NEWLOG_OAK_BARK_ONLY = 12, - E_META_NEWLOG_SPRUCE_BARK_ONLY = 13, - E_META_NEWLOG_BIRCH_BARK_ONLY = 14, - E_META_NEWLOG_JUNGLE_BARK_ONLY = 15, + E_META_NEWLOG_OAK_UP_DOWN = 0, + E_META_NEWLOG_SPRUCE_UP_DOWN = 1, + E_META_NEWLOG_BIRCH_UP_DOWN = 2, + E_META_NEWLOG_JUNGLE_UP_DOWN = 3, + E_META_NEWLOG_OAK_X = 4, + E_META_NEWLOG_SPRUCE_X = 5, + E_META_NEWLOG_BIRCH_X = 6, + E_META_NEWLOG_JUNGLE_X = 7, + E_META_NEWLOG_OAK_Z = 8, + E_META_NEWLOG_SPRUCE_Z = 9, + E_META_NEWLOG_BIRCH_Z = 10, + E_META_NEWLOG_JUNGLE_Z = 11, + E_META_NEWLOG_OAK_BARK_ONLY = 12, + E_META_NEWLOG_SPRUCE_BARK_ONLY = 13, + E_META_NEWLOG_BIRCH_BARK_ONLY = 14, + E_META_NEWLOG_JUNGLE_BARK_ONLY = 15, // E_META_NEWLOG metas cont. (Block ID 162): - E_META_NEWLOG_ACACIA_UP_DOWN = 0, - E_META_NEWLOG_DARK_OAK_UP_DOWN = 1, - E_META_NEWLOG_ACACIA_X = 4, - E_META_NEWLOG_DARK_OAK_X = 5, - E_META_NEWLOG_ACACIA_Z = 8, - E_META_NEWLOG_DARK_OAK_Z = 9, - E_META_NEWLOG_ACACIA_BARK_ONLY = 12, + E_META_NEWLOG_ACACIA_UP_DOWN = 0, + E_META_NEWLOG_DARK_OAK_UP_DOWN = 1, + E_META_NEWLOG_ACACIA_X = 4, + E_META_NEWLOG_DARK_OAK_X = 5, + E_META_NEWLOG_ACACIA_Z = 8, + E_META_NEWLOG_DARK_OAK_Z = 9, + E_META_NEWLOG_ACACIA_BARK_ONLY = 12, E_META_NEWLOG_DARK_OAK_BARK_ONLY = 13, // E_BLOCK_WOODEN_DOUBLE_SLAB metas: - E_META_WOODEN_DOUBLE_SLAB_APPLE = 0, - E_META_WOODEN_DOUBLE_SLAB_CONIFER = 1, - E_META_WOODEN_DOUBLE_SLAB_BIRCH = 2, - E_META_WOODEN_DOUBLE_SLAB_JUNGLE = 3, - E_META_WOODEN_DOUBLE_SLAB_ACACIA = 4, - E_META_WOODEN_DOUBLE_SLAB_DARK_OAK = 5, + E_META_WOODEN_DOUBLE_SLAB_APPLE = 0, + E_META_WOODEN_DOUBLE_SLAB_CONIFER = 1, + E_META_WOODEN_DOUBLE_SLAB_BIRCH = 2, + E_META_WOODEN_DOUBLE_SLAB_JUNGLE = 3, + E_META_WOODEN_DOUBLE_SLAB_ACACIA = 4, + E_META_WOODEN_DOUBLE_SLAB_DARK_OAK = 5, // E_BLOCK_WOODEN_SLAB metas: - E_META_WOODEN_SLAB_APPLE = 0, - E_META_WOODEN_SLAB_CONIFER = 1, - E_META_WOODEN_SLAB_BIRCH = 2, - E_META_WOODEN_SLAB_JUNGLE = 3, - E_META_WOODEN_SLAB_ACACIA = 4, - E_META_WOODEN_SLAB_DARK_OAK = 5, - E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, - E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, + E_META_WOODEN_SLAB_APPLE = 0, + E_META_WOODEN_SLAB_CONIFER = 1, + E_META_WOODEN_SLAB_BIRCH = 2, + E_META_WOODEN_SLAB_JUNGLE = 3, + E_META_WOODEN_SLAB_ACACIA = 4, + E_META_WOODEN_SLAB_DARK_OAK = 5, + E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, + E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, // E_BLOCK_WOOL metas: E_META_WOOL_WHITE = 0, -- cgit v1.2.3 From 12012d0c80fbee12de7e842b7976af6973960c45 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 29 Jul 2014 13:14:48 -0700 Subject: Renamed NEWLEAVES and NEWLOG to LEAVES and LOG. --- src/BlockID.h | 68 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index 9334b7310..b78c09f9c 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -512,18 +512,18 @@ enum E_META_HOPPER_FACING_XP = 5, // E_BLOCK_LEAVES metas: - E_META_NEWLEAVES_APPLE = 0, - E_META_NEWLEAVES_CONIFER = 1, - E_META_NEWLEAVES_BIRCH = 2, - E_META_NEWLEAVES_JUNGLE = 3, - E_META_NEWLEAVES_APPLE_NO_DECAY = 4, - E_META_NEWLEAVES_CONIFER_NO_DECAY = 5, - E_META_NEWLEAVES_BIRCH_NO_DECAY = 6, - E_META_NEWLEAVES_JUNGLE_NO_DECAY = 7, - E_META_NEWLEAVES_APPLE_CHECK_DECAY = 8, - E_META_NEWLEAVES_CONIFER_CHECK_DECAY = 9, - E_META_NEWLEAVES_BIRCH_CHECK_DECAY = 10, - E_META_NEWLEAVES_JUNGLE_CHECK_DECAY = 11, + E_META_LEAVES_APPLE = 0, + E_META_LEAVES_CONIFER = 1, + E_META_LEAVES_BIRCH = 2, + E_META_LEAVES_JUNGLE = 3, + E_META_LEAVES_APPLE_NO_DECAY = 4, + E_META_LEAVES_CONIFER_NO_DECAY = 5, + E_META_LEAVES_BIRCH_NO_DECAY = 6, + E_META_LEAVES_JUNGLE_NO_DECAY = 7, + E_META_LEAVES_APPLE_CHECK_DECAY = 8, + E_META_LEAVES_CONIFER_CHECK_DECAY = 9, + E_META_LEAVES_BIRCH_CHECK_DECAY = 10, + E_META_LEAVES_JUNGLE_CHECK_DECAY = 11, // E_BLOCK_LEAVES meta cont. (Block ID 161): E_META_NEWLEAVES_ACACIA = 0, @@ -534,10 +534,10 @@ enum E_META_NEWLEAVES_DARK_OAK_CHECK_DECAY = 9, // E_BLOCK_LOG metas: - E_META_NEWLOG_APPLE = 0, - E_META_NEWLOG_CONIFER = 1, - E_META_NEWLOG_BIRCH = 2, - E_META_NEWLOG_JUNGLE = 3, + E_META_LOG_APPLE = 0, + E_META_LOG_CONIFER = 1, + E_META_LOG_BIRCH = 2, + E_META_LOG_JUNGLE = 3, // E_BLOCK_NEW_LEAVES metas E_META_NEW_LEAVES_ACACIA_WOOD = 0, @@ -722,24 +722,24 @@ enum E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block // E_META_LOG metas: - E_META_NEWLOG_OAK_UP_DOWN = 0, - E_META_NEWLOG_SPRUCE_UP_DOWN = 1, - E_META_NEWLOG_BIRCH_UP_DOWN = 2, - E_META_NEWLOG_JUNGLE_UP_DOWN = 3, - E_META_NEWLOG_OAK_X = 4, - E_META_NEWLOG_SPRUCE_X = 5, - E_META_NEWLOG_BIRCH_X = 6, - E_META_NEWLOG_JUNGLE_X = 7, - E_META_NEWLOG_OAK_Z = 8, - E_META_NEWLOG_SPRUCE_Z = 9, - E_META_NEWLOG_BIRCH_Z = 10, - E_META_NEWLOG_JUNGLE_Z = 11, - E_META_NEWLOG_OAK_BARK_ONLY = 12, - E_META_NEWLOG_SPRUCE_BARK_ONLY = 13, - E_META_NEWLOG_BIRCH_BARK_ONLY = 14, - E_META_NEWLOG_JUNGLE_BARK_ONLY = 15, - - // E_META_NEWLOG metas cont. (Block ID 162): + E_META_LOG_OAK_UP_DOWN = 0, + E_META_LOG_SPRUCE_UP_DOWN = 1, + E_META_LOG_BIRCH_UP_DOWN = 2, + E_META_LOG_JUNGLE_UP_DOWN = 3, + E_META_LOG_OAK_X = 4, + E_META_LOG_SPRUCE_X = 5, + E_META_LOG_BIRCH_X = 6, + E_META_LOG_JUNGLE_X = 7, + E_META_LOG_OAK_Z = 8, + E_META_LOG_SPRUCE_Z = 9, + E_META_LOG_BIRCH_Z = 10, + E_META_LOG_JUNGLE_Z = 11, + E_META_LOG_OAK_BARK_ONLY = 12, + E_META_LOG_SPRUCE_BARK_ONLY = 13, + E_META_LOG_BIRCH_BARK_ONLY = 14, + E_META_LOG_JUNGLE_BARK_ONLY = 15, + + // E_META_LOG metas cont. (Block ID 162): E_META_NEWLOG_ACACIA_UP_DOWN = 0, E_META_NEWLOG_DARK_OAK_UP_DOWN = 1, E_META_NEWLOG_ACACIA_X = 4, -- cgit v1.2.3 From b5a2c6667ac0845d17a709cc436afb570079a9a7 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 3 Oct 2014 21:32:41 +0100 Subject: Improved furnaces * Fixed progress bar on 1.8 * Fixed bugs * Improved code * Fixes #1068 * Fixes #1070 --- src/BlockEntities/FurnaceEntity.cpp | 141 ++++++++++++------------------------ src/BlockEntities/FurnaceEntity.h | 110 ++++++++++++++++------------ src/Chunk.cpp | 2 +- src/Chunk.h | 2 +- src/ClientHandle.cpp | 2 +- src/ClientHandle.h | 2 +- src/Protocol/Protocol.h | 2 +- src/Protocol/Protocol17x.cpp | 2 +- src/Protocol/Protocol17x.h | 2 +- src/Protocol/Protocol18x.cpp | 2 +- src/Protocol/Protocol18x.h | 2 +- src/Protocol/ProtocolRecognizer.cpp | 2 +- src/Protocol/ProtocolRecognizer.h | 2 +- src/UI/Window.cpp | 23 ++---- src/UI/Window.h | 15 ++-- 15 files changed, 131 insertions(+), 180 deletions(-) diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp index 4452fc00a..222b27637 100644 --- a/src/BlockEntities/FurnaceEntity.cpp +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -5,6 +5,7 @@ #include "../UI/Window.h" #include "../Entities/Player.h" #include "../Root.h" +#include "Chunk.h" @@ -13,8 +14,9 @@ enum { - PROGRESSBAR_SMELTING = 0, - PROGRESSBAR_FUEL = 1, + PROGRESSBAR_FUEL = 0, + PROGRESSBAR_SMELTING = 2, + PROGRESSBAR_SMELTING_CONFIRM = 3, } ; @@ -23,7 +25,6 @@ enum cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) : super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), - m_BlockType(a_BlockType), m_BlockMeta(a_BlockMeta), m_CurrentRecipe(NULL), m_IsCooking((a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_LIT_FURNACE)), @@ -31,8 +32,7 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY m_TimeCooked(0), m_FuelBurnTime(0), m_TimeBurned(0), - m_LastProgressFuel(0), - m_LastProgressCook(0) + m_IsDestroyed(false) { m_Contents.AddListener(*this); } @@ -57,27 +57,28 @@ cFurnaceEntity::~cFurnaceEntity() void cFurnaceEntity::UsedBy(cPlayer * a_Player) { - if (GetWindow() == NULL) + cWindow * Window = GetWindow(); + if (Window == NULL) { OpenWindow(new cFurnaceWindow(m_PosX, m_PosY, m_PosZ, this)); + Window = GetWindow(); } - cWindow * Window = GetWindow(); + if (Window != NULL) { if (a_Player->GetWindow() != Window) { a_Player->OpenWindow(Window); - BroadcastProgress(PROGRESSBAR_FUEL, (short)m_LastProgressFuel); - BroadcastProgress(PROGRESSBAR_SMELTING, (short)m_LastProgressCook); } } + + UpdateProgressBars(true); } -/// Restarts cooking. Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active. Returns true if cooking. bool cFurnaceEntity::ContinueCooking(void) { UpdateInput(); @@ -92,14 +93,16 @@ bool cFurnaceEntity::ContinueCooking(void) bool cFurnaceEntity::Tick(float a_Dt, cChunk & a_Chunk) { UNUSED(a_Dt); - UNUSED(a_Chunk); + if (m_FuelBurnTime <= 0) { - // No fuel is burning, reset progressbars and bail out - if ((m_LastProgressCook > 0) || (m_LastProgressFuel > 0)) - { - UpdateProgressBars(); - } + // Cooked time decreases twice as fast when ran out of fuel + m_TimeCooked -= 2; + m_TimeCooked = std::max(m_TimeCooked, 0); + + // Reset progressbars, block type, and bail out + a_Chunk.FastSetBlock(GetRelX(), m_PosY, GetRelZ(), E_BLOCK_FURNACE, m_BlockMeta); + UpdateProgressBars(); return false; } @@ -139,12 +142,12 @@ void cFurnaceEntity::SendTo(cClientHandle & a_Client) -void cFurnaceEntity::BroadcastProgress(int a_ProgressbarID, short a_Value) +void cFurnaceEntity::BroadcastProgress(short a_ProgressbarID, short a_Value) { cWindow * Window = GetWindow(); if (Window != NULL) { - Window->BroadcastProgress(a_ProgressbarID, a_Value); + Window->SetProperty(a_ProgressbarID, a_Value); } } @@ -152,7 +155,6 @@ void cFurnaceEntity::BroadcastProgress(int a_ProgressbarID, short a_Value) -/// One item finished cooking void cFurnaceEntity::FinishOne() { m_TimeCooked = 0; @@ -166,8 +168,6 @@ void cFurnaceEntity::FinishOne() m_Contents.ChangeSlotCount(fsOutput, m_CurrentRecipe->Out->m_ItemCount); } m_Contents.ChangeSlotCount(fsInput, -m_CurrentRecipe->In->m_ItemCount); - - UpdateIsCooking(); } @@ -181,8 +181,7 @@ void cFurnaceEntity::BurnNewFuel(void) if (NewTime == 0) { // The item in the fuel slot is not suitable - m_FuelBurnTime = 0; - m_TimeBurned = 0; + SetBurnTimes(0, 0); SetIsCooking(false); return; } @@ -194,8 +193,7 @@ void cFurnaceEntity::BurnNewFuel(void) } // Burn one new fuel: - m_FuelBurnTime = NewTime; - m_TimeBurned = 0; + SetBurnTimes(NewTime, 0); SetIsCooking(true); if (m_Contents.GetSlot(fsFuel).m_ItemType == E_ITEM_LAVA_BUCKET) { @@ -214,33 +212,19 @@ void cFurnaceEntity::BurnNewFuel(void) void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) { super::OnSlotChanged(a_ItemGrid, a_SlotNum); - - if (m_World == NULL) + + if (m_IsDestroyed) { - // The furnace isn't initialized yet, do no processing return; } ASSERT(a_ItemGrid == &m_Contents); switch (a_SlotNum) { - case fsInput: - { - UpdateInput(); - break; - } - - case fsFuel: - { - UpdateFuel(); - break; - } - - case fsOutput: - { - UpdateOutput(); - break; - } + case fsInput: UpdateInput(); break; + case fsFuel: UpdateFuel(); break; + case fsOutput: UpdateOutput(); break; + default: ASSERT(!"Invalid furnace slot update!"); break; } } @@ -249,7 +233,6 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) -/// Updates the current recipe, based on the current input void cFurnaceEntity::UpdateInput(void) { if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput)) @@ -263,8 +246,8 @@ void cFurnaceEntity::UpdateInput(void) m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput)); if (!CanCookInputToOutput()) { - // This input cannot be cooked - m_NeedCookTime = 0; + // This input cannot be cooked, reset cook counter immediately + SetCookTimes(0, 0); SetIsCooking(false); } else @@ -284,7 +267,6 @@ void cFurnaceEntity::UpdateInput(void) -/// Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate void cFurnaceEntity::UpdateFuel(void) { if (m_FuelBurnTime > m_TimeBurned) @@ -301,14 +283,12 @@ void cFurnaceEntity::UpdateFuel(void) -/// Called when the output slot changes; starts burning if space became available void cFurnaceEntity::UpdateOutput(void) { if (!CanCookInputToOutput()) { // Cannot cook anymore: - m_TimeCooked = 0; - m_NeedCookTime = 0; + SetCookTimes(0, 0); SetIsCooking(false); return; } @@ -324,30 +304,6 @@ void cFurnaceEntity::UpdateOutput(void) -/// Updates the m_IsCooking, based on the input slot, output slot and m_FuelBurnTime / m_TimeBurned -void cFurnaceEntity::UpdateIsCooking(void) -{ - if ( - !CanCookInputToOutput() || // Cannot cook this - (m_FuelBurnTime <= 0) || // No fuel - (m_TimeBurned >= m_FuelBurnTime) // Fuel burnt out - ) - { - // Reset everything - SetIsCooking(false); - m_TimeCooked = 0; - m_NeedCookTime = 0; - return; - } - - SetIsCooking(true); -} - - - - - -/// Returns true if the input can be cooked into output and the item counts allow for another cooking operation bool cFurnaceEntity::CanCookInputToOutput(void) const { if (m_CurrentRecipe == NULL) @@ -382,25 +338,20 @@ bool cFurnaceEntity::CanCookInputToOutput(void) const -/// Broadcasts progressbar updates, if needed -void cFurnaceEntity::UpdateProgressBars(void) +void cFurnaceEntity::UpdateProgressBars(bool a_ForceUpdate) { // In order to preserve bandwidth, an update is sent only every 10th tick - // That's why the comparisons use the division by eight - - int CurFuel = (m_FuelBurnTime > 0) ? (200 - 200 * m_TimeBurned / m_FuelBurnTime) : 0; - if ((CurFuel / 8) != (m_LastProgressFuel / 8)) + if (!a_ForceUpdate && (m_World->GetWorldAge() % 10 != 0)) { - BroadcastProgress(PROGRESSBAR_FUEL, (short)CurFuel); - m_LastProgressFuel = CurFuel; + return; } - int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0; - if ((CurCook / 8) != (m_LastProgressCook / 8)) - { - BroadcastProgress(PROGRESSBAR_SMELTING, (short)CurCook); - m_LastProgressCook = CurCook; - } + int CurFuel = (m_FuelBurnTime > 0) ? 200 - (200 * m_TimeBurned / m_FuelBurnTime) : 0; + BroadcastProgress(PROGRESSBAR_FUEL, (short)CurFuel); + + int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0; + BroadcastProgress(PROGRESSBAR_SMELTING_CONFIRM, 200); // Post 1.8, Mojang requires a random packet with an ID of three and value of 200. Wat. Wat. Wat. + BroadcastProgress(PROGRESSBAR_SMELTING, (short)CurCook); } @@ -413,11 +364,13 @@ void cFurnaceEntity::SetIsCooking(bool a_IsCooking) { return; } - m_IsCooking = a_IsCooking; - - // Light or extinguish the furnace: - m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, m_IsCooking ? E_BLOCK_LIT_FURNACE : E_BLOCK_FURNACE, m_BlockMeta); + + // Only light the furnace as it is extinguished only when the fuel runs out, not when cooking stops - handled in this::Tick() + if (m_IsCooking) + { + m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, E_BLOCK_LIT_FURNACE, m_BlockMeta); + } } diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h index ed3317af6..14dadbec8 100644 --- a/src/BlockEntities/FurnaceEntity.h +++ b/src/BlockEntities/FurnaceEntity.h @@ -38,7 +38,7 @@ public: // tolua_end - /// Constructor used for normal operation + /** Constructor used for normal operation */ cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World); virtual ~cFurnaceEntity(); @@ -49,103 +49,117 @@ public: virtual void SendTo(cClientHandle & a_Client) override; virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; virtual void UsedBy(cPlayer * a_Player) override; + virtual void Destroy() override + { + m_IsDestroyed = true; + super::Destroy(); + } - /// Restarts cooking. Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active. Returns true if cooking. + /** Restarts cooking + Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active + Returns true if cooking */ bool ContinueCooking(void); - - void ResetCookTimer(); // tolua_begin - /// Returns the item in the input slot + /** Returns the item in the input slot */ const cItem & GetInputSlot(void) const { return GetSlot(fsInput); } - /// Returns the item in the fuel slot + /** Returns the item in the fuel slot */ const cItem & GetFuelSlot(void) const { return GetSlot(fsFuel); } - /// Returns the item in the output slot + /** Returns the item in the output slot */ const cItem & GetOutputSlot(void) const { return GetSlot(fsOutput); } - /// Sets the item in the input slot + /** Sets the item in the input slot */ void SetInputSlot(const cItem & a_Item) { SetSlot(fsInput, a_Item); } - /// Sets the item in the fuel slot + /** Sets the item in the fuel slot */ void SetFuelSlot(const cItem & a_Item) { SetSlot(fsFuel, a_Item); } - /// Sets the item in the output slot + /** Sets the item in the output slot */ void SetOutputSlot(const cItem & a_Item) { SetSlot(fsOutput, a_Item); } - /// Returns the time that the current item has been cooking, in ticks - int GetTimeCooked(void) const {return m_TimeCooked; } + /** Returns the time that the current item has been cooking, in ticks */ + int GetTimeCooked(void) const { return m_TimeCooked; } - /// Returns the time until the current item finishes cooking, in ticks + /** Returns the time until the current item finishes cooking, in ticks */ int GetCookTimeLeft(void) const { return m_NeedCookTime - m_TimeCooked; } - /// Returns the time until the current fuel is depleted, in ticks - int GetFuelBurnTimeLeft(void) const {return m_FuelBurnTime - m_TimeBurned; } + /** Returns the time until the current fuel is depleted, in ticks */ + int GetFuelBurnTimeLeft(void) const { return m_FuelBurnTime - m_TimeBurned; } - /// Returns true if there's time left before the current fuel is depleted + /** Returns true if there's time left before the current fuel is depleted */ bool HasFuelTimeLeft(void) const { return (GetFuelBurnTimeLeft() > 0); } // tolua_end - void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = a_TimeBurned; } - void SetCookTimes(int a_NeedCookTime, int a_TimeCooked) {m_NeedCookTime = a_NeedCookTime; m_TimeCooked = a_TimeCooked; } + void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) + { + m_FuelBurnTime = a_FuelBurnTime; + m_TimeBurned = a_TimeBurned; + } + + void SetCookTimes(int a_NeedCookTime, int a_TimeCooked) + { + m_NeedCookTime = a_NeedCookTime; + m_TimeCooked = a_TimeCooked; + } protected: - - /// Block type of the block currently represented by this entity (changes when furnace lights up) - BLOCKTYPE m_BlockType; - /// Block meta of the block currently represented by this entity + /** Block meta of the block currently represented by this entity */ NIBBLETYPE m_BlockMeta; - /// The recipe for the current input slot + /** The recipe for the current input slot */ const cFurnaceRecipe::cRecipe * m_CurrentRecipe; - /// The item that is being smelted + /** The item that is being smelted */ cItem m_LastInput; + + /** Set to true when the furnace entity has been destroyed to prevent the block being set again */ + bool m_IsDestroyed; - bool m_IsCooking; ///< Set to true if the furnace is cooking an item - - // All timers are in ticks - int m_NeedCookTime; ///< Amount of time needed to fully cook current item - int m_TimeCooked; ///< Amount of time that the current item has been cooking - int m_FuelBurnTime; ///< Amount of time that the current fuel can burn (in total); zero if no fuel burning - int m_TimeBurned; ///< Amount of time that the current fuel has been burning - - int m_LastProgressFuel; ///< Last value sent as the progress for the fuel - int m_LastProgressCook; ///< Last value sent as the progress for the cooking + /** Set to true if the furnace is cooking an item */ + bool m_IsCooking; + /** Amount of ticks needed to fully cook current item */ + int m_NeedCookTime; + + /** Amount of ticks that the current item has been cooking */ + int m_TimeCooked; + + /** Amount of ticks that the current fuel can burn (in total); zero if no fuel burning */ + int m_FuelBurnTime; + + /** Amount of ticks that the current fuel has been burning */ + int m_TimeBurned; - /// Sends the specified progressbar value to all clients of the window - void BroadcastProgress(int a_ProgressbarID, short a_Value); + /** Sends the specified progressbar value to all clients of the window */ + void BroadcastProgress(short a_ProgressbarID, short a_Value); - /// One item finished cooking + /** One item finished cooking */ void FinishOne(); - /// Starts burning a new fuel, if possible + /** Starts burning a new fuel, if possible */ void BurnNewFuel(void); - /// Updates the recipe, based on the current input + /** Updates the recipe, based on the current input */ void UpdateInput(void); - /// Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate + /** Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate */ void UpdateFuel(void); - /// Called when the output slot changes + /** Called when the output slot changes */ void UpdateOutput(void); - /// Updates the m_IsCooking, based on the input slot, output slot and m_FuelBurnTime / m_TimeBurned - void UpdateIsCooking(void); - - /// Returns true if the input can be cooked into output and the item counts allow for another cooking operation + /** Returns true if the input can be cooked into output and the item counts allow for another cooking operation */ bool CanCookInputToOutput(void) const; - /// Broadcasts progressbar updates, if needed - void UpdateProgressBars(void); + /** Broadcasts progressbar updates, if needed */ + void UpdateProgressBars(bool a_ForceUpdate = false); - /// Sets the m_IsCooking variable, updates the furnace block type based on the value + /** Sets the m_IsCooking variable, updates the furnace block type based on the value */ void SetIsCooking(bool a_IsCooking); // cItemGrid::cListener overrides: diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 96b8eda4e..88ee9ba31 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -333,7 +333,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData) { BLOCKTYPE EntityBlockType = (*itr)->GetBlockType(); BLOCKTYPE WorldBlockType = GetBlock((*itr)->GetRelX(), (*itr)->GetPosY(), (*itr)->GetRelZ()); - ASSERT(EntityBlockType == WorldBlockType); + ASSERT((EntityBlockType == E_BLOCK_FURNACE) ? ((EntityBlockType == E_BLOCK_FURNACE) || (EntityBlockType == E_BLOCK_LIT_FURNACE)) : (WorldBlockType == EntityBlockType)); } // for itr - m_BlockEntities #endif // _DEBUG diff --git a/src/Chunk.h b/src/Chunk.h index bc66b6528..8e13ff00e 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -33,7 +33,7 @@ class cChunkMap; class cBeaconEntity; class cBoundingBox; class cChestEntity; -class cCHunkDataCallback; +class cChunkDataCallback; class cCommandBlockEntity; class cDispenserEntity; class cFurnaceEntity; diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index a29bef0c0..359255a3e 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2694,7 +2694,7 @@ void cClientHandle::SendWindowOpen(const cWindow & a_Window) -void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cClientHandle::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 20592c190..674a8cafd 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -204,7 +204,7 @@ public: void SendWholeInventory (const cWindow & a_Window); void SendWindowClose (const cWindow & a_Window); void SendWindowOpen (const cWindow & a_Window); - void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value); + void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value); // tolua_begin const AString & GetUsername(void) const; diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 7225f663d..02a8a52f6 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -130,7 +130,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) = 0; virtual void SendWindowClose (const cWindow & a_Window) = 0; virtual void SendWindowOpen (const cWindow & a_Window) = 0; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) = 0; + virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) = 0; /// Returns the ServerID used for authentication through session.minecraft.net virtual AString GetAuthServerID(void) = 0; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index a7abd240f..204691ede 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -1439,7 +1439,7 @@ void cProtocol172::SendWindowOpen(const cWindow & a_Window) -void cProtocol172::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cProtocol172::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { ASSERT(m_State == 3); // In game mode? diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index 7709df59d..f939bfb5e 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -134,7 +134,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; virtual AString GetAuthServerID(void) override { return m_AuthServerID; } diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index acdb48cf7..c9118c239 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -1500,7 +1500,7 @@ void cProtocol180::SendWindowOpen(const cWindow & a_Window) -void cProtocol180::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cProtocol180::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { ASSERT(m_State == 3); // In game mode? diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h index 8c0b77a21..92d9825ef 100644 --- a/src/Protocol/Protocol18x.h +++ b/src/Protocol/Protocol18x.h @@ -133,7 +133,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; virtual AString GetAuthServerID(void) override { return m_AuthServerID; } diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 4f8eb59db..0b829ac9e 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -350,7 +350,7 @@ void cProtocolRecognizer::SendHealth(void) -void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { ASSERT(m_Protocol != NULL); m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 96a7e17d2..f60df4158 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -121,7 +121,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; virtual AString GetAuthServerID(void) override; diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp index d83336f75..802d0d219 100644 --- a/src/UI/Window.cpp +++ b/src/UI/Window.cpp @@ -758,20 +758,7 @@ void cWindow::BroadcastWholeWindow(void) -void cWindow::BroadcastProgress(int a_Progressbar, int a_Value) -{ - cCSLock Lock(m_CS); - for (cPlayerList::iterator itr = m_OpenedBy.begin(); itr != m_OpenedBy.end(); ++itr) - { - (*itr)->GetClientHandle()->SendWindowProperty(*this, a_Progressbar, a_Value); - } // for itr - m_OpenedBy[] -} - - - - - -void cWindow::SetProperty(int a_Property, int a_Value) +void cWindow::SetProperty(short a_Property, short a_Value) { cCSLock Lock(m_CS); for (cPlayerList::iterator itr = m_OpenedBy.begin(), end = m_OpenedBy.end(); itr != end; ++itr) @@ -784,7 +771,7 @@ void cWindow::SetProperty(int a_Property, int a_Value) -void cWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Player) +void cWindow::SetProperty(short a_Property, short a_Value, cPlayer & a_Player) { a_Player.GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value); } @@ -919,7 +906,7 @@ cEnchantingWindow::cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) : -void cEnchantingWindow::SetProperty(int a_Property, int a_Value) +void cEnchantingWindow::SetProperty(short a_Property, short a_Value) { if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue))) { @@ -935,7 +922,7 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value) -void cEnchantingWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Player) +void cEnchantingWindow::SetProperty(short a_Property, short a_Value, cPlayer & a_Player) { if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue))) { @@ -951,7 +938,7 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Pla -int cEnchantingWindow::GetPropertyValue(int a_Property) +short cEnchantingWindow::GetPropertyValue(short a_Property) { if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue))) { diff --git a/src/UI/Window.h b/src/UI/Window.h index 6b6dce346..26dd7f125 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -130,9 +130,6 @@ public: /// Sends the contents of the whole window to all clients of this window. void BroadcastWholeWindow(void); - - /// Sends the progressbar to all clients of this window (same as SetProperty) - void BroadcastProgress(int a_Progressbar, int a_Value); // tolua_begin @@ -140,10 +137,10 @@ public: void SetWindowTitle(const AString & a_WindowTitle) { m_WindowTitle = a_WindowTitle; } /// Sends the UpdateWindowProperty (0x69) packet to all clients of the window - virtual void SetProperty(int a_Property, int a_Value); + virtual void SetProperty(short a_Property, short a_Value); /// Sends the UpdateWindowPropert(0x69) packet to the specified player - virtual void SetProperty(int a_Property, int a_Value, cPlayer & a_Player); + virtual void SetProperty(short a_Property, short a_Value, cPlayer & a_Player); // tolua_end @@ -287,16 +284,16 @@ class cEnchantingWindow : typedef cWindow super; public: cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ); - virtual void SetProperty(int a_Property, int a_Value, cPlayer & a_Player) override; - virtual void SetProperty(int a_Property, int a_Value) override; + virtual void SetProperty(short a_Property, short a_Value, cPlayer & a_Player) override; + virtual void SetProperty(short a_Property, short a_Value) override; /** Return the Value of a Property */ - int GetPropertyValue(int a_Property); + short GetPropertyValue(short a_Property); cSlotArea * m_SlotArea; protected: - int m_PropertyValue[3]; + short m_PropertyValue[3]; int m_BlockX, m_BlockY, m_BlockZ; }; -- cgit v1.2.3 From 3d2d8a096b72a0af9d4e21198d112d97c9318410 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 5 Oct 2014 20:03:21 +0200 Subject: cMojangAPI: Added periodical refreshes. --- src/Protocol/MojangAPI.cpp | 130 ++++++++++++++++++++++++++++++++++++++------- src/Protocol/MojangAPI.h | 21 ++++++++ 2 files changed, 132 insertions(+), 19 deletions(-) diff --git a/src/Protocol/MojangAPI.cpp b/src/Protocol/MojangAPI.cpp index 28da83c31..0a6716e6f 100644 --- a/src/Protocol/MojangAPI.cpp +++ b/src/Protocol/MojangAPI.cpp @@ -11,6 +11,8 @@ #include "json/json.h" #include "PolarSSL++/BlockingSslClientSocket.h" #include "../RankManager.h" +#include "../OSSupport/IsThread.h" +#include "../Root.h" @@ -151,6 +153,41 @@ cMojangAPI::sProfile::sProfile( +//////////////////////////////////////////////////////////////////////////////// +// cMojangAPI::cUpdateThread: + +class cMojangAPI::cUpdateThread : + public cIsThread +{ + typedef cIsThread super; +public: + cUpdateThread() : + super("cMojangAPI::cUpdateThread") + { + } + + ~cUpdateThread() + { + m_evtNotify.Set(); + Stop(); + } + +protected: + cEvent m_evtNotify; + + virtual void Execute(void) override + { + do + { + cRoot::Get()->GetMojangAPI().Update(); + } while (!m_evtNotify.Wait(60 * 60 * 1000)); // Repeat every 60 minutes + } +} ; + + + + + //////////////////////////////////////////////////////////////////////////////// // cMojangAPI: @@ -159,7 +196,8 @@ cMojangAPI::cMojangAPI(void) : m_NameToUUIDAddress(DEFAULT_NAME_TO_UUID_ADDRESS), m_UUIDToProfileServer(DEFAULT_UUID_TO_PROFILE_SERVER), m_UUIDToProfileAddress(DEFAULT_UUID_TO_PROFILE_ADDRESS), - m_RankMgr(NULL) + m_RankMgr(NULL), + m_UpdateThread(new cUpdateThread()) { } @@ -183,6 +221,7 @@ void cMojangAPI::Start(cIniFile & a_SettingsIni) m_UUIDToProfileServer = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER); m_UUIDToProfileAddress = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS); LoadCachesFromDisk(); + m_UpdateThread->Start(); } @@ -465,21 +504,7 @@ void cMojangAPI::LoadCachesFromDisk(void) db.exec("CREATE TABLE IF NOT EXISTS PlayerNameToUUID (PlayerName, UUID, DateTime)"); db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)"); - // Clean up old entries: - { - SQLite::Statement stmt(db, "DELETE FROM PlayerNameToUUID WHERE DateTime < ?"); - Int64 LimitDateTime = time(NULL) - MAX_AGE; - stmt.bind(1, LimitDateTime); - stmt.exec(); - } - { - SQLite::Statement stmt(db, "DELETE FROM UUIDToProfile WHERE DateTime < ?"); - Int64 LimitDateTime = time(NULL) - MAX_AGE; - stmt.bind(1, LimitDateTime); - stmt.exec(); - } - - // Retrieve all remaining entries: + // Retrieve all entries: { SQLite::Statement stmt(db, "SELECT PlayerName, UUID, DateTime FROM PlayerNameToUUID"); while (stmt.executeStep()) @@ -596,18 +621,27 @@ void cMojangAPI::CacheNamesToUUIDs(const AStringVector & a_PlayerNames) } // for itr - a_PlayerNames[] } // Lock(m_CSNameToUUID) - while (!NamesToQuery.empty()) + QueryNamesToUUIDs(NamesToQuery); +} + + + + + +void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) +{ + while (!a_NamesToQuery.empty()) { // Create the request body - a JSON containing up to MAX_PER_QUERY playernames: Json::Value root; int Count = 0; - AStringVector::iterator itr = NamesToQuery.begin(), end = NamesToQuery.end(); + AStringVector::iterator itr = a_NamesToQuery.begin(), end = a_NamesToQuery.end(); for (; (itr != end) && (Count < MAX_PER_QUERY); ++itr, ++Count) { Json::Value req(*itr); root.append(req); } // for itr - a_PlayerNames[] - NamesToQuery.erase(NamesToQuery.begin(), itr); + a_NamesToQuery.erase(a_NamesToQuery.begin(), itr); Json::FastWriter Writer; AString RequestBody = Writer.write(root); @@ -705,12 +739,22 @@ void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID) // Check if already present: { + cCSLock Lock(m_CSUUIDToProfile); if (m_UUIDToProfile.find(a_UUID) != m_UUIDToProfile.end()) { return; } } + QueryUUIDToProfile(a_UUID); +} + + + + + +void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID) +{ // Create the request address: AString Address = m_UUIDToProfileAddress; ReplaceString(Address, "%UUID%", a_UUID); @@ -817,3 +861,51 @@ void cMojangAPI::NotifyNameUUID(const AString & a_PlayerName, const AString & a_ + +void cMojangAPI::Update(void) +{ + Int64 LimitDateTime = time(NULL) - MAX_AGE; + + // Re-query all playernames that are stale: + AStringVector PlayerNames; + { + cCSLock Lock(m_CSNameToUUID); + for (cProfileMap::const_iterator itr = m_NameToUUID.begin(), end = m_NameToUUID.end(); itr != end; ++itr) + { + if (itr->second.m_DateTime < LimitDateTime) + { + PlayerNames.push_back(itr->first); + } + } // for itr - m_NameToUUID[] + } + if (!PlayerNames.empty()) + { + LOG("cMojangAPI: Updating name-to-uuid cache for %u names", (unsigned)PlayerNames.size()); + QueryNamesToUUIDs(PlayerNames); + } + + // Re-query all profiles that are stale: + AStringVector ProfileUUIDs; + { + cCSLock Lock(m_CSUUIDToProfile); + for (cProfileMap::const_iterator itr = m_UUIDToProfile.begin(), end = m_UUIDToProfile.end(); itr != end; ++itr) + { + if (itr->second.m_DateTime < LimitDateTime) + { + ProfileUUIDs.push_back(itr->first); + } + } // for itr - m_UUIDToProfile[] + } + if (!ProfileUUIDs.empty()) + { + LOG("cMojangAPI: Updating uuid-to-profile cache for %u uuids", (unsigned)ProfileUUIDs.size()); + for (AStringVector::const_iterator itr = ProfileUUIDs.begin(), end = ProfileUUIDs.end(); itr != end; ++itr) + { + QueryUUIDToProfile(*itr); + } + } +} + + + + diff --git a/src/Protocol/MojangAPI.h b/src/Protocol/MojangAPI.h index 252d32543..fa4c16e4e 100644 --- a/src/Protocol/MojangAPI.h +++ b/src/Protocol/MojangAPI.h @@ -93,6 +93,10 @@ public: void SetRankManager(cRankManager * a_RankManager) { m_RankMgr = a_RankManager; } protected: + /** The thread that periodically checks for stale data and re-queries it from the server. */ + class cUpdateThread; + + /** Holds data for a single player profile. */ struct sProfile { @@ -177,6 +181,9 @@ protected: /** Protects m_RankMgr agains simultaneous multi-threaded access. */ cCriticalSection m_CSRankMgr; + + /** The thread that periodically updates the stale data in the DB from the Mojang servers. */ + SharedPtr m_UpdateThread; /** Loads the caches from a disk storage. */ @@ -189,15 +196,29 @@ protected: Names that are not valid are not added into the cache. ASSUMEs that a_PlayerNames contains lowercased player names. */ void CacheNamesToUUIDs(const AStringVector & a_PlayerNames); + + /** Queries all the specified names and stores them into the m_PlayerNameToUUID cache. + Names that are not valid are not added into the cache. + ASSUMEs that a_PlayerNames contans lowercased player names. + For performance reasons takes a non-const reference and modifies the list given to it, until empty. */ + void QueryNamesToUUIDs(AStringVector & a_PlayerNames); /** Makes sure the specified UUID is in the m_UUIDToProfile cache. If missing, downloads it from Mojang API servers. UUIDs that are not valid will not be added into the cache. ASSUMEs that a_UUID is a lowercased short UUID. */ void CacheUUIDToProfile(const AString & a_UUID); + /** Queries the specified UUID's profile and stores it in the m_UUIDToProfile cache. If already present, updates the cache entry. + UUIDs that are not valid will not be added into the cache. + ASSUMEs that a_UUID is a lowercased short UUID. */ + void QueryUUIDToProfile(const AString & a_UUID); + /** Called for each name-uuid pairing that is discovered. If assigned, notifies the m_RankManager of the event. */ void NotifyNameUUID(const AString & a_PlayerName, const AString & a_PlayerUUID); + + /** Updates the stale values in the DB from the Mojang servers. Called from the cUpdateThread, blocks on the HTTPS API calls. */ + void Update(void); } ; // tolua_export -- cgit v1.2.3 From e3a69a527d53fd7540dce4a424d280a9d0cbb1a9 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 7 Oct 2014 15:02:51 +0200 Subject: Removed unused cBlockHayBaleHandler. --- src/Blocks/BlockHandler.cpp | 3 +-- src/Blocks/BlockHayBale.h | 22 ---------------------- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 src/Blocks/BlockHayBale.h diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index ff0b201e7..904e0a921 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -36,7 +36,6 @@ #include "BlockGlass.h" #include "BlockGlowstone.h" #include "BlockGravel.h" -#include "BlockHayBale.h" #include "BlockMobHead.h" #include "BlockHopper.h" #include "BlockIce.h" @@ -231,7 +230,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_GLASS_PANE: return new cBlockGlassHandler (a_BlockType); case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType); case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType); - case E_BLOCK_HAY_BALE: return new cBlockHayBaleHandler (a_BlockType); + case E_BLOCK_HAY_BALE: return new cBlockSidewaysHandler (a_BlockType); case E_BLOCK_HEAD: return new cBlockMobHeadHandler (a_BlockType); case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: return new cBlockPressurePlateHandler(a_BlockType); case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType); diff --git a/src/Blocks/BlockHayBale.h b/src/Blocks/BlockHayBale.h deleted file mode 100644 index 8150b10d3..000000000 --- a/src/Blocks/BlockHayBale.h +++ /dev/null @@ -1,22 +0,0 @@ - -#pragma once - -#include "BlockSideways.h" - - - - - -class cBlockHayBaleHandler : - public cBlockSidewaysHandler -{ -public: - cBlockHayBaleHandler(BLOCKTYPE a_BlockType) - : cBlockSidewaysHandler(a_BlockType) - { - } -} ; - - - - -- cgit v1.2.3 From fec509935dce9c51d597c58cba2acdd558d7ae53 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 7 Oct 2014 15:39:24 +0200 Subject: Removed BlockHaybale.h from CMakeLists.txt --- src/Blocks/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt index 9f971a8bd..eed949aab 100644 --- a/src/Blocks/CMakeLists.txt +++ b/src/Blocks/CMakeLists.txt @@ -45,7 +45,6 @@ SET (HDRS BlockGlowstone.h BlockGravel.h BlockHandler.h - BlockHayBale.h BlockHopper.h BlockIce.h BlockLadder.h -- cgit v1.2.3 From 20f2d80c593a94ffac973fd49d97cd44c770981b Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 17:25:14 +0100 Subject: Updated Buildserver URLs. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9763e49a9..09ff5d796 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Installation Normally, you will want to download a pre-compiled version of MCServer from one of the buildservers: - * [Windows and Linux](http://builds.mc-server.org) - * [Raspberry Pi](http://ci.bearbin.net) + * [Windows and Linux](http://builds.cuberite.org) + * [Raspberry Pi](http://builds.cuberite.org) You simply need to download and extract these files before you can use the server. -- cgit v1.2.3 From 68a54c90c9408f2b3351e778a632b024e1433984 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Oct 2014 20:31:16 +0200 Subject: Added AcaciaTrees for the savanna biomes --- src/Generating/Trees.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 1b0f2dc14..c78a30f9b 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -224,8 +224,6 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No case biMegaTaiga: case biMegaTaigaHills: case biExtremeHillsPlus: - case biSavanna: - case biSavannaPlateau: case biMesa: case biMesaPlateauF: case biMesaPlateau: @@ -241,8 +239,6 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No case biMegaSpruceTaiga: case biMegaSpruceTaigaHills: case biExtremeHillsPlusM: - case biSavannaM: - case biSavannaPlateauM: case biMesaBryce: case biMesaPlateauFM: case biMesaPlateauM: @@ -252,6 +248,15 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No return; } + case biSavanna: + case biSavannaPlateau: + case biSavannaM: + case biSavannaPlateauM: + { + GetAcaciaTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks); + return; + } + case biRoofedForest: case biRoofedForestM: { @@ -403,7 +408,53 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks) { - // TODO + int Height = 2 + (a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) / 11 % 3); + + // Create the trunk + for (int i = 0; i < Height; i++) + { + a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); + } + + Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + Vector3i BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ * a_Seq) % 3 - 1); + int Attempts = 0; + while (BranchDirection.Length() == 0.0) + { + Attempts++; + BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * Attempts, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY * Attempts, a_BlockZ * a_Seq) % 3 - 1); + } + BranchDirection.y = 1; + + int BranchHeight = a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 3 + 1; + for (int i = 0; i < BranchHeight; i++) + { + BranchPos = BranchPos + BranchDirection; + a_LogBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y, BranchPos.z, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); + } + + PushCoordBlocks(BranchPos.x, BranchPos.y, BranchPos.z, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); + PushCoordBlocks(BranchPos.x, BranchPos.y + 1, BranchPos.z, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); + a_OtherBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y + 1, BranchPos.z, E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD)); + + bool TwoTop = (a_Noise.IntNoise3D(a_BlockX, a_BlockY, a_BlockZ) < 0 ? true : false); + if (!TwoTop) + { + return; + } + + BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + BranchDirection = Vector3d(-BranchDirection.x, 1, -BranchDirection.z); + BranchHeight = a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * a_Seq * 10, a_BlockZ * a_Seq) % 3 + 1; + for (int i = 0; i < BranchHeight; i++) + { + BranchPos = BranchPos + BranchDirection; + a_LogBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y, BranchPos.z, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); + } + + PushCoordBlocks(BranchPos.x, BranchPos.y, BranchPos.z, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); + PushCoordBlocks(BranchPos.x, BranchPos.y + 1, BranchPos.z, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); + a_OtherBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y + 1, BranchPos.z, E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD)); } -- cgit v1.2.3 From 36fa1c5c73ba273051904d539e82d1f8f33a50d7 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Oct 2014 21:25:59 +0200 Subject: Using array with possible directions. --- src/Generating/Trees.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index c78a30f9b..8fce61b95 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -416,15 +416,16 @@ void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); } - Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); - Vector3i BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ * a_Seq) % 3 - 1); - int Attempts = 0; - while (BranchDirection.Length() == 0.0) + const Vector3i AvailableDirections[] = { - Attempts++; - BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * Attempts, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY * Attempts, a_BlockZ * a_Seq) % 3 - 1); - } - BranchDirection.y = 1; + { -1, 1, 0 }, { 0, 1, -1 }, + { -1, 1, 1 }, { -1, 1, -1 }, + { 1, 1, 1 }, { 1, 1, -1 }, + { 1, 1, 0 }, { 0, 1, 1 }, + }; + + Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + Vector3i BranchDirection = AvailableDirections[a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 8]; int BranchHeight = a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 3 + 1; for (int i = 0; i < BranchHeight; i++) -- cgit v1.2.3 From e95ee55974b674d7f026bae3beac7836da74efba Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 8 Oct 2014 21:32:09 +0200 Subject: Added comments to the GetAcaciaTreeImage function --- src/Generating/Trees.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 8fce61b95..7fd6d6f07 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -408,6 +408,7 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks) { + // Calculate a base height int Height = 2 + (a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) / 11 % 3); // Create the trunk @@ -416,6 +417,7 @@ void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); } + // Array with possible directions for a branch to go to. const Vector3i AvailableDirections[] = { { -1, 1, 0 }, { 0, 1, -1 }, @@ -424,35 +426,51 @@ void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi { 1, 1, 0 }, { 0, 1, 1 }, }; + // Set the starting point of the branch Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + + // Get a direction for the trunk to go to. Vector3i BranchDirection = AvailableDirections[a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 8]; + // Calculate a height for the branch between 1 and 3 int BranchHeight = a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 3 + 1; + + // Place the logs of the branch. for (int i = 0; i < BranchHeight; i++) { BranchPos = BranchPos + BranchDirection; a_LogBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y, BranchPos.z, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); } + // Add the leaves to the top of the branch PushCoordBlocks(BranchPos.x, BranchPos.y, BranchPos.z, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); PushCoordBlocks(BranchPos.x, BranchPos.y + 1, BranchPos.z, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); a_OtherBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y + 1, BranchPos.z, E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD)); + // Choose if we have to add another branch bool TwoTop = (a_Noise.IntNoise3D(a_BlockX, a_BlockY, a_BlockZ) < 0 ? true : false); if (!TwoTop) { return; } + // Reset the starting point of the branch BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + + // Invert the direction of the previous branch. BranchDirection = Vector3d(-BranchDirection.x, 1, -BranchDirection.z); + + // Calculate a new height for the second branch BranchHeight = a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * a_Seq * 10, a_BlockZ * a_Seq) % 3 + 1; + + // Place the logs in the same way as the first branch for (int i = 0; i < BranchHeight; i++) { BranchPos = BranchPos + BranchDirection; a_LogBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y, BranchPos.z, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); } + // And add the leaves ontop of the second branch PushCoordBlocks(BranchPos.x, BranchPos.y, BranchPos.z, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); PushCoordBlocks(BranchPos.x, BranchPos.y + 1, BranchPos.z, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD); a_OtherBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y + 1, BranchPos.z, E_BLOCK_NEW_LEAVES, E_META_NEW_LEAVES_ACACIA_WOOD)); -- cgit v1.2.3 From de41e2a04cfae499e89f7edd96e160d854f6602c Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:04:26 +0100 Subject: Removed ChunkWorx --- MCServer/Plugins/ChunkWorx/ChunkWorx.deproj | 9 - MCServer/Plugins/ChunkWorx/chunkworx_main.lua | 128 ------------ MCServer/Plugins/ChunkWorx/chunkworx_web.lua | 274 -------------------------- 3 files changed, 411 deletions(-) delete mode 100644 MCServer/Plugins/ChunkWorx/ChunkWorx.deproj delete mode 100644 MCServer/Plugins/ChunkWorx/chunkworx_main.lua delete mode 100644 MCServer/Plugins/ChunkWorx/chunkworx_web.lua diff --git a/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj b/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj deleted file mode 100644 index 17420d1d7..000000000 --- a/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - chunkworx_main.lua - - - chunkworx_web.lua - - diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua deleted file mode 100644 index 88ecb3979..000000000 --- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua +++ /dev/null @@ -1,128 +0,0 @@ --- Global variables -PLUGIN = {} -- Reference to own plugin object -GENERATION_STATE = 0 -OPERATION_CODE = 0 -- 0 = generation -CX = 0 -CZ = 0 -CURRENT = 0 -TOTAL = 0 - --- AREA Variables -AreaStartX = -10 -AreaStartZ = -10 -AreaEndX = 10 -AreaEndZ = 10 - --- RADIAL Variables -RadialX = 0 -RadialZ = 0 -Radius = 10 - --- WORLD -WORK_WORLD = cRoot:Get():GetDefaultWorld():GetName() -WW_instance = cRoot:Get():GetDefaultWorld() -WORLDS = {} - - - - - -function Initialize(Plugin) - PLUGIN = Plugin - - PLUGIN:SetName("ChunkWorx") - PLUGIN:SetVersion(6) - - cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick) - - Plugin:AddWebTab("(Re)Generation", HandleRequest_Generation) - - GENERATION_STATE = 0 - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - if (WW_instance == nil) then - LOG("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": NO WORLD found :(") - end - - -- Read the stored values: - local SettingsIni = cIniFile(); - SettingsIni:ReadFile("ChunkWorx.ini"); -- ignore any read errors - AreaStartX = SettingsIni:GetValueSetI("Area data", "StartX", AreaStartX) - AreaStartZ = SettingsIni:GetValueSetI("Area data", "StartZ", AreaStartZ) - AreaEndX = SettingsIni:GetValueSetI("Area data", "EndX", AreaEndX) - AreaEndZ = SettingsIni:GetValueSetI("Area data", "EndZ", AreaEndZ) - RadialX = SettingsIni:GetValueSetI("Radial data", "RadialX", RadialX) - RadialZ = SettingsIni:GetValueSetI("Radial data", "RadialZ", RadialZ) - Radius = SettingsIni:GetValueSetI("Radial data", "Radius", Radius) - SettingsIni:WriteFile("ChunkWorx.ini"); - - LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion()) - return true -end - - - - - -function OnTick( DeltaTime ) - if (GENERATION_STATE == 1 or GENERATION_STATE == 3) then - LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works STARTED!") - LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": At world: " .. WORK_WORLD) - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - if (GENERATION_STATE == 1) then GENERATION_STATE = 2 end - if (GENERATION_STATE == 3) then GENERATION_STATE = 4 end - - -- Changing in case coordinates are flipped - local shifter = AreaEndX - if (AreaStartX > AreaEndX) then - AreaEndX = AreaStartX - AreaStartX = shifter - end - shifter = AreaEndZ - if (AreaStartZ > AreaEndZ) then - AreaEndZ = AreaStartZ - AreaStartZ = shifter - end - - CX = AreaStartX - CZ = AreaStartZ - CURRENT = 0 - - if (WW_instance == nil) then - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED") - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": NO WORLD found :(") - GENERATION_STATE = 0 - end - end - - - - if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then - if (WW_instance:GetGeneratorQueueLength() < 200 - and WW_instance:GetLightingQueueLength() < 200 - and (WW_instance:GetStorageSaveQueueLength() + WW_instance:GetStorageLoadQueueLength()) < 80) then - local chunk_sum = (1+ AreaEndX - AreaStartX) * (1+ AreaEndZ - AreaStartZ) - TOTAL = chunk_sum - LOG("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": PROCESSING 100 chunks, (" .. CURRENT .. "/" .. chunk_sum .. ")") - for C = 1, 100 do - if (GENERATION_STATE == 2) then WW_instance:GenerateChunk(CX, CZ) end - if (GENERATION_STATE == 4) then WW_instance:RegenerateChunk(CX, CZ) end - - CX = CX + 1 - CURRENT = CURRENT + 1 - if (CX > AreaEndX) then - CX = AreaStartX - CZ = CZ + 1 - if (CZ > AreaEndZ) then - if (GENERATION_STATE == 2) then LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " - generation ENDED!") end - if (GENERATION_STATE == 4) then LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " - REgeneration ENDED!") end - - GENERATION_STATE = 0 - break - end - end - end - WW_instance:QueueSaveAllChunks() - WW_instance:QueueUnloadUnusedChunks() - end - end -end \ No newline at end of file diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua deleted file mode 100644 index 9aec38b12..000000000 --- a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua +++ /dev/null @@ -1,274 +0,0 @@ - --- chunkworx_web.lua - --- WebAdmin-related functions - - - - - -local function Buttons_Player( Name ) - return "
" -end - - - - - -local function Button_World( Name ) - return "
" -end - - - - - -local function SaveSettings() - local SettingsIni = cIniFile() - SettingsIni:SetValueI("Area data", "StartX", AreaStartX) - SettingsIni:SetValueI("Area data", "StartZ", AreaStartZ) - SettingsIni:SetValueI("Area data", "EndX", AreaEndX) - SettingsIni:SetValueI("Area data", "EndZ", AreaEndZ) - SettingsIni:SetValueI("Radial data", "RadialX", RadialX) - SettingsIni:SetValueI("Radial data", "RadialZ", RadialZ) - SettingsIni:SetValueI("Radial data", "Radius", Radius) - SettingsIni:WriteFile("ChunkWorx.ini") -end - - - - - -function HandleRequest_Generation( Request ) - local Content = "" - if (Request.PostParams["AGHRRRR"] ~= nil) then - GENERATION_STATE = 0 - WW_instance:QueueSaveAllChunks() - WW_instance:QueueUnloadUnusedChunks() - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED by admin") - end - --Content = Content .. "" - -- PROCESSING - -------------------------------------------------------------------------------------------------- - local function ProcessingContent() - local _small_content = "" - _small_content = _small_content .. "" - _small_content = _small_content .. "

World for operations:

"..WORK_WORLD - if (OPERATION_CODE == 0) then - _small_content = _small_content .. "

Operation:

Generation" - elseif (OPERATION_CODE == 1) then - _small_content = _small_content .. "

Operation:

Regeneration" - end - _small_content = _small_content .. "

Area:

["..AreaStartX..":"..AreaStartZ.."] ["..AreaEndX..":"..AreaEndZ.."]" - _small_content = _small_content .. "

Progress:

"..CURRENT.."/"..TOTAL - _small_content = _small_content .. "
" - _small_content = _small_content .. "
" - _small_content = _small_content .. "" - _small_content = _small_content .. "
" - return _small_content - end - if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then - Content = ProcessingContent() - return Content - end - -- SELECTING - -------------------------------------------------------------------------------------------------- - if ( Request.PostParams["FormSetWorld"] ) then - WORK_WORLD = Request.PostParams["FormWorldName"] - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - end - - if( Request.PostParams["SelectWorld"] ~= nil - and Request.PostParams["WorldName"] ~= nil ) then -- World is selected! - WORK_WORLD = Request.PostParams["WorldName"] - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - end - - if(Request.PostParams["OperationGenerate"] ~= nil) then - OPERATION_CODE = 0 - end - if(Request.PostParams["OperationReGenerate"] ~= nil) then - OPERATION_CODE = 1 - end - - if (GENERATION_STATE == 0) then - if( Request.PostParams["FormAreaStartX"] ~= nil - and Request.PostParams["FormAreaStartZ"] ~= nil - and Request.PostParams["FormAreaEndX"] ~= nil - and Request.PostParams["FormAreaEndZ"] ~= nil ) then --(Re)Generation valid! - -- COMMON (Re)gen - if( Request.PostParams["StartArea"]) then - AreaStartX = tonumber(Request.PostParams["FormAreaStartX"]) - AreaStartZ = tonumber(Request.PostParams["FormAreaStartZ"]) - AreaEndX = tonumber(Request.PostParams["FormAreaEndX"]) - AreaEndZ = tonumber(Request.PostParams["FormAreaEndZ"]) - SaveSettings(); - if (OPERATION_CODE == 0) then - GENERATION_STATE = 1 - elseif (OPERATION_CODE == 1) then - GENERATION_STATE = 3 - end - Content = ProcessingContent() - return Content - end - end - if( Request.PostParams["FormRadialX"] ~= nil - and Request.PostParams["FormRadialZ"] ~= nil - and Request.PostParams["FormRadius"] ~= nil ) then --(Re)Generation valid! - -- COMMON (Re)gen - if( Request.PostParams["StartRadial"]) then - RadialX = tonumber(Request.PostParams["FormRadialX"]) or 0 - RadialZ = tonumber(Request.PostParams["FormRadialZ"]) or 0 - Radius = tonumber(Request.PostParams["FormRadius"]) or 10 - AreaStartX = RadialX - Radius - AreaStartZ = RadialZ - Radius - AreaEndX = RadialX + Radius - AreaEndZ = RadialZ + Radius - SaveSettings() - if (OPERATION_CODE == 0) then - GENERATION_STATE = 1 - elseif (OPERATION_CODE == 1) then - GENERATION_STATE = 3 - end - Content = ProcessingContent() - return Content - end - end - -- POINT REGEN! - if( Request.PostParams["FormPointX"] ~= nil - and Request.PostParams["FormPointZ"] ~= nil ) then --ReGeneration valid! - -- EXACT - if ( Request.PostParams["PointExact"] ~= nil) then - AreaStartX = tonumber(Request.PostParams["FormPointX"]) - AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - AreaEndX = AreaStartX - AreaEndZ = AreaStartZ - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - -- 3x3 - if ( Request.PostParams["Point3x3"] ~= nil) then - AreaStartX = tonumber(Request.PostParams["FormPointX"]) - 1 - AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - 1 - AreaEndX = AreaStartX + 2 - AreaEndZ = AreaStartZ + 2 - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - end - - local GetAreaByPlayer = function(Player) - -- Player is valid only within this function, it cannot be stord and used later! - AreaStartX = Player:GetChunkX() - AreaStartZ = Player:GetChunkZ() - end - -- PLAYERS REGEN! - if( Request.PostParams["PlayerExact"] ~= nil - and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) - AreaEndX = AreaStartX - AreaEndZ = AreaStartZ - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - if( Request.PostParams["Player3x3"] ~= nil - and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) - AreaStartX = AreaStartX - 1 - AreaStartZ = AreaStartZ - 1 - AreaEndX = AreaStartX + 2 - AreaEndZ = AreaStartZ + 2 - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - end - - --Content = Content .. "

World for operations: " .. WORK_WORLD .. "

" - --Content = Content .. "
" - --Content = Content .. "" - --Content = Content .. "
" - - -- SELECTING WORK_WORLD - Content = Content .. "

World for operations: " .. WORK_WORLD .. "

" - Content = Content .. "" - local WorldNum = 0 - local AddWorldToTable = function(World) - WorldNum = WorldNum + 1 - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - end - cRoot:Get():ForEachWorld(AddWorldToTable) - if( WorldNum == 0 ) then - Content = Content .. "" - end - Content = Content .. "
" .. WorldNum .. "." .. World:GetName() .. "" .. Button_World(World:GetName()) .. "
No worlds! O_O
" - Content = Content .. "
" - - -- SELECTING OPERATION - if (OPERATION_CODE == 0) then - Content = Content .. "

Operation: Generation

" - elseif (OPERATION_CODE == 1) then - Content = Content .. "

Operation: Regeneration

" - end - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING AREA - Content = Content .. "

Area:

Start X, Start Z; End X, End Z" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING RADIAL - Content = Content .. "

Radial:

Center X, Center Z, Radius" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - Content = Content .. "
" - Content = Content .. "
" - Content = Content .. "
" - - -- SELECTING POINT - Content = Content .. "

Point regeneration:

X, Z" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING PLAYERS - Content = Content .. "

Player-based regeneration:

" - Content = Content .. "" - local PlayerNum = 0 - local AddPlayerToTable = function( Player ) - PlayerNum = PlayerNum + 1 - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - end - if (cRoot:Get():GetWorld(WORK_WORLD) == nil) then - Content = Content .. "" - else - cRoot:Get():GetWorld(WORK_WORLD):ForEachPlayer( AddPlayerToTable ) - if( PlayerNum == 0 ) then - Content = Content .. "" - end - end - Content = Content .. "
" .. PlayerNum .. "." .. Player:GetName() .. "" .. Buttons_Player(Player:GetName()) .. "
Incorrect world selection
No connected players
" - Content = Content .. "
" - return Content -end \ No newline at end of file -- cgit v1.2.3 From ce11888851f7531d23db8aa10045b4babb9def88 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:05:24 +0100 Subject: Added chunkWorx. --- .gitmodules | 3 +++ MCServer/Plugins/ChunkWorx | 1 + 2 files changed, 4 insertions(+) create mode 160000 MCServer/Plugins/ChunkWorx diff --git a/.gitmodules b/.gitmodules index 33649023e..d3e575177 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "lib/SQLiteCpp"] path = lib/SQLiteCpp url = https://github.com/mc-server/SQLiteCpp.git +[submodule "MCServer/Plugins/ChunkWorx"] + path = MCServer/Plugins/ChunkWorx + url = https://github.com/mc-server/ChunkWorx.git diff --git a/MCServer/Plugins/ChunkWorx b/MCServer/Plugins/ChunkWorx new file mode 160000 index 000000000..894c7e320 --- /dev/null +++ b/MCServer/Plugins/ChunkWorx @@ -0,0 +1 @@ +Subproject commit 894c7e32049e9d2a1e736f7d721aaacd1ae29e53 -- cgit v1.2.3 From 8f625867f72ea5865616a14c628a21d494bac27e Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:07:55 +0100 Subject: Removed ChatLog. --- MCServer/Plugins/ChatLog/plugin.lua | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 MCServer/Plugins/ChatLog/plugin.lua diff --git a/MCServer/Plugins/ChatLog/plugin.lua b/MCServer/Plugins/ChatLog/plugin.lua deleted file mode 100644 index adbf986e0..000000000 --- a/MCServer/Plugins/ChatLog/plugin.lua +++ /dev/null @@ -1,31 +0,0 @@ - --- plugin.lua - --- Implements the main entrypoint for the plugin, as well as all the handling needed - --- ChatLog plugin logs all chat messages into the server log - - - - - -function Initialize(Plugin) - Plugin:SetName("ChatLog") - Plugin:SetVersion(3) - - cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat) - - LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) - return true -end - - - - - -function OnChat(Player, Message) - -- Lets get loggin' - LOGINFO("[" .. Player:GetName() .. "]: " .. StripColorCodes(Message)); - - return false -end \ No newline at end of file -- cgit v1.2.3 From 3b68949cc92d1b059516c4467faa7d648d802f50 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:08:21 +0100 Subject: Added ChatLog --- .gitmodules | 9 ++++++--- MCServer/Plugins/ChatLog | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) create mode 160000 MCServer/Plugins/ChatLog diff --git a/.gitmodules b/.gitmodules index d3e575177..1992d88d8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,12 +7,15 @@ [submodule "MCServer/Plugins/TransAPI"] path = MCServer/Plugins/TransAPI url = https://github.com/bearbin/transapi.git +[submodule "MCServer/Plugins/ChunkWorx"] + path = MCServer/Plugins/ChunkWorx + url = https://github.com/mc-server/ChunkWorx.git [submodule "lib/polarssl"] path = lib/polarssl url = https://github.com/mc-server/polarssl.git [submodule "lib/SQLiteCpp"] path = lib/SQLiteCpp url = https://github.com/mc-server/SQLiteCpp.git -[submodule "MCServer/Plugins/ChunkWorx"] - path = MCServer/Plugins/ChunkWorx - url = https://github.com/mc-server/ChunkWorx.git +[submodule "MCServer/Plugins/ChatLog"] + path = MCServer/Plugins/ChatLog + url = https://github.com/mc-server/ChatLog.git diff --git a/MCServer/Plugins/ChatLog b/MCServer/Plugins/ChatLog new file mode 160000 index 000000000..983d23ca3 --- /dev/null +++ b/MCServer/Plugins/ChatLog @@ -0,0 +1 @@ +Subproject commit 983d23ca37baa89f7e4dc11d71502d9c059f6376 -- cgit v1.2.3 From ccbd5ba6a2cf75cfa3a11e74464fc5943468127f Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:11:09 +0100 Subject: Added Handy. --- .gitmodules | 3 + MCServer/Plugins/Handy | 1 + MCServer/Plugins/Handy/handy.lua | 28 ---- MCServer/Plugins/Handy/handy_functions.lua | 216 ----------------------------- 4 files changed, 4 insertions(+), 244 deletions(-) create mode 160000 MCServer/Plugins/Handy delete mode 100644 MCServer/Plugins/Handy/handy.lua delete mode 100644 MCServer/Plugins/Handy/handy_functions.lua diff --git a/.gitmodules b/.gitmodules index 1992d88d8..a4ff5efaf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "MCServer/Plugins/ChatLog"] path = MCServer/Plugins/ChatLog url = https://github.com/mc-server/ChatLog.git +[submodule "MCServer/Plugins/Handy"] + path = MCServer/Plugins/Handy + url = https://github.com/mc-server/Handy.git diff --git a/MCServer/Plugins/Handy b/MCServer/Plugins/Handy new file mode 160000 index 000000000..e64a04be3 --- /dev/null +++ b/MCServer/Plugins/Handy @@ -0,0 +1 @@ +Subproject commit e64a04be39ac7790abcb09de3d4c7d8fc2a2a1e2 diff --git a/MCServer/Plugins/Handy/handy.lua b/MCServer/Plugins/Handy/handy.lua deleted file mode 100644 index e4e9d3f5f..000000000 --- a/MCServer/Plugins/Handy/handy.lua +++ /dev/null @@ -1,28 +0,0 @@ --- Global variables -PLUGIN = {} -- Reference to own plugin object -CHEST_WIDTH = 9 -HANDY_VERSION = 2 ---[[ - -Handy is a plugin for other plugins. It contain no commands, no hooks, but functions to ease plugins developers' life. - -API: - - -TODO: -1. GetChestSlot wrapper, so it will detect double chest neighbour chest and will be able to access it. -]] - -function Initialize(Plugin) - PLUGIN = Plugin - PLUGIN:SetName("Handy") - PLUGIN:SetVersion(HANDY_VERSION) - - PluginManager = cRoot:Get():GetPluginManager() - LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion()) - return true -end - -function OnDisable() - LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...") -end \ No newline at end of file diff --git a/MCServer/Plugins/Handy/handy_functions.lua b/MCServer/Plugins/Handy/handy_functions.lua deleted file mode 100644 index af43f663a..000000000 --- a/MCServer/Plugins/Handy/handy_functions.lua +++ /dev/null @@ -1,216 +0,0 @@ ---[[ -General stuff -]] --- Returns Handy plugin version number -function GetHandyVersion() - return HANDY_VERSION -end --- Checks if handy is in proper version -function CheckForRequiredVersion( inVersion ) - if( inVersion > HANDY_VERSION ) then return false end - return true -end ---[[ -MCS-specific _functions and nasty hacks :D -]] -function GetChestHeightCheat( inChest ) - local chestGrid = inChest:GetContents() - LOGINFO( "This function serves no purpose now! You should consider chest:GetContents():GetHeight() now!" ) - LOGINFO( "Also, you might find Handy's new 'IsChestDouble()' useful for your case" ) - return chestGrid:GetHeight() -end -function IsChestDouble( inChest ) - local chestHeight = inChest:GetContents():GetHeight() - if( chestHeight == 3 ) then - return false - end - return true -end --- Those two checks how many items of given inItemID chest and player have, and how much they could fit inside them -function ReadChestForItem( inChest, inItemID ) - return ReadGridForItems( inChest:GetContents(), inItemID ) -end -function ReadPlayerForItem( inPlayer, inItemID ) - local inventoryFound, inventoryFree = ReadGridForItems( inPlayer:GetInventory():GetInventoryGrid(), inItemID ) - local hotbarFound, hotbarFree = ReadGridForItems( inPlayer:GetInventory():GetHotbarGrid(), inItemID ) - local itemsFound = inventoryFound + hotbarFound - local freeSpace = inventoryFree + hotbarFree - return itemsFound, freeSpace -end --- Following functions are for chest-related operations --- BEWARE! Those assume you did checked if chest has items/space in it! -function ReadGridForItems( inGrid, inItemID ) - local itemsFound = 0 - local freeSpace = 0 - local slotsCount = inGrid:GetNumSlots() - local testerItem = cItem( inItemID ) - local maxStackSize = testerItem:GetMaxStackSize() - for index = 0, (slotsCount - 1) do - slotItem = inGrid:GetSlot( index ) - if( slotItem:IsEmpty() ) then - freeSpace = freeSpace + maxStackSize - else - if( slotItem:IsStackableWith( testerItem ) ) then - itemsFound = itemsFound + slotItem.m_ItemCount - freeSpace = maxStackSize - slotItem.m_ItemCount - end - end - end - return itemsFound, freeSpace -end - -function TakeItemsFromGrid( inGrid, inItem ) - local slotsCount = inGrid:GetNumSlots() - local removedItem = cItem( inItem ) - for index = 0, (slotsCount - 1) do - slotItem = inGrid:GetSlot( index ) - if( slotItem:IsSameType( removedItem ) ) then - if( slotItem.m_ItemCount <= removedItem.m_ItemCount ) then - removedItem.m_ItemCount = removedItem.m_ItemCount - slotItem.m_ItemCount - inGrid:EmptySlot( index ) - else - removedItem.m_ItemCount = slotItem.m_ItemCount - removedItem.m_ItemCount - inGrid:SetSlot( index, removedItem ) - removedItem.m_ItemCount = 0 - end - if( removedItem.m_ItemCount <= 0 ) then break end - end - end - return removedItem.m_ItemCount -end --------------- -function TakeItemsFromChest( inChest, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FOR ITEMS FIRST!! - local chestGrid = inChest:GetContents() - local removedItem = cItem( inItemID, inAmount ) - TakeItemsFromGrid( chestGrid, removedItem ) -end -function PutItemsToChest( inChest, inItemID, inAmount ) - local chestGrid = inChest:GetContents() - local addedItem = cItem( inItemID, inAmount ) - chestGrid:AddItem( addedItem ) -end --- Similar to chest-related. -function TakeItemsFromPlayer( inPlayer, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FIRST! - local removedItem = cItem( inItemID, inAmount ) - local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid() - local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid() - local itemsLeft = TakeItemsFromGrid( inventoryGrid, removedItem ) - if( itemsLeft > 0 ) then - removedItem = cItem( inItemID, itemsLeft ) - TakeItemsFromGrid( hotbarGrid, removedItem ) - end -end -function GiveItemsToPlayer( inPlayer, inItemID, inAmount ) - local addedItem = cItem( inItemID, inAmount ) - local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid() - local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid() - local itemsAdded = inventoryGrid:AddItem( addedItem ) - if( itemsAdded < inAmount ) then - addedItem.m_ItemCount = addedItem.m_ItemCount - itemsAdded - hotbarGrid:AddItem( addedItem ) - end -end --- This function returns item max stack for a given itemID. It uses vanilla max stack size, and uses several non-common items notations; --- Those are: --- oneonerecord( because aparently 11record wasn't the best idea in lua scripting application ) --- carrotonastick( because it wasn't added to items.txt yet ) --- waitrecord( for same reason ) --- Feel free to ignore the difference, or to add those to items.txt -function GetItemMaxStack( inItemID ) - local testerItem = cItem( inItemID ) - LOGINFO( "This function serves no real purpose now, maybe consider using cItem:GetMaxStackSize()?" ) - return testerItem:GetMaxStackSize() -end -function ItemIsArmor( inItemID, inCheckForHorseArmor ) - inCheckForHorseArmor = inCheckForHorseArmor or false - if( inItemID == E_ITEM_LEATHER_CAP ) then return true end - if( inItemID == E_ITEM_LEATHER_TUNIC ) then return true end - if( inItemID == E_ITEM_LEATHER_PANTS ) then return true end - if( inItemID == E_ITEM_LEATHER_BOOTS ) then return true end - - if( inItemID == E_ITEM_CHAIN_HELMET ) then return true end - if( inItemID == E_ITEM_CHAIN_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_CHAIN_LEGGINGS ) then return true end - if( inItemID == E_ITEM_CHAIN_BOOTS ) then return true end - - if( inItemID == E_ITEM_IRON_HELMET ) then return true end - if( inItemID == E_ITEM_IRON_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_IRON_LEGGINGS ) then return true end - if( inItemID == E_ITEM_IRON_BOOTS ) then return true end - - if( inItemID == E_ITEM_DIAMOND_HELMET ) then return true end - if( inItemID == E_ITEM_DIAMOND_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_DIAMOND_LEGGINGS ) then return true end - if( inItemID == E_ITEM_DIAMOND_BOOTS ) then return true end - - if( inItemID == E_ITEM_GOLD_HELMET ) then return true end - if( inItemID == E_ITEM_GOLD_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_GOLD_LEGGINGS ) then return true end - if( inItemID == E_ITEM_GOLD_BOOTS ) then return true end - - if( inCheckForHorseArmor ) then - if( inItemID == E_ITEM_IRON_HORSE_ARMOR ) then return true end - if( inItemID == E_ITEM_GOLD_HORSE_ARMOR ) then return true end - if( inItemID == E_ITEM_DIAMOND_HORSE_ARMOR ) then return true end - end - return false -end --- Returns full-length playername for a short name( usefull for parsing commands ) -function GetExactPlayername( inPlayerName ) - local _result = inPlayerName - local function SetProcessingPlayername( inPlayer ) - _result = inPlayer:GetName() - end - cRoot:Get():FindAndDoWithPlayer( inPlayerName, SetProcessingPlayername ) - return _result -end -function GetPlayerByName( inPlayerName ) - local _player - local PlayerSetter = function( Player ) - _player = Player - end - cRoot:Get():FindAndDoWithPlayer( inPlayerName, PlayerSetter ) - return _player -end ---[[ -Not-so-usual math _functions -]] --- Rounds floating point number. Because lua guys think this function doesn't deserve to be presented in lua's math -function round( inX ) - if( inX%2 ~= 0.5 ) then - return math.floor( inX + 0.5 ) - end - return inX - 0.5 -end ---[[ -Functions I use for filework and stringswork -]] -function PluralString( inValue, inSingularString, inPluralString ) - local _value_string = tostring( inValue ) - if( _value_string[#_value_string] == "1" ) then - return inSingularString - end - return inPluralString -end -function PluralItemName( inItemID, inAmount ) -- BEWARE! TEMPORAL SOLUTION THERE! :D - local _value_string = tostring( inValue ) - local _name = "" - if( _value_string[#_value_string] == "1" ) then - -- singular names - _name = ItemTypeToString( inItemID ) - else - -- plural names - _name = ItemTypeToString( inItemID ).."s" - end - return _name -end --- for filewriting purposes. 0 = false, 1 = true -function StringToBool( inValue ) - if( inValue == "1" ) then return true end - return false -end --- same, but reversal -function BoolToString( inValue ) - if( inValue == true ) then return 1 end - return 0 -end -- cgit v1.2.3 From 27e69f32c6e72ada6741f0b866c1afbc7ba00bc0 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:13:10 +0100 Subject: Removed MagicCarpet --- MCServer/Plugins/MagicCarpet/objects.lua | 97 -------------------------------- MCServer/Plugins/MagicCarpet/plugin.lua | 81 -------------------------- 2 files changed, 178 deletions(-) delete mode 100644 MCServer/Plugins/MagicCarpet/objects.lua delete mode 100644 MCServer/Plugins/MagicCarpet/plugin.lua diff --git a/MCServer/Plugins/MagicCarpet/objects.lua b/MCServer/Plugins/MagicCarpet/objects.lua deleted file mode 100644 index 8d81623a5..000000000 --- a/MCServer/Plugins/MagicCarpet/objects.lua +++ /dev/null @@ -1,97 +0,0 @@ --- Location object -cLocation = {} -function cLocation:new( x, y, z ) - local object = { x = x, y = y, z = z } - setmetatable(object, { __index = cLocation }) - return object -end - --- Offsets -cFibers = { } -function cFibers:new() - local object = { - cLocation:new( 2, -1, 2 ), - cLocation:new( 2, -1, 1 ), - cLocation:new( 2, -1, 0 ), - cLocation:new( 2, -1, -1 ), - cLocation:new( 2, -1, -2 ), - cLocation:new( 1, -1, 2 ), - cLocation:new( 1, -1, 1 ), - cLocation:new( 1, -1, 0 ), - cLocation:new( 1, -1, -1 ), - cLocation:new( 1, -1, -2 ), - cLocation:new( 0, -1, 2 ), - cLocation:new( 0, -1, 1 ), - cLocation:new( 0, -1, 0 ), - cLocation:new( 0, -1, -1 ), - cLocation:new( 0, -1, -2 ), - cLocation:new( -1, -1, 2 ), - cLocation:new( -1, -1, 1 ), - cLocation:new( -1, -1, 0 ), - cLocation:new( -1, -1, -1 ), - cLocation:new( -1, -1, -2 ), - cLocation:new( -2, -1, 2 ), - cLocation:new( -2, -1, 1 ), - cLocation:new( -2, -1, 0 ), - cLocation:new( -2, -1, -1 ), - cLocation:new( -2, -1, -2 ), - imadeit = false, - } - setmetatable(object, { __index = cFibers }) - return object; -end - --- Carpet object -cCarpet = {} -function cCarpet:new() - local object = { Location = cLocation:new(0,0,0), - Fibers = cFibers:new(), - } - setmetatable(object, { __index = cCarpet }) - return object -end - -function cCarpet:remove() - local World = cRoot:Get():GetDefaultWorld() - for i, fib in ipairs( self.Fibers ) do - local x = self.Location.x + fib.x - local y = self.Location.y + fib.y - local z = self.Location.z + fib.z - local BlockID = World:GetBlock( x, y, z ) - if( fib.imadeit == true and BlockID == E_BLOCK_GLASS ) then - World:SetBlock( x, y, z, 0, 0 ) - fib.imadeit = false - end - end -end - -function cCarpet:draw() - local World = cRoot:Get():GetDefaultWorld() - for i, fib in ipairs( self.Fibers ) do - local x = self.Location.x + fib.x - local y = self.Location.y + fib.y - local z = self.Location.z + fib.z - local BlockID = World:GetBlock( x, y, z ) - if( BlockID == 0 ) then - fib.imadeit = true - World:SetBlock( x, y, z, E_BLOCK_GLASS, 0 ) - else - fib.imadeit = false - end - end -end - -function cCarpet:moveTo( NewPos ) - local x = math.floor( NewPos.x ) - local y = math.floor( NewPos.y ) - local z = math.floor( NewPos.z ) - if( self.Location.x ~= x or self.Location.y ~= y or self.Location.z ~= z ) then - self:remove() - self.Location = cLocation:new( x, y, z ) - self:draw() - end -end - -function cCarpet:getY() - return self.Location.y -end \ No newline at end of file diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua deleted file mode 100644 index 417ea0e02..000000000 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ /dev/null @@ -1,81 +0,0 @@ -local Carpets = {} -local PLUGIN - -function Initialize( Plugin ) - Plugin:SetName( "MagicCarpet" ) - Plugin:SetVersion( 2 ) - - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving) - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnDisconnect) - - local PluginManager = cPluginManager:Get() - PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet"); - - PLUGIN = Plugin - - LOG( "Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() ) - return true -end - - - - - -function OnDisable() - LOG( PLUGIN:GetName() .. " v." .. PLUGIN:GetVersion() .. " is shutting down..." ) - for i, Carpet in pairs( Carpets ) do - Carpet:remove() - end -end - - - - - -function HandleCarpetCommand( Split, Player ) - Carpet = Carpets[ Player ] - - if( Carpet == nil ) then - Carpets[ Player ] = cCarpet:new() - Player:SendMessageSuccess("You're on a magic carpet!") - Player:SendMessageInfo("Look straight down to descend. Jump to ascend.") - else - Carpet:remove() - Carpets[ Player ] = nil - Player:SendMessageSuccess("The carpet vanished!") - end - - return true -end - - - - - -function OnDisconnect( Reason, Player ) - local Carpet = Carpets[ Player ] - if( Carpet ~= nil ) then - Carpet:remove() - end - Carpets[ Player ] = nil -end - - - - - -function OnPlayerMoving(Player) - local Carpet = Carpets[ Player ] - if( Carpet == nil ) then - return - end - - if( Player:GetPitch() == 90 ) then - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY() - 1, Player:GetPosZ() ) ) - else - if( Player:GetPosY() < Carpet:getY() ) then - Player:TeleportToCoords(Player:GetPosX(), Carpet:getY() + 0.2, Player:GetPosZ()) - end - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) ) - end -end -- cgit v1.2.3 From fa00cbeda3729c072e3594b137ee00b298d5f120 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:13:38 +0100 Subject: Added MagicCarpet --- .gitmodules | 3 +++ MCServer/Plugins/MagicCarpet | 1 + 2 files changed, 4 insertions(+) create mode 160000 MCServer/Plugins/MagicCarpet diff --git a/.gitmodules b/.gitmodules index a4ff5efaf..3a26ec262 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "MCServer/Plugins/Handy"] path = MCServer/Plugins/Handy url = https://github.com/mc-server/Handy.git +[submodule "MCServer/Plugins/MagicCarpet"] + path = MCServer/Plugins/MagicCarpet + url = https://github.com/mc-server/MagicCarpet.git diff --git a/MCServer/Plugins/MagicCarpet b/MCServer/Plugins/MagicCarpet new file mode 160000 index 000000000..493f2dfa6 --- /dev/null +++ b/MCServer/Plugins/MagicCarpet @@ -0,0 +1 @@ +Subproject commit 493f2dfa6d39f134e37c4c614cf8d6ffd10c825f -- cgit v1.2.3 From 01f7ff303d37b08aca2dd3251b0887ec8651ca3c Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:14:02 +0100 Subject: Reordered .gitmodules. Fixes #496 --- .gitmodules | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3a26ec262..d2ce2c855 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,12 +10,6 @@ [submodule "MCServer/Plugins/ChunkWorx"] path = MCServer/Plugins/ChunkWorx url = https://github.com/mc-server/ChunkWorx.git -[submodule "lib/polarssl"] - path = lib/polarssl - url = https://github.com/mc-server/polarssl.git -[submodule "lib/SQLiteCpp"] - path = lib/SQLiteCpp - url = https://github.com/mc-server/SQLiteCpp.git [submodule "MCServer/Plugins/ChatLog"] path = MCServer/Plugins/ChatLog url = https://github.com/mc-server/ChatLog.git @@ -25,3 +19,9 @@ [submodule "MCServer/Plugins/MagicCarpet"] path = MCServer/Plugins/MagicCarpet url = https://github.com/mc-server/MagicCarpet.git +[submodule "lib/polarssl"] + path = lib/polarssl + url = https://github.com/mc-server/polarssl.git +[submodule "lib/SQLiteCpp"] + path = lib/SQLiteCpp + url = https://github.com/mc-server/SQLiteCpp.git -- cgit v1.2.3 From 5cf1ba092e11da8e49222a9606031c48c5b91337 Mon Sep 17 00:00:00 2001 From: worktycho Date: Thu, 9 Oct 2014 09:53:16 +0100 Subject: Enabled C++11 in gcc --- SetFlags.cmake | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index 1827a4b66..bea830616 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -59,12 +59,13 @@ macro(set_flags) set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG") set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") elseif(APPLE) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") #on os x clang adds pthread for us but we need to add it for gcc if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") - set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") add_flags_cxx("-stdlib=libc++") add_flags_lnk("-stdlib=libc++") else() @@ -77,13 +78,10 @@ macro(set_flags) add_flags_cxx("-pthread") endif() - # Make CLang use C++11, otherwise MSVC2008-supported extensions don't work ("override" keyword etc.): - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") - set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") # We use a signed char (fixes #640 on RasPi) add_flags_cxx("-fsigned-char") -- cgit v1.2.3 From c3479f75578986baebfedd6ff4d4ea992a1ba080 Mon Sep 17 00:00:00 2001 From: worktycho Date: Thu, 9 Oct 2014 10:07:58 +0100 Subject: Fix flag name in gcc 4.6 and earlier --- SetFlags.cmake | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index bea830616..c0a021c25 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -60,10 +60,22 @@ macro(set_flags) set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") elseif(APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") - set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND (NOT GCC_VERSION VERSION_GREATER 4.6)) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++0x") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + endif() #on os x clang adds pthread for us but we need to add it for gcc if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_flags_cxx("-stdlib=libc++") @@ -78,10 +90,22 @@ macro(set_flags) add_flags_cxx("-pthread") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") - set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND (NOT GCC_VERSION VERSION_GREATER 4.6)) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++0x") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++0x") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + endif() # We use a signed char (fixes #640 on RasPi) add_flags_cxx("-fsigned-char") -- cgit v1.2.3 From f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 9 Oct 2014 12:33:16 +0200 Subject: DistortedHeightmap: Fixed crash on number rounding. Fixes #1521. --- src/Generating/DistortedHeightmap.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index c18c402da..bf8995dcb 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -540,10 +540,11 @@ void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile) int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z) { - int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16); - int ChunkZ = (int)floor(a_Z / (NOISE_DATATYPE)16); - int RelX = (int)(a_X - (NOISE_DATATYPE)ChunkX * cChunkDef::Width); - int RelZ = (int)(a_Z - (NOISE_DATATYPE)ChunkZ * cChunkDef::Width); + int RelX = (int)std::floor(a_X); + int RelY = 0; + int RelZ = (int)std::floor(a_Z); + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(RelX, RelY, RelZ, ChunkX, ChunkZ); // If we're withing the same chunk, return the pre-cached heightmap: if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ)) -- cgit v1.2.3 From f8d1e96ae7ac9a3483ff0a214796455946d7880f Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:25:45 -0700 Subject: Use static casts instead of C casts, add floor-cast functions --- src/Entities/Entity.h | 6 +++--- src/Globals.h | 40 ++++++++++++++++++++++++++++++++++++---- src/Vector3.h | 33 ++++++++++++++++----------------- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 3fa7e80c1..0a03eb3f2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT (int)floor(GetPosX()) -#define POSY_TOINT (int)floor(GetPosY()) -#define POSZ_TOINT (int)floor(GetPosZ()) +#define POSX_TOINT FloorD(GetPosX()) +#define POSY_TOINT FloorD(GetPosY()) +#define POSZ_TOINT FloorD(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } diff --git a/src/Globals.h b/src/Globals.h index 0926457da..8bf7a0f0c 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -226,10 +226,10 @@ template class SizeChecker; // CRT stuff: #include -#include -#include -#include -#include +#include +#include +#include +#include @@ -400,6 +400,38 @@ T Clamp(T a_Value, T a_Min, T a_Max) +/** Floors a_Value, then casts it to C (an int by default) */ +template +C FloorD(double a_Value) +{ + return static_cast(std::floor(a_Value)); +} + +/** Floors a_Value, then casts it to C (an int by default) */ +template +C FloorF(double a_Value) +{ + return static_cast(std::floorf(a_Value)); +} + +/** Ciels a_Value, then casts it to C (an int by default) */ +template +C CeilD(double a_Value) +{ + return static_cast(std::ceil(a_Value)); +} + +/** Ciels a_Value, then casts it to C (an int by default) */ +template +C CeilF(double a_Value) +{ + return static_cast(std::ceilf(a_Value)); +} + + + + + #ifndef TOLUA_TEMPLATE_BIND #define TOLUA_TEMPLATE_BIND(x) #endif diff --git a/src/Vector3.h b/src/Vector3.h index 1dcb38f64..782b0d1c9 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -4,7 +4,6 @@ #define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC) -#include #include #include @@ -29,9 +28,9 @@ public: // Hardcoded copy constructors (tolua++ does not support function templates .. yet) - Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} - Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} - Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} + Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} + Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} + Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} // tolua_end @@ -53,9 +52,9 @@ public: { double Len = 1.0 / Length(); - x = (T)(x * Len); - y = (T)(y * Len); - z = (T)(z * Len); + x = static_cast(x * Len); + y = static_cast(y * Len); + z = static_cast(z * Len); } inline Vector3 NormalizeCopy(void) const @@ -63,9 +62,9 @@ public: double Len = 1.0 / Length(); return Vector3( - (T)(x * Len), - (T)(y * Len), - (T)(z * Len) + static_cast(x * Len), + static_cast(y * Len), + static_cast(z * Len) ); } @@ -74,15 +73,15 @@ public: double Len = 1.0 / Length(); a_Rhs.Set( - (T)(x * Len), - (T)(y * Len), - (T)(z * Len) + static_cast(x * Len), + static_cast(y * Len), + static_cast(z * Len) ); } inline double Length(void) const { - return sqrt((double)(x * x + y * y + z * z)); + return sqrt(static_cast(x * x + y * y + z * z)); } inline double SqrLength(void) const @@ -138,9 +137,9 @@ public: inline Vector3 Floor(void) const { return Vector3( - (int)floor(x), - (int)floor(y), - (int)floor(z) + static_cast(floor(x)), + static_cast(floor(y)), + static_cast(floor(z)) ); } -- cgit v1.2.3 From 76b37acb421bf10e094182b2e9be111eb29c46f1 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:51:38 -0700 Subject: Float/Ciel: If it's going to use C++11, it might as well take advantage of it --- src/Entities/Entity.h | 6 +++--- src/Globals.h | 26 ++++++-------------------- src/Vector3.h | 6 +++--- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0a03eb3f2..f0577aba2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT FloorD(GetPosX()) -#define POSY_TOINT FloorD(GetPosY()) -#define POSZ_TOINT FloorD(GetPosZ()) +#define POSX_TOINT FloorC(GetPosX()) +#define POSY_TOINT FloorC(GetPosY()) +#define POSZ_TOINT FloorC(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } diff --git a/src/Globals.h b/src/Globals.h index 8bf7a0f0c..9959d92a9 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -400,34 +400,20 @@ T Clamp(T a_Value, T a_Min, T a_Max) -/** Floors a_Value, then casts it to C (an int by default) */ -template -C FloorD(double a_Value) +/** Floors a value, then casts it to C (an int by default) */ +template +typename std::enable_if::value, C>::type FloorC(T a_Value) { return static_cast(std::floor(a_Value)); } -/** Floors a_Value, then casts it to C (an int by default) */ -template -C FloorF(double a_Value) -{ - return static_cast(std::floorf(a_Value)); -} - -/** Ciels a_Value, then casts it to C (an int by default) */ -template -C CeilD(double a_Value) +/** Ceils a value, then casts it to C (an int by default) */ +template +typename std::enable_if::value, C>::type CeilC(T a_Value) { return static_cast(std::ceil(a_Value)); } -/** Ciels a_Value, then casts it to C (an int by default) */ -template -C CeilF(double a_Value) -{ - return static_cast(std::ceilf(a_Value)); -} - diff --git a/src/Vector3.h b/src/Vector3.h index 782b0d1c9..937c8fdfa 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -137,9 +137,9 @@ public: inline Vector3 Floor(void) const { return Vector3( - static_cast(floor(x)), - static_cast(floor(y)), - static_cast(floor(z)) + FloorC(x), + FloorC(y), + FloorC(z) ); } -- cgit v1.2.3 From a47d9e53344144d7584c37bbac742cf2187492fe Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 10 Oct 2014 09:58:54 +0200 Subject: Fixed MSVC compilation. --- src/Globals.h | 3 +++ src/Vector3.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Globals.h b/src/Globals.h index 9959d92a9..4ee1352eb 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -51,6 +51,9 @@ #define NORETURN __declspec(noreturn) + // Use non-standard defines in + #define _USE_MATH_DEFINES + #elif defined(__GNUC__) // TODO: Can GCC explicitly mark classes as abstract (no instances can be created)? diff --git a/src/Vector3.h b/src/Vector3.h index 937c8fdfa..1854e42e3 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -3,7 +3,6 @@ -#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC) #include #include -- cgit v1.2.3 From 473c0425d374132c097045a84e03510bc8a7876b Mon Sep 17 00:00:00 2001 From: tycho Date: Fri, 10 Oct 2014 15:33:19 +0100 Subject: Moved a few objects to unique_ptr --- src/Bindings/ManualBindings.cpp | 2 +- src/Globals.h | 7 ++++++ src/World.cpp | 53 +++++++++++++++++++---------------------- src/World.h | 18 +++++++------- 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index f643f06ec..0558533ce 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1160,7 +1160,7 @@ static int tolua_cWorld_QueueTask(lua_State * tolua_S) return lua_do_error(tolua_S, "Error in function call '#funcname#': Could not get function reference of parameter #1"); } - self->QueueTask(new cLuaWorldTask(*Plugin, FnRef)); + self->QueueTask(make_unique(*Plugin, FnRef)); return 0; } diff --git a/src/Globals.h b/src/Globals.h index 4ee1352eb..5c5a8b3d2 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -419,6 +419,12 @@ typename std::enable_if::value, C>::type CeilC(T a_Value) +//temporary replacement for std::make_unique until we get c++14 +template< class T, class... Args > +std::unique_ptr make_unique( Args&&... args ) +{ + return std::unique_ptr(new T(args...)); +} #ifndef TOLUA_TEMPLATE_BIND @@ -436,3 +442,4 @@ typename std::enable_if::value, C>::type CeilC(T a_Value) #include "BlockInfo.h" + diff --git a/src/World.cpp b/src/World.cpp index a3c804b44..a23db6242 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -256,14 +256,14 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin m_IsDeepSnowEnabled(false), m_ShouldLavaSpawnFire(true), m_VillagersShouldHarvestCrops(true), - m_SimulatorManager(NULL), - m_SandSimulator(NULL), + m_SimulatorManager(), + m_SandSimulator(), m_WaterSimulator(NULL), - m_LavaSimulator(NULL), - m_FireSimulator(NULL), + m_LavaSimulator(nullptr), + m_FireSimulator(), m_RedstoneSimulator(NULL), m_MaxPlayers(10), - m_ChunkMap(NULL), + m_ChunkMap(), m_bAnimals(true), m_Weather(eWeather_Sunny), m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) @@ -303,11 +303,8 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin cWorld::~cWorld() { - delete m_SimulatorManager; m_SimulatorManager = NULL; - delete m_SandSimulator; m_SandSimulator = NULL; delete m_WaterSimulator; m_WaterSimulator = NULL; delete m_LavaSimulator; m_LavaSimulator = NULL; - delete m_FireSimulator; m_FireSimulator = NULL; delete m_RedstoneSimulator; m_RedstoneSimulator = NULL; UnloadUnusedChunks(); @@ -319,8 +316,6 @@ cWorld::~cWorld() Serializer.Save(); m_MapManager.SaveMapData(); - - delete m_ChunkMap; } @@ -631,7 +626,7 @@ void cWorld::Start(void) InitialiseAndLoadMobSpawningValues(IniFile); SetTimeOfDay(IniFile.GetValueSetI("General", "TimeInTicks", m_TimeOfDay)); - m_ChunkMap = new cChunkMap(this); + m_ChunkMap = make_unique(this); m_LastSave = 0; m_LastUnload = 0; @@ -641,16 +636,16 @@ void cWorld::Start(void) m_BlockTickQueueCopy.reserve(1000); // Simulators: - m_SimulatorManager = new cSimulatorManager(*this); + m_SimulatorManager = make_unique(*this); m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER); m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA); - m_SandSimulator = new cSandSimulator(*this, IniFile); - m_FireSimulator = new cFireSimulator(*this, IniFile); + m_SandSimulator = make_unique(*this, IniFile); + m_FireSimulator = make_unique(*this, IniFile); m_RedstoneSimulator = InitializeRedstoneSimulator(IniFile); // Water, Lava and Redstone simulators get registered in their initialize function. - m_SimulatorManager->RegisterSimulator(m_SandSimulator, 1); - m_SimulatorManager->RegisterSimulator(m_FireSimulator, 1); + m_SimulatorManager->RegisterSimulator(m_SandSimulator.get(), 1); + m_SimulatorManager->RegisterSimulator(m_FireSimulator.get(), 1); m_Lighting.Start(this); m_Storage.Start(this, m_StorageSchema, m_StorageCompressionFactor); @@ -1059,7 +1054,6 @@ void cWorld::TickQueuedTasks(void) for (cTasks::iterator itr = Tasks.begin(), end = Tasks.end(); itr != end; ++itr) { (*itr)->Run(*this); - delete *itr; } // for itr - m_Tasks[] } @@ -1073,18 +1067,19 @@ void cWorld::TickScheduledTasks(void) cScheduledTasks Tasks; { cCSLock Lock(m_CSScheduledTasks); - while (!m_ScheduledTasks.empty() && (m_ScheduledTasks.front()->m_TargetTick < m_WorldAge)) - { - Tasks.push_back(m_ScheduledTasks.front()); - m_ScheduledTasks.pop_front(); - } + std::move( + m_ScheduledTasks.begin(), + std::find_if( + m_ScheduledTasks.begin(), + m_ScheduledTasks.end(), + [m_WorldAge] (std::unique_ptr& Task) { return Task->m_TargetTick < m_WorldAge;}), + std::back_inserter(Tasks)); } // Execute and delete each task: for (cScheduledTasks::iterator itr = Tasks.begin(), end = Tasks.end(); itr != end; ++itr) { (*itr)->m_Task->Run(*this); - delete *itr; } // for itr - m_Tasks[] } @@ -2593,7 +2588,7 @@ void cWorld::UnloadUnusedChunks(void) void cWorld::QueueUnloadUnusedChunks(void) { - QueueTask(new cWorld::cTaskUnloadUnusedChunks); + QueueTask(make_unique()); } @@ -3049,17 +3044,17 @@ void cWorld::SaveAllChunks(void) void cWorld::QueueSaveAllChunks(void) { - QueueTask(new cWorld::cTaskSaveAllChunks); + QueueTask(make_unique()); } -void cWorld::QueueTask(cTask * a_Task) +void cWorld::QueueTask(std::unique_ptr a_Task) { cCSLock Lock(m_CSTasks); - m_Tasks.push_back(a_Task); + m_Tasks.push_back(std::move(a_Task)); } @@ -3076,11 +3071,11 @@ void cWorld::ScheduleTask(int a_DelayTicks, cTask * a_Task) { if ((*itr)->m_TargetTick >= TargetTick) { - m_ScheduledTasks.insert(itr, new cScheduledTask(TargetTick, a_Task)); + m_ScheduledTasks.insert(itr, make_unique(TargetTick, a_Task)); return; } } - m_ScheduledTasks.push_back(new cScheduledTask(TargetTick, a_Task)); + m_ScheduledTasks.push_back(make_unique(TargetTick, a_Task)); } diff --git a/src/World.h b/src/World.h index 90dada259..66dd2494e 100644 --- a/src/World.h +++ b/src/World.h @@ -103,7 +103,7 @@ public: virtual void Run(cWorld & a_World) = 0; } ; - typedef std::vector cTasks; + typedef std::vector> cTasks; class cTaskSaveAllChunks : @@ -506,7 +506,7 @@ public: // tolua_end - inline cSimulatorManager * GetSimulatorManager(void) { return m_SimulatorManager; } + inline cSimulatorManager * GetSimulatorManager(void) { return m_SimulatorManager.get(); } inline cFluidSimulator * GetWaterSimulator(void) { return m_WaterSimulator; } inline cFluidSimulator * GetLavaSimulator (void) { return m_LavaSimulator; } @@ -671,7 +671,7 @@ public: void QueueSaveAllChunks(void); // tolua_export /** Queues a task onto the tick thread. The task object will be deleted once the task is finished */ - void QueueTask(cTask * a_Task); // Exported in ManualBindings.cpp + void QueueTask(std::unique_ptr a_Task); // Exported in ManualBindings.cpp /** Queues a task onto the tick thread, with the specified delay. The task object will be deleted once the task is finished */ @@ -764,7 +764,7 @@ public: cChunkGenerator & GetGenerator(void) { return m_Generator; } cWorldStorage & GetStorage (void) { return m_Storage; } - cChunkMap * GetChunkMap (void) { return m_ChunkMap; } + cChunkMap * GetChunkMap (void) { return m_ChunkMap.get(); } /** Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call */ void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export @@ -861,7 +861,7 @@ private: } }; - typedef std::list cScheduledTasks; + typedef std::list> cScheduledTasks; AString m_WorldName; @@ -913,11 +913,11 @@ private: std::vector m_BlockTickQueue; std::vector m_BlockTickQueueCopy; // Second is for safely removing the objects from the queue - cSimulatorManager * m_SimulatorManager; - cSandSimulator * m_SandSimulator; + std::unique_ptr m_SimulatorManager; + std::unique_ptr m_SandSimulator; cFluidSimulator * m_WaterSimulator; cFluidSimulator * m_LavaSimulator; - cFireSimulator * m_FireSimulator; + std::unique_ptr m_FireSimulator; cRedstoneSimulator * m_RedstoneSimulator; cCriticalSection m_CSPlayers; @@ -927,7 +927,7 @@ private: unsigned int m_MaxPlayers; - cChunkMap * m_ChunkMap; + std::unique_ptr m_ChunkMap; bool m_bAnimals; std::set m_AllowedMobs; -- cgit v1.2.3 From a36f18fb4972c1acc09412a8e49d96e4681e6ba4 Mon Sep 17 00:00:00 2001 From: kjanku1 Date: Sat, 11 Oct 2014 14:22:55 +0200 Subject: Android strings transladed to polish --- Android/res/values-pl/strings.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Android/res/values-pl/strings.xml diff --git a/Android/res/values-pl/strings.xml b/Android/res/values-pl/strings.xml new file mode 100644 index 000000000..d4848ab86 --- /dev/null +++ b/Android/res/values-pl/strings.xml @@ -0,0 +1,13 @@ + + + + Hello World, MCServerActivity! + MCServer + Start + Stop + MCServer jest włączony + MCServer jest wyłączony + Twoje IP … + Ustawienia + + \ No newline at end of file -- cgit v1.2.3 From 1a07dc897d13c775c6f540f3500db505e5e80abc Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 11 Oct 2014 14:43:06 +0100 Subject: Fix lambda capture --- src/World.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/World.cpp b/src/World.cpp index a23db6242..f616063f5 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1067,12 +1067,13 @@ void cWorld::TickScheduledTasks(void) cScheduledTasks Tasks; { cCSLock Lock(m_CSScheduledTasks); + auto WorldAge = m_WorldAge; std::move( m_ScheduledTasks.begin(), std::find_if( m_ScheduledTasks.begin(), m_ScheduledTasks.end(), - [m_WorldAge] (std::unique_ptr& Task) { return Task->m_TargetTick < m_WorldAge;}), + [WorldAge] (std::unique_ptr& Task) { return Task->m_TargetTick < m_WorldAge;}), std::back_inserter(Tasks)); } -- cgit v1.2.3 From 040be609ff3fa77bacf22dab0d70be6610f2718f Mon Sep 17 00:00:00 2001 From: Kamil Janku Date: Sat, 11 Oct 2014 16:14:20 +0200 Subject: Update strings.xml --- Android/res/values-pl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android/res/values-pl/strings.xml b/Android/res/values-pl/strings.xml index d4848ab86..74c8044d8 100644 --- a/Android/res/values-pl/strings.xml +++ b/Android/res/values-pl/strings.xml @@ -10,4 +10,4 @@ Twoje IP … Ustawienia - \ No newline at end of file + -- cgit v1.2.3 From d3f31b5046ebd2dacfcbeb96f900e12d2bddcad9 Mon Sep 17 00:00:00 2001 From: win32re Date: Sat, 11 Oct 2014 17:40:33 +0200 Subject: Update template.html --- MCServer/webadmin/template.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html index 822f73857..50eaa486b 100644 --- a/MCServer/webadmin/template.html +++ b/MCServer/webadmin/template.html @@ -51,7 +51,7 @@ table { border-top: 1px solid #ddd; width: 700px; - } + } table tr th { text-align: left; @@ -71,17 +71,23 @@ border: 1px solid #ddd; border-radius: 3px; } - #main table tr.odd td { + + #main table tr.odd td { background: #fbfbfb; } - table tr:hover td { background: #fdfcf6; } + table tr:hover td { + background: #fdfcf6; + } + table .action { text-align: right; padding: 0 20px 0 10px; } - table tr .action a { color: #9b9b9b; } + table tr .action a { + color: #9b9b9b; + } #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; } #cssmenu > ul {list-style:inside none; padding:0; margin:0;} -- cgit v1.2.3 From 9bb2b43e9e6994f247659ee48b2225c456f1dde5 Mon Sep 17 00:00:00 2001 From: win32re Date: Sat, 11 Oct 2014 17:57:56 +0200 Subject: More template changes. --- MCServer/webadmin/template.html | 261 ++++++++++++++++++++-------------------- 1 file changed, 130 insertions(+), 131 deletions(-) diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html index 50eaa486b..addc1806c 100644 --- a/MCServer/webadmin/template.html +++ b/MCServer/webadmin/template.html @@ -1,135 +1,134 @@ - - {TITLE} | {PLUGIN_NAME} - - - - - - - -
- Login: {USERNAME}
-
- -
- -
- {CONTENT} -
-

MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.

Web Design by Tiger

-
- + footer { + font-family: helvetica; + font-size: 10px; + text-align: center; + border-top: 1px #000 dotted; + padding: 1px 0px 1px 0px; + } + + table { + border-collapse: collapse; + border-spacing: 10; + } + + table { + border-top: 1px solid #ddd; + width: 700px; + } + + table tr th { + text-align: left; + background: #f6f6f6; + padding: 0px 20px; + height: 25px; + line-height: 25px; + border: 1px solid #ddd; + border-radius: 3px; + } + + table tr td { + background: #f6f6f6; + padding: 0px 20px; + height: 29px; + line-height: 29px; + border: 1px solid #ddd; + border-radius: 3px; + } + + #main table tr.odd td { + background: #fbfbfb; + } + + table tr:hover td { + background: #fdfcf6; + } + + table .action { + text-align: right; + padding: 0 20px 0 10px; + } + + table tr .action a { + color: #9b9b9b; + } + + #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; } + #cssmenu > ul {list-style:inside none; padding:0; margin:0;} + #cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;} + #cssmenu > ul > li > a{ outline:none; display:block; position:relative; color:#E8E8E8; padding:10px 10px; font:bold 13px/100% Arial, Helvetica, sans-serif; text-align:center; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.4); } + #cssmenu > ul > li:first-child > a{border-radius:5px 0 0 5px;} + /* #cssmenu > ul > li > a:after{ content:''; position:absolute; border-right:1px solid #FFFFFF; top:-1px; bottom:-1px; right:-2px; z-index:99; } */ + #cssmenu ul li.has-sub:hover > a:after{top:0; bottom:0;} + #cssmenu > ul > li.has-sub > a:before{ content:''; position:absolute; top:18px; right:6px; border:5px solid transparent; border-top:5px solid #707070; } + #cssmenu > ul > li.has-sub:hover > a:before{top:19px;} + #cssmenu ul li.has-sub:hover > a{ background:#3f3f3f; border-color:#707070; padding-bottom:13px; padding-top:13px; top:-1px; z-index:999; } + #cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;} + #cssmenu ul li.has-sub > a:hover{background:#3f3f3f; border-color:#3f3f3f;} + #cssmenu ul li > ul, #cssmenu ul li > div{ display:none; width:auto; position:absolute; top:38px; padding:10px 0; background:#3f3f3f; border-radius:0 0 5px 5px; z-index:999; } + #cssmenu ul li > ul{width:200px;} + #cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;} + #cssmenu ul li > ul li a{ outline:none; display:block; position:relative; margin:0; padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.5); } + #cssmenu, #cssmenu > ul > li > ul > li a:hover{ background:#C8C8C8;} + #cssmenu > ul > li > a { border-right:1px solid #707070; color:#FFFFFF; } + #cssmenu > ul > li > a:after { border-color:#707070; } + #cssmenu > ul > li > a:hover { background:#B8B8B8; } + + + + + + +
+ Login: {USERNAME}
+
+ +
+ +
+ {CONTENT} +
+

MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.

Web Design by Tiger

+
+ -- cgit v1.2.3 From 68762747e0455a5a3203f53bda8b576e170e3337 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 16:59:13 +0100 Subject: Fixed typo and removed useless right side up slab meta. --- src/BlockID.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/BlockID.h b/src/BlockID.h index b78c09f9c..f1aee3f4a 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -764,8 +764,7 @@ enum E_META_WOODEN_SLAB_JUNGLE = 3, E_META_WOODEN_SLAB_ACACIA = 4, E_META_WOODEN_SLAB_DARK_OAK = 5, - E_META_WOODEN_SLAB_RIGHT_SIDE_UP = 0, - E_META_WOODWN_SLAB_UPSIDE_DOWN = 8, + E_META_WOODEN_SLAB_UPSIDE_DOWN = 8, // E_BLOCK_WOOL metas: E_META_WOOL_WHITE = 0, -- cgit v1.2.3 From faa8e721d55be453b26ba928d3901a3c9f1b02e4 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 17:03:30 +0100 Subject: Reverted submodule changes. --- MCServer/Plugins/Core | 2 +- lib/polarssl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 013a32a7f..f8c2531fb 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 013a32a7fb3c8a6cfe0aef892d4c7394d4e1be59 +Subproject commit f8c2531fbef9bfd0b6f024d4d3319384a70a0831 diff --git a/lib/polarssl b/lib/polarssl index 2cb1a0c40..d6a15321a 160000 --- a/lib/polarssl +++ b/lib/polarssl @@ -1 +1 @@ -Subproject commit 2cb1a0c4009ecf368ecc74eb428394e10f9e6d00 +Subproject commit d6a15321ae51762098e49a976d26efa2493c94f6 -- cgit v1.2.3 From 59efc7cfd26e3165fde727b4651650054402bae3 Mon Sep 17 00:00:00 2001 From: win32re Date: Sat, 11 Oct 2014 18:07:10 +0200 Subject: Fixed indentation. --- MCServer/webadmin/template.html | 261 ++++++++++++++++++++-------------------- 1 file changed, 131 insertions(+), 130 deletions(-) diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html index addc1806c..53037be0d 100644 --- a/MCServer/webadmin/template.html +++ b/MCServer/webadmin/template.html @@ -1,134 +1,135 @@ - - {TITLE} | {PLUGIN_NAME} - - - - - - -
- Login: {USERNAME}
-
- -
- -
- {CONTENT} -
-

MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.

Web Design by Tiger

-
- + #maincontent { + padding: 0px 25px 10px 25px; + } + + #wrapper { + min-width: 850px; + width: 75%; + margin: 10px auto; + background-color: white; + border: 4px #888888 solid; + border-radius: 10px; + font-family: Calibri, Trebuchet MS; + } + + header { + text-align:center; + padding: 10px; 0px; + } + + span { + text-align: right; + float: right; + border-left: 2px #C8C8C8 solid; + border-bottom: 2px #C8C8C8 solid; + padding: 2px 10px; + } + + footer { + font-family: helvetica; + font-size: 10px; + text-align: center; + border-top: 1px #000 dotted; + padding: 1px 0px 1px 0px; + } + + table { + border-collapse: collapse; + border-spacing: 10; + } + + table { + border-top: 1px solid #ddd; + width: 700px; + } + + table tr th { + text-align: left; + background: #f6f6f6; + padding: 0px 20px; + height: 25px; + line-height: 25px; + border: 1px solid #ddd; + border-radius: 3px; + } + + table tr td { + background: #f6f6f6; + padding: 0px 20px; + height: 29px; + line-height: 29px; + border: 1px solid #ddd; + border-radius: 3px; + } + + #main table tr.odd td { + background: #fbfbfb; + } + + table tr:hover td { + background: #fdfcf6; + } + + table .action { + text-align: right; + padding: 0 20px 0 10px; + } + + table tr .action a { + color: #9b9b9b; + } + + #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; } + #cssmenu > ul {list-style:inside none; padding:0; margin:0;} + #cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;} + #cssmenu > ul > li > a{ outline:none; display:block; position:relative; color:#E8E8E8; padding:10px 10px; font:bold 13px/100% Arial, Helvetica, sans-serif; text-align:center; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.4); } + #cssmenu > ul > li:first-child > a{border-radius:5px 0 0 5px;} + /* #cssmenu > ul > li > a:after{ content:''; position:absolute; border-right:1px solid #FFFFFF; top:-1px; bottom:-1px; right:-2px; z-index:99; } */ + #cssmenu ul li.has-sub:hover > a:after{top:0; bottom:0;} + #cssmenu > ul > li.has-sub > a:before{ content:''; position:absolute; top:18px; right:6px; border:5px solid transparent; border-top:5px solid #707070; } + #cssmenu > ul > li.has-sub:hover > a:before{top:19px;} + #cssmenu ul li.has-sub:hover > a{ background:#3f3f3f; border-color:#707070; padding-bottom:13px; padding-top:13px; top:-1px; z-index:999; } + #cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;} + #cssmenu ul li.has-sub > a:hover{background:#3f3f3f; border-color:#3f3f3f;} + #cssmenu ul li > ul, #cssmenu ul li > div{ display:none; width:auto; position:absolute; top:38px; padding:10px 0; background:#3f3f3f; border-radius:0 0 5px 5px; z-index:999; } + #cssmenu ul li > ul{width:200px;} + #cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;} + #cssmenu ul li > ul li a{ outline:none; display:block; position:relative; margin:0; padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.5); } + #cssmenu, #cssmenu > ul > li > ul > li a:hover{ background:#C8C8C8;} + #cssmenu > ul > li > a { border-right:1px solid #707070; color:#FFFFFF; } + #cssmenu > ul > li > a:after { border-color:#707070; } + #cssmenu > ul > li > a:hover { background:#B8B8B8; } + + + + + + +
+ Login: {USERNAME} +
+
+ +
+ +
+ {CONTENT} +
+

MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.

Web Design by Tiger

+
+ -- cgit v1.2.3 From 0c4894b99ebf8a679a744424452e901e2ef8a8d3 Mon Sep 17 00:00:00 2001 From: win32re Date: Sat, 11 Oct 2014 18:11:56 +0200 Subject: Update template.html --- MCServer/webadmin/template.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html index 53037be0d..e0c7e3597 100644 --- a/MCServer/webadmin/template.html +++ b/MCServer/webadmin/template.html @@ -116,10 +116,12 @@
- Login: {USERNAME} + + Login: {USERNAME} +
- +
-- cgit v1.2.3 From d9a50dd2eeec80f197b6024b2293d2a71060bc85 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 17:15:38 +0100 Subject: Fixed remaining indent and replaced tiger with webfreak. --- MCServer/webadmin/template.html | 214 ++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/MCServer/webadmin/template.html b/MCServer/webadmin/template.html index e0c7e3597..8bfcc0fbe 100644 --- a/MCServer/webadmin/template.html +++ b/MCServer/webadmin/template.html @@ -3,112 +3,112 @@ {TITLE} | {PLUGIN_NAME} @@ -133,7 +133,7 @@

MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.

-

Web Design by Tiger

+

Web Design by

-- cgit v1.2.3 From ae0705a67d6a464b08a9083cfb9e9f9bb4a1c0a3 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 17:17:22 +0100 Subject: Fixes. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09ff5d796..0b1a6c443 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ MCServer [![Build Status](http://img.shields.io/travis/mc-server/MCServer.svg)]( MCServer is a Minecraft server that is written in C++ and designed to be efficient with memory and CPU, as well as having a flexible Lua Plugin API. -MCServer can run on PCs, Macs, and *nix. This includes android phones and tablets as well as Raspberry Pis. +MCServer can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis. -We currently support the protocol from Minecraft 1.2 all the way up to Minecraft 1.8. +We currently support Release 1.7 and 1.8 (not beta) Minecraft protocol versions. Installation ------------ -- cgit v1.2.3 From 99efaa5a3c5dc070fd0dd54a5e4fff3443cc3df0 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 17:19:08 +0100 Subject: More README changes. --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b1a6c443..5c7388528 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,7 @@ We currently support Release 1.7 and 1.8 (not beta) Minecraft protocol versions. Installation ------------ -Normally, you will want to download a pre-compiled version of MCServer from one of the buildservers: - - * [Windows and Linux](http://builds.cuberite.org) - * [Raspberry Pi](http://builds.cuberite.org) +Normally, you will want to download a pre-compiled version of MCServer from the official buildserver: http://builds.cuberite.org You simply need to download and extract these files before you can use the server. @@ -22,7 +19,7 @@ If you're a more advanced user, you may want to compile the server yourself for Contributing ------------ -MCServer is licensed under the Apache license V2, and we welcome anybody to fork and submit a Pull Request back with their changes, and if you want to join as a permanent member we can add you to the team. +MCServer is licensed under the Apache License V2, and we welcome anybody to fork and submit a Pull Request back with their changes, and if you want to join as a permanent member we can add you to the team. Check out the [CONTRIBUTING.md](https://github.com/mc-server/MCServer/blob/master/CONTRIBUTING.md) file for more details. -- cgit v1.2.3 From 6af9d5ba0142b5bff6147c5fbc844a39f8dd0d0d Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 18:39:46 +0100 Subject: Fixed compilation. --- src/Blocks/BlockStone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index e52599c0f..69cc8301b 100644 --- a/src/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h @@ -18,7 +18,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - if (a_BlockMeta == E_META_STONE) + if (a_BlockMeta == E_META_STONE_STONE) { a_Pickups.push_back(cItem(E_BLOCK_COBBLESTONE, 1, 0)); return; -- cgit v1.2.3 From b19742fe5a0a665213e9906c697c8a25613c6442 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 11 Oct 2014 21:31:49 +0100 Subject: Added easy installation method for Linux. --- easyinstall.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 easyinstall.sh diff --git a/easyinstall.sh b/easyinstall.sh new file mode 100755 index 000000000..77ffb2290 --- /dev/null +++ b/easyinstall.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +PLATFORM=$(uname -m) + +echo "Identifying platform: $PLATFORM" +case $PLATFORM in + "i686") DOWNLOADURL="http://builds.cuberite.org/job/MCServer%20Linux%20x86/lastSuccessfulBuild/artifact/MCServer.tar" ;; + "x86_64") DOWNLOADURL="http://builds.cuberite.org/job/MCServer%20Linux%20x64/lastSuccessfulBuild/artifact/MCServer.tar" ;; + # Assume that all arm devices are a raspi for now. + "arm*") DOWNLOADURL="http://builds.cuberite.org/job/MCServer%20Linux%20armhf/lastSuccessfulBuild/artifact/MCServer.tar" +esac + +echo "Downloading precompiled binaries." +curl -s $DOWNLOADURL | tar -xzf - +echo "Done." + +echo "MCServer is now installed, run using 'cd MCServer; ./MCServer'." -- cgit v1.2.3 From 20dfd9ba3e832a369696c3a28caa62024dc9e0ba Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 11 Oct 2014 13:36:43 -0700 Subject: Webadmin: use images already in files/ instead of inline image data This also probably means that the browser will be able to cache the images better, and not have to repeatedly download them al a part of the HTML. --- MCServer/webadmin/(original).html | 8 ++++---- MCServer/webadmin/template.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MCServer/webadmin/(original).html b/MCServer/webadmin/(original).html index 239a255e5..673a93ada 100644 --- a/MCServer/webadmin/(original).html +++ b/MCServer/webadmin/(original).html @@ -1,7 +1,7 @@ - + {TITLE}