public void preInit() { if(!Loader.instance().isInState(LoaderState.PREINITIALIZATION)) { TConstruct.log.error( "Proxy.preInit has to be called during Pre-Initialisation."); } }
public void init() { if(!Loader.instance().isInState(LoaderState.INITIALIZATION)) { TConstruct.log.error( "Proxy.init has to be called during Initialisation."); } }
public void postInit() { if(!Loader.instance().isInState(LoaderState.POSTINITIALIZATION)) { TConstruct.log.error( "Proxy.postInit has to be called during Post-Initialisation."); } }
/** * 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); } }
/** * 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); } }
@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); }
@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; }
@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; }
@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; } }
@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()); }
@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()); }
@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()); }
@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()); }
@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()); }