本文整理匯總了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);
}