first commit
This commit is contained in:
35
Minecraft.World/OpenDoorGoal.cpp
Normal file
35
Minecraft.World/OpenDoorGoal.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "stdafx.h"
|
||||
#include "net.minecraft.world.entity.h"
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "OpenDoorGoal.h"
|
||||
|
||||
OpenDoorGoal::OpenDoorGoal(Mob *mob, bool closeDoorAfter) : DoorInteractGoal(mob)
|
||||
{
|
||||
this->mob = mob;
|
||||
this->closeDoor = closeDoorAfter;
|
||||
}
|
||||
|
||||
bool OpenDoorGoal::canContinueToUse()
|
||||
{
|
||||
return closeDoor && forgetTime > 0 && DoorInteractGoal::canContinueToUse();
|
||||
}
|
||||
|
||||
void OpenDoorGoal::start()
|
||||
{
|
||||
forgetTime = 20;
|
||||
doorTile->setOpen(mob->level, doorX, doorY, doorZ, true);
|
||||
}
|
||||
|
||||
void OpenDoorGoal::stop()
|
||||
{
|
||||
if (closeDoor)
|
||||
{
|
||||
doorTile->setOpen(mob->level, doorX, doorY, doorZ, false);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenDoorGoal::tick()
|
||||
{
|
||||
--forgetTime;
|
||||
DoorInteractGoal::tick();
|
||||
}
|
||||
Reference in New Issue
Block a user