refactor: replace shared_ptr(new T) with make_shared<T>

This commit is contained in:
MatthewBeshay 2026-03-31 20:34:51 +11:00
parent 8b836cf604
commit a18cb3d484
246 changed files with 706 additions and 720 deletions

View file

@ -3807,7 +3807,6 @@ int CMinecraftApp::UnlockFullInviteReturned(void* pParam, int iPad,
if (ProfileManager.IsSignedInLive(iPad)) { if (ProfileManager.IsSignedInLive(iPad)) {
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0); false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }
} }
@ -3825,7 +3824,6 @@ int CMinecraftApp::UnlockFullSaveReturned(void* pParam, int iPad,
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, pMinecraft->player->GetXboxPad(), false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0); /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }
@ -3844,7 +3842,6 @@ int CMinecraftApp::UnlockFullExitReturned(void* pParam, int iPad,
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, pMinecraft->player->GetXboxPad(), false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0); /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }
@ -3867,7 +3864,6 @@ int CMinecraftApp::TrialOverReturned(void* pParam, int iPad,
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, pMinecraft->player->GetXboxPad(), false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0); /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }
@ -4128,12 +4124,6 @@ void CMinecraftApp::NotificationsCallback(void* pParam,
pClass->m_vNotifications.push_back(pNotification); pClass->m_vNotifications.push_back(pNotification);
} }
void CMinecraftApp::UpsellReturnedCallback(void* pParam, EUpsellType type,
EUpsellResponse result,
int iUserData) {
// 4jcraft: nuked
}
#if defined(_DEBUG_MENUS_ENABLED) #if defined(_DEBUG_MENUS_ENABLED)
bool CMinecraftApp::DebugArtToolsOn() { bool CMinecraftApp::DebugArtToolsOn() {
return DebugSettingsOn() && return DebugSettingsOn() &&

View file

@ -487,7 +487,6 @@ public:
bool m_bChangingSessionType; bool m_bChangingSessionType;
bool m_bReallyChangingSessionType; bool m_bReallyChangingSessionType;
bool m_bDisplayFullVersionPurchase; // for after signing in during the
// trial, and trying to unlock full // trial, and trying to unlock full
// version on an upsell // version on an upsell

View file

@ -45,7 +45,6 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat,
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0); false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }
} }

View file

@ -460,7 +460,6 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) { if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
// 4J-PB - need to check this user can access the store // 4J-PB - need to check this user can access the store
{ {
ProfileManager.DisplayFullVersionPurchase(
false, pMinecraft->player->GetXboxPad(), false, pMinecraft->player->GetXboxPad(),
/*eSen_UpsellID_Full_Version_Of_Game*/ 0); /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
} }

View file

@ -495,7 +495,6 @@ void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID,
int iVal) {} int iVal) {}
void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence,
bool bSetOthersToIdle) {} bool bSetOthersToIdle) {}
void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant,
int iUpsellParam) {} int iUpsellParam) {}
void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam, void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam,
EUpsellType type, EUpsellType type,

View file

@ -3337,7 +3337,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
// std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( // std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance(
// level )); // level ));
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>( std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(
std::shared_ptr<Spider>(new Spider(level))); std::make_shared<Spider>(level));
mob->moveTo(player->x + 1, player->y, player->z + 1, mob->moveTo(player->x + 1, player->y, player->z + 1,
level->random->nextFloat() * 360, 0); level->random->nextFloat() * 360, 0);
level->addEntity(mob); level->addEntity(mob);

View file

@ -171,9 +171,9 @@ void MerchantScreen::tick() {
DataOutputStream output(&rawOutput); DataOutputStream output(&rawOutput);
output.writeInt(currentRecipeIndex); output.writeInt(currentRecipeIndex);
minecraft->player->connection->send( minecraft->player->connection->send(
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket( std::make_shared<CustomPayloadPacket>(
CustomPayloadPacket::TRADER_SELECTION_PACKET, CustomPayloadPacket::TRADER_SELECTION_PACKET,
rawOutput.toByteArray()))); rawOutput.toByteArray()));
} }
} else { } else {
nextRecipeButton->active = false; nextRecipeButton->active = false;
@ -200,8 +200,8 @@ void MerchantScreen::buttonClicked(Button* button) {
DataOutputStream output(&rawOutput); DataOutputStream output(&rawOutput);
output.writeInt(currentRecipeIndex); output.writeInt(currentRecipeIndex);
minecraft->player->connection->send( minecraft->player->connection->send(
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket( std::make_shared<CustomPayloadPacket>(
CustomPayloadPacket::TRADER_SELECTION_PACKET, CustomPayloadPacket::TRADER_SELECTION_PACKET,
rawOutput.toByteArray()))); rawOutput.toByteArray()));
} }
} }

View file

