the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 38 lines 1.2 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.ai.control.h" 3#include "net.minecraft.world.entity.ai.util.h" 4#include "net.minecraft.world.entity.ai.navigation.h" 5#include "net.minecraft.world.entity.h" 6#include "net.minecraft.world.level.h" 7#include "MoveTowardsRestrictionGoal.h" 8 9MoveTowardsRestrictionGoal::MoveTowardsRestrictionGoal(PathfinderMob *mob, double speedModifier) 10{ 11 wantedX = wantedY = wantedZ = 0.0; 12 13 this->mob = mob; 14 this->speedModifier = speedModifier; 15 setRequiredControlFlags(Control::MoveControlFlag); 16} 17 18bool MoveTowardsRestrictionGoal::canUse() 19{ 20 if (mob->isWithinRestriction()) return false; 21 Pos *towards = mob->getRestrictCenter(); 22 Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(towards->x, towards->y, towards->z)); 23 if (pos == NULL) return false; 24 wantedX = pos->x; 25 wantedY = pos->y; 26 wantedZ = pos->z; 27 return true; 28} 29 30bool MoveTowardsRestrictionGoal::canContinueToUse() 31{ 32 return !mob->getNavigation()->isDone(); 33} 34 35void MoveTowardsRestrictionGoal::start() 36{ 37 mob->getNavigation()->moveTo(wantedX, wantedY, wantedZ, speedModifier); 38}