-
Notifications
You must be signed in to change notification settings - Fork 3
Creating Plugins
ΡΞΛΚSΤΞΡ edited this page Jul 16, 2022
·
2 revisions
Hudium itself defined two kinds of plugins: BlockInfoPlugin and EntityInfoPlugin.
By implementing BlockInfoPlugin, you can add custom thingy into the block info.
By implementing EntityInfoPlugin, you can add custom thingy into the entity info.
Create a class implementing BlockInfoPlugin or EntityInfoPlugin:
package example.info.plugin;
import dev.intelligentcreations.hudium.api.info.plugin.BlockInfoPlugin;
import dev.intelligentcreations.hudium.api.info.plugin.context.BlockInfoPluginContext;
public class ExamplePlugin implements BlockInfoPlugin {
@Override
public void addInfo(BlockInfoPluginContext context) {
// Do our things here
}
// Method below can be optionally overridden.
@Override
public boolean enabled() {
// Defines whether the plugin is enabled.
return BlockInfoPlugin.super.enabled();
}
}
Then add the plugin into the "hudium_info" entrypoint in your fabric.mod.json:
{
"schemaVersion": 1,
"id": "example",
"version": "1.0.0",
"name": "Example",
"description": "im an example hahaye",
"authors": [
"exampleAuthor"
],
"environment": "*",
"entrypoints": {
"main": [
"example.ExampleInitializer"
],
"hudium_info": [
"example.info.plugin.ExamplePlugin"
]
},
"mixins": [
"example.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.6",
"fabric": "*",
"minecraft": "1.19.*",
"java": ">=17"
}
}
Simply calls the renderText method from the context:
context.renderText("A line of text hahaye", 5592405); // 5592405 stands for color here
No need to worry about space occupying - context has done that for you!
UNDER CONSTRUCTION