0x48 S48PacketResourcePackSend
Sends a resource pack URL and hash. Client downloads and applies it.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| url | String | Download URL |
| hash | String | SHA-1 hash |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| URL | String | |
| Hash | String | SHA-1 hash |
MCP References
NetHandlerPlayClient.handleResourcePackSend()Handler Interface
INetHandlerPlayClientNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
Deobfuscated MCP 1.8.9 source of S48PacketResourcePackSend, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S48PacketResourcePackSend.java) at build time and verified present.
Deep Dive
Role in the protocol
The server orders the client to load a resource pack. Two strings travel: the URL and a SHA-1 hash used for integrity. The vanilla flow downloads the pack, applies it and answers with C19PacketResourcePackStatus (ACCEPTED, DECLINED, FAILED_DOWNLOAD, SUCCESSFULLY_LOADED). The level:// scheme is the sharp edge: vanilla maps level://name to a file inside the local saves directory, so the URL doubles as a local file path.
Vanilla handling
handleResourcePack branches on the scheme. level:// URLs resolve against mcDataDir/saves: if the file exists the pack loads and ACCEPTED then SUCCESSFULLY_LOADED are sent; if not, FAILED_DOWNLOAD. HTTP(S) URLs go through the resource pack repository asynchronously, with a GUI prompt unless the server's resource mode is ENABLED or DISABLED.
Why clients touch it
Three defensive implementations in the corpus. Rise 6.1.30 and 6.2.4 run ResourcePackCheck as a SecurityFeature: it validates the scheme, decodes the level:// path, and rejects any URL containing ".." or not ending in /resources.zip, answering with C19 FAILED_DOWNLOAD. Tenacity's AntiExploit module cancels the packet and sends FAILED_DOWNLOAD for the same classes of malicious URLs. LiquidSense Dev injects MixinNetHandlerPlayClient with a HEAD-cancellable @Inject on handleResourcePack that performs the identical scheme and level:// checks, replying C19 FAILED_DOWNLOAD and cancelling the vanilla handler on failure. All three target the level:// traversal that reads arbitrary files from the saves folder.
Exploit surface
A level:// URL with ../ segments walks out of the saves directory into other local files, which the client then loads as a resource pack; vanilla does not verify the hash for level:// packs. Replying FAILED_DOWNLOAD keeps the server's state machine consistent so it stops waiting for a status, which is why both defenses send C19 rather than silently dropping the packet.
Server-Side Handling
Server side, the packet is built by EntityPlayerMP.loadResourcePack or sendResourcePack with an arbitrary URL and hash supplied by plugins or server config. The server waits for a C19 status before re-prompting; a client that never replies eventually stops receiving pack offers. The hash is echoed back verbatim in C19.
Protocol Analysis
Two strings: URL and SHA-1 hash. The level:// scheme is special-cased client-side, and the hash is ignored for level:// packs in vanilla. C19 carries the same hash back, so the status reply identifies which offer it answers. The packet id 0x48 is clientbound-only in PLAY state.
Anti-Cheat Landscape
Not a movement or combat surface: no anti-cheat measures S48 traffic. The defense angle is client security (file disclosure via level://), and both corpus implementations are client-side self-defense rather than anti-cheat bypasses.
implementation Implementation Cases
The resource pack push. Rise 6.x defends it as a SecurityFeature (ResourcePackCheck), Tenacity as an AntiExploit module, and LiquidSense Dev as an @Inject guard on MixinNetHandlerPlayClient; all three reject level:// path traversal URLs and reply C19 FAILED_DOWNLOAD to keep the server's status state machine moving.
Block malicious resource pack offers, specifically level:// URLs that read local files, before the vanilla download flow runs.
A SecurityFeature (not a toggleable module) whose handle() inspects every packet: for S48 it takes the URL and hash, and only acts on level:// URLs. The URL is parsed as a URI, the scheme must be http, https or level, and a decoded level path containing ".." or not ending in /resources.zip is rejected with C19 FAILED_DOWNLOAD. The attempted path is printed to stdout.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ResourcePackCheck.java =====
package com.alan.clients.security.impl;
import com.alan.clients.security.SecurityFeature;
import com.alan.clients.util.packet.PacketUtil;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.server.S48PacketResourcePackSend;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
public final class ResourcePackCheck extends SecurityFeature {
public ResourcePackCheck() {
super("Resource Pack Check", "Server attempted to view files on the computer");
}
@Override
public boolean handle(final Packet<?> packet) {
if (packet instanceof S48PacketResourcePackSend) {
final S48PacketResourcePackSend wrapper = ((S48PacketResourcePackSend) packet);
final String url = wrapper.getURL();
final String hash = wrapper.getHash();
if (url.toLowerCase().startsWith("level://")) {
return check(url, hash);
}
}
return false;
}
private boolean check(String url, final String hash) {
try {
final URI uri = new URI(url);
final String scheme = uri.getScheme();
final boolean isLevelProtocol = "level".equals(scheme);
if (!("http".equals(scheme) || "https".equals(scheme) || isLevelProtocol)) {
throw new URISyntaxException(url, "Wrong protocol");
}
url = URLDecoder.decode(url.substring("level://".length()), StandardCharsets.UTF_8.toString());
if (isLevelProtocol && (url.contains("..") || !url.endsWith("/resources.zip"))) {
System.out.println("Server tried to access the path: " + url);
throw new URISyntaxException(url, "Invalid levelstorage resource pack path");
}
return false;
} catch (final Exception e) {
PacketUtil.sendNoEvent(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
return true;
}
}
}
// NOTE (AI): The check is deliberately narrow: http and https passes through untouched, only the level:// file-reading scheme is validated. The FAILED_DOWNLOAD reply keeps the server from waiting on a status forever.Cancel malicious resource pack offers inside a general anti-exploit module, replying FAILED_DOWNLOAD so the server does not stall.
PacketReceiveEvent handler: for S48 the URL is parsed as a URI; non-http(s)/level schemes cancel the packet, and level:// URLs containing ".." or not ending in /resources.zip are cancelled with a C19 FAILED_DOWNLOAD reply. URISyntaxException also cancels with FAILED_DOWNLOAD. The same handler guards S43PacketCamera, S2APacketParticles, S27PacketExplosion, S18PacketEntityTeleport and S11PacketSpawnExperienceOrb, plus a 100-packet-per-second counter.
// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====
package dev.tenacity.module.impl.misc;
import dev.tenacity.event.IEventListener;
import dev.tenacity.event.impl.packet.PacketReceiveEvent;
import dev.tenacity.module.Module;
import dev.tenacity.module.ModuleCategory;
import dev.tenacity.util.misc.ChatUtil;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.server.*;
import java.net.URI;
import java.net.URISyntaxException;
public class AntiExploit extends Module {
private long lastExplosion = 0, lastExperience = 0;
private int invalidExperience = 0;
final int PACKET_THRESHOLD = 100;
final long CHECK_INTERVAL = 1000;
int packetCount = 0;
public AntiExploit() {
super("AntiExploit", "Prevents server exploits", ModuleCategory.MISC);
}
private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {
Packet<?> packet = event.getPacket();
handlePacketCount();
if(packet instanceof S48PacketResourcePackSend) {
S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;
try {
URI uri = new URI(resourcePack.getURL());
String scheme = uri.getScheme();
boolean isLevelProtocol = scheme.equalsIgnoreCase("level");
boolean isHttpProtocol = scheme.equalsIgnoreCase("http");
boolean isHttpsProtocol = scheme.equalsIgnoreCase("https");
if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {
ChatUtil.print("§cBlocked Exploit: Resource Pack");
event.cancel();
} else if(isLevelProtocol && (resourcePack.getURL().contains("..") || !((S48PacketResourcePackSend) packet).getURL().endsWith("/resources.zip"))) {
ChatUtil.print("§cBlocked Exploit: File Access");
event.cancel();
mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
}
} catch (URISyntaxException exception) {
ChatUtil.print("§cBlocked Exploit: Resource Pack");
event.cancel();
mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
}
} else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
} else if(packet instanceof S2APacketParticles) {
S2APacketParticles particles = (S2APacketParticles) packet;
if(Math.abs(particles.getParticleSpeed()) >= 1) {
ChatUtil.print("§cBlocked Exploit: Particles");
event.cancel();
} else if(((S2APacketParticles) packet).getParticleCount() > 1) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
}
} else if(packet instanceof S27PacketExplosion) {
S27PacketExplosion explosion = (S27PacketExplosion) packet;
if(Math.abs(explosion.getStrength()) > 1) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
} else if(System.currentTimeMillis() - lastExplosion <= 1) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
} else if(packet instanceof S2APacketParticles) {
S2APacketParticles particles = (S2APacketParticles) packet;
if(Math.abs(particles.getParticleSpeed()) > 1) {
ChatUtil.print("§cBlocked Exploit: Particles");
event.cancel();
} else if(particles.getParticleCount() >= 1) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
}
}
lastExplosion = System.currentTimeMillis();
} else if(packet instanceof S18PacketEntityTeleport) {
S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;
double packetX = Math.abs(teleport.getX());
double packetY = Math.abs(teleport.getY());
double packetZ = Math.abs(teleport.getZ());
if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {
ChatUtil.print("§cBlocked Exploit: Teleport");
event.cancel();
}
} else if(packet instanceof S11PacketSpawnExperienceOrb) {
if(System.currentTimeMillis() - lastExperience <= 1) {
invalidExperience++;
if(invalidExperience >= 2) {
ChatUtil.print("§cBlocked Exploit: Crash");
event.cancel();
}
} else {
invalidExperience = 0;
}
lastExperience = System.currentTimeMillis();
}
};
private void triggerKick() {
ChatUtil.print("§cAbnormal packet activity detected. Kicking player...");
}
private void handlePacketCount() {
long currentTime = System.currentTimeMillis();
long lastPacketCheckTime = 0;
if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {
packetCount = 0;
lastPacketCheckTime = currentTime;
}
packetCount++;
if (packetCount > PACKET_THRESHOLD) {
triggerKick();
packetCount = 0;
}
}
}
// NOTE (AI): AntiExploit is a catch-all client defense; the S48 branch mirrors Rise's ResourcePackCheck logic but as a user-facing module that prints a chat message for each blocked offer. The companion util Enhancements.validateResourcePackUrl holds the URL validation used elsewhere.Block malicious resource pack offers at the vanilla handler, cancelling the download before it starts.
An @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) mixin on NetHandlerPlayClient. It parses the URL as a URI, requires the scheme to be http, https or level, and rejects level:// URLs containing ".." or not ending in /resources.zip. On any URISyntaxException it logs the failure, sends C19PacketResourcePackStatus FAILED_DOWNLOAD through netManager, and cancels the vanilla handler.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.injection.forge.mixins.network;
import io.netty.buffer.Unpooled;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EntityMovementEvent;
import net.ccbluex.liquidbounce.event.PacketSenEvent;
import net.ccbluex.liquidbounce.features.module.modules.movement.Fly;
import net.ccbluex.liquidbounce.features.special.AntiForge;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.minecraft.client.ClientBrandRetriever;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiDownloadTerrain;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.network.*;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.network.play.client.C19PacketResourcePackStatus;
import net.minecraft.network.play.server.S01PacketJoinGame;
import net.minecraft.network.play.server.S14PacketEntity;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.world.WorldSettings;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.net.URI;
import java.net.URISyntaxException;
@Mixin(NetHandlerPlayClient.class)
public abstract class MixinNetHandlerPlayClient {
@Shadow
@Final
private NetworkManager netManager;
@Shadow
private Minecraft gameController;
@Shadow
private WorldClient clientWorldController;
@Shadow
public int currentServerMaxPlayers;
@Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true)
private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {
final String url = p_handleResourcePack_1_.getURL();
final String hash = p_handleResourcePack_1_.getHash();
try {
final String scheme = new URI(url).getScheme();
final boolean isLevelProtocol = "level".equals(scheme);
if(!"http".equals(scheme) && !"https".equals(scheme) && !isLevelProtocol)
throw new URISyntaxException(url, "Wrong protocol");
if(isLevelProtocol && (url.contains("..") || !url.endsWith("/resources.zip")))
throw new URISyntaxException(url, "Invalid levelstorage resourcepack path");
}catch(final URISyntaxException e) {
ClientUtils.getLogger().error("Failed to handle resource pack", e);
netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
callbackInfo.cancel();
}
}
@Inject(method = "handleJoinGame", at = @At("HEAD"), cancellable = true)
private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {
if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())
return;
PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);
this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);
this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
callbackInfo.cancel();
}
@Inject(method = "handleEntityMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;onGround:Z"))
private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {
final Entity entity = packetIn.getEntity(this.clientWorldController);
if(entity != null)
LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));
}
@Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true)
private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {
final PacketSenEvent event = new PacketSenEvent(packet);
LiquidBounce.eventManager.callEvent(event);
if (event.isCancelled()) {
callbackInfo.cancel();
}
}
@Overwrite
public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {
PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);
Container container = null;
EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;
if (packetIn.getWindowId() == 0) {
container = entityplayer.inventoryContainer;
} else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {
container = entityplayer.openContainer;
}
if (container != null && !packetIn.func_148888_e()) {
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
}
}
}
// NOTE (AI): Only the handleResourcePack inject concerns S48; the same file also injects handleJoinGame (AntiForge), handleEntityMovement, addToSendQueue, and overwrites handleConfirmTransaction, which are covered by other packets' writeups.anticheat Anti-Cheat Checks
Artemis is the only anticheat with logic on the send side of the resource-pack flow. Its PingSpoofProtocol pushes a fake S48 offer whose URL encodes a keepalive id and validates the client's C19 FAILED_DOWNLOAD reply, and ResourcePackTickHandler uses a level:// offer with a numeric hash as a tick-confirmation channel. These are the OUT-side arms of the same two checks documented on the C19PacketResourcePackStatus page. FlopAC's WrappedOutResourcePackSend and the Negativity RESOURCE_PACK_SEND constant are wrappers and registrations only.
Detect ping spoofing with a resource-pack offer as the probe: the server sends S48 with an id-encoded URL and verifies the client's C19 answer.
On 1.9 and older servers the check builds a GPacketPlayServerResourcePackSend whose URL is a generated numeric id (line 175) and pushes it to the client. It then expects the C19 response: FAILED_DOWNLOAD with a matching numeric URL, followed by the next keepalive echo. Missing, out-of-order or non-numeric responses log violations. On 1.10+ it switches to fake teleports because the packet's hash field was removed there.
// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.checks.enterprise/src/main/java/ac/artemis/checks/enterprise/spoof/PingSpoofProtocol.java =====
package ac.artemis.checks.enterprise.spoof;
import ac.artemis.core.v4.check.ArtemisCheck;
import ac.artemis.core.v4.check.FastProcessHandler;
import ac.artemis.core.v4.check.PacketHandler;
import ac.artemis.core.v4.check.annotations.Check;
import ac.artemis.anticheat.api.check.type.Type;
import ac.artemis.core.v4.check.exempt.type.ExemptType;
import ac.artemis.core.v4.check.settings.CheckInformation;
import ac.artemis.core.v4.data.PlayerData;
import ac.artemis.core.v4.utils.chat.StringUtil;
import ac.artemis.packet.PacketManager;
import cc.ghast.packet.PacketAPI;
import ac.artemis.packet.protocol.ProtocolVersion;
import cc.ghast.packet.wrapper.mc.PlayerEnums;
import ac.artemis.packet.spigot.wrappers.GPacket;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientCustomPayload;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientKeepAlive;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerKeepAlive;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;
import java.util.Deque;
import java.util.LinkedList;
/**
* @author Ghast
* @since 25/03/2021
* Artemis © 2021
*
* This is most effectively the best antibot protection I've got on Artemis. By combining the
* concept of checking a random resource pack link and the usage of keep alives, we can pretty
* much capture whether or not a player is a bot or has a broken client misplacing keep-alives/
* resource packs.
*/
@Check(type = Type.PINGSPOOF, var = "Protocol")
public class PingSpoofProtocol extends ArtemisCheck implements PacketHandler, FastProcessHandler {
public PingSpoofProtocol(PlayerData data, CheckInformation info) {
super(data, info);
}
private final Deque<Long> ids = new LinkedList<>();
private Long next;
@Override
public void handle(GPacket packet) {
final boolean exempt = this.isExempt(ExemptType.JOIN);
/*
* They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean
* this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.
*/
if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))
return;
/*
* Lets handle resource pack status. Since we flush the channel before, theoretically this should be processed
* beforehand?
*/
if (packet instanceof GPacketPlayClientResourcePackStatus) {
final GPacketPlayClientResourcePackStatus sts = (GPacketPlayClientResourcePackStatus) packet;
/*
* Lets not interfere with real resource pack requests alright?
*/
if (!StringUtil.isNumeric(sts.getUrl().get())) {
this.debug("Invalid id");
return;
}
/*
* Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other
* than that is completely invalid. Hence we can just skip over it.
*/
if (!sts.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD) && !exempt) {
this.log("Successfully downloaded - Invalid");
this.debug("[FLAG] Successfully downloaded - Invalid");
return;
}
/*
* Both resource pack and keep alive packets are async to the threading. Meaning they aren't ticked.
* This means these are synchronous but not correlated to other packets. Perfect for a pingspoof check.
* If no response is received, it's invalid
*/
if (ids.isEmpty() && !exempt) {
this.log("Packet coming from idk where");
this.debug("[FLAG] Packet coming from idk where");
return;
}
/*
* Alrighty lets get decoding.
*/
final long var = Long.decode(sts.getUrl().get());
/*
* No clue where tf this keep alive coming from hommie, but it defo ain't ours, so it's a bad
* packet.
*/
if (!ids.contains(var) && !exempt) {
this.log("Keep alive does not exist bruh");
this.debug("[FLAG] Keep alive does not exist bruh");
return;
}
long id = ids.poll();
/*
* Well this is awkward. We're receiving the wrong... packet id?
* Hence, this is deemed as a bad packet.
*/
if (id != var && ids.contains(var)) {
while (id != var && !ids.isEmpty()) {
id = ids.poll();
if (exempt)
continue;
this.log("Invalid identifier, polling queue...");
}
}
/*
* Nice alright, valid keep alive, lets mark the next id to receive.
*/
else {
next = var;
ids.remove(var);
this.debug("resource=" + var);
}
}
/*
* Since the keep alive flushed out a resource pack status packet, the next packet received should be the
* resource pack denial then only the keep alive.
*/
else if (packet instanceof GPacketPlayClientKeepAlive) {
final GPacketPlayClientKeepAlive ka = (GPacketPlayClientKeepAlive) packet;
if (next == null) {
if (!exempt)
this.log("No confirmation");
return;
}
if (next == ka.getId()) {
this.debug("ka=" + ka.getId());
} else if (!exempt) {
this.log("Packet order 0x1");
this.debug("[FLAG] Packet order 0x1");
}
}
}
@Override
public void fastHandle(GPacket packet) {
/*
* They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean
* this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.
*/
if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))
return;
/*
* Only handle server keep alives because uhhh
*/
if (packet instanceof GPacketPlayServerKeepAlive) {
final GPacketPlayServerKeepAlive ka = (GPacketPlayServerKeepAlive) packet;
this.ids.add(ka.getId());
final String encoded = Long.toString(ka.getId());
PacketManager.getApi().sendPacket(
data.getPlayer().getUniqueId(),
new GPacketPlayServerResourcePackSend(
"level://" + Math.random() + "/resources.zip", encoded
)
);
}
}
}
// NOTE (AI): The S48 side is the probe construction at line 175 (GPacketPlayServerResourcePackSend with an id-encoded URL); the C19 validation in the same file is documented on the C19PacketResourcePackStatus page.Use a level:// resource-pack offer as a tick-confirmation channel on 1.8 servers.
On 1.8.9 and below it sends a GPacketPlayServerResourcePackSend whose hash encodes a numeric tick id (line 57), then accepts only C19 FAILED_DOWNLOAD replies whose URL is numeric and contains the player name. The parsed id is stored as the player's resourcePackTick and feeds the tick-confirmation infrastructure other Artemis checks use to measure connection state.
// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v5/features/tick/impl/ResourcePackTickHandler.java =====
package ac.artemis.core.v5.features.tick.impl;
import ac.artemis.core.v4.data.PlayerData;
import ac.artemis.core.v4.utils.chat.StringUtil;
import ac.artemis.packet.PacketManager;
import cc.ghast.packet.PacketAPI;
import ac.artemis.packet.protocol.ProtocolVersion;
import cc.ghast.packet.wrapper.mc.PlayerEnums;
import ac.artemis.packet.spigot.wrappers.GPacket;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;
public class ResourcePackTickHandler extends AbstractTickHandler<GPacketPlayClientResourcePackStatus> {
public ResourcePackTickHandler(final PlayerData data) {
super(data);
}
@Override
public boolean canReceive() {
return data.getVersion().isOrBelow(ProtocolVersion.V1_8_9);
}
@Override
public boolean isPacket(final GPacket packet) {
if (!(packet instanceof GPacketPlayClientResourcePackStatus))
return false;
final GPacketPlayClientResourcePackStatus wrapper = (GPacketPlayClientResourcePackStatus) packet;
/*
* Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other
* than that is completely invalid. Hence we can just skip over it.
*/
if (!wrapper.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD))
return false;
if (!wrapper.getUrl().isPresent())
return false;
if (!wrapper.getUrl().get().contains(data.getPlayer().getName()))
return false;
return StringUtil.isNumeric(wrapper.getUrl().get());
}
@Override
public short getPacketId(final GPacket packet) {
return Short.parseShort(((GPacketPlayClientResourcePackStatus) packet).getUrl().get());
}
@Override
public void onConsume(final GPacketPlayClientResourcePackStatus packet) {
data.connection.resourcePackTick = Integer.parseInt(packet.getUrl().get());
}
@Override
public void onPush(final boolean flush, final short id) {
final GPacket packet = new GPacketPlayServerResourcePackSend(
"level://" + data.getPlayer().getName() + "_" + Math.random() + "/resources.zip",
Short.toString(id)
);
PacketManager.getApi().sendPacket(data.getPlayer().getUniqueId(), packet);
}
}
// NOTE (AI): The S48 side is the probe send in onPush (lines 56-62); the C19 validation is the isPacket gate. The same mechanism is documented from the C19 side on the C19PacketResourcePackStatus page. ConnectionHolder registers this handler (line 26, commented out in the clone).Related Packets
Wiki Cross-Reference
Two strings: resource pack URL (32767 cap) and SHA-1 hash (40-char cap). Client answers with C19 status: accepted, declined, failed download, loaded.
The level:// scheme maps into the local saves folder, so malicious URLs with .. segments can probe local files; hash is ignored for level packs.
MCP 1.8.9 S48PacketResourcePackSend implements Packet
1.8.9 callers: EntityPlayerMP.loadResourcePack sends new S48PacketResourcePackSend (line 1192): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.
Vanilla Internals
Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.
Module Analyses Using S48PacketResourcePackSend
Full source walkthroughs of the modules and anti-cheats that use this packet.