the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 72 lines 1.9 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.player.h" 3#include "net.minecraft.world.phys.h" 4#include "net.minecraft.world.level.h" 5#include "net.minecraft.world.level.tile.h" 6#include "net.minecraft.stats.h" 7#include "Material.h" 8#include "ItemInstance.h" 9#include "FlintAndSteelItem.h" 10#include "SoundTypes.h" 11 12FlintAndSteelItem::FlintAndSteelItem(int id) : Item( id ) 13{ 14 maxStackSize = 1; 15 setMaxDamage(64); 16} 17 18bool FlintAndSteelItem::useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) 19{ 20 // 4J-PB - Adding a test only version to allow tooltips to be displayed 21 if (face == 0) y--; 22 if (face == 1) y++; 23 if (face == 2) z--; 24 if (face == 3) z++; 25 if (face == 4) x--; 26 if (face == 5) x++; 27 28 if (!player->mayUseItemAt(x, y, z, face, instance)) return false; 29 30 int targetType = level->getTile(x, y, z); 31 32 if(!bTestUseOnOnly) 33 { 34 if (targetType == 0) 35 { 36 if( level->getTile(x, y-1, z) == Tile::obsidian_Id ) 37 { 38 if( Tile::portalTile->trySpawnPortal(level, x, y, z, false) ) 39 { 40 player->awardStat( 41 GenericStats::portalsCreated(), 42 GenericStats::param_noArgs() 43 ); 44 45 // 4J : WESTY : Added for achievement. 46 player->awardStat(GenericStats::InToTheNether(),GenericStats::param_InToTheNether()); 47 } 48 } 49 50 level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_FIRE_NEWIGNITE, 1, random->nextFloat() * 0.4f + 0.8f); 51 level->setTileAndUpdate(x, y, z, Tile::fire_Id); 52 } 53 54 instance->hurtAndBreak(1, player); 55 } 56 else 57 { 58 if(targetType == 0) 59 { 60 return true; 61 } 62 else 63 { 64 return false; 65 } 66 } 67 68 // 4J-PB - this function shouldn't really return true all the time, but I've added a special case for my test use for the tooltips display 69 // and will leave it as is for the game use 70 71 return true; 72}