diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-08 19:08:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 18:08:36 -0500 |
| commit | 28614b922fb77149a54da1a87bebfbc98736f296 (patch) | |
| tree | 7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/StemTile.cpp | |
| parent | 88798b501d0cf6287b6f87acb2592676e3cec58d (diff) | |
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
Diffstat (limited to 'Minecraft.World/StemTile.cpp')
| -rw-r--r-- | Minecraft.World/StemTile.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index 62b0d57b..476b643c 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -17,7 +17,7 @@ StemTile::StemTile(int id, Tile *fruit) : Bush(id) float ss = 0.125f; this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); - iconAngled = NULL; + iconAngled = nullptr; } bool StemTile::mayPlaceOn(int tile) @@ -34,7 +34,7 @@ void StemTile::tick(Level *level, int x, int y, int z, Random *random) float growthSpeed = getGrowthSpeed(level, x, y, z); // 4J Stu - Brought forward change from 1.2.3 to make fruit more likely to grow - if (random->nextInt((int) (25 / growthSpeed) + 1) == 0) + if (random->nextInt(static_cast<int>(25 / growthSpeed) + 1) == 0) { int age = level->getData(x, y, z); if (age < 7) @@ -149,10 +149,10 @@ void StemTile::updateDefaultShape() void StemTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(Tile::tlsIdxShape)); tls->yy1 = (level->getData(x, y, z) * 2 + 2) / 16.0f; float ss = 0.125f; - setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, (float) tls->yy1, 0.5f + ss); + setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, static_cast<float>(tls->yy1), 0.5f + ss); } int StemTile::getRenderShape() @@ -184,12 +184,12 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float return; } - Item *seed = NULL; + Item *seed = nullptr; if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin; if (fruit == Tile::melon) seed = Item::seeds_melon; - if (seed != NULL) + if (seed != nullptr) { - popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(seed))); + popResource(level, x, y, z, std::make_shared<ItemInstance>(seed)); } } |
