Merge remote-tracking branch 'origin/master' into Ranks
This commit is contained in:
commit
3020e8cc05
@ -185,4 +185,10 @@ AttackDamage=6.0
|
|||||||
SightDistance=25.0
|
SightDistance=25.0
|
||||||
MaxHealth=100
|
MaxHealth=100
|
||||||
|
|
||||||
|
[Bat]
|
||||||
|
AttackRange=2.0
|
||||||
|
AttackRate=1
|
||||||
|
AttackDamage=0.0
|
||||||
|
SightDistance=25.0
|
||||||
|
MaxHealth=6
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ set(BINDING_DEPENDENCIES
|
|||||||
../Bindings/AllToLua.pkg
|
../Bindings/AllToLua.pkg
|
||||||
../Bindings/gen_LuaState_Call.lua
|
../Bindings/gen_LuaState_Call.lua
|
||||||
../Bindings/LuaFunctions.h
|
../Bindings/LuaFunctions.h
|
||||||
../Bindings/LuaState_Call.inc
|
|
||||||
../Bindings/LuaWindow.h
|
../Bindings/LuaWindow.h
|
||||||
../Bindings/Plugin.h
|
../Bindings/Plugin.h
|
||||||
../Bindings/PluginLua.h
|
../Bindings/PluginLua.h
|
||||||
@ -129,6 +128,7 @@ if (NOT MSVC)
|
|||||||
endif ()
|
endif ()
|
||||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
|
||||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.h PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.h PROPERTIES GENERATED TRUE)
|
||||||
|
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/LuaState_Call.inc PROPERTIES GENERATED TRUE)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_library(Bindings ${SRCS} ${HDRS})
|
add_library(Bindings ${SRCS} ${HDRS})
|
||||||
|
@ -549,13 +549,13 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl
|
|||||||
bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
|
bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
// Try the chest directly connected to the hopper:
|
// Try the chest directly connected to the hopper:
|
||||||
cChestEntity * Chest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ);
|
cChestEntity * ConnectedChest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
if (Chest == NULL)
|
if (ConnectedChest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MoveItemsToGrid(*Chest))
|
if (MoveItemsToGrid(*ConnectedChest))
|
||||||
{
|
{
|
||||||
// Chest block directly connected was not full
|
// Chest block directly connected was not full
|
||||||
return true;
|
return true;
|
||||||
@ -586,13 +586,13 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
BLOCKTYPE Block = Neighbor->GetBlock(x, a_BlockY, z);
|
BLOCKTYPE Block = Neighbor->GetBlock(x, a_BlockY, z);
|
||||||
if (Block != Chest->GetBlockType())
|
if (Block != ConnectedChest->GetBlockType())
|
||||||
{
|
{
|
||||||
// Not the same kind of chest
|
// Not the same kind of chest
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z);
|
cChestEntity * Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z);
|
||||||
if (Chest == NULL)
|
if (Chest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z);
|
||||||
|
@ -112,6 +112,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sends the slab back to the client. It's to refuse a doubleslab placement.
|
||||||
|
a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Converts the single-slab blocktype to its equivalent double-slab blocktype
|
/// Converts the single-slab blocktype to its equivalent double-slab blocktype
|
||||||
static BLOCKTYPE GetDoubleSlabType(BLOCKTYPE a_SingleSlabBlockType)
|
static BLOCKTYPE GetDoubleSlabType(BLOCKTYPE a_SingleSlabBlockType)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
/** Individual enchantment IDs, corresponding to their NBT IDs: http://www.minecraftwiki.net/wiki/Data_Values#Enchantment_IDs
|
/** Individual enchantment IDs, corresponding to their NBT IDs: http://www.minecraftwiki.net/wiki/Data_Values#Enchantment_IDs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum
|
enum eEnchantment
|
||||||
{
|
{
|
||||||
enchProtection = 0,
|
enchProtection = 0,
|
||||||
enchFireProtection = 1,
|
enchFireProtection = 1,
|
||||||
|
@ -33,6 +33,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const int cPlayer::MAX_HEALTH = 20;
|
||||||
|
|
||||||
|
const int cPlayer::MAX_FOOD_LEVEL = 20;
|
||||||
|
|
||||||
|
/** Number of ticks it takes to eat an item */
|
||||||
|
const int cPlayer::EATING_TICKS = 30;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) :
|
cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) :
|
||||||
@ -509,7 +518,7 @@ void cPlayer::Heal(int a_Health)
|
|||||||
|
|
||||||
void cPlayer::SetFoodLevel(int a_FoodLevel)
|
void cPlayer::SetFoodLevel(int a_FoodLevel)
|
||||||
{
|
{
|
||||||
int FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL));
|
int FoodLevel = Clamp(a_FoodLevel, 0, MAX_FOOD_LEVEL);
|
||||||
|
|
||||||
if (cRoot::Get()->GetPluginManager()->CallHookPlayerFoodLevelChange(*this, FoodLevel))
|
if (cRoot::Get()->GetPluginManager()->CallHookPlayerFoodLevelChange(*this, FoodLevel))
|
||||||
{
|
{
|
||||||
@ -601,7 +610,6 @@ void cPlayer::FinishEating(void)
|
|||||||
|
|
||||||
// Send the packets:
|
// Send the packets:
|
||||||
m_ClientHandle->SendEntityStatus(*this, esPlayerEatingAccepted);
|
m_ClientHandle->SendEntityStatus(*this, esPlayerEatingAccepted);
|
||||||
m_World->BroadcastEntityAnimation(*this, 0);
|
|
||||||
m_World->BroadcastEntityMetadata(*this);
|
m_World->BroadcastEntityMetadata(*this);
|
||||||
|
|
||||||
// consume the item:
|
// consume the item:
|
||||||
@ -619,8 +627,8 @@ void cPlayer::FinishEating(void)
|
|||||||
// if the food is mushroom soup, return a bowl to the inventory
|
// if the food is mushroom soup, return a bowl to the inventory
|
||||||
if (Item.m_ItemType == E_ITEM_MUSHROOM_SOUP)
|
if (Item.m_ItemType == E_ITEM_MUSHROOM_SOUP)
|
||||||
{
|
{
|
||||||
cItem emptyBowl(E_ITEM_BOWL, 1, 0, "");
|
cItem EmptyBowl(E_ITEM_BOWL);
|
||||||
GetInventory().AddItem(emptyBowl, true, true);
|
GetInventory().AddItem(EmptyBowl, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +639,6 @@ void cPlayer::FinishEating(void)
|
|||||||
void cPlayer::AbortEating(void)
|
void cPlayer::AbortEating(void)
|
||||||
{
|
{
|
||||||
m_EatingFinishTick = -1;
|
m_EatingFinishTick = -1;
|
||||||
m_World->BroadcastEntityAnimation(*this, 0);
|
|
||||||
m_World->BroadcastEntityMetadata(*this);
|
m_World->BroadcastEntityMetadata(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,6 +915,10 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
|
|||||||
}
|
}
|
||||||
GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str()));
|
GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str()));
|
||||||
}
|
}
|
||||||
|
else if (a_TDI.Attacker == NULL) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough
|
||||||
|
{
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
else if (a_TDI.Attacker->IsPlayer())
|
else if (a_TDI.Attacker->IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer * Killer = (cPlayer *)a_TDI.Attacker;
|
cPlayer * Killer = (cPlayer *)a_TDI.Attacker;
|
||||||
|
@ -29,12 +29,13 @@ class cPlayer :
|
|||||||
typedef cPawn super;
|
typedef cPawn super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
static const int MAX_HEALTH;
|
||||||
{
|
|
||||||
MAX_HEALTH = 20,
|
static const int MAX_FOOD_LEVEL;
|
||||||
MAX_FOOD_LEVEL = 20,
|
|
||||||
EATING_TICKS = 30, ///< Number of ticks it takes to eat an item
|
/** Number of ticks it takes to eat an item */
|
||||||
} ;
|
static const int EATING_TICKS;
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
CLASS_PROTODEF(cPlayer)
|
CLASS_PROTODEF(cPlayer)
|
||||||
|
@ -387,6 +387,28 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
|
|
||||||
m_FinishGens.push_back(new cFinishGenSingleTopBlock(Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks));
|
m_FinishGens.push_back(new cFinishGenSingleTopBlock(Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "NaturalPatches") == 0)
|
||||||
|
{
|
||||||
|
cStructGenOreNests::OreList Ores;
|
||||||
|
|
||||||
|
// Dirt vein
|
||||||
|
cStructGenOreNests::OreInfo DirtVein;
|
||||||
|
DirtVein.BlockType = E_BLOCK_DIRT;
|
||||||
|
DirtVein.MaxHeight = 127;
|
||||||
|
DirtVein.NumNests = 20;
|
||||||
|
DirtVein.NestSize = 32;
|
||||||
|
Ores.push_back(DirtVein);
|
||||||
|
|
||||||
|
// Gravel vein
|
||||||
|
cStructGenOreNests::OreInfo GravelVein;
|
||||||
|
GravelVein.BlockType = E_BLOCK_DIRT;
|
||||||
|
GravelVein.MaxHeight = 127;
|
||||||
|
GravelVein.NumNests = 20;
|
||||||
|
GravelVein.NestSize = 32;
|
||||||
|
Ores.push_back(GravelVein);
|
||||||
|
|
||||||
|
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "NetherClumpFoliage") == 0)
|
else if (NoCaseCompare(*itr, "NetherClumpFoliage") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
|
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
|
||||||
@ -398,9 +420,74 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
|
int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
|
||||||
m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth));
|
m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "NetherOreNests") == 0)
|
||||||
|
{
|
||||||
|
cStructGenOreNests::OreList Ores;
|
||||||
|
|
||||||
|
// Quartz vein
|
||||||
|
cStructGenOreNests::OreInfo QuartzVein;
|
||||||
|
QuartzVein.BlockType = E_BLOCK_NETHER_QUARTZ_ORE;
|
||||||
|
QuartzVein.MaxHeight = 255;
|
||||||
|
QuartzVein.NumNests = 80;
|
||||||
|
QuartzVein.NestSize = 8;
|
||||||
|
Ores.push_back(QuartzVein);
|
||||||
|
|
||||||
|
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_NETHERRACK));
|
||||||
|
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "OreNests") == 0)
|
else if (NoCaseCompare(*itr, "OreNests") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cStructGenOreNests(Seed));
|
cStructGenOreNests::OreList Ores;
|
||||||
|
|
||||||
|
// Coal vein
|
||||||
|
cStructGenOreNests::OreInfo CoalVein;
|
||||||
|
CoalVein.BlockType = E_BLOCK_COAL_ORE;
|
||||||
|
CoalVein.MaxHeight = 127;
|
||||||
|
CoalVein.NumNests = 50;
|
||||||
|
CoalVein.NestSize = 10;
|
||||||
|
Ores.push_back(CoalVein);
|
||||||
|
|
||||||
|
// Iron vein
|
||||||
|
cStructGenOreNests::OreInfo IronVein;
|
||||||
|
IronVein.BlockType = E_BLOCK_IRON_ORE;
|
||||||
|
IronVein.MaxHeight = 64;
|
||||||
|
IronVein.NumNests = 14;
|
||||||
|
IronVein.NestSize = 6;
|
||||||
|
Ores.push_back(IronVein);
|
||||||
|
|
||||||
|
// Gold vein
|
||||||
|
cStructGenOreNests::OreInfo GoldVein;
|
||||||
|
GoldVein.BlockType = E_BLOCK_GOLD_ORE;
|
||||||
|
GoldVein.MaxHeight = 32;
|
||||||
|
GoldVein.NumNests = 2;
|
||||||
|
GoldVein.NestSize = 6;
|
||||||
|
Ores.push_back(GoldVein);
|
||||||
|
|
||||||
|
// Redstone vein
|
||||||
|
cStructGenOreNests::OreInfo RedstoneVein;
|
||||||
|
RedstoneVein.BlockType = E_BLOCK_REDSTONE_ORE;
|
||||||
|
RedstoneVein.MaxHeight = 16;
|
||||||
|
RedstoneVein.NumNests = 4;
|
||||||
|
RedstoneVein.NestSize = 6;
|
||||||
|
Ores.push_back(RedstoneVein);
|
||||||
|
|
||||||
|
// Lapis vein
|
||||||
|
cStructGenOreNests::OreInfo LapisVein;
|
||||||
|
LapisVein.BlockType = E_BLOCK_LAPIS_ORE;
|
||||||
|
LapisVein.MaxHeight = 30;
|
||||||
|
LapisVein.NumNests = 2;
|
||||||
|
LapisVein.NestSize = 5;
|
||||||
|
Ores.push_back(LapisVein);
|
||||||
|
|
||||||
|
// Diamond vein
|
||||||
|
cStructGenOreNests::OreInfo DiamondVein;
|
||||||
|
DiamondVein.BlockType = E_BLOCK_DIAMOND_ORE;
|
||||||
|
DiamondVein.MaxHeight = 15;
|
||||||
|
DiamondVein.NumNests = 1;
|
||||||
|
DiamondVein.NestSize = 4;
|
||||||
|
Ores.push_back(DiamondVein);
|
||||||
|
|
||||||
|
m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE));
|
||||||
}
|
}
|
||||||
else if (NoCaseCompare(*itr, "POCPieces") == 0)
|
else if (NoCaseCompare(*itr, "POCPieces") == 0)
|
||||||
{
|
{
|
||||||
|
@ -484,8 +484,6 @@ int cFinishGenSingleTopBlock::GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap
|
|||||||
|
|
||||||
void cFinishGenSingleTopBlock::GenFinish(cChunkDesc & a_ChunkDesc)
|
void cFinishGenSingleTopBlock::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
// Add Lilypads on top of water surface in Swampland
|
|
||||||
|
|
||||||
int NumToGen = GetNumToGen(a_ChunkDesc.GetBiomeMap());
|
int NumToGen = GetNumToGen(a_ChunkDesc.GetBiomeMap());
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
|
@ -12,45 +12,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// cStructGenOreNests configuration:
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_COAL = 127;
|
|
||||||
const int NUM_NESTS_COAL = 50;
|
|
||||||
const int NEST_SIZE_COAL = 10;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_IRON = 64;
|
|
||||||
const int NUM_NESTS_IRON = 14;
|
|
||||||
const int NEST_SIZE_IRON = 6;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_REDSTONE = 16;
|
|
||||||
const int NUM_NESTS_REDSTONE = 4;
|
|
||||||
const int NEST_SIZE_REDSTONE = 6;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_GOLD = 32;
|
|
||||||
const int NUM_NESTS_GOLD = 2;
|
|
||||||
const int NEST_SIZE_GOLD = 6;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_DIAMOND = 15;
|
|
||||||
const int NUM_NESTS_DIAMOND = 1;
|
|
||||||
const int NEST_SIZE_DIAMOND = 4;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_LAPIS = 30;
|
|
||||||
const int NUM_NESTS_LAPIS = 2;
|
|
||||||
const int NEST_SIZE_LAPIS = 5;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_DIRT = 127;
|
|
||||||
const int NUM_NESTS_DIRT = 20;
|
|
||||||
const int NEST_SIZE_DIRT = 32;
|
|
||||||
|
|
||||||
const int MAX_HEIGHT_GRAVEL = 70;
|
|
||||||
const int NUM_NESTS_GRAVEL = 15;
|
|
||||||
const int NEST_SIZE_GRAVEL = 32;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenTrees:
|
// cStructGenTrees:
|
||||||
|
|
||||||
@ -311,14 +272,15 @@ void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
|
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_COAL_ORE, MAX_HEIGHT_COAL, NUM_NESTS_COAL, NEST_SIZE_COAL, BlockTypes, 1);
|
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_IRON_ORE, MAX_HEIGHT_IRON, NUM_NESTS_IRON, NEST_SIZE_IRON, BlockTypes, 2);
|
int seq = 1;
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_REDSTONE_ORE, MAX_HEIGHT_REDSTONE, NUM_NESTS_REDSTONE, NEST_SIZE_REDSTONE, BlockTypes, 3);
|
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_GOLD_ORE, MAX_HEIGHT_GOLD, NUM_NESTS_GOLD, NEST_SIZE_GOLD, BlockTypes, 4);
|
// Generate the ores from the ore list.
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIAMOND_ORE, MAX_HEIGHT_DIAMOND, NUM_NESTS_DIAMOND, NEST_SIZE_DIAMOND, BlockTypes, 5);
|
for (OreList::const_iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr)
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_LAPIS_ORE, MAX_HEIGHT_LAPIS, NUM_NESTS_LAPIS, NEST_SIZE_LAPIS, BlockTypes, 6);
|
{
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIRT, MAX_HEIGHT_DIRT, NUM_NESTS_DIRT, NEST_SIZE_DIRT, BlockTypes, 10);
|
GenerateOre(ChunkX, ChunkZ, itr->BlockType, itr->MaxHeight, itr->NumNests, itr->NestSize, BlockTypes, seq);
|
||||||
GenerateOre(ChunkX, ChunkZ, E_BLOCK_GRAVEL, MAX_HEIGHT_GRAVEL, NUM_NESTS_GRAVEL, NEST_SIZE_GRAVEL, BlockTypes, 11);
|
seq++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -376,7 +338,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Index = cChunkDef::MakeIndexNoCheck(BlockX, BlockY, BlockZ);
|
int Index = cChunkDef::MakeIndexNoCheck(BlockX, BlockY, BlockZ);
|
||||||
if (a_BlockTypes[Index] == E_BLOCK_STONE)
|
if (a_BlockTypes[Index] == m_ToReplace)
|
||||||
{
|
{
|
||||||
a_BlockTypes[Index] = a_OreType;
|
a_BlockTypes[Index] = a_OreType;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,30 @@ class cStructGenOreNests :
|
|||||||
public cFinishGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
struct OreInfo
|
||||||
|
{
|
||||||
|
BLOCKTYPE BlockType; // The type of the nest.
|
||||||
|
int MaxHeight; // The highest possible a nest can occur
|
||||||
|
int NumNests; // How many nests per chunk
|
||||||
|
int NestSize; // The amount of blocks a nest can have.
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<OreInfo> OreList;
|
||||||
|
|
||||||
|
cStructGenOreNests(int a_Seed, OreList a_OreList, BLOCKTYPE a_ToReplace) :
|
||||||
|
m_Noise(a_Seed),
|
||||||
|
m_Seed(a_Seed),
|
||||||
|
m_OreList(a_OreList),
|
||||||
|
m_ToReplace(a_ToReplace)
|
||||||
|
{}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cNoise m_Noise;
|
cNoise m_Noise;
|
||||||
int m_Seed;
|
int m_Seed;
|
||||||
|
|
||||||
|
OreList m_OreList; // A list of possible ores.
|
||||||
|
BLOCKTYPE m_ToReplace;
|
||||||
|
|
||||||
// cFinishGen override:
|
// cFinishGen override:
|
||||||
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
class cHTTPMessage
|
class cHTTPMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
enum eStatus
|
||||||
{
|
{
|
||||||
HTTP_OK = 200,
|
HTTP_OK = 200,
|
||||||
HTTP_BAD_REQUEST = 400,
|
HTTP_BAD_REQUEST = 400,
|
||||||
|
@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Results of packet-parsing:
|
/// Results of packet-parsing:
|
||||||
enum
|
enum eParseResult
|
||||||
{
|
{
|
||||||
PARSE_OK = 1,
|
PARSE_OK = 1,
|
||||||
PARSE_ERROR = -1,
|
PARSE_ERROR = -1,
|
||||||
|
@ -48,7 +48,10 @@ Implements the 1.7.x protocol classes:
|
|||||||
|
|
||||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||||
Type Var; \
|
Type Var; \
|
||||||
ByteBuf.Proc(Var);
|
if (!ByteBuf.Proc(Var))\
|
||||||
|
{\
|
||||||
|
return;\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1700,8 +1703,7 @@ bool cProtocol172::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType)
|
|||||||
|
|
||||||
void cProtocol172::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer)
|
void cProtocol172::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer)
|
||||||
{
|
{
|
||||||
Int64 Timestamp;
|
HANDLE_READ(a_ByteBuffer, ReadBEInt64, Int64, Timestamp);
|
||||||
a_ByteBuffer.ReadBEInt64(Timestamp);
|
|
||||||
|
|
||||||
cPacketizer Pkt(*this, 0x01); // Ping packet
|
cPacketizer Pkt(*this, 0x01); // Ping packet
|
||||||
Pkt.WriteInt64(Timestamp);
|
Pkt.WriteInt64(Timestamp);
|
||||||
@ -2054,7 +2056,10 @@ void cProtocol172::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
|
|||||||
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
|
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
|
||||||
HANDLE_READ(a_ByteBuffer, ReadBEShort, short, Length);
|
HANDLE_READ(a_ByteBuffer, ReadBEShort, short, Length);
|
||||||
AString Data;
|
AString Data;
|
||||||
a_ByteBuffer.ReadString(Data, Length);
|
if (!a_ByteBuffer.ReadString(Data, Length))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_Client->HandlePluginMessage(Channel, Data);
|
m_Client->HandlePluginMessage(Channel, Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user