mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-11 19:57:18 +00:00
refactor: replace shared_ptr(new T) with make_shared<T>
This commit is contained in:
parent
8b836cf604
commit
a18cb3d484
|
|
@ -3807,7 +3807,6 @@ int CMinecraftApp::UnlockFullInviteReturned(void* pParam, int iPad,
|
|||
if (ProfileManager.IsSignedInLive(iPad)) {
|
||||
// 4J-PB - need to check this user can access the store
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
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())) {
|
||||
// 4J-PB - need to check this user can access the store
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
false, pMinecraft->player->GetXboxPad(),
|
||||
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
|
||||
}
|
||||
|
|
@ -3844,7 +3842,6 @@ int CMinecraftApp::UnlockFullExitReturned(void* pParam, int iPad,
|
|||
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
|
||||
// 4J-PB - need to check this user can access the store
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
false, pMinecraft->player->GetXboxPad(),
|
||||
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
|
||||
}
|
||||
|
|
@ -3867,7 +3864,6 @@ int CMinecraftApp::TrialOverReturned(void* pParam, int iPad,
|
|||
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
|
||||
// 4J-PB - need to check this user can access the store
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
false, pMinecraft->player->GetXboxPad(),
|
||||
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
|
||||
}
|
||||
|
|
@ -4128,12 +4124,6 @@ void CMinecraftApp::NotificationsCallback(void* pParam,
|
|||
pClass->m_vNotifications.push_back(pNotification);
|
||||
}
|
||||
|
||||
void CMinecraftApp::UpsellReturnedCallback(void* pParam, EUpsellType type,
|
||||
EUpsellResponse result,
|
||||
int iUserData) {
|
||||
// 4jcraft: nuked
|
||||
}
|
||||
|
||||
#if defined(_DEBUG_MENUS_ENABLED)
|
||||
bool CMinecraftApp::DebugArtToolsOn() {
|
||||
return DebugSettingsOn() &&
|
||||
|
|
|
|||
|
|
@ -487,7 +487,6 @@ public:
|
|||
bool m_bChangingSessionType;
|
||||
bool m_bReallyChangingSessionType;
|
||||
|
||||
bool m_bDisplayFullVersionPurchase; // for after signing in during the
|
||||
// trial, and trying to unlock full
|
||||
// version on an upsell
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
false, iPad, /*eSen_UpsellID_Full_Version_Of_Game*/ 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -460,7 +460,6 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(
|
|||
if (ProfileManager.IsSignedInLive(pMinecraft->player->GetXboxPad())) {
|
||||
// 4J-PB - need to check this user can access the store
|
||||
{
|
||||
ProfileManager.DisplayFullVersionPurchase(
|
||||
false, pMinecraft->player->GetXboxPad(),
|
||||
/*eSen_UpsellID_Full_Version_Of_Game*/ 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -495,7 +495,6 @@ void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID,
|
|||
int iVal) {}
|
||||
void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence,
|
||||
bool bSetOthersToIdle) {}
|
||||
void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant,
|
||||
int iUpsellParam) {}
|
||||
void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam,
|
||||
EUpsellType type,
|
||||
|
|
|
|||
|
|
@ -3337,7 +3337,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
|||
// std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance(
|
||||
// level ));
|
||||
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,
|
||||
level->random->nextFloat() * 360, 0);
|
||||
level->addEntity(mob);
|
||||
|
|
|
|||
|
|
@ -171,9 +171,9 @@ void MerchantScreen::tick() {
|
|||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(currentRecipeIndex);
|
||||
minecraft->player->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
std::make_shared<CustomPayloadPacket>(
|
||||
CustomPayloadPacket::TRADER_SELECTION_PACKET,
|
||||
rawOutput.toByteArray())));
|
||||
rawOutput.toByteArray()));
|
||||
}
|
||||
} else {
|
||||
nextRecipeButton->active = false;
|
||||
|
|
@ -200,8 +200,8 @@ void MerchantScreen::buttonClicked(Button* button) {
|
|||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(currentRecipeIndex);
|
||||
minecraft->player->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
std::make_shared<CustomPayloadPacket>(
|
||||
CustomPayloadPacket::TRADER_SELECTION_PACKET,
|
||||
rawOutput.toByteArray())));
|
||||
rawOutput.toByteArray()));
|
||||
}
|
||||
}
|
||||
|
|
@ -160,8 +160,8 @@ void RepairScreen::updateItemName() {
|
|||
DataOutputStream dos(&baos);
|
||||
dos.writeUTF(itemName);
|
||||
Minecraft::GetInstance()->player->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||
std::make_shared<CustomPayloadPacket>(
|
||||
CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()));
|
||||
}
|
||||
|
||||
// 4jcraft: these 3 are to implement Containerlistener (see IUIScene_AnvilMenu
|
||||
|
|
|
|||
|
|
@ -162,11 +162,11 @@ void BeaconScreen::renderBg(float a) {
|
|||
// Render payment item icons
|
||||
itemRenderer->renderGuiItem(
|
||||
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);
|
||||
itemRenderer->renderGuiItem(
|
||||
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);
|
||||
itemRenderer->renderGuiItem(font, minecraft->textures,
|
||||
std::shared_ptr<ItemInstance>(
|
||||
|
|
@ -206,8 +206,8 @@ void BeaconScreen::buttonClicked(Button* button) {
|
|||
dos.writeInt(beacon->getSecondaryPower());
|
||||
|
||||
minecraft->player->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray())));
|
||||
std::make_shared<CustomPayloadPacket>(
|
||||
CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray()));
|
||||
minecraft->player->closeContainer();
|
||||
} else if (dynamic_cast<BeaconPowerButton*>(button)) {
|
||||
int effectId = button->id & 255;
|
||||
|
|
|
|||
|
|
@ -390,10 +390,10 @@ void ClientConnection::handleAddEntity(
|
|||
packet->data = 0;
|
||||
} break;
|
||||
case AddEntityPacket::ARROW:
|
||||
e = std::shared_ptr<Entity>(new Arrow(level, x, y, z));
|
||||
e = std::make_shared<Arrow>(level, x, y, z);
|
||||
break;
|
||||
case AddEntityPacket::SNOWBALL:
|
||||
e = std::shared_ptr<Entity>(new Snowball(level, x, y, z));
|
||||
e = std::make_shared<Snowball>(level, x, y, z);
|
||||
break;
|
||||
case AddEntityPacket::ITEM_FRAME: {
|
||||
int ix = (int)x;
|
||||
|
|
@ -408,10 +408,10 @@ void ClientConnection::handleAddEntity(
|
|||
setRot = false;
|
||||
break;
|
||||
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;
|
||||
case AddEntityPacket::EYEOFENDERSIGNAL:
|
||||
e = std::shared_ptr<Entity>(new EyeOfEnderSignal(level, x, y, z));
|
||||
e = std::make_shared<EyeOfEnderSignal>(level, x, y, z);
|
||||
break;
|
||||
case AddEntityPacket::FIREBALL:
|
||||
e = std::shared_ptr<Entity>(
|
||||
|
|
@ -432,7 +432,7 @@ void ClientConnection::handleAddEntity(
|
|||
packet->data = 0;
|
||||
break;
|
||||
case AddEntityPacket::EGG:
|
||||
e = std::shared_ptr<Entity>(new ThrownEgg(level, x, y, z));
|
||||
e = std::make_shared<ThrownEgg>(level, x, y, z);
|
||||
break;
|
||||
case AddEntityPacket::THROWN_POTION:
|
||||
e = std::shared_ptr<Entity>(
|
||||
|
|
@ -440,24 +440,24 @@ void ClientConnection::handleAddEntity(
|
|||
packet->data = 0;
|
||||
break;
|
||||
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;
|
||||
break;
|
||||
case AddEntityPacket::BOAT:
|
||||
e = std::shared_ptr<Entity>(new Boat(level, x, y, z));
|
||||
e = std::make_shared<Boat>(level, x, y, z);
|
||||
break;
|
||||
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;
|
||||
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;
|
||||
case AddEntityPacket::ITEM:
|
||||
e = std::shared_ptr<Entity>(new ItemEntity(level, x, y, z));
|
||||
e = std::make_shared<ItemEntity>(level, x, y, z);
|
||||
break;
|
||||
case AddEntityPacket::FALLING:
|
||||
e = std::shared_ptr<Entity>(new FallingTile(
|
||||
level, x, y, z, packet->data & 0xFFFF, packet->data >> 16));
|
||||
e = std::make_shared<FallingTile>(
|
||||
level, x, y, z, packet->data & 0xFFFF, packet->data >> 16);
|
||||
packet->data = 0;
|
||||
break;
|
||||
case AddEntityPacket::WITHER_SKULL:
|
||||
|
|
@ -667,7 +667,7 @@ void ClientConnection::handleAddGlobalEntity(
|
|||
double z = packet->z / 32.0;
|
||||
std::shared_ptr<Entity> e; // = nullptr;
|
||||
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) {
|
||||
e->xp = packet->x;
|
||||
e->yp = packet->y;
|
||||
|
|
@ -681,8 +681,8 @@ void ClientConnection::handleAddGlobalEntity(
|
|||
|
||||
void ClientConnection::handleAddPainting(
|
||||
std::shared_ptr<AddPaintingPacket> packet) {
|
||||
std::shared_ptr<Painting> painting = std::shared_ptr<Painting>(new Painting(
|
||||
level, packet->x, packet->y, packet->z, packet->dir, packet->motive));
|
||||
std::shared_ptr<Painting> painting = std::make_shared<Painting>(
|
||||
level, packet->x, packet->y, packet->z, packet->dir, packet->motive);
|
||||
level->putEntity(packet->id, painting);
|
||||
}
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ void ClientConnection::handleAddPlayer(
|
|||
std::shared_ptr<ItemInstance>(); // nullptr;
|
||||
} else {
|
||||
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);
|
||||
|
||||
|
|
@ -1934,12 +1934,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
|
|||
minecraft->user->name.c_str(),
|
||||
SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex,
|
||||
(int)g_NetworkManager.IsHost());
|
||||
send(std::shared_ptr<LoginPacket>(new LoginPacket(
|
||||
send(std::make_shared<LoginPacket>(
|
||||
minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION,
|
||||
offlineXUID, onlineXUID, (!allAllowed && friendsAllowed),
|
||||
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex),
|
||||
app.GetPlayerCapeId(m_userIndex),
|
||||
ProfileManager.IsGuest(m_userIndex))));
|
||||
ProfileManager.IsGuest(m_userIndex)));
|
||||
fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n");
|
||||
|
||||
if (!g_NetworkManager.IsHost()) {
|
||||
|
|
@ -2519,7 +2519,7 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::HOPPER: {
|
||||
std::shared_ptr<HopperTileEntity> hopper =
|
||||
std::shared_ptr<HopperTileEntity>(new HopperTileEntity());
|
||||
std::make_shared<HopperTileEntity>();
|
||||
if (packet->customName) hopper->setCustomName(packet->title);
|
||||
if (player->openHopper(hopper)) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
|
|
@ -2529,7 +2529,7 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::FURNACE: {
|
||||
std::shared_ptr<FurnaceTileEntity> furnace =
|
||||
std::shared_ptr<FurnaceTileEntity>(new FurnaceTileEntity());
|
||||
std::make_shared<FurnaceTileEntity>();
|
||||
if (packet->customName) furnace->setCustomName(packet->title);
|
||||
if (player->openFurnace(furnace)) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
|
|
@ -2551,7 +2551,7 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::DROPPER: {
|
||||
std::shared_ptr<DropperTileEntity> dropper =
|
||||
std::shared_ptr<DropperTileEntity>(new DropperTileEntity());
|
||||
std::make_shared<DropperTileEntity>();
|
||||
if (packet->customName) dropper->setCustomName(packet->title);
|
||||
|
||||
if (player->openTrap(dropper)) {
|
||||
|
|
@ -2562,7 +2562,7 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::TRAP: {
|
||||
std::shared_ptr<DispenserTileEntity> dispenser =
|
||||
std::shared_ptr<DispenserTileEntity>(new DispenserTileEntity());
|
||||
std::make_shared<DispenserTileEntity>();
|
||||
if (packet->customName) dispenser->setCustomName(packet->title);
|
||||
|
||||
if (player->openTrap(dispenser)) {
|
||||
|
|
@ -2604,7 +2604,7 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::BEACON: {
|
||||
std::shared_ptr<BeaconTileEntity> beacon =
|
||||
std::shared_ptr<BeaconTileEntity>(new BeaconTileEntity());
|
||||
std::make_shared<BeaconTileEntity>();
|
||||
if (packet->customName) beacon->setCustomName(packet->title);
|
||||
|
||||
if (player->openBeacon(beacon)) {
|
||||
|
|
@ -2715,8 +2715,8 @@ void ClientConnection::handleContainerAck(
|
|||
}
|
||||
if (menu != nullptr) {
|
||||
if (!packet->accepted) {
|
||||
send(std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
|
||||
packet->containerId, packet->uid, true)));
|
||||
send(std::make_shared<ContainerAckPacket>(
|
||||
packet->containerId, packet->uid, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2740,7 +2740,7 @@ void ClientConnection::handleTileEditorOpen(
|
|||
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
|
||||
} else if (packet->editorType == TileEditorOpenPacket::SIGN) {
|
||||
std::shared_ptr<SignTileEntity> localSignDummy =
|
||||
std::shared_ptr<SignTileEntity>(new SignTileEntity());
|
||||
std::make_shared<SignTileEntity>();
|
||||
localSignDummy->setLevel(level);
|
||||
localSignDummy->x = packet->x;
|
||||
localSignDummy->y = packet->y;
|
||||
|
|
@ -3183,7 +3183,7 @@ void ClientConnection::displayPrivilegeChanges(
|
|||
|
||||
void ClientConnection::handleKeepAlive(
|
||||
std::shared_ptr<KeepAlivePacket> packet) {
|
||||
send(std::shared_ptr<KeepAlivePacket>(new KeepAlivePacket(packet->id)));
|
||||
send(std::make_shared<KeepAlivePacket>(packet->id));
|
||||
}
|
||||
|
||||
void ClientConnection::handlePlayerAbilities(
|
||||
|
|
|
|||
|
|
@ -113,20 +113,20 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) {
|
|||
|
||||
if (localPlayerMode->isCreative()) {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)));
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
||||
destroyDelay = 5;
|
||||
} else if (!isDestroying || !sameDestroyTarget(x, y, z)) {
|
||||
if (isDestroying) {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock,
|
||||
yDestroyBlock, zDestroyBlock, face)));
|
||||
yDestroyBlock, zDestroyBlock, face));
|
||||
}
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)));
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||
int t = minecraft->level->getTile(x, y, z);
|
||||
if (t > 0 && destroyProgress == 0)
|
||||
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() {
|
||||
if (isDestroying) {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock,
|
||||
yDestroyBlock, zDestroyBlock, -1)));
|
||||
yDestroyBlock, zDestroyBlock, -1));
|
||||
}
|
||||
|
||||
isDestroying = false;
|
||||
|
|
@ -183,8 +183,8 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) {
|
|||
if (localPlayerMode->isCreative()) {
|
||||
destroyDelay = 5;
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)));
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
||||
return;
|
||||
}
|
||||
|
|
@ -216,8 +216,8 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) {
|
|||
if (destroyProgress >= 1) {
|
||||
isDestroying = false;
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face)));
|
||||
std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face));
|
||||
destroyBlock(x, y, z, face);
|
||||
destroyProgress = 0;
|
||||
destroyTicks = 0;
|
||||
|
|
@ -406,31 +406,31 @@ bool MultiPlayerGameMode::useItem(std::shared_ptr<Player> player, Level* level,
|
|||
}
|
||||
|
||||
if (!bTestUseOnly) {
|
||||
connection->send(std::shared_ptr<UseItemPacket>(new UseItemPacket(
|
||||
-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0)));
|
||||
connection->send(std::make_shared<UseItemPacket>(
|
||||
-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<MultiplayerLocalPlayer> MultiPlayerGameMode::createPlayer(
|
||||
Level* level) {
|
||||
return std::shared_ptr<MultiplayerLocalPlayer>(new MultiplayerLocalPlayer(
|
||||
minecraft, level, minecraft->user, connection));
|
||||
return std::make_shared<MultiplayerLocalPlayer>(
|
||||
minecraft, level, minecraft->user, connection);
|
||||
}
|
||||
|
||||
void MultiPlayerGameMode::attack(std::shared_ptr<Player> player,
|
||||
std::shared_ptr<Entity> entity) {
|
||||
ensureHasSentCarriedItem();
|
||||
connection->send(std::shared_ptr<InteractPacket>(new InteractPacket(
|
||||
player->entityId, entity->entityId, InteractPacket::ATTACK)));
|
||||
connection->send(std::make_shared<InteractPacket>(
|
||||
player->entityId, entity->entityId, InteractPacket::ATTACK));
|
||||
player->attack(entity);
|
||||
}
|
||||
|
||||
bool MultiPlayerGameMode::interact(std::shared_ptr<Player> player,
|
||||
std::shared_ptr<Entity> entity) {
|
||||
ensureHasSentCarriedItem();
|
||||
connection->send(std::shared_ptr<InteractPacket>(new InteractPacket(
|
||||
player->entityId, entity->entityId, InteractPacket::INTERACT)));
|
||||
connection->send(std::make_shared<InteractPacket>(
|
||||
player->entityId, entity->entityId, InteractPacket::INTERACT));
|
||||
return player->interact(entity);
|
||||
}
|
||||
|
||||
|
|
@ -475,8 +475,8 @@ void MultiPlayerGameMode::handleCreativeModeItemDrop(
|
|||
|
||||
void MultiPlayerGameMode::releaseUsingItem(std::shared_ptr<Player> player) {
|
||||
ensureHasSentCarriedItem();
|
||||
connection->send(std::shared_ptr<PlayerActionPacket>(new PlayerActionPacket(
|
||||
PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255)));
|
||||
connection->send(std::make_shared<PlayerActionPacket>(
|
||||
PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255));
|
||||
player->releaseUsingItem();
|
||||
}
|
||||
|
||||
|
|
@ -517,5 +517,5 @@ void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal,
|
|||
std::shared_ptr<Player> player) {
|
||||
player->SetDebugOptions(uiVal);
|
||||
connection->send(
|
||||
std::shared_ptr<DebugOptionsPacket>(new DebugOptionsPacket(uiVal)));
|
||||
std::make_shared<DebugOptionsPacket>(uiVal));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile,
|
|||
MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
|
||||
LevelSettings* levelSettings, int dimension,
|
||||
int difficulty)
|
||||
: Level(std::shared_ptr<MockedLevelStorage>(new MockedLevelStorage()),
|
||||
: Level(std::make_shared<MockedLevelStorage>(),
|
||||
L"MpServer", Dimension::getNew(dimension), levelSettings, false) {
|
||||
minecraft = Minecraft::GetInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@ void MultiplayerLocalPlayer::tick() {
|
|||
tempX, tempY, tempZ, x, y, z)) {
|
||||
if (isRiding()) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot(
|
||||
yRot, xRot, onGround, abilities.flying)));
|
||||
std::make_shared<MovePlayerPacket::Rot>(
|
||||
yRot, xRot, onGround, abilities.flying));
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerInputPacket>(new PlayerInputPacket(
|
||||
xxa, yya, input->jumping, input->sneaking)));
|
||||
std::make_shared<PlayerInputPacket>(
|
||||
xxa, yya, input->jumping, input->sneaking));
|
||||
} else {
|
||||
sendPosition();
|
||||
}
|
||||
|
|
@ -101,12 +101,12 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
if (sprinting != lastSprinting) {
|
||||
if (sprinting)
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::START_SPRINTING)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::START_SPRINTING));
|
||||
else
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SPRINTING)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SPRINTING));
|
||||
|
||||
lastSprinting = sprinting;
|
||||
}
|
||||
|
|
@ -115,12 +115,12 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
if (sneaking != lastSneaked) {
|
||||
if (sneaking)
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::START_SNEAKING)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::START_SNEAKING));
|
||||
else
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SNEAKING)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SNEAKING));
|
||||
|
||||
lastSneaked = sneaking;
|
||||
}
|
||||
|
|
@ -129,12 +129,12 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
if (idle != lastIdle) {
|
||||
if (idle)
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::START_IDLEANIM)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::START_IDLEANIM));
|
||||
else
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM));
|
||||
|
||||
lastIdle = idle;
|
||||
}
|
||||
|
|
@ -151,22 +151,22 @@ void MultiplayerLocalPlayer::sendPosition() {
|
|||
bool rot = rydd != 0 || rxdd != 0;
|
||||
if (riding != nullptr) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot(
|
||||
xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying)));
|
||||
std::make_shared<MovePlayerPacket::PosRot>(
|
||||
xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying));
|
||||
move = false;
|
||||
} else {
|
||||
if (move && rot) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot(
|
||||
x, bb.y0, y, z, yRot, xRot, onGround, abilities.flying)));
|
||||
std::make_shared<MovePlayerPacket::PosRot>(
|
||||
x, bb.y0, y, z, yRot, xRot, onGround, abilities.flying));
|
||||
} else if (move) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Pos(
|
||||
x, bb.y0, y, z, onGround, abilities.flying)));
|
||||
std::make_shared<MovePlayerPacket::Pos>(
|
||||
x, bb.y0, y, z, onGround, abilities.flying));
|
||||
} else if (rot) {
|
||||
connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot(
|
||||
yRot, xRot, onGround, abilities.flying)));
|
||||
std::make_shared<MovePlayerPacket::Rot>(
|
||||
yRot, xRot, onGround, abilities.flying));
|
||||
} else {
|
||||
connection->send(std::shared_ptr<MovePlayerPacket>(
|
||||
new MovePlayerPacket(onGround, abilities.flying)));
|
||||
|
|
@ -199,7 +199,7 @@ void MultiplayerLocalPlayer::reallyDrop(
|
|||
std::shared_ptr<ItemEntity> itemEntity) {}
|
||||
|
||||
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() {
|
||||
|
|
@ -313,15 +313,15 @@ bool MultiplayerLocalPlayer::isLocalPlayer() { return true; }
|
|||
|
||||
void MultiplayerLocalPlayer::sendRidingJump() {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::RIDING_JUMP,
|
||||
(int)(getJumpRidingScale() * 100.0f))));
|
||||
(int)(getJumpRidingScale() * 100.0f)));
|
||||
}
|
||||
|
||||
void MultiplayerLocalPlayer::sendOpenInventory() {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY));
|
||||
}
|
||||
|
||||
void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) {
|
||||
|
|
@ -353,8 +353,8 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr<Entity> e) {
|
|||
|
||||
void MultiplayerLocalPlayer::StopSleeping() {
|
||||
connection->send(
|
||||
std::shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SLEEPING)));
|
||||
std::make_shared<PlayerCommandPacket>(
|
||||
shared_from_this(), PlayerCommandPacket::STOP_SLEEPING));
|
||||
}
|
||||
|
||||
// 4J Added
|
||||
|
|
@ -380,9 +380,9 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) {
|
|||
#endif
|
||||
if (getCustomCape() != oldCapeIndex)
|
||||
connection->send(
|
||||
std::shared_ptr<TextureChangePacket>(new TextureChangePacket(
|
||||
std::make_shared<TextureChangePacket>(
|
||||
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
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void ReceivingLevelScreen::tick() {
|
|||
tickCount++;
|
||||
if (tickCount % 20 == 0) {
|
||||
connection->send(
|
||||
std::shared_ptr<KeepAlivePacket>(new KeepAlivePacket()));
|
||||
std::make_shared<KeepAlivePacket>());
|
||||
}
|
||||
if (connection != nullptr) {
|
||||
connection->tick();
|
||||
|
|
|
|||
|
|
@ -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 zp = z + (zz + 0.5) / SD;
|
||||
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,
|
||||
zp - z - 0.5f, tile, face, data, textures)))
|
||||
zp - z - 0.5f, tile, face, data, textures))
|
||||
->init(x, y, z, data));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -745,8 +745,8 @@ void LocalPlayer::magicCrit(std::shared_ptr<Entity> e) {
|
|||
|
||||
void LocalPlayer::take(std::shared_ptr<Entity> e, int orgCount) {
|
||||
minecraft->particleEngine->add(
|
||||
std::shared_ptr<TakeAnimationParticle>(new TakeAnimationParticle(
|
||||
(Level*)minecraft->level, e, shared_from_this(), -0.5f)));
|
||||
std::make_shared<TakeAnimationParticle>(
|
||||
(Level*)minecraft->level, e, shared_from_this(), -0.5f));
|
||||
}
|
||||
|
||||
void LocalPlayer::chat(const std::wstring& message) {}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
EntityTileRenderer* EntityTileRenderer::instance = new EntityTileRenderer;
|
||||
|
||||
EntityTileRenderer::EntityTileRenderer() {
|
||||
chest = std::shared_ptr<ChestTileEntity>(new ChestTileEntity());
|
||||
chest = std::make_shared<ChestTileEntity>();
|
||||
trappedChest = std::shared_ptr<ChestTileEntity>(
|
||||
new ChestTileEntity(ChestTile::TYPE_TRAP));
|
||||
enderChest =
|
||||
std::shared_ptr<EnderChestTileEntity>(new EnderChestTileEntity());
|
||||
std::make_shared<EnderChestTileEntity>();
|
||||
}
|
||||
|
||||
void EntityTileRenderer::render(Tile* tile, int data, float brightness,
|
||||
|
|
|
|||
|
|
@ -1544,10 +1544,10 @@ void GameRenderer::tickRain() {
|
|||
if (t > 0) {
|
||||
if (Tile::tiles[t]->material == Material::lava) {
|
||||
mc->particleEngine->add(
|
||||
std::shared_ptr<SmokeParticle>(new SmokeParticle(
|
||||
std::make_shared<SmokeParticle>(
|
||||
level, x + xa,
|
||||
y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0,
|
||||
0, 0)));
|
||||
0, 0));
|
||||
} else {
|
||||
if (random->nextInt(++rainPosSamples) == 0) {
|
||||
rainPosX = x + xa;
|
||||
|
|
|
|||
|
|
@ -3079,7 +3079,7 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
|
|||
break;
|
||||
case eParticleType_lava:
|
||||
particle =
|
||||
std::shared_ptr<Particle>(new LavaParticle(lev, x, y, z));
|
||||
std::make_shared<LavaParticle>(lev, x, y, z);
|
||||
break;
|
||||
case eParticleType_footstep:
|
||||
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));
|
||||
break;
|
||||
case eParticleType_reddust:
|
||||
particle = std::shared_ptr<Particle>(new RedDustParticle(
|
||||
lev, x, y, z, (float)xa, (float)ya, (float)za));
|
||||
particle = std::make_shared<RedDustParticle>(
|
||||
lev, x, y, z, (float)xa, (float)ya, (float)za);
|
||||
break;
|
||||
case eParticleType_snowballpoof:
|
||||
particle = std::shared_ptr<Particle>(new BreakingItemParticle(
|
||||
lev, x, y, z, Item::snowBall, textures));
|
||||
particle = std::make_shared<BreakingItemParticle>(
|
||||
lev, x, y, z, Item::snowBall, textures);
|
||||
break;
|
||||
case eParticleType_dripWater:
|
||||
particle = std::shared_ptr<Particle>(
|
||||
|
|
@ -3114,8 +3114,8 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
|
|||
new SnowShovelParticle(lev, x, y, z, xa, ya, za));
|
||||
break;
|
||||
case eParticleType_slime:
|
||||
particle = std::shared_ptr<Particle>(new BreakingItemParticle(
|
||||
lev, x, y, z, Item::slimeBall, textures));
|
||||
particle = std::make_shared<BreakingItemParticle>(
|
||||
lev, x, y, z, Item::slimeBall, textures);
|
||||
break;
|
||||
case eParticleType_heart:
|
||||
particle = std::shared_ptr<Particle>(
|
||||
|
|
@ -3142,8 +3142,8 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
|
|||
(eParticleType <= eParticleType_iconcrack_last)) {
|
||||
int id = PARTICLE_CRACK_ID(eParticleType),
|
||||
data = PARTICLE_CRACK_DATA(eParticleType);
|
||||
particle = std::shared_ptr<Particle>(new BreakingItemParticle(
|
||||
lev, x, y, z, xa, ya, za, Item::items[id], textures, data));
|
||||
particle = std::make_shared<BreakingItemParticle>(
|
||||
lev, x, y, z, xa, ya, za, Item::items[id], textures, data);
|
||||
} else if ((eParticleType >= eParticleType_tilecrack_base) &&
|
||||
(eParticleType <= eParticleType_tilecrack_last)) {
|
||||
int id = PARTICLE_CRACK_ID(eParticleType),
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ bool b2 = !mob->isCapeHidden();*/
|
|||
glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f);
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void SnowManRenderer::additionalRendering(std::shared_ptr<LivingEntity> _mob,
|
|||
|
||||
MobRenderer::additionalRendering(mob, a);
|
||||
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) {
|
||||
glPushMatrix();
|
||||
model->head->translateTo(1 / 16.0f);
|
||||
|
|
|
|||
|
|
@ -402,8 +402,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
|||
new McRegionLevelStorage(newFormatSave, File(L"."), name, true));
|
||||
#else
|
||||
storage =
|
||||
std::shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(
|
||||
new ConsoleSaveFileOriginal(L""), File(L"."), name, true));
|
||||
std::make_shared<McRegionLevelStorage>(
|
||||
new ConsoleSaveFileOriginal(L""), File(L"."), name, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1434,10 +1434,10 @@ void MinecraftServer::tick() {
|
|||
|
||||
if (tickCount % 20 == 0) {
|
||||
players->broadcastAll(
|
||||
std::shared_ptr<SetTimePacket>(new SetTimePacket(
|
||||
std::make_shared<SetTimePacket>(
|
||||
level->getGameTime(), level->getDayTime(),
|
||||
level->getGameRules()->getBoolean(
|
||||
GameRules::RULE_DAYLIGHT))),
|
||||
GameRules::RULE_DAYLIGHT)),
|
||||
level->dimension->id);
|
||||
}
|
||||
// #ifndef 0
|
||||
|
|
|
|||
|
|
@ -129,10 +129,10 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
|||
#endif
|
||||
// 4J Added - Give every player a map the first time they join a server
|
||||
player->inventory->setItem(
|
||||
9, std::shared_ptr<ItemInstance>(new ItemInstance(
|
||||
9, std::make_shared<ItemInstance>(
|
||||
Item::map_Id, 1,
|
||||
level->getAuxValueForMap(player->getXuid(), 0, centreXC,
|
||||
centreZC, mapScale))));
|
||||
centreZC, mapScale)));
|
||||
if (app.getGameRuleDefinitions() != nullptr) {
|
||||
app.getGameRuleDefinitions()->postProcessPlayer(player);
|
||||
}
|
||||
|
|
@ -199,8 +199,8 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
|||
}
|
||||
|
||||
// std::shared_ptr<PlayerConnection> playerConnection =
|
||||
// std::shared_ptr<PlayerConnection>(new PlayerConnection(server,
|
||||
// connection, player));
|
||||
// std::make_shared<PlayerConnection>(server,
|
||||
// connection, player);
|
||||
player->connection =
|
||||
playerConnection; // Used to be assigned in PlayerConnection ctor but
|
||||
// moved out so we can use std::shared_ptr
|
||||
|
|
@ -216,7 +216,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
|||
|
||||
addPlayerToReceiving(player);
|
||||
|
||||
playerConnection->send(std::shared_ptr<LoginPacket>(new LoginPacket(
|
||||
playerConnection->send(std::make_shared<LoginPacket>(
|
||||
L"", player->entityId, level->getLevelData()->getGenerator(),
|
||||
level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
|
||||
(uint8_t)level->dimension->id, (uint8_t)level->getMaxBuildHeight(),
|
||||
|
|
@ -225,7 +225,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
|||
(uint8_t)playerIndex, level->useNewSeaLevel(),
|
||||
player->getAllPlayerGamePrivileges(),
|
||||
level->getLevelData()->getXZSize(),
|
||||
level->getLevelData()->getHellScale())));
|
||||
level->getLevelData()->getHellScale()));
|
||||
playerConnection->send(std::shared_ptr<SetSpawnPositionPacket>(
|
||||
new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z)));
|
||||
playerConnection->send(std::shared_ptr<PlayerAbilitiesPacket>(
|
||||
|
|
@ -255,9 +255,9 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
|||
player->xRot);
|
||||
|
||||
server->getConnection()->addPlayerConnection(playerConnection);
|
||||
playerConnection->send(std::shared_ptr<SetTimePacket>(new SetTimePacket(
|
||||
playerConnection->send(std::make_shared<SetTimePacket>(
|
||||
level->getGameTime(), level->getDayTime(),
|
||||
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))));
|
||||
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
|
||||
|
||||
auto activeEffects = player->getActiveEffects();
|
||||
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) ) );
|
||||
if (player->connection->getNetworkPlayer()) {
|
||||
broadcastAll(
|
||||
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(player)));
|
||||
std::make_shared<PlayerInfoPacket>(player));
|
||||
}
|
||||
|
||||
players.push_back(player);
|
||||
|
|
@ -472,7 +472,7 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
|
|||
// PlayerInfoPacket(op->name, true, op->latency) ) );
|
||||
if (op->connection->getNetworkPlayer()) {
|
||||
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)
|
||||
firstSleepingPlayer = thisPlayer;
|
||||
thisPlayer->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
thisPlayer->name, ChatPacket::e_ChatBedMeSleep)));
|
||||
std::make_shared<ChatPacket>(
|
||||
thisPlayer->name, ChatPacket::e_ChatBedMeSleep));
|
||||
}
|
||||
}
|
||||
player->connection->send(std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep)));
|
||||
player->connection->send(std::make_shared<ChatPacket>(
|
||||
firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -714,8 +714,8 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
|
|||
player->setRespawnPosition(bedPosition, spawnForced);
|
||||
} else {
|
||||
player->connection->send(
|
||||
std::shared_ptr<GameEventPacket>(new GameEventPacket(
|
||||
GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0)));
|
||||
std::make_shared<GameEventPacket>(
|
||||
GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0));
|
||||
}
|
||||
delete bedPosition;
|
||||
}
|
||||
|
|
@ -727,19 +727,19 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
|
|||
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(),
|
||||
player->level->getMaxBuildHeight(),
|
||||
player->gameMode->getGameModeForPlayer(), level->difficulty,
|
||||
level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(),
|
||||
player->entityId, level->getLevelData()->getXZSize(),
|
||||
level->getLevelData()->getHellScale())));
|
||||
level->getLevelData()->getHellScale()));
|
||||
player->connection->teleport(player->x, player->y, player->z, player->yRot,
|
||||
player->xRot);
|
||||
player->connection->send(
|
||||
std::shared_ptr<SetExperiencePacket>(new SetExperiencePacket(
|
||||
std::make_shared<SetExperiencePacket>(
|
||||
player->experienceProgress, player->totalExperience,
|
||||
player->experienceLevel)));
|
||||
player->experienceLevel));
|
||||
|
||||
if (keepAllPlayerData) {
|
||||
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
|
||||
player->flushEntitiesToRemove();
|
||||
|
||||
player->connection->send(std::shared_ptr<RespawnPacket>(new RespawnPacket(
|
||||
player->connection->send(std::make_shared<RespawnPacket>(
|
||||
(char)player->dimension, newLevel->getSeed(),
|
||||
newLevel->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(),
|
||||
newLevel->difficulty, newLevel->getLevelData()->getGenerator(),
|
||||
newLevel->useNewSeaLevel(), player->entityId,
|
||||
newLevel->getLevelData()->getXZSize(),
|
||||
newLevel->getLevelData()->getHellScale())));
|
||||
newLevel->getLevelData()->getHellScale()));
|
||||
|
||||
oldLevel->removeEntityImmediately(player);
|
||||
player->removed = false;
|
||||
|
|
@ -984,7 +984,7 @@ void PlayerList::tick() {
|
|||
// PlayerInfoPacket(op->name, true, op->latency) ) );
|
||||
if (op->connection->getNetworkPlayer()) {
|
||||
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);
|
||||
if (player != nullptr) {
|
||||
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,
|
||||
ServerLevel* level) {
|
||||
player->connection->send(std::shared_ptr<SetTimePacket>(new SetTimePacket(
|
||||
player->connection->send(std::make_shared<SetTimePacket>(
|
||||
level->getGameTime(), level->getDayTime(),
|
||||
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))));
|
||||
level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
|
||||
if (level->isRaining()) {
|
||||
player->connection->send(std::shared_ptr<GameEventPacket>(
|
||||
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
|
||||
if ((level->dimension->id == 0) &&
|
||||
level->getLevelData()->getHasStronghold()) {
|
||||
player->connection->send(std::shared_ptr<XZPacket>(new XZPacket(
|
||||
player->connection->send(std::make_shared<XZPacket>(
|
||||
XZPacket::STRONGHOLD, level->getLevelData()->getXStronghold(),
|
||||
level->getLevelData()->getZStronghold())));
|
||||
level->getLevelData()->getZStronghold()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ void GameMode::adjustPlayer(std::shared_ptr<Player> player) {}
|
|||
// }
|
||||
|
||||
std::shared_ptr<Player> GameMode::createPlayer(Level* level) {
|
||||
return std::shared_ptr<Player>(new LocalPlayer(
|
||||
minecraft, level, minecraft->user, level->dimension->id));
|
||||
return std::make_shared<LocalPlayer>(
|
||||
minecraft, level, minecraft->user, level->dimension->id);
|
||||
}
|
||||
|
||||
bool GameMode::interact(std::shared_ptr<Player> player,
|
||||
|
|
|
|||
|
|
@ -368,8 +368,8 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) {
|
|||
// MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in
|
||||
// the packet
|
||||
broadcast(
|
||||
std::shared_ptr<ChunkTilesUpdatePacket>(new ChunkTilesUpdatePacket(
|
||||
pos.x, pos.z, changedTiles, (uint8_t)changes, level)));
|
||||
std::make_shared<ChunkTilesUpdatePacket>(
|
||||
pos.x, pos.z, changedTiles, (uint8_t)changes, level));
|
||||
for (int i = 0; i < changes; i++) {
|
||||
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
|
||||
int y = ((changedTiles[i]) & 255);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// we don't generate any particles
|
||||
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->destroyBlocks = destroyBlocks;
|
||||
explosion->explode();
|
||||
|
|
@ -1130,9 +1130,9 @@ void ServerLevel::runTileEvents() {
|
|||
TileEventData te = *it;
|
||||
server->getPlayers()->broadcast(
|
||||
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.getParamA(), te.getParamB())));
|
||||
te.getParamA(), te.getParamB()));
|
||||
}
|
||||
}
|
||||
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 zDist, double speed) {
|
||||
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,
|
||||
(float)zDist, (float)speed, count));
|
||||
(float)zDist, (float)speed, count);
|
||||
|
||||
for (auto it = players.begin(); it != players.end(); ++it) {
|
||||
std::shared_ptr<ServerPlayer> player =
|
||||
|
|
|
|||
|
|
@ -549,9 +549,9 @@ void ServerPlayer::doTickB() {
|
|||
lastSentFood != foodData.getFoodLevel() ||
|
||||
((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) {
|
||||
// 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(),
|
||||
m_lastDamageSource)));
|
||||
m_lastDamageSource));
|
||||
lastSentHealth = getHealth();
|
||||
lastSentFood = foodData.getFoodLevel();
|
||||
lastFoodSaturationZero = foodData.getSaturationLevel() == 0;
|
||||
|
|
@ -582,8 +582,8 @@ void ServerPlayer::doTickB() {
|
|||
if (totalExperience != lastSentExp) {
|
||||
lastSentExp = totalExperience;
|
||||
connection->send(
|
||||
std::shared_ptr<SetExperiencePacket>(new SetExperiencePacket(
|
||||
experienceProgress, totalExperience, experienceLevel)));
|
||||
std::make_shared<SetExperiencePacket>(
|
||||
experienceProgress, totalExperience, experienceLevel));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -703,8 +703,8 @@ void ServerPlayer::changeDimension(int i) {
|
|||
m_enteredEndExitPortal =
|
||||
true; // We only flag this for the player in the portal
|
||||
connection->send(
|
||||
std::shared_ptr<GameEventPacket>(new GameEventPacket(
|
||||
GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())));
|
||||
std::make_shared<GameEventPacket>(
|
||||
GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
|
||||
app.DebugPrintf("Sending packet to %d\n",
|
||||
thisPlayer->GetUserIndex());
|
||||
}
|
||||
|
|
@ -806,8 +806,8 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList,
|
|||
void ServerPlayer::ride(std::shared_ptr<Entity> e) {
|
||||
Player::ride(e);
|
||||
connection->send(
|
||||
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(
|
||||
SetEntityLinkPacket::RIDING, shared_from_this(), riding)));
|
||||
std::make_shared<SetEntityLinkPacket>(
|
||||
SetEntityLinkPacket::RIDING, shared_from_this(), riding));
|
||||
|
||||
// 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
|
||||
|
|
@ -830,8 +830,8 @@ void ServerPlayer::openTextEdit(std::shared_ptr<TileEntity> sign) {
|
|||
signTE->setAllowedPlayerEditor(
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
connection->send(
|
||||
std::shared_ptr<TileEditorOpenPacket>(new TileEditorOpenPacket(
|
||||
TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)));
|
||||
std::make_shared<TileEditorOpenPacket>(
|
||||
TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -843,9 +843,9 @@ bool ServerPlayer::startCrafting(int x, int y, int z) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9,
|
||||
false)));
|
||||
false));
|
||||
containerMenu = new CraftingMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -862,9 +862,9 @@ bool ServerPlayer::openFireworks(int x, int y, int z) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9,
|
||||
false)));
|
||||
false));
|
||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -873,9 +873,9 @@ bool ServerPlayer::openFireworks(int x, int y, int z) {
|
|||
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9,
|
||||
false)));
|
||||
false));
|
||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -893,9 +893,9 @@ bool ServerPlayer::startEnchanting(int x, int y, int z,
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
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->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -912,9 +912,9 @@ bool ServerPlayer::startRepairing(int x, int y, int z) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9,
|
||||
false)));
|
||||
false));
|
||||
containerMenu = new AnvilMenu(
|
||||
inventory, level, x, y, z,
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
|
|
@ -939,9 +939,9 @@ bool ServerPlayer::openContainer(std::shared_ptr<Container> container) {
|
|||
assert(containerType >= 0);
|
||||
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, containerType, container->getCustomName(),
|
||||
container->getContainerSize(), container->hasCustomName())));
|
||||
container->getContainerSize(), container->hasCustomName()));
|
||||
|
||||
containerMenu = new ContainerMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
|
|
@ -958,10 +958,10 @@ bool ServerPlayer::openHopper(std::shared_ptr<HopperTileEntity> container) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::HOPPER,
|
||||
container->getCustomName(), container->getContainerSize(),
|
||||
container->hasCustomName())));
|
||||
container->hasCustomName()));
|
||||
containerMenu = new HopperMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -978,10 +978,10 @@ bool ServerPlayer::openHopper(std::shared_ptr<MinecartHopper> container) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::HOPPER,
|
||||
container->getCustomName(), container->getContainerSize(),
|
||||
container->hasCustomName())));
|
||||
container->hasCustomName()));
|
||||
containerMenu = new HopperMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -998,10 +998,10 @@ bool ServerPlayer::openFurnace(std::shared_ptr<FurnaceTileEntity> furnace) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::FURNACE,
|
||||
furnace->getCustomName(), furnace->getContainerSize(),
|
||||
furnace->hasCustomName())));
|
||||
furnace->hasCustomName()));
|
||||
containerMenu = new FurnaceMenu(inventory, furnace);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -1017,13 +1017,13 @@ bool ServerPlayer::openTrap(std::shared_ptr<DispenserTileEntity> trap) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter,
|
||||
trap->GetType() == eTYPE_DROPPERTILEENTITY
|
||||
? ContainerOpenPacket::DROPPER
|
||||
: ContainerOpenPacket::TRAP,
|
||||
trap->getCustomName(), trap->getContainerSize(),
|
||||
trap->hasCustomName())));
|
||||
trap->hasCustomName()));
|
||||
containerMenu = new TrapMenu(inventory, trap);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -1040,10 +1040,10 @@ bool ServerPlayer::openBrewingStand(
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::BREWING_STAND,
|
||||
brewingStand->getCustomName(), brewingStand->getContainerSize(),
|
||||
brewingStand->hasCustomName())));
|
||||
brewingStand->hasCustomName()));
|
||||
containerMenu = new BrewingStandMenu(inventory, brewingStand);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -1060,10 +1060,10 @@ bool ServerPlayer::openBeacon(std::shared_ptr<BeaconTileEntity> beacon) {
|
|||
if (containerMenu == inventoryMenu) {
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::BEACON,
|
||||
beacon->getCustomName(), beacon->getContainerSize(),
|
||||
beacon->hasCustomName())));
|
||||
beacon->hasCustomName()));
|
||||
containerMenu = new BeaconMenu(inventory, beacon);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -1086,10 +1086,10 @@ bool ServerPlayer::openTrading(std::shared_ptr<Merchant> traderTarget,
|
|||
((MerchantMenu*)containerMenu)->getTradeContainer();
|
||||
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::TRADER_NPC,
|
||||
name.empty() ? L"" : name, container->getContainerSize(),
|
||||
!name.empty())));
|
||||
!name.empty()));
|
||||
|
||||
MerchantRecipeList* offers = traderTarget->getOffers(
|
||||
std::dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
|
|
@ -1121,10 +1121,10 @@ bool ServerPlayer::openHorseInventory(std::shared_ptr<EntityHorse> horse,
|
|||
}
|
||||
nextContainerCounter();
|
||||
connection->send(
|
||||
std::shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(
|
||||
std::make_shared<ContainerOpenPacket>(
|
||||
containerCounter, ContainerOpenPacket::HORSE,
|
||||
horse->getCustomName(), container->getContainerSize(),
|
||||
container->hasCustomName(), horse->entityId)));
|
||||
container->hasCustomName(), horse->entityId));
|
||||
containerMenu = new HorseInventoryMenu(inventory, container, horse);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
|
|
@ -1245,22 +1245,22 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
case IDS_TILE_BED_OCCUPIED:
|
||||
messageType = ChatPacket::e_ChatBedOccupied;
|
||||
connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType)));
|
||||
std::make_shared<ChatPacket>(L"", messageType));
|
||||
break;
|
||||
case IDS_TILE_BED_NO_SLEEP:
|
||||
messageType = ChatPacket::e_ChatBedNoSleep;
|
||||
connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType)));
|
||||
std::make_shared<ChatPacket>(L"", messageType));
|
||||
break;
|
||||
case IDS_TILE_BED_NOT_VALID:
|
||||
messageType = ChatPacket::e_ChatBedNotValid;
|
||||
connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType)));
|
||||
std::make_shared<ChatPacket>(L"", messageType));
|
||||
break;
|
||||
case IDS_TILE_BED_NOTSAFE:
|
||||
messageType = ChatPacket::e_ChatBedNotSafe;
|
||||
connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType)));
|
||||
std::make_shared<ChatPacket>(L"", messageType));
|
||||
break;
|
||||
case IDS_TILE_BED_PLAYERSLEEP:
|
||||
messageType = ChatPacket::e_ChatBedPlayerSleep;
|
||||
|
|
@ -1271,8 +1271,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() != player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatBedPlayerSleep)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatBedPlayerSleep));
|
||||
} else {
|
||||
player->connection->send(std::shared_ptr<ChatPacket>(
|
||||
new ChatPacket(name, ChatPacket::e_ChatBedMeSleep)));
|
||||
|
|
@ -1287,8 +1287,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() != player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerEnteredEnd)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerEnteredEnd));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1306,7 +1306,7 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
case IDS_TILE_BED_MESLEEP:
|
||||
messageType = ChatPacket::e_ChatBedMeSleep;
|
||||
connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(L"", messageType)));
|
||||
std::make_shared<ChatPacket>(L"", messageType));
|
||||
break;
|
||||
|
||||
case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED:
|
||||
|
|
@ -1316,8 +1316,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxPigsSheepCows)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxPigsSheepCows));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1328,8 +1328,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxChickens)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxChickens));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1340,8 +1340,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxSquid)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxSquid));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1363,8 +1363,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxWolves)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxWolves));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1375,8 +1375,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxMooshrooms)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxMooshrooms));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1387,8 +1387,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxEnemies)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxEnemies));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1400,8 +1400,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxVillagers)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxVillagers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1412,9 +1412,9 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
std::make_shared<ChatPacket>(
|
||||
name,
|
||||
ChatPacket::e_ChatPlayerMaxBredPigsSheepCows)));
|
||||
ChatPacket::e_ChatPlayerMaxBredPigsSheepCows));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1425,8 +1425,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredChickens)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredChickens));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1437,8 +1437,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredMooshrooms)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredMooshrooms));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1450,8 +1450,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredWolves)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxBredWolves));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1463,8 +1463,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerCantShearMooshroom)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerCantShearMooshroom));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1476,8 +1476,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxHangingEntities)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxHangingEntities));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1488,9 +1488,9 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
std::make_shared<ChatPacket>(
|
||||
name,
|
||||
ChatPacket::e_ChatPlayerCantSpawnInPeaceful)));
|
||||
ChatPacket::e_ChatPlayerCantSpawnInPeaceful));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1502,8 +1502,8 @@ void ServerPlayer::displayClientMessage(int messageId) {
|
|||
server->getPlayers()->players[i];
|
||||
if (shared_from_this() == player) {
|
||||
player->connection->send(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
name, ChatPacket::e_ChatPlayerMaxBoats)));
|
||||
std::make_shared<ChatPacket>(
|
||||
name, ChatPacket::e_ChatPlayerMaxBoats));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1577,14 +1577,14 @@ void ServerPlayer::teleportTo(double x, double y, double z) {
|
|||
|
||||
void ServerPlayer::crit(std::shared_ptr<Entity> entity) {
|
||||
getLevel()->getTracker()->broadcastAndSend(
|
||||
shared_from_this(), std::shared_ptr<AnimatePacket>(new AnimatePacket(
|
||||
entity, AnimatePacket::CRITICAL_HIT)));
|
||||
shared_from_this(), std::make_shared<AnimatePacket>(
|
||||
entity, AnimatePacket::CRITICAL_HIT));
|
||||
}
|
||||
|
||||
void ServerPlayer::magicCrit(std::shared_ptr<Entity> entity) {
|
||||
getLevel()->getTracker()->broadcastAndSend(
|
||||
shared_from_this(), std::shared_ptr<AnimatePacket>(new AnimatePacket(
|
||||
entity, AnimatePacket::MAGIC_CRITICAL_HIT)));
|
||||
shared_from_this(), std::make_shared<AnimatePacket>(
|
||||
entity, AnimatePacket::MAGIC_CRITICAL_HIT));
|
||||
}
|
||||
|
||||
void ServerPlayer::onUpdateAbilities() {
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ void TrackedEntity::tick(EntityTracker* tracker,
|
|||
(e->riding != nullptr &&
|
||||
tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) {
|
||||
lastRidingEntity = e->riding;
|
||||
broadcast(std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(
|
||||
SetEntityLinkPacket::RIDING, e, e->riding)));
|
||||
broadcast(std::make_shared<SetEntityLinkPacket>(
|
||||
SetEntityLinkPacket::RIDING, e, e->riding));
|
||||
}
|
||||
|
||||
// Moving forward special case for item frames
|
||||
|
|
@ -304,8 +304,8 @@ void TrackedEntity::tick(EntityTracker* tracker,
|
|||
if (rot) {
|
||||
// 4J: Changed this to use deltas
|
||||
broadcast(
|
||||
std::shared_ptr<MoveEntityPacket>(new MoveEntityPacket::Rot(
|
||||
e->entityId, (uint8_t)yRota, (uint8_t)xRota)));
|
||||
std::make_shared<MoveEntityPacket::Rot>(
|
||||
e->entityId, (uint8_t)yRota, (uint8_t)xRota));
|
||||
yRotp = yRotn;
|
||||
xRotp = xRotn;
|
||||
}
|
||||
|
|
@ -571,8 +571,8 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker,
|
|||
// 4J Stu brought forward to fix when Item Frames
|
||||
if (!e->getEntityData()->isEmpty() && !isAddMobPacket) {
|
||||
sp->connection->send(
|
||||
std::shared_ptr<SetEntityDataPacket>(new SetEntityDataPacket(
|
||||
e->entityId, e->getEntityData(), true)));
|
||||
std::make_shared<SetEntityDataPacket>(
|
||||
e->entityId, e->getEntityData(), true));
|
||||
}
|
||||
|
||||
if (e->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
|
|
@ -597,15 +597,15 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker,
|
|||
|
||||
if (e->riding != nullptr) {
|
||||
sp->connection->send(
|
||||
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(
|
||||
SetEntityLinkPacket::RIDING, e, e->riding)));
|
||||
std::make_shared<SetEntityLinkPacket>(
|
||||
SetEntityLinkPacket::RIDING, e, e->riding));
|
||||
}
|
||||
if (e->instanceof(eTYPE_MOB) &&
|
||||
std::dynamic_pointer_cast<Mob>(e)->getLeashHolder() != nullptr) {
|
||||
sp->connection->send(
|
||||
std::shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(
|
||||
std::make_shared<SetEntityLinkPacket>(
|
||||
SetEntityLinkPacket::LEASH, e,
|
||||
std::dynamic_pointer_cast<Mob>(e)->getLeashHolder())));
|
||||
std::dynamic_pointer_cast<Mob>(e)->getLeashHolder()));
|
||||
}
|
||||
|
||||
if (e->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
|
|
@ -689,8 +689,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
|
||||
if (e->instanceof(eTYPE_ITEMENTITY)) {
|
||||
std::shared_ptr<AddEntityPacket> packet =
|
||||
std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp));
|
||||
std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp);
|
||||
return packet;
|
||||
} else if (e->instanceof(eTYPE_SERVERPLAYER)) {
|
||||
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:
|
||||
// When one of the Players is idle for a few minutes his head turns 180
|
||||
// degrees.
|
||||
return std::shared_ptr<AddPlayerPacket>(new AddPlayerPacket(
|
||||
player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp));
|
||||
return std::make_shared<AddPlayerPacket>(
|
||||
player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp);
|
||||
} else if (e->instanceof(eTYPE_MINECART)) {
|
||||
std::shared_ptr<Minecart> minecart =
|
||||
std::dynamic_pointer_cast<Minecart>(e);
|
||||
|
|
@ -714,8 +714,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
new AddEntityPacket(e, AddEntityPacket::MINECART,
|
||||
minecart->getType(), yRotp, xRotp, xp, yp, zp));
|
||||
} else if (e->instanceof(eTYPE_BOAT)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_ENDERDRAGON)) {
|
||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||
return std::shared_ptr<AddMobPacket>(
|
||||
|
|
@ -724,37 +724,37 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
} else if (e->instanceof(eTYPE_FISHINGHOOK)) {
|
||||
std::shared_ptr<Entity> owner =
|
||||
std::dynamic_pointer_cast<FishingHook>(e)->owner;
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::FISH_HOOK,
|
||||
owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp,
|
||||
yp, zp));
|
||||
yp, zp);
|
||||
} else if (e->instanceof(eTYPE_ARROW)) {
|
||||
std::shared_ptr<Entity> owner =
|
||||
(std::dynamic_pointer_cast<Arrow>(e))->owner;
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::ARROW,
|
||||
owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp,
|
||||
yp, zp));
|
||||
yp, zp);
|
||||
} else if (e->instanceof(eTYPE_SNOWBALL)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_THROWNPOTION)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::THROWN_POTION,
|
||||
((std::dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue()),
|
||||
yRotp, xRotp, xp, yp, zp));
|
||||
yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_THROWNENDERPEARL)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_FIREBALL)) {
|
||||
eINSTANCEOF classType = e->GetType();
|
||||
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<AddEntityPacket> aep = nullptr;
|
||||
if (fb->owner != nullptr) {
|
||||
aep = std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp));
|
||||
aep = std::make_shared<AddEntityPacket>(
|
||||
e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp);
|
||||
} else {
|
||||
aep = std::shared_ptr<AddEntityPacket>(
|
||||
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);
|
||||
return aep;
|
||||
} else if (e->instanceof(eTYPE_THROWNEGG)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_PRIMEDTNT)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) {
|
||||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp));
|
||||
return std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_FALLINGTILE)) {
|
||||
std::shared_ptr<FallingTile> ft =
|
||||
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,
|
||||
xRotp, xp, yp, zp));
|
||||
xRotp, xp, yp, zp);
|
||||
} else if (e->instanceof(eTYPE_PAINTING)) {
|
||||
return std::shared_ptr<AddPaintingPacket>(
|
||||
new AddPaintingPacket(std::dynamic_pointer_cast<Painting>(e)));
|
||||
|
|
@ -820,8 +820,8 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
std::shared_ptr<LeashFenceKnotEntity> knot =
|
||||
std::dynamic_pointer_cast<LeashFenceKnotEntity>(e);
|
||||
std::shared_ptr<AddEntityPacket> packet =
|
||||
std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp));
|
||||
std::make_shared<AddEntityPacket>(
|
||||
e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp);
|
||||
packet->x = Mth::floor((float)knot->xTile * 32);
|
||||
packet->y = Mth::floor((float)knot->yTile * 32);
|
||||
packet->z = Mth::floor((float)knot->zTile * 32);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
|
|||
reason, _tick);
|
||||
app.DebugPrintf("Pending connection disconnect: %d\n", reason);
|
||||
connection->send(
|
||||
std::shared_ptr<DisconnectPacket>(new DisconnectPacket(reason)));
|
||||
std::make_shared<DisconnectPacket>(reason));
|
||||
connection->sendAndQuit();
|
||||
done = true;
|
||||
// } catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
|
|||
// 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
|
||||
server->getPlayers()->removePlayerFromReceiving(player);
|
||||
send(std::shared_ptr<DisconnectPacket>(new DisconnectPacket(reason)));
|
||||
send(std::make_shared<DisconnectPacket>(reason));
|
||||
connection->sendAndQuit();
|
||||
// 4J-PB - removed, since it needs to be localised in the language the
|
||||
// client is in
|
||||
|
|
@ -120,8 +120,8 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) {
|
|||
// ChatPacket(L"§e" + player->name + L" left the game.") ) );
|
||||
if (getWasKicked()) {
|
||||
server->getPlayers()->broadcastAll(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
player->name, ChatPacket::e_ChatPlayerKickedFromGame)));
|
||||
std::make_shared<ChatPacket>(
|
||||
player->name, ChatPacket::e_ChatPlayerKickedFromGame));
|
||||
} else {
|
||||
server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>(
|
||||
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
|
||||
if (sendPacket)
|
||||
player->connection->send(
|
||||
std::shared_ptr<MovePlayerPacket>(new MovePlayerPacket::PosRot(
|
||||
x, y + 1.62f, y, z, yRot, xRot, false, false)));
|
||||
std::make_shared<MovePlayerPacket::PosRot>(
|
||||
x, y + 1.62f, y, z, yRot, xRot, false, false));
|
||||
}
|
||||
|
||||
void PlayerConnection::handlePlayerAction(
|
||||
|
|
@ -553,8 +553,8 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
|
|||
// ChatPacket(L"§e" + player->name + L" left the game.") ) );
|
||||
if (getWasKicked()) {
|
||||
server->getPlayers()->broadcastAll(
|
||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
||||
player->name, ChatPacket::e_ChatPlayerKickedFromGame)));
|
||||
std::make_shared<ChatPacket>(
|
||||
player->name, ChatPacket::e_ChatPlayerKickedFromGame));
|
||||
} else {
|
||||
server->getPlayers()->broadcastAll(std::shared_ptr<ChatPacket>(
|
||||
new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame)));
|
||||
|
|
@ -1132,8 +1132,8 @@ void PlayerConnection::handleContainerClick(
|
|||
if (ItemInstance::matches(packet->item, clicked)) {
|
||||
// Yep, you sure did click what you claimed to click!
|
||||
player->connection->send(
|
||||
std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
|
||||
packet->containerId, packet->uid, true)));
|
||||
std::make_shared<ContainerAckPacket>(
|
||||
packet->containerId, packet->uid, true));
|
||||
player->ignoreSlotUpdateHack = true;
|
||||
player->containerMenu->broadcastChanges();
|
||||
player->broadcastCarriedItem();
|
||||
|
|
@ -1142,8 +1142,8 @@ void PlayerConnection::handleContainerClick(
|
|||
// No, you clicked the wrong thing!
|
||||
expectedAcks[player->containerMenu->containerId] = packet->uid;
|
||||
player->connection->send(
|
||||
std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
|
||||
packet->containerId, packet->uid, false)));
|
||||
std::make_shared<ContainerAckPacket>(
|
||||
packet->containerId, packet->uid, false));
|
||||
player->containerMenu->setSynched(player, false);
|
||||
|
||||
std::vector<std::shared_ptr<ItemInstance> > items;
|
||||
|
|
@ -1199,7 +1199,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
|
|||
std::wstring id = std::wstring(buf);
|
||||
if (data == nullptr) {
|
||||
data =
|
||||
std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id));
|
||||
std::make_shared<MapItemSavedData>(id);
|
||||
}
|
||||
player->level->setSavedData(id, (std::shared_ptr<SavedData>)data);
|
||||
|
||||
|
|
@ -1364,9 +1364,9 @@ void PlayerConnection::handlePlayerInfo(
|
|||
Player::ePlayerGamePrivilege_CreativeMode));
|
||||
serverPlayer->gameMode->setGameModeForPlayer(gameType);
|
||||
serverPlayer->connection->send(
|
||||
std::shared_ptr<GameEventPacket>(new GameEventPacket(
|
||||
std::make_shared<GameEventPacket>(
|
||||
GameEventPacket::CHANGE_GAME_MODE,
|
||||
gameType->getId())));
|
||||
gameType->getId()));
|
||||
} else {
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"%ls already has game mode %d\n",
|
||||
|
|
@ -1673,9 +1673,9 @@ void PlayerConnection::handleCraftItem(
|
|||
if (ingItemInst->getItem()->hasCraftingRemainingItem()) {
|
||||
// replace item with remaining result
|
||||
player->inventory->add(
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(
|
||||
std::make_shared<ItemInstance>(
|
||||
ingItemInst->getItem()
|
||||
->getCraftingRemainingItem())));
|
||||
->getCraftingRemainingItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ ServerConnection::~ServerConnection() {}
|
|||
// used to have
|
||||
void ServerConnection::NewIncomingSocket(Socket* socket) {
|
||||
std::shared_ptr<PendingConnection> unconnectedClient =
|
||||
std::shared_ptr<PendingConnection>(new PendingConnection(
|
||||
std::make_shared<PendingConnection>(
|
||||
server, socket,
|
||||
L"Connection #" + _toString<int>(connectionCounter++)));
|
||||
L"Connection #" + _toString<int>(connectionCounter++));
|
||||
handleConnection(unconnectedClient);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void GiveItemCommand::execute(std::shared_ptr<CommandSender> source,
|
|||
std::shared_ptr<ServerPlayer> player = getPlayer(uid);
|
||||
if (player != nullptr && item > 0 && Item::items[item] != nullptr) {
|
||||
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);
|
||||
drop->throwTime = 0;
|
||||
// logAdminAction(source, L"commands.give.success",
|
||||
|
|
|
|||
|
|
@ -50,24 +50,24 @@ std::shared_ptr<Projectile> ArrowDispenseBehavior::getProjectile(
|
|||
|
||||
std::shared_ptr<Projectile> EggDispenseBehavior::getProjectile(
|
||||
Level* world, Position* position) {
|
||||
return std::shared_ptr<Projectile>(new ThrownEgg(
|
||||
world, position->getX(), position->getY(), position->getZ()));
|
||||
return std::make_shared<ThrownEgg>(
|
||||
world, position->getX(), position->getY(), position->getZ());
|
||||
}
|
||||
|
||||
/* Snowball */
|
||||
|
||||
std::shared_ptr<Projectile> SnowballDispenseBehavior::getProjectile(
|
||||
Level* world, Position* position) {
|
||||
return std::shared_ptr<Projectile>(new Snowball(
|
||||
world, position->getX(), position->getY(), position->getZ()));
|
||||
return std::make_shared<Snowball>(
|
||||
world, position->getX(), position->getY(), position->getZ());
|
||||
}
|
||||
|
||||
/* Exp Bottle */
|
||||
|
||||
std::shared_ptr<Projectile> ExpBottleDispenseBehavior::getProjectile(
|
||||
Level* world, Position* position) {
|
||||
return std::shared_ptr<Projectile>(new ThrownExpBottle(
|
||||
world, position->getX(), position->getY(), position->getZ()));
|
||||
return std::make_shared<ThrownExpBottle>(
|
||||
world, position->getX(), position->getY(), position->getZ());
|
||||
}
|
||||
|
||||
float ExpBottleDispenseBehavior::getUncertainty() {
|
||||
|
|
@ -164,8 +164,8 @@ std::shared_ptr<ItemInstance> FireworksDispenseBehavior::execute(
|
|||
double spawnZ = source->getZ() + facing->getStepZ();
|
||||
|
||||
std::shared_ptr<FireworksRocketEntity> firework =
|
||||
std::shared_ptr<FireworksRocketEntity>(new FireworksRocketEntity(
|
||||
world, spawnX, spawnY, spawnZ, dispensed));
|
||||
std::make_shared<FireworksRocketEntity>(
|
||||
world, spawnX, spawnY, spawnZ, dispensed);
|
||||
source->getWorld()->addEntity(firework);
|
||||
|
||||
outcome = ACTIVATED_ITEM;
|
||||
|
|
@ -348,7 +348,7 @@ std::shared_ptr<ItemInstance> EmptyBucketDispenseBehavior::execute(
|
|||
new ItemInstance(targetType))) < 0) {
|
||||
DefaultDispenseItemBehavior::dispense(
|
||||
source,
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(targetType)));
|
||||
std::make_shared<ItemInstance>(targetType));
|
||||
}
|
||||
|
||||
outcome = ACTIVATED_ITEM;
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ void Connection::tick() {
|
|||
// read and write threads don't timeout
|
||||
tickCount++;
|
||||
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
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddEntityPacket());
|
||||
return std::make_shared<AddEntityPacket>();
|
||||
}
|
||||
virtual int getId() { return 23; }
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ public:
|
|||
virtual int getEstimatedSize();
|
||||
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddExperienceOrbPacket());
|
||||
return std::make_shared<AddExperienceOrbPacket>();
|
||||
}
|
||||
virtual int getId() { return 26; }
|
||||
};
|
||||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddGlobalEntityPacket());
|
||||
return std::make_shared<AddGlobalEntityPacket>();
|
||||
}
|
||||
virtual int getId() { return 71; }
|
||||
};
|
||||
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddMobPacket());
|
||||
return std::make_shared<AddMobPacket>();
|
||||
}
|
||||
virtual int getId() { return 24; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddPaintingPacket());
|
||||
return std::make_shared<AddPaintingPacket>();
|
||||
}
|
||||
virtual int getId() { return 25; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AddPlayerPacket());
|
||||
return std::make_shared<AddPlayerPacket>();
|
||||
}
|
||||
virtual int getId() { return 20; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AnimatePacket());
|
||||
return std::make_shared<AnimatePacket>();
|
||||
}
|
||||
virtual int getId() { return 18; }
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@ public:
|
|||
virtual bool isAync();
|
||||
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new AwardStatPacket());
|
||||
return std::make_shared<AwardStatPacket>();
|
||||
}
|
||||
virtual int getId() { return 200; }
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new BlockRegionUpdatePacket());
|
||||
return std::make_shared<BlockRegionUpdatePacket>();
|
||||
}
|
||||
virtual int getId() { return 51; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ChatPacket());
|
||||
return std::make_shared<ChatPacket>();
|
||||
}
|
||||
virtual int getId() { return 3; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ChunkTilesUpdatePacket());
|
||||
return std::make_shared<ChunkTilesUpdatePacket>();
|
||||
}
|
||||
virtual int getId() { return 52; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ChunkVisibilityAreaPacket());
|
||||
return std::make_shared<ChunkVisibilityAreaPacket>();
|
||||
}
|
||||
virtual int getId() { return 155; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ChunkVisibilityPacket());
|
||||
return std::make_shared<ChunkVisibilityPacket>();
|
||||
}
|
||||
virtual int getId() { return 50; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ClientCommandPacket());
|
||||
return std::make_shared<ClientCommandPacket>();
|
||||
}
|
||||
virtual int getId() { return 205; }
|
||||
};
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ComplexItemDataPacket());
|
||||
return std::make_shared<ComplexItemDataPacket>();
|
||||
}
|
||||
virtual int getId() { return 131; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerAckPacket());
|
||||
return std::make_shared<ContainerAckPacket>();
|
||||
}
|
||||
virtual int getId() { return 106; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerButtonClickPacket());
|
||||
return std::make_shared<ContainerButtonClickPacket>();
|
||||
}
|
||||
virtual int getId() { return 108; }
|
||||
};
|
||||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerClickPacket());
|
||||
return std::make_shared<ContainerClickPacket>();
|
||||
}
|
||||
virtual int getId() { return 102; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerClosePacket());
|
||||
return std::make_shared<ContainerClosePacket>();
|
||||
}
|
||||
virtual int getId() { return 101; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerOpenPacket());
|
||||
return std::make_shared<ContainerOpenPacket>();
|
||||
}
|
||||
virtual int getId() { return 100; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerSetContentPacket());
|
||||
return std::make_shared<ContainerSetContentPacket>();
|
||||
}
|
||||
virtual int getId() { return 104; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerSetDataPacket());
|
||||
return std::make_shared<ContainerSetDataPacket>();
|
||||
}
|
||||
virtual int getId() { return 105; }
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ContainerSetSlotPacket());
|
||||
return std::make_shared<ContainerSetSlotPacket>();
|
||||
}
|
||||
virtual int getId() { return 103; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new CraftItemPacket());
|
||||
return std::make_shared<CraftItemPacket>();
|
||||
}
|
||||
virtual int getId() { return 150; }
|
||||
};
|
||||
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new CustomPayloadPacket());
|
||||
return std::make_shared<CustomPayloadPacket>();
|
||||
}
|
||||
virtual int getId() { return 250; }
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new DebugOptionsPacket());
|
||||
return std::make_shared<DebugOptionsPacket>();
|
||||
}
|
||||
virtual int getId() { return 152; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new DisconnectPacket());
|
||||
return std::make_shared<DisconnectPacket>();
|
||||
}
|
||||
virtual int getId() { return 255; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new EntityActionAtPositionPacket());
|
||||
return std::make_shared<EntityActionAtPositionPacket>();
|
||||
}
|
||||
virtual int getId() { return 17; }
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new EntityEventPacket());
|
||||
return std::make_shared<EntityEventPacket>();
|
||||
}
|
||||
virtual int getId() { return 38; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ExplodePacket());
|
||||
return std::make_shared<ExplodePacket>();
|
||||
}
|
||||
virtual int getId() { return 60; }
|
||||
};
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new GameCommandPacket());
|
||||
return std::make_shared<GameCommandPacket>();
|
||||
}
|
||||
virtual int getId() { return 167; }
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new GameEventPacket());
|
||||
return std::make_shared<GameEventPacket>();
|
||||
}
|
||||
virtual int getId() { return 70; }
|
||||
};
|
||||
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new GetInfoPacket());
|
||||
return std::make_shared<GetInfoPacket>();
|
||||
}
|
||||
virtual int getId() { return 254; }
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new InteractPacket());
|
||||
return std::make_shared<InteractPacket>();
|
||||
}
|
||||
virtual int getId() { return 7; }
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new KeepAlivePacket());
|
||||
return std::make_shared<KeepAlivePacket>();
|
||||
}
|
||||
virtual int getId() { return 0; }
|
||||
};
|
||||
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new KickPlayerPacket());
|
||||
return std::make_shared<KickPlayerPacket>();
|
||||
}
|
||||
virtual int getId() { return 159; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new LevelEventPacket());
|
||||
return std::make_shared<LevelEventPacket>();
|
||||
}
|
||||
virtual int getId() { return 61; }
|
||||
};
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new LevelParticlesPacket());
|
||||
return std::make_shared<LevelParticlesPacket>();
|
||||
}
|
||||
virtual int getId() { return 63; }
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new LevelSoundPacket());
|
||||
return std::make_shared<LevelSoundPacket>();
|
||||
}
|
||||
virtual int getId() { return 62; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new LoginPacket());
|
||||
return std::make_shared<LoginPacket>();
|
||||
}
|
||||
virtual int getId() { return 1; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new MoveEntityPacket());
|
||||
return std::make_shared<MoveEntityPacket>();
|
||||
}
|
||||
virtual int getId() { return 30; }
|
||||
};
|
||||
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new MoveEntityPacketSmall());
|
||||
return std::make_shared<MoveEntityPacketSmall>();
|
||||
}
|
||||
virtual int getId() { return 162; }
|
||||
};
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new MovePlayerPacket());
|
||||
return std::make_shared<MovePlayerPacket>();
|
||||
}
|
||||
virtual int getId() { return 10; }
|
||||
};
|
||||
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -671,7 +671,7 @@ std::shared_ptr<ItemInstance> Packet::readItem(DataInputStream* dis) {
|
|||
int damage = dis->readShort();
|
||||
|
||||
item =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(id, count, damage));
|
||||
std::make_shared<ItemInstance>(id, count, damage);
|
||||
// 4J Stu - Always read/write the tag
|
||||
// if (Item.items[id].canBeDepleted() ||
|
||||
// Item.items[id].shouldOverrideMultiplayerNBT())
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PlayerAbilitiesPacket());
|
||||
return std::make_shared<PlayerAbilitiesPacket>();
|
||||
}
|
||||
virtual int getId() { return 202; }
|
||||
};
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PlayerActionPacket());
|
||||
return std::make_shared<PlayerActionPacket>();
|
||||
}
|
||||
virtual int getId() { return 14; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PlayerCommandPacket());
|
||||
return std::make_shared<PlayerCommandPacket>();
|
||||
}
|
||||
virtual int getId() { return 19; }
|
||||
};
|
||||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PlayerInfoPacket());
|
||||
return std::make_shared<PlayerInfoPacket>();
|
||||
}
|
||||
virtual int getId() { return 201; }
|
||||
};
|
||||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PlayerInputPacket());
|
||||
return std::make_shared<PlayerInputPacket>();
|
||||
}
|
||||
virtual int getId() { return 27; }
|
||||
};
|
||||
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new PreLoginPacket());
|
||||
return std::make_shared<PreLoginPacket>();
|
||||
}
|
||||
virtual int getId() { return 2; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new RemoveEntitiesPacket());
|
||||
return std::make_shared<RemoveEntitiesPacket>();
|
||||
}
|
||||
virtual int getId() { return 29; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new RemoveMobEffectPacket());
|
||||
return std::make_shared<RemoveMobEffectPacket>();
|
||||
}
|
||||
virtual int getId() { return 42; }
|
||||
};
|
||||
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new RespawnPacket());
|
||||
return std::make_shared<RespawnPacket>();
|
||||
}
|
||||
virtual int getId() { return 9; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new RotateHeadPacket());
|
||||
return std::make_shared<RotateHeadPacket>();
|
||||
}
|
||||
virtual int getId() { return 35; }
|
||||
};
|
||||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new ServerSettingsChangedPacket());
|
||||
return std::make_shared<ServerSettingsChangedPacket>();
|
||||
}
|
||||
virtual int getId() { return 153; }
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetCarriedItemPacket());
|
||||
return std::make_shared<SetCarriedItemPacket>();
|
||||
}
|
||||
virtual int getId() { return 16; }
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetCreativeModeSlotPacket());
|
||||
return std::make_shared<SetCreativeModeSlotPacket>();
|
||||
}
|
||||
virtual int getId() { return 107; }
|
||||
};
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetDisplayObjectivePacket());
|
||||
return std::make_shared<SetDisplayObjectivePacket>();
|
||||
}
|
||||
virtual int getId() { return 208; }
|
||||
};
|
||||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetEntityDataPacket());
|
||||
return std::make_shared<SetEntityDataPacket>();
|
||||
}
|
||||
virtual int getId() { return 40; }
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetEntityLinkPacket());
|
||||
return std::make_shared<SetEntityLinkPacket>();
|
||||
}
|
||||
virtual int getId() { return 39; }
|
||||
};
|
||||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetEntityMotionPacket());
|
||||
return std::make_shared<SetEntityMotionPacket>();
|
||||
}
|
||||
virtual int getId() { return 28; }
|
||||
};
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetEquippedItemPacket());
|
||||
return std::make_shared<SetEquippedItemPacket>();
|
||||
}
|
||||
virtual int getId() { return 5; }
|
||||
};
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetExperiencePacket());
|
||||
return std::make_shared<SetExperiencePacket>();
|
||||
}
|
||||
virtual int getId() { return 43; }
|
||||
};
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetHealthPacket());
|
||||
return std::make_shared<SetHealthPacket>();
|
||||
}
|
||||
virtual int getId() { return 8; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetObjectivePacket());
|
||||
return std::make_shared<SetObjectivePacket>();
|
||||
}
|
||||
virtual int getId() { return 206; }
|
||||
};
|
||||
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
public:
|
||||
static std::shared_ptr<Packet> create() {
|
||||
return std::shared_ptr<Packet>(new SetPlayerTeamPacket());
|
||||
return std::make_shared<SetPlayerTeamPacket>();
|
||||
}
|
||||
virtual int getId() { return 209; }
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue