当前位置: 首页>>代码示例>>Java>>正文


Java InjectedModContainer类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.InjectedModContainer的典型用法代码示例。如果您正苦于以下问题:Java InjectedModContainer类的具体用法?Java InjectedModContainer怎么用?Java InjectedModContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InjectedModContainer类属于net.minecraftforge.fml.common包,在下文中一共展示了InjectedModContainer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRegistryName

import net.minecraftforge.fml.common.InjectedModContainer; //导入依赖的package包/类
public final T setRegistryName(String name)
{
    if (getRegistryName() != null)
        throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName());

    int index = name.lastIndexOf(':');
    String oldPrefix = index == -1 ? "" : name.substring(0, index);
    name = index == -1 ? name : name.substring(index + 1);
    ModContainer mc = Loader.instance().activeModContainer();
    String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase();
    if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
    {
        FMLLog.bigWarning("Dangerous alternative prefix `%s` for name `%s`, expected `%s` invalid registry invocation/invalid name?", oldPrefix, name, prefix);
        prefix = oldPrefix;
    }
    this.registryName = new ResourceLocation(prefix, name);
    return (T)this;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:IForgeRegistryEntry.java

示例2: registerBlock

import net.minecraftforge.fml.common.InjectedModContainer; //导入依赖的package包/类
public static <T extends Block> T registerBlock(T block, ItemBlock itemBlock, String name) {
	String finalName = name;
	String lowerCase = name.toLowerCase();
	if (name != lowerCase) {
		ModLogger.warning("Registering a Block and Item that has a non-lowercase registry name! (" + name + " vs. "
				+ lowerCase + ") setting it to " + lowerCase);
		finalName = lowerCase;

		ModContainer mc = Loader.instance().activeModContainer();
		String prefix = mc == null || (mc instanceof InjectedModContainer
				&& ((InjectedModContainer) mc).wrappedContainer instanceof FMLContainer) ? "minecraft"
						: mc.getModId().toLowerCase();
		MissingItemHandler.remapItems.put(new ResourceLocation(prefix, name), itemBlock);
		MissingItemHandler.remapBlocks.put(new ResourceLocation(prefix, name), block);
	}

	block.setUnlocalizedName(CrystalMod.prefix(finalName));
	block.setRegistryName(CrystalMod.resource(finalName));
	GameRegistry.register(block);
	GameRegistry.register(itemBlock.setRegistryName(CrystalMod.resource(finalName)));
	REGISTRY.put(finalName, block);
	return block;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:ModBlocks.java

示例3: getResult

import net.minecraftforge.fml.common.InjectedModContainer; //导入依赖的package包/类
public static CheckResult getResult(ModContainer mod)
{
    if (mod == null) return PENDING_CHECK;
    if (mod instanceof InjectedModContainer)
        mod = ((InjectedModContainer)mod).wrappedContainer;
    CheckResult ret = results.get(mod);
    return ret == null ? PENDING_CHECK : ret;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:ForgeVersion.java

示例4: getIdForCurrentContainer

import net.minecraftforge.fml.common.InjectedModContainer; //导入依赖的package包/类
/**
 * Creates a ResourceLocation for a string, using the active mod container as the owner of
 * the ID.
 *
 * @param id The id for the specific entry.
 * @return A ResourceLocation for the entry.
 */
public static ResourceLocation getIdForCurrentContainer (String id) {

    final int index = id.lastIndexOf(':');
    final String entryName = index == -1 ? id : id.substring(index + 1);
    final ModContainer mod = Loader.instance().activeModContainer();
    final String prefix = mod == null || mod instanceof InjectedModContainer && ((InjectedModContainer) mod).wrappedContainer instanceof FMLContainer ? "minecraft" : mod.getModId().toLowerCase();

    return new ResourceLocation(prefix, entryName);
}
 
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:17,代码来源:ModUtils.java


注:本文中的net.minecraftforge.fml.common.InjectedModContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。