SuperLeadRope/src/main/java/top/r3944realms/superleadrope/SuperLeadRope.java
3944Realms ad275c4d37 版本更新到1.0.0
1. 对WayStone做进一步适配(显然WS自己有问题)
2. 添加了禁拴效果及其对应的药水
3. 添加了彩蛋内容(暂无非作弊获取方式)
4. 添加了最大拴绳拉力阈值,在配置中调整
2025-12-11 18:27:07 +08:00

93 lines
3.1 KiB
Java

/*
* Super Lead rope mod
* Copyright (C) 2025 R3944Realms
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR 阿 PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package top.r3944realms.superleadrope;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.r3944realms.superleadrope.compat.WayStoneCompat;
import top.r3944realms.superleadrope.config.LeashCommonConfig;
import top.r3944realms.superleadrope.core.register.*;
import top.r3944realms.superleadrope.network.NetworkHandler;
import top.r3944realms.superleadrope.util.file.ConfigUtil;
/**
* The type Super lead rope.
*/
@Mod(value = SuperLeadRope.MOD_ID)
//TODO: API规范化
public class SuperLeadRope {
/**
* The constant logger.
*/
public static final Logger logger = LoggerFactory.getLogger(SuperLeadRope.class);
/**
* The constant MOD_ID.
*/
public static final String MOD_ID = "superleadrope";
/**
* Instantiates a new Super lead rope.
*/
public SuperLeadRope() {
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
SLPItems.register(eventBus);
SLPBlocks.register(eventBus);
SLPEntityTypes.register(eventBus);
SLPSoundEvents.register(eventBus);
SLPEffects.register(eventBus);
SLPPotions.register(eventBus);
NetworkHandler.register();
initialize();
}
/**
* Initialize.
*/
public static void initialize() {
logger.info("Initializing SuperLeadRope");
String c = "common";
ConfigUtil.createFile(new String[]{c});
ModLoadingContext modLoadingContext = ModLoadingContext.get();
ConfigUtil.registerConfig(modLoadingContext, ModConfig.Type.COMMON, LeashCommonConfig.SPEC, c, "leash");
WayStoneCompat.init();
}
/**
* The type Mod info.
*/
public static class ModInfo {
/**
* The constant VERSION.
*/
public static final String VERSION;
static {
// 从 ModList 获取当前 ModContainer 的元数据
VERSION = ModList.get()
.getModContainerById(MOD_ID)
.map(c -> c.getModInfo().getVersion().toString())
.orElse("UNKNOWN");
}
}
}