本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}