summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/PluginManager.cpp2
-rw-r--r--src/BlockInfo.cpp1
-rw-r--r--src/Blocks/BlockCake.h55
-rw-r--r--src/Blocks/BlockHandler.cpp2
-rw-r--r--src/Blocks/BlockLeaves.h1
-rw-r--r--src/Blocks/BlockMushroom.h1
-rw-r--r--src/Blocks/BlockVine.h2
-rw-r--r--src/ChunkMap.cpp7
-rw-r--r--src/Cuboid.cpp14
-rw-r--r--src/Cuboid.h1
-rw-r--r--src/Defines.h26
-rw-r--r--src/Items/ItemCake.h41
-rw-r--r--src/Items/ItemHandler.cpp4
-rw-r--r--src/Items/ItemShears.h5
-rw-r--r--src/MobSpawner.cpp2
-rw-r--r--src/WorldStorage/WSSAnvil.cpp1
16 files changed, 150 insertions, 15 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index c7df6357e..b9cf160c4 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -248,7 +248,7 @@ bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message)
{
AStringVector Split(StringSplit(a_Message, " "));
ASSERT(!Split.empty()); // This should not happen - we know there's at least one char in the message so the split needs to be at least one item long
- a_Player->SendMessageInfo(Printf("Unknown command: \"%s\"", Split[0].c_str()));
+ a_Player->SendMessageInfo(Printf("Unknown command: \"%s\"", a_Message.c_str()));
LOGINFO("Player %s issued an unknown command: \"%s\"", a_Player->GetName().c_str(), a_Message.c_str());
return true; // Cancel sending
}
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index d1ecfdf7e..7d438ba3e 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -93,6 +93,7 @@ void cBlockInfo::Initialize(void)
ms_Info[E_BLOCK_IRON_BARS ].m_SpreadLightFalloff = 1;
ms_Info[E_BLOCK_IRON_DOOR ].m_SpreadLightFalloff = 1;
ms_Info[E_BLOCK_LEAVES ].m_SpreadLightFalloff = 1;
+ ms_Info[E_BLOCK_NEW_LEAVES ].m_SpreadLightFalloff = 1;
ms_Info[E_BLOCK_SIGN_POST ].m_SpreadLightFalloff = 1;
ms_Info[E_BLOCK_TORCH ].m_SpreadLightFalloff = 1;
ms_Info[E_BLOCK_VINES ].m_SpreadLightFalloff = 1;
diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h
new file mode 100644
index 000000000..36e133388
--- /dev/null
+++ b/src/Blocks/BlockCake.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "BlockHandler.h"
+
+
+
+
+
+class cBlockCakeHandler :
+ public cBlockHandler
+{
+public:
+ cBlockCakeHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
+ virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
+ {
+ NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+
+ if (!a_Player->Feed(2, 0.1))
+ {
+ return;
+ }
+
+ if (Meta >= 5)
+ {
+ a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
+ }
+ else
+ {
+ a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta + 1);
+ }
+ }
+
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
+ {
+ // Give nothing
+ }
+
+ virtual bool IsUseable(void) override
+ {
+ return true;
+ }
+
+ virtual const char * GetStepSound(void) override
+ {
+ return "step.cloth";
+ }
+} ;
+
+
+
+
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 5b8effc07..4f74e2f45 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -11,6 +11,7 @@
#include "BlockBrewingStand.h"
#include "BlockButton.h"
#include "BlockCactus.h"
+#include "BlockCake.h"
#include "BlockCarpet.h"
#include "BlockCauldron.h"
#include "BlockChest.h"
@@ -93,6 +94,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_BRICK_STAIRS: return new cBlockStairsHandler (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_CARPET: return new cBlockCarpetHandler (a_BlockType);
case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType);
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 7b8f0b378..a6d3373c1 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -16,6 +16,7 @@
{ \
case E_BLOCK_LEAVES: a_Area.SetBlockType(x, y, z, (BLOCKTYPE)(E_BLOCK_SPONGE + i + 1)); break; \
case E_BLOCK_LOG: return true; \
+ case E_BLOCK_NEW_LOG: return true; \
}
bool HasNearLog(cBlockArea &a_Area, int a_BlockX, int a_BlockY, int a_BlockZ);
diff --git a/src/Blocks/BlockMushroom.h b/src/Blocks/BlockMushroom.h
index 623cfda64..c30c1a401 100644
--- a/src/Blocks/BlockMushroom.h
+++ b/src/Blocks/BlockMushroom.h
@@ -39,6 +39,7 @@ public:
case E_BLOCK_CACTUS:
case E_BLOCK_ICE:
case E_BLOCK_LEAVES:
+ case E_BLOCK_NEW_LEAVES:
case E_BLOCK_AIR:
{
return false;
diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h
index 708583e70..8041d9359 100644
--- a/src/Blocks/BlockVine.h
+++ b/src/Blocks/BlockVine.h
@@ -73,7 +73,7 @@ public:
/// Returns true if the specified block type is good for vines to attach to
static bool IsBlockAttachable(BLOCKTYPE a_BlockType)
{
- return (a_BlockType == E_BLOCK_LEAVES) || cBlockInfo::IsSolid(a_BlockType);
+ return (a_BlockType == E_BLOCK_LEAVES) || (a_BlockType == E_BLOCK_NEW_LEAVES) || cBlockInfo::IsSolid(a_BlockType);
}
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 40964c654..62c1ec544 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1383,6 +1383,13 @@ void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks)
}
break;
}
+ case E_BLOCK_NEW_LEAVES:
+ {
+ if (itr->BlockType == E_BLOCK_NEW_LOG)
+ {
+ Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
+ }
+ }
}
} // for itr - a_Blocks[]
}
diff --git a/src/Cuboid.cpp b/src/Cuboid.cpp
index 2400c64f3..3e5240248 100644
--- a/src/Cuboid.cpp
+++ b/src/Cuboid.cpp
@@ -38,6 +38,20 @@ void cCuboid::Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2)
+void cCuboid::Assign(const cCuboid & a_SrcCuboid)
+{
+ p1.x = a_SrcCuboid.p1.x;
+ p1.y = a_SrcCuboid.p1.y;
+ p1.z = a_SrcCuboid.p1.z;
+ p2.x = a_SrcCuboid.p2.x;
+ p2.y = a_SrcCuboid.p2.y;
+ p2.z = a_SrcCuboid.p2.z;
+}
+
+
+
+
+
void cCuboid::Sort(void)
{
if (p1.x > p2.x)
diff --git a/src/Cuboid.h b/src/Cuboid.h
index b90a09e05..3239c54fc 100644
--- a/src/Cuboid.h
+++ b/src/Cuboid.h
@@ -21,6 +21,7 @@ public:
cCuboid(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2) : p1(a_X1, a_Y1, a_Z1), p2(a_X2, a_Y2, a_Z2) {}
void Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2);
+ void Assign(const cCuboid & a_SrcCuboid);
void Sort(void);
diff --git a/src/Defines.h b/src/Defines.h
index 3b7654265..38411c69d 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -530,16 +530,22 @@ enum eMessageType
// http://forum.mc-server.org/showthread.php?tid=1212
// MessageType...
- mtCustom, // Send raw data without any processing
- mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege)
- mtInformation, // Informational message (i.e. command usage)
- mtSuccess, // Something executed successfully
- mtWarning, // Something concerning (i.e. reload) is about to happen
- mtFatal, // Something catastrophic occured (i.e. plugin crash)
- mtDeath, // Denotes death of player
- mtPrivateMessage, // Player to player messaging identifier
- mtJoin, // A player has joined the server
- mtLeave, // A player has left the server
+ mtCustom, // Send raw data without any processing
+ mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege)
+ mtInformation, // Informational message (i.e. command usage)
+ mtSuccess, // Something executed successfully
+ mtWarning, // Something concerning (i.e. reload) is about to happen
+ mtFatal, // Something catastrophic occured (i.e. plugin crash)
+ mtDeath, // Denotes death of player
+ mtPrivateMessage, // Player to player messaging identifier
+ mtJoin, // A player has joined the server
+ mtLeave, // A player has left the server
+
+ // Common aliases:
+ mtFail = mtFailure,
+ mtError = mtFailure,
+ mtInfo = mtInformation,
+ mtPM = mtPrivateMessage,
};
diff --git a/src/Items/ItemCake.h b/src/Items/ItemCake.h
new file mode 100644
index 000000000..48e23ed59
--- /dev/null
+++ b/src/Items/ItemCake.h
@@ -0,0 +1,41 @@
+
+#pragma once
+
+#include "ItemHandler.h"
+
+
+
+
+
+class cItemCakeHandler :
+ public cItemHandler
+{
+public:
+ cItemCakeHandler(int a_ItemType) :
+ cItemHandler(a_ItemType)
+ {
+ }
+
+
+ virtual bool IsPlaceable(void) override
+ {
+ return true;
+ }
+
+
+ virtual bool GetPlacementBlockTypeMeta(
+ cWorld * a_World, cPlayer * a_Player,
+ int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
+ ) override
+ {
+ a_BlockType = E_BLOCK_CAKE;
+ a_BlockMeta = 0;
+ return true;
+ }
+} ;
+
+
+
+
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 232791f99..454fabdd7 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -13,6 +13,7 @@
#include "ItemBow.h"
#include "ItemBrewingStand.h"
#include "ItemBucket.h"
+#include "ItemCake.h"
#include "ItemCauldron.h"
#include "ItemCloth.h"
#include "ItemComparator.h"
@@ -94,6 +95,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
// Single item per handler, alphabetically sorted:
case E_BLOCK_LEAVES: return new cItemLeavesHandler(a_ItemType);
+ case E_BLOCK_NEW_LEAVES: return new cItemLeavesHandler(a_ItemType);
case E_BLOCK_SAPLING: return new cItemSaplingHandler(a_ItemType);
case E_BLOCK_WOOL: return new cItemClothHandler(a_ItemType);
case E_ITEM_BED: return new cItemBedHandler(a_ItemType);
@@ -101,6 +103,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_BOTTLE_O_ENCHANTING: return new cItemBottleOEnchantingHandler();
case E_ITEM_BOW: return new cItemBowHandler;
case E_ITEM_BREWING_STAND: return new cItemBrewingStandHandler(a_ItemType);
+ case E_ITEM_CAKE: return new cItemCakeHandler(a_ItemType);
case E_ITEM_CAULDRON: return new cItemCauldronHandler(a_ItemType);
case E_ITEM_COMPARATOR: return new cItemComparatorHandler(a_ItemType);
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);
@@ -338,6 +341,7 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_BREWING_STAND: return 64;
case E_ITEM_BUCKET: return 16;
case E_ITEM_CARROT: return 64;
+ case E_ITEM_CAKE: return 1;
case E_ITEM_CAULDRON: return 64;
case E_ITEM_CLAY: return 64;
case E_ITEM_CLAY_BRICK: return 64;
diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h
index b8f75f5ba..39d2776fa 100644
--- a/src/Items/ItemShears.h
+++ b/src/Items/ItemShears.h
@@ -28,10 +28,10 @@ public:
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
{
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
- if (Block == E_BLOCK_LEAVES)
+ if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES))
{
cItems Drops;
- Drops.push_back(cItem(E_BLOCK_LEAVES, 1, a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x03));
+ Drops.push_back(cItem(Block, 1, a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x03));
a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
@@ -49,6 +49,7 @@ public:
case E_BLOCK_COBWEB:
case E_BLOCK_VINES:
case E_BLOCK_LEAVES:
+ case E_BLOCK_NEW_LEAVES:
{
return true;
}
diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp
index 7704f6cf3..a0d0f5c54 100644
--- a/src/MobSpawner.cpp
+++ b/src/MobSpawner.cpp
@@ -169,7 +169,7 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
(TargetBlock == E_BLOCK_AIR) &&
(BlockAbove == E_BLOCK_AIR) &&
(
- (BlockBelow == E_BLOCK_GRASS) || (BlockBelow == E_BLOCK_LEAVES)
+ (BlockBelow == E_BLOCK_GRASS) || (BlockBelow == E_BLOCK_LEAVES) || (BlockBelow == E_BLOCK_NEW_LEAVES)
) &&
(a_RelY >= 62) &&
(m_Random.NextInt(3, a_Biome) != 0)
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 19405f4aa..7a2366755 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -369,6 +369,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT
{
case E_BLOCK_AIR:
case E_BLOCK_LEAVES:
+ case E_BLOCK_NEW_LEAVES:
{
// nothing needed
break;