diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 8d960997c..81a8a7925 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->mustAccept = $manager->resourcePacksRequired(); + $pk->removeClientResourcePacks = $manager->removeClientResourcePacks(); $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 41fd445e7..4e68d3a42 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 $mustAccept = false; + public $removeClientResourcePacks = false; /** @var ResourcePack[] */ public $behaviorPackStack = []; @@ -48,7 +48,7 @@ class ResourcePackStackPacket extends DataPacket{ public $baseGameVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK; protected function decodePayload(){ - $this->mustAccept = $this->getBool(); + $this->removeClientResourcePacks = $this->getBool(); $behaviorPackCount = $this->getUnsignedVarInt(); while($behaviorPackCount-- > 0){ $this->getString(); @@ -68,7 +68,7 @@ class ResourcePackStackPacket extends DataPacket{ } protected function encodePayload(){ - $this->putBool($this->mustAccept); + $this->putBool($this->removeClientResourcePacks); $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 f004df611..89a664365 100644 --- a/src/pocketmine/resourcepacks/ResourcePackManager.php +++ b/src/pocketmine/resourcepacks/ResourcePackManager.php @@ -43,6 +43,8 @@ class ResourcePackManager{ /** @var bool */ private $serverForceResources = false; + /** @var bool */ + private $removeClientResourcePacks = false; /** @var ResourcePack[] */ private $resourcePacks = []; @@ -71,6 +73,7 @@ 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..."); @@ -136,6 +139,16 @@ 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 39677852d..7c1422f6c 100644 --- a/src/pocketmine/resources/resource_packs.yml +++ b/src/pocketmine/resources/resource_packs.yml @@ -3,6 +3,13 @@ #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.