@ -160,8 +160,8 @@ void RepairScreen::updateItemName() {
DataOutputStream dos(&baos); DataOutputStream dos(&baos);
dos.writeUTF(itemName); dos.writeUTF(itemName);
Minecraft::GetInstance()->player->connection->send( Minecraft::GetInstance()->player->connection->send(
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket( std::make_shared<CustomPayloadPacket>(
CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()));
} }
// 4jcraft: these 3 are to implement Containerlistener (see IUIScene_AnvilMenu // 4jcraft: these 3 are to implement Containerlistener (see IUIScene_AnvilMenu

View file

@ -162,11 +162,11 @@ void BeaconScreen::renderBg(float a) {
// Render payment item icons // Render payment item icons
itemRenderer->renderGuiItem( itemRenderer->renderGuiItem(
font, minecraft->textures, font, minecraft->textures,
std::shared_ptr<ItemInstance>(new ItemInstance(Item::emerald_Id, 1, 0)), std::make_shared<ItemInstance>(Item::emerald_Id, 1, 0),
xo + 42, yo + 109); xo + 42, yo + 109);
itemRenderer->renderGuiItem( itemRenderer->renderGuiItem(
font, minecraft->textures, font, minecraft->textures,
std::shared_ptr<ItemInstance>(new ItemInstance(Item::diamond_Id, 1, 0)), std::make_shared<ItemInstance>(Item::diamond_Id, 1, 0),
xo + 42 + 22, yo + 109); xo + 42 + 22, yo + 109);
itemRenderer->renderGuiItem(font, minecraft->textures, itemRenderer->renderGuiItem(font, minecraft->textures,
std::shared_ptr<ItemInstance>( std::shared_ptr<ItemInstance>(
@ -206,8 +206,8 @@ void BeaconScreen::buttonClicked(Button* button) {
dos.writeInt(beacon->getSecondaryPower()); dos.writeInt(beacon->getSecondaryPower());
minecraft->player->connection->send( minecraft->player->connection->send(
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket( std::make_shared<CustomPayloadPacket>(
CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray()))); CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray()));
minecraft->player->closeContainer(); minecraft->player->closeContainer();
} else if (dynamic_cast<BeaconPowerButton*>(button)) { } else if (dynamic_cast<BeaconPowerButton*>(button)) {
int effectId = button->id & 255; int effectId = button->id & 255;

View file

@ -390,10 +390,10 @@ void ClientConnection::handleAddEntity(
packet->data = 0; packet->data = 0;
} break; } break;
case AddEntityPacket::ARROW: case AddEntityPacket::ARROW:
e = std::shared_ptr<Entity>(new Arrow(level, x, y, z)); e = std::make_shared<Arrow>(level, x, y, z);
break; break;
case AddEntityPacket::SNOWBALL: case AddEntityPacket::SNOWBALL:
e = std::shared_ptr<Entity>(new Snowball(level, x, y, z)); e = std::make_shared<Snowball>(level, x, y, z);
break; break;
case AddEntityPacket::ITEM_FRAME: { case AddEntityPacket::ITEM_FRAME: {
int ix = (int)x; int ix = (int)x;
@ -408,10 +408,10 @@ void ClientConnection::handleAddEntity(
setRot = false; setRot = false;
break; break;
case AddEntityPacket::THROWN_ENDERPEARL: case AddEntityPacket::THROWN_ENDERPEARL:
e = std::shared_ptr<Entity>(new ThrownEnderpearl(level, x, y, z)); e = std::make_shared<ThrownEnderpearl>(level, x, y, z);
break; break;
case AddEntityPacket::EYEOFENDERSIGNAL: case AddEntityPacket::EYEOFENDERSIGNAL:
e = std::shared_ptr<Entity>(new EyeOfEnderSignal(level, x, y, z)); e = std::make_shared<EyeOfEnderSignal>(level, x, y, z);
break; break;
case AddEntityPacket::FIREBALL: case AddEntityPacket::FIREBALL:
e = std::shared_ptr<Entity>( e = std::shared_ptr<Entity>(
@ -432,7 +432,7 @@ void ClientConnection::handleAddEntity(
packet->data = 0; packet->data = 0;
break; break;
case AddEntityPacket::EGG: case AddEntityPacket::EGG:
e = std::shared_ptr<Entity>(new ThrownEgg(level, x, y, z)); e = std::make_shared<ThrownEgg>(level, x, y, z);
break; break;
case AddEntityPacket::THROWN_POTION: case AddEntityPacket::THROWN_POTION:
e = std::shared_ptr<Entity>( e = std::shared_ptr<Entity>(
@ -440,24 +440,24 @@ void ClientConnection::handleAddEntity(
packet->data = 0; packet->data = 0;
break; break;
case AddEntityPacket::THROWN_EXPBOTTLE: case AddEntityPacket::THROWN_EXPBOTTLE:
e = std::shared_ptr<Entity>(new ThrownExpBottle(level, x, y, z)); e = std::make_shared<ThrownExpBottle>(level, x, y, z);
packet->data = 0; packet->data = 0;
break; break;
case AddEntityPacket::BOAT: case AddEntityPacket::BOAT:
e = std::shared_ptr<Entity>(new Boat(level, x, y, z)); e = std::make_shared<Boat>(level, x, y, z);
break; break;
case AddEntityPacket::PRIMED_TNT: case AddEntityPacket::PRIMED_TNT:
e = std::shared_ptr<Entity>(new PrimedTnt(level, x, y, z, nullptr)); e = std::make_shared<PrimedTnt>(level, x, y, z, nullptr);
break; break;
case AddEntityPacket::ENDER_CRYSTAL: case AddEntityPacket::ENDER_CRYSTAL:
e = std::shared_ptr<Entity>(new EnderCrystal(level, x, y, z)); e = std::make_shared<EnderCrystal>(level, x, y, z);
break; break;
case AddEntityPacket::ITEM: case AddEntityPacket::ITEM:
e = std::shared_ptr<Entity>(new ItemEntity(level, x, y, z)); e = std::make_shared<ItemEntity>(level, x, y, z);
break; break;
case AddEntityPacket::FALLING: case AddEntityPacket::FALLING:
e = std::shared_ptr<Entity>(new FallingTile( e = std::make_shared<FallingTile>(
level, x, y, z, packet->data & 0xFFFF, packet->data >> 16)); level, x, y, z, packet->data & 0xFFFF, packet->data >> 16);
packet->data = 0; packet->data = 0;
break; break;
case AddEntityPacket::WITHER_SKULL: case AddEntityPacket::WITHER_SKULL:
@ -667,7 +667,7 @@ void ClientConnection::handleAddGlobalEntity(
double z = packet->z / 32.0; double z = packet->z / 32.0;
std::shared_ptr<Entity> e; // = nullptr; std::shared_ptr<Entity> e; // = nullptr;
if (packet->type == AddGlobalEntityPacket::LIGHTNING) if (packet->type == AddGlobalEntityPacket::LIGHTNING)
e = std::shared_ptr<LightningBolt>(new LightningBolt(level, x, y, z)); e = std::make_shared<LightningBolt>(level, x, y, z);
if (e != nullptr) { if (e != nullptr) {
e->xp = packet->x; e->xp = packet->x;
e->yp = packet->y; e->yp = packet->y;
@ -681,8 +681,8 @@ void ClientConnection::handleAddGlobalEntity(
void ClientConnection::handleAddPainting( void ClientConnection::handleAddPainting(
std::shared_ptr<AddPaintingPacket> packet) { std::shared_ptr<AddPaintingPacket> packet) {
std::shared_ptr<Painting> painting = std::shared_ptr<Painting>(new Painting( std::shared_ptr<Painting> painting = std::make_shared<Painting>(
level, packet->x, packet->y, packet->z, packet->dir, packet->motive)); level, packet->x, packet->y, packet->z, packet->dir, packet->motive);
level->putEntity(packet->id, painting); level->putEntity(packet->id, painting);
} }
@ -749,7 +749,7 @@ void ClientConnection::handleAddPlayer(
std::shared_ptr<ItemInstance>(); // nullptr; std::shared_ptr<ItemInstance>(); // nullptr;
} else { } else {
player->inventory->items[player->inventory->selected] = player->inventory->items[player->inventory->selected] =
std::shared_ptr<ItemInstance>(new ItemInstance(item, 1, 0)); std::make_shared<ItemInstance>(item, 1, 0);
} }
player->absMoveTo(x, y, z, yRot, xRot); player->absMoveTo(x, y, z, yRot, xRot);
@ -1934,12 +1934,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
minecraft->user->name.c_str(), minecraft->user->name.c_str(),
SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex,
(int)g_NetworkManager.IsHost()); (int)g_NetworkManager.IsHost());
send(std::shared_ptr<LoginPacket>(new LoginPacket( send(std::make_shared<LoginPacket>(
minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION,
offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), offlineXUID, onlineXUID, (!allAllowed && friendsAllowed),
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex),
app.GetPlayerCapeId(m_userIndex), app.GetPlayerCapeId(m_userIndex),
ProfileManager.IsGuest(m_userIndex)))); ProfileManager.IsGuest(m_userIndex)));
fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n");
if (!g_NetworkManager.IsHost()) { if (!g_NetworkManager.IsHost()) {
@ -2519,7 +2519,7 @@ void ClientConnection::handleContainerOpen(
} break; } break;
case ContainerOpenPacket::HOPPER: { case ContainerOpenPacket::HOPPER: {
std::shared_ptr<HopperTileEntity> hopper = std::shared_ptr<HopperTileEntity> hopper =
std::shared_ptr<HopperTileEntity>(new HopperTileEntity()); std::make_shared<HopperTileEntity>();
if (packet->customName) hopper->setCustomName(packet->title); if (packet->customName) hopper->setCustomName(packet->title);
if (player->openHopper(hopper)) { if (player->openHopper(hopper)) {
player->containerMenu->containerId = packet->containerId; player->containerMenu->containerId = packet->containerId;
@ -2529,7 +2529,7 @@ void ClientConnection::handleContainerOpen(
} break; } break;
case ContainerOpenPacket::FURNACE: { case ContainerOpenPacket::FURNACE: {
std::shared_ptr<FurnaceTileEntity> furnace = std::shared_ptr<FurnaceTileEntity> furnace =
std::shared_ptr<FurnaceTileEntity>(new FurnaceTileEntity()); std::make_shared<FurnaceTileEntity>();
if (packet->customName) furnace->setCustomName(packet->title); if (packet->customName) furnace->setCustomName(packet->title);
if (player->openFurnace(furnace)) { if (player->openFurnace(furnace)) {
player->containerMenu->containerId = packet->containerId; player->containerMenu->containerId = packet->containerId;
@ -2551,7 +2551,7 @@ void ClientConnection::handleContainerOpen(
} break; } break;
case ContainerOpenPacket::DROPPER: { case ContainerOpenPacket::DROPPER: {
std::shared_ptr<DropperTileEntity> dropper = std::shared_ptr<DropperTileEntity> dropper =
std::shared_ptr<DropperTileEntity>(new DropperTileEntity()); std::make_shared<DropperTileEntity>();
if (packet->customName) dropper->setCustomName(packet->title); if (packet->customName) dropper->setCustomName(packet->title);
if (player->openTrap(dropper)) { if (player->openTrap(dropper)) {
@ -2562,7 +2562,7 @@ void ClientConnection::handleContainerOpen(
} break; } break;
case ContainerOpenPacket::TRAP: { case ContainerOpenPacket::TRAP: {
std::shared_ptr<DispenserTileEntity> dispenser = std::shared_ptr<DispenserTileEntity> dispenser =
std::shared_ptr<DispenserTileEntity>(new DispenserTileEntity()); std::make_shared<DispenserTileEntity>();
if (packet->customName) dispenser->setCustomName(packet->title); if (packet->customName) dispenser->setCustomName(packet->title);
if (player->openTrap(dispenser)) { if (player->openTrap(dispenser)) {
@ -2604,7 +2604,7 @@ void ClientConnection::handleContainerOpen(
} break; } break;
case ContainerOpenPacket::BEACON: { case ContainerOpenPacket::BEACON: {
std::shared_ptr<BeaconTileEntity> beacon = std::shared_ptr<BeaconTileEntity> beacon =
std::shared_ptr<BeaconTileEntity>(new BeaconTileEntity()); std::make_shared<BeaconTileEntity>();
if (packet->customName) beacon->setCustomName(packet->title); if (packet->customName) beacon->setCustomName(packet->title);
if (player->openBeacon(beacon)) { if (player->openBeacon(beacon)) {
@ -2715,8 +2715,8 @@ void ClientConnection::handleContainerAck(
} }
if (menu != nullptr) { if (menu != nullptr) {
if (!packet->accepted) { if (!packet->accepted) {
send(std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket( send(std::make_shared<ContainerAckPacket>(
packet->containerId, packet->uid, true))); packet->containerId, packet->uid, true));
} }
} }
} }
@ -2740,7 +2740,7 @@ void ClientConnection::handleTileEditorOpen(
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity); minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
} else if (packet->editorType == TileEditorOpenPacket::SIGN) { } else if (packet->editorType == TileEditorOpenPacket::SIGN) {
std::shared_ptr<SignTileEntity> localSignDummy = std::shared_ptr<SignTileEntity> localSignDummy =
std::shared_ptr<SignTileEntity>(new SignTileEntity()); std::make_shared<SignTileEntity>();
localSignDummy->setLevel(level); localSignDummy->setLevel(level);
localSignDummy->x = packet->x; localSignDummy->x = packet->x;
localSignDummy->y = packet->y; localSignDummy->y = packet->y;
@ -3183,7 +3183,7 @@ void ClientConnection::displayPrivilegeChanges(
void ClientConnection::handleKeepAlive( void ClientConnection::handleKeepAlive(
std::shared_ptr<KeepAlivePacket> packet) { std::shared_ptr<KeepAlivePacket> packet) {
send(std::shared_ptr<KeepAlivePacket>(new KeepAlivePacket(packet->id))); send(std::make_shared<KeepAlivePacket>(packet->id));
} }
void ClientConnection::handlePlayerAbilities( void ClientConnection::handlePlayerAbilities(

View file

@ -113,20 +113,20 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
if (localPlayerMode->isCreative()) { if (localPlayerMode->isCreative()) {
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face))); PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
creativeDestroyBlock(minecraft, this, x, y, z, face); creativeDestroyBlock(minecraft, this, x, y, z, face);
destroyDelay = 5; destroyDelay = 5;
} else if (!isDestroying || !sameDestroyTarget(x, y, z)) { } else if (!isDestroying || !sameDestroyTarget(x, y, z)) {
if (isDestroying) { if (isDestroying) {
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock,
yDestroyBlock, zDestroyBlock, face))); yDestroyBlock, zDestroyBlock, face));
} }
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face))); PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
int t = minecraft->level->getTile(x, y, z); int t = minecraft->level->getTile(x, y, z);
if (t > 0 && destroyProgress == 0) if (t > 0 && destroyProgress == 0)
Tile::tiles[t]->attack(minecraft->level, x, y, z, Tile::tiles[t]->attack(minecraft->level, x, y, z,
@ -156,9 +156,9 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
void MultiPlayerGameMode::stopDestroyBlock() { void MultiPlayerGameMode::stopDestroyBlock() {
if (isDestroying) { if (isDestroying) {
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock,
yDestroyBlock, zDestroyBlock, -1))); yDestroyBlock, zDestroyBlock, -1));
} }
isDestroying = false; isDestroying = false;
@ -183,8 +183,8 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) {
if (localPlayerMode->isCreative()) { if (localPlayerMode->isCreative()) {
destroyDelay = 5; destroyDelay = 5;
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face))); PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
creativeDestroyBlock(minecraft, this, x, y, z, face); creativeDestroyBlock(minecraft, this, x, y, z, face);
return; return;
} }
@ -216,8 +216,8 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) {
if (destroyProgress >= 1) { if (destroyProgress >= 1) {
isDestroying = false; isDestroying = false;
connection->send( connection->send(
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( std::make_shared<PlayerActionPacket>(
PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face))); PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face));
destroyBlock(x, y, z, face); destroyBlock(x, y, z, face);
destroyProgress = 0; destroyProgress = 0;
destroyTicks = 0; destroyTicks = 0;
@ -406,31 +406,31 @@ bool MultiPlayerGameMode::useItem(std::shared_ptr<Player> player, Level* level,
} }
if (!bTestUseOnly) { if (!bTestUseOnly) {
connection->send(std::shared_ptr<UseItemPacket>(new UseItemPacket( connection->send(std::make_shared<UseItemPacket>(
-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0))); -1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0));
} }
return result; return result;
} }
std::shared_ptr<MultiplayerLocalPlayer> MultiPlayerGameMode::createPlayer( std::shared_ptr<MultiplayerLocalPlayer> MultiPlayerGameMode::createPlayer(
Level* level) { Level* level) {
return std::shared_ptr<MultiplayerLocalPlayer>(new MultiplayerLocalPlayer( return std::make_shared<MultiplayerLocalPlayer>(
minecraft, level, minecraft->user, connection)); minecraft, level, minecraft->user, connection);
} }
void MultiPlayerGameMode::attack(std::shared_ptr<Player> player, void MultiPlayerGameMode::attack(std::shared_ptr<Player> player,
std::shared_ptr<Entity> entity) { std::shared_ptr<Entity> entity) {
ensureHasSentCarriedItem(); ensureHasSentCarriedItem();
connection->send(std::shared_ptr<InteractPacket>(new InteractPacket( connection->send(std::make_shared<InteractPacket>(
player->entityId, entity->entityId, InteractPacket::ATTACK))); player->entityId, entity->entityId, InteractPacket::ATTACK));
player->attack(entity); player->attack(entity);
} }
bool MultiPlayerGameMode::interact(std::shared_ptr<Player> player, bool MultiPlayerGameMode::interact(std::shared_ptr<Player> player,
std::shared_ptr<Entity> entity) { std::shared_ptr<Entity> entity) {
ensureHasSentCarriedItem(); ensureHasSentCarriedItem();
connection->send(std::shared_ptr<InteractPacket>(new InteractPacket( connection->send(std::make_shared<InteractPacket>(
player->entityId, entity->entityId, InteractPacket::INTERACT))); player->entityId, entity->entityId, InteractPacket::INTERACT));
return player->interact(entity); return player->interact(entity);
} }
@ -475,8 +475,8 @@ void MultiPlayerGameMode::handleCreativeModeItemDrop(
void MultiPlayerGameMode::releaseUsingItem(std::shared_ptr<Player> player) { void MultiPlayerGameMode::releaseUsingItem(std::shared_ptr<Player> player) {
ensureHasSentCarriedItem(); ensureHasSentCarriedItem();
connection->send(std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket( connection->send(std::make_shared<PlayerActionPacket>(
PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255))); PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255));
player->releaseUsingItem(); player->releaseUsingItem();
} }
@ -517,5 +517,5 @@ void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal,
std::shared_ptr<Player> player) { std::shared_ptr<Player> player) {
player->SetDebugOptions(uiVal); player->SetDebugOptions(uiVal);
connection->send( connection->send(
std::shared_ptr<DebugOptionsPacket>(new DebugOptionsPacket(uiVal))); std::make_shared<DebugOptionsPacket>(uiVal));
} }

View file

@ -29,7 +29,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile,
MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection, MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
LevelSettings* levelSettings, int dimension, LevelSettings* levelSettings, int dimension,
int difficulty) int difficulty)
: Level(std::shared_ptr<MockedLevelStorage>(new MockedLevelStorage()), : Level(std::make_shared<MockedLevelStorage>(),
L"MpServer", Dimension::getNew(dimension), levelSettings, false) { L"MpServer", Dimension::getNew(dimension), levelSettings, false) {
minecraft = Minecraft::GetInstance(); minecraft = Minecraft::GetInstance();

View file

@ -81,11 +81,11 @@ void MultiplayerLocalPlayer::tick() {
tempX, tempY, tempZ, x, y, z)) { tempX, tempY, tempZ, x, y, z)) {
if (isRiding()) { if (isRiding()) {
connection->send( connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot( std::make_shared<MovePlayerPacket::Rot>(
yRot, xRot, onGround, abilities.flying))); yRot, xRot, onGround, abilities.flying));
connection->send( connection->send(
std::shared_ptr<PlayerInputPacket>(new PlayerInputPacket( std::make_shared<PlayerInputPacket>(
xxa, yya, input->jumping, input->sneaking))); xxa, yya, input->jumping, input->sneaking));
} else { } else {
sendPosition(); sendPosition();
} }
@ -101,12 +101,12 @@ void MultiplayerLocalPlayer::sendPosition() {
if (sprinting != lastSprinting) { if (sprinting != lastSprinting) {
if (sprinting) if (sprinting)
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::START_SPRINTING))); shared_from_this(), PlayerCommandPacket::START_SPRINTING));
else else
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); shared_from_this(), PlayerCommandPacket::STOP_SPRINTING));
lastSprinting = sprinting; lastSprinting = sprinting;
} }
@ -115,12 +115,12 @@ void MultiplayerLocalPlayer::sendPosition() {
if (sneaking != lastSneaked) { if (sneaking != lastSneaked) {
if (sneaking) if (sneaking)
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::START_SNEAKING))); shared_from_this(), PlayerCommandPacket::START_SNEAKING));
else else
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::STOP_SNEAKING))); shared_from_this(), PlayerCommandPacket::STOP_SNEAKING));
lastSneaked = sneaking; lastSneaked = sneaking;
} }
@ -129,12 +129,12 @@ void MultiplayerLocalPlayer::sendPosition() {
if (idle != lastIdle) { if (idle != lastIdle) {
if (idle) if (idle)
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::START_IDLEANIM))); shared_from_this(), PlayerCommandPacket::START_IDLEANIM));
else else
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM))); shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM));
lastIdle = idle; lastIdle = idle;
} }
@ -151,22 +151,22 @@ void MultiplayerLocalPlayer::sendPosition() {
bool rot = rydd != 0 || rxdd != 0; bool rot = rydd != 0 || rxdd != 0;
if (riding != nullptr) { if (riding != nullptr) {
connection->send( connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot( std::make_shared<MovePlayerPacket::PosRot>(
xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying))); xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying));
move = false; move = false;
} else { } else {
if (move && rot) { if (move && rot) {
connection->send( connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot( std::make_shared<MovePlayerPacket::PosRot>(
x, bb.y0, y, z, yRot, xRot, onGround, abilities.flying))); x, bb.y0, y, z, yRot, xRot, onGround, abilities.flying));
} else if (move) { } else if (move) {
connection->send( connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Pos( std::make_shared<MovePlayerPacket::Pos>(
x, bb.y0, y, z, onGround, abilities.flying))); x, bb.y0, y, z, onGround, abilities.flying));
} else if (rot) { } else if (rot) {
connection->send( connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot( std::make_shared<MovePlayerPacket::Rot>(
yRot, xRot, onGround, abilities.flying))); yRot, xRot, onGround, abilities.flying));
} else { } else {
connection->send(std::shared_ptr<MovePlayerPacket>( connection->send(std::shared_ptr<MovePlayerPacket>(
new MovePlayerPacket(onGround, abilities.flying))); new MovePlayerPacket(onGround, abilities.flying)));
@ -199,7 +199,7 @@ void MultiplayerLocalPlayer::reallyDrop(
std::shared_ptr<ItemEntity> itemEntity) {} std::shared_ptr<ItemEntity> itemEntity) {}
void MultiplayerLocalPlayer::chat(const std::wstring& message) { void MultiplayerLocalPlayer::chat(const std::wstring& message) {
connection->send(std::shared_ptr<ChatPacket>(new ChatPacket(message))); connection->send(std::make_shared<ChatPacket>(message));
} }
void MultiplayerLocalPlayer::swing() { void MultiplayerLocalPlayer::swing() {
@ -313,15 +313,15 @@ bool MultiplayerLocalPlayer::isLocalPlayer() { return true; }
void MultiplayerLocalPlayer::sendRidingJump() { void MultiplayerLocalPlayer::sendRidingJump() {
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::RIDING_JUMP, shared_from_this(), PlayerCommandPacket::RIDING_JUMP,
(int)(getJumpRidingScale() * 100.0f)))); (int)(getJumpRidingScale() * 100.0f)));
} }
void MultiplayerLocalPlayer::sendOpenInventory() { void MultiplayerLocalPlayer::sendOpenInventory() {
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY))); shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY));
} }
void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) { void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) {
@ -353,8 +353,8 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) {
void MultiplayerLocalPlayer::StopSleeping() { void MultiplayerLocalPlayer::StopSleeping() {
connection->send( connection->send(
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket( std::make_shared<PlayerCommandPacket>(
shared_from_this(), PlayerCommandPacket::STOP_SLEEPING))); shared_from_this(), PlayerCommandPacket::STOP_SLEEPING));
} }
// 4J Added // 4J Added
@ -380,9 +380,9 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
#endif #endif
if (getCustomCape() != oldCapeIndex) if (getCustomCape() != oldCapeIndex)
connection->send( connection->send(
std::shared_ptr<TextureChangePacket>(new TextureChangePacket( std::make_shared<TextureChangePacket>(
shared_from_this(), TextureChangePacket::e_TextureChange_Cape, shared_from_this(), TextureChangePacket::e_TextureChange_Cape,
app.GetPlayerCapeName(GetXboxPad())))); app.GetPlayerCapeName(GetXboxPad())));
} }
// 4J added for testing. This moves the player in a repeated sequence of 2 // 4J added for testing. This moves the player in a repeated sequence of 2

