2024-07-24 01:21:47 +00:00
/ *
*
* Keeblarcraft
*
* This is the primary server side " main " object that is referenced by Fabric . This is where everything is setup for the mod
* and a very important class . Please becareful as you add to it
*
* /
2024-07-22 22:17:04 +00:00
package jesse.keeblarcraft ;
import net.fabricmc.api.ModInitializer ;
2024-07-24 01:21:47 +00:00
// import net.minecraft.server.command.ServerCommandSource;
2024-07-22 22:17:04 +00:00
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
2024-07-24 01:21:47 +00:00
import jesse.keeblarcraft.Commands.CustomCommandManager ;
2024-07-29 00:13:48 +00:00
import jesse.keeblarcraft.Utils.CustomExceptions.SETUP_FAILED_EXCEPTION ;
import jesse.keeblarcraft.Utils.Setup ;
2024-07-24 01:21:47 +00:00
// import com.mojang.brigadier.Command;
2024-07-22 22:17:04 +00:00
public class Keeblarcraft implements ModInitializer {
2024-07-24 01:21:47 +00:00
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
2024-07-22 22:17:04 +00:00
public static final Logger LOGGER = LoggerFactory . getLogger ( " keeblarcraft " ) ;
2024-07-24 01:21:47 +00:00
CustomCommandManager cmdMgr = new CustomCommandManager ( ) ;
2024-07-29 00:13:48 +00:00
Setup setup = Setup . GetInstance ( ) ;
2024-07-24 01:21:47 +00:00
@Override
public void onInitialize ( ) {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER . info ( " Hello Fabric world! " ) ;
2024-07-22 22:17:04 +00:00
2024-07-29 00:13:48 +00:00
if ( setup ! = null ) {
try {
2024-08-01 04:03:46 +00:00
// Run setup. If setup fails; it throws SETUP_FAILED_EXCEPTION
LOGGER . info ( " Running setup stage " ) ;
2024-07-29 00:13:48 +00:00
setup . RunSetup ( ) ;
2024-08-01 04:03:46 +00:00
// Run command registrations from the command manager
LOGGER . info ( " Running command registration " ) ;
cmdMgr . RegisterCustomCommands ( ) ;
2024-07-29 00:13:48 +00:00
} catch ( SETUP_FAILED_EXCEPTION e ) {
System . out . println ( " ERROR. Setup failed to initialize environment. Mod likely does not have read/write permissions inside area. Mod will now close out. " ) ;
e . printStackTrace ( ) ;
}
} else {
// Program exit. Dual definition of setup somehow happened!
2024-08-01 04:03:46 +00:00
System . out . println ( " Dual definition of singleton attempted! Out of order initialization? How did this even happen? " ) ;
2024-07-29 00:13:48 +00:00
}
2024-07-24 01:21:47 +00:00
}
2024-07-22 22:17:04 +00:00
}