summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua4
m---------MCServer/Plugins/Core0
-rw-r--r--MCServer/crafting.txt6
-rw-r--r--MCServer/furnace.txt1
-rw-r--r--src/BlockInfo.cpp1
-rw-r--r--src/Blocks/BlockCocoaPod.h96
-rw-r--r--src/Blocks/BlockHandler.cpp2
-rw-r--r--src/Blocks/CMakeLists.txt1
-rw-r--r--src/Entities/Player.cpp6
-rw-r--r--src/Generating/Caves.cpp25
-rw-r--r--src/Items/ItemDye.h46
-rw-r--r--src/World.cpp17
13 files changed, 197 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml
index 4e8377748..26e74c1b2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,9 +11,11 @@ before_install:
- sudo apt-get update -qq
install:
- # g++4.8
+ # g++4.8 and clang
- sudo apt-get install -qq g++-4.8
- - export CXX="g++-4.8"
+
+ # g++4.8
+ - if [ "$CXX" == "g++" ]; then export CXX="g++-4.8"; export CC="gcc-4.8"; fi
# Build MCServer
script: ./CIbuild.sh
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 72dcce5e4..ba3763724 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2564,7 +2564,9 @@ World:ForEachEntity(
if not(a_Entity:IsMob()) then
return;
end
- local Monster = tolua.cast(a_Entity, "cMonster"); -- Get the cMonster out of cEntity, now that we know the entity represents one.
+
+ -- Get the cMonster out of cEntity, now that we know the entity represents one.
+ local Monster = tolua.cast(a_Entity, "cMonster");
if (Monster:GetMobType() == mtSpider) then
Monster:TeleportToCoords(Monster:GetPosX(), Monster:GetPosY() + 100, Monster:GetPosZ());
end
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core
-Subproject 39d980e3a3447ac23f61c7d65426b33ee6c0718
+Subproject 6e9d612b9eb548d888d2bf986488aad762a99be
diff --git a/MCServer/crafting.txt b/MCServer/crafting.txt
index 4d28b1f52..a24fdee0c 100644
--- a/MCServer/crafting.txt
+++ b/MCServer/crafting.txt
@@ -277,12 +277,12 @@ ActivatorRail, 6 = IronIngot, 1:1, 1:2, 1:3, 3:1, 3:2, 3:3 | Stick, 2:1, 2:3 | R
#******************************************************#
# Mechanisms
#
-WoodenDoor, 3 = OakPlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
SpruceDoor, 3 = SprucePlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
BirchDoor, 3 = BirchPlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
JungleDoor, 3 = JunglePlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
AcaciaDoor, 3 = AcaciaPlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
DarkOakDoor, 3 = DarkOakPlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
+WoodenDoor, 3 = OakPlanks, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
IronDoor, 3 = IronIngot, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3
TrapDoor, 2 = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
IronTrapDoor = IronIngot, 1:1, 1:2, 2:1, 2:2
@@ -358,21 +358,21 @@ IronBars, 16 = IronIngot, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
Paper, 3 = Sugarcane, 1:1, 2:1, 3:1
Book = Paper, *, *, * | leather, *
Bookandquill = Book, * | feather, * | inksac, *
-Fence, 3 = OakPlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
SpruceFence, 3 = SprucePlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
BirchFence, 3 = BirchPlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
JungleFence, 3 = JunglePlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
DarkOakFence, 3 = DarkOakPlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
AcaciaFence, 3 = AcaciaPlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
+Fence, 3 = OakPlanks, 1:1, 1:2, 3:1, 3:2 | Stick, 2:1, 2:2
Cobblestonewall, 6 = cobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
mossycobblestonewall, 6 = mossycobblestone, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3
NetherBrickFence, 6 = NetherBrick, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
-FenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | OakPlanks, 2:1, 2:2
SpruceFenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | SprucePlanks, 2:1, 2:2
BirchFenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | BirchPlanks, 2:1, 2:2
JungleFenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | JunglePlanks, 2:1, 2:2
DarkOakFenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | DarkOakPlanks, 2:1, 2:2
AcaciaFenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | AcaciaPlanks, 2:1, 2:2
+FenceGate = Stick, 1:1, 1:2, 3:1, 3:2 | OakPlanks, 2:1, 2:2
Bed = Planks, 1:2, 2:2, 3:2 | Wool, 1:1, 2:1, 3:1
GoldIngot = GoldNugget, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
EyeOfEnder = EnderPearl, * | BlazePowder, *
diff --git a/MCServer/furnace.txt b/MCServer/furnace.txt
index 7179b5299..fb8d63677 100644
--- a/MCServer/furnace.txt
+++ b/MCServer/furnace.txt
@@ -49,6 +49,7 @@ NetherQuartzOre = NetherQuartz
Sand = Glass
Pork = CookedPork
RawBeef = Steak
+Potato = BakedPotato
RawChicken = CookedChicken
Clay = Brick
ClayBlock = HardenedClay
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index bcab21e77..3c5e8d7b7 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -452,7 +452,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_AIR ].m_IsSolid = false;
a_Info[E_BLOCK_BIG_FLOWER ].m_IsSolid = false;
a_Info[E_BLOCK_BROWN_MUSHROOM ].m_IsSolid = false;
- a_Info[E_BLOCK_CAKE ].m_IsSolid = false;
a_Info[E_BLOCK_CARROTS ].m_IsSolid = false;
a_Info[E_BLOCK_COBWEB ].m_IsSolid = false;
a_Info[E_BLOCK_CROPS ].m_IsSolid = false;
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
new file mode 100644
index 000000000..1b659d48f
--- /dev/null
+++ b/src/Blocks/BlockCocoaPod.h
@@ -0,0 +1,96 @@
+#pragma once
+
+#include "BlockHandler.h"
+#include "../FastRandom.h"
+
+
+
+
+
+class cBlockCocoaPodHandler :
+ public cBlockHandler
+{
+public:
+ cBlockCocoaPodHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
+ {
+ }
+
+
+ virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
+ {
+ eBlockFace BlockFace = MetaToBlockFace(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
+ AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockFace, true);
+
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ a_Chunk.UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ, BlockType, BlockMeta);
+
+ return ((BlockType == E_BLOCK_LOG) && ((BlockMeta & 0x3) == E_META_LOG_JUNGLE));
+ }
+
+
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ {
+ cFastRandom Random;
+
+ if (Random.NextInt(5) == 0)
+ {
+ NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
+ NIBBLETYPE TypeMeta = Meta & 0x03;
+ int GrowState = Meta >> 2;
+
+ if (GrowState < 2)
+ {
+ ++GrowState;
+ a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, (NIBBLETYPE) (GrowState << 2 | TypeMeta));
+ }
+ }
+ }
+
+
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
+ {
+ int GrowState = a_BlockMeta >> 2;
+ a_Pickups.Add(E_ITEM_DYE, ((GrowState >= 2) ? 3 : 1), E_META_DYE_BROWN);
+ }
+
+
+ static eBlockFace MetaToBlockFace(NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta & 0x3)
+ {
+ case 0: return BLOCK_FACE_ZM;
+ case 1: return BLOCK_FACE_XP;
+ case 2: return BLOCK_FACE_ZP;
+ case 3: return BLOCK_FACE_XM;
+ default:
+ {
+ ASSERT(!"Bad meta");
+ return BLOCK_FACE_NONE;
+ }
+ }
+ }
+
+
+ static NIBBLETYPE BlockFaceToMeta(eBlockFace a_BlockFace)
+ {
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_ZM: return 0;
+ case BLOCK_FACE_XM: return 3;
+ case BLOCK_FACE_XP: return 1;
+ case BLOCK_FACE_ZP: return 2;
+ default:
+ {
+ ASSERT(!"Unknown face");
+ return 0;
+ }
+ }
+ }
+
+} ;
+
+
+
+
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 60f13a747..d532aa1dc 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -17,6 +17,7 @@
#include "BlockChest.h"
#include "BlockCloth.h"
#include "BlockCobWeb.h"
+#include "BlockCocoaPod.h"
#include "BlockCommandBlock.h"
#include "BlockComparator.h"
#include "BlockCrops.h"
@@ -198,6 +199,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType);
case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType);
case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType);
+ case E_BLOCK_COCOA_POD: return new cBlockCocoaPodHandler (a_BlockType);
case E_BLOCK_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType);
case E_BLOCK_ACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType);
case E_BLOCK_COBBLESTONE: return new cBlockStoneHandler (a_BlockType);
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index eed949aab..ed3e321d4 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -24,6 +24,7 @@ SET (HDRS
BlockChest.h
BlockCloth.h
BlockCobWeb.h
+ BlockCocoaPod.h
BlockCommandBlock.h
BlockComparator.h
BlockCrops.h
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 8d2eb1e5f..15920d6cf 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1604,6 +1604,12 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
// Update the view distance.
m_ClientHandle->SetViewDistance(m_ClientHandle->GetRequestedViewDistance());
+ // Send current weather of target world to player
+ if (a_World->GetDimension() == dimOverworld)
+ {
+ m_ClientHandle->SendWeather(a_World->GetWeather());
+ }
+
return true;
}
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index e4735cb83..1e8dbef90 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -100,6 +100,7 @@ public:
void ProcessChunk(
int a_ChunkX, int a_ChunkZ,
cChunkDef::BlockTypes & a_BlockTypes,
+ cChunkDesc::BlockNibbleBytes & a_BlockMetas,
cChunkDef::HeightMap & a_HeightMap
);
@@ -455,6 +456,7 @@ void cCaveTunnel::CalcBoundingBox(void)
void cCaveTunnel::ProcessChunk(
int a_ChunkX, int a_ChunkZ,
cChunkDef::BlockTypes & a_BlockTypes,
+ cChunkDesc::BlockNibbleBytes & a_BlockMetas,
cChunkDef::HeightMap & a_HeightMap
)
{
@@ -505,6 +507,22 @@ void cCaveTunnel::ProcessChunk(
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
}
}
+ else if (SqDist <= SqRad * 2)
+ {
+ if (cChunkDef::GetBlock(a_BlockTypes, x, y, z) == E_BLOCK_SAND)
+ {
+ int Index = cChunkDef::MakeIndexNoCheck(x, y, z);
+ if (a_BlockMetas[Index] == 1)
+ {
+ a_BlockMetas[Index] = 0;
+ cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_RED_SANDSTONE);
+ }
+ else
+ {
+ cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_SANDSTONE);
+ }
+ }
+ }
} // for y
} // for x, z
} // for itr - m_Points[]
@@ -596,11 +614,12 @@ void cStructGenWormNestCaves::cCaveSystem::DrawIntoChunk(cChunkDesc & a_ChunkDes
{
int ChunkX = a_ChunkDesc.GetChunkX();
int ChunkZ = a_ChunkDesc.GetChunkZ();
- cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
- cChunkDef::HeightMap & HeightMap = a_ChunkDesc.GetHeightMap();
+ cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
+ cChunkDef::HeightMap & HeightMap = a_ChunkDesc.GetHeightMap();
+ cChunkDesc::BlockNibbleBytes & BlockMetas = a_ChunkDesc.GetBlockMetasUncompressed();
for (cCaveTunnels::const_iterator itr = m_Tunnels.begin(), end = m_Tunnels.end(); itr != end; ++itr)
{
- (*itr)->ProcessChunk(ChunkX, ChunkZ, BlockTypes, HeightMap);
+ (*itr)->ProcessChunk(ChunkX, ChunkZ, BlockTypes, BlockMetas, HeightMap);
} // for itr - m_Tunnels[]
}
diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h
index ccf4714f7..da978040d 100644
--- a/src/Items/ItemDye.h
+++ b/src/Items/ItemDye.h
@@ -4,6 +4,7 @@
#include "ItemHandler.h"
#include "../World.h"
#include "../Entities/Player.h"
+#include "../Blocks/BlockCocoaPod.h"
@@ -16,10 +17,9 @@ public:
cItemDyeHandler(int a_ItemType)
: cItemHandler(a_ItemType)
{
-
}
- virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
+ virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{
// Handle growing the plants:
if (a_Item.m_ItemDamage == E_META_DYE_WHITE)
@@ -34,8 +34,50 @@ public:
}
}
}
+ else if ((a_Item.m_ItemDamage == E_META_DYE_BROWN) && (a_BlockFace >= BLOCK_FACE_ZM) && (a_BlockFace <= BLOCK_FACE_XP))
+ {
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+
+ // Check if the block that the player clicked is a jungle log.
+ if ((BlockType != E_BLOCK_LOG) || ((BlockMeta & 0x3) != E_META_LOG_JUNGLE))
+ {
+ return false;
+ }
+
+ // Get the location from the new cocoa pod.
+ AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
+ BlockMeta = cBlockCocoaPodHandler::BlockFaceToMeta(a_BlockFace);
+
+ if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_AIR)
+ {
+ return false;
+ }
+
+ // Check plugins
+ if (cRoot::Get()->GetPluginManager()->CallHookPlayerPlacingBlock(*a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, 0, 0, 0, E_BLOCK_COCOA_POD, BlockMeta))
+ {
+ a_World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
+ a_Player->GetInventory().SendEquippedSlot();
+ return false;
+ }
+
+ // Set block and broadcast place sound
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COCOA_POD, BlockMeta);
+ a_World->BroadcastSoundEffect("dig.stone", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);
+
+ // Remove one cocoa pod from the inventory
+ if (!a_Player->IsGameModeCreative())
+ {
+ a_Player->GetInventory().RemoveOneEquippedItem();
+ }
+ cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, 0, 0, 0, E_BLOCK_COCOA_POD, BlockMeta);
+ return true;
+ }
return false;
}
+
} ;
diff --git a/src/World.cpp b/src/World.cpp
index 6783bd533..69b39f831 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1520,7 +1520,21 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
return true;
}
-
+
+ case E_BLOCK_COCOA_POD:
+ {
+ NIBBLETYPE TypeMeta = BlockMeta & 0x03;
+ int GrowState = BlockMeta >> 2;
+
+ if (GrowState < 2)
+ {
+ GrowState++;
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, (NIBBLETYPE) (GrowState << 2 | TypeMeta));
+ BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
+ }
+ return true;
+ }
+
case E_BLOCK_CROPS:
{
if (a_IsByBonemeal && !m_IsCropsBonemealable)
@@ -3280,7 +3294,6 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
return -1;
}
- BroadcastSpawnEntity(*a_Monster);
cPluginManager::Get()->CallHookSpawnedMonster(*this, *a_Monster);
return a_Monster->GetUniqueID();