View file

@ -16,7 +16,7 @@ void ReceivingLevelScreen::tick() {
tickCount++; tickCount++;
if (tickCount % 20 == 0) { if (tickCount % 20 == 0) {
connection->send( connection->send(
std::shared_ptr<KeepAlivePacket>(new KeepAlivePacket())); std::make_shared<KeepAlivePacket>());
} }
if (connection != nullptr) { if (connection != nullptr) {
connection->tick(); connection->tick();

View file

@ -207,9 +207,9 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data) {
double yp = y + (yy + 0.5) / SD; double yp = y + (yy + 0.5) / SD;
double zp = z + (zz + 0.5) / SD; double zp = z + (zz + 0.5) / SD;
int face = random->nextInt(6); int face = random->nextInt(6);
add((std::shared_ptr<TerrainParticle>(new TerrainParticle( add((std::make_shared<TerrainParticle>(
level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f,
zp - z - 0.5f, tile, face, data, textures))) zp - z - 0.5f, tile, face, data, textures))
->init(x, y, z, data)); ->init(x, y, z, data));
} }
} }

View file

@ -745,8 +745,8 @@ void LocalPlayer::magicCrit(std::shared_ptr<Entity> e) {
void LocalPlayer::take(std::shared_ptr<Entity> e, int orgCount) { void LocalPlayer::take(std::shared_ptr<Entity> e, int orgCount) {
minecraft->particleEngine->add( minecraft->particleEngine->add(
std::shared_ptr<TakeAnimationParticle>(new TakeAnimationParticle( std::make_shared<TakeAnimationParticle>(
(Level*)minecraft->level, e, shared_from_this(), -0.5f))); (Level*)minecraft->level, e, shared_from_this(), -0.5f));
} }
void LocalPlayer::chat(const std::wstring& message) {} void LocalPlayer::chat(const std::wstring& message) {}

View file

@ -7,11 +7,11 @@
EntityTileRenderer* EntityTileRenderer::instance = new EntityTileRenderer; EntityTileRenderer* EntityTileRenderer::instance = new EntityTileRenderer;
EntityTileRenderer::EntityTileRenderer() { EntityTileRenderer::EntityTileRenderer() {
chest = std::shared_ptr<ChestTileEntity>(new ChestTileEntity()); chest = std::make_shared<ChestTileEntity>();
trappedChest = std::shared_ptr<ChestTileEntity>( trappedChest = std::shared_ptr<ChestTileEntity>(
new ChestTileEntity(ChestTile::TYPE_TRAP)); new ChestTileEntity(ChestTile::TYPE_TRAP));
enderChest = enderChest =
std::shared_ptr<EnderChestTileEntity>(new EnderChestTileEntity()); std::make_shared<EnderChestTileEntity>();
} }
void EntityTileRenderer::render(Tile* tile, int data, float brightness, void EntityTileRenderer::render(Tile* tile, int data, float brightness,

View file

@ -1544,10 +1544,10 @@ void GameRenderer::tickRain() {
if (t > 0) { if (t > 0) {
if (Tile::tiles[t]->material == Material::lava) { if (Tile::tiles[t]->material == Material::lava) {
mc->particleEngine->add( mc->particleEngine->add(
std::shared_ptr<SmokeParticle>(new SmokeParticle( std::make_shared<SmokeParticle>(
level, x + xa, level, x + xa,
y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0,
0, 0))); 0, 0));
} else { } else {
if (random->nextInt(++rainPosSamples) == 0) { if (random->nextInt(++rainPosSamples) == 0) {
rainPosX = x + xa; rainPosX = x + xa;

View file

@ -3079,7 +3079,7 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
break; break;
case eParticleType_lava: case eParticleType_lava:
particle = particle =
std::shared_ptr<Particle>(new LavaParticle(lev, x, y, z)); std::make_shared<LavaParticle>(lev, x, y, z);
break; break;
case eParticleType_footstep: case eParticleType_footstep:
particle = std::shared_ptr<Particle>( particle = std::shared_ptr<Particle>(
@ -3094,12 +3094,12 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f)); new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f));
break; break;
case eParticleType_reddust: case eParticleType_reddust:
particle = std::shared_ptr<Particle>(new RedDustParticle( particle = std::make_shared<RedDustParticle>(
lev, x, y, z, (float)xa, (float)ya, (float)za)); lev, x, y, z, (float)xa, (float)ya, (float)za);
break; break;
case eParticleType_snowballpoof: case eParticleType_snowballpoof:
particle = std::shared_ptr<Particle>(new BreakingItemParticle( particle = std::make_shared<BreakingItemParticle>(
lev, x, y, z, Item::snowBall, textures)); lev, x, y, z, Item::snowBall, textures);
break; break;
case eParticleType_dripWater: case eParticleType_dripWater:
particle = std::shared_ptr<Particle>( particle = std::shared_ptr<Particle>(
@ -3114,8 +3114,8 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
new SnowShovelParticle(lev, x, y, z, xa, ya, za)); new SnowShovelParticle(lev, x, y, z, xa, ya, za));
break; break;
case eParticleType_slime: case eParticleType_slime:
particle = std::shared_ptr<Particle>(new BreakingItemParticle( particle = std::make_shared<BreakingItemParticle>(
lev, x, y, z, Item::slimeBall, textures)); lev, x, y, z, Item::slimeBall, textures);
break; break;
case eParticleType_heart: case eParticleType_heart:
particle = std::shared_ptr<Particle>( particle = std::shared_ptr<Particle>(
@ -3142,8 +3142,8 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
(eParticleType <= eParticleType_iconcrack_last)) { (eParticleType <= eParticleType_iconcrack_last)) {
int id = PARTICLE_CRACK_ID(eParticleType), int id = PARTICLE_CRACK_ID(eParticleType),
data = PARTICLE_CRACK_DATA(eParticleType); data = PARTICLE_CRACK_DATA(eParticleType);
particle = std::shared_ptr<Particle>(new BreakingItemParticle( particle = std::make_shared<BreakingItemParticle>(
lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); lev, x, y, z, xa, ya, za, Item::items[id], textures, data);
} else if ((eParticleType >= eParticleType_tilecrack_base) && } else if ((eParticleType >= eParticleType_tilecrack_base) &&
(eParticleType <= eParticleType_tilecrack_last)) { (eParticleType <= eParticleType_tilecrack_last)) {
int id = PARTICLE_CRACK_ID(eParticleType), int id = PARTICLE_CRACK_ID(eParticleType),

View file

@ -358,7 +358,7 @@ bool b2 = !mob->isCapeHidden();*/
glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f); glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f);
if (mob->fishing != nullptr) { if (mob->fishing != nullptr) {
item = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick)); item = std::make_shared<ItemInstance>(Item::stick);
} }
UseAnim anim = UseAnim_none; // null; UseAnim anim = UseAnim_none; // null;

View file

@ -24,7 +24,7 @@ void SnowManRenderer::additionalRendering(std::shared_ptr<LivingEntity> _mob,
MobRenderer::additionalRendering(mob, a); MobRenderer::additionalRendering(mob, a);
std::shared_ptr<ItemInstance> headGear = std::shared_ptr<ItemInstance> headGear =
std::shared_ptr<ItemInstance>(new ItemInstance(Tile::pumpkin, 1)); std::make_shared<ItemInstance>(Tile::pumpkin, 1);
if (headGear != nullptr && headGear->getItem()->id < 256) { if (headGear != nullptr && headGear->getItem()->id < 256) {
glPushMatrix(); glPushMatrix();
model->head->translateTo(1 / 16.0f); model->head->translateTo(1 / 16.0f);

View file

@ -402,8 +402,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); new McRegionLevelStorage(newFormatSave, File(L"."), name, true));
#else #else
storage = storage =
std::shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage( std::make_shared<McRegionLevelStorage>(
new ConsoleSaveFileOriginal(L""), File(L"."), name, true)); new ConsoleSaveFileOriginal(L""), File(L"."), name, true);
#endif #endif
} }
@ -1434,10 +1434,10 @@ void MinecraftServer::tick() {
if (tickCount % 20 == 0) { if (tickCount % 20 == 0) {
players->broadcastAll( players->broadcastAll(
std::shared_ptr<SetTimePacket>(new SetTimePacket( std::make_shared<SetTimePacket>(
level->getGameTime(), level->getDayTime(), level->getGameTime(), level->getDayTime(),
level->getGameRules()->getBoolean( level->getGameRules()->getBoolean(
GameRules::RULE_DAYLIGHT))), GameRules::RULE_DAYLIGHT)),
level->dimension->id); level->dimension->id);
} }
// #ifndef 0 // #ifndef 0

View file

@ -129,10 +129,10 @@ void PlayerList::placeNewPlayer(Connection* connection,
#endif #endif
// 4J Added - Give every player a map the first time they join a server // 4J Added - Give every player a map the first time they join a server
player->inventory->setItem( player->inventory->setItem(
9, std::shared_ptr<ItemInstance>(new ItemInstance( 9, std::make_shared<ItemInstance>(
Item::map_Id, 1, Item::map_Id, 1,
level->getAuxValueForMap(player->getXuid(), 0, centreXC, level->getAuxValueForMap(player->getXuid(), 0, centreXC,
centreZC, mapScale)))); centreZC, mapScale)));
if (app.getGameRuleDefinitions() != nullptr) { if (app.getGameRuleDefinitions() != nullptr) {
app.getGameRuleDefinitions()->postProcessPlayer(player); app.getGameRuleDefinitions()->postProcessPlayer(player);
} }
@ -199,8 +199,8 @@ void PlayerList::placeNewPlayer(Connection* connection,
} }
// std::shared_ptr<PlayerConnection> playerConnection = // std::shared_ptr<PlayerConnection> playerConnection =
// std::shared_ptr<PlayerConnection>(new PlayerConnection(server, // std::make_shared<PlayerConnection>(server,
// connection, player)); // connection, player);
player->connection = player->connection =
playerConnection; // Used to be assigned in PlayerConnection ctor but playerConnection; // Used to be assigned in PlayerConnection ctor but
// moved out so we can use std::shared_ptr // moved out so we can use std::shared_ptr
@ -216,7 +216,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
addPlayerToReceiving(player); addPlayerToReceiving(player);
playerConnection->send(std::shared_ptr<LoginPacket>(new LoginPacket( playerConnection->send(std::make_shared<LoginPacket>(
L"", player->entityId, level->getLevelData()->getGenerator(), L"", player->entityId, level->getLevelData()->getGenerator(),
level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
(uint8_t)level->dimension->id, (uint8_t)level->getMaxBuildHeight(), (uint8_t)level->dimension->id, (uint8_t)level->getMaxBuildHeight(),
@ -225,7 +225,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
(uint8_t)playerIndex, level->useNewSeaLevel(), (uint8_t)playerIndex, level->useNewSeaLevel(),
player->getAllPlayerGamePrivileges(), player->getAllPlayerGamePrivileges(),
level->getLevelData()->getXZSize(), level->getLevelData()->getXZSize(),
level->getLevelData()->getHellScale()))); level->getLevelData()->getHellScale()));
playerConnection->send(std::shared_ptr<SetSpawnPositionPacket>( playerConnection->send(std::shared_ptr<SetSpawnPositionPacket>(
new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z))); new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z)));
playerConnection->send(std::shared_ptr<PlayerAbilitiesPacket>( playerConnection->send(std::shared_ptr<PlayerAbilitiesPacket>(
@ -255,9 +255,9 @@ void PlayerList::placeNewPlayer(Connection* connection,
player->xRot); player->xRot);
server->getConnection()->addPlayerConnection(playerConnection); server->getConnection()->addPlayerConnection(playerConnection);
playerConnection->send(std::shared_ptr<SetTimePacket>(new SetTimePacket( playerConnection->send(std::make_shared<SetTimePacket>(
level->getGameTime(), level->getDayTime(), level->getGameTime(), level->getDayTime(),
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
auto activeEffects = player->getActiveEffects(); auto activeEffects = player->getActiveEffects();
for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) {
@ -443,7 +443,7 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
// PlayerInfoPacket(player->name, true, 1000) ) ); // PlayerInfoPacket(player->name, true, 1000) ) );
if (player->connection->getNetworkPlayer()) { if (player->connection->getNetworkPlayer()) {
broadcastAll( broadcastAll(
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(player))); std::make_shared<PlayerInfoPacket>(player));
} }
players.push_back(player); players.push_back(player);
@ -472,7 +472,7 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
// PlayerInfoPacket(op->name, true, op->latency) ) ); // PlayerInfoPacket(op->name, true, op->latency) ) );
if (op->connection->getNetworkPlayer()) { if (op->connection->getNetworkPlayer()) {
player->connection->send( player->connection->send(
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(op))); std::make_shared<PlayerInfoPacket>(op));
} }
} }
@ -484,12 +484,12 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
if (firstSleepingPlayer == nullptr) if (firstSleepingPlayer == nullptr)
firstSleepingPlayer = thisPlayer; firstSleepingPlayer = thisPlayer;
thisPlayer->connection->send( thisPlayer->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); thisPlayer->name, ChatPacket::e_ChatBedMeSleep));
} }
} }
player->connection->send(std::shared_ptr<ChatPacket>(new ChatPacket( player->connection->send(std::make_shared<ChatPacket>(
firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep));
} }
} }
@ -714,8 +714,8 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
player->setRespawnPosition(bedPosition, spawnForced); player->setRespawnPosition(bedPosition, spawnForced);
} else { } else {
player->connection->send( player->connection->send(
std::shared_ptr<GameEventPacket>(new GameEventPacket( std::make_shared<GameEventPacket>(
GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0))); GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0));
} }
delete bedPosition; delete bedPosition;
} }
@ -727,19 +727,19 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
player->setPos(player->x, player->y + 1, player->z); player->setPos(player->x, player->y + 1, player->z);
} }
player->connection->send(std::shared_ptr<RespawnPacket>(new RespawnPacket( player->connection->send(std::make_shared<RespawnPacket>(
(char)player->dimension, player->level->getSeed(), (char)player->dimension, player->level->getSeed(),
player->level->getMaxBuildHeight(), player->level->getMaxBuildHeight(),
player->gameMode->getGameModeForPlayer(), level->difficulty, player->gameMode->getGameModeForPlayer(), level->difficulty,
level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(), level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(),
player->entityId, level->getLevelData()->getXZSize(), player->entityId, level->getLevelData()->getXZSize(),
level->getLevelData()->getHellScale()))); level->getLevelData()->getHellScale()));
player->connection->teleport(player->x, player->y, player->z, player->yRot, player->connection->teleport(player->x, player->y, player->z, player->yRot,
player->xRot); player->xRot);
player->connection->send( player->connection->send(
std::shared_ptr<SetExperiencePacket>(new SetExperiencePacket( std::make_shared<SetExperiencePacket>(
player->experienceProgress, player->totalExperience, player->experienceProgress, player->totalExperience,
player->experienceLevel))); player->experienceLevel));
if (keepAllPlayerData) { if (keepAllPlayerData) {
std::vector<MobEffectInstance*>* activeEffects = std::vector<MobEffectInstance*>* activeEffects =
@ -851,13 +851,13 @@ void PlayerList::toggleDimension(std::shared_ptr<ServerPlayer> player,
// respawn packet we will be in the wrong level // respawn packet we will be in the wrong level
player->flushEntitiesToRemove(); player->flushEntitiesToRemove();
player->connection->send(std::shared_ptr<RespawnPacket>(new RespawnPacket( player->connection->send(std::make_shared<RespawnPacket>(
(char)player->dimension, newLevel->getSeed(), (char)player->dimension, newLevel->getSeed(),
newLevel->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), newLevel->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(),
newLevel->difficulty, newLevel->getLevelData()->getGenerator(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(),
newLevel->useNewSeaLevel(), player->entityId, newLevel->useNewSeaLevel(), player->entityId,
newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getXZSize(),
newLevel->getLevelData()->getHellScale()))); newLevel->getLevelData()->getHellScale()));
oldLevel->removeEntityImmediately(player); oldLevel->removeEntityImmediately(player);
player->removed = false; player->removed = false;
@ -984,7 +984,7 @@ void PlayerList::tick() {
// PlayerInfoPacket(op->name, true, op->latency) ) ); // PlayerInfoPacket(op->name, true, op->latency) ) );
if (op->connection->getNetworkPlayer()) { if (op->connection->getNetworkPlayer()) {
broadcastAll( broadcastAll(
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(op))); std::make_shared<PlayerInfoPacket>(op));
} }
} }
@ -1278,7 +1278,7 @@ void PlayerList::sendMessage(const std::wstring& name,
std::shared_ptr<ServerPlayer> player = getPlayer(name); std::shared_ptr<ServerPlayer> player = getPlayer(name);
if (player != nullptr) { if (player != nullptr) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(message))); std::make_shared<ChatPacket>(message));
} }
} }
@ -1368,9 +1368,9 @@ void PlayerList::reloadWhitelist() {}
void PlayerList::sendLevelInfo(std::shared_ptr<ServerPlayer> player, void PlayerList::sendLevelInfo(std::shared_ptr<ServerPlayer> player,
ServerLevel* level) { ServerLevel* level) {
player->connection->send(std::shared_ptr<SetTimePacket>(new SetTimePacket( player->connection->send(std::make_shared<SetTimePacket>(
level->getGameTime(), level->getDayTime(), level->getGameTime(), level->getDayTime(),
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
if (level->isRaining()) { if (level->isRaining()) {
player->connection->send(std::shared_ptr<GameEventPacket>( player->connection->send(std::shared_ptr<GameEventPacket>(
new GameEventPacket(GameEventPacket::START_RAINING, 0))); new GameEventPacket(GameEventPacket::START_RAINING, 0)));
@ -1385,9 +1385,9 @@ void PlayerList::sendLevelInfo(std::shared_ptr<ServerPlayer> player,
// send the stronghold position if there is one // send the stronghold position if there is one
if ((level->dimension->id == 0) && if ((level->dimension->id == 0) &&
level->getLevelData()->getHasStronghold()) { level->getLevelData()->getHasStronghold()) {
player->connection->send(std::shared_ptr<XZPacket>(new XZPacket( player->connection->send(std::make_shared<XZPacket>(
XZPacket::STRONGHOLD, level->getLevelData()->getXStronghold(), XZPacket::STRONGHOLD, level->getLevelData()->getXStronghold(),
level->getLevelData()->getZStronghold()))); level->getLevelData()->getZStronghold()));
} }
} }

View file

@ -96,8 +96,8 @@ void GameMode::adjustPlayer(std::shared_ptr<Player> player) {}
// } // }
std::shared_ptr<Player> GameMode::createPlayer(Level* level) { std::shared_ptr<Player> GameMode::createPlayer(Level* level) {
return std::shared_ptr<Player>(new LocalPlayer( return std::make_shared<LocalPlayer>(
minecraft, level, minecraft->user, level->dimension->id)); minecraft, level, minecraft->user, level->dimension->id);
} }
bool GameMode::interact(std::shared_ptr<Player> player, bool GameMode::interact(std::shared_ptr<Player> player,

View file

@ -368,8 +368,8 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) {
// MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in // MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in
// the packet // the packet
broadcast( broadcast(
std::shared_ptr<ChunkTilesUpdatePacket>(new ChunkTilesUpdatePacket( std::make_shared<ChunkTilesUpdatePacket>(
pos.x, pos.z, changedTiles, (uint8_t)changes, level))); pos.x, pos.z, changedTiles, (uint8_t)changes, level));
for (int i = 0; i < changes; i++) { for (int i = 0; i < changes; i++) {
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
int y = ((changedTiles[i]) & 255); int y = ((changedTiles[i]) & 255);

View file

@ -1051,7 +1051,7 @@ std::shared_ptr<Explosion> ServerLevel::explode(std::shared_ptr<Entity> source,
// instead of calling super, we run the same explosion code here except // instead of calling super, we run the same explosion code here except
// we don't generate any particles // we don't generate any particles
std::shared_ptr<Explosion> explosion = std::shared_ptr<Explosion> explosion =
std::shared_ptr<Explosion>(new Explosion(this, source, x, y, z, r)); std::make_shared<Explosion>(this, source, x, y, z, r);
explosion->fire = fire; explosion->fire = fire;
explosion->destroyBlocks = destroyBlocks; explosion->destroyBlocks = destroyBlocks;
explosion->explode(); explosion->explode();
@ -1130,9 +1130,9 @@ void ServerLevel::runTileEvents() {
TileEventData te = *it; TileEventData te = *it;
server->getPlayers()->broadcast( server->getPlayers()->broadcast(
te.getX(), te.getY(), te.getZ(), 64, dimension->id, te.getX(), te.getY(), te.getZ(), 64, dimension->id,
std::shared_ptr<TileEventPacket>(new TileEventPacket( std::make_shared<TileEventPacket>(
te.getX(), te.getY(), te.getZ(), te.getTile(), te.getX(), te.getY(), te.getZ(), te.getTile(),
te.getParamA(), te.getParamB()))); te.getParamA(), te.getParamB()));
} }
} }
tileEvents[runList].clear(); tileEvents[runList].clear();
@ -1203,9 +1203,9 @@ void ServerLevel::sendParticles(const std::wstring& name, double x, double y,
double z, int count, double xDist, double yDist, double z, int count, double xDist, double yDist,
double zDist, double speed) { double zDist, double speed) {
std::shared_ptr<Packet> packet = std::shared_ptr<Packet> packet =
std::shared_ptr<LevelParticlesPacket>(new LevelParticlesPacket( std::make_shared<LevelParticlesPacket>(
name, (float)x, (float)y, (float)z, (float)xDist, (float)yDist, name, (float)x, (float)y, (float)z, (float)xDist, (float)yDist,
(float)zDist, (float)speed, count)); (float)zDist, (float)speed, count);
for (auto it = players.begin(); it != players.end(); ++it) { for (auto it = players.begin(); it != players.end(); ++it) {
std::shared_ptr<ServerPlayer> player = std::shared_ptr<ServerPlayer> player =

View file

@ -549,9 +549,9 @@ void ServerPlayer::doTickB() {
lastSentFood != foodData.getFoodLevel() || lastSentFood != foodData.getFoodLevel() ||
((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) { ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) {
// 4J Stu - Added m_lastDamageSource for telemetry // 4J Stu - Added m_lastDamageSource for telemetry
connection->send(std::shared_ptr<SetHealthPacket>(new SetHealthPacket( connection->send(std::make_shared<SetHealthPacket>(
getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(),
m_lastDamageSource))); m_lastDamageSource));
lastSentHealth = getHealth(); lastSentHealth = getHealth();
lastSentFood = foodData.getFoodLevel(); lastSentFood = foodData.getFoodLevel();
lastFoodSaturationZero = foodData.getSaturationLevel() == 0; lastFoodSaturationZero = foodData.getSaturationLevel() == 0;
@ -582,8 +582,8 @@ void ServerPlayer::doTickB() {
if (totalExperience != lastSentExp) { if (totalExperience != lastSentExp) {
lastSentExp = totalExperience; lastSentExp = totalExperience;
connection->send( connection->send(
std::shared_ptr<SetExperiencePacket>(new SetExperiencePacket( std::make_shared<SetExperiencePacket>(
experienceProgress, totalExperience, experienceLevel))); experienceProgress, totalExperience, experienceLevel));
} }
} }
@ -703,8 +703,8 @@ void ServerPlayer::changeDimension(int i) {
m_enteredEndExitPortal = m_enteredEndExitPortal =
true; // We only flag this for the player in the portal true; // We only flag this for the player in the portal
connection->send( connection->send(
std::shared_ptr<GameEventPacket>(new GameEventPacket( std::make_shared<GameEventPacket>(
GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()))); GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
app.DebugPrintf("Sending packet to %d\n", app.DebugPrintf("Sending packet to %d\n",
thisPlayer->GetUserIndex()); thisPlayer->GetUserIndex());
} }
@ -806,8 +806,8 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList,
void ServerPlayer::ride(std::shared_ptr<Entity> e) { void ServerPlayer::ride(std::shared_ptr<Entity> e) {
Player::ride(e); Player::ride(e);
connection->send( connection->send(
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket( std::make_shared<SetEntityLinkPacket>(
SetEntityLinkPacket::RIDING, shared_from_this(), riding))); SetEntityLinkPacket::RIDING, shared_from_this(), riding));
// 4J Removed this - The act of riding will be handled on the client and // 4J Removed this - The act of riding will be handled on the client and
// will change the position of the player. If we also teleport it then we // will change the position of the player. If we also teleport it then we
@ -830,8 +830,8 @@ void ServerPlayer::openTextEdit(std::shared_ptr<TileEntity> sign) {
signTE->setAllowedPlayerEditor( signTE->setAllowedPlayerEditor(
std::dynamic_pointer_cast<Player>(shared_from_this())); std::dynamic_pointer_cast<Player>(shared_from_this()));
connection->send( connection->send(
std::shared_ptr<TileEditorOpenPacket>(new TileEditorOpenPacket( std::make_shared<TileEditorOpenPacket>(
TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z))); TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z));
} }
} }
@ -843,9 +843,9 @@ bool ServerPlayer::startCrafting(int x, int y, int z) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9,
false))); false));
containerMenu = new CraftingMenu(inventory, level, x, y, z); containerMenu = new CraftingMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -862,9 +862,9 @@ bool ServerPlayer::openFireworks(int x, int y, int z) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9,
false))); false));
containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -873,9 +873,9 @@ bool ServerPlayer::openFireworks(int x, int y, int z) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9,
false))); false));
containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -893,9 +893,9 @@ bool ServerPlayer::startEnchanting(int x, int y, int z,
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::ENCHANTMENT, containerCounter, ContainerOpenPacket::ENCHANTMENT,
name.empty() ? L"" : name, 9, !name.empty()))); name.empty() ? L"" : name, 9, !name.empty()));
containerMenu = new EnchantmentMenu(inventory, level, x, y, z); containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -912,9 +912,9 @@ bool ServerPlayer::startRepairing(int x, int y, int z) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9,
false))); false));
containerMenu = new AnvilMenu( containerMenu = new AnvilMenu(
inventory, level, x, y, z, inventory, level, x, y, z,
std::dynamic_pointer_cast<Player>(shared_from_this())); std::dynamic_pointer_cast<Player>(shared_from_this()));
@ -939,9 +939,9 @@ bool ServerPlayer::openContainer(std::shared_ptr<Container> container) {
assert(containerType >= 0); assert(containerType >= 0);
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, containerType, container->getCustomName(), containerCounter, containerType, container->getCustomName(),
container->getContainerSize(), container->hasCustomName()))); container->getContainerSize(), container->hasCustomName()));
containerMenu = new ContainerMenu(inventory, container); containerMenu = new ContainerMenu(inventory, container);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
@ -958,10 +958,10 @@ bool ServerPlayer::openHopper(std::shared_ptr<HopperTileEntity> container) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::HOPPER, containerCounter, ContainerOpenPacket::HOPPER,
container->getCustomName(), container->getContainerSize(), container->getCustomName(), container->getContainerSize(),
container->hasCustomName()))); container->hasCustomName()));
containerMenu = new HopperMenu(inventory, container); containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -978,10 +978,10 @@ bool ServerPlayer::openHopper(std::shared_ptr<MinecartHopper> container) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::HOPPER, containerCounter, ContainerOpenPacket::HOPPER,
container->getCustomName(), container->getContainerSize(), container->getCustomName(), container->getContainerSize(),
container->hasCustomName()))); container->hasCustomName()));
containerMenu = new HopperMenu(inventory, container); containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -998,10 +998,10 @@ bool ServerPlayer::openFurnace(std::shared_ptr<FurnaceTileEntity> furnace) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::FURNACE, containerCounter, ContainerOpenPacket::FURNACE,
furnace->getCustomName(), furnace->getContainerSize(), furnace->getCustomName(), furnace->getContainerSize(),
furnace->hasCustomName()))); furnace->hasCustomName()));
containerMenu = new FurnaceMenu(inventory, furnace); containerMenu = new FurnaceMenu(inventory, furnace);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -1017,13 +1017,13 @@ bool ServerPlayer::openTrap(std::shared_ptr<DispenserTileEntity> trap) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, containerCounter,
trap->GetType() == eTYPE_DROPPERTILEENTITY trap->GetType() == eTYPE_DROPPERTILEENTITY
? ContainerOpenPacket::DROPPER ? ContainerOpenPacket::DROPPER
: ContainerOpenPacket::TRAP, : ContainerOpenPacket::TRAP,
trap->getCustomName(), trap->getContainerSize(), trap->getCustomName(), trap->getContainerSize(),
trap->hasCustomName()))); trap->hasCustomName()));
containerMenu = new TrapMenu(inventory, trap); containerMenu = new TrapMenu(inventory, trap);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -1040,10 +1040,10 @@ bool ServerPlayer::openBrewingStand(
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::BREWING_STAND, containerCounter, ContainerOpenPacket::BREWING_STAND,
brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->getCustomName(), brewingStand->getContainerSize(),
brewingStand->hasCustomName()))); brewingStand->hasCustomName()));
containerMenu = new BrewingStandMenu(inventory, brewingStand); containerMenu = new BrewingStandMenu(inventory, brewingStand);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -1060,10 +1060,10 @@ bool ServerPlayer::openBeacon(std::shared_ptr<BeaconTileEntity> beacon) {
if (containerMenu == inventoryMenu) { if (containerMenu == inventoryMenu) {
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::BEACON, containerCounter, ContainerOpenPacket::BEACON,
beacon->getCustomName(), beacon->getContainerSize(), beacon->getCustomName(), beacon->getContainerSize(),
beacon->hasCustomName()))); beacon->hasCustomName()));
containerMenu = new BeaconMenu(inventory, beacon); containerMenu = new BeaconMenu(inventory, beacon);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -1086,10 +1086,10 @@ bool ServerPlayer::openTrading(std::shared_ptr<Merchant> traderTarget,
((MerchantMenu*)containerMenu)->getTradeContainer(); ((MerchantMenu*)containerMenu)->getTradeContainer();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::TRADER_NPC, containerCounter, ContainerOpenPacket::TRADER_NPC,
name.empty() ? L"" : name, container->getContainerSize(), name.empty() ? L"" : name, container->getContainerSize(),
!name.empty()))); !name.empty()));
MerchantRecipeList* offers = traderTarget->getOffers( MerchantRecipeList* offers = traderTarget->getOffers(
std::dynamic_pointer_cast<Player>(shared_from_this())); std::dynamic_pointer_cast<Player>(shared_from_this()));
@ -1121,10 +1121,10 @@ bool ServerPlayer::openHorseInventory(std::shared_ptr<EntityHorse> horse,
} }
nextContainerCounter(); nextContainerCounter();
connection->send( connection->send(
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket( std::make_shared<ContainerOpenPacket>(
containerCounter, ContainerOpenPacket::HORSE, containerCounter, ContainerOpenPacket::HORSE,
horse->getCustomName(), container->getContainerSize(), horse->getCustomName(), container->getContainerSize(),
container->hasCustomName(), horse->entityId))); container->hasCustomName(), horse->entityId));
containerMenu = new HorseInventoryMenu(inventory, container, horse); containerMenu = new HorseInventoryMenu(inventory, container, horse);
containerMenu->containerId = containerCounter; containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this); containerMenu->addSlotListener(this);
@ -1245,22 +1245,22 @@ void ServerPlayer::displayClientMessage(int messageId) {
case IDS_TILE_BED_OCCUPIED: case IDS_TILE_BED_OCCUPIED:
messageType = ChatPacket::e_ChatBedOccupied; messageType = ChatPacket::e_ChatBedOccupied;
connection->send( connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType))); std::make_shared<ChatPacket>(L"", messageType));
break; break;
case IDS_TILE_BED_NO_SLEEP: case IDS_TILE_BED_NO_SLEEP:
messageType = ChatPacket::e_ChatBedNoSleep; messageType = ChatPacket::e_ChatBedNoSleep;
connection->send( connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType))); std::make_shared<ChatPacket>(L"", messageType));
break; break;
case IDS_TILE_BED_NOT_VALID: case IDS_TILE_BED_NOT_VALID:
messageType = ChatPacket::e_ChatBedNotValid; messageType = ChatPacket::e_ChatBedNotValid;
connection->send( connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType))); std::make_shared<ChatPacket>(L"", messageType));
break; break;
case IDS_TILE_BED_NOTSAFE: case IDS_TILE_BED_NOTSAFE:
messageType = ChatPacket::e_ChatBedNotSafe; messageType = ChatPacket::e_ChatBedNotSafe;
connection->send( connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType))); std::make_shared<ChatPacket>(L"", messageType));
break; break;
case IDS_TILE_BED_PLAYERSLEEP: case IDS_TILE_BED_PLAYERSLEEP:
messageType = ChatPacket::e_ChatBedPlayerSleep; messageType = ChatPacket::e_ChatBedPlayerSleep;
@ -1271,8 +1271,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() != player) { if (shared_from_this() != player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatBedPlayerSleep))); name, ChatPacket::e_ChatBedPlayerSleep));
} else { } else {
player->connection->send(std::shared_ptr<ChatPacket>( player->connection->send(std::shared_ptr<ChatPacket>(
new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); new ChatPacket(name, ChatPacket::e_ChatBedMeSleep)));
@ -1287,8 +1287,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() != player) { if (shared_from_this() != player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerEnteredEnd))); name, ChatPacket::e_ChatPlayerEnteredEnd));
} }
} }
break; break;
@ -1306,7 +1306,7 @@ void ServerPlayer::displayClientMessage(int messageId) {
case IDS_TILE_BED_MESLEEP: case IDS_TILE_BED_MESLEEP:
messageType = ChatPacket::e_ChatBedMeSleep; messageType = ChatPacket::e_ChatBedMeSleep;
connection->send( connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType))); std::make_shared<ChatPacket>(L"", messageType));
break; break;
case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED: case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED:
@ -1316,8 +1316,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); name, ChatPacket::e_ChatPlayerMaxPigsSheepCows));
} }
} }
break; break;
@ -1328,8 +1328,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxChickens))); name, ChatPacket::e_ChatPlayerMaxChickens));
} }
} }
break; break;
@ -1340,8 +1340,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxSquid))); name, ChatPacket::e_ChatPlayerMaxSquid));
} }
} }
break; break;
@ -1363,8 +1363,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxWolves))); name, ChatPacket::e_ChatPlayerMaxWolves));
} }
} }
break; break;
@ -1375,8 +1375,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxMooshrooms))); name, ChatPacket::e_ChatPlayerMaxMooshrooms));
} }
} }
break; break;
@ -1387,8 +1387,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxEnemies))); name, ChatPacket::e_ChatPlayerMaxEnemies));
} }
} }
break; break;
@ -1400,8 +1400,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxVillagers))); name, ChatPacket::e_ChatPlayerMaxVillagers));
} }
} }
break; break;
@ -1412,9 +1412,9 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, name,
ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); ChatPacket::e_ChatPlayerMaxBredPigsSheepCows));
} }
} }
break; break;
@ -1425,8 +1425,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxBredChickens))); name, ChatPacket::e_ChatPlayerMaxBredChickens));
} }
} }
break; break;
@ -1437,8 +1437,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); name, ChatPacket::e_ChatPlayerMaxBredMooshrooms));
} }
} }
break; break;
@ -1450,8 +1450,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxBredWolves))); name, ChatPacket::e_ChatPlayerMaxBredWolves));
} }
} }
break; break;
@ -1463,8 +1463,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerCantShearMooshroom))); name, ChatPacket::e_ChatPlayerCantShearMooshroom));
} }
} }
break; break;
@ -1476,8 +1476,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxHangingEntities))); name, ChatPacket::e_ChatPlayerMaxHangingEntities));
} }
} }
break; break;
@ -1488,9 +1488,9 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, name,
ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); ChatPacket::e_ChatPlayerCantSpawnInPeaceful));
} }
} }
break; break;
@ -1502,8 +1502,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
server->getPlayers()->players[i]; server->getPlayers()->players[i];
if (shared_from_this() == player) { if (shared_from_this() == player) {
player->connection->send( player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
name, ChatPacket::e_ChatPlayerMaxBoats))); name, ChatPacket::e_ChatPlayerMaxBoats));
} }
} }
break; break;
@ -1577,14 +1577,14 @@ void ServerPlayer::teleportTo(double x, double y, double z) {
void ServerPlayer::crit(std::shared_ptr<Entity> entity) { void ServerPlayer::crit(std::shared_ptr<Entity> entity) {
getLevel()->getTracker()->broadcastAndSend( getLevel()->getTracker()->broadcastAndSend(
shared_from_this(), std::shared_ptr<AnimatePacket>(new AnimatePacket( shared_from_this(), std::make_shared<AnimatePacket>(
entity, AnimatePacket::CRITICAL_HIT))); entity, AnimatePacket::CRITICAL_HIT));
} }
void ServerPlayer::magicCrit(std::shared_ptr<Entity> entity) { void ServerPlayer::magicCrit(std::shared_ptr<Entity> entity) {
getLevel()->getTracker()->broadcastAndSend( getLevel()->getTracker()->broadcastAndSend(
shared_from_this(), std::shared_ptr<AnimatePacket>(new AnimatePacket( shared_from_this(), std::make_shared<AnimatePacket>(
entity, AnimatePacket::MAGIC_CRITICAL_HIT))); entity, AnimatePacket::MAGIC_CRITICAL_HIT));
} }
void ServerPlayer::onUpdateAbilities() { void ServerPlayer::onUpdateAbilities() {

View file

@ -66,8 +66,8 @@ void TrackedEntity::tick(EntityTracker* tracker,
(e->riding != nullptr && (e->riding != nullptr &&
tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) { tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) {
lastRidingEntity = e->riding; lastRidingEntity = e->riding;
broadcast(std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket( broadcast(std::make_shared<SetEntityLinkPacket>(
SetEntityLinkPacket::RIDING, e, e->riding))); SetEntityLinkPacket::RIDING, e, e->riding));
} }
// Moving forward special case for item frames // Moving forward special case for item frames
@ -304,8 +304,8 @@ void TrackedEntity::tick(EntityTracker* tracker,
if (rot) { if (rot) {
// 4J: Changed this to use deltas // 4J: Changed this to use deltas
broadcast( broadcast(
std::shared_ptr<MoveEntityPacket>(new MoveEntityPacket::Rot( std::make_shared<MoveEntityPacket::Rot>(
e->entityId, (uint8_t)yRota, (uint8_t)xRota))); e->entityId, (uint8_t)yRota, (uint8_t)xRota));
yRotp = yRotn; yRotp = yRotn;
xRotp = xRotn; xRotp = xRotn;
} }
@ -571,8 +571,8 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker,
// 4J Stu brought forward to fix when Item Frames // 4J Stu brought forward to fix when Item Frames
if (!e->getEntityData()->isEmpty() && !isAddMobPacket) { if (!e->getEntityData()->isEmpty() && !isAddMobPacket) {
sp->connection->send( sp->connection->send(
std::shared_ptr<SetEntityDataPacket>(new SetEntityDataPacket( std::make_shared<SetEntityDataPacket>(
e->entityId, e->getEntityData(), true))); e->entityId, e->getEntityData(), true));
} }
if (e->instanceof(eTYPE_LIVINGENTITY)) { if (e->instanceof(eTYPE_LIVINGENTITY)) {
@ -597,15 +597,15 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker,
if (e->riding != nullptr) { if (e->riding != nullptr) {
sp->connection->send( sp->connection->send(
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket( std::make_shared<SetEntityLinkPacket>(
SetEntityLinkPacket::RIDING, e, e->riding))); SetEntityLinkPacket::RIDING, e, e->riding));
} }
if (e->instanceof(eTYPE_MOB) && if (e->instanceof(eTYPE_MOB) &&
std::dynamic_pointer_cast<Mob>(e)->getLeashHolder() != nullptr) { std::dynamic_pointer_cast<Mob>(e)->getLeashHolder() != nullptr) {
sp->connection->send( sp->connection->send(
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket( std::make_shared<SetEntityLinkPacket>(
SetEntityLinkPacket::LEASH, e, SetEntityLinkPacket::LEASH, e,
std::dynamic_pointer_cast<Mob>(e)->getLeashHolder()))); std::dynamic_pointer_cast<Mob>(e)->getLeashHolder()));
} }
if (e->instanceof(eTYPE_LIVINGENTITY)) { if (e->instanceof(eTYPE_LIVINGENTITY)) {
@ -689,8 +689,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
if (e->instanceof(eTYPE_ITEMENTITY)) { if (e->instanceof(eTYPE_ITEMENTITY)) {
std::shared_ptr<AddEntityPacket> packet = std::shared_ptr<AddEntityPacket> packet =
std::shared_ptr<AddEntityPacket>(new AddEntityPacket( std::make_shared<AddEntityPacket>(
e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp);
return packet; return packet;
} else if (e->instanceof(eTYPE_SERVERPLAYER)) { } else if (e->instanceof(eTYPE_SERVERPLAYER)) {
std::shared_ptr<ServerPlayer> player = std::shared_ptr<ServerPlayer> player =
@ -705,8 +705,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
// 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: // 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay:
// When one of the Players is idle for a few minutes his head turns 180 // When one of the Players is idle for a few minutes his head turns 180
// degrees. // degrees.
return std::shared_ptr<AddPlayerPacket>(new AddPlayerPacket( return std::make_shared<AddPlayerPacket>(
player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp)); player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp);
} else if (e->instanceof(eTYPE_MINECART)) { } else if (e->instanceof(eTYPE_MINECART)) {
std::shared_ptr<Minecart> minecart = std::shared_ptr<Minecart> minecart =
std::dynamic_pointer_cast<Minecart>(e); std::dynamic_pointer_cast<Minecart>(e);
@ -714,8 +714,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
new AddEntityPacket(e, AddEntityPacket::MINECART, new AddEntityPacket(e, AddEntityPacket::MINECART,
minecart->getType(), yRotp, xRotp, xp, yp, zp)); minecart->getType(), yRotp, xRotp, xp, yp, zp));
} else if (e->instanceof(eTYPE_BOAT)) { } else if (e->instanceof(eTYPE_BOAT)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_ENDERDRAGON)) { } else if (e->instanceof(eTYPE_ENDERDRAGON)) {
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
return std::shared_ptr<AddMobPacket>( return std::shared_ptr<AddMobPacket>(
@ -724,37 +724,37 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
} else if (e->instanceof(eTYPE_FISHINGHOOK)) { } else if (e->instanceof(eTYPE_FISHINGHOOK)) {
std::shared_ptr<Entity> owner = std::shared_ptr<Entity> owner =
std::dynamic_pointer_cast<FishingHook>(e)->owner; std::dynamic_pointer_cast<FishingHook>(e)->owner;
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::FISH_HOOK, e, AddEntityPacket::FISH_HOOK,
owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp,
yp, zp)); yp, zp);
} else if (e->instanceof(eTYPE_ARROW)) { } else if (e->instanceof(eTYPE_ARROW)) {
std::shared_ptr<Entity> owner = std::shared_ptr<Entity> owner =
(std::dynamic_pointer_cast<Arrow>(e))->owner; (std::dynamic_pointer_cast<Arrow>(e))->owner;
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::ARROW, e, AddEntityPacket::ARROW,
owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp,
yp, zp)); yp, zp);
} else if (e->instanceof(eTYPE_SNOWBALL)) { } else if (e->instanceof(eTYPE_SNOWBALL)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_THROWNPOTION)) { } else if (e->instanceof(eTYPE_THROWNPOTION)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::THROWN_POTION, e, AddEntityPacket::THROWN_POTION,
((std::dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue()), ((std::dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue()),
yRotp, xRotp, xp, yp, zp)); yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) { } else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_THROWNENDERPEARL)) { } else if (e->instanceof(eTYPE_THROWNENDERPEARL)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) { } else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) { } else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_FIREBALL)) { } else if (e->instanceof(eTYPE_FIREBALL)) {
eINSTANCEOF classType = e->GetType(); eINSTANCEOF classType = e->GetType();
int type = AddEntityPacket::FIREBALL; int type = AddEntityPacket::FIREBALL;
@ -769,8 +769,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
std::shared_ptr<Fireball> fb = std::dynamic_pointer_cast<Fireball>(e); std::shared_ptr<Fireball> fb = std::dynamic_pointer_cast<Fireball>(e);
std::shared_ptr<AddEntityPacket> aep = nullptr; std::shared_ptr<AddEntityPacket> aep = nullptr;
if (fb->owner != nullptr) { if (fb->owner != nullptr) {
aep = std::shared_ptr<AddEntityPacket>(new AddEntityPacket( aep = std::make_shared<AddEntityPacket>(
e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp)); e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp);
} else { } else {
aep = std::shared_ptr<AddEntityPacket>( aep = std::shared_ptr<AddEntityPacket>(
new AddEntityPacket(e, type, 0, yRotp, xRotp, xp, yp, zp)); new AddEntityPacket(e, type, 0, yRotp, xRotp, xp, yp, zp));
@ -780,20 +780,20 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
aep->za = (int)(fb->zPower * 8000); aep->za = (int)(fb->zPower * 8000);
return aep; return aep;
} else if (e->instanceof(eTYPE_THROWNEGG)) { } else if (e->instanceof(eTYPE_THROWNEGG)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_PRIMEDTNT)) { } else if (e->instanceof(eTYPE_PRIMEDTNT)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) { } else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) {
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_FALLINGTILE)) { } else if (e->instanceof(eTYPE_FALLINGTILE)) {
std::shared_ptr<FallingTile> ft = std::shared_ptr<FallingTile> ft =
std::dynamic_pointer_cast<FallingTile>(e); std::dynamic_pointer_cast<FallingTile>(e);
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket( return std::make_shared<AddEntityPacket>(
e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp,
xRotp, xp, yp, zp)); xRotp, xp, yp, zp);
} else if (e->instanceof(eTYPE_PAINTING)) { } else if (e->instanceof(eTYPE_PAINTING)) {
return std::shared_ptr<AddPaintingPacket>( return std::shared_ptr<AddPaintingPacket>(
new AddPaintingPacket(std::dynamic_pointer_cast<Painting>(e))); new AddPaintingPacket(std::dynamic_pointer_cast<Painting>(e)));
@ -820,8 +820,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
std::shared_ptr<LeashFenceKnotEntity> knot = std::shared_ptr<LeashFenceKnotEntity> knot =
std::dynamic_pointer_cast<LeashFenceKnotEntity>(e); std::dynamic_pointer_cast<LeashFenceKnotEntity>(e);
std::shared_ptr<AddEntityPacket> packet = std::shared_ptr<AddEntityPacket> packet =
std::shared_ptr<AddEntityPacket>(new AddEntityPacket( std::make_shared<AddEntityPacket>(
e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp)); e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp);
packet->x = Mth::floor((float)knot->xTile * 32); packet->x = Mth::floor((float)knot->xTile * 32);
packet->y = Mth::floor((float)knot->yTile * 32); packet->y = Mth::floor((float)knot->yTile * 32);
packet->z = Mth::floor((float)knot->zTile * 32); packet->z = Mth::floor((float)knot->zTile * 32);

View file

@ -56,7 +56,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
reason, _tick); reason, _tick);
app.DebugPrintf("Pending connection disconnect: %d\n", reason); app.DebugPrintf("Pending connection disconnect: %d\n", reason);
connection->send( connection->send(
std::shared_ptr<DisconnectPacket>(new DisconnectPacket(reason))); std::make_shared<DisconnectPacket>(reason));
connection->sendAndQuit(); connection->sendAndQuit();
done = true; done = true;
// } catch (Exception e) { // } catch (Exception e) {

