Skip to content

Commit 68ebecc

Browse files
committed
-Added Change Profile screen, it'll appear when starting the game with the default name
-Finished implementing stats logic -Now, pigs will turn into pig zombies when hit by thunders -Fixed cloth sounds not being added
1 parent b3ded17 commit 68ebecc

85 files changed

Lines changed: 1649 additions & 137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

platforms/windows/projects/Client/Client.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
<ClInclude Include="$(MC_ROOT)\source\client\renderer\Lighting.hpp" />
204204
<ClInclude Include="$(MC_ROOT)\source\client\player\input\BuildActionIntention.hpp" />
205205
<ClInclude Include="..\..\..\..\source\client\gui\components\SliderButton.hpp" />
206+
<ClInclude Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.hpp" />
206207
<ClInclude Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.hpp" />
207208
<ClInclude Include="..\..\..\..\source\client\gui\screens\IntroScreen.hpp" />
208209
<ClInclude Include="..\..\..\..\source\client\gui\screens\inventory\ChestScreen.hpp" />
@@ -365,6 +366,7 @@
365366
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseBuildInput.cpp" />
366367
<ClCompile Include="$(MC_ROOT)\source\client\renderer\Lighting.cpp" />
367368
<ClCompile Include="..\..\..\..\source\client\gui\components\SliderButton.cpp" />
369+
<ClCompile Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.cpp" />
368370
<ClCompile Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.cpp" />
369371
<ClCompile Include="..\..\..\..\source\client\gui\screens\IntroScreen.cpp" />
370372
<ClCompile Include="..\..\..\..\source\client\gui\screens\inventory\ChestScreen.cpp" />

platforms/windows/projects/Client/Client.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@
581581
<ClInclude Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.hpp">
582582
<Filter>Header Files\GUI\Screens</Filter>
583583
</ClInclude>
584+
<ClInclude Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.hpp">
585+
<Filter>Header Files\GUI\Screens</Filter>
586+
</ClInclude>
584587
</ItemGroup>
585588
<ItemGroup>
586589
<ClCompile Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.cpp">
@@ -1069,5 +1072,8 @@
10691072
<ClCompile Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.cpp">
10701073
<Filter>Source Files\GUI\Screens</Filter>
10711074
</ClCompile>
1075+
<ClCompile Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.cpp">
1076+
<Filter>Source Files\GUI\Screens</Filter>
1077+
</ClCompile>
10721078
</ItemGroup>
10731079
</Project>

platforms/windows/projects/Common/Common.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<ClCompile Include="$(MC_ROOT)\source\common\ShortTag.cpp" />
9797
<ClCompile Include="$(MC_ROOT)\source\common\StringTag.cpp" />
9898
<ClCompile Include="$(MC_ROOT)\source\common\Tag.cpp" />
99+
<ClCompile Include="..\..\..\..\source\common\md5.cpp" />
99100
<ClCompile Include="..\..\..\..\source\common\NbtIo.cpp" />
100101
<ClCompile Include="..\..\..\..\source\common\ProgressListener.cpp" />
101102
</ItemGroup>
@@ -124,6 +125,7 @@
124125
<ClInclude Include="$(MC_ROOT)\source\common\ShortTag.hpp" />
125126
<ClInclude Include="$(MC_ROOT)\source\common\StringTag.hpp" />
126127
<ClInclude Include="$(MC_ROOT)\source\common\Tag.hpp" />
128+
<ClInclude Include="..\..\..\..\source\common\md5.hpp" />
127129
<ClInclude Include="..\..\..\..\source\common\NbtIo.hpp" />
128130
<ClInclude Include="..\..\..\..\source\common\ProgressListener.hpp" />
129131
</ItemGroup>

