A Mixin framework for Spigot/Bukkit that allows you to hook custom event anywhere

Overview

MixBukkit MixBukkit is a mixin framework inspired by SpongePowered's Mixin framework using ASM.

When will you need it

Let's say you want to hook something in Skeleton.class, but obviously you can't just edit spigot source code. Having a custom build just for a plugin is ridiculous. MixBukkit provides an easy to use API that allows you to hook anything in NMS/CraftBukkit/Spigot API/Plugins and even libraries.

Environment

In theory, it should work from Java 8 ~ Java latest, Linux & Windows & MacOS, but I only tested it on Linux with Java 17.
Minecraft version is not limited, but it will result in mapping different

Basic Usage

(Please check docs/Getting Started.md for more information)

Mapping

Method 1. Use Spigot's Members Mapping

If you want to make things easy/fast/good/great/simple, you can use this method. Simply skip to next step, you don't need to worry about mapping

Method 2. Use custom mapping

Since we get an AutoMapper, you can use it instead, but you can also do this if you have a custom mapping to load. Doing the following thing will get you a working vanilla mapping. You can also grab it from %server_root%/mappings.csrg.

  1. Run buildtool with this following command: java -jar BuildTool.jar --rev --remapped
  2. After that, go to your local maven repository (usually {user.home}/.m2/repository), and copy minecraft-server- -maps-spigot-members.csrg . For example, it's in /home/fan87/.m2/repository/org/spigotmc/minecraft-server/1.18.1-R0.1-SNAPSHOT/ on my computer
  3. Paste that file into the same directory as plugin.yml, and name it to anything you want. For example: mapping.csrg

Bad way of loading a custom members mapping