View file

@ -112,7 +112,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
// 4J Stu - Need to remove the player from the receiving list before their // 4J Stu - Need to remove the player from the receiving list before their
// socket is NULLed so that we can find another player on their system // socket is NULLed so that we can find another player on their system
server->getPlayers()->removePlayerFromReceiving(player); server->getPlayers()->removePlayerFromReceiving(player);
send(std::shared_ptr<DisconnectPacket>(new DisconnectPacket(reason))); send(std::make_shared<DisconnectPacket>(reason));
connection->sendAndQuit(); connection->sendAndQuit();
// 4J-PB - removed, since it needs to be localised in the language the // 4J-PB - removed, since it needs to be localised in the language the
// client is in // client is in
@ -120,8 +120,8 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
// ChatPacket(L"§e" + player->name + L" left the game.") ) ); // ChatPacket(L"§e" + player->name + L" left the game.") ) );
if (getWasKicked()) { if (getWasKicked()) {
server->getPlayers()->broadcastAll( server->getPlayers()->broadcastAll(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
player->name, ChatPacket::e_ChatPlayerKickedFromGame))); player->name, ChatPacket::e_ChatPlayerKickedFromGame));
} else { } else {
server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>( server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>(
new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame))); new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame)));
@ -365,8 +365,8 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot,
// where it represents the bottom of the player bounding volume // where it represents the bottom of the player bounding volume
if (sendPacket) if (sendPacket)
player->connection->send( player->connection->send(
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot( std::make_shared<MovePlayerPacket::PosRot>(
x, y + 1.62f, y, z, yRot, xRot, false, false))); x, y + 1.62f, y, z, yRot, xRot, false, false));
} }
void PlayerConnection::handlePlayerAction( void PlayerConnection::handlePlayerAction(
@ -553,8 +553,8 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
// ChatPacket(L"§e" + player->name + L" left the game.") ) ); // ChatPacket(L"§e" + player->name + L" left the game.") ) );
if (getWasKicked()) { if (getWasKicked()) {
server->getPlayers()->broadcastAll( server->getPlayers()->broadcastAll(
std::shared_ptr<ChatPacket>(new ChatPacket( std::make_shared<ChatPacket>(
player->name, ChatPacket::e_ChatPlayerKickedFromGame))); player->name, ChatPacket::e_ChatPlayerKickedFromGame));
} else { } else {
server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>( server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>(
new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame))); new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame)));
@ -1132,8 +1132,8 @@ void PlayerConnection::handleContainerClick(
if (ItemInstance::matches(packet->item, clicked)) { if (ItemInstance::matches(packet->item, clicked)) {
// Yep, you sure did click what you claimed to click! // Yep, you sure did click what you claimed to click!
player->connection->send( player->connection->send(
std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket( std::make_shared<ContainerAckPacket>(
packet->containerId, packet->uid, true))); packet->containerId, packet->uid, true));
player->ignoreSlotUpdateHack = true; player->ignoreSlotUpdateHack = true;
player->containerMenu->broadcastChanges(); player->containerMenu->broadcastChanges();
player->broadcastCarriedItem(); player->broadcastCarriedItem();
@ -1142,8 +1142,8 @@ void PlayerConnection::handleContainerClick(
// No, you clicked the wrong thing! // No, you clicked the wrong thing!
expectedAcks[player->containerMenu->containerId] = packet->uid; expectedAcks[player->containerMenu->containerId] = packet->uid;
player->connection->send( player->connection->send(
std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket( std::make_shared<ContainerAckPacket>(
packet->containerId, packet->uid, false))); packet->containerId, packet->uid, false));
player->containerMenu->setSynched(player, false); player->containerMenu->setSynched(player, false);
std::vector<std::shared_ptr<ItemInstance> > items; std::vector<std::shared_ptr<ItemInstance> > items;
@ -1199,7 +1199,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
std::wstring id = std::wstring(buf); std::wstring id = std::wstring(buf);
if (data == nullptr) { if (data == nullptr) {
data = data =
std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id)); std::make_shared<MapItemSavedData>(id);
} }
player->level->setSavedData(id, (std::shared_ptr<SavedData>)data); player->level->setSavedData(id, (std::shared_ptr<SavedData>)data);
@ -1364,9 +1364,9 @@ void PlayerConnection::handlePlayerInfo(
Player::ePlayerGamePrivilege_CreativeMode)); Player::ePlayerGamePrivilege_CreativeMode));
serverPlayer->gameMode->setGameModeForPlayer(gameType); serverPlayer->gameMode->setGameModeForPlayer(gameType);
serverPlayer->connection->send( serverPlayer->connection->send(
std::shared_ptr<GameEventPacket>(new GameEventPacket( std::make_shared<GameEventPacket>(
GameEventPacket::CHANGE_GAME_MODE, GameEventPacket::CHANGE_GAME_MODE,
gameType->getId()))); gameType->getId()));
} else { } else {
#if !defined(_CONTENT_PACKAGE) #if !defined(_CONTENT_PACKAGE)
wprintf(L"%ls already has game mode %d\n", wprintf(L"%ls already has game mode %d\n",
@ -1673,9 +1673,9 @@ void PlayerConnection::handleCraftItem(
if (ingItemInst->getItem()->hasCraftingRemainingItem()) { if (ingItemInst->getItem()->hasCraftingRemainingItem()) {
// replace item with remaining result // replace item with remaining result
player->inventory->add( player->inventory->add(
std::shared_ptr<ItemInstance>(new ItemInstance( std::make_shared<ItemInstance>(
ingItemInst->getItem() ingItemInst->getItem()
->getCraftingRemainingItem()))); ->getCraftingRemainingItem()));
} }
} }
} }

