the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 40 lines 1.3 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.player.h" 3#include "net.minecraft.world.level.h" 4#include "net.minecraft.world.level.tile.h" 5#include "ItemInstance.h" 6#include "GenericStats.h" 7#include "RedstoneItem.h" 8 9RedStoneItem::RedStoneItem(int id) : Item(id) 10{ 11} 12 13bool RedStoneItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) 14{ 15 // 4J-PB - Adding a test only version to allow tooltips to be displayed 16 if (level->getTile(x, y, z) != Tile::topSnow_Id) 17 { 18 if (face == 0) y--; 19 if (face == 1) y++; 20 if (face == 2) z--; 21 if (face == 3) z++; 22 if (face == 4) x--; 23 if (face == 5) x++; 24 if (!level->isEmptyTile(x, y, z)) return false; 25 } 26 if (!player->mayUseItemAt(x, y, z, face, itemInstance)) return false; 27 if (Tile::redStoneDust->mayPlace(level, x, y, z)) 28 { 29 if(!bTestUseOnOnly) 30 { 31 // 4J-JEV: Hook for durango 'BlockPlaced' event. 32 player->awardStat(GenericStats::blocksPlaced(Tile::redStoneDust_Id), GenericStats::param_blocksPlaced(Tile::redStoneDust_Id,itemInstance->getAuxValue(),1)); 33 34 itemInstance->count--; 35 level->setTileAndUpdate(x, y, z, Tile::redStoneDust_Id); 36 } 37 } 38 39 return true; 40}