Skip to content

Commit

Permalink
Switched to EBF Registration system
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDoctor1138 committed Aug 30, 2024
1 parent efe391e commit 666315a
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 25 deletions.
2 changes: 2 additions & 0 deletions src/main/java/tcce/client/core/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public static boolean isAnniversary() {
return(cal.get(Calendar.MONTH) == Calendar.AUGUST && cal.get(Calendar.DATE) == 29);
}

public static boolean preRenderModels = false;


@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
Expand Down
36 changes: 15 additions & 21 deletions src/main/java/tcce/common/TCCE.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TCCE {
public static CommonProxy proxy;

/* TrainCraft Logger */
public static Logger tcLog = LogManager.getLogger(TCCEInfo.modName);
public static Logger tcceLog = LogManager.getLogger(TCCEInfo.modName);

// public static File configDirectory;

Expand All @@ -41,53 +41,44 @@ public class TCCE {

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
tcLog.info("Starting Traincraft Community Edition Addon " + TCCEInfo.modVersion + "!");
tcceLog.info("Starting PreInitialization");
tcceLog.info("Starting Traincraft Community Edition" + TCCEInfo.modVersion + "!");

if (!Loader.isModLoaded("tc")) {
tcLog.error("Traincraft not found");
tcceLog.error("Traincraft is not installed!");
}


/* Config handler */
// configDirectory= event.getModConfigurationDirectory();

/* Register Items, Blocks, ... */
tcLog.info("Initialize Blocks, Items, ...");

//TCCETab = new TCCETab(CreativeTabs.getNextID(), "TCCE");



tcceLog.info("Initialising Entities.");
EntityHandler.init();

/* Other Proxy init */
tcLog.info("Initialize Renderer and Events");
tcceLog.info("Initialize Renderer and Events");

registry = new TCCERegistry();


tcLog.info("Finished PreInitialization");
tcceLog.info("Finished PreInitialization");
}



@Mod.EventHandler
public void init(FMLInitializationEvent event) {
tcLog.info("Start Initialization");
tcceLog.info("Start Initialization");
tcceLog.info("Initialize Blocks, Items, ...");
TCCEItems.init();
tcLog.info("Initialize Gui");
tcceLog.info("Initialize Gui");
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);


tcLog.info("Initialize Recipes");
tcceLog.info("Initialize Recipes");
TCCERecipeHandler.initBlockRecipes();
TCCERecipeHandler.initItemRecipes();
TCCERecipeHandler.initSmeltingRecipes();
AssemblyTableRecipes.recipes();

proxy.registerBookHandler();
registry.init();
tcLog.info("Finished Initialization");
tcceLog.info("Finished Initialization");

}

Expand All @@ -98,6 +89,9 @@ public void load(FMLInitializationEvent event) {

@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
tcceLog.info("Start to PostInitialize");
TCCERegistry.endRegistration();
tcceLog.info("Finished PostInitialization");
}

@Mod.EventHandler
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tcce/common/core/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int

}

public boolean isClient(){
return false;
}
public Object getTESR(){return null;}

public GuiScreen getCurrentScreen() {
return null;
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/tcce/common/items/TCCEItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/
package tcce.common.items;

import cpw.mods.fml.common.registry.GameRegistry;
import tcce.common.library.TCCEInfo;
import tcce.common.library.TCCEItemIDs;
import tcce.common.library.TCCERegistry;
import train.common.Traincraft;

public class TCCEItems {
Expand All @@ -21,15 +21,14 @@ public static void init() {

private static void loadItems() {

TCCEItemIDs.recipeBook.item = new ItemRecipeBook().setCreativeTab(Traincraft.tcCommunityTab);
TCCEItemIDs.recipeBook.item = new ItemRecipeBook();
}

private static void registerItems() {
for (TCCEItemIDs itemId : TCCEItemIDs.values()) {
if (itemId.item != null) {
if (itemId.className != null) {
GameRegistry.registerItem(itemId.item, itemId.name());
itemId.item.setUnlocalizedName(TCCEInfo.modID + ":" + itemId.name());
TCCERegistry.registerItem(itemId.item, TCCEInfo.modID, itemId.name(), Traincraft.tcCommunityTab);

}

Expand Down
Loading

0 comments on commit 666315a

Please sign in to comment.