the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 45 lines 1.1 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.ai.control.h" 3#include "net.minecraft.world.entity.ai.goal.h" 4#include "net.minecraft.world.entity.ai.navigation.h" 5#include "net.minecraft.world.entity.h" 6#include "net.minecraft.world.entity.animal.h" 7#include "SitGoal.h" 8 9SitGoal::SitGoal(TamableAnimal *mob) 10{ 11 _wantToSit = false; 12 13 this->mob = mob; 14 setRequiredControlFlags(Control::JumpControlFlag | Control::MoveControlFlag); 15} 16 17bool SitGoal::canUse() 18{ 19 if (!mob->isTame()) return false; 20 if (mob->isInWater()) return false; 21 if (!mob->onGround) return false; 22 23 shared_ptr<LivingEntity> owner = dynamic_pointer_cast<LivingEntity>( mob->getOwner() ); 24 if (owner == NULL) return true; // owner not on level 25 26 if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != NULL) return false; 27 28 return _wantToSit; 29} 30 31void SitGoal::start() 32{ 33 mob->getNavigation()->stop(); 34 mob->setSitting(true); 35} 36 37void SitGoal::stop() 38{ 39 mob->setSitting(false); 40} 41 42void SitGoal::wantToSit(bool _wantToSit) 43{ 44 this->_wantToSit = _wantToSit; 45}