mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Fixed bug where Bonus Chests would spawn again when loading back into it.
Fixes #982 Added a check for if the world is new. Meaning no more additional chests if the world is loaded up again.
This commit is contained in:
parent
3c52436c08
commit
ee3a5e8393
|
|
@ -24,6 +24,9 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||||
|
|
||||||
bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, bool force)
|
bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, bool force)
|
||||||
{
|
{
|
||||||
|
//Will only spawn a bonus chest if the world is new and has never been saved.
|
||||||
|
if (level->isNew)
|
||||||
|
{
|
||||||
if( !force )
|
if( !force )
|
||||||
{
|
{
|
||||||
int t = 0;
|
int t = 0;
|
||||||
|
|
@ -59,7 +62,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
|
||||||
{
|
{
|
||||||
level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS);
|
level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS);
|
||||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
|
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
|
||||||
if (chest != nullptr)
|
if (chest != NULL)
|
||||||
{
|
{
|
||||||
WeighedTreasure::addChestItems(random, treasureList, chest, numRolls);
|
WeighedTreasure::addChestItems(random, treasureList, chest, numRolls);
|
||||||
chest->isBonusChest = true; // 4J added
|
chest->isBonusChest = true; // 4J added
|
||||||
|
|
@ -85,4 +88,6 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue