Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spoof resource packs #870

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
package net.wurstclient.mixin;

import net.minecraft.fluid.FluidState;
import net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket;
import net.minecraft.network.packet.s2c.play.*;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -19,10 +22,6 @@
import net.minecraft.client.toast.SystemToast;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ChunkData;
import net.minecraft.network.packet.s2c.play.ChunkDeltaUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ServerMetadataS2CPacket;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
Expand All @@ -37,7 +36,7 @@ public abstract class ClientPlayNetworkHandlerMixin
@Shadow
@Final
private MinecraftClient client;

@Inject(at = @At("HEAD"),
method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V",
cancellable = true)
Expand Down Expand Up @@ -101,4 +100,21 @@ private void onOnChunkDeltaUpdate(ChunkDeltaUpdateS2CPacket packet,
(pos, state) -> WurstClient.INSTANCE.getHax().newChunksHack
.afterUpdateBlock(pos));
}

@Inject(at = @At("HEAD"),
method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/play/ResourcePackSendS2CPacket;)V",
cancellable = true)
private void onOnResourcePackSend(ResourcePackSendS2CPacket packet,
CallbackInfo ci)
{
if(!WurstClient.INSTANCE.getOtfs().spoofResourcePackOtf.isEnabled())
return;

this.sendResourcePackStatus(ResourcePackStatusC2SPacket.Status.ACCEPTED);

ci.cancel();
}

@Shadow
protected abstract void sendResourcePackStatus(ResourcePackStatusC2SPacket.Status packet);
}
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/other_feature/OtfList.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public final class OtfList
public final NoTelemetryOtf noTelemetryOtf = new NoTelemetryOtf();
public final ReconnectOtf reconnectOtf = new ReconnectOtf();
public final ServerFinderOtf serverFinderOtf = new ServerFinderOtf();
public final SpoofResourcePackOtf spoofResourcePackOtf = new SpoofResourcePackOtf();
public final TabGuiOtf tabGuiOtf = new TabGuiOtf();
public final TranslationsOtf translationsOtf = new TranslationsOtf();
public final VanillaSpoofOtf vanillaSpoofOtf = new VanillaSpoofOtf();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package net.wurstclient.other_features;

import net.wurstclient.other_feature.OtherFeature;
import net.wurstclient.settings.CheckboxSetting;

public final class SpoofResourcePackOtf extends OtherFeature {

private final CheckboxSetting disableResourcePacks =
new CheckboxSetting("Disable downloaded resource packs", false);

public SpoofResourcePackOtf()
{
super("SpoofResourcePack",
"Skips downloading and success confirmation of resource packs for some servers");
addSetting(disableResourcePacks);
}

@Override
public boolean isEnabled()
{
return disableResourcePacks.isChecked();
}

@Override
public String getPrimaryAction()
{
return isEnabled() ? "Re-enable downloading" : "Disable downloading";
}

@Override
public void doPrimaryAction()
{
disableResourcePacks.setChecked(!disableResourcePacks.isChecked());
}

// See ClientPlayNetworkHandlerMixin::onOnResourcePackSend

}