From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: feat: TU19 (Dec 2014) Features & Content (#155) * try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki --- Minecraft.World/Entity.h | 80 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 22 deletions(-) (limited to 'Minecraft.World/Entity.h') diff --git a/Minecraft.World/Entity.h b/Minecraft.World/Entity.h index bde83e30..e2a26290 100644 --- a/Minecraft.World/Entity.h +++ b/Minecraft.World/Entity.h @@ -6,7 +6,7 @@ using namespace std; #include "Vec3.h" #include "Definitions.h" -class Mob; +class LivingEntity; class LightningBolt; class ItemEntity; class EntityPos; @@ -17,6 +17,7 @@ class Random; class Level; class CompoundTag; class DamageSource; +class Explosion; // 4J Stu Added this mainly to allow is to record telemetry for player deaths enum EEntityDamageType @@ -33,13 +34,16 @@ enum EEntityDamageType class Entity : public enable_shared_from_this { -friend class Gui; // 4J Stu - Added to be able to access the shared flag functions and constants, without making them publicly available to everything + friend class Gui; // 4J Stu - Added to be able to access the shared flag functions and constants, without making them publicly available to everything public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts virtual eINSTANCEOF GetType() = 0; -public: + inline bool instanceof(eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, GetType()); } + inline static bool instanceof(eINSTANCEOF type, eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, type); } +public: + static const wstring RIDING_TAG; static const short TOTAL_AIR_SUPPLY = 20 * 15; private: @@ -53,6 +57,7 @@ public: bool blocksBuilding; weak_ptr rider; // Changed to weak to avoid circular dependency between rider/riding entity shared_ptr riding; + bool forcedLoading; Level *level; double xo, yo, zo; @@ -79,6 +84,7 @@ public: float walkDistO; float walkDist; + float moveDist; float fallDistance; private: @@ -110,10 +116,6 @@ public: private: bool firstTick; -public: - wstring customTextureUrl; - wstring customTextureUrl2; - protected: bool fireImmune; @@ -125,7 +127,7 @@ private: static const int DATA_SHARED_FLAGS_ID = 0; static const int FLAG_ONFIRE = 0; static const int FLAG_SNEAKING = 1; - static const int FLAG_RIDING = 2; + //static const int FLAG_ = 2; static const int FLAG_SPRINTING = 3; static const int FLAG_USING_ITEM = 4; static const int FLAG_INVISIBLE = 5; @@ -138,22 +140,39 @@ private: public: bool inChunk; - int xChunk, yChunk, zChunk; - int xp, yp, zp, xRotp, yRotp; - bool noCulling; - bool hasImpulse; + int xChunk, yChunk, zChunk; + int xp, yp, zp, xRotp, yRotp; + bool noCulling; + bool hasImpulse; + int changingDimensionDelay; + +protected: + bool isInsidePortal; + int portalTime; + +public: + int dimension; + +protected: + int portalEntranceDir; + +private: + bool invulnerable; + wstring uuid; protected: // 4J Added so that client side simulations on the host are not affected by zero-lag bool m_ignoreVerticalCollisions; + bool m_ignorePortal; + public: Entity(Level *level, bool useSmallId = true); // 4J - added useSmallId parameter virtual ~Entity(); protected: // 4J - added for common ctor code - void _init(bool useSmallId); + void _init(bool useSmallId, Level *level); protected: virtual void defineSynchedData() = 0; @@ -191,6 +210,7 @@ public: void interpolateTurn(float xo, float yo); virtual void tick(); virtual void baseTick(); + virtual int getPortalWaitTime(); protected: void lavaHurt(); @@ -256,7 +276,7 @@ protected: public: // 4J Added damageSource param to enable telemetry on player deaths - virtual bool hurt(DamageSource *source, int damage); + virtual bool hurt(DamageSource *source, float damage); bool intersects(double x0, double y0, double z0, double x1, double y1, double z1); virtual bool isPickable(); virtual bool isPushable(); @@ -264,18 +284,24 @@ public: virtual void awardKillScore(shared_ptr victim, int score); virtual bool shouldRender(Vec3 *c); virtual bool shouldRenderAtSqrDistance(double distance); - virtual int getTexture(); // 4J - changed from wstring to int virtual bool isCreativeModeAllowed(); + bool saveAsMount(CompoundTag *entityTag); bool save(CompoundTag *entityTag); void saveWithoutId(CompoundTag *entityTag); virtual void load(CompoundTag *tag); protected: + virtual bool repositionEntityAfterLoad(); const wstring getEncodeId(); public: virtual void readAdditionalSaveData(CompoundTag *tag) = 0; virtual void addAdditonalSaveData(CompoundTag *tag) = 0; + /** + * Called after load() has finished and the entity has been added to the + * world + */ + virtual void onLoadedFromSave(); protected: ListTag *newDoubleList(unsigned int number, double firstValue, ...); @@ -296,15 +322,14 @@ public: virtual double getRidingHeight(); virtual double getRideHeight(); virtual void ride(shared_ptr e); - virtual void findStandUpPosition(shared_ptr vehicle); // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player virtual void lerpTo(double x, double y, double z, float yRot, float xRot, int steps); virtual float getPickRadius(); virtual Vec3 *getLookAngle(); virtual void handleInsidePortal(); + virtual int getDimensionChangingDelay(); virtual void lerpMotion(double xd, double yd, double zd); virtual void handleEntityEvent(byte eventId); virtual void animateHurt(); - virtual void prepareCustomTextures(); virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[] virtual void setEquippedSlot(int slot, shared_ptr item); // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game virtual bool isOnFire(); @@ -336,7 +361,7 @@ public: void setAirSupply(int supply); virtual void thunderHit(const LightningBolt *lightningBolt); - virtual void killed(shared_ptr mob); + virtual void killed(shared_ptr mob); protected: bool checkInTile(double x, double y, double z); @@ -346,9 +371,6 @@ public: virtual wstring getAName(); - // TU9 - bool skipAttackInteraction(shared_ptr source) {return false;} - // 4J - added to manage allocation of small ids private: // Things also added here to be able to manage the concept of a number of extra "wandering" entities - normally path finding entities aren't allowed to @@ -374,14 +396,28 @@ public: void considerForExtraWandering(bool enable); bool isExtraWanderingEnabled(); int getWanderingQuadrant(); - + virtual vector > *getSubEntities(); virtual bool is(shared_ptr other); virtual float getYHeadRot(); virtual void setYHeadRot(float yHeadRot); virtual bool isAttackable(); + virtual bool skipAttackInteraction(shared_ptr source); virtual bool isInvulnerable(); virtual void copyPosition(shared_ptr target); + virtual void restoreFrom(shared_ptr oldEntity, bool teleporting); + virtual void changeDimension(int i); + virtual float getTileExplosionResistance(Explosion *explosion, Level *level, int x, int y, int z, Tile *tile); + virtual bool shouldTileExplode(Explosion *explosion, Level *level, int x, int y, int z, int id, float power); + virtual int getMaxFallDistance(); + virtual int getPortalEntranceDir(); + virtual bool isIgnoringTileTriggers(); + virtual bool displayFireAnimation(); + virtual void setUUID(const wstring &UUID); + virtual wstring getUUID(); + virtual bool isPushedByWater(); + virtual wstring getDisplayName(); + virtual wstring getNetworkName(); // 4J: Added private: unsigned int m_uiAnimOverrideBitmask; -- cgit v1.2.3