the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 84 lines 2.3 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.h" 3#include "net.minecraft.world.level.h" 4#include "net.minecraft.world.level.tile.h" 5#include "net.minecraft.world.h" 6#include "StoneSlabTile.h" 7 8 9const unsigned int StoneSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { IDS_TILE_STONESLAB_STONE, 10 IDS_TILE_STONESLAB_SAND, 11 IDS_TILE_STONESLAB_WOOD, 12 IDS_TILE_STONESLAB_COBBLE, 13 IDS_TILE_STONESLAB_BRICK, 14 IDS_TILE_STONESLAB_SMOOTHBRICK, 15 IDS_TILE_STONESLAB_NETHERBRICK, 16 IDS_TILE_STONESLAB_QUARTZ, 17 }; 18 19StoneSlabTile::StoneSlabTile(int id, bool fullSize) : HalfSlabTile(id, fullSize, Material::stone) 20{ 21} 22 23Icon *StoneSlabTile::getTexture(int face, int data) 24{ 25 int type = data & TYPE_MASK; 26 if (fullSize && (data & TOP_SLOT_BIT) != 0) 27 { 28 face = Facing::UP; 29 } 30 switch(type) 31 { 32 case STONE_SLAB: 33 if (face == Facing::UP || face == Facing::DOWN) return icon; 34 return iconSide; 35 break; 36 case SAND_SLAB: 37 return Tile::sandStone->getTexture(face); 38 case WOOD_SLAB: 39 return Tile::wood->getTexture(face); 40 case COBBLESTONE_SLAB: 41 return Tile::cobblestone->getTexture(face); 42 case BRICK_SLAB: 43 return Tile::redBrick->getTexture(face); 44 case SMOOTHBRICK_SLAB: 45 return Tile::stoneBrick->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT); 46 case NETHERBRICK_SLAB: 47 return Tile::netherBrick->getTexture(Facing::UP); 48 case QUARTZ_SLAB: 49 return Tile::quartzBlock->getTexture(face); 50 } 51 52 return icon; 53} 54 55void StoneSlabTile::registerIcons(IconRegister *iconRegister) 56{ 57 icon = iconRegister->registerIcon(L"stoneslab_top"); 58 iconSide = iconRegister->registerIcon(L"stoneslab_side"); 59} 60 61int StoneSlabTile::getResource(int data, Random *random, int playerBonusLevel) 62{ 63 return Tile::stoneSlabHalf_Id; 64} 65 66unsigned int StoneSlabTile::getDescriptionId(int iData /*= -1*/) 67{ 68 if(iData < 0 ) iData = 0; 69 return StoneSlabTile::SLAB_NAMES[iData]; 70} 71 72int StoneSlabTile::getAuxName(int auxValue) 73{ 74 if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) 75 { 76 auxValue = 0; 77 } 78 return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue]; 79} 80 81shared_ptr<ItemInstance> StoneSlabTile::getSilkTouchItemInstance(int data) 82{ 83 return shared_ptr<ItemInstance>(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK)); 84}