This is an API mod that adds nothing on its own. Its main goal currently is to simplify the process of creating the BlockBlock mod and its addons.
Features
This mod adds a number of events, as well as a permission system framework that allows developers to prevent players from doing certain actions.
Events
BlockBreakEvent.ATTACK - Triggered when a player starts mining a block
BlockBreakEvent.BEFORE - Triggered right before a block is broken
BlockBreakEvent.AFTER - Triggered after a block is sucessfully broken (cannot be cancelled)
BlockPlaceEvent - Triggered a player places a block
BlockUseEvent Triggered when a player (right click) uses a block
EntityItemDropEvent - Triggered when a killed entity is about to drop its loot
EntityUseEvent - Triggered when a player (right click) uses an entity
ItemUseEvent - Triggered when a player uses an item
ObjectCraftedEvent - Triggered when a player enters a valid recipe in a crafting grid
Permission framework
The permission framework makes it easier to lock a certain action, for a certain item, block, entity or other actions. Locking actions is done on a per-player basis.
The API adds 3 ActionContext classes you can use:
BlockActionContext - Used for breaking, placement and block interaction.
ItemActionContext - Used for item usage and crafting recipes.
EntityActionContext - Used for interacting with entities and preventing their drops.
These context classes contain all the info you might need to decide what you need to do with an action.
Alternatively, you can pass it along to the Permission class using Permission.isObjectLocked(context). This will return whether an object is locked or not for a certain player.
For a more comprehensive guide on how to use the API, please refer to the wiki (under construction).
<img src="https://goldmedia.top/uploads/gallery/blunthornapi_desc_1_07887aa4.png" width=150>
How to Install BlunthornAPI (Mod)
BlunthornAPI by Unknown is verified for Fabric across Minecraft versions 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6 (latest release: 1.0.7-1.20.x, file size: 93 KB). Follow the steps below to install it safely from ModCraft.tv:
- Click the Download button above and select your Minecraft version (1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6) and platform (Fabric).
- Make sure you have the compatible loader or environment installed for Fabric.
- Move the downloaded BlunthornAPI file into your Minecraft
.minecraft/modsfolder and launch the game.
All Versions
+ Add Version- Fixed the client not updating properly when travelling through dimensions
- Fixed the object ID logging to chat twice when using the item logging feature
- Fixed an issue where items locked in item_usage would cause issues when used in a crafting grid
- Fixed client side only code running on the server. This means the API should now work on servers!
- Added anvil support
- Players in spectator mode will no longer be checked for restrictions
- When in creative, you can now press F8 to log the item ID of the item you're currently hovering over in an inventory. The ID will be shared in chat and saved in a file at
[instance_folder]/config/blunthornapi/item_id_log.json
- Fixed placement not locking properly
- When shift-right clicking a block with another placeable block in hand, it will now trigger the
BlockPlaceEventinstead of theBlockUseEvent. This makes it possible to still place blocks ontop of blocks that are locked in theBLOCK_INTERACTIONcategory.
