介绍
中文介绍正在准备中,下面暂时显示原文。
Lucky Block Mod
Features
-
Event Handler Module
- Allows users to define various events in
lucky_functions.jsonfile to trigger when lucky blocks are mined
- Allows users to define various events in
-
Loot Handler Module
- Supports obtaining items from any loot table in any data pack
-
Structure Module
- Supports loading and generating structures from any data pack
-
Data Pack Support
- For detailed information, please refer to DATAPACK.md
-
Example Block
- Provides example lucky blocks
- Lucky value range: 0-200
- Higher numbers are more likely to trigger lucky effects
API Documentation
Creating Custom Lucky Blocks
- Extend Base Lucky Block Class
public class CustomLuckyBlock extends BaseLuckyBlock {
public CustomLuckyBlock() {
super(); // Use default properties
}
}
- Customize Block Properties
public class CustomLuckyBlock extends BaseLuckyBlock {
public CustomLuckyBlock() {
super(Properties.of()
.strength(1.0f)
.sound(SoundType.WOOD)
// Other properties...
);
}
}
- Custom Break Effect
@Override
protected void onLuckyBlockBreak(Level level, BlockPos pos, BlockState state, Player player) {
if (level instanceof ServerLevel serverLevel) {
// Get lucky value
int luckyValue = state.getValue(LUCKY);
// Load and execute effects
List<LuckyFunctionConfig> configs = LuckyConfigLoader.loadLuckyFunctions(serverLevel, luckyValue);
if (!configs.isEmpty()) {
LuckyFunctionConfig config = configs.get(level.random.nextInt(configs.size()));
JsonObject effect = config.getRandomEffect();
if (effect != null) {
executeEffect(new Effect(effect), serverLevel, pos, player, luckyValue);
}
}
}
}
Overridable Methods
onLuckyBlockBreak(Level level, BlockPos pos, BlockState state, Player player): Handle block break eventonRedStoneActivate(ServerLevel level, BlockPos pos, BlockState state): Handle redstone activation eventexecuteEffect(Effect effect, ServerLevel level, BlockPos pos, @Nullable Player player, int luckyValue): Execute effects
Lucky Value Description
- Range: 0-200
- Get method:
state.getValue(LUCKY) - Default generation: Randomly generates value 0-200 when placed
Trigger Methods
-
Break Trigger
- Triggers effect when player breaks the block
-
Redstone Trigger
- Triggers effect when receiving redstone signal
Usage Instructions
- Place configuration files in
data/[datapack]/lucky_functions/lucky_functions.json - Forge API: https://github.com/MinecraftForge/MinecraftForge/tree/1.20.1
Configuration File Format
{
"lucky_functions": [
{
"id": "luckyblocks:spawn_items",
"enabled": true,
"items": [
{
"loot_table": "minecraft:chests/simple_dungeon",
"enabled": true,
"count": 1
},
{
"loot_table": "minecraft:chests/desert_pyramid",
"enabled": false
}
]
},
{
"id": "luckyblocks:spawn_structure",
"enabled": true,
"structures": [
{
"structure": "minecraft:village/plains/houses/plains_small_house_1",
"enabled": true,
"rotation": "NONE"
}
]
}
],
"unlucky_functions": [
{
"id": "luckyblocks:explosion",
"enabled": true,
"effects": [
{
"power": 4,
"enabled": true,
"fire": false
},
{
"power": 8,
"fire": true,
"enabled": false
}
]
},
{
"id": "luckyblocks:spawn_mob",
"enabled": true,
"mobs": [
{
"type": "minecraft:creeper",
"enabled": true,
"charged": true,
"count": 1
},
{
"type": "minecraft:zombie",
"enabled": true,
"baby": true,
"equipment": {
"mainhand": "minecraft:diamond_sword"
}
}
]
}
]
}
Configuration Description
-
Function Structure
- Each function has a unique
idandenabledstatus - Functions can contain multiple sub-functions, each can be enabled/disabled individually
- Each function has a unique
-
Built-in Functions
spawn_items: Generate items (from loot tables)loot_table: Loot table pathcount: Generation count
spawn_structure: Generate structuresstructure: Structure pathrotation: Rotation direction (NONE, CLOCKWISE_90, CLOCKWISE_180, COUNTERCLOCKWISE_90)
explosion: Create explosionspower: Explosion powerfire: Whether to create fire
spawn_mob: Spawn entitiestype: Entity typecount: Spawn countcharged: Whether charged (Creeper specific)baby: Whether babyequipment: Equipment configuration
-
Sub-function Configuration
- Each sub-function must have an
enabledproperty - Can include additional properties specific to the function
- Supports condition configuration and random weights (to be implemented)
- Each sub-function must have an
Data Pack Customization
WIKI-DataPack
常见问题
Xiyu’s Lucky Block 支持哪些 Minecraft 版本?
Xiyu’s Lucky Block 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。
Xiyu’s Lucky Block 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
Mai_xiyu 的其他作品
查看全部 →OneKeyMiner
by Mai_xiyu
这个模组允许你在按住连锁键时,使用工具连锁破坏方块或进行连锁耕作。破坏一个方块后,邻近的方块也会一并被破坏;手持种子时,邻近的耕地也会同时播种。
156.8万
1 个月前
Modrinth · CurseForge
Super Tools Reload
by Mai_xiyu
这个模组加入了大量新物品,强度极高(没错,真的极高),包括工具、盔甲、食物和方块。它主要用于添加新物品,功能也和大多数模组差不多。
56.4万
1 年前
Modrinth · CurseForge
OneKeyMiner(Neo)Forge and Fabric| Vein Miner | Chain Vein
by Mai_xiyu
这个模组可以让你按住连锁键来连锁破坏方块和耕种。破坏方块时,周围相邻的方块也会一起被破坏;手持种子时,相邻的耕地也会一起播种。
47.6万
1 个月前
CurseForge
Spartan Weaponry Unofficial
by Mai_xiyu, IAFEnvoy
经典模组 Spartan Weaponry 的非官方 NeoForge 1.21.1 移植版,包含剑、长柄武器、远程武器等,灵感源自 Balkon's WeaponMod!
28万
2 个月前
Modrinth · CurseForge
评论
登录后评论和评分