From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.Client/Common/Tutorial/UseTileTask.cpp | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Minecraft.Client/Common/Tutorial/UseTileTask.cpp (limited to 'Minecraft.Client/Common/Tutorial/UseTileTask.cpp') diff --git a/Minecraft.Client/Common/Tutorial/UseTileTask.cpp b/Minecraft.Client/Common/Tutorial/UseTileTask.cpp new file mode 100644 index 00000000..1f4ed4cb --- /dev/null +++ b/Minecraft.Client/Common/Tutorial/UseTileTask.cpp @@ -0,0 +1,40 @@ +#include "stdafx.h" +#include "..\..\..\Minecraft.World\Entity.h" +#include "..\..\..\Minecraft.World\Level.h" +#include "..\..\..\Minecraft.World\ItemInstance.h" +#include "UseTileTask.h" + +UseTileTask::UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, + bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), + x( x ), y( y ), z( z ), tileId( tileId ) +{ + useLocation = true; +} + +UseTileTask::UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, + bool enablePreCompletion, vector *inConstraints, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, bTaskReminders ), + tileId( tileId ) +{ + useLocation = false; +} + +bool UseTileTask::isCompleted() +{ + return bIsCompleted; +} + +void UseTileTask::useItemOn(Level *level, shared_ptr item, int x, int y, int z,bool bTestUseOnly) +{ + if(bTestUseOnly) return; + + if( !enablePreCompletion && !bHasBeenActivated) return; + + if( !useLocation || ( x == this->x && y == this->y && z == this->z ) ) + { + int t = level->getTile(x, y, z); + if( t == tileId ) + bIsCompleted = true; + } +} \ No newline at end of file -- cgit v1.2.3