aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/StoneSlabTile.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/StoneSlabTile.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/StoneSlabTile.cpp')
-rw-r--r--Minecraft.World/StoneSlabTile.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/Minecraft.World/StoneSlabTile.cpp b/Minecraft.World/StoneSlabTile.cpp
new file mode 100644
index 00000000..5c8d8b07
--- /dev/null
+++ b/Minecraft.World/StoneSlabTile.cpp
@@ -0,0 +1,84 @@
+#include "stdafx.h"
+#include "net.minecraft.h"
+#include "net.minecraft.world.level.h"
+#include "net.minecraft.world.level.tile.h"
+#include "net.minecraft.world.h"
+#include "StoneSlabTile.h"
+
+
+const unsigned int StoneSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { IDS_TILE_STONESLAB_STONE,
+ IDS_TILE_STONESLAB_SAND,
+ IDS_TILE_STONESLAB_WOOD,
+ IDS_TILE_STONESLAB_COBBLE,
+ IDS_TILE_STONESLAB_BRICK,
+ IDS_TILE_STONESLAB_SMOOTHBRICK,
+ IDS_TILE_STONESLAB_NETHERBRICK,
+ IDS_TILE_STONESLAB_QUARTZ,
+ };
+
+StoneSlabTile::StoneSlabTile(int id, bool fullSize) : HalfSlabTile(id, fullSize, Material::stone)
+{
+}
+
+Icon *StoneSlabTile::getTexture(int face, int data)
+{
+ int type = data & TYPE_MASK;
+ if (fullSize && (data & TOP_SLOT_BIT) != 0)
+ {
+ face = Facing::UP;
+ }
+ switch(type)
+ {
+ case STONE_SLAB:
+ if (face == Facing::UP || face == Facing::DOWN) return icon;
+ return iconSide;
+ break;
+ case SAND_SLAB:
+ return Tile::sandStone->getTexture(face);
+ case WOOD_SLAB:
+ return Tile::wood->getTexture(face);
+ case COBBLESTONE_SLAB:
+ return Tile::stoneBrick->getTexture(face);
+ case BRICK_SLAB:
+ return Tile::redBrick->getTexture(face);
+ case SMOOTHBRICK_SLAB:
+ return Tile::stoneBrickSmooth->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT);
+ case NETHERBRICK_SLAB:
+ return Tile::netherBrick->getTexture(Facing::UP);
+ case QUARTZ_SLAB:
+ return Tile::quartzBlock->getTexture(face);
+ }
+
+ return icon;
+}
+
+void StoneSlabTile::registerIcons(IconRegister *iconRegister)
+{
+ icon = iconRegister->registerIcon(L"stoneslab_top");
+ iconSide = iconRegister->registerIcon(L"stoneslab_side");
+}
+
+int StoneSlabTile::getResource(int data, Random *random, int playerBonusLevel)
+{
+ return Tile::stoneSlabHalf_Id;
+}
+
+unsigned int StoneSlabTile::getDescriptionId(int iData /*= -1*/)
+{
+ if(iData < 0 ) iData = 0;
+ return StoneSlabTile::SLAB_NAMES[iData];
+}
+
+int StoneSlabTile::getAuxName(int auxValue)
+{
+ if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH)
+ {
+ auxValue = 0;
+ }
+ return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue];
+}
+
+shared_ptr<ItemInstance> StoneSlabTile::getSilkTouchItemInstance(int data)
+{
+ return shared_ptr<ItemInstance>(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK));
+}