From 4794ba236a551bd839bbb8565474c19f93d97c30 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 4 Jan 2020 16:04:07 +0000 Subject: [PATCH] Revert "resource packs: added new option remove_client_resources, fixed client packs being removed when forcing resource pack download" This reverts commit 06ec8b83978fcc52a7964d678a97c73b50a97aa8. unfortunately, this had some unanticipated side effects, thanks to idiotic behaviour in the client ... when having optional downloads but trying to force resources, the client chokes because it thinks the server is forcing it to apply a pack that it doesn't have. Since there's no way to detect when this problem occurs in the protocol, the only option is to revert this. --- src/pocketmine/Player.php | 2 +- .../mcpe/protocol/ResourcePackStackPacket.php | 6 +++--- .../resourcepacks/ResourcePackManager.php | 13 ------------- src/pocketmine/resources/resource_packs.yml | 7 ------- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 81a8a7925..8d960997c 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2118,7 +2118,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new ResourcePackStackPacket(); $manager = $this->server->getResourcePackManager(); $pk->resourcePackStack = $manager->getResourceStack(); - $pk->removeClientResourcePacks = $manager->removeClientResourcePacks(); + $pk->mustAccept = $manager->resourcePacksRequired(); $this->dataPacket($pk); break; case ResourcePackClientResponsePacket::STATUS_COMPLETED: diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php index 4e68d3a42..41fd445e7 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php @@ -35,7 +35,7 @@ class ResourcePackStackPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_STACK_PACKET; /** @var bool */ - public $removeClientResourcePacks = false; + public $mustAccept = false; /** @var ResourcePack[] */ public $behaviorPackStack = []; @@ -48,7 +48,7 @@ class ResourcePackStackPacket extends DataPacket{ public $baseGameVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK; protected function decodePayload(){ - $this->removeClientResourcePacks = $this->getBool(); + $this->mustAccept = $this->getBool(); $behaviorPackCount = $this->getUnsignedVarInt(); while($behaviorPackCount-- > 0){ $this->getString(); @@ -68,7 +68,7 @@ class ResourcePackStackPacket extends DataPacket{ } protected function encodePayload(){ - $this->putBool($this->removeClientResourcePacks); + $this->putBool($this->mustAccept); $this->putUnsignedVarInt(count($this->behaviorPackStack)); foreach($this->behaviorPackStack as $entry){ diff --git a/src/pocketmine/resourcepacks/ResourcePackManager.php b/src/pocketmine/resourcepacks/ResourcePackManager.php index 89a664365..f004df611 100644 --- a/src/pocketmine/resourcepacks/ResourcePackManager.php +++ b/src/pocketmine/resourcepacks/ResourcePackManager.php @@ -43,8 +43,6 @@ class ResourcePackManager{ /** @var bool */ private $serverForceResources = false; - /** @var bool */ - private $removeClientResourcePacks = false; /** @var ResourcePack[] */ private $resourcePacks = []; @@ -73,7 +71,6 @@ class ResourcePackManager{ $resourcePacksConfig = new Config($this->path . "resource_packs.yml", Config::YAML, []); $this->serverForceResources = (bool) $resourcePacksConfig->get("force_resources", false); - $this->removeClientResourcePacks = (bool) $resourcePacksConfig->get("remove_client_resources", false); $logger->info("Loading resource packs..."); @@ -139,16 +136,6 @@ class ResourcePackManager{ return $this->serverForceResources; } - /** - * Returns whether client-sided global resources will be removed. - * Useful if you want to force vanilla resources. - * - * @return bool - */ - public function removeClientResourcePacks() : bool{ - return $this->removeClientResourcePacks; - } - /** * Returns an array of resource packs in use, sorted in order of priority. * @return ResourcePack[] diff --git a/src/pocketmine/resources/resource_packs.yml b/src/pocketmine/resources/resource_packs.yml index 7c1422f6c..39677852d 100644 --- a/src/pocketmine/resources/resource_packs.yml +++ b/src/pocketmine/resources/resource_packs.yml @@ -3,13 +3,6 @@ #Choose whether players must use your chosen resource packs to join the server. #NOTE: This will do nothing if there are no resource packs in the stack below. force_resources: false - -#Choose whether players are allowed to use their own client-side packs in addition to the server ones. -#If false, server packs will apply on top of client global packs. -#If true, server packs will apply directly on top of vanilla and client packs will be removed. -#You can use this with an empty resource stack to force vanilla-only textures. -remove_client_resources: false - resource_stack: #Resource packs here are applied from bottom to top. This means that resources in higher packs will override those in lower packs. #Entries here must indicate the filename of the resource pack.