diff --git a/Thrift/Client/Manager/Hooks/ClientInstance/HookClientInstance.cpp b/Thrift/Client/Manager/Hooks/ClientInstance/HookClientInstance.cpp index e54192f..6003b7a 100644 --- a/Thrift/Client/Manager/Hooks/ClientInstance/HookClientInstance.cpp +++ b/Thrift/Client/Manager/Hooks/ClientInstance/HookClientInstance.cpp @@ -80,7 +80,7 @@ auto RenderContextCallback(void* a1, MinecraftUIRenderContext* ctx) -> void { auto Hook_ClientInstance::init(void) -> StatusData { rndrMgr = this->mgr; - auto sig = Utils::findSig("48 8B C4 48 89 58 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B ? 48 89 54 24 ? 4C"); + auto sig = Utils::findSig("48 8B C4 48 89 58 18 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 B8 0F 29 78 A8 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B FA"); if (!sig) return StatusData(MethodStatus::Error, "[ClientInstance Hook] Failed to find Signature!"); diff --git a/Thrift/Client/Manager/Hooks/Key/HookKey.cpp b/Thrift/Client/Manager/Hooks/Key/HookKey.cpp index b5829b7..d2f9ade 100644 --- a/Thrift/Client/Manager/Hooks/Key/HookKey.cpp +++ b/Thrift/Client/Manager/Hooks/Key/HookKey.cpp @@ -44,7 +44,7 @@ auto KeyHookCallback(uint64_t key, bool isDown) -> void { auto Hook_Key::init(void) -> StatusData { kMgr = this->mgr; - auto sig = Utils::findSig("48 ? ? 48 ? ? ? 4C 8D 05 ? ? ? ? 89"); + auto sig = Utils::findSig("48 83 EC ? ? ? C1 4C 8D 05"); if (!sig) return StatusData(MethodStatus::Error, "[Key Hook] Failed to find Signature!"); diff --git a/Thrift/Client/Manager/Modules/Movement/AirJump.h b/Thrift/Client/Manager/Modules/Movement/AirJump.h index 62d789a..8667d14 100644 --- a/Thrift/Client/Manager/Modules/Movement/AirJump.h +++ b/Thrift/Client/Manager/Modules/Movement/AirJump.h @@ -12,7 +12,7 @@ class AirJump : public Module { auto instance = Minecraft::getClientInstance(); auto player = (instance != nullptr ? instance->LocalPlayer : nullptr); - if (player != nullptr) - player->getMovementProxy()->setOnGround(true); - }; + if (player != nullptr); + // player->getMovementProxy()->setOnGround(true); we dont have movement proxy rn, and i dont wanna give entt out yet, so nrg will have to add a sig + } }; \ No newline at end of file diff --git a/Thrift/Client/Manager/Modules/Movement/AutoJump.h b/Thrift/Client/Manager/Modules/Movement/AutoJump.h index e632b40..acc161f 100644 --- a/Thrift/Client/Manager/Modules/Movement/AutoJump.h +++ b/Thrift/Client/Manager/Modules/Movement/AutoJump.h @@ -12,7 +12,7 @@ class AutoJump : public Module { auto instance = Minecraft::getClientInstance(); auto player = (instance != nullptr ? instance->LocalPlayer : nullptr); - if (player != nullptr) - player->getMovementProxy()->setJumping(true); + if (player != nullptr); + //player->getMovementProxy()->setJumping(true); we dont have movement proxy rn, and i dont wanna give entt out yet, so nrg will have to add a sig }; }; \ No newline at end of file diff --git a/Thrift/Client/Manager/Modules/Movement/AutoSprint.h b/Thrift/Client/Manager/Modules/Movement/AutoSprint.h index 204f063..78a87e6 100644 --- a/Thrift/Client/Manager/Modules/Movement/AutoSprint.h +++ b/Thrift/Client/Manager/Modules/Movement/AutoSprint.h @@ -12,10 +12,10 @@ class AutoSprint : public Module { auto instance = Minecraft::getClientInstance(); auto player = (instance != nullptr ? instance->LocalPlayer : nullptr); if (player == nullptr) return; - auto input = instance->getMoveInputHandler; - if (instance->getMoveInputHandler->isSneakDown) return; + // auto input = instance->getMoveInputHandler; moveinputhandler has been broken since forever. + // if (instance->getMoveInputHandler->isSneakDown) return; moveinputhandler has been broken since forever. - if ((input->forwardMovement > 0 || ((input->forwardMovement || input->sideMovement)))) - player->getMovementProxy()->setSprinting(true); + // if ((input->forwardMovement > 0 || ((input->forwardMovement || input->sideMovement)))) + // player->getMovementProxy()->setSprinting(true); // we dont have movement proxy rn, and i dont wanna give entt out yet, so nrg will have to add a sig }; }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/Actor.h b/Thrift/Client/SDK/Classes/Actor.h index 5d7ddaf..9e5138b 100644 --- a/Thrift/Client/SDK/Classes/Actor.h +++ b/Thrift/Client/SDK/Classes/Actor.h @@ -1,22 +1,53 @@ #pragma once #include "../../Utils/Utils.h" -#include "DirectPlayerMovementProxy.h" #include "../Components/AABBShapeComponent.h" #include "../Components/RenderPositionComponent.h" +#include "../Components/StateVectorComponent.h" +#include "Level.h" +#include "Player.h" +#include "MoveInputHandler.h" +#include "ActorFlags.h" +#include "BlockActor.h" +#include "BlockSource.h" +#include "ActorCollision.h" +#include "ActorType.h" +#include "EntityContext.h" + +// testing i am still connected? // Classes/ Structs class DirectPlayerMovementProxy; -class EntityRegistry; - -struct EntityId { - uint32_t id; -}; - -struct EntityContext { - EntityRegistry* registry; - EntityId id; -}; +//class EntityRegistry; +class ItemStack; +class ItemStackBase; +class CompoundTag;// +class ActorInitializationMethod;// +class VariantParameterList;// +struct ActorDamageSource;// +class ActorDamageCause;// +struct ArmorSlot;// +class ActorEvent;// +class ActorUniqueID;// +class IConstBlockSource;// +class NewInteractionModel;// +class InputMode;// +class Options;// +class ActorInteraction;// +struct ItemUseMethod;// +class MobEffectInstance;// +class PlayerMovementSettings;// +class ChangeDimensionPacket;// +class AutomaticID;// +struct DataLoadHelper;// +struct RenderParams;// +class Tick;// +class ChalkboardBlockActor;// +class ResolvedTextObject;// +struct TextObjectRoot;// +class SubChunkPos;// +class ChunkSource;// +class LayeredAbilities;// class EntityLocation { public: @@ -25,97 +56,255 @@ class EntityLocation { Vec3 velocity; }; -class Actor { + +struct MobBodyRotationComponent { + float bodyRot; + float prevBodyRot; +}; + +template +class FlagComponent {}; + +struct OnGroundFlag {}; +struct OnGroundFlagComponent {}; +struct JumpFromGroundRequestFlag {}; +struct PlayerComponentFlag {}; + +class Actor { // 1.20.81 +public: + virtual void Destructor(); // ~Actor(); // Actor Destructor public: - virtual int getStatusFlag(__int64); - virtual void setStatusFlag(__int64, bool); - virtual int getLastHurtByEntity(void); - virtual void setLastHurtByEntity(Actor*); - virtual int getLastHurtByPlayer(void); - virtual void setLastHurtByPlayer(class Player*); - virtual int getLastHurtEntity(void); - virtual void setLastHurtEntity(Actor*); + virtual bool getStatusFlag(ActorFlags); + virtual void setStatusFlag(ActorFlags, bool); virtual void outOfWorld(void); - virtual void reloadHardcoded(__int64, __int64 const&); - virtual void reloadHardcodedClient(__int64, __int64 const&); - virtual void initializeComponents(__int64, __int64 const&); - virtual void reloadComponents(__int64, __int64 const&); + virtual void reloadHardcoded(ActorInitializationMethod, VariantParameterList const&); + virtual void reloadHardcodedClient(ActorInitializationMethod, VariantParameterList const&); + virtual void initializeComponents(ActorInitializationMethod, VariantParameterList const&); + virtual void reloadComponents(ActorInitializationMethod, VariantParameterList const&); virtual void _serverInitItemStackIds(void); virtual void _doInitialMove(void); - virtual void hasComponent();//HashedString const& - virtual void Destructor(); + virtual bool hasComponent(); virtual void resetUserPos(bool); - virtual int getOwnerEntityType(void); + virtual void getOwnerEntityType(void); virtual void remove(void); - virtual bool isRuntimePredictedMovementEnabled(void); - virtual int getPredictedMovementValues(void); - virtual Vec3* getPos(void); - virtual Vec3* getPosOld(void); - virtual float getPosExtrapolated(float); - virtual int getFiringPos(void); - virtual float getInterpolatedRidingPosition(float); - virtual float getInterpolatedBodyRot(float); - virtual float getInterpolatedHeadRot(float); - virtual float getInterpolatedBodyYaw(float); - virtual int getYawSpeedInDegreesPerSecond(void); - virtual float getInterpolatedWalkAnimSpeed(float); - virtual float getInterpolatedRidingOffset(float, int); - virtual void resetInterpolated(void); + virtual void getFiringPos(void); + virtual void getInterpolatedBodyRot(float); + virtual void getInterpolatedHeadRot(float); + virtual void getInterpolatedBodyYaw(float); + virtual void getYawSpeedInDegreesPerSecond(void); + virtual void getInterpolatedRidingOffset(float, int); virtual bool isFireImmune(void); - virtual void breaksFallingBlocks(void); - virtual void blockedByShield(__int64 const&, Actor&); - virtual void canDisableShield(void); + virtual void blockedByShield(ActorDamageSource const&, Actor&); + virtual bool canDisableShield(void); virtual void teleportTo(Vec3 const&, bool, int, int, bool); - virtual void tryTeleportTo(Vec3 const&, bool, bool, int, int); - virtual void chorusFruitTeleport(Vec3 const&); virtual void lerpMotion(Vec3 const&); - virtual void tryCreateAddEntityPacket(void); + virtual void tryCreateAddActorPacket(void); virtual void normalTick(void); virtual void baseTick(void); virtual void passengerTick(void); - virtual void positionPassenger(Actor&, float); virtual void startRiding(Actor&); virtual void addPassenger(Actor&); - virtual int getExitTip(std::string const&, __int64, __int64); - virtual int getEntityLocNameString(void); - virtual void intersects(Vec3 const&, Vec3 const&); + virtual void getExitTip(std::string const&, InputMode, NewInteractionModel); + virtual void getEntityLocNameString(void); virtual bool isInWall(void); virtual bool isInvisible(void); virtual bool canShowNameTag(void); - virtual void canExistInPeaceful(void); - virtual void setNameTagVisible(bool); - virtual TextHolder* getNameTag(void); - virtual int getNameTagAsHash(void); - virtual TextHolder* getFormattedNameTag(void); - virtual void filterFormattedNameTag(__int64 const&); - virtual void setNameTag(std::string const&); - virtual int getAlwaysShowNameTag(void); - virtual void setScoreTag(std::string const&); - virtual int getScoreTag(void); - virtual bool isInWater(void); -public: - DirectPlayerMovementProxy* getMovementProxy() { - using MovementProxyFunction = void(__fastcall*)(Actor*, std::shared_ptr*); - static MovementProxyFunction originalFunction = (MovementProxyFunction)Utils::findSig("40 53 48 83 ec ? 48 8b da 48 8b d1 48 89 5c 24 ? 48 8b 41"); - std::shared_ptr movementProxyPointer; - originalFunction(this, &movementProxyPointer); - return (DirectPlayerMovementProxy*)movementProxyPointer.get(); - } - RenderPositionComponent* getRenderPositionComponent() { - using getRenderPositionComponent = RenderPositionComponent * (__cdecl*)(void*, EntityId*); - static auto func = reinterpret_cast(Utils::findSig("40 53 48 83 EC ? 48 8B DA BA 6E F3 E8 D4")); - auto registryBase = *reinterpret_cast(this->entityContext.registry); - auto id = this->entityContext.id; - return func(registryBase, &id); + virtual void getFormattedNameTag(void); + virtual void getNameTagTextColor(void); + virtual void getShadowRadius(void); + virtual void getHeadLookVector(float); + virtual bool canInteractWithOtherEntitiesInGame(void); + virtual void getBrightness(float, IConstBlockSource const&); + virtual void playerTouch(void); + virtual bool isImmobile(void); + virtual bool isSilentObserver(void); + virtual bool isSleeping(void); + virtual void setSleeping(bool); + virtual void setSneaking(bool); + virtual bool isBlocking(void); + virtual bool isDamageBlocked(ActorDamageSource const&); + virtual bool isAlive(void); + virtual bool isOnFire(void); + virtual bool isSurfaceMob(void); + virtual bool isTargetable(void); + virtual bool canAttack(Actor*, bool); + virtual void setTarget(Actor*); + virtual bool isValidTarget(Actor*); + virtual void attack(Actor&, ActorDamageCause const&); + virtual void performRangedAttack(Actor&, float); + virtual void setOwner(ActorUniqueID); + virtual void setSitting(bool); + virtual void onTame(void); + virtual void onFailedTame(void); + virtual void setStanding(bool); + virtual bool canPowerJump(void); + virtual bool isEnchanted(void); + virtual void shouldRender(void); + virtual void playAmbientSound(void); + virtual void getAmbientSound(void); + virtual bool isInvulnerableTo(ActorDamageSource const&); + virtual void getBlockDamageCause(Block const&); + virtual void doFireHurt(int); + virtual void onLightningHit(void); + virtual void feed(int); + virtual void handleEntityEvent(ActorEvent, int); + virtual void getActorRendererId(void); + virtual void despawn(void); + virtual void setArmor(ArmorSlot, ItemStack const&); + virtual void getArmorMaterialTypeInSlot(ArmorSlot); + virtual void getArmorTextureIndexInSlot(ArmorSlot); + virtual void getArmorColorInSlot(ArmorSlot, int); + virtual void setEquippedSlot(int, ItemStack const&); + virtual void setCarriedItem(ItemStack const&); + virtual void getCarriedItem(void); + virtual void setOffhandSlot(ItemStack const&); + virtual void getEquippedTotem(void); + virtual void consumeTotem(void); + virtual void save(CompoundTag&); + virtual void load(CompoundTag const&, DataLoadHelper&); + virtual void queryEntityRenderer(void); + virtual void getSourceUniqueID(void); + virtual bool canFreeze(void); + virtual void getLiquidAABB(void); + virtual void handleInsidePortal(Vec3 const&); + virtual bool canChangeDimensionsUsingPortal(void); + virtual void changeDimension(int); + virtual void changeDimension(ChangeDimensionPacket const&); + virtual void getControllingPlayer(void); + virtual void causeFallDamageToActor(float, float, ActorDamageSource); + virtual void onSynchedDataUpdate(int); + virtual bool canAddPassenger(Actor&); + virtual bool canPickupItem(ItemStack const&); + virtual bool canBePulledIntoVehicle(void); + virtual void inCaravan(void); + virtual void sendMotionPacketIfNeeded(PlayerMovementSettings const&); + virtual bool canSynchronizeNewEntity(void); + virtual void startSwimming(void); + virtual void stopSwimming(void); + virtual void buildDebugInfo(std::string&); + virtual void getCommandPermissionLevel(void); + virtual void getDeathTime(void); + virtual bool canBeAffected(int); + virtual bool canBeAffectedByArrow(MobEffectInstance const&); + virtual void onEffectRemoved(MobEffectInstance&); + virtual bool canObstructSpawningAndBlockPlacement(void); + virtual void getAnimationComponent(void); + virtual void openContainerComponent(void); + virtual void swing(void); + virtual void useItem(ItemStackBase&, ItemUseMethod, bool); + virtual void getDebugText(std::vector&); + virtual void getMapDecorationRotation(void); + virtual void getPassengerYRotation(Actor const&); + virtual void add(ItemStack&); + virtual void drop(ItemStack const&, bool); + virtual void getInteraction(ActorInteraction&, Vec3 const&); + virtual bool canDestroyBlock(Block const&); + virtual void setAuxValue(int); + virtual void startSpinAttack(void); + virtual void stopSpinAttack(void); + virtual void renderDebugServerState(Options const&); + virtual void kill(void); + virtual void die(ActorDamageSource const&); + virtual void shouldDropDeathLoot(void); + virtual void applySnapshot(void); + virtual void getNextStep(float); + virtual void onPush(Actor&); + virtual void getLastDeathPos(void); + virtual void getLastDeathDimension(void); + virtual bool hasDiedBefore(void); + virtual void doEnterWaterSplashEffect(void); + virtual void doExitWaterSplashEffect(void); + virtual void doWaterSplashEffect(void); + virtual void _shouldProvideFeedbackOnHandContainerItemSet(int, ItemStack const&); + virtual void _shouldProvideFeedbackOnArmorSet(ArmorSlot, ItemStack const&); + virtual void updateEntitySpecificMolangVariables(RenderParams&); + virtual void shouldTryMakeStepSound(void); + virtual void _hurt(ActorDamageSource const&, float, bool, bool); + virtual void readAdditionalSaveData(CompoundTag const&, DataLoadHelper&); + virtual void addAdditionalSaveData(CompoundTag&); + virtual void _playStepSound(Vec3 const&, Block const&); + virtual void _doAutoAttackOnTouch(Actor&); + + + bool isPlayer() + { + + if (isAlive() && !isImmobile() && getNametag() != nullptr && !getNametag()->empty()) + return true; + + return false; // sorry about this homelessness but tozic would MURDER me if i added entt and components to this :pray: } - AABBShapeComponent* getAABBShapeComponent() { - using getAABBShapeComponent = AABBShapeComponent * (__cdecl*)(void*, EntityId*); - static auto func = reinterpret_cast(Utils::findSig("40 53 48 83 EC ? 48 8B DA BA F2 C9 10 1B")); - auto registryBase = *reinterpret_cast(this->entityContext.registry); - auto id = this->entityContext.id; - return func(registryBase, &id); + + std::string* getNametag() { + static uintptr_t sig; + if (sig == NULL) { + sig = Utils::findSig("48 83 EC ? 48 8B 81 ? ? ? ? 48 85 C0 74 3B 48 8B 08 BA ? ? ? ? 48 8B 40 ? 48 2B C1 48 C1 F8 ? 66 3B D0 73 17"); + } + + auto fn = reinterpret_cast(sig); + return fn(this); } + + float getTicksPerSecond() { + if (this != nullptr) { + Vec3 targetPos = this->stateVector->currentPos; + Vec3 targetPosOld = this->stateVector->oldPos; + float hVel = sqrtf(((targetPos.x - targetPosOld.x) * (targetPos.x - targetPosOld.x)) + ((targetPos.z - targetPosOld.z) * (targetPos.z - targetPosOld.z))); + return hVel; + } + return -1.f; + } + + float getBlocksPerSecond() { + return getTicksPerSecond() * 20; + } + + /*/ + bool isOnGround() { // ActorCollision::isOnGround + return hasComponent(); + } + + void setIsOnGround(bool state) { + if (state) { + getOrEmplaceComponent(); + } + else { + removeComponent(); + } + }; + + + void jumpFromGround() { + getOrEmplaceComponent>(); + } + + Vec2* getRotation() { + __int64* v2 = (__int64*)*((__int64*)this + 0x55); + if (v2 == nullptr) + return nullptr; + return (Vec2*)v2; + } + + void setRotations(Vec2* a2) + { + __int64* v2 = (__int64*)*((__int64*)this + 0x55); + if (v2 == nullptr) return; + *v2 = *(__int64*)a2; + } + + bool isPlayer() + { + return hasComponent>(); + + } + /*/ public: - BUILD_ACCESS(struct EntityContext, entityContext, 0x8); - BUILD_ACCESS(class EntityLocation*, location, 0x2A0); -}; \ No newline at end of file + // Level Actor::getLevel(void) + BUILD_ACCESS(Level*, level, 0x250); // 1.20.81 + // Unknown + BUILD_ACCESS(int16_t, hurtTime, 0x638); // 1.20.81 + // StateVector Actor::getPosition(void); + BUILD_ACCESS(StateVectorComponent*, stateVector, 0x290); // 1.20.81 + // AABBShape (StateVector + 8) or Actor::getAABB(void) + BUILD_ACCESS(AABBShapeComponent*, aabbShape, 0x298); // 1.20.81 +}; diff --git a/Thrift/Client/SDK/Classes/ActorCollision.h b/Thrift/Client/SDK/Classes/ActorCollision.h new file mode 100644 index 0000000..b149207 --- /dev/null +++ b/Thrift/Client/SDK/Classes/ActorCollision.h @@ -0,0 +1,11 @@ +#pragma once + +class ActorCollision { +public: + bool isOnGround() { + auto isOnGroundFunc = Utils::findSig("4C 8B 41 ? 4C 8B D1 48 8B 41 ? 4C 8B 49 ? 49 2B C0 48 C1 F8 ? 48 FF C8 25 ? ? ? ? 49 8B 0C C0 48 83 F9 ? 74 ? 0F 1F 84 00 ? ? ? ? 48 C1 E1 ? 42 81 7C 09 ? ? ? ? ? 4A 8D 04 09 74 ? 48 8B 08 48 83 F9 ? 75 ? 49 8B 42 ? 49 3B 42 ? 74 ? 48 8B 48 ? 48 85 C9 74 ? 4C 8B 49 ? 8B 02 8B D0 48 8B 49 ? 81 E2 ? ? ? ? 49 2B C9 44 8B C2 49 C1 E8 ? 48 C1 F9 ? 4C 3B C1 73 ? 4B 8B 0C C1 48 85 C9 74 ? 81 E2 ? ? ? ? 4C 8D 04 91 4D 85 C0 74 ? 25 ? ? ? ? 41 33 00 3D ? ? ? ? 73 ? B0 ? C3 32 C0 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 4C 8B 41 ? 41 BB ? ? ? ? 48 8B 41 ? 4C 8B D1 4C 8B 49 ? 49 2B C0 48 C1 F8 ? 48 FF C8 49 23 C3 49 8B 04 C0 48 83 F8 ? 74 ? 0F 1F 40 ? 48 C1 E0 ? 46 39 5C 08 ? 4A 8D 0C 08 74 ? 48 8B 01 48 83 F8 ? 75 ? 49 8B 4A ? 49 3B 4A ? 74 ? 48 8B 49 ? 48 85 C9 74 ? 4C 8B 49 ? 8B 02 8B D0 48 8B 49 ? 81 E2 ? ? ? ? 49 2B C9 44 8B C2 49 C1 E8 ? 48 C1 F9 ? 4C 3B C1 73 ? 4B 8B 0C C1 48 85 C9 74 ? 81 E2 ? ? ? ? 4C 8D 04 91 4D 85 C0 74 ? 25 ? ? ? ? 41 33 00 3D ? ? ? ? 73 ? B0 ? C3 32 C0 C3 CC CC CC 4C 8B 41 ? 4C 8B D1 48 8B 41 ? 4C 8B 49 ? 49 2B C0 48 C1 F8 ? 48 FF C8 25 ? ? ? ? 49 8B 0C C0 48 83 F9 ? 74 ? 0F 1F 84 00 ? ? ? ? 48 C1 E1 ? 42 81 7C 09 ? ? ? ? ? 4A 8D 04 09 74 ? 48 8B 08 48 83 F9 ? 75 ? 49 8B 42 ? 49 3B 42 ? 74 ? 48 8B 48 ? 48 85 C9 74 ? 4C 8B 49 ? 8B 02 8B D0 48 8B 49 ? 81 E2 ? ? ? ? 49 2B C9 44 8B C2 49 C1 E8 ? 48 C1 F9 ? 4C 3B C1 73 ? 4B 8B 0C C1 48 85 C9 74 ? 81 E2 ? ? ? ? 4C 8D 04 91 4D 85 C0 74 ? 25 ? ? ? ? 41 33 00 3D ? ? ? ? 73 ? B0 ? C3 32 C0 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 4C 8B 41 ? 41 BB"); + //void* rcx = *(void**)((__int64)this + 0x10); + int rda = *(int*)((__int64)this + 0x8); // was 0x18 on actor + return Utils::CallFunc((void*)isOnGroundFunc, this, &rda); + } +}; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/ActorFlags.h b/Thrift/Client/SDK/Classes/ActorFlags.h new file mode 100644 index 0000000..2f4d3b9 --- /dev/null +++ b/Thrift/Client/SDK/Classes/ActorFlags.h @@ -0,0 +1,113 @@ +#pragma once + +enum ActorFlags : int { + ONFIRE = 0, + SNEAKING = 1, + RIDING = 2, + SPRINTING = 3, + ACTION = 4, + INVISIBLE = 5, + TEMPTED = 6, + INLOVE = 7, + SADDLED = 8, + POWERED = 9, + IGNITED = 10, + BABY = 11, + CONVERTING = 12, + CRITICAL = 13, + CAN_SHOW_NAMETAG = 14, + ALWAYS_SHOW_NAMETAG = 15, + IMMOBILE = 16, + SILENT = 17, + WALLCLIMBING = 18, + CAN_CLIMB = 19, + SWIMMER = 20, + CAN_FLY = 21, + WALKER = 22, + RESTING = 23, + SITTING = 24, + ANGRY = 25, + INTERESTED = 26, + CHARGED = 27, + TAMED = 28, + ORPHANED = 29, + LEASHED = 30, + SHEARED = 31, + GLIDING = 32, + ELDER = 33, + MOVING = 34, + BREATHING = 35, + CHESTED = 36, + STACKABLE = 37, + SHOWBASE = 38, + REARING = 39, + VIBRATING = 40, + IDLING = 41, + EVOKER_SPELL = 42, + CHARGE_ATTACK = 43, + WASD_CONTROLLED = 44, + CAN_POWER_JUMP = 45, + CAN_DASH = 46, + LINGERING = 47, // LINGER, had to rename it due to compiler error + HAS_COLLISION = 48, + GRAVITY = 49, + FIRE_IMMUNE = 50, + DANCING = 51, + ENCHANTED = 52, + SHOW_TRIDENT_ROPE = 53, + CONTAINER_PRIVATE = 54, + IS_TRANSFORMING = 55, + SPIN_ATTACK = 56, + SWIMMING = 57, + BRIBED = 58, + PREGNANT = 59, + LAYING_EGG = 60, + RIDER_CAN_PICK = 61, + TRANSITION_SETTING = 62, + EATING = 63, + LAYING_DOWN = 64, + SNEEZING = 65, + TRUSTING = 66, + ROLLING = 67, + SCARED = 68, + IN_SCAFFOLDING = 69, + OVER_SCAFFOLDING = 70, + FALL_THROUGH_SCAFFOLDING = 71, + BLOCKING = 72, + TRANSITION_BLOCKING = 73, + BLOCKED_USING_SHIELD = 74, + BLOCKED_USING_DAMAGED_SHIELD = 75, + SLEEPING = 76, + ENTITY_GROW_UP = 77, + TRADE_INTEREST = 78, + DOOR_BREAKER = 79, + BREAKING_OBSTRUCTION = 80, + DOOR_OPENER = 81, + IS_ILLAGER_CAPTAIN = 82, + STUNNED = 83, + ROARING = 84, + DELAYED_ATTACK = 85, + IS_AVOIDING_MOBS = 86, + IS_AVOIDING_BLOCKS = 87, + FACING_TARGET_TO_RANGE_ATTACK = 88, + HIDDEN_WHEN_INVISIBLE = 89, + IS_IN_UI = 90, + STALKING = 91, + EMOTING = 92, + CELEBRATING = 93, + ADMIRING = 94, + CELEBRATING_SPECIAL = 95, + RAM_ATTACK = 97, + PLAYING_DEAD = 98, + IN_ASCENDABLE_BLOCK = 99, + OVER_DESCENDABLE_BLOCK = 100, + CROAKING = 101, + EAT_MOB = 102, + JUMP_GOAL_JUMP = 103, + EMERGING = 104, + SNIFFING = 105, + DIGGING = 106, + SONIC_BOOM = 107, + HAS_DASH_COOLDOWN = 108, + PUSH_TOWARDS_CLOSEST_SPACE = 109 +}; diff --git a/Thrift/Client/SDK/Classes/ActorType.h b/Thrift/Client/SDK/Classes/ActorType.h new file mode 100644 index 0000000..745f1d7 --- /dev/null +++ b/Thrift/Client/SDK/Classes/ActorType.h @@ -0,0 +1,149 @@ +#pragma once + +enum ActorType { + + /* Drops */ + + item = 64, + xp_orb = 69, + + /* Blocks */ + + tnt = 65, + falling_block = 66, + moving_block = 67, + + /* Immobile and projectiles */ + + armor_stand = 61, + xp_bottle = 68, + eye_of_ender_signal = 70, + ender_crystal = 71, + fireworks_rocket = 72, + thrown_trident = 73, + shulker_bullet = 76, + fishing_hook = 77, + dragon_fireball = 79, + arrow = 80, + snowball = 81, + egg = 82, + painting = 83, + minecart = 84, + fireball = 85, + splash_potion = 86, + ender_pearl = 87, + leash_knot = 88, + wither_skull = 89, + boat = 90, + wither_skull_dangerous = 91, + lightning_bolt = 93, + small_fireball = 94, + area_effect_cloud = 95, + hopper_minecart = 96, + tnt_minecart = 97, + chest_minecart = 98, + command_block_minecart = 100, + lingering_potion = 101, + llama_spit = 102, + evocation_fang = 103, + ice_bomb = 106, + balloon = 107, + chest_boat = 218, + + /* Hostile mobs */ + + zombie = 32, + creeper = 33, + skeleton = 34, + spider = 35, + zombie_pigman = 36, + slime = 37, + enderman = 38, + silverfish = 39, + cave_spider = 40, + ghast = 41, + magma_cube = 42, + blaze = 43, + zombie_villager = 44, + witch = 45, + stray = 46, + husk = 47, + wither_skeleton = 48, + guardian = 49, + elder_guardian = 50, + wither = 52, + ender_dragon = 53, + shulker = 54, + endermite = 55, + vindicator = 57, + phantom = 58, + ravager = 59, + evocation_illager = 104, + vex = 105, + drowned = 110, + pillager = 114, + zombie_villager_v2 = 116, + piglin = 123, + hoglin = 124, + zoglin = 126, + piglin_brute = 127, + warden = 131, + + /* Passive and neutral mobs */ + + chicken = 10, + cow = 11, + pig = 12, + sheep = 13, + wolf = 14, + villager = 15, + mooshroom = 16, + squid = 17, + rabbit = 18, + bat = 19, + iron_golem = 20, + snow_golem = 21, + ocelot = 22, + horse = 23, + donkey = 24, + mule = 25, + skeleton_horse = 26, + zombie_horse = 27, + polar_bear = 28, + llama = 29, + parrot = 30, + dolphin = 31, + turtle = 74, + cat = 75, + pufferfish = 108, + salmon = 109, + tropicalfish = 111, + cod = 112, + panda = 113, + villager_v2 = 115, + wandering_trader = 118, + fox = 121, + bee = 122, + strider = 125, + goat = 128, + frog = 132, + tadpole = 133, + allay = 134, + + /* Other */ + + player = 63, + shield = 117, + + /* Unused */ + + elder_guardian_ghost = 120, + + /* Education Edition */ + + npc = 51, + agent = 56, + tripod_camera = 62, + chalkboard = 78 + +}; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/Block.h b/Thrift/Client/SDK/Classes/Block.h new file mode 100644 index 0000000..5fe8913 --- /dev/null +++ b/Thrift/Client/SDK/Classes/Block.h @@ -0,0 +1,32 @@ +#pragma once + +class Block +{ +public: + /*/ + BlockLegacy* GetBlockLegacy() { + return *reinterpret_cast((uintptr_t)this + 0x30); // 1.20.71 + } + + TextHolder* GetTileName() + { + return GetBlockLegacy()->GetTileName(); + } + + Material* GetMaterial() + { + return GetBlockLegacy()->GetMaterial(); + } + + MaterialType GetMaterialType() + { + return GetBlockLegacy()->GetMaterial()->type; + } +we are too homeless sorry /*/ +public: + class TextHolder tileName; //0x0008 +private: + char pad_0028[8]; //0x0028 +public: + class TextHolder name; //0x0030 +}; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/BlockActor.h b/Thrift/Client/SDK/Classes/BlockActor.h new file mode 100644 index 0000000..cb64e1c --- /dev/null +++ b/Thrift/Client/SDK/Classes/BlockActor.h @@ -0,0 +1,12 @@ +#pragma once + +class CompoundTag; + +class BlockActor { +private: + virtual void destructor(); + virtual __int64 load(__int64&, CompoundTag*, __int64&); + +public: + virtual bool save(CompoundTag*); +}; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/BlockSource.h b/Thrift/Client/SDK/Classes/BlockSource.h new file mode 100644 index 0000000..e9a3306 --- /dev/null +++ b/Thrift/Client/SDK/Classes/BlockSource.h @@ -0,0 +1,11 @@ +#pragma once +//Include like this to avoid over riding +#include "Block.h" + +class BlockSource { +public: + Block* getBlock(Vec3 blockPos) + { + return Utils::CallVFunc<2, Block*, Vec3&>(this, blockPos); + } +}; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/ClientInstance.h b/Thrift/Client/SDK/Classes/ClientInstance.h index e73c256..986cb09 100644 --- a/Thrift/Client/SDK/Classes/ClientInstance.h +++ b/Thrift/Client/SDK/Classes/ClientInstance.h @@ -9,43 +9,43 @@ #include "GuiData.h" #include "Actor.h" -#define disableInputIndex 305 -#define getLocalPlayerIndex 27 +#define disableInputIndex 331 // Updated to 1.20.81 +#define getLocalPlayerIndex 29 class ClientInstance { private: uintptr_t** VTable; + public: + Player* getLocalPlayer() { + return (Player*)Utils::CallVFunc(this); // 1.20.80 + } + - auto getLocalPlayer() -> class Player* { - return (class Player*)Utils::CallVFunc(this); + BlockSource* getBlockSource() { + return Utils::CallVFunc<28, BlockSource*>(this); // 1.20.71 } auto setDisableInput(bool disable) -> void { - Utils::CallVFunc(this, disable); + Utils::CallVFunc(this, disable); //maybe bad // Updated to 1.20.81 } - auto releaseMouse() -> void { - Utils::CallVFunc(this); - } auto grabMouse() -> void { - Utils::CallVFunc(this); + Utils::CallVFunc<332, __int64>(this); //326 // BROKEN in 1.21 } - auto getMoveTurnInput() -> class MoveInputHandler* { - auto* player = this->getLocalPlayer(); - using MoveInputComponent_try_get = class MoveInputHandler* (__cdecl*)(void*, EntityId*); - static MoveInputComponent_try_get MoveInputComponent_try_getFunc = reinterpret_cast(Utils::findSig("40 53 48 83 EC 20 48 8B DA BA 2E CD 8B 46"));//dont mind shit sig :heart: - auto registryBase = *reinterpret_cast(player->entityContext.registry); - EntityId entityId = player->entityContext.id; - return MoveInputComponent_try_getFunc(registryBase, &entityId); + auto releaseMouse() -> void { + Utils::CallVFunc<333, __int64>(this); //327 BROKEN in 1.21 } + + + + public: - BUILD_ACCESS(class LoopbackPacketSender*, LoopbackPacketSender, 0xF0);//Good as of 1.20 - BUILD_ACCESS(class MinecraftGame*, MinecraftGame, 0xC8); //Good as of 1.20 - BUILD_ACCESS(class GuiData*, GuiData, 0x540);//Good as of 1.20 + BUILD_ACCESS(class LoopbackPacketSender*, LoopbackPacketSender, 0xF0); // Updated to 1.20.71 + BUILD_ACCESS(class MinecraftGame*, MinecraftGame, 0xC8); // Updated to 1.20.71 + BUILD_ACCESS(class GuiData*, GuiData, 0x558); // Updated to 1.20.81 public: AS_FIELD(class Player*, LocalPlayer, getLocalPlayer); - AS_FIELD(class MoveInputHandler*, getMoveInputHandler, getMoveTurnInput); }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/EntityContext.h b/Thrift/Client/SDK/Classes/EntityContext.h new file mode 100644 index 0000000..d0fc155 --- /dev/null +++ b/Thrift/Client/SDK/Classes/EntityContext.h @@ -0,0 +1,15 @@ +#pragma once +#include + + +class EntityId; + +struct EntityIdTraits { + using value_type = EntityId; + + using entity_type = uint32_t; + using version_type = uint16_t; + + static constexpr entity_type entity_mask = 0x3FFFF; + static constexpr version_type version_mask = 0x3FFF; +}; diff --git a/Thrift/Client/SDK/Classes/EntityID.h b/Thrift/Client/SDK/Classes/EntityID.h new file mode 100644 index 0000000..e69de29 diff --git a/Thrift/Client/SDK/Classes/EntityIdTraits.h b/Thrift/Client/SDK/Classes/EntityIdTraits.h new file mode 100644 index 0000000..e69de29 diff --git a/Thrift/Client/SDK/Classes/GuiData.h b/Thrift/Client/SDK/Classes/GuiData.h index 68464a9..7e0b745 100644 --- a/Thrift/Client/SDK/Classes/GuiData.h +++ b/Thrift/Client/SDK/Classes/GuiData.h @@ -2,17 +2,22 @@ #include "../../Utils/Math.h" class GuiData { - char pad_0000[0x28]; //0x0000 + char pad_0000[0x30]; //0x0000 public: - struct Vec2 actualRes; //0x0030 + Vec2 actualRes; //0x0030 private: - char pad_0020[0x8]; //0x0038 + char pad_0020[0x10]; //0x0040 public: - struct Vec2 res; + Vec2 resOLD; + BUILD_ACCESS(Vec2, res, 0x0040); virtual void Constructor(); float* getScale() { return reinterpret_cast((__int64)this + 0x4C);//Good as of 1.20 }; +private: + char pad_0x0050[0x1A]; //0x0050 +public: + Vec2 MousePos; //0x006A }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/Level.h b/Thrift/Client/SDK/Classes/Level.h new file mode 100644 index 0000000..ef30c75 --- /dev/null +++ b/Thrift/Client/SDK/Classes/Level.h @@ -0,0 +1,85 @@ +#pragma once +#include "../../Utils/Utils.h" +#include "EntityContext.h" + +class Actor; +class Block; + +enum class HitResultType : int { + Tile = 0x0, + Entity = 0x1, + EntityOutOfRange = 0x2, + NoHit = 0x3, +}; + +struct WeakEntityRef { +private: + uint8_t pad[0x10]{}; + +public: + //int id23{}; + +private: + uint8_t pad2[0x4]{}; +}; + +class HitResult { +public: + Vec3 startPos; // this+0x0 + Vec3 rayDir; // this+0xC + HitResultType type; // this+0x18 + unsigned char facing; // this+0x1C + Vec3 blockPos; // this+0x20 + Vec3 Pos; // this+0x2C + WeakEntityRef entity; // this+0x38 + bool isHitLiquid; // this+0x50 + unsigned char liquidFacing; // this+0x51 + Vec3 liquid; // this+0x54 + Vec3 liquidPos; // this+0x60 + bool indirectHit; // this+0x6C +}; + +class BlockPalette { +public: + Block* getBlock(unsigned int* runtimeId) { + using getblock_t = Block*(__fastcall*)(BlockPalette*, unsigned int*); + static getblock_t getblock = reinterpret_cast(Utils::findSig("40 ? 48 81 EC ? ? ? ? 48 8B ? ? ? ? ? 48 33 ? 48 89 ? ? ? ? ? ? 48 8B ? C7 44 24 20")); + return getblock(this, runtimeId); + } +}; + +class Level { +public: + BUILD_ACCESS(BlockPalette*, blockPalette, 0x0AC8); + + std::vector getRuntimeActorList() { + std::vector listOut; + Utils::CallVFunc<278, decltype(&listOut)>(this, &listOut); // Updated to 1.20.80 + return listOut; + } + + HitResult* getHitResult() { + return (HitResult*)Utils::CallVFunc<288, HitResult*>(this); + } + + BlockPalette* getBlockPalette() { + return Utils::CallVFunc<70, BlockPalette*>(this); + } + /*std::vector getRuntimeActorList() { + static uintptr_t sig = Utils::findSig("40 53 48 83 EC 30 48 81 C1 E0 1C 00 00"); // Updated to 1.20.71 + static auto getRuntimeActorList = *(decltype(&Level::getRuntimeActorList)*)&sig; + return (this->*getRuntimeActorList)(); + }*/ + + /* +private: + char pad_0x0000[0xC48]; //0x0000 +public: + Vec3 Origin; //0x0BD8 + Vec3 RelativeRayEnd; + HitResultType HitType; + int BlockFace; + Vec3 IBlockPos; //0x0BF8 + Vec3 AbsoluteHitPos; + */ +}; diff --git a/Thrift/Client/SDK/Classes/MinecraftGame.h b/Thrift/Client/SDK/Classes/MinecraftGame.h index 884d4b7..c5bff2d 100644 --- a/Thrift/Client/SDK/Classes/MinecraftGame.h +++ b/Thrift/Client/SDK/Classes/MinecraftGame.h @@ -17,6 +17,6 @@ class Font { class MinecraftGame { public: - BUILD_ACCESS(bool, canUseKeys, 0x188);//Good as of 1.20.10 - BUILD_ACCESS(Font*, mcfont, 0xEC0);//Good as of 1.20.10 + BUILD_ACCESS(bool, canUseKeys, 0x1A8);//good for 1.20.62 + BUILD_ACCESS(Font*, mcfont, 0xF48);//good for 1.20.51 }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/MinecraftUIRenderContext.h b/Thrift/Client/SDK/Classes/MinecraftUIRenderContext.h index 0c6b622..f182b8c 100644 --- a/Thrift/Client/SDK/Classes/MinecraftUIRenderContext.h +++ b/Thrift/Client/SDK/Classes/MinecraftUIRenderContext.h @@ -4,6 +4,7 @@ #include "../../Utils/Utils.h" #include "../../Utils/Math.h" + class TextMeasureData { public: float scale; @@ -27,9 +28,57 @@ class CaretMeasureData { }; }; +class FilePath {//I pasted +private: + char pad_0x0[0x18]; +public: + std::string filePathStr; +}; + +class TexturePtr { +private: + char pad_0x0[0x18]; +public: + FilePath* filePath; +}; + +enum class ResourceFileSystem : int { //nrg sent me + UserPackage = 0x0, + AppPackage = 0x1, + Raw = 0x2, + RawPersistent = 0x3, + SettingsDir = 0x4, + ExternalDir = 0x5, + ServerPackage = 0x6, + DataDir = 0x7, + UserDir = 0x8, + ScreenshotsDir = 0x9, + StoreCache = 0xA, + Invalid = 0xB, +}; + +class ResourceLocation +{ +public: + ResourceFileSystem type; //0x0 +private: + char fill[0x4]; +public: + std::string path; //0x8 + __int64 pathHash; + __int64 fullHash; +public: + ResourceLocation(ResourceFileSystem type, std::string path) { + this->type = type; + this->path = path; + } + +}; + class MinecraftUIRenderContext { public: - ClientInstance* clientInstance; + ClientInstance* clientInstance; + private: virtual ~MinecraftUIRenderContext(); public: @@ -39,14 +88,15 @@ class MinecraftUIRenderContext { virtual auto drawDebugText(const float*, const std::string&, const float*, float, unsigned int, float*, void*) -> __int64; virtual auto drawText(Font*, const float*, const std::string&, const float*, float, unsigned int, const TextMeasureData*, const CaretMeasureData*) -> __int64; virtual auto flushText(float) -> void; - virtual auto drawImage(std::string*, Vec2*, Vec2*, Vec2*, Vec2*, bool, const float*, float) -> __int64; + virtual auto drawImage(TexturePtr*, Vec2*, Vec2*, Vec2*, Vec2*) -> __int64; private: //virtual auto Function7(void) -> void; virtual auto Function8(void) -> void; - virtual auto Function9(void) -> void; + +private: virtual auto Function10(void) -> void; virtual auto Function11(void) -> void; public: virtual auto drawRectangle(const float*, const float*, float, int) -> void; - virtual auto fillRectangle(const float*, const float*, float) -> void; + virtual auto fillRectangle(const Rect, const float*, float) -> void; }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Classes/Player.h b/Thrift/Client/SDK/Classes/Player.h index c4305ed..e9a05dd 100644 --- a/Thrift/Client/SDK/Classes/Player.h +++ b/Thrift/Client/SDK/Classes/Player.h @@ -2,7 +2,75 @@ #include "Actor.h" + class Player : public Actor { public: - // + virtual void prepareRegion(ChunkSource&); + virtual void destroyRegion(void); + virtual void suspendRegion(void); + virtual void _fireDimensionChanged(void); + virtual void changeDimensionWithCredits(int); + virtual void tickWorld(Tick const&); + virtual void Function5(); + virtual void getTickingOffsets(void); + virtual void moveView(void); + virtual void moveSpawnView(Vec3 const&, int); + virtual void checkMovementStats(Vec3 const&); + virtual void getCurrentStructureFeature(void); + virtual bool isAutoJumpEnabled(void); + virtual void respawn(void); + virtual void resetRot(void); + virtual bool isInTrialMode(void); + virtual void openPortfolio(void); + virtual void openBook(int, bool, int, BlockActor*); + virtual void openTrading(ActorUniqueID const&, bool); + virtual void openChalkboard(ChalkboardBlockActor&, bool); + virtual void openNpcInteractScreen(); + virtual void openInventory(void); + virtual void displayChatMessage(std::string const&, std::string const&); + virtual void displayClientMessage(std::string const&); + virtual void displayTextObjectMessage(TextObjectRoot const&, std::string const&, std::string const&); + virtual void displayTextObjectWhisperMessage(ResolvedTextObject const&, std::string const&, std::string const&); + virtual void displayTextObjectWhisperMessage(std::string const&, std::string const&, std::string const&); + virtual void displayWhisperMessage(std::string const&, std::string const&, std::string const&, std::string const&); + virtual void startSleepInBed(Vec3 const&); + virtual void stopSleepInBed(bool, bool); + virtual bool canStartSleepInBed(void); + virtual void openSign(Vec3 const&, bool); + virtual void playEmote(std::string const&, bool); + virtual bool isLoading(void); + virtual bool isPlayerInitialized(void); + virtual void stopLoading(void); + virtual void setPlayerGameType(void); + virtual void initHUDContainerManager(void); + virtual void _crit(Actor&); + virtual void getEventing(void); + virtual void getUserId(void); + virtual void addExperience(int); + virtual void addLevels(int); //virtual void addLevels(int); + virtual void Function42(); + virtual void Function43(); + virtual void Function44(); + virtual void deleteContainerManager(void); + virtual bool isActorRelevant(Actor const&); + virtual void Function47(); + virtual void onSuspension(void); + virtual void onLinkedSlotsChanged(void); + virtual void Function50(); + virtual void Function51(); + virtual void sendNetworkPacket(Packet&); + virtual void Function53(); + virtual bool isSimulated(void); + virtual void getXuid(void); + virtual void getMovementSettings(void); + virtual void requestMissingSubChunk(SubChunkPos const&); + virtual void getMaxChunkBuildRadius(void); + virtual void onMovePlayerPacketNormal(Vec3 const&, Vec2 const&, float); + virtual void _createChunkSource(ChunkSource&); + virtual void setAbilities(LayeredAbilities const&); + + virtual void getEditorPlayer(void); // ServerPlayer + virtual void destroyEditorPlayer(void); // ServerPlayer + virtual void _getSpawnChunkLimit(void); // ServerPlayer + virtual void _updateChunkPublisherView(Vec3 const&, float); // ServerPlayer }; \ No newline at end of file diff --git a/Thrift/Client/SDK/Components/FlagComponent.h b/Thrift/Client/SDK/Components/FlagComponent.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/Thrift/Client/SDK/Components/FlagComponent.h @@ -0,0 +1 @@ +#pragma once diff --git a/Thrift/Client/SDK/Components/StateVectorComponent.h b/Thrift/Client/SDK/Components/StateVectorComponent.h new file mode 100644 index 0000000..0546af2 --- /dev/null +++ b/Thrift/Client/SDK/Components/StateVectorComponent.h @@ -0,0 +1,11 @@ +#pragma once +#include "../../Utils/Utils.h" + +class StateVectorComponent +{ +public: + Vec3 currentPos; //0x0000 + Vec3 oldPos; //0x000C + Vec3 velocity; //0x0018 + char pad_0024[116]; //0x0024 +}; //Size: 0x0098 \ No newline at end of file diff --git a/Thrift/Client/SDK/Minecraft.h b/Thrift/Client/SDK/Minecraft.h index ed5d4ea..8d0c109 100644 --- a/Thrift/Client/SDK/Minecraft.h +++ b/Thrift/Client/SDK/Minecraft.h @@ -7,8 +7,14 @@ class Minecraft { static ClientInstance* ci; static MinecraftUIRenderContext* renderCtx; public: + + static inline Font* MinecraftFont = nullptr; static auto getClientInstance(void)->ClientInstance*; static auto setClientInstance(ClientInstance*)->void; static auto getRenderContext(void) -> MinecraftUIRenderContext*; static auto setRenderContext(MinecraftUIRenderContext*) -> void; + + static Font* getFont() { + return MinecraftFont; + } }; \ No newline at end of file diff --git a/Thrift/Client/Utils/Render/RenderUtils.h b/Thrift/Client/Utils/Render/RenderUtils.h index 221268b..2f38ef9 100644 --- a/Thrift/Client/Utils/Render/RenderUtils.h +++ b/Thrift/Client/Utils/Render/RenderUtils.h @@ -1,27 +1,38 @@ -#pragma once +#pragma once #include "../Utils.h" #include "../../Manager/Hooks/SwapChain/ImGui/imgui.h" #include "../../SDK/Classes/MinecraftUIRenderContext.h" #include "../../SDK/Minecraft.h" +#include "../Math.h" + + + class RenderUtils { public: static class MinecraftUIRenderContext* context; + static class ScreenContext* screenContext2D; + static class ScreenContext* screenContext3D; + static class Tessellator* Tessellator2D; + static class Tessellator* Tessellator3D; + static float* colorHolder; /* Default colors */ - static struct Color white; - static struct Color black; - static struct Color red; - static struct Color lime; - static struct Color blue; - static struct Color yellow; - static struct Color cyan; - static struct Color purple; + static Color white; + static Color black; + static Color red; + static Color lime; + static Color blue; + static Color yellow; + static Color cyan; + static Color purple; static __forceinline void flush() { context->flushText(0); } + + static __forceinline float getTextWidth(std::string text, float textSize, class Font* font) { return context->getLineLength(font, text, textSize, false); } @@ -30,31 +41,73 @@ class RenderUtils { return font->getLineHeight(); } - static __forceinline void drawText(Font* font, Vec2 textPos, std::string text, Color color, float fontSize) { + static __forceinline void drawText(Font* font, Vec2 textPos, std::string text, Color color, float fontSize, bool shadow = false) { if (font == nullptr) { auto instance = context->clientInstance; auto mcgame = (instance != nullptr ? instance->MinecraftGame : nullptr); - font = (mcgame != nullptr ? mcgame->mcfont : nullptr); + //font = (mcgame != nullptr ? mcgame->mcfont : nullptr); + //font = (instance->getMinecraft() != nullptr ? instance->getMinecraft()->getFont() : nullptr); + font = Minecraft::getFont(); }; if (font == nullptr) return; - TextMeasureData textMeasureData = TextMeasureData(fontSize); + TextMeasureData textMeasureData = TextMeasureData(fontSize, shadow); CaretMeasureData caretMeasureData = CaretMeasureData(); auto textRect = Rect(textPos.x, textPos.x + (textPos.x * fontSize), textPos.y, textPos.y + (textPos.y * fontSize / 2)); context->drawText(font, textRect.get(), text, color.get(), color.a, 0, &textMeasureData, &caretMeasureData); } + template // not related to memory LOL + static std::string combine(T t) + { + std::stringstream ss; + ss << t; + return ss.str(); + } + + template // not related to memory LOL + static std::string combine(T t, Args... args) + { + std::stringstream ss; + ss << t << combine(args...); + return ss.str(); + } + + static __forceinline void drawGradientText(Vec2 pos, std::string text, float size, float alpha, bool shadow, float speed, float saturation, float brightness, int index) { + TextHolder str(text); + int ind = 0; + + for (char c : std::string(str.getText())) + { + std::string string = combine(c, ""); + + // Current color index + int colorIndex = ind * index; + + // Get each char's width and draw + float charWidth = getTextLen(nullptr, string, size); + + drawText(nullptr, Vec2(pos.x, pos.y), string, Utils::getGoodRainbow(speed, saturation, brightness, colorIndex), size, shadow); + + // Increment the color and pos index + pos.x += charWidth; + ++ind; + } + } + static __forceinline float getTextLen(Font* font, std::string text, float fontSize) { if (font == nullptr) { auto instance = context->clientInstance; auto mcgame = (instance != nullptr ? instance->MinecraftGame : nullptr); - font = (mcgame != nullptr ? mcgame->mcfont : nullptr); + //font = (mcgame != nullptr ? mcgame->mcfont : nullptr); + //font = (instance->getMinecraft() != nullptr ? instance->getMinecraft()->getFont() : nullptr); + font = Minecraft::getFont(); }; @@ -69,25 +122,25 @@ class RenderUtils { context->drawRectangle(rect.get(), color.get(), color.a, lineWidth); } - static __forceinline void fillRectangle(Rect rect, Color color) { + static __forceinline void fillRectangle(Rect rect, Color color, float alpha = 1.f) { rect = Rect(rect.x, rect.z, rect.y, rect.w); - context->fillRectangle(rect.get(), color.get(), color.a); + context->fillRectangle(rect, color.get(), alpha); } - static __forceinline void renderOutlinedText(std::string text, Vec2 textPos, Color fillColor, Color outlineColor, float textSize, Font* font) { + static __forceinline void renderOutlinedText(std::string text, Vec2 textPos, Color fillColor, Color outlineColor, float textSize, Font* font = nullptr) { // Calculate how much to go forward/backwards based on text size float backwards = -0.25f * textSize; float forwards = 0.5f * textSize; // Get rid of formatting std::string rt = text; - int formatPos = rt.find("§"); + int formatPos = (int)rt.find("�"); while (formatPos != std::string::npos) { if (rt.size() > formatPos + 2) { if (rt.at(formatPos + 2) != 'l') { // Don't get rid of bold rt.erase(formatPos - 1, 3); } } - formatPos = rt.find("§", formatPos + 1); + formatPos = (int)rt.find("�", formatPos + 1); } // Outline the text RenderUtils::drawText(font, textPos + Vec2(backwards, backwards), rt, outlineColor, textSize); @@ -118,7 +171,9 @@ class RenderUtils { RECT desktop; const HWND hDesktop = GetDesktopWindow(); GetWindowRect(hDesktop, &desktop); - return Vec2(desktop.right, desktop.bottom); + return Vec2((float)desktop.right, (float)desktop.bottom); } + + }; extern RenderUtils* renderUtils; diff --git a/Thrift/Client/Utils/Utils.h b/Thrift/Client/Utils/Utils.h index ff3b4e8..85aaad1 100644 --- a/Thrift/Client/Utils/Utils.h +++ b/Thrift/Client/Utils/Utils.h @@ -97,6 +97,14 @@ class Utils { std::uniform_real_distribution<>dis(min, max); return dis(gen); }; + + template + static R CallFunc(void* func, Args... args) + { + return ((R(*)(Args...))func)(args...); + } + + public: static auto ColorConvertRGBtoHSV(float, float, float, float&, float&, float&) -> void; static auto ColorConvertHSVtoRGB(float, float, float, float&, float&, float&) -> void;