Skip to content

Commit

Permalink
server resource pack spoofing
Browse files Browse the repository at this point in the history
  • Loading branch information
AutumnVN committed Jan 10, 2025
1 parent 5fa51fb commit b065154
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package autumnvn.autumn.mixin.client;

import autumnvn.autumn.AutumnClient;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket;
import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket;
import org.spongepowered.asm.mixin.Mixin;
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.util.Objects;
import java.util.UUID;

@Mixin(ResourcePackSendS2CPacket.class)
public class ResourcePackSendS2CPacketMixin {

@Shadow
public UUID id() {
return null;
}

// ServerResourcePackSpoofing
@Inject(method = "apply*", at = @At("HEAD"), cancellable = true)
private void apply(CallbackInfo ci) {
if (Objects.requireNonNull(AutumnClient.client.getCurrentServerEntry()).getResourcePackPolicy() == ServerInfo.ResourcePackPolicy.DISABLED) {
Objects.requireNonNull(AutumnClient.client.getNetworkHandler()).sendPacket(new ResourcePackStatusC2SPacket(id(), ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED));
ci.cancel();
}
}
}
1 change: 1 addition & 0 deletions src/client/resources/autumn.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"MinecraftClientMixin",
"OptionsScreenMixin",
"PlayerListHudMixin",
"ResourcePackSendS2CPacketMixin",
"SimpleOptionMixin",
"SplashOverlayMixin",
"TitleScreenMixin",
Expand Down

0 comments on commit b065154

Please sign in to comment.