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

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

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

Loader.isInState介绍

暂无

代码示例

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

public void preInit() {
 if(!Loader.instance().isInState(LoaderState.PREINITIALIZATION)) {
  TConstruct.log.error(
    "Proxy.preInit has to be called during Pre-Initialisation.");
 }
}

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

public void init() {
 if(!Loader.instance().isInState(LoaderState.INITIALIZATION)) {
  TConstruct.log.error(
    "Proxy.init has to be called during Initialisation.");
 }
}

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

public void postInit() {
 if(!Loader.instance().isInState(LoaderState.POSTINITIALIZATION)) {
  TConstruct.log.error(
    "Proxy.postInit has to be called during Post-Initialisation.");
 }
}

代码示例来源:origin: vadis365/TheErebus

/**
 * Registers all capabilities to the {@link CapabilityManager}. Must be called during pre init.
 */
public static void registerCapabilities() {
  Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
  for(EntityCapability<?, ?, ?> capability : REGISTERED_CAPABILITIES) {
    registerCapability(capability);
  }
}

代码示例来源:origin: vadis365/TheErebus

/**
 * Registers all capabilities to the {@link CapabilityManager}. Must be called during pre init.
 */
public static void registerCapabilities() {
  Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
  for(ItemCapability<?, ?> capability : REGISTERED_CAPABILITIES) {
    registerCapability(capability);
  }
}

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

@Override
public void registerCustomEMC(@Nonnull Object o, long value)
{
  Preconditions.checkNotNull(o);
  boolean flag = Loader.instance().isInState(LoaderState.PREINITIALIZATION) || Loader.instance().isInState(LoaderState.INITIALIZATION) || Loader.instance().isInState(LoaderState.POSTINITIALIZATION);
  Preconditions.checkState(flag, String.format("Mod %s tried to register EMC at an invalid time!", Loader.instance().activeModContainer().getModId()));
  APICustomEMCMapper.instance.registerCustomEMC(o, value);
  PECore.debugLog("Mod {} registered emc value {} for Object {}", Loader.instance().activeModContainer().getModId(), value, o);
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public <T extends IFactionEntity> IFaction registerFaction(String name, Class<T> entityInterface, int color) {
  if (!UtilLib.isNonNull(name, entityInterface)) {
    throw new IllegalArgumentException("[Vampirism]Parameter for faction cannot be null");
  }
  if (!Loader.instance().isInState(LoaderState.PREINITIALIZATION)) {
    throw new IllegalStateException("Factions have to be registered during PRE-INIT");
  }
  Faction<T> f = new Faction<>(name, entityInterface, color);
  addFaction(f);
  return f;
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public <T extends IFactionPlayer> IPlayableFaction registerPlayableFaction(String name, Class<T> entityInterface, int color, ResourceLocation key, Capability<T> playerCapabiltiy, int highestLevel) {
  if (!UtilLib.isNonNull(name, entityInterface, playerCapabiltiy)) {
    throw new IllegalArgumentException("[Vampirism]Parameters for faction cannot be null");
  }
  if (!Loader.instance().isInState(LoaderState.PREINITIALIZATION)) {
    throw new IllegalStateException("Factions have to be registered during PRE-INIT");
  }
  PlayableFaction<T> f = new PlayableFaction<>(name, entityInterface, color, key, playerCapabiltiy, highestLevel);
  addFaction(f);
  return f;
}

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

@Override
public boolean registerWorldTransmutation(@Nonnull IBlockState origin, @Nonnull IBlockState result1, IBlockState result2)
{
  Preconditions.checkNotNull(origin);
  Preconditions.checkNotNull(result1);
  Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), String.format("Mod %s tried to register world transmutation at an invalid time!", Loader.instance().activeModContainer().getModId()));
  if (WorldTransmutations.getWorldTransmutation(origin, false) != null)
  {
    return false;
  }
  else
  {
    WorldTransmutations.register(origin, result1, result2);
    return true;
  }
}

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

@Override
public void registerCustomEMC(@Nonnull ItemStack stack, long value)
{
  Preconditions.checkNotNull(stack);
  boolean flag = Loader.instance().isInState(LoaderState.PREINITIALIZATION) || Loader.instance().isInState(LoaderState.INITIALIZATION) || Loader.instance().isInState(LoaderState.POSTINITIALIZATION);
  Preconditions.checkState(flag, String.format("Mod %s tried to register EMC at an invalid time!", Loader.instance().activeModContainer().getModId()));
  APICustomEMCMapper.instance.registerCustomEMC(stack, value);
  PECore.debugLog("Mod {} registered emc value {} for itemstack {}", Loader.instance().activeModContainer().getModId(), value, stack.toString());
}

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

@Override
public void blacklistInterdiction(@Nonnull Class<? extends Entity> clazz)
{
  Preconditions.checkNotNull(clazz);
  Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering interdiction blacklist at incorrect time!", Loader.instance().activeModContainer().getModId());
  doBlacklistInterdiction(clazz, Loader.instance().activeModContainer().getModId());
}

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

@Override
public void blacklistSwiftwolf(@Nonnull Class<? extends Entity> clazz)
{
  Preconditions.checkNotNull(clazz);
  Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering SWRG repel at incorrect time!", Loader.instance().activeModContainer().getModId());
  doBlacklistSwiftwolf(clazz, Loader.instance().activeModContainer().getModId());
}

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

@Override
public void blacklistTimeWatch(@Nonnull Class<? extends TileEntity> clazz)
{
  Preconditions.checkNotNull(clazz);
  Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering TimeWatch blacklist at incorrect time!", Loader.instance().activeModContainer().getModId());
  doBlacklistTimewatch(clazz, Loader.instance().activeModContainer().getModId());
}

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

@Override
public void whitelistNBT(@Nonnull ItemStack stack)
{
  Preconditions.checkNotNull(stack);
  Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering NBT whitelist at incorrect time!", Loader.instance().activeModContainer().getModId());
  doWhitelistNBT(stack, Loader.instance().activeModContainer().getModId());
}

相关文章