From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: feat: TU19 (Dec 2014) Features & Content (#155) * try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki --- Minecraft.World/PlayerTeam.cpp | 120 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 Minecraft.World/PlayerTeam.cpp (limited to 'Minecraft.World/PlayerTeam.cpp') diff --git a/Minecraft.World/PlayerTeam.cpp b/Minecraft.World/PlayerTeam.cpp new file mode 100644 index 00000000..3e159af4 --- /dev/null +++ b/Minecraft.World/PlayerTeam.cpp @@ -0,0 +1,120 @@ +#include "stdafx.h" +#include "net.minecraft.world.scores.h" +#include "PlayerTeam.h" + +PlayerTeam::PlayerTeam(Scoreboard *scoreboard, const wstring &name) +{ + this->scoreboard = scoreboard; + this->name = name; + displayName = name; + + prefix = L""; + suffix = L""; + allowFriendlyFire = true; + seeFriendlyInvisibles = true; +} + +Scoreboard *PlayerTeam::getScoreboard() +{ + return scoreboard; +} + +wstring PlayerTeam::getName() +{ + return name; +} + +wstring PlayerTeam::getDisplayName() +{ + return displayName; +} + +void PlayerTeam::setDisplayName(const wstring &displayName) +{ + //if (displayName == null) throw new IllegalArgumentException("Name cannot be null"); + this->displayName = displayName; + scoreboard->onTeamChanged(this); +} + +unordered_set *PlayerTeam::getPlayers() +{ + return &players; +} + +wstring PlayerTeam::getPrefix() +{ + return prefix; +} + +void PlayerTeam::setPrefix(const wstring &prefix) +{ + //if (prefix == null) throw new IllegalArgumentException("Prefix cannot be null"); + this->prefix = prefix; + scoreboard->onTeamChanged(this); +} + +wstring PlayerTeam::getSuffix() +{ + return suffix; +} + +void PlayerTeam::setSuffix(const wstring &suffix) +{ + //if (suffix == null) throw new IllegalArgumentException("Suffix cannot be null"); + this->suffix = suffix; + scoreboard->onTeamChanged(this); +} + +wstring PlayerTeam::getFormattedName(const wstring &teamMemberName) +{ + return getPrefix() + teamMemberName + getSuffix(); +} + +wstring PlayerTeam::formatNameForTeam(PlayerTeam *team) +{ + return formatNameForTeam(team, team->getDisplayName()); +} + +wstring PlayerTeam::formatNameForTeam(Team *team, const wstring &name) +{ + if (team == NULL) return name; + return team->getFormattedName(name); +} + +bool PlayerTeam::isAllowFriendlyFire() +{ + return allowFriendlyFire; +} + +void PlayerTeam::setAllowFriendlyFire(bool allowFriendlyFire) +{ + this->allowFriendlyFire = allowFriendlyFire; + scoreboard->onTeamChanged(this); +} + +bool PlayerTeam::canSeeFriendlyInvisibles() +{ + return seeFriendlyInvisibles; +} + +void PlayerTeam::setSeeFriendlyInvisibles(bool seeFriendlyInvisibles) +{ + this->seeFriendlyInvisibles = seeFriendlyInvisibles; + scoreboard->onTeamChanged(this); +} + +int PlayerTeam::packOptions() +{ + int result = 0; + + if (isAllowFriendlyFire()) result |= 1 << BIT_FRIENDLY_FIRE; + if (canSeeFriendlyInvisibles()) result |= 1 << BIT_SEE_INVISIBLES; + + return result; +} + +void PlayerTeam::unpackOptions(int options) +{ + setAllowFriendlyFire((options & (1 << BIT_FRIENDLY_FIRE)) > 0); + setSeeFriendlyInvisibles((options & (1 << BIT_SEE_INVISIBLES)) > 0); +} \ No newline at end of file -- cgit v1.2.3