View file

@ -22,9 +22,9 @@ ServerConnection::~ServerConnection() {}
// used to have // used to have
void ServerConnection::NewIncomingSocket(Socket* socket) { void ServerConnection::NewIncomingSocket(Socket* socket) {
std::shared_ptr<PendingConnection> unconnectedClient = std::shared_ptr<PendingConnection> unconnectedClient =
std::shared_ptr<PendingConnection>(new PendingConnection( std::make_shared<PendingConnection>(
server, socket, server, socket,
L"Connection #" + _toString<int>(connectionCounter++))); L"Connection #" + _toString<int>(connectionCounter++));
handleConnection(unconnectedClient); handleConnection(unconnectedClient);
} }

View file

@ -34,7 +34,7 @@ void GiveItemCommand::execute(std::shared_ptr<CommandSender> source,
std::shared_ptr<ServerPlayer> player = getPlayer(uid); std::shared_ptr<ServerPlayer> player = getPlayer(uid);
if (player != nullptr && item > 0 && Item::items[item] != nullptr) { if (player != nullptr && item > 0 && Item::items[item] != nullptr) {
std::shared_ptr<ItemInstance> itemInstance = std::shared_ptr<ItemInstance> itemInstance =
std::shared_ptr<ItemInstance>(new ItemInstance(item, amount, aux)); std::make_shared<ItemInstance>(item, amount, aux);
std::shared_ptr<ItemEntity> drop = player->drop(itemInstance); std::shared_ptr<ItemEntity> drop = player->drop(itemInstance);
drop->throwTime = 0; drop->throwTime = 0;
// logAdminAction(source, L"commands.give.success", // logAdminAction(source, L"commands.give.success",

View file

@ -50,24 +50,24 @@ std::shared_ptr<Projectile> ArrowDispenseBehavior::getProjectile(
std::shared_ptr<Projectile> EggDispenseBehavior::getProjectile( std::shared_ptr<Projectile> EggDispenseBehavior::getProjectile(
Level* world, Position* position) { Level* world, Position* position) {
return std::shared_ptr<Projectile>(new ThrownEgg( return std::make_shared<ThrownEgg>(
world, position->getX(), position->getY(), position->getZ())); world, position->getX(), position->getY(), position->getZ());
} }
/* Snowball */ /* Snowball */
std::shared_ptr<Projectile> SnowballDispenseBehavior::getProjectile( std::shared_ptr<Projectile> SnowballDispenseBehavior::getProjectile(
Level* world, Position* position) { Level* world, Position* position) {
return std::shared_ptr<Projectile>(new Snowball( return std::make_shared<Snowball>(
world, position->getX(), position->getY(), position->getZ())); world, position->getX(), position->getY(), position->getZ());
} }
/* Exp Bottle */ /* Exp Bottle */
std::shared_ptr<Projectile> ExpBottleDispenseBehavior::getProjectile( std::shared_ptr<Projectile> ExpBottleDispenseBehavior::getProjectile(
Level* world, Position* position) { Level* world, Position* position) {
return std::shared_ptr<Projectile>(new ThrownExpBottle( return std::make_shared<ThrownExpBottle>(
world, position->getX(), position->getY(), position->getZ())); world, position->getX(), position->getY(), position->getZ());
} }
float ExpBottleDispenseBehavior::getUncertainty() { float ExpBottleDispenseBehavior::getUncertainty() {
@ -164,8 +164,8 @@ std::shared_ptr<ItemInstance> FireworksDispenseBehavior::execute(
double spawnZ = source->getZ() + facing->getStepZ(); double spawnZ = source->getZ() + facing->getStepZ();
std::shared_ptr<FireworksRocketEntity> firework = std::shared_ptr<FireworksRocketEntity> firework =
std::shared_ptr<FireworksRocketEntity>(new FireworksRocketEntity( std::make_shared<FireworksRocketEntity>(
world, spawnX, spawnY, spawnZ, dispensed)); world, spawnX, spawnY, spawnZ, dispensed);
source->getWorld()->addEntity(firework); source->getWorld()->addEntity(firework);
outcome = ACTIVATED_ITEM; outcome = ACTIVATED_ITEM;
@ -348,7 +348,7 @@ std::shared_ptr<ItemInstance> EmptyBucketDispenseBehavior::execute(
new ItemInstance(targetType))) < 0) { new ItemInstance(targetType))) < 0) {
DefaultDispenseItemBehavior::dispense( DefaultDispenseItemBehavior::dispense(
source, source,
std::shared_ptr<ItemInstance>(new ItemInstance(targetType))); std::make_shared<ItemInstance>(targetType));
} }
outcome = ACTIVATED_ITEM; outcome = ACTIVATED_ITEM;

View file

@ -451,7 +451,7 @@ void Connection::tick() {
// read and write threads don't timeout // read and write threads don't timeout
tickCount++; tickCount++;
if (tickCount % 20 == 0) { if (tickCount % 20 == 0) {
send(std::shared_ptr<KeepAlivePacket>(new KeepAlivePacket())); send(std::make_shared<KeepAlivePacket>());
} }
// 4J Stu - 1.8.2 changed from 100 to 1000 // 4J Stu - 1.8.2 changed from 100 to 1000

View file

@ -61,7 +61,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddEntityPacket()); return std::make_shared<AddEntityPacket>();
} }
virtual int getId() { return 23; } virtual int getId() { return 23; }
}; };

