6th batch of changes

This commit is contained in:
Mohamed Ashraf 2026-03-03 00:26:38 +04:00
parent 2e34f54ba7
commit d63a688bec
6 changed files with 26 additions and 12 deletions

View file

@ -1,7 +1,7 @@
#pragma once
#include "..\Minecraft.World\SmoothFloat.h"
#include "..\Minecraft.World\net.minecraft.world.entity.player.h"
#include "..\Minecraft.World\Pos.h"
#include "../Minecraft.World/SmoothFloat.h"
#include "../Minecraft.World/net.minecraft.world.entity.player.h"
#include "../Minecraft.World/Pos.h"
class Level;
class User;
class CompoundTag;

View file

@ -1,9 +1,9 @@
#pragma once
using namespace std;
#include "..\Minecraft.World\HashExtension.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "..\Minecraft.World\net.minecraft.world.entity.h"
#include "..\Minecraft.World\JavaIntHash.h"
#include "../Minecraft.World/HashExtension.h"
#include "../Minecraft.World/net.minecraft.world.level.h"
#include "../Minecraft.World/net.minecraft.world.entity.h"
#include "../Minecraft.World/JavaIntHash.h"
class ClientConnection;
class MultiPlayerChunkCache;

View file

@ -1,6 +1,6 @@
#pragma once
#include "LocalPlayer.h"
#include "..\Minecraft.World\SharedConstants.h"
#include "../Minecraft.World/SharedConstants.h"
class ClientConnection;
class Minecraft;

View file

@ -1992,6 +1992,7 @@ target_compile_options(${PROJECT_NAME} PRIVATE
-fpermissive
-Wtemplate-body
-Wshift-count-overflow
-pthread
-std=c++11
)

View file

@ -17,14 +17,17 @@
#include "EntityPos.h"
#include "Entity.h"
#include "SoundTypes.h"
#include "..\minecraft.Client\HumanoidModel.h"
#include "..\Minecraft.Client\MinecraftServer.h"
#include "..\Minecraft.Client\MultiPlayerLevel.h"
#include "..\Minecraft.Client\MultiplayerLocalPlayer.h"
#include "../Minecraft.Client/HumanoidModel.h"
#include "../Minecraft.Client/MinecraftServer.h"
#include "../Minecraft.Client/MultiPlayerLevel.h"
#include "../Minecraft.Client/MultiPlayerLocalPlayer.h"
#include "../Minecraft.Client/Windows64/Windows64_App.h"
int Entity::entityCounter = 2048; // 4J - changed initialiser to 2048, as we are using range 0 - 2047 as special unique smaller ids for things that need network tracked
#ifdef _WIN32
DWORD Entity::tlsIdx = TlsAlloc();
#endif // _WIN32
// 4J - added getSmallId & freeSmallId methods
unsigned int Entity::entityIdUsedFlags[2048/32] = {0};
@ -44,7 +47,12 @@ int Entity::getSmallId()
// for final notification to the client that the entities are removed. We can't go re-using these small Ids yet, as otherwise we will
// potentially end up telling the client that the entity has been removed After we have already re-used its Id and created a new entity.
// This ends up with newly created client-side entities being removed by accident, causing invisible mobs.
#ifdef _WIN32
if( ((size_t)TlsGetValue(tlsIdx) != 0 ) )
#else
pthread_key_create(&tlsKey, nullptr);
if ( ((size_t)pthread_getspecific(tlsKey) != 0) )
#endif
{
MinecraftServer *server = MinecraftServer::getInstance();
if( server )

View file

@ -5,6 +5,7 @@ using namespace std;
#include "FloatTag.h"
#include "Vec3.h"
#include "Definitions.h"
#include <pthread.h>
class Mob;
class LightningBolt;
@ -365,7 +366,11 @@ private:
static int extraWanderIds[EXTRA_WANDER_MAX];
static int extraWanderCount;
static int extraWanderTicks;
#if defined(_WIN32)
static DWORD tlsIdx;
#else
static pthread_key_t tlsKey;
#endif
public:
static void tickExtraWandering();
static void countFlagsForPIX();