platforms/windows/projects/Common/Common.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
<ClCompile Include="..\..\..\..\source\common\NbtIo.cpp">
9696
<Filter>Source Files\Tag</Filter>
9797
</ClCompile>
98+
<ClCompile Include="..\..\..\..\source\common\md5.cpp">
99+
<Filter>Source Files</Filter>
100+
</ClCompile>
98101
</ItemGroup>
99102
<ItemGroup>
100103
<ClInclude Include="$(MC_ROOT)\source\common\CThread.hpp">
@@ -175,5 +178,8 @@
175178
<ClInclude Include="..\..\..\..\source\common\NbtIo.hpp">
176179
<Filter>Header Files\Tag</Filter>
177180
</ClInclude>
181+
<ClInclude Include="..\..\..\..\source\common\md5.hpp">
182+
<Filter>Header Files</Filter>
183+
</ClInclude>
178184
</ItemGroup>
179185
</Project>

platforms/windows/projects/Network/Network.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<ClCompile Include="..\..\..\..\source\network\packets\SignUpdatePacket.cpp" />
108108
<ClCompile Include="..\..\..\..\source\network\packets\TakeItemEntityPacket.cpp" />
109109
<ClCompile Include="..\..\..\..\source\network\packets\TeleportEntityPacket.cpp" />
110+
<ClCompile Include="..\..\..\..\source\network\packets\UpdateStatPacket.cpp" />
110111
<ClCompile Include="..\..\..\..\source\network\packets\UseItemPacket.cpp" />
111112
<ClCompile Include="..\..\..\..\source\network\ServerLevelListener.cpp" />
112113
</ItemGroup>

platforms/windows/projects/Network/Network.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,8 @@
208208
<ClCompile Include="..\..\..\..\source\network\packets\SetRidingPacket.cpp">
209209
<Filter>Source Files\Packets</Filter>
210210
</ClCompile>
211+
<ClCompile Include="..\..\..\..\source\network\packets\UpdateStatPacket.cpp">
212+
<Filter>Source Files\Packets</Filter>
213+
</ClCompile>
211214
</ItemGroup>
212215
</Project>

platforms/windows/projects/Stats/Stats.vcxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,22 @@
2323
<ClInclude Include="$(MC_ROOT)\source\stats\Achievements.hpp" />
2424
<ClInclude Include="$(MC_ROOT)\source\stats\Stat.hpp" />
2525
<ClInclude Include="$(MC_ROOT)\source\stats\StatFormatter.hpp" />
26+
<ClInclude Include="..\..\..\..\source\stats\AchievementMap.hpp" />
27+
<ClInclude Include="..\..\..\..\source\stats\CustomStat.hpp" />
28+
<ClInclude Include="..\..\..\..\source\stats\Stats.hpp" />
29+
<ClInclude Include="..\..\..\..\source\stats\StatsCounter.hpp" />
30+
<ClInclude Include="..\..\..\..\source\stats\StatsSyncher.hpp" />
2631
</ItemGroup>
2732
<ItemGroup>
2833
<ClCompile Include="$(MC_ROOT)\source\stats\Achievement.cpp" />
2934
<ClCompile Include="$(MC_ROOT)\source\stats\Achievements.cpp" />
3035
<ClCompile Include="$(MC_ROOT)\source\stats\Stat.cpp" />
3136
<ClCompile Include="$(MC_ROOT)\source\stats\StatFormatter.cpp" />
37+
<ClCompile Include="..\..\..\..\source\stats\AchievementMap.cpp" />
38+
<ClCompile Include="..\..\..\..\source\stats\CustomStat.cpp" />
39+
<ClCompile Include="..\..\..\..\source\stats\Stats.cpp" />
40+
<ClCompile Include="..\..\..\..\source\stats\StatsCounter.cpp" />
41+
<ClCompile Include="..\..\..\..\source\stats\StatsSyncher.cpp" />
3242
</ItemGroup>
3343
<PropertyGroup Label="Globals">
3444
<VCProjectVersion>17.0</VCProjectVersion>

