the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 67 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.entity.projectile.h" 4#include "net.minecraft.world.entity.player.h" 5#include "net.minecraft.world.item.h" 6#include "net.minecraft.world.h" 7#include "SoundTypes.h" 8#include "FireChargeItem.h" 9#include "tile.h" 10 11FireChargeItem::FireChargeItem(int id) : Item(id) 12{ 13 m_dragonFireballIcon = NULL; 14} 15 16bool FireChargeItem::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) 17{ 18 if (level->isClientSide) 19 { 20 return true; 21 } 22 23 if (face == 0) y--; 24 if (face == 1) y++; 25 if (face == 2) z--; 26 if (face == 3) z++; 27 if (face == 4) x--; 28 if (face == 5) x++; 29 30 if (!player->mayUseItemAt(x, y, z, face, instance)) 31 { 32 return false; 33 } 34 35 // 4J-PB - Adding a test only version to allow tooltips to be displayed 36 if(bTestUseOnOnly) 37 { 38 return true; 39 } 40 41 int targetType = level->getTile(x, y, z); 42 43 if (targetType == 0) 44 { 45 level->playSound( x + 0.5, y + 0.5, z + 0.5,eSoundType_FIRE_NEWIGNITE, 1, random->nextFloat() * 0.4f + 0.8f); 46 level->setTileAndUpdate(x, y, z, Tile::fire_Id); 47 } 48 49 if (!player->abilities.instabuild) 50 { 51 instance->count--; 52 } 53 return true; 54} 55 56Icon *FireChargeItem::getIcon(int itemAuxValue) 57{ 58 if(itemAuxValue > 0) return m_dragonFireballIcon; 59 return Item::getIcon(itemAuxValue); 60} 61 62void FireChargeItem::registerIcons(IconRegister *iconRegister) 63{ 64 Item::registerIcons(iconRegister); 65 m_dragonFireballIcon = iconRegister->registerIcon(L"dragonFireball"); 66} 67