the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1using namespace std;
2
3#include "stdafx.h"
4#include "Item.h"
5#include "net.minecraft.world.entity.player.h"
6#include "net.minecraft.world.level.h"
7#include "net.minecraft.world.level.tile.h"
8#include "ItemInstance.h"
9#include "SeedItem.h"
10
11SeedItem::SeedItem(int id, int resultId, int targetLand) : Item(id)
12{
13 this->resultId = resultId;
14 this->targetLand = targetLand;
15}
16
17bool SeedItem::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)
18{
19 // 4J-PB - Adding a test only version to allow tooltips to be displayed
20 if (face != 1) return false;
21
22 if (!player->mayUseItemAt(x, y, z, face, instance) || !player->mayUseItemAt(x, y + 1, z, face, instance)) return false;
23
24 int targetType = level->getTile(x, y, z);
25
26 if (targetType == targetLand && level->isEmptyTile(x, y + 1, z))
27 {
28 if(!bTestUseOnOnly)
29 {
30 level->setTileAndUpdate(x, y + 1, z, resultId);
31 instance->count--;
32 }
33 return true;
34 }
35 return false;
36}