Mod

HookLib

Quick rating

HookLib

No reviews yet

Framework for coremods

QoL & Tweaks
API/Library
Mod Loaders
Forge
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Optional
Server Optional

About

Project Details

Type
Mod
License
MIT License
Latest Version
hooklib 3.28
Authors
CurseForge
Modrinth

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

About

Description

Introduction

This is framework for coremods at MinecraftForge.

Basicaly, useful for mod developers.

Goal of this project is to provide an easy way to modify existing logic without directly changing code of it, but by writing your additional code.

Doesn't require knowledge of jvm bytecode.

Welp, kinda I'm late with publishing it project, bc Mixins took over the world, but I found out HookLib more handy, and I still have unimplemented good ideas, which will make it even better. So maybe it makes sense

Getting started

Understanding of hooks

When exists some code which you wanna to change, but its part of Minecraft or other mod, you can write something like:

@HookContainer
public class MyHooks {
    @Hook
    @OnBegin
    public static void resize(Minecraft mc, int x, int y) {
        System.out.println("Resize, x=" + x + ", y=" + y);
    }
}

HookLib will find method with name `resize` with two `int`'s arguments in class `Minecraft` and will insert call of MyHooks#resize to begin of found
target method.


Then you will see in console message when window resized.

Adding to project

  • Add dependency to build.gradle:
repositories {
    maven {
        url "https://cursemaven.com"
    }
}
dependencies {
    implementation "curse.maven:hooklib:12345"
}
  • Add VM option `-Dfml.coreMods.load=gloomyfolken.hooklib.minecraft.MainHookLoader`

It's possible by gradle too:

minecraft {
    mappings channel: 'snapshot', version: '20171003-1.12'

    runs {
        client {
            workingDirectory project.file('run')
            property "fml.coreMods.load", "gloomyfolken.hooklib.minecraft.MainHookLoader" //here
        }

        server {
            workingDirectory project.file('run')
            property "fml.coreMods.load", "gloomyfolken.hooklib.minecraft.MainHookLoader" //here
        }
    }
}
  • Perform Gradle Refresh in your ide

Next learning

Check our wiki for api details and advanced techniques

Roadmap

  • <s>make HookLib to modloader for coremods</s>
  • <s>injection point at method call</s>
  • <s>way to print possible @LocalVariable arguments</s>
  • <s>injection point at expression</s>
  • <s>way to access to private variables</s>
  • port to new versions of Minecraft
  • annotation processor for compile-time validation
  • configs for coremods
  • caching of target classes with applied hooks

Gratitudes

  • Thanks @GloomyFolken for original HookLib development!
  • Thanks @Foreck for cool logo!

Introduction

This is framework for coremods at MinecraftForge.

Basicaly, useful for mod developers.

Goal of this project is to provide an easy way to modify existing logic without directly changing code of it, but by writing your additional code.

Doesn't require knowledge of jvm bytecode.

Welp, kinda I'm late with publishing it project, bc Mixins took over the world, but I found out HookLib more handy, and I still have unimplemented good ideas, which will make it even better. So maybe it makes sense

Getting started

Understanding of hooks

When exists some code which you wanna to change, but its part of Minecraft or other mod, you can write something like:

@HookContainer
public class MyHooks {
    @Hook
    @OnBegin
    public static void resize(Minecraft mc, int x, int y) {
        System.out.println("Resize, x=" + x + ", y=" + y);
    }
}

HookLib will find method with name `resize` with two `int`'s arguments in class `Minecraft` and will insert call of MyHooks#resize to begin of found
target method.

Then you will see in console message when window resized.

Adding to project

  • Add dependency to build.gradle:

    repositories { maven { url "https://cursemaven.com" } } dependencies { implementation "curse.maven:hooklib:12345" }

  • Add VM option `-Dfml.coreMods.load=gloomyfolken.hooklib.minecraft.MainHookLoader`

It's possible by gradle too:

minecraft {
    mappings channel: 'snapshot', version: '20171003-1.12'

    runs {
        client {
            workingDirectory project.file('run')
            property "fml.coreMods.load", "gloomyfolken.hooklib.minecraft.MainHookLoader" //here
        }

        server {
            workingDirectory project.file('run')
            property "fml.coreMods.load", "gloomyfolken.hooklib.minecraft.MainHookLoader" //here
        }
    }
}
  • Perform Gradle Refresh in your ide

Next learning

Check our wiki for api details and advanced techniques

Roadmap

  • make HookLib to modloader for coremods

  • injection point at method call

  • way to print possible @LocalVariable arguments

  • injection point at expression

  • way to access to private variables

  • port to new versions of Minecraft

  • annotation processor for compile-time validation

  • configs for coremods

  • caching of target classes with applied hooks

Gratitudes

  • Thanks @GloomyFolken for original HookLib development!
  • Thanks @Foreck for cool logo!

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~120,000
Total Downloads
CurseForge
~120,000
Modrinth
<1,000
Last Updated
CurseForge
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched and imported data for this project from CurseForge or Modrinth. High-traffic and active projects are checked more often.
Next pipeline sync