Do not replace %server_root%/mappings.csrg to load a custom mapping. It will probably kill all plugins that is using Mixin.
Unless you want to make the mapping globally (let's say you are the user, you can do this).

Register MixinPlugin

If you wish to use Spigot's members mapping:

// onEnable()
MixinPlugin mixinPlugin = MixBukkit.registerMixinPlugin(this, AutoMapper.getMappingAsStream());

If you wish to use a custom members mapping:

// onEnable()
MixinPlugin mixinPlugin = MixBukkit.registerMixinPlugin(this, TestMixin.class.getClassLoader().getResourceAsStream("mapping.csrg" /* Type the mapping location here */));

After registering MixinPlugin, you can start registering mixins. Please check TestMixin/ module for examples!

Project Keywords/Tips and tricks

ShellCode

Also be known as Bytecode Generator. For example: ShellCodeReflectionPluginMethodCall uses reflection to call plugin methods. Every shellcode should get an annotation: ShellCodeInfo, which contains information about the shellcode. While implementing your own the shellcode, you should always annotate it with @ShellCodeInfo with required information. To get a list of ShellCodes, simply type ShellCode in your IDE and let it auto completes:

MixinAction (MAction)

MixinAction has ability to modify entire method, which is the lowest level of mixin. If you want to do something special other than inserting shellcode (for example: replace it with a super call, trash the method), you can use this. Same as shellcode, you can do get a list of MixinAction with MAction and let the IDE list them for you. Here's an example MixinAction (MActionMethodTrasher), which trashes entire method and replace them with nothing. Note that it doesn't work with variables requires a return value:

HookLocator (HLocator)

HookLocator will return a list of instruction index. Let's say you want to inject a shellcode into the top of the method, you would want to use new MActionInsertShellCode(shellCode, new HLocatorTop())

Advanced Usage

Coming Soon! (JavaDoc also coming soon : D )

Gallery

You might also like...

A lightweight, mixin like injection lib using ASM

ClassTransform A lightweight, mixin like injection lib using ASM. The usage is like Mixins. You can almost copy-paste mixins code and it works. Why? I

Dec 22, 2022

An annotation-based command framework for Bukkit

Blade Blade is an easy-to-use command framework based on annotations. It currently only supports Bukkit, but it can be easily extended to more platfor

Nov 6, 2022

💡极致性能的企业级Java服务器框架,RPC,游戏服务器框架,web应用服务器框架。(Extreme fast enterprise Java server framework, can be RPC, game server framework, web server framework.)

💡极致性能的企业级Java服务器框架,RPC,游戏服务器框架,web应用服务器框架。(Extreme fast enterprise Java server framework, can be RPC, game server framework, web server framework.)

👉 为性能而生的万能服务器框架 👈 Ⅰ. zfoo简介 🚩 性能炸裂,天生异步,Actor设计思想,无锁化设计,基于Spring的MVC式用法的万能RPC框架 极致序列化,原生集成的目前二进制序列化和反序列化速度最快的 zfoo protocol 作为网络通讯协议 高可拓展性,单台服务器部署,

Jan 1, 2023

Allows you to use the MongoDB query syntax to query your relational database.

Allows you to use the MongoDB query syntax to query your relational database.

Spring Data JPA MongoDB Expressions How it works: Customize JPA Repository base class: @SpringBootApplication @EnableJpaRepositories(repositoryBaseCla

Dec 27, 2022

Android library that allows you to determine your location in a few of lines!

Android library that allows you to determine your location in a few of lines!

locsimple Android library that allows you to determine your location in some lines! Benefits: automatic processing of permissions processing of enabli

Aug 31, 2022

1.7 - 1.18 utility class that allows you to change blocks at blazing fast speeds

BlockChanger 1.7 - 1.18 utility class that allows you to change blocks at blazing fast speeds Setup Just import the class to your project. Usage Playe

Dec 23, 2022

A simple app that allows you to view high quality aerial photos of Poland

A simple app that allows you to view high quality aerial photos of Poland

kalucky0 Maps A simple app that allows you to view high quality aerial photos of Poland Data source: Geoportal Contributing Contributions are always w

Apr 15, 2022

A manager tool to categorize game assets such as images and sounds/music. The tool enables you to tag these files, so that finding them by tags allows fast searches.

A manager tool to categorize game assets such as images and sounds/music. The tool enables you to tag these files, so that finding them by tags allows fast searches.

BtAssetManager This application allows you to easily categorize large amounts of image and sound files. You can apply tags to each individual file to

Sep 15, 2022

A mod for OneConfig that allows you to customize the hit color of any living entity to your liking.

A mod for OneConfig that allows you to customize the hit color of any living entity to your liking.

HitColor A mod for OneConfig that allows you to customize the hit color of any living entity to your liking. Features An option to toggle Armor being

Nov 5, 2022
Owner
DragonCommissions
DragonCommissions
A bukkit/spigot plugin to add custom music discs using the Simple Voice Chat API.

Custom Discs 1.19 A spigot/bukkit fork of henkelmax's Audio Player. Play custom music discs using the Simple Voice Chat API. (The voice chat mod is re

null 21 Dec 22, 2022
This is a Bukkit-Event based AntiCheat created cause of a challenge.

XAC - XAntiCheat This is a Bukkit-Event based AntiCheat made out of a challenge with a friend of mine. Its not recommandable to use and also a bit exp

ytendx 3 Apr 6, 2022
A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way.

MixinExtras A small companion library to Mixin, designed to help you write your Mixins in a more expressive and compatible way. More information about

null 97 Jan 7, 2023
r/place replica in Minecraft (Bukkit/Spigot plugin)

MinePlace offers a completely new gaming experience in Minecraft. As a parody of r/place, a world-renowned reddit community project, this project offe

Northernside 4 Aug 19, 2022
A React Native project starter with Typescript, a theme provider with hook to easy styling component, a folder architecture ready and some configs to keep a codebase clean.

React Native Boilerplate Folder structure : src ├── assets │   ├── audios │   ├── fonts │   ├── icons │   └── images ├── components │   ├── Layout.tsx

LazyRabbit 23 Sep 1, 2022
Simple AnimationUtil using Easing functions. Can be used anywhere, Hacked-Client, Mods, etc..

AnimationUtil Simple AnimationUtil using Easing functions. Can be used anywhere, Hacked-Client, Mods, etc.. Render example > https://gyazo.com/780b5d8

null 71 Jan 8, 2023
A custom minimap that displays resources all around you while you adventure through Aeternum!

New-World-MiniMap A custom minimap that displays resources all around you while you adventure through Aeternum! Download Download Page Minimap.rar Oth

Mal Ball 7 Dec 9, 2021
Plugin for Spigot, PaperMC, BungeeCord and Velocity to create custom MOTDs, playercount message and playercount hover with priorities and conditions.

AdvancedServerList AdvancedServerList is a server and proxy plugin that allows you to create custom MOTDs and more in your server list with priority a

Andre_601 19 Dec 14, 2022
A Pomodoro Timer that allows you to collect Pokemon as you work.

Pomodoro: The Pokémon Collecting Game! A fun take on the Pomodoro Technique So, what does this application do? This application utilizes the famous Po

Kevin Wong 2 Jan 29, 2022
The Mixin re-mapper for Lunar Client.

LunarRemapper The Mixin re-mapper for Lunar Client. I have little time to work on this project, if you know what you're doing and have familiarized yo

null 45 Nov 28, 2022