2026-03-01 12:16:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Entity.h"
|
2026-03-03 03:04:10 +08:00
|
|
|
#include "Projectile.h"
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
class Mob;
|
|
|
|
|
class HitResult;
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
class Throwable : public Entity, public Projectile
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
int xTile;
|
|
|
|
|
int yTile;
|
|
|
|
|
int zTile;
|
|
|
|
|
int lastTile;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool inGround;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int shakeTime;
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
shared_ptr<LivingEntity> owner;
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
private:
|
2026-03-03 03:04:10 +08:00
|
|
|
wstring ownerName;
|
2026-03-01 12:16:08 +08:00
|
|
|
int life;
|
|
|
|
|
int flightTime;
|
|
|
|
|
|
|
|
|
|
void _throwableInit();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Throwable(Level *level);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void defineSynchedData();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual bool shouldRenderAtSqrDistance(double distance);
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
Throwable(Level *level, shared_ptr<LivingEntity> mob);
|
2026-03-01 12:16:08 +08:00
|
|
|
Throwable(Level *level, double x, double y, double z);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual float getThrowPower();
|
|
|
|
|
virtual float getThrowUpAngleOffset();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual void shoot(double xd, double yd, double zd, float pow, float uncertainty);
|
|
|
|
|
virtual void lerpMotion(double xd, double yd, double zd);
|
|
|
|
|
virtual void tick();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual float getGravity();
|
|
|
|
|
virtual void onHit(HitResult *res) = 0;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual void addAdditonalSaveData(CompoundTag *tag);
|
|
|
|
|
virtual void readAdditionalSaveData(CompoundTag *tag);
|
|
|
|
|
virtual float getShadowHeightOffs();
|
2026-03-03 03:04:10 +08:00
|
|
|
virtual shared_ptr<LivingEntity> getOwner();
|
2026-03-01 12:16:08 +08:00
|
|
|
};
|