net.minecraftforge.fml.common.Loader.hasReachedState()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中net.minecraftforge.fml.common.Loader.hasReachedState()方法的一些代码示例,展示了Loader.hasReachedState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.hasReachedState()方法的具体详情如下:
包路径:net.minecraftforge.fml.common.Loader
类名称:Loader
方法名:hasReachedState

Loader.hasReachedState介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

public void registerModels() {
 if(Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) {
  TConstruct.log.error(
    "Proxy.registerModels has to be called during preInit. Otherwise the models wont be found on first load.");
 }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

@Override
public void transform(BookData book, SectionData data) {
 ContentListing listing = new ContentListing();
 listing.title = book.translate(sectionName);
 addPage(data, sectionName, "", listing);
 // don't do stuff during preinit etc, we only want to fill it once everything is added
 if(!Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION)) {
  return;
 }
 MATERIAL_TYPES_ON_DISPLAY.forEach(type -> {
  int pageIndex = data.pages.size();
  generateContent(type, data);
  if(pageIndex < data.pages.size()) {
   listing.addEntry(getStatName(type), data.pages.get(pageIndex));
  }
 });
}

代码示例来源:origin: SleepyTrousers/EnderCore

/**
 * Registers a top level package to be searched for {@link Handler} classes. Not needed if your {@code @Mod} class implements {@link IEnderMod}
 *
 * @param packageName
 * @deprecated This is not needed, period.
 */
@Deprecated
public static void addPackage(String packageName) {
 if (Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) {
  throw new RuntimeException("This method must only be called in preinit");
 }
 EnderCore.logger.info("Adding package " + packageName + " to handler search.");
 packageSet.add(packageName);
}

代码示例来源:origin: SleepyTrousers/EnderCore

private boolean checkGameState() {
 return restartReq == RestartReqs.NONE ||
   (restartReq == RestartReqs.REQUIRES_WORLD_RESTART && FMLCommonHandler.instance().getMinecraftServerInstance() == null) ||
   !Loader.instance().hasReachedState(LoaderState.AVAILABLE);
}

代码示例来源:origin: sinkillerj/ProjectE

@Nonnull
@Override
public IKnowledgeProvider getKnowledgeProviderFor(@Nonnull UUID playerUUID)
{
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
  {
    Preconditions.checkState(PECore.proxy.getClientPlayer() != null, "Client player doesn't exist!");
    return PECore.proxy.getClientTransmutationProps();
  }
  else
  {
    Preconditions.checkNotNull(playerUUID);
    Preconditions.checkState(Loader.instance().hasReachedState(LoaderState.SERVER_STARTED), "Server must be running to query knowledge!");
    EntityPlayer player = findOnlinePlayer(playerUUID);
    if (player != null)
    {
      return player.getCapability(ProjectEAPI.KNOWLEDGE_CAPABILITY, null);
    }
    else
    {
      return TransmutationOffline.forPlayer(playerUUID);
    }
  }
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

}else if(message.isNBTMessage() && Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)&& !Loader.instance().hasReachedState(LoaderState.INITIALIZATION) && BattlegearConfig.initItemFromNBT(message.getNBTValue())){
  success = true;

相关文章