platforms/windows/projects/Stats/Stats.vcxproj.filters

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121
<ClInclude Include="$(MC_ROOT)\source\stats\StatFormatter.hpp">
2222
<Filter>Header Files</Filter>
2323
</ClInclude>
24+
<ClInclude Include="..\..\..\..\source\stats\AchievementMap.hpp">
25+
<Filter>Header Files</Filter>
26+
</ClInclude>
27+
<ClInclude Include="..\..\..\..\source\stats\CustomStat.hpp">
28+
<Filter>Header Files</Filter>
29+
</ClInclude>
30+
<ClInclude Include="..\..\..\..\source\stats\Stats.hpp">
31+
<Filter>Header Files</Filter>
32+
</ClInclude>
33+
<ClInclude Include="..\..\..\..\source\stats\StatsCounter.hpp">
34+
<Filter>Header Files</Filter>
35+
</ClInclude>
36+
<ClInclude Include="..\..\..\..\source\stats\StatsSyncher.hpp">
37+
<Filter>Header Files</Filter>
38+
</ClInclude>
2439
</ItemGroup>
2540
<ItemGroup>
2641
<ClCompile Include="$(MC_ROOT)\source\stats\Achievement.cpp">
@@ -35,5 +50,20 @@
3550
<ClCompile Include="$(MC_ROOT)\source\stats\StatFormatter.cpp">
3651
<Filter>Source Files</Filter>
3752
</ClCompile>
53+
<ClCompile Include="..\..\..\..\source\stats\AchievementMap.cpp">
54+
<Filter>Source Files</Filter>
55+
</ClCompile>
56+
<ClCompile Include="..\..\..\..\source\stats\Stats.cpp">
57+
<Filter>Source Files</Filter>
58+
</ClCompile>
59+
<ClCompile Include="..\..\..\..\source\stats\CustomStat.cpp">
60+
<Filter>Source Files</Filter>
61+
</ClCompile>
62+
<ClCompile Include="..\..\..\..\source\stats\StatsSyncher.cpp">
63+
<Filter>Source Files</Filter>
64+
</ClCompile>
65+
<ClCompile Include="..\..\..\..\source\stats\StatsCounter.cpp">
66+
<Filter>Source Files</Filter>
67+
</ClCompile>
3868
</ItemGroup>
3969
</Project>

platforms/windows/projects/World/World.vcxproj.filters

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,6 @@
677677
<ClCompile Include="..\..\..\..\source\world\tile\entity\FurnaceTileEntity.cpp">
678678
<Filter>Source Files\Tile\Entity</Filter>
679679
</ClCompile>
680-
<ClCompile Include="..\..\..\..\source\world\item\FurnaceResultSlot.cpp">
681-
<Filter>Source Files\Item\Crafting</Filter>
682-
</ClCompile>
683680
<ClCompile Include="..\..\..\..\source\world\item\FurnaceMenu.cpp">
684681
<Filter>Source Files\Item\Inventory</Filter>
685682
</ClCompile>
@@ -932,6 +929,9 @@
932929
<ClCompile Include="..\..\..\..\source\world\item\ContainerListener.cpp">
933930
<Filter>Source Files\Item\Inventory</Filter>
934931
</ClCompile>
932+
<ClCompile Include="..\..\..\..\source\world\item\FurnaceResultSlot.cpp">
933+
<Filter>Source Files\Item\Inventory</Filter>
934+
</ClCompile>
935935
</ItemGroup>
936936
<ItemGroup>
937937
<ClInclude Include="$(MC_ROOT)\source\world\entity\Entity.hpp">

source/client/app/Minecraft.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
// custom:
4040
#include "client/renderer/PatchManager.hpp"
4141
#include "client/locale/Language.hpp"
42+
#include "stats/AchievementMap.hpp"
43+
#include "stats/Stats.hpp"
4244

4345
float Minecraft::_renderScaleMultiplier = 1.0f;
4446

@@ -72,20 +74,21 @@ Minecraft::Minecraft() :
7274
m_pGameMode = nullptr;
7375
m_pTextures = nullptr;
7476
m_pFont = nullptr;
77+
m_pStatsCounter = nullptr;
7578
m_pRakNetInstance = nullptr;
7679
m_pNetEventCallback = nullptr;
7780
field_2B0 = 0;
7881
m_pUser = nullptr;
7982
m_pLevel = nullptr;
8083
m_pPlayer = nullptr;
81-
m_pCameraEntity = nullptr; // why is there a duplicate? (this is used for the camera)
84+
m_pCameraEntity = nullptr;
8285
field_D0C = 0;
8386
m_pScreen = nullptr;
8487
field_D18 = 10;
8588
m_pInputHolder = nullptr;
8689
m_bGrabbedMouse = false; // this was true by default. why? we do not start off in-game...
8790
m_bIsTouchscreen = false;
88-
m_pLevelStorageSource = nullptr; // TODO
91+
m_pLevelStorageSource = nullptr;
8992
m_bIsLevelLoaded = false;
9093
m_ticks = 0;
9194
m_missTime = 0;
@@ -683,6 +686,7 @@ void Minecraft::tick()
683686

