aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ChestTileEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/ChestTileEntity.cpp')
-rw-r--r--Minecraft.World/ChestTileEntity.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp
index ba277e24..b8f323f4 100644
--- a/Minecraft.World/ChestTileEntity.cpp
+++ b/Minecraft.World/ChestTileEntity.cpp
@@ -65,7 +65,7 @@ shared_ptr<ItemInstance> ChestTileEntity::getItem(unsigned int slot)
shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
{
- if (items->data[slot] != nullptr)
+ if (items->data[slot] != NULL)
{
if (items->data[slot]->count <= count)
{
@@ -91,7 +91,7 @@ shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int coun
shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
{
- if (items->data[slot] != nullptr)
+ if (items->data[slot] != NULL)
{
shared_ptr<ItemInstance> item = items->data[slot];
items->data[slot] = nullptr;
@@ -103,7 +103,7 @@ shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
void ChestTileEntity::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
items->data[slot] = item;
- if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize();
+ if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize();
this->setChanged();
}
@@ -154,10 +154,10 @@ void ChestTileEntity::save(CompoundTag *base)
for (unsigned int i = 0; i < items->length; i++)
{
- if (items->data[i] != nullptr)
+ if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
- tag->putByte(L"Slot", static_cast<byte>(i));
+ tag->putByte(L"Slot", (byte) i);
items->data[i]->save(tag);
listTag->add(tag);
}
@@ -244,17 +244,17 @@ void ChestTileEntity::checkNeighbors()
}
shared_ptr<ChestTileEntity> cteThis = dynamic_pointer_cast<ChestTileEntity>(shared_from_this());
- if (n.lock() != nullptr) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH);
- if (s.lock() != nullptr) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH);
- if (e.lock() != nullptr) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST);
- if (w.lock() != nullptr) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST);
+ if (n.lock() != NULL) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH);
+ if (s.lock() != NULL) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH);
+ if (e.lock() != NULL) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST);
+ if (w.lock() != NULL) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST);
}
bool ChestTileEntity::isSameChest(int x, int y, int z)
{
Tile *tile = Tile::tiles[level->getTile(x, y, z)];
- if (tile == nullptr || !(dynamic_cast<ChestTile *>(tile) != nullptr)) return false;
- return static_cast<ChestTile *>(tile)->type == getType();
+ if (tile == NULL || !(dynamic_cast<ChestTile *>(tile) != NULL)) return false;
+ return ((ChestTile *) tile)->type == getType();
}
void ChestTileEntity::tick()
@@ -283,7 +283,7 @@ void ChestTileEntity::tick()
shared_ptr<Container> container = containerMenu->getContainer();
shared_ptr<Container> thisContainer = dynamic_pointer_cast<Container>(shared_from_this());
shared_ptr<CompoundContainer> compoundContainer = dynamic_pointer_cast<CompoundContainer>(container);
- if ((container == thisContainer) || (compoundContainer != nullptr && compoundContainer->contains(thisContainer)))
+ if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer)))
{
openCount++;
}
@@ -298,12 +298,12 @@ void ChestTileEntity::tick()
float speed = 0.10f;
if (openCount > 0 && openness == 0)
{
- if (n.lock() == nullptr && w.lock() == nullptr)
+ if (n.lock() == NULL && w.lock() == NULL)
{
double xc = x + 0.5;
double zc = z + 0.5;
- if (s.lock() != nullptr) zc += 0.5;
- if (e.lock() != nullptr) xc += 0.5;
+ if (s.lock() != NULL) zc += 0.5;
+ if (e.lock() != NULL) xc += 0.5;
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
@@ -323,12 +323,12 @@ void ChestTileEntity::tick()
{
// Fix for #64546 - Customer Encountered: TU7: Chests placed by the Player are closing too fast.
//openness = 0;
- if (n.lock() == nullptr && w.lock() == nullptr)
+ if (n.lock() == NULL && w.lock() == NULL)
{
double xc = x + 0.5;
double zc = z + 0.5;
- if (s.lock() != nullptr) zc += 0.5;
- if (e.lock() != nullptr) xc += 0.5;
+ if (s.lock() != NULL) zc += 0.5;
+ if (e.lock() != NULL) xc += 0.5;
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
@@ -366,7 +366,7 @@ void ChestTileEntity::startOpen()
void ChestTileEntity::stopOpen()
{
- if (getTile() == nullptr || !( dynamic_cast<ChestTile *>( getTile() ) != nullptr)) return;
+ if (getTile() == NULL || !( dynamic_cast<ChestTile *>( getTile() ) != NULL)) return;
openCount--;
level->tileEvent(x, y, z, getTile()->id, ChestTile::EVENT_SET_OPEN_COUNT, openCount);
level->updateNeighborsAt(x, y, z, getTile()->id);
@@ -389,9 +389,9 @@ int ChestTileEntity::getType()
{
if (type == -1)
{
- if (level != nullptr && dynamic_cast<ChestTile *>( getTile() ) != nullptr)
+ if (level != NULL && dynamic_cast<ChestTile *>( getTile() ) != NULL)
{
- type = static_cast<ChestTile *>(getTile())->type;
+ type = ((ChestTile *) getTile())->type;
}
else
{
@@ -405,12 +405,12 @@ int ChestTileEntity::getType()
// 4J Added
shared_ptr<TileEntity> ChestTileEntity::clone()
{
- shared_ptr<ChestTileEntity> result = std::make_shared<ChestTileEntity>();
+ shared_ptr<ChestTileEntity> result = shared_ptr<ChestTileEntity>( new ChestTileEntity() );
TileEntity::clone(result);
for (unsigned int i = 0; i < items->length; i++)
{
- if (items->data[i] != nullptr)
+ if (items->data[i] != NULL)
{
result->items->data[i] = ItemInstance::clone(items->data[i]);
}