the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 37 lines 851 B view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.h" 3#include "net.minecraft.world.entity.ai.control.h" 4#include "RandomLookAroundGoal.h" 5 6RandomLookAroundGoal::RandomLookAroundGoal(Mob *mob) 7{ 8 relX = relZ = 0.0; 9 lookTime = 0; 10 11 this->mob = mob; 12 setRequiredControlFlags(Control::MoveControlFlag | Control::LookControlFlag); 13} 14 15bool RandomLookAroundGoal::canUse() 16{ 17 return mob->getRandom()->nextFloat() < 0.02f; 18} 19 20bool RandomLookAroundGoal::canContinueToUse() 21{ 22 return lookTime >= 0; 23} 24 25void RandomLookAroundGoal::start() 26{ 27 double rnd = 2 * PI * mob->getRandom()->nextDouble(); 28 relX = cos(rnd); 29 relZ = sin(rnd); 30 lookTime = 20 + mob->getRandom()->nextInt(20); 31} 32 33void RandomLookAroundGoal::tick() 34{ 35 --lookTime; 36 mob->getLookControl()->setLookAt(mob->x + relX, mob->y + mob->getHeadHeight(), mob->z + relZ, 10, mob->getMaxHeadXRot()); 37}