the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 31 lines 983 B view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.player.h" 3#include "net.minecraft.h" 4#include "net.minecraft.world.level.h" 5#include "SeedFoodItem.h" 6 7SeedFoodItem::SeedFoodItem(int id, int nutrition, float saturationMod, int resultId, int targetLand) : FoodItem(id, nutrition, saturationMod, false) 8{ 9 this->resultId = resultId; 10 this->targetLand = targetLand; 11 12} 13 14bool SeedFoodItem::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) 15{ 16 if (face != Facing::UP) return false; 17 18 if (!player->mayUseItemAt(x, y, z, face, instance) || !player->mayUseItemAt(x, y + 1, z, face, instance)) return false; 19 int targetType = level->getTile(x, y, z); 20 21 if (targetType == targetLand && level->isEmptyTile(x, y + 1, z)) 22 { 23 if(!bTestUseOnOnly) 24 { 25 level->setTileAndUpdate(x, y + 1, z, resultId); 26 instance->count--; 27 } 28 return true; 29 } 30 return false; 31}