linux (compat): Add linux to most Win64 guards

This commit is contained in:
Anaël committed 2026-11-29 13:33:39 +01:00
1 parent 8cf5675892
commit 9626065598
180 files changed
+941 -935

No files matched your search

+23 -23
View File
@@ -37,7 +37,7 @@
#include "../Minecraft.World/LevelChunk.h"
#include "LevelRenderer.h"
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
#include "../Minecraft.Server/FourKitBridge.h"
#include "../Minecraft.World/ChatPacket.h"
@@ -789,7 +789,7 @@ shared_ptr<ItemInstance> ServerPlayer::getCarried(int slot)
void ServerPlayer::die(DamageSource *source)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
shared_ptr<ChatPacket> deathPacket = getCombatTracker()->getDeathMessagePacket();
std::wstring deathMsg = FormatDeathMessage(deathPacket);
@@ -1041,7 +1041,7 @@ void ServerPlayer::changeDimension(int i)
}
else
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
bool portalDestModified = false;
double portalOutX = 0, portalOutY = 0, portalOutZ = 0;
#endif
@@ -1052,7 +1052,7 @@ void ServerPlayer::changeDimension(int i)
Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn();
if (pos != nullptr)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
{
double outX, outY, outZ;
bool cancelled = FourKitBridge::FirePlayerPortal(entityId,
@@ -1077,7 +1077,7 @@ void ServerPlayer::changeDimension(int i)
}
else
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
{
double scale = server->getLevel(i)->getLevelData()->getHellScale();
double toX = x, toY = y, toZ = z;
@@ -1114,7 +1114,7 @@ void ServerPlayer::changeDimension(int i)
}
server->getPlayers()->toggleDimension( dynamic_pointer_cast<ServerPlayer>(shared_from_this()), i);
connection->send(std::make_shared<LevelEventPacket>(LevelEvent::SOUND_PORTAL_TRAVEL, 0, 0, 0, 0, false));
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (portalDestModified)
{
connection->teleport(portalOutX, portalOutY, portalOutZ, yRot, xRot);
@@ -1149,7 +1149,7 @@ void ServerPlayer::take(shared_ptr<Entity> e, int orgCount)
Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, bool bTestUse)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (!bTestUse && FourKitBridge::FireBedEnter(entityId, dimension, x, y, z))
return OTHER_PROBLEM;
#endif
@@ -1166,7 +1166,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo
void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
int bedX = bedPosition ? bedPosition->x : 0;
int bedY = bedPosition ? bedPosition->y : 0;
int bedZ = bedPosition ? bedPosition->z : 0;
@@ -1178,7 +1178,7 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
}
Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (wasSleeping)
FourKitBridge::FireBedLeave(entityId, dimension, bedX, bedY, bedZ);
#endif
@@ -1227,7 +1227,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z)
containerMenu = new CraftingMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::WORKBENCH, L"", 9))
{
doCloseContainer();
@@ -1253,7 +1253,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9))
{
doCloseContainer();
@@ -1271,7 +1271,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9))
{
doCloseContainer();
@@ -1297,7 +1297,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name)
containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9))
{
doCloseContainer();
@@ -1323,7 +1323,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z)
containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast<Player>(shared_from_this()));
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::REPAIR_TABLE, L"", 9))
{
doCloseContainer();
@@ -1354,7 +1354,7 @@ bool ServerPlayer::openContainer(shared_ptr<Container> container)
containerMenu = new ContainerMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, containerType, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
@@ -1380,7 +1380,7 @@ bool ServerPlayer::openHopper(shared_ptr<HopperTileEntity> container)
containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
@@ -1406,7 +1406,7 @@ bool ServerPlayer::openHopper(shared_ptr<MinecartHopper> container)
containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
@@ -1432,7 +1432,7 @@ bool ServerPlayer::openFurnace(shared_ptr<FurnaceTileEntity> furnace)
containerMenu = new FurnaceMenu(inventory, furnace);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize()))
{
doCloseContainer();
@@ -1458,7 +1458,7 @@ bool ServerPlayer::openTrap(shared_ptr<DispenserTileEntity> trap)
containerMenu = new TrapMenu(inventory, trap);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize()))
{
doCloseContainer();
@@ -1484,7 +1484,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr<BrewingStandTileEntity> brewing_s
containerMenu = new BrewingStandMenu(inventory, brewing_stand);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BREWING_STAND, brewing_stand->getCustomName(), brewing_stand->getContainerSize()))
{
doCloseContainer();
@@ -1510,7 +1510,7 @@ bool ServerPlayer::openBeacon(shared_ptr<BeaconTileEntity> beacon)
nextContainerCounter();
containerMenu = new BeaconMenu(inventory, beacon);
containerMenu->containerId = containerCounter;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize()))
{
doCloseContainer();
@@ -1541,7 +1541,7 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
containerMenu->addSlotListener(this);
shared_ptr<Container> container = static_cast<MerchantMenu *>(containerMenu)->getTradeContainer();
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize()))
{
doCloseContainer();
@@ -1582,7 +1582,7 @@ bool ServerPlayer::openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<
containerMenu = new HorseInventoryMenu(inventory, container, horse);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize()))
{
doCloseContainer();