Mods
Resource Packs
Data Packs
Modpacks
Shaders
Plugins
Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings
Biscuit!

Biscuit!

A simple API for working with 1.20.5 cookies and transfers in an easy and secure way!

595
2
Library
Technology
Utility
AboutChangelogVersions

Maintenance PRs Welcome

ko-fi

Biscuit!

A simple API for working with 1.20.5 cookies and transfers in an easy and secure way!

Features

  • [x] Cookies as POJOs
  • [x] Injected interfaces on many networking classes
  • [x] Cookie Signing for tamper detection
  • [x] Event system
  • [ ] Automatic identifier generation (May not be possbile)
  • [ ] Encryption
  • [ ] Spreading large data across many cookies

Setup

In your build.gradle include:

repositories {
    maven { url "https://api.modrinth.com/maven" }
}

dependencies {
  modImplementation("maven.modrinth:biscuit!:1.1.0")
}

Dev

// Make a class to represent your cookie
public static class TestCookie {

    private final String data;
    
    public TestCookie(String data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return data;
    }
}

// Register the cookie:
Biscuit.register(new Identifier("test", "cookie"), TestCookie.class);

// Register the cookie with a secret for tamper detection. The secret must be the same on all servers requesting this cookie:
Biscuit.register(new Identifier("test", "cookie"), TestCookie.class).setSecret("my_secret");

// Set/Get the cookie from the ServerPlayerEntity, ClientConnection, or any of the network handlers (Not handshake)
TestCookie cookie = new TestCookie("whoohoo!");
player.setCookie(cookie);

player.getCookie(TestCookie.class).whenComplete((cookie, throwable) -> {
    System.out.println(cookie);
});

Set a cookie before your mod (or another mod/the transfer command) transfers the player:

BiscuitEvents.PRE_TRANSFER.register((packet, profile, cookieJar, ci) -> {
    cookieJar.setCookie(cookie);
});

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Compatibility

Minecraft: Java Edition

1.21.x
1.20.x

Platforms

Fabric
Quilt

Supported environments

Server-side

Links

Report issues View source

Creators

mrnavastar
mrnavastar Member

Details

Licensed CC0-1.0
Published last year
Updated 6 months ago

Modrinth is open source.

main@a0bd011

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.