aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Minecraft.cpp
diff options
context:
space:
mode:
authorAyush Thoren <ayushthoren@gmail.com>2026-03-08 12:12:49 -0700
committerGitHub <noreply@github.com>2026-03-09 03:12:49 +0800
commita14a4542c9a1d475c5bbb3f9ff6bf80be43e680a (patch)
tree88049674e24bad99ae8bcfe3e158c3316fe4bf49 /Minecraft.Client/Minecraft.cpp
parent2f443fe333000595319e23c6e78b3d00d7f91f40 (diff)
Fix stale held item appearing when switching worlds (#910)
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
Diffstat (limited to 'Minecraft.Client/Minecraft.cpp')
-rw-r--r--Minecraft.Client/Minecraft.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp
index 599a14f2..1fc8bd54 100644
--- a/Minecraft.Client/Minecraft.cpp
+++ b/Minecraft.Client/Minecraft.cpp
@@ -10,6 +10,7 @@
#include "User.h"
#include "Textures.h"
#include "GameRenderer.h"
+#include "ItemInHandRenderer.h"
#include "HumanoidModel.h"
#include "Options.h"
#include "TexturePackRepository.h"
@@ -217,6 +218,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
m_pendingLocalConnections[i] = NULL;
m_connectionFailed[i] = false;
localgameModes[i]=NULL;
+ localitemInHandRenderers[i] = NULL;
}
animateTickLevel = NULL; // 4J added
@@ -4240,6 +4242,17 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
// 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-NULL
gameRenderer->DisableUpdateThread();
+ if (level == NULL || player == NULL)
+ {
+ for (int i = 0; i < XUSER_MAX_COUNT; ++i)
+ {
+ if (localitemInHandRenderers[i] != NULL)
+ {
+ localitemInHandRenderers[i]->reset();
+ }
+ }
+ }
+
for(unsigned int i = 0; i < levels.length; ++i)
{
// 4J We only need to save out in multiplayer is we are setting the level to NULL