Skip to content

Commit

Permalink
Addon transfer pt2
Browse files Browse the repository at this point in the history
Fixed itemID conflict, Sounds not working, recipes work, Recipebook only displays addon trains (needs tweaking for when your addon uses its own modID)
  • Loading branch information
TheDoctor1138 committed Aug 30, 2024
1 parent df17460 commit c5bfb82
Show file tree
Hide file tree
Showing 195 changed files with 220 additions and 395 deletions.
Binary file modified lib/Traincraft-4.4.1_020-CE_7.1.jar
Binary file not shown.
24 changes: 15 additions & 9 deletions src/main/java/tcce/client/core/handlers/RecipeBookHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

package tcce.client.core.handlers;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import net.minecraft.item.Item;
import train.common.core.interfaces.ITCRecipe;
import train.common.core.managers.TierRecipe;
import train.common.library.Info;
import train.common.library.TCCEItemIDs;
import train.common.recipes.ShapedTrainRecipes;
import train.common.recipes.ShapelessTrainRecipe;

import java.util.*;

public class RecipeBookHandler {
public static String[] vanillaWorkTableRecipes = new String[21];

Expand All @@ -40,6 +38,9 @@ public static List<ITCRecipe> workbenchListCleaner(List recipeList) {

ITCRecipe recipe = (ITCRecipe)r;
String output = Item.itemRegistry.getNameForObject(recipe.getRecipeOutput().getItem());



if (!outputs.contains(output)) {
if (!output.contains("tc:")) {
cleaned.add(recipe);
Expand All @@ -60,11 +61,16 @@ public static List<TierRecipe> assemblyListCleaner(List recipeList) {
TierRecipe recipe = (TierRecipe)r;
String output = Item.itemRegistry.getNameForObject(recipe.getOutput().getItem());
if (!outputs.contains(output)) {
if (!output.contains("tc:")) {
cleanedList.add(recipe);
outputs.add(output);
for (TCCEItemIDs items : TCCEItemIDs.values()) {
if (output.equals(Info.modID + ":" + items.name())) {
cleanedList.add(recipe);
outputs.add(output);
}
}
}



}
}

Expand Down
24 changes: 12 additions & 12 deletions src/main/java/tcce/common/TCCE.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tcce.common.core.CommonProxy;
import tcce.common.core.TCCETab;
import tcce.common.core.handlers.EntityHandler;
import tcce.common.core.handlers.TCCERecipeHandler;
import tcce.common.items.TCCEItems;
import tcce.common.library.TCCEInfo;
import tcce.common.library.TCCERegistry;
import tcce.common.recipes.AssemblyTableRecipes;

@Mod(modid = TCCEInfo.modID, name = TCCEInfo.modName, version = TCCEInfo.modVersion)
@Mod(modid = TCCEInfo.modID, name = TCCEInfo.modName, version = TCCEInfo.modVersion, dependencies = "required-after:tc")
public class TCCE {

/* TrainCraft instance */
Expand Down Expand Up @@ -55,17 +54,17 @@ public void preInit(FMLPreInitializationEvent event) {
/* Register Items, Blocks, ... */
tcLog.info("Initialize Blocks, Items, ...");

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



TCCEItems.init();
EntityHandler.init();

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

registry = new TCCERegistry();
registry.init();


tcLog.info("Finished PreInitialization");
}
Expand All @@ -74,13 +73,8 @@ public void preInit(FMLPreInitializationEvent event) {

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
}

@Mod.EventHandler
public void load(FMLInitializationEvent event) {



tcLog.info("Start Initialization");
TCCEItems.init();
tcLog.info("Initialize Gui");
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

Expand All @@ -92,7 +86,13 @@ public void load(FMLInitializationEvent event) {
AssemblyTableRecipes.recipes();

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

}

@Mod.EventHandler
public void load(FMLInitializationEvent event) {

}

Expand Down
23 changes: 6 additions & 17 deletions src/main/java/tcce/common/items/TCCEItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
package tcce.common.items;

import cpw.mods.fml.common.registry.GameRegistry;
import tcce.common.TCCE;
import tcce.common.library.TCCEInfo;
import tcce.common.library.TCCEItemIDs;
import train.common.items.ItemRollingStock;
import train.common.Traincraft;

public class TCCEItems {

Expand All @@ -20,28 +20,17 @@ public static void init() {
}

private static void loadItems() {
for (TCCEItemIDs items : TCCEItemIDs.values()) {
if (items.className != null) {
if (items.className.equals("ItemRollingStock")) {
items.item = new ItemRollingStock("tc" + ":trains/" + items.iconName, TCCE.TCCETab);
}
}
}

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

private static void registerItems() {
for (TCCEItemIDs itemId : TCCEItemIDs.values()) {
if (itemId.item != null) {
if (itemId.className != null) {
if (itemId.className.equals("ItemRollingStock")) {
itemId.item.setUnlocalizedName("tc:" + itemId.name());
GameRegistry.registerItem(itemId.item, itemId.name(), "tc");
}
else {
GameRegistry.registerItem(itemId.item, itemId.name());
}
GameRegistry.registerItem(itemId.item, itemId.name());
itemId.item.setUnlocalizedName(TCCEInfo.modID + ":" + itemId.name());

}


Expand Down
1 change: 1 addition & 0 deletions src/main/java/tcce/common/library/TCCEEnumTrains.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import tcce.common.entity.rollingStock.steam.*;
import tcce.common.entity.rollingStock.tender.*;
import train.common.api.TrainRecord;
import train.common.library.TCCEItemIDs;


public class TCCEEnumTrains {
Expand Down
Loading

0 comments on commit c5bfb82

Please sign in to comment.