View file

@ -24,7 +24,7 @@ public:
virtual int getEstimatedSize(); virtual int getEstimatedSize();
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddExperienceOrbPacket()); return std::make_shared<AddExperienceOrbPacket>();
} }
virtual int getId() { return 26; } virtual int getId() { return 26; }
}; };

View file

@ -27,7 +27,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddGlobalEntityPacket()); return std::make_shared<AddGlobalEntityPacket>();
} }
virtual int getId() { return 71; } virtual int getId() { return 71; }
}; };

View file

@ -39,7 +39,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddMobPacket()); return std::make_shared<AddMobPacket>();
} }
virtual int getId() { return 24; } virtual int getId() { return 24; }
}; };

View file

@ -28,7 +28,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddPaintingPacket()); return std::make_shared<AddPaintingPacket>();
} }
virtual int getId() { return 25; } virtual int getId() { return 25; }
}; };

View file

@ -48,7 +48,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AddPlayerPacket()); return std::make_shared<AddPlayerPacket>();
} }
virtual int getId() { return 20; } virtual int getId() { return 20; }
}; };

View file

@ -31,7 +31,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AnimatePacket()); return std::make_shared<AnimatePacket>();
} }
virtual int getId() { return 18; } virtual int getId() { return 18; }
}; };

