the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 2.0 kB view raw
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//EntityDamageSource::EntityDamageSource(const wstring &msgId, shared_ptr<Entity> entity) : DamageSource(msgId) 8EntityDamageSource::EntityDamageSource(ChatPacket::EChatPacketMessage msgId, ChatPacket::EChatPacketMessage msgWithItemId, shared_ptr<Entity> entity) : DamageSource(msgId, msgWithItemId) 9{ 10 this->entity = entity; 11} 12 13shared_ptr<Entity> EntityDamageSource::getEntity() 14{ 15 return entity; 16} 17 18//wstring EntityDamageSource::getLocalizedDeathMessage(shared_ptr<Player> player) 19//{ 20// return L"death." + msgId + player->name + entity->getAName(); 21// //return I18n.get("death." + msgId, player.name, entity.getAName()); 22//} 23 24shared_ptr<ChatPacket> EntityDamageSource::getDeathMessagePacket(shared_ptr<LivingEntity> player) 25{ 26 shared_ptr<ItemInstance> held = (entity != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast<LivingEntity>(entity)->getCarriedItem() : nullptr; 27 wstring additional = L""; 28 29 if (entity->instanceof(eTYPE_SERVERPLAYER)) 30 { 31 additional = dynamic_pointer_cast<Player>(entity)->name; 32 } 33 else if (entity->instanceof(eTYPE_MOB)) 34 { 35 shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(entity); 36 if (mob->hasCustomName()) 37 { 38 additional = mob->getCustomName(); 39 } 40 } 41 42 if ( (held != NULL) && held->hasCustomHoverName()) 43 { 44 return shared_ptr<ChatPacket>( new ChatPacket(player->getNetworkName(), m_msgWithItemId, entity->GetType(), additional, held->getHoverName() ) ); 45 } 46 else 47 { 48 return shared_ptr<ChatPacket>( new ChatPacket(player->getNetworkName(), m_msgId, entity->GetType(), additional ) ); 49 } 50} 51 52bool EntityDamageSource::scalesWithDifficulty() 53{ 54 return (entity != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) && !entity->instanceof(eTYPE_PLAYER); 55} 56 57// 4J: Copy function 58DamageSource *EntityDamageSource::copy() 59{ 60 return new EntityDamageSource(*this); 61}