summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockCrops.h23
-rw-r--r--src/Blocks/BlockFarmland.h2
-rw-r--r--src/Blocks/BlockFluid.h1
-rw-r--r--src/Blocks/BlockHandler.cpp18
-rw-r--r--src/Blocks/BlockPiston.h4
-rw-r--r--src/Blocks/BlockSlab.h13
-rw-r--r--src/Blocks/BlockStairs.h1
7 files changed, 51 insertions, 11 deletions
diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h
index cc18a2b18..4ea94cf86 100644
--- a/src/Blocks/BlockCrops.h
+++ b/src/Blocks/BlockCrops.h
@@ -8,7 +8,8 @@
-/** Common class that takes care of carrots, potatoes and wheat */
+/** Common class that takes care of beetroots, carrots, potatoes and wheat */
+template <NIBBLETYPE RipeMeta>
class cBlockCropsHandler :
public cBlockPlant
{
@@ -23,11 +24,20 @@ public:
{
cFastRandom rand;
- if (a_Meta == 0x7)
+ // Beetroots have three stages before fully grown
+ if (a_Meta >= RipeMeta)
{
// Is fully grown, drop the entire produce:
switch (m_BlockType)
{
+ case E_BLOCK_BEETROOTS:
+ {
+ char SeedCount = static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2);
+ a_Pickups.push_back(cItem(E_ITEM_BEETROOT_SEEDS, SeedCount, 0));
+ char BeetrootCount = static_cast<char>(1 + (rand.NextInt(3) + rand.NextInt(3)) / 2);
+ a_Pickups.push_back(cItem(E_ITEM_BEETROOT, BeetrootCount, 0)); // [1 .. 3] with high preference of 2
+ break;
+ }
case E_BLOCK_CROPS:
{
a_Pickups.push_back(cItem(E_ITEM_WHEAT, 1, 0));
@@ -61,9 +71,10 @@ public:
// Drop 1 item of whatever is growing
switch (m_BlockType)
{
- case E_BLOCK_CROPS: a_Pickups.push_back(cItem(E_ITEM_SEEDS, 1, 0)); break;
- case E_BLOCK_CARROTS: a_Pickups.push_back(cItem(E_ITEM_CARROT, 1, 0)); break;
- case E_BLOCK_POTATOES: a_Pickups.push_back(cItem(E_ITEM_POTATO, 1, 0)); break;
+ case E_BLOCK_BEETROOTS: a_Pickups.push_back(cItem(E_ITEM_BEETROOT_SEEDS, 1, 0)); break;
+ case E_BLOCK_CROPS: a_Pickups.push_back(cItem(E_ITEM_SEEDS, 1, 0)); break;
+ case E_BLOCK_CARROTS: a_Pickups.push_back(cItem(E_ITEM_CARROT, 1, 0)); break;
+ case E_BLOCK_POTATOES: a_Pickups.push_back(cItem(E_ITEM_POTATO, 1, 0)); break;
default:
{
ASSERT(!"Unhandled block type");
@@ -82,7 +93,7 @@ public:
// If there is still room to grow and the plant can grow, then grow.
// Otherwise if the plant needs to die, then dig it up
- if ((Meta < 7) && (Action == paGrowth))
+ if ((Meta < RipeMeta) && (Action == paGrowth))
{
a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, m_BlockType, ++Meta);
}
diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h
index ddbd79335..7efd062d5 100644
--- a/src/Blocks/BlockFarmland.h
+++ b/src/Blocks/BlockFarmland.h
@@ -48,6 +48,7 @@ public:
BLOCKTYPE UpperBlock = (a_RelY >= cChunkDef::Height - 1) ? static_cast<BLOCKTYPE>(E_BLOCK_AIR) : a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ);
switch (UpperBlock)
{
+ case E_BLOCK_BEETROOTS:
case E_BLOCK_CROPS:
case E_BLOCK_POTATOES:
case E_BLOCK_CARROTS:
@@ -131,6 +132,7 @@ public:
virtual bool CanSustainPlant(BLOCKTYPE a_Plant) override
{
return (
+ (a_Plant == E_BLOCK_BEETROOTS) ||
(a_Plant == E_BLOCK_CROPS) ||
(a_Plant == E_BLOCK_CARROTS) ||
(a_Plant == E_BLOCK_POTATOES) ||
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h
index df51fb104..0a8b34145 100644
--- a/src/Blocks/BlockFluid.h
+++ b/src/Blocks/BlockFluid.h
@@ -61,6 +61,7 @@ public:
virtual bool CanSustainPlant(BLOCKTYPE a_Plant) override
{
return (
+ (a_Plant == E_BLOCK_BEETROOTS) ||
(a_Plant == E_BLOCK_CROPS) ||
(a_Plant == E_BLOCK_CARROTS) ||
(a_Plant == E_BLOCK_POTATOES) ||
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index be254900d..028fdbfbd 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -187,6 +187,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType);
case E_BLOCK_BEACON: return new cBlockEntityHandler (a_BlockType);
case E_BLOCK_BED: return new cBlockBedHandler (a_BlockType);
+ case E_BLOCK_BEETROOTS: return new cBlockCropsHandler<4> (a_BlockType); // 4 stages of growth
case E_BLOCK_BIG_FLOWER: return new cBlockBigFlowerHandler (a_BlockType);
case E_BLOCK_BIRCH_DOOR: return new cBlockDoorHandler (a_BlockType);
case E_BLOCK_BIRCH_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
@@ -196,9 +197,10 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType);
case E_BLOCK_CACTUS: return new cBlockCactusHandler (a_BlockType);
case E_BLOCK_CAKE: return new cBlockCakeHandler (a_BlockType);
- case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType);
+ case E_BLOCK_CARROTS: return new cBlockCropsHandler<8> (a_BlockType); // 8 stages of growth
case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType);
case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType);
+ case E_BLOCK_CHAIN_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType);
case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType);
case E_BLOCK_CLAY: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType);
@@ -208,7 +210,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_COBBLESTONE: return new cBlockStoneHandler (a_BlockType);
case E_BLOCK_COBBLESTONE_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_COBWEB: return new cBlockCobWebHandler (a_BlockType);
- case E_BLOCK_CROPS: return new cBlockCropsHandler (a_BlockType);
+ case E_BLOCK_CROPS: return new cBlockCropsHandler<8> (a_BlockType); // 8 stages of growth
case E_BLOCK_DARK_OAK_DOOR: return new cBlockDoorHandler (a_BlockType);
case E_BLOCK_DARK_OAK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
case E_BLOCK_DARK_OAK_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
@@ -225,7 +227,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_ENCHANTMENT_TABLE: return new cBlockEnchantmentTableHandler(a_BlockType);
case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType);
case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler (a_BlockType);
- case E_BLOCK_OAK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
+ case E_BLOCK_FROSTED_ICE: return new cBlockIceHandler (a_BlockType);
case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType);
case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType);
case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType);
@@ -271,13 +273,18 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_RED_SANDSTONE_SLAB: return new cBlockSlabHandler (a_BlockType);
case E_BLOCK_NOTE_BLOCK: return new cBlockEntityHandler (a_BlockType);
+ case E_BLOCK_OAK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
+ case E_BLOCK_PACKED_ICE: return new cBlockIceHandler (a_BlockType);
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler;
case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType);
- case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
+ case E_BLOCK_POTATOES: return new cBlockCropsHandler<8> (a_BlockType); // 8 stages of growth
case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType);
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType);
+ case E_BLOCK_PURPUR_DOUBLE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
+ case E_BLOCK_PURPUR_SLAB: return new cBlockSlabHandler (a_BlockType);
+ case E_BLOCK_PURPUR_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_QUARTZ_BLOCK: return new cBlockQuartzHandler (a_BlockType);
case E_BLOCK_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
@@ -292,6 +299,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_REDSTONE_WIRE: return new cBlockRedstoneHandler (a_BlockType);
case E_BLOCK_RED_MUSHROOM: return new cBlockMushroomHandler (a_BlockType);
case E_BLOCK_RED_ROSE: return new cBlockFlowerHandler (a_BlockType);
+ case E_BLOCK_REPEATING_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType);
case E_BLOCK_SAND: return new cBlockSandHandler (a_BlockType);
case E_BLOCK_SANDSTONE_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_SAPLING: return new cBlockSaplingHandler (a_BlockType);
@@ -456,6 +464,7 @@ void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterfac
case E_BLOCK_ACACIA_DOOR:
case E_BLOCK_ACTIVE_COMPARATOR:
case E_BLOCK_BED:
+ case E_BLOCK_BEETROOTS:
case E_BLOCK_BIRCH_DOOR:
case E_BLOCK_BREWING_STAND:
case E_BLOCK_CAKE:
@@ -482,6 +491,7 @@ void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterfac
case E_BLOCK_PISTON_EXTENSION:
case E_BLOCK_POTATOES:
case E_BLOCK_PUMPKIN_STEM:
+ case E_BLOCK_PURPUR_DOUBLE_SLAB:
case E_BLOCK_REDSTONE_ORE_GLOWING:
case E_BLOCK_REDSTONE_REPEATER_OFF:
case E_BLOCK_REDSTONE_REPEATER_ON:
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index 18b688256..e1445c21c 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -113,12 +113,14 @@ private:
case E_BLOCK_BEACON:
case E_BLOCK_BEDROCK:
case E_BLOCK_BREWING_STAND:
+ case E_BLOCK_CHAIN_COMMAND_BLOCK:
case E_BLOCK_CHEST:
case E_BLOCK_COMMAND_BLOCK:
case E_BLOCK_DAYLIGHT_SENSOR:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
case E_BLOCK_ENCHANTMENT_TABLE:
+ case E_BLOCK_END_GATEWAY:
case E_BLOCK_END_PORTAL:
case E_BLOCK_END_PORTAL_FRAME:
// Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed / pulled in MCS :)
@@ -132,7 +134,9 @@ private:
case E_BLOCK_NOTE_BLOCK:
case E_BLOCK_OBSIDIAN:
case E_BLOCK_PISTON_EXTENSION:
+ case E_BLOCK_REPEATING_COMMAND_BLOCK:
case E_BLOCK_STANDING_BANNER:
+ case E_BLOCK_STRUCTURE_BLOCK:
case E_BLOCK_TRAPPED_CHEST:
case E_BLOCK_WALL_BANNER:
{
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h
index c75dee50d..01e9e701d 100644
--- a/src/Blocks/BlockSlab.h
+++ b/src/Blocks/BlockSlab.h
@@ -88,7 +88,12 @@ public:
/** Returns true if the specified blocktype is one of the slabs handled by this handler */
static bool IsAnySlabType(BLOCKTYPE a_BlockType)
{
- return ((a_BlockType == E_BLOCK_WOODEN_SLAB) || (a_BlockType == E_BLOCK_STONE_SLAB) || (a_BlockType == E_BLOCK_RED_SANDSTONE_SLAB));
+ return (
+ (a_BlockType == E_BLOCK_WOODEN_SLAB) ||
+ (a_BlockType == E_BLOCK_STONE_SLAB) ||
+ (a_BlockType == E_BLOCK_RED_SANDSTONE_SLAB) ||
+ (a_BlockType == E_BLOCK_PURPUR_SLAB)
+ );
}
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
@@ -110,6 +115,7 @@ public:
case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
case E_BLOCK_WOODEN_SLAB: return E_BLOCK_DOUBLE_WOODEN_SLAB;
case E_BLOCK_RED_SANDSTONE_SLAB: return E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB;
+ case E_BLOCK_PURPUR_SLAB: return E_BLOCK_PURPUR_DOUBLE_SLAB;
}
ASSERT(!"Unhandled slab type!");
return E_BLOCK_AIR;
@@ -167,6 +173,10 @@ public:
{
return 10;
}
+ case E_BLOCK_PURPUR_SLAB:
+ {
+ return 16;
+ }
default:
{
ASSERT(!"Unhandled blocktype in slab handler!");
@@ -211,6 +221,7 @@ public:
case E_BLOCK_DOUBLE_STONE_SLAB: return E_BLOCK_STONE_SLAB;
case E_BLOCK_DOUBLE_WOODEN_SLAB: return E_BLOCK_WOODEN_SLAB;
case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB: return E_BLOCK_RED_SANDSTONE_SLAB;
+ case E_BLOCK_PURPUR_DOUBLE_SLAB: return E_BLOCK_PURPUR_SLAB;
}
ASSERT(!"Unhandled double slab type!");
return a_BlockType;
diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h
index 3d7dd1442..c3d5193e8 100644
--- a/src/Blocks/BlockStairs.h
+++ b/src/Blocks/BlockStairs.h
@@ -104,6 +104,7 @@ public:
case E_BLOCK_STONE_BRICK_STAIRS: return 11;
case E_BLOCK_OAK_WOOD_STAIRS: return 13;
case E_BLOCK_ACACIA_WOOD_STAIRS: return 15;
+ case E_BLOCK_PURPUR_STAIRS: return 16;
case E_BLOCK_DARK_OAK_WOOD_STAIRS: return 26;
case E_BLOCK_BRICK_STAIRS: return 28;
case E_BLOCK_NETHER_BRICK_STAIRS: return 35;