From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR --- Minecraft.World/MinecartFurnace.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Minecraft.World/MinecartFurnace.cpp') diff --git a/Minecraft.World/MinecartFurnace.cpp b/Minecraft.World/MinecartFurnace.cpp index 24950d5c..fa005eca 100644 --- a/Minecraft.World/MinecartFurnace.cpp +++ b/Minecraft.World/MinecartFurnace.cpp @@ -37,7 +37,7 @@ int MinecartFurnace::getType() void MinecartFurnace::defineSynchedData() { Minecart::defineSynchedData(); - entityData->define(DATA_ID_FUEL, (byte) 0); + entityData->define(DATA_ID_FUEL, static_cast(0)); } void MinecartFurnace::tick() @@ -66,7 +66,7 @@ void MinecartFurnace::destroy(DamageSource *source) if (!source->isExplosion()) { - spawnAtLocation(shared_ptr(new ItemInstance(Tile::furnace, 1)), 0); + spawnAtLocation(std::make_shared(Tile::furnace, 1), 0); } } @@ -123,7 +123,7 @@ void MinecartFurnace::applyNaturalSlowdown() bool MinecartFurnace::interact(shared_ptr player) { shared_ptr selected = player->inventory->getSelected(); - if (selected != NULL && selected->id == Item::coal_Id) + if (selected != nullptr && selected->id == Item::coal_Id) { if (!player->abilities.instabuild && --selected->count == 0) player->inventory->setItem(player->inventory->selected, nullptr); fuel += SharedConstants::TICKS_PER_SECOND * 180; @@ -140,7 +140,7 @@ void MinecartFurnace::addAdditonalSaveData(CompoundTag *base) Minecart::addAdditonalSaveData(base); base->putDouble(L"PushX", xPush); base->putDouble(L"PushZ", zPush); - base->putShort(L"Fuel", (short) fuel); + base->putShort(L"Fuel", static_cast(fuel)); } void MinecartFurnace::readAdditionalSaveData(CompoundTag *base) @@ -160,11 +160,11 @@ void MinecartFurnace::setHasFuel(bool fuel) { if (fuel) { - entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) | 1)); } else { - entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) & ~1)); } } -- cgit v1.2.3