the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 83 lines 2.1 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.level.dimension.h" 4#include "net.minecraft.world.item.enchantment.h" 5#include "net.minecraft.world.food.h" 6#include "net.minecraft.stats.h" 7#include "IceTile.h" 8 9IceTile::IceTile(int id) : HalfTransparentTile(id, L"ice", Material::ice, false) 10{ 11 friction = 0.98f; 12 setTicking(true); 13} 14 15int IceTile::getRenderLayer() 16{ 17 return 1; 18} 19 20bool IceTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) 21{ 22 return HalfTransparentTile::shouldRenderFace(level, x, y, z, 1 - face); 23} 24 25void IceTile::playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data) 26{ 27 player->awardStat(GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) ); 28 player->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE); 29 30 if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player)) 31 { 32 shared_ptr<ItemInstance> item = getSilkTouchItemInstance(data); 33 if (item != NULL) 34 { 35 popResource(level, x, y, z, item); 36 } 37 } 38 else 39 { 40 if (level->dimension->ultraWarm) 41 { 42 level->removeTile(x, y, z); 43 return; 44 } 45 46 int playerBonusLevel = EnchantmentHelper::getDiggingLootBonus(player); 47 spawnResources(level, x, y, z, data, playerBonusLevel); 48 Material *below = level->getMaterial(x, y - 1, z); 49 if (below->blocksMotion() || below->isLiquid()) 50 { 51 level->setTileAndUpdate(x, y, z, Tile::water_Id); 52 } 53 } 54} 55 56int IceTile::getResourceCount(Random *random) 57{ 58 return 0; 59} 60 61void IceTile::tick(Level *level, int x, int y, int z, Random *random) 62{ 63 if (level->getBrightness(LightLayer::Block, x, y, z) > 11 - Tile::lightBlock[id]) 64 { 65 if (level->dimension->ultraWarm) 66 { 67 level->removeTile(x, y, z); 68 return; 69 } 70 this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); 71 level->setTileAndUpdate(x, y, z, Tile::calmWater_Id); 72 } 73} 74 75bool IceTile::shouldTileTick(Level *level, int x,int y,int z) 76{ 77 return level->getBrightness(LightLayer::Block, x, y, z) > 11 - Tile::lightBlock[id]; 78} 79 80int IceTile::getPistonPushReaction() 81{ 82 return Material::PUSH_NORMAL; 83}