aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ChestTileEntity.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-03 06:14:34 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-03 06:14:34 +0700
commit13c8bafad57bd081a3e87eb7e67a3a0d98734706 (patch)
tree7b5ab6ffd2d550129e77a458295aa6e65da9cb0b /Minecraft.World/ChestTileEntity.cpp
parent41ded31af8767a6a0a0da2075d6bcd7d17078873 (diff)
Minor fixes
1. Improve const correctness in a few places (such as `Container::getMaxStackSize()` -> `Container::getMaxStackSize() const`) 2. Use C++11 varargs for `I18n::get`, `Entity::newDoubleList` and `Language::getElement`
Diffstat (limited to 'Minecraft.World/ChestTileEntity.cpp')
-rw-r--r--Minecraft.World/ChestTileEntity.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp
index 39f957bd..fded7d28 100644
--- a/Minecraft.World/ChestTileEntity.cpp
+++ b/Minecraft.World/ChestTileEntity.cpp
@@ -53,7 +53,7 @@ ChestTileEntity::~ChestTileEntity()
delete items;
}
-unsigned int ChestTileEntity::getContainerSize()
+unsigned int ChestTileEntity::getContainerSize()
{
return 9 * 3;
}
@@ -63,11 +63,11 @@ shared_ptr<ItemInstance> ChestTileEntity::getItem(unsigned int slot)
return items->data[slot];
}
-shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
+shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
{
if (items->data[slot] != NULL)
{
- if (items->data[slot]->count <= count)
+ if (items->data[slot]->count <= count)
{
shared_ptr<ItemInstance> item = items->data[slot];
items->data[slot] = nullptr;
@@ -75,8 +75,8 @@ shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int coun
// 4J Stu - Fix for duplication glitch
if(item->count <= 0) return nullptr;
return item;
- }
- else
+ }
+ else
{
shared_ptr<ItemInstance> i = items->data[slot]->remove(count);
if (items->data[slot]->count == 0) items->data[slot] = nullptr;
@@ -154,7 +154,7 @@ void ChestTileEntity::save(CompoundTag *base)
for (unsigned int i = 0; i < items->length; i++)
{
- if (items->data[i] != NULL)
+ if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
@@ -167,7 +167,7 @@ void ChestTileEntity::save(CompoundTag *base)
base->putBoolean(L"bonus", isBonusChest);
}
-int ChestTileEntity::getMaxStackSize()
+int ChestTileEntity::getMaxStackSize() const
{
return Container::LARGE_MAX_STACK_SIZE;
}
@@ -179,7 +179,7 @@ bool ChestTileEntity::stillValid(shared_ptr<Player> player)
return true;
}
-void ChestTileEntity::setChanged()
+void ChestTileEntity::setChanged()
{
TileEntity::setChanged();
}
@@ -302,7 +302,7 @@ void ChestTileEntity::tick()
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
+ // 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);
}
}
@@ -327,7 +327,7 @@ void ChestTileEntity::tick()
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
+ // 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);
}
}