View file

@ -30,7 +30,7 @@ public:
virtual bool isAync(); virtual bool isAync();
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new AwardStatPacket()); return std::make_shared<AwardStatPacket>();
} }
virtual int getId() { return 200; } virtual int getId() { return 200; }

View file

@ -35,7 +35,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new BlockRegionUpdatePacket()); return std::make_shared<BlockRegionUpdatePacket>();
} }
virtual int getId() { return 51; } virtual int getId() { return 51; }
}; };

View file

@ -148,7 +148,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ChatPacket()); return std::make_shared<ChatPacket>();
} }
virtual int getId() { return 3; } virtual int getId() { return 3; }
}; };

View file

@ -33,7 +33,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ChunkTilesUpdatePacket()); return std::make_shared<ChunkTilesUpdatePacket>();
} }
virtual int getId() { return 52; } virtual int getId() { return 52; }
}; };

View file

@ -30,7 +30,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ChunkVisibilityAreaPacket()); return std::make_shared<ChunkVisibilityAreaPacket>();
} }
virtual int getId() { return 155; } virtual int getId() { return 155; }
}; };

View file

@ -25,7 +25,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ChunkVisibilityPacket()); return std::make_shared<ChunkVisibilityPacket>();
} }
virtual int getId() { return 50; } virtual int getId() { return 50; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ClientCommandPacket()); return std::make_shared<ClientCommandPacket>();
} }
virtual int getId() { return 205; } virtual int getId() { return 205; }
}; };

