the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.damagesource.h"
3#include "net.minecraft.world.entity.h"
4#include "BasicTypeContainers.h"
5#include "CombatEntry.h"
6
7CombatEntry::CombatEntry(DamageSource *source, int time, float health, float damage, CombatTracker::eLOCATION location, float fallDistance)
8{
9 this->source = NULL;
10 if(source != NULL)
11 {
12 // 4J: this might actually be a derived damage source so use copy func
13 this->source = source->copy();
14 }
15 this->time = time;
16 this->damage = damage;
17 this->health = health;
18 this->location = location;
19 this->fallDistance = fallDistance;
20}
21
22CombatEntry::~CombatEntry()
23{
24 delete source;
25}
26
27DamageSource *CombatEntry::getSource()
28{
29 return source;
30}
31
32int CombatEntry::getTime()
33{
34 return time;
35}
36
37float CombatEntry::getDamage()
38{
39 return damage;
40}
41
42float CombatEntry::getHealthBeforeDamage()
43{
44 return health;
45}
46
47float CombatEntry::getHealthAfterDamage()
48{
49 return health - damage;
50}
51
52bool CombatEntry::isCombatRelated()
53{
54 return source->getEntity() && source->getEntity()->instanceof(eTYPE_LIVINGENTITY);
55}
56
57CombatTracker::eLOCATION CombatEntry::getLocation()
58{
59 return location;
60}
61
62wstring CombatEntry::getAttackerName()
63{
64 return getSource()->getEntity() == NULL ? L"" : getSource()->getEntity()->getNetworkName();
65}
66
67float CombatEntry::getFallDistance()
68{
69 if (source == DamageSource::outOfWorld) return Float::MAX_VALUE;
70 return fallDistance;
71}