diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/StemTile.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* 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
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)); } } |
