mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-03-25 14:21:55 +02:00
Fix stale held item appearing when switching worlds (#910)
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
This commit is contained in:
@@ -930,6 +930,14 @@ void ItemInHandRenderer::tick()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ItemInHandRenderer::reset()
|
||||||
|
{
|
||||||
|
selectedItem = nullptr;
|
||||||
|
lastSlot = -1;
|
||||||
|
height = 0.0f;
|
||||||
|
oHeight = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void ItemInHandRenderer::itemPlaced()
|
void ItemInHandRenderer::itemPlaced()
|
||||||
{
|
{
|
||||||
height = 0;
|
height = 0;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ private:
|
|||||||
int lastSlot;
|
int lastSlot;
|
||||||
public:
|
public:
|
||||||
void tick();
|
void tick();
|
||||||
|
void reset();
|
||||||
void itemPlaced();
|
void itemPlaced();
|
||||||
void itemUsed();
|
void itemUsed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Textures.h"
|
#include "Textures.h"
|
||||||
#include "GameRenderer.h"
|
#include "GameRenderer.h"
|
||||||
|
#include "ItemInHandRenderer.h"
|
||||||
#include "HumanoidModel.h"
|
#include "HumanoidModel.h"
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
#include "TexturePackRepository.h"
|
#include "TexturePackRepository.h"
|
||||||
@@ -217,6 +218,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
|
|||||||
m_pendingLocalConnections[i] = NULL;
|
m_pendingLocalConnections[i] = NULL;
|
||||||
m_connectionFailed[i] = false;
|
m_connectionFailed[i] = false;
|
||||||
localgameModes[i]=NULL;
|
localgameModes[i]=NULL;
|
||||||
|
localitemInHandRenderers[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
animateTickLevel = NULL; // 4J added
|
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
|
// 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();
|
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)
|
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
|
// 4J We only need to save out in multiplayer is we are setting the level to NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user