View file

@ -26,7 +26,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ComplexItemDataPacket()); return std::make_shared<ComplexItemDataPacket>();
} }
virtual int getId() { return 131; } virtual int getId() { return 131; }
}; };

View file

@ -26,7 +26,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerAckPacket()); return std::make_shared<ContainerAckPacket>();
} }
virtual int getId() { return 106; } virtual int getId() { return 106; }
}; };

View file

@ -22,7 +22,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerButtonClickPacket()); return std::make_shared<ContainerButtonClickPacket>();
} }
virtual int getId() { return 108; } virtual int getId() { return 108; }
}; };

View file

@ -31,7 +31,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerClickPacket()); return std::make_shared<ContainerClickPacket>();
} }
virtual int getId() { return 102; } virtual int getId() { return 102; }
}; };

View file

@ -21,7 +21,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerClosePacket()); return std::make_shared<ContainerClosePacket>();
} }
virtual int getId() { return 101; } virtual int getId() { return 101; }
}; };

View file

@ -54,7 +54,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerOpenPacket()); return std::make_shared<ContainerOpenPacket>();
} }
virtual int getId() { return 100; } virtual int getId() { return 100; }
}; };

View file

@ -28,7 +28,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerSetContentPacket()); return std::make_shared<ContainerSetContentPacket>();
} }
virtual int getId() { return 104; } virtual int getId() { return 104; }
}; };

View file

@ -23,7 +23,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerSetDataPacket()); return std::make_shared<ContainerSetDataPacket>();
} }
virtual int getId() { return 105; } virtual int getId() { return 105; }
}; };

View file

@ -30,7 +30,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ContainerSetSlotPacket()); return std::make_shared<ContainerSetSlotPacket>();
} }
virtual int getId() { return 103; } virtual int getId() { return 103; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new CraftItemPacket()); return std::make_shared<CraftItemPacket>();
} }
virtual int getId() { return 150; } virtual int getId() { return 150; }
}; };

View file

@ -37,7 +37,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new CustomPayloadPacket()); return std::make_shared<CustomPayloadPacket>();
} }
virtual int getId() { return 250; } virtual int getId() { return 250; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new DebugOptionsPacket()); return std::make_shared<DebugOptionsPacket>();
} }
virtual int getId() { return 152; } virtual int getId() { return 152; }
}; };

View file

@ -57,7 +57,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new DisconnectPacket()); return std::make_shared<DisconnectPacket>();
} }
virtual int getId() { return 255; } virtual int getId() { return 255; }
}; };

View file

@ -25,7 +25,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new EntityActionAtPositionPacket()); return std::make_shared<EntityActionAtPositionPacket>();
} }
virtual int getId() { return 17; } virtual int getId() { return 17; }
}; };

View file

@ -23,7 +23,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new EntityEventPacket()); return std::make_shared<EntityEventPacket>();
} }
virtual int getId() { return 38; } virtual int getId() { return 38; }
}; };

View file

@ -44,7 +44,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ExplodePacket()); return std::make_shared<ExplodePacket>();
} }
virtual int getId() { return 60; } virtual int getId() { return 60; }
}; };

View file

@ -28,7 +28,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new GameCommandPacket()); return std::make_shared<GameCommandPacket>();
} }
virtual int getId() { return 167; } virtual int getId() { return 167; }
}; };

View file

@ -38,7 +38,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new GameEventPacket()); return std::make_shared<GameEventPacket>();
} }
virtual int getId() { return 70; } virtual int getId() { return 70; }
}; };

View file

@ -15,7 +15,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new GetInfoPacket()); return std::make_shared<GetInfoPacket>();
} }
virtual int getId() { return 254; } virtual int getId() { return 254; }
}; };

View file

@ -23,7 +23,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new InteractPacket()); return std::make_shared<InteractPacket>();
} }
virtual int getId() { return 7; } virtual int getId() { return 7; }
}; };

View file

@ -23,7 +23,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new KeepAlivePacket()); return std::make_shared<KeepAlivePacket>();
} }
virtual int getId() { return 0; } virtual int getId() { return 0; }
}; };

View file

@ -21,7 +21,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new KickPlayerPacket()); return std::make_shared<KickPlayerPacket>();
} }
virtual int getId() { return 159; } virtual int getId() { return 159; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new LevelEventPacket()); return std::make_shared<LevelEventPacket>();
} }
virtual int getId() { return 61; } virtual int getId() { return 61; }
}; };

View file

@ -42,7 +42,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new LevelParticlesPacket()); return std::make_shared<LevelParticlesPacket>();
} }
virtual int getId() { return 63; } virtual int getId() { return 63; }
}; };

View file

@ -38,7 +38,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new LevelSoundPacket()); return std::make_shared<LevelSoundPacket>();
} }
virtual int getId() { return 62; } virtual int getId() { return 62; }
}; };

View file

@ -57,7 +57,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new LoginPacket()); return std::make_shared<LoginPacket>();
} }
virtual int getId() { return 1; } virtual int getId() { return 1; }
}; };

View file

@ -29,7 +29,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacket()); return std::make_shared<MoveEntityPacket>();
} }
virtual int getId() { return 30; } virtual int getId() { return 30; }
}; };
@ -45,7 +45,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacket::PosRot()); return std::make_shared<MoveEntityPacket::PosRot>();
} }
virtual int getId() { return 33; } virtual int getId() { return 33; }
}; };
@ -61,7 +61,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacket::Pos()); return std::make_shared<MoveEntityPacket::Pos>();
} }
virtual int getId() { return 31; } virtual int getId() { return 31; }
}; };
@ -77,7 +77,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacket::Rot()); return std::make_shared<MoveEntityPacket::Rot>();
} }
virtual int getId() { return 32; } virtual int getId() { return 32; }
}; };

View file

@ -30,7 +30,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacketSmall()); return std::make_shared<MoveEntityPacketSmall>();
} }
virtual int getId() { return 162; } virtual int getId() { return 162; }
}; };
@ -46,7 +46,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacketSmall::PosRot()); return std::make_shared<MoveEntityPacketSmall::PosRot>();
} }
virtual int getId() { return 165; } virtual int getId() { return 165; }
}; };
@ -62,7 +62,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacketSmall::Pos()); return std::make_shared<MoveEntityPacketSmall::Pos>();
} }
virtual int getId() { return 163; } virtual int getId() { return 163; }
}; };
@ -78,7 +78,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MoveEntityPacketSmall::Rot()); return std::make_shared<MoveEntityPacketSmall::Rot>();
} }
virtual int getId() { return 164; } virtual int getId() { return 164; }
}; };

View file

@ -30,7 +30,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MovePlayerPacket()); return std::make_shared<MovePlayerPacket>();
} }
virtual int getId() { return 10; } virtual int getId() { return 10; }
}; };
@ -47,7 +47,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MovePlayerPacket::PosRot()); return std::make_shared<MovePlayerPacket::PosRot>();
} }
virtual int getId() { return 13; } virtual int getId() { return 13; }
}; };
@ -64,7 +64,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MovePlayerPacket::Pos()); return std::make_shared<MovePlayerPacket::Pos>();
} }
virtual int getId() { return 11; } virtual int getId() { return 11; }
}; };
@ -80,7 +80,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new MovePlayerPacket::Rot()); return std::make_shared<MovePlayerPacket::Rot>();
} }
virtual int getId() { return 12; } virtual int getId() { return 12; }
}; };

View file

@ -671,7 +671,7 @@ std::shared_ptr<ItemInstance> Packet::readItem(DataInputStream* dis) {
int damage = dis->readShort(); int damage = dis->readShort();
item = item =
std::shared_ptr<ItemInstance>(new ItemInstance(id, count, damage)); std::make_shared<ItemInstance>(id, count, damage);
// 4J Stu - Always read/write the tag // 4J Stu - Always read/write the tag
// if (Item.items[id].canBeDepleted() || // if (Item.items[id].canBeDepleted() ||
// Item.items[id].shouldOverrideMultiplayerNBT()) // Item.items[id].shouldOverrideMultiplayerNBT())

View file

@ -49,7 +49,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PlayerAbilitiesPacket()); return std::make_shared<PlayerAbilitiesPacket>();
} }
virtual int getId() { return 202; } virtual int getId() { return 202; }
}; };

View file

@ -28,7 +28,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PlayerActionPacket()); return std::make_shared<PlayerActionPacket>();
} }
virtual int getId() { return 14; } virtual int getId() { return 14; }
}; };

View file

@ -43,7 +43,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PlayerCommandPacket()); return std::make_shared<PlayerCommandPacket>();
} }
virtual int getId() { return 19; } virtual int getId() { return 19; }
}; };

View file

@ -33,7 +33,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PlayerInfoPacket()); return std::make_shared<PlayerInfoPacket>();
} }
virtual int getId() { return 201; } virtual int getId() { return 201; }
}; };

View file

@ -31,7 +31,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PlayerInputPacket()); return std::make_shared<PlayerInputPacket>();
} }
virtual int getId() { return 27; } virtual int getId() { return 27; }
}; };

View file

@ -51,7 +51,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new PreLoginPacket()); return std::make_shared<PreLoginPacket>();
} }
virtual int getId() { return 2; } virtual int getId() { return 2; }
}; };

View file

@ -27,7 +27,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new RemoveEntitiesPacket()); return std::make_shared<RemoveEntitiesPacket>();
} }
virtual int getId() { return 29; } virtual int getId() { return 29; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new RemoveMobEffectPacket()); return std::make_shared<RemoveMobEffectPacket>();
} }
virtual int getId() { return 42; } virtual int getId() { return 42; }
}; };

View file

@ -36,7 +36,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new RespawnPacket()); return std::make_shared<RespawnPacket>();
} }
virtual int getId() { return 9; } virtual int getId() { return 9; }
}; };

View file

@ -26,7 +26,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new RotateHeadPacket()); return std::make_shared<RotateHeadPacket>();
} }
virtual int getId() { return 35; } virtual int getId() { return 35; }
}; };

View file

@ -29,7 +29,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new ServerSettingsChangedPacket()); return std::make_shared<ServerSettingsChangedPacket>();
} }
virtual int getId() { return 153; } virtual int getId() { return 153; }
}; };

View file

@ -23,7 +23,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetCarriedItemPacket()); return std::make_shared<SetCarriedItemPacket>();
} }
virtual int getId() { return 16; } virtual int getId() { return 16; }
}; };

View file

@ -24,7 +24,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetCreativeModeSlotPacket()); return std::make_shared<SetCreativeModeSlotPacket>();
} }
virtual int getId() { return 107; } virtual int getId() { return 107; }
}; };

View file

@ -25,7 +25,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetDisplayObjectivePacket()); return std::make_shared<SetDisplayObjectivePacket>();
} }
virtual int getId() { return 208; } virtual int getId() { return 208; }
}; };

View file

@ -32,7 +32,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetEntityDataPacket()); return std::make_shared<SetEntityDataPacket>();
} }
virtual int getId() { return 40; } virtual int getId() { return 40; }
}; };

View file

@ -30,7 +30,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetEntityLinkPacket()); return std::make_shared<SetEntityLinkPacket>();
} }
virtual int getId() { return 39; } virtual int getId() { return 39; }
}; };

View file

@ -32,7 +32,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetEntityMotionPacket()); return std::make_shared<SetEntityMotionPacket>();
} }
virtual int getId() { return 28; } virtual int getId() { return 28; }
}; };

View file

@ -38,7 +38,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetEquippedItemPacket()); return std::make_shared<SetEquippedItemPacket>();
} }
virtual int getId() { return 5; } virtual int getId() { return 5; }
}; };

View file

@ -26,7 +26,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetExperiencePacket()); return std::make_shared<SetExperiencePacket>();
} }
virtual int getId() { return 43; } virtual int getId() { return 43; }
}; };

View file

@ -28,7 +28,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetHealthPacket()); return std::make_shared<SetHealthPacket>();
} }
virtual int getId() { return 8; } virtual int getId() { return 8; }
}; };

View file

@ -29,7 +29,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetObjectivePacket()); return std::make_shared<SetObjectivePacket>();
} }
virtual int getId() { return 206; } virtual int getId() { return 206; }
}; };

View file

@ -39,7 +39,7 @@ public:
public: public:
static std::shared_ptr<Packet> create() { static std::shared_ptr<Packet> create() {
return std::shared_ptr<Packet>(new SetPlayerTeamPacket()); return std::make_shared<SetPlayerTeamPacket>();
} }
virtual int getId() { return 209; } virtual int getId() { return 209; }
}; };

Some files were not shown because too many files have changed in this diff Show more