diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/HalfSlabTile.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/HalfSlabTile.cpp')
| -rw-r--r-- | Minecraft.World/HalfSlabTile.cpp | 79 |
1 files changed, 44 insertions, 35 deletions
diff --git a/Minecraft.World/HalfSlabTile.cpp b/Minecraft.World/HalfSlabTile.cpp index ed3969c1..13308b9a 100644 --- a/Minecraft.World/HalfSlabTile.cpp +++ b/Minecraft.World/HalfSlabTile.cpp @@ -6,17 +6,6 @@ #include "net.minecraft.stats.h" #include "Facing.h" -/*package net.minecraft.world.level.tile; - -import java.util.*; - -import net.minecraft.Facing; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.*; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.phys.AABB;*/ - - HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material *material) : Tile(id, material, fullSize) { @@ -98,41 +87,41 @@ int HalfSlabTile::getResourceCount(Random *random) int HalfSlabTile::getSpawnResourcesAuxValue(int data) { - return data & TYPE_MASK; + return data & TYPE_MASK; } bool HalfSlabTile::isCubeShaped() { - return fullSize; + return fullSize; } bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { - if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face); + if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face); - if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face)) - { - return false; - } + if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face)) + { + return false; + } - int ox = x, oy = y, oz = z; - ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]]; - oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]]; - oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]]; + int ox = x, oy = y, oz = z; + ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]]; + oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]]; + oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]]; - boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0; - if (isUpper) - { - if (face == Facing::DOWN) return true; - if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face)) return true; - return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0); - } - else - { - if (face == Facing::UP) return true; - if (face == Facing::DOWN && Tile::shouldRenderFace(level, x, y, z, face)) return true; - return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0); - } + boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0; + if (isUpper) + { + if (face == Facing::DOWN) return true; + if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face)) return true; + return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0); + } + else + { + if (face == Facing::UP) return true; + if (face == Facing::DOWN && Tile::shouldRenderFace(level, x, y, z, face)) return true; + return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0); + } } bool HalfSlabTile::isHalfSlab(int tileId) @@ -140,4 +129,24 @@ bool HalfSlabTile::isHalfSlab(int tileId) return tileId == Tile::stoneSlabHalf_Id || tileId == Tile::woodSlabHalf_Id; } +int HalfSlabTile::cloneTileData(Level *level, int x, int y, int z) +{ + return Tile::cloneTileData(level, x, y, z) & TYPE_MASK; +} +int HalfSlabTile::cloneTileId(Level *level, int x, int y, int z) +{ + if (isHalfSlab(id)) + { + return id; + } + if (id == Tile::stoneSlab_Id) + { + return Tile::stoneSlabHalf_Id; + } + if (id == Tile::woodSlab_Id) + { + return Tile::woodSlabHalf_Id; + } + return Tile::stoneSlabHalf_Id; +}
\ No newline at end of file |
