diff --git a/README.md b/README.md index c09acf4..aa163de 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,26 @@ [![Build](https://github.com/6b6t/AnarchyMod/actions/workflows/build.yml/badge.svg)](https://github.com/6b6t/AnarchyMod/actions/workflows/build.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) -🔓 The Minecraft mod required to play on 6b6t — bypass Mojang's ban of the world's biggest anarchy server. +🔓 Bypass Mojang's blocked server list and connect to any Minecraft server. + +This is a fork of [6b6t/AnarchyMod](https://github.com/6b6t/AnarchyMod), reworked so that the mod is +useful for any server and keeps to itself. + +## What's different from upstream + +- **Every server is unblocked, not just a hardcoded list.** Upstream only bypassed the ban for + domains on a built-in allowlist of anarchy servers, extended at startup by a list downloaded from + `6b6t.org`. Both are gone: the mod now reports every server as unblocked. +- **No telemetry.** Upstream sent a packet to the server on every join, and the domain download was a + second call home. Neither remains, and the mod makes no network requests of its own. +- **Your server list is left alone.** Upstream inserted 6b6t at the top of your multiplayer list if + no matching server was present. It no longer touches your server list. +- **No 6b6t promotion in the mod.** The tracked homepage link and the Discord entry are gone from the + mod metadata. ## Features -- **Server unblocking** — bypasses Mojang's blocked server list for known anarchy servers -- **Auto server list** — automatically adds 6b6t to your server list if not already present -- **Join notification** — sends a lightweight packet to the server on join for analytics +- **Server unblocking** — bypasses Mojang's blocked server list for every server ## Supported Minecraft Versions @@ -42,8 +55,6 @@ ## Installation -AnarchyMod is required to connect to and play on 6b6t. - 1. Install [Fabric Loader](https://fabricmc.net/) and [Fabric API](https://modrinth.com/mod/fabric-api) for your Minecraft version 2. Download the matching JAR from [Releases](https://github.com/6b6t/AnarchyMod/releases) diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..e565323 --- /dev/null +++ b/TODO.md @@ -0,0 +1,46 @@ +# TODO + +Goal: turn AnarchyMod into a generic blocked-server-list bypass, with no telemetry +and no 6b6t-specific behaviour. + +## Play on any server + +- [x] Make `BlockedServersMixin` always report servers as unblocked, instead of only + those on the 6b6t allowlist. +- [x] Delete `Domains.java`. It held the hardcoded anarchy-server allowlist and also + fetched an extra list from `https://www.6b6t.org/api/anarchy-mod.json` on startup. + With every server unblocked there is nothing left to match against. + +## Remove telemetry + +- [x] Delete `JoinPayload.java` and stop registering it in `AnarchyMod.onInitializeClient`. +- [x] Drop the `ClientPlayConnectionEvents.JOIN` listener that sent the packet to the + server on every join. +- [x] The remote domain fetch is gone with `Domains.java` (it was the other outbound call). +- [x] Drop the utm-tagged homepage link from `fabric.mod.json`. + +## Do not add 6b6t to the server list + +- [x] Delete `ServerListMixin.java` and remove it from `anarchymod.mixins.json`. + +## Metadata + +- [x] Rewrite the `fabric.mod.json` description; remove the 6b6t homepage and Discord links. +- [x] Add `Wokleim` to the authors. +- [x] Remove the now-unused explicit `gson` dependency from `build.gradle.kts` and + `modern-build.gradle.kts` (only `Domains.java` used it). + +## Docs + +- [x] Rewrite `README.md`: state that it is based on 6b6t/AnarchyMod, link the source, + and list the changes made in this fork. +- [x] Update the description in `_config.yml`. + +## Notes / left alone on purpose + +- `fabric-api` stays a required dependency and `AnarchyMod` stays the client entrypoint, + even though the entrypoint no longer does anything. Decided against dropping it. +- `contact.issues` / `contact.sources` still point at `github.com/6b6t/AnarchyMod`, kept + as source attribution rather than as promotion. +- Verified by compiling the 1.19.4, 1.20.5 and 1.21.11 modules, which covers all three + Stonecutter branches the deleted code had. Not launched in a real client. diff --git a/_config.yml b/_config.yml index 9f4f565..e144960 100644 --- a/_config.yml +++ b/_config.yml @@ -1,5 +1,5 @@ title: AnarchyMod -description: 🔓 The Minecraft mod required to play on 6b6t — bypass Mojang's ban of the world's biggest anarchy server. +description: 🔓 Bypass Mojang's blocked server list and connect to any Minecraft server. theme: jekyll-theme-hacker # The release jar lives on the Releases page, so hide the source zip/tar buttons. diff --git a/build.gradle.kts b/build.gradle.kts index 02a1665..ce8c99f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,6 @@ dependencies { mappings(loom.officialMojangMappings()) modImplementation("net.fabricmc:fabric-loader:$loaderVersion") modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion") - implementation("com.google.code.gson:gson:2.14.0") } loom { diff --git a/modern-build.gradle.kts b/modern-build.gradle.kts index 50d450d..2a6b3a6 100644 --- a/modern-build.gradle.kts +++ b/modern-build.gradle.kts @@ -19,7 +19,6 @@ dependencies { minecraft("com.mojang:minecraft:$minecraftVersion") implementation("net.fabricmc:fabric-loader:$loaderVersion") implementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion") - implementation("com.google.code.gson:gson:2.14.0") } loom { diff --git a/src/main/java/net/blockhost/anarchymod/AnarchyMod.java b/src/main/java/net/blockhost/anarchymod/AnarchyMod.java index ad93799..b6e67c0 100644 --- a/src/main/java/net/blockhost/anarchymod/AnarchyMod.java +++ b/src/main/java/net/blockhost/anarchymod/AnarchyMod.java @@ -1,31 +1,11 @@ package net.blockhost.anarchymod; -//? if <1.20.5 { -/*import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.network.FriendlyByteBuf; -*///?} else { -import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; -//?} import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; public class AnarchyMod implements ClientModInitializer { @Override public void onInitializeClient() { - //? if >=26.1 { - PayloadTypeRegistry.serverboundPlay().register(JoinPayload.TYPE, JoinPayload.CODEC); - //?} else if >=1.20.5 { - /*PayloadTypeRegistry.playC2S().register(JoinPayload.TYPE, JoinPayload.CODEC); - *///?} - ClientPlayConnectionEvents.JOIN.register((listener, sender, client) -> { - if (client.getCurrentServer() != null && Domains.contains(client.getCurrentServer().ip)) - //? if <1.20.5 { - /*ClientPlayNetworking.send(JoinPayload.ID, new FriendlyByteBuf(Unpooled.buffer())); - *///?} else { - sender.sendPacket(new JoinPayload()); - //?} - }); + // Everything this mod does happens in BlockedServersMixin. } } diff --git a/src/main/java/net/blockhost/anarchymod/Domains.java b/src/main/java/net/blockhost/anarchymod/Domains.java deleted file mode 100644 index 5119733..0000000 --- a/src/main/java/net/blockhost/anarchymod/Domains.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.blockhost.anarchymod; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; - -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.HashSet; -import java.util.Locale; -import java.util.Set; -import java.util.logging.Logger; - -public class Domains { - - private static final Logger LOGGER = Logger.getLogger("AnarchyMod-Domains"); - private static final String DOMAINS_URL = "https://www.6b6t.org/api/anarchy-mod.json"; - - private static final Set DEFAULT = Set.of( - "*.6b6t.org", "*.10b10t.org", "*.6b6t.cc", "*.6b6t.me", - "*.7b7t.me", "*.8b8t.org", "*.alacity.net", - "*.anarchypvp.pw", "*.l2x9.org", "*.simpleanarchy.org" - ); - - private static final Set domains = new HashSet<>(); - private static final Gson gson = new Gson(); - - static { - DEFAULT.forEach(d -> domains.add(d.toLowerCase(Locale.ROOT))); - loadRemote(); - } - - private static void loadRemote() { - try { - HttpClient client = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create(DOMAINS_URL)) - .timeout(Duration.ofSeconds(15)) - .GET() - .build(); - - HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); - - JsonObject json = gson.fromJson(response.body(), JsonObject.class); - JsonArray array = json.getAsJsonArray("domains"); - if (array == null) return; - - array.forEach(element -> - domains.add(element.getAsString().toLowerCase(Locale.ROOT)) - ); - } catch (Throwable t) { - LOGGER.warning("Failed to load domains from remote, using defaults: " + t.getMessage()); - } - } - - public static boolean contains(String input) { - if (input == null) return false; - - String domain = input.toLowerCase(Locale.ROOT); - - if (domain.startsWith("*.")) { - domain = domain.substring(2); - } - - int semiColon = domain.indexOf(':'); - if (semiColon != -1) { - domain = domain.substring(0, semiColon); - } - - for (String entry : domains) { - if (entry.startsWith("*.")) { - String base = entry.substring(2); - if (domain.equals(base) || domain.endsWith("." + base)) { - return true; - } - } else { - if (domain.equals(entry)) { - return true; - } - } - } - - return false; - } -} diff --git a/src/main/java/net/blockhost/anarchymod/JoinPayload.java b/src/main/java/net/blockhost/anarchymod/JoinPayload.java deleted file mode 100644 index 61343b9..0000000 --- a/src/main/java/net/blockhost/anarchymod/JoinPayload.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.blockhost.anarchymod; - -//? if <1.20.5 { -/*import net.minecraft.resources.ResourceLocation; - -public class JoinPayload { - - public static final ResourceLocation ID = new ResourceLocation("anarchymod", "join"); -} -*///?} else { -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -//? if >=1.21.11 { -import net.minecraft.resources.Identifier; -//? } else { -/*import net.minecraft.resources.ResourceLocation; -*///?} - -public class JoinPayload implements CustomPacketPayload { - - //? if >=1.21.11 { - public static final Identifier ID = Identifier.fromNamespaceAndPath("anarchymod", "join"); - //? } elif >=1.21.7 { - /*public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("anarchymod", "join"); - *///?} else { - /*public static final ResourceLocation ID = ResourceLocation.tryBuild("anarchymod", "join"); - *///?} - - public static final StreamCodec CODEC = - StreamCodec.of( - (buf, payload) -> {}, - buf -> new JoinPayload() - ); - - public static final Type TYPE = - new Type<>(ID); - - @Override - public Type type() { - return TYPE; - } -} -//?} diff --git a/src/main/java/net/blockhost/anarchymod/mixin/BlockedServersMixin.java b/src/main/java/net/blockhost/anarchymod/mixin/BlockedServersMixin.java index 91ae415..8e1903a 100644 --- a/src/main/java/net/blockhost/anarchymod/mixin/BlockedServersMixin.java +++ b/src/main/java/net/blockhost/anarchymod/mixin/BlockedServersMixin.java @@ -1,7 +1,6 @@ package net.blockhost.anarchymod.mixin; import com.mojang.patchy.BlockedServers; -import net.blockhost.anarchymod.Domains; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -10,11 +9,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(BlockedServers.class) public class BlockedServersMixin { - @Inject(method = "isBlockedServerHostName", at = @At("RETURN"), cancellable = true, remap = false) + @Inject(method = "isBlockedServerHostName", at = @At("HEAD"), cancellable = true, remap = false) public void isBlockedServerHostName(String server, CallbackInfoReturnable cir) { - boolean contains = Domains.contains(server); - if (contains) { - cir.setReturnValue(false); - } + cir.setReturnValue(false); } } diff --git a/src/main/java/net/blockhost/anarchymod/mixin/ServerListMixin.java b/src/main/java/net/blockhost/anarchymod/mixin/ServerListMixin.java deleted file mode 100644 index db7c2ab..0000000 --- a/src/main/java/net/blockhost/anarchymod/mixin/ServerListMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.blockhost.anarchymod.mixin; - -import net.blockhost.anarchymod.Domains; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.multiplayer.ServerList; -import org.spongepowered.asm.mixin.Final; -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.List; - -@Mixin(ServerList.class) -public class ServerListMixin { - - @Shadow - @Final - private List serverList; - - @Inject(method = "load", at = @At("RETURN")) - public void afterLoad(CallbackInfo ci) { - if (serverList.stream().noneMatch(data -> Domains.contains(data.ip))) { - //? if <1.20.2 { - /*serverList.add(0, new ServerData("6b6t", "6b6t.org", false)); - *///? } elif <1.20.5 { - /*serverList.add(0, new ServerData("6b6t", "6b6t.org", ServerData.Type.OTHER)); - *///?} else { - serverList.addFirst(new ServerData("6b6t", "6b6t.org", ServerData.Type.OTHER)); - //?} - } - } -} diff --git a/src/main/resources/anarchymod.mixins.json b/src/main/resources/anarchymod.mixins.json index 4c8acde..6988a61 100644 --- a/src/main/resources/anarchymod.mixins.json +++ b/src/main/resources/anarchymod.mixins.json @@ -4,8 +4,7 @@ "package": "net.blockhost.anarchymod.mixin", "compatibilityLevel": "JAVA_${java_version}", "client": [ - "BlockedServersMixin", - "ServerListMixin" + "BlockedServersMixin" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d42f6ae..3b9cfe8 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -3,12 +3,12 @@ "id": "anarchymod", "version": "${version}", "name": "AnarchyMod", - "description": "The Minecraft mod required to play on 6b6t — bypass Mojang's ban of the world's biggest anarchy server.", + "description": "Bypasses Mojang's blocked server list so you can connect to any Minecraft server.", "authors": [ - "6b6t" + "6b6t", + "Wokleim" ], "contact": { - "homepage": "https://www.6b6t.org/?utm_source=anarchymod&utm_medium=mod_menu&utm_campaign=evergreen_website&utm_content=description_link", "issues": "https://github.com/6b6t/AnarchyMod/issues", "sources": "https://github.com/6b6t/AnarchyMod" }, @@ -23,13 +23,6 @@ "mixins": [ "anarchymod.mixins.json" ], - "custom": { - "modmenu": { - "links": { - "modmenu.discord": "https://6b6t.org/discord" - } - } - }, "depends": { "fabric-api": "*", "fabricloader": ">=${loader_version}",