Skip to content

Commit

Permalink
Addon transfer pt2
Browse files Browse the repository at this point in the history
It works, maybe requires some tweaking after testing
  • Loading branch information
TheDoctor1138 committed Aug 30, 2024
1 parent 0798d93 commit 12d8197
Show file tree
Hide file tree
Showing 6 changed files with 859 additions and 42 deletions.
15 changes: 12 additions & 3 deletions src/main/java/train/common/Traincraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import ebf.tim.entities.EntitySeat;
import ebf.tim.networking.PacketSeatUpdate;
import ebf.tim.utility.DebugUtil;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.world.gen.structure.MapGenStructureIO;
Expand All @@ -32,7 +32,6 @@
import train.common.blocks.TCBlocks;
import train.common.core.CommonProxy;
import train.common.core.CreativeTabTraincraft;
import train.common.core.CreativeTabTraincraftTrains;
import train.common.core.TrainModCore;
import train.common.core.handlers.*;
import train.common.core.util.TraincraftUtil;
Expand Down Expand Up @@ -104,7 +103,7 @@ public class Traincraft {
public static File configDirectory;

/* Creative tab for Traincraft */
public static CreativeTabTraincraft tcTab, tcTrainTab;
public static CreativeTabTraincraft tcTab, tcTrainTab, tcCommunityTab ;

public ArmorMaterial armor = EnumHelper.addArmorMaterial("Armor", 5, new int[]{1, 2, 2, 1}, 25);
public ArmorMaterial armorCloth = EnumHelper.addArmorMaterial("TCcloth", 5, new int[]{1, 2, 2, 1}, 25);
Expand Down Expand Up @@ -145,6 +144,9 @@ public void preInit(FMLPreInitializationEvent event) {
e.printStackTrace();
}
}
if (hasTCCEAddon()){
tcCommunityTab = new CreativeTabTraincraft("Traincraft: Community Edition", Info.modID, "trains/train_mogul");
}

/* Other Proxy init */
tcLog.info("Initialize Renderer and Events");
Expand All @@ -159,6 +161,11 @@ public void init(FMLInitializationEvent event) {
tcLog.info("Start Initialization");
TCBlocks.init();
TCItems.init();
if (Traincraft.hasTCCEAddon()) {
TCItems.registerTCCERollingStock();
Traincraft.tcLog.info("Enabled Traincraft: Community Edition rollingstock");
}

proxy.registerTileEntities();

tcLog.info("Initialize Fluids");
Expand Down Expand Up @@ -257,4 +264,6 @@ public static boolean hasNotEnoughItems() {
public static boolean hasRailcraft() {
return Loader.isModLoaded("Railcraft");
}

public static boolean hasTCCEAddon() {return Loader.isModLoaded("tcce");}
}
35 changes: 0 additions & 35 deletions src/main/java/train/common/core/CreativeTabTraincraftTrains.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

public class NEIAssemblyTableRecipePlugin extends ShapedRecipeHandler {
private final List<TierRecipe> recipeList = assemblyListCleaner(TierRecipeManager.getInstance().getRecipeList());
private static TierRecipe currentRecipe;

private CachedShapedRecipe getShape(TierRecipe recipe) {
CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, recipe.getOutput());
Expand Down Expand Up @@ -171,6 +172,7 @@ public void loadCraftingRecipes(ItemStack result) {
for (TierRecipe recipe : recipeList) {
if (NEIClientUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) {
this.arecipes.add(getShape(recipe));
currentRecipe = recipe;
}
}
}
Expand Down Expand Up @@ -209,8 +211,11 @@ public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
public void drawBackground(int recipe) {
GL11.glColor4f(1, 1, 1, 1);
TierRecipe tierRecipe = null;



if (recipe < recipeList.size()) {
tierRecipe = recipeList.get(recipe);
tierRecipe = currentRecipe;
if (tierRecipe != null) {
changeTexture(getGuiTexture(tierRecipe.getTier()));
}
Expand Down
26 changes: 23 additions & 3 deletions src/main/java/train/common/items/TCItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@


import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
import train.common.Traincraft;
import train.common.adminbook.ItemAdminBook;
import train.common.library.EnumTracks;
import train.common.library.Info;
import train.common.library.ItemIDs;
import train.common.library.*;

public class TCItems {

Expand Down Expand Up @@ -226,4 +225,25 @@ private static void registerItems() {
}
}
}


public static void registerTCCERollingStock(){

for (TCCEItemIDs tcceItems : TCCEItemIDs.values()) {
if (tcceItems.className != null) {
if (tcceItems.className.equals("ItemRollingStock")) {
tcceItems.item = new ItemRollingStock(Info.modID.toLowerCase() + ":trains/" + tcceItems.iconName, Traincraft.tcCommunityTab);
}

}
}

for (TCCEItemIDs tcceItems : TCCEItemIDs.values()) {
if (tcceItems.item != null){
tcceItems.item.setUnlocalizedName(Info.modID + ":" + tcceItems.name());
GameRegistry.registerItem(tcceItems.item, tcceItems.name());
}
}

}
}
Loading

0 comments on commit 12d8197

Please sign in to comment.