當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。