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.entity.player.h"
3#include "net.minecraft.world.entity.h"
4#include "net.minecraft.world.damagesource.h"
5#include "net.minecraft.network.packet.h"
6
7//IndirectEntityDamageSource::IndirectEntityDamageSource(const wstring &msgId, shared_ptr<Entity> entity, shared_ptr<Entity> owner) : EntityDamageSource(msgId, entity)
8IndirectEntityDamageSource::IndirectEntityDamageSource(ChatPacket::EChatPacketMessage msgId, ChatPacket::EChatPacketMessage msgWithItemId, shared_ptr<Entity> entity, shared_ptr<Entity> owner) : EntityDamageSource(msgId, msgWithItemId, entity)
9{
10 this->owner = owner;
11}
12
13// 4J Stu - Brought forward from 1.2.3 to fix #46422
14shared_ptr<Entity> IndirectEntityDamageSource::getDirectEntity()
15{
16 return entity;
17}
18
19shared_ptr<Entity> IndirectEntityDamageSource::getEntity()
20{
21 return owner;
22}
23
24//wstring IndirectEntityDamageSource::getLocalizedDeathMessage(shared_ptr<Player> player)
25//{
26// return L"death." + msgId + player->name + owner->getAName();
27// //return I18n.get("death." + msgId, player.name, owner.getAName());
28//}
29
30shared_ptr<ChatPacket> IndirectEntityDamageSource::getDeathMessagePacket(shared_ptr<LivingEntity> player)
31{
32 shared_ptr<ItemInstance> held = entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast<LivingEntity>(entity)->getCarriedItem() : nullptr;
33 wstring additional = L"";
34 int type;
35 if(owner != NULL)
36 {
37 type = owner->GetType();
38 if(type == eTYPE_SERVERPLAYER)
39 {
40 shared_ptr<Player> sourcePlayer = dynamic_pointer_cast<Player>(owner);
41 if(sourcePlayer != NULL) additional = sourcePlayer->name;
42 }
43 }
44 else
45 {
46 type = entity->GetType();
47 }
48 if(held != NULL && held->hasCustomHoverName() )
49 {
50 return shared_ptr<ChatPacket>( new ChatPacket(player->getNetworkName(), m_msgWithItemId, type, additional, held->getHoverName() ) );
51 }
52 else
53 {
54 return shared_ptr<ChatPacket>( new ChatPacket(player->getNetworkName(), m_msgId, type, additional ) );
55 }
56}
57
58// 4J: Copy function
59DamageSource *IndirectEntityDamageSource::copy()
60{
61 return new IndirectEntityDamageSource(*this);
62}