Paper/CraftBukkit-Patches/0043-Texture-Pack-Resolutions.patch

75 lines
3.4 KiB
Diff

From 4a8f60ad4f5babc013cd49f510bea117f9356cc3 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 13:04:45 +1100
Subject: [PATCH] Texture Pack Resolutions
Fix issues when specifiying a server texture pack URL with resolution != 16.
---
src/main/java/net/minecraft/server/MinecraftServer.java | 2 +-
src/main/java/org/bukkit/craftbukkit/Spigot.java | 2 ++
src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 2 +-
src/main/resources/configurations/bukkit.yml | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3689a3d..9a78084 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1075,7 +1075,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public int S() {
- return 16;
+ return org.bukkit.craftbukkit.Spigot.textureResolution; // Spigot
}
public abstract boolean T();
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index bce217e..8fd635f 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -24,6 +24,7 @@ public class Spigot {
public static boolean tabPing = false;
private static Metrics metrics;
public static List<String> bungeeIPs;
+ public static int textureResolution = 16;
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
@@ -62,6 +63,7 @@ public class Spigot {
tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
bungeeIPs = configuration.getStringList("settings.bungee-proxies");
+ textureResolution = configuration.getInt("settings.texture-resolution", textureResolution);
if (metrics == null) {
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3c34a4c..8361614 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -828,7 +828,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setTexturePack(String url) {
Validate.notNull(url, "Texture pack URL cannot be null");
- byte[] message = (url + "\0" + "16").getBytes();
+ byte[] message = (url + "\0" + org.bukkit.craftbukkit.Spigot.textureResolution).getBytes(); // Spigot
Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");
getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message));
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
index 64f68a2..4034c6f 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
@@ -37,6 +37,7 @@ settings:
restart-script-location: /path/to/server/start.sh
bungee-proxies:
- 127.0.0.1
+ texture-resolution: 16
world-settings:
default:
growth-chunks-per-tick: 650
--
1.8.1-rc2