Full module source: 1 implementation
Every implementation below is the complete module file, verbatim. Expand a client to read its code.
KiwiClientCLIENTsrc/main/java/com/tangykiwi/kiwiclient/module/client/VanillaSpoof.javaJava · 42 lines · 1.4 KB
Spoofs the client brand name.
| 1 | package com.tangykiwi.kiwiclient.module.client;
|
| 2 |
|
| 3 | import com.tangykiwi.kiwiclient.module.Module;
|
| 4 |
|
| 5 | import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
|
| 6 | import net.minecraft.network.protocol.common.custom.BrandPayload;
|
| 7 | import net.minecraft.resources.Identifier;
|
| 8 |
|
| 9 | import org.apache.commons.lang3.Strings;
|
| 10 |
|
| 11 | import com.google.common.eventbus.Subscribe;
|
| 12 | import com.tangykiwi.kiwiclient.event.PacketEvent;
|
| 13 | import com.tangykiwi.kiwiclient.module.Category;
|
| 14 |
|
| 15 | public class VanillaSpoof extends Module {
|
| 16 | public VanillaSpoof() {
|
| 17 | super("VanillaSpoof", "Spoofs the client brand name.", Category.CLIENT);
|
| 18 | }
|
| 19 |
|
| 20 | @Subscribe
|
| 21 | public void onPacketSend(PacketEvent.Send event) {
|
| 22 | if (event.packet instanceof ServerboundCustomPayloadPacket) {
|
| 23 | Identifier id = ((ServerboundCustomPayloadPacket) event.packet).payload().type().id();
|
| 24 |
|
| 25 | String[] channels = {"fabric", "minecraft:register"};
|
| 26 | for (String channel : channels) {
|
| 27 | if (Strings.CI.contains(id.toString(), channel)) {
|
| 28 | event.cancel();
|
| 29 | return;
|
| 30 | }
|
| 31 | }
|
| 32 |
|
| 33 | if (id.equals(BrandPayload.TYPE.id())) {
|
| 34 | ServerboundCustomPayloadPacket spoofedPacket = new ServerboundCustomPayloadPacket(new BrandPayload("vanilla"));
|
| 35 |
|
| 36 | event.connection.send(spoofedPacket, null, true);
|
| 37 | event.cancel();
|
| 38 | }
|
| 39 | }
|
| 40 | }
|
| 41 | }
|
| 42 |
|
Mixins (2)
ServerboundMovePlayerPacketAccessor.javaJava · 17 lines · 484 B
@Mixin(ServerboundMovePlayerPacket.class)
| 1 | package com.tangykiwi.kiwiclient.mixin;
|
| 2 |
|
| 3 | import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
| 4 | import org.spongepowered.asm.mixin.Mixin;
|
| 5 | import org.spongepowered.asm.mixin.Mutable;
|
| 6 | import org.spongepowered.asm.mixin.gen.Accessor;
|
| 7 |
|
| 8 | @Mixin(ServerboundMovePlayerPacket.class)
|
| 9 | public interface ServerboundMovePlayerPacketAccessor {
|
| 10 | @Mutable
|
| 11 | @Accessor("y")
|
| 12 | void setY(double y);
|
| 13 |
|
| 14 | @Mutable
|
| 15 | @Accessor("onGround")
|
| 16 | void setOnGround(boolean onGround);
|
| 17 | }
|
ServerboundMovePlayerPacketMixin.javaJava · 25 lines · 594 B
@Mixin(ServerboundMovePlayerPacket.class)
| 1 | package com.tangykiwi.kiwiclient.mixin;
|
| 2 |
|
| 3 | import org.spongepowered.asm.mixin.Mixin;
|
| 4 | import org.spongepowered.asm.mixin.Unique;
|
| 5 |
|
| 6 | import com.tangykiwi.kiwiclient.mixininterface.IServerboundMovePlayerPacket;
|
| 7 |
|
| 8 | import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
| 9 |
|
| 10 | @Mixin(ServerboundMovePlayerPacket.class)
|
| 11 | public class ServerboundMovePlayerPacketMixin implements IServerboundMovePlayerPacket {
|
| 12 | @Unique private int tag = 0;
|
| 13 |
|
| 14 | @Override
|
| 15 | public void setTag(int tag) {
|
| 16 | this.tag = tag;
|
| 17 | }
|
| 18 |
|
| 19 | @Override
|
| 20 | public int getTag() {
|
| 21 | return tag;
|
| 22 | }
|
| 23 |
|
| 24 | }
|
| 25 |
|