EventBlock API
Description:
EventBlock API is a Minecraft Forge mod for 1.20.1 that adds special blocks that generate random events every in-game noon. These blocks can add excitement and unpredictability to your world, making them perfect for adventure maps, custom worlds, or modpacks.
Features:
- Blocks that trigger a random event every in-game noon.
- When block is placed - it will take texture, sounds, model and other properties of block beneath it (for now only works with: stone, dirt, diorite, snow block, granite, andesite, grass block and sand)
- Fully configurable: modpack creators can add custom events.
- Works seamlessly with other Forge mods.
For Modpack Creators:
To add a custom event to a block’s event list:
-
Import the RandomBlock class:
import com.creatorsindrome.eventblock.common.block.RandomBlock;
-
Register your event using the static method:
RandomBlock.regBlockEvent(new BlockEvent() {
@Override
public void run(BlockState blockstate, ServerLevel world, BlockPos pos) {
// Your custom event code here
}
});
The run method receives the following arguments:
BlockState blockstate — the state of the block triggering the event
ServerLevel world — the server-side world
BlockPos pos — the position of the block
Usage:
Simply place the Random Event Block in your world. Every in-game noon, it will execute one of the registered events. Combine multiple blocks for more complex behaviors.
Recommended For:
- Adventure maps
- Custom servers
- Modpacks looking to add dynamic world events