Merge pull request #700 from Howaner/GlobalFixes
Add new Trees (without Generator)
This commit is contained in:
commit
191a08fc32
@ -527,10 +527,12 @@ enum
|
||||
E_META_SANDSTONE_SMOOTH = 2,
|
||||
|
||||
// E_BLOCK_SAPLING metas (lowest 3 bits):
|
||||
E_META_SAPLING_APPLE = 0,
|
||||
E_META_SAPLING_CONIFER = 1,
|
||||
E_META_SAPLING_BIRCH = 2,
|
||||
E_META_SAPLING_JUNGLE = 3,
|
||||
E_META_SAPLING_APPLE = 0,
|
||||
E_META_SAPLING_CONIFER = 1,
|
||||
E_META_SAPLING_BIRCH = 2,
|
||||
E_META_SAPLING_JUNGLE = 3,
|
||||
E_META_SAPLING_ACACIA = 4,
|
||||
E_META_SAPLING_DARK_OAK = 5,
|
||||
|
||||
// E_BLOCK_SILVERFISH_EGG metas:
|
||||
E_META_SILVERFISH_EGG_STONE = 0,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "BlockIce.h"
|
||||
#include "BlockLadder.h"
|
||||
#include "BlockLeaves.h"
|
||||
#include "BlockNewLeaves.h"
|
||||
#include "BlockLever.h"
|
||||
#include "BlockMelon.h"
|
||||
#include "BlockMushroom.h"
|
||||
@ -108,6 +109,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
switch(a_BlockType)
|
||||
{
|
||||
// Block handlers, alphabetically sorted:
|
||||
case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType);
|
||||
case E_BLOCK_BED: return new cBlockBedHandler (a_BlockType);
|
||||
case E_BLOCK_BIRCH_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
@ -126,6 +128,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE 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_DARK_OAK_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
case E_BLOCK_DEAD_BUSH: return new cBlockDeadBushHandler (a_BlockType);
|
||||
case E_BLOCK_DETECTOR_RAIL: return new cBlockRailHandler (a_BlockType);
|
||||
case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType);
|
||||
@ -169,6 +172,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
|
||||
case E_BLOCK_NETHER_WART: return new cBlockNetherWartHandler (a_BlockType);
|
||||
case E_BLOCK_NEW_LEAVES: return new cBlockNewLeavesHandler (a_BlockType);
|
||||
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
|
||||
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
||||
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
||||
|
@ -139,6 +139,8 @@ bool HasNearLog(cBlockArea & a_Area, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
switch (Types[i])
|
||||
{
|
||||
case E_BLOCK_NEW_LEAVES:
|
||||
case E_BLOCK_NEW_LOG:
|
||||
case E_BLOCK_LEAVES:
|
||||
case E_BLOCK_LOG:
|
||||
{
|
||||
|
42
src/Blocks/BlockNewLeaves.h
Normal file
42
src/Blocks/BlockNewLeaves.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "BlockHandler.h"
|
||||
#include "BlockLeaves.h"
|
||||
#include "../World.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cBlockNewLeavesHandler :
|
||||
public cBlockLeavesHandler
|
||||
{
|
||||
public:
|
||||
cBlockNewLeavesHandler(BLOCKTYPE a_BlockType)
|
||||
: cBlockLeavesHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
MTRand rand;
|
||||
|
||||
// Only the first 2 bits contain the display information, the others are for growing
|
||||
if (rand.randInt(5) == 0)
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, (a_BlockMeta & 3) + 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -382,6 +382,24 @@ 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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
|
||||
{
|
||||
int Height = 9 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
|
||||
|
@ -63,6 +63,12 @@ void GetLargeAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a
|
||||
/// Generates an image of a random birch tree
|
||||
void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
||||
|
||||
/// Generates an image of a random acacia tree
|
||||
void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
||||
|
||||
/// Generates an image of a random darkoak tree
|
||||
void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
||||
|
||||
/// Generates an image of a random large birch tree
|
||||
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks,sSetBlockVector & a_OtherBlocks);
|
||||
|
||||
|
@ -1216,10 +1216,12 @@ void cWorld::GrowTreeFromSapling(int a_X, int a_Y, int a_Z, NIBBLETYPE a_Sapling
|
||||
sSetBlockVector Logs, Other;
|
||||
switch (a_SaplingMeta & 0x07)
|
||||
{
|
||||
case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_ACACIA: GetAcaciaTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
case E_META_SAPLING_DARK_OAK: GetDarkoakTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
|
||||
}
|
||||
Other.insert(Other.begin(), Logs.begin(), Logs.end());
|
||||
Logs.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user