684687
tickInput();
685688

689+
m_pStatsCounter->tick();
686690
m_gui.tick();
687691

688692
if (m_async.empty())
@@ -830,6 +834,7 @@ void Minecraft::init()
830834
m_pGameRenderer = new GameRenderer(this);
831835
m_pParticleEngine = new ParticleEngine(m_pLevel, m_pTextures);
832836
m_pUser = new User(getOptions()->m_playerName.get(), "");
837+
m_pStatsCounter = new StatsCounter(m_pUser, m_externalStorageDir);
833838

834839
setScreen(new IntroScreen);
835840
m_async.emplace_back(std::bind(&Minecraft::initAssets, this));
@@ -842,6 +847,7 @@ void Minecraft::initAssets()
842847
GrassColor::init(m_pPlatform->loadTexture("misc/grasscolor.png", true));
843848
FoliageColor::init(m_pPlatform->loadTexture("misc/foliagecolor.png", true));
844849
Language::getInstance()->init(getOptions());
850+
AchievementMap::getInstance()->init();
845851
}
846852

847853
Minecraft::~Minecraft()
@@ -1043,7 +1049,7 @@ void Minecraft::setLevel(Level* pLevel, const std::string& text, std::shared_ptr
10431049

10441050
if (m_pRakNetInstance->m_bIsHost && m_pMinecraftServer && m_pMinecraftServer->m_pConnection->m_onlinePlayers.empty())
10451051
{
1046-
m_pRakNetInstance->announceServer(m_pUser->m_guid);
1052+
m_pRakNetInstance->announceServer(m_pUser->m_username);
10471053
_levelGenerated();
10481054
}
10491055
else if (!m_pRakNetInstance->m_bIsHost)
@@ -1120,12 +1126,18 @@ void Minecraft::selectLevel(const std::string& a, std::function<void(LevelData&)
11201126
hostMultiplayer();
11211127
if (prepare)
11221128
prepare(m_pMinecraftServer->m_levelData);
1129+
1130+
m_pStatsCounter->addStat(Stats::startGame, 1);
11231131
if (m_pMinecraftServer->m_bIsNew)
11241132
{
1133+
m_pStatsCounter->addStat(Stats::createWorld, 1);
11251134
m_delayed.push_back(std::bind(&Minecraft::setLevel, this, m_pMinecraftServer->getLevel(), "Generating level", nullptr));
11261135
}
11271136
else
1137+
{
1138+
m_pStatsCounter->addStat(Stats::loadWorld, 1);
11281139
m_delayed.push_back(std::bind(&Minecraft::setLevel, this, m_pMinecraftServer->getLevel(m_pMinecraftServer->m_levelData.getDimension()), "Loading level", nullptr));
1140+
}
11291141
m_bIsLevelLoaded = true;
11301142
}
11311143

@@ -1155,7 +1167,7 @@ void Minecraft::leaveGame()
11551167
void Minecraft::hostMultiplayer()
11561168
{
11571169
#ifndef __EMSCRIPTEN__
1158-
m_pRakNetInstance->host(m_pUser->m_guid, C_DEFAULT_PORT, C_MAX_CONNECTIONS);
1170+
m_pRakNetInstance->host(m_pUser->m_username, C_DEFAULT_PORT, C_MAX_CONNECTIONS);
11591171
ServerSideNetworkHandler* handler = new ServerSideNetworkHandler(this, m_pRakNetInstance);
11601172
m_pNetEventCallback = handler;
11611173
m_pMinecraftServer->setConnection(handler);

0 commit comments

Comments
 (0)