summaryrefslogtreecommitdiffstats
path: root/src/Entity.hpp
blob: cc9f6fa845cd19b651d730147effc0f162cf2662 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#pragma once

#include "Utility.hpp"
#include "Vector.hpp"

enum class EntityType {
    Object,
    Mob,
};

enum class ObjectType{
    Boat=1,
    ItemStack,
    AreaEffectCloud,
    Minecart=10,
    ActivatedTNT=50,
    EnderCrystal,
    TippedArrow=60,
    Snowball,
    Egg,
    FireBall,
    FireCharge,
    ThrownEnderpearl,
    WitherSkull,
    ShulkerBullet,
    LlamaSpit,
    FallingObjects=70,
    Itemframes,
    EyeOfEnder,
    ThrownPotion,
    ThrownExpBottle=75,
    FireworkRocket,
    LeashKnot,
    ArmorStand,
    EvocationFangs,
    FishingHook=90,
    SpectralArrow,
    DragonFireball=93,
};

enum MobType {
    Item = 1,
    XPOrb,
    AreaEffectCloud,
    ElderGuardian,
    WitherSkeleton,
    Stray,
    ThrownEgg,
    LeashKnot,
    Painting,
    Arrow,
    Snowball,
    Fireball,
    SmallFireball,
    ThrownEnderpearl,
    EyeOfEnderSignal,
    ThrownPotion,
    ThrownExpBottle,
    ItemFrame,
    WitherSkull,
    PrimedTnt,
    FallingSand,
    FireworksRocketEntity,
    Husk,
    SpectralArrow,
    ShulkerBullet,
    DragonFireball,
    ZombieVillager,
    SkeletonHorse,
    ZombieHorse,
    ArmorStand,
    Donkey,
    Mule,
    EvocationFangs,
    EvocationIllager,
    Vex,
    VindicationIllager,
    IllusionIllager,
    MinecartCommandBlock=40,
    Boat,
    MinecartRideable,
    MinecartChest,
    MinecartFurnace,
    MinecartTNT,
    MinecartHopper,
    MinecartSpawner,
    Creeper=50,
    Skeleton,
    Spider,
    Giant,
    Zombie,
    Slime,
    Ghast,
    PigZombie,
    Enderman,
    CaveSpider,
    Silverfish,
    Blaze,
    LavaSlime,
    EnderDragon,
    WitherBoss,
    Bat,
    Witch,
    Endermite,
    Guardian,
    Shulker,
    Pig=90,
    Sheep,
    Cow,
    Chicken,
    Squid,
    Wolf,
    MushroomCow,
    SnowMan,
    Ozelot,
    VillagerGolem,
    Horse,
    Rabbit,
    PolarBear,
    Llama,
    LlamaSpit,
    Parrot,
    Villager=120,
    EnderCrystal=200,
};

struct Entity {
    Uuid uuid;
    VectorF pos = 0;
    VectorF vel = 0;
    unsigned int entityId = 0;
    double yaw = 0;
    double pitch = 0;
    double width = 1.0;
    double height = 1.0;
    glm::vec3 renderColor;
    int entityType=0;
    EntityType type;
    bool isSolid = true;
    double gravity = 32.0; // in m/s^2
    double drag = 0.4;
    double terminalVelocity = 78.4;
    bool onGround = true;
    VectorF EyeOffset = VectorF(0,1.62,0);

    static VectorF DecodeVelocity(short x, short y, short z);
    static VectorF DecodeDeltaPos(short deltaX, short deltaY, short deltaZ);
    static double DecodeYaw(double yaw);
    static double DecodePitch(double pitch);
    static double EncodeYaw(double yaw);
    static double EncodePitch(double pitch);
};

Entity CreateObject(ObjectType type);

Entity CreateMob(MobType type);