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.World/Sheep.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Minecraft.World/Sheep.h (limited to 'Minecraft.World/Sheep.h') diff --git a/Minecraft.World/Sheep.h b/Minecraft.World/Sheep.h new file mode 100644 index 00000000..666e1d57 --- /dev/null +++ b/Minecraft.World/Sheep.h @@ -0,0 +1,86 @@ +#pragma once + +using namespace std; + +class Random; +class EatTileGoal; +class CraftingContainer; + +#include "Animal.h" +#include "SharedConstants.h" +#include "AbstractContainerMenu.h" + +class Sheep : public Animal +{ +private: + class SheepContainer : public AbstractContainerMenu + { + bool stillValid(shared_ptr player) { return false; } + }; + + shared_ptr container; +public: + eINSTANCEOF GetType() { return eTYPE_SHEEP; } + static Entity *create(Level *level) { return new Sheep(level); } + +private: + static const int EAT_ANIMATION_TICKS = SharedConstants::TICKS_PER_SECOND * 2; + static const int DATA_WOOL_ID = 16; + + int eatAnimationTick; + EatTileGoal *eatTileGoal; + +public: + static const float COLOR[][3]; + +public: + Sheep(Level *level); + +protected: + virtual bool useNewAi(); + virtual void newServerAiStep(); + +public: + void aiStep(); + virtual int getMaxHealth(); + +protected: + virtual void defineSynchedData(); + +public: + virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel); + virtual int getDeathLoot(); + +public: + virtual void handleEntityEvent(byte id); + +public: + float getHeadEatPositionScale(float a); + float getHeadEatAngleScale(float a); + + virtual bool interact(shared_ptr player); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditionalSaveData(CompoundTag *tag); + +protected: + virtual int getAmbientSound(); + virtual int getHurtSound(); + virtual int getDeathSound(); + +public: + int getColor(); + void setColor(int color); + bool isSheared(); + void setSheared(bool value); + + static int getSheepColor(Random *random); + virtual shared_ptr getBreedOffspring(shared_ptr target); + + virtual void ate(); + + void finalizeMobSpawn(); + +private: + int getOffspringColor(shared_ptr animal, shared_ptr partner); + int getDyeColor(shared_ptr animal); +}; -- cgit v1.2.3