mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 11:24:11 +01:00
Add new setResourcePack method. Fixes BUKKIT-5015
Minecraft now uses resource packs instead of texture packs, which broke the setTexturePack method, as the client no longer listens on the MC|TPack channel. This commit fixes the issue by adding in a setResourcePack method, and by deprecating setTexturePack and rewriting it to call the newly added setResourcePack. In order to simplify the method and prevent this from happening in the future, setResourcePack calls EntityPlayer.a(String) to use the same logic as minecraft when sending resource packs. By: Nate Mortensen <nate.richard.mortensen@gmail.com>
This commit is contained in:
parent
4caf845eae
commit
a6a6c99078
1 changed files with 6 additions and 4 deletions
|
@ -880,12 +880,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
}
|
||||
|
||||
public void setTexturePack(String url) {
|
||||
Validate.notNull(url, "Texture pack URL cannot be null");
|
||||
setResourcePack(url);
|
||||
}
|
||||
|
||||
byte[] message = (url + "\0" + "16").getBytes();
|
||||
Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");
|
||||
@Override
|
||||
public void setResourcePack(String url) {
|
||||
Validate.notNull(url, "Resource pack URL cannot be null");
|
||||
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|TPack", message));
|
||||
getHandle().a(url); // should be setResourcePack
|
||||
}
|
||||
|
||||
public void addChannel(String channel) {
|
||||
|
|
Loading…
Reference in a new issue