forked from broscolotos/Traincraft-Community-Pack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00259bd
commit be26b34
Showing
22 changed files
with
698 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install 7z and extract data | ||
run: | | ||
sudo apt-get install -y p7zip-full | ||
mkdir ~/.gradle | ||
mkdir ~/.gradle/caches | ||
cd ~/.gradle/caches | ||
7z x /home/runner/work/Traincraft-Community-Pack/Traincraft-Community-Pack/gradle/caches.7z.001 -y | ||
cd /home/runner/work/Traincraft-Community-Pack/Traincraft-Community-Pack | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Retrieve base mod | ||
run: ./gradlew getTrainAPI | ||
|
||
- name: setup with Gradle | ||
run: ./gradlew setupDecompWorkspace --refresh-dependencies idea | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew setupDecompWorkspace --refresh-dependencies build | ||
|
||
- name: Create artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: TCCE-Addon-Experimental | ||
path: build/libs/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[submodule "submodules/Traincraft"] | ||
path = submodules/Traincraft | ||
url = https://github.com/TheDoctor1138/Traincraft-5.git | ||
branch = TC4.5-1.7.10 | ||
branch = TC4.5-1.7.10 | ||
update = merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
73 changes: 73 additions & 0 deletions
73
src/main/java/tcce/client/core/handlers/RecipeBookHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// Source code recreated from a .class file by IntelliJ IDEA | ||
// (powered by FernFlower decompiler) | ||
// | ||
|
||
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.recipes.ShapedTrainRecipes; | ||
import train.common.recipes.ShapelessTrainRecipe; | ||
|
||
public class RecipeBookHandler { | ||
public static String[] vanillaWorkTableRecipes = new String[21]; | ||
|
||
public RecipeBookHandler() { | ||
} | ||
|
||
public static List<ITCRecipe> workbenchListCleaner(List recipeList) { | ||
Set<String> outputs = new HashSet(); | ||
ArrayList<ITCRecipe> cleaned = new ArrayList(); | ||
Iterator var3 = recipeList.iterator(); | ||
|
||
while(true) { | ||
Object r; | ||
do { | ||
if (!var3.hasNext()) { | ||
return cleaned; | ||
} | ||
|
||
r = var3.next(); | ||
} while(!(r instanceof ShapedTrainRecipes) && !(r instanceof ShapelessTrainRecipe)); | ||
|
||
ITCRecipe recipe = (ITCRecipe)r; | ||
String output = Item.itemRegistry.getNameForObject(recipe.getRecipeOutput().getItem()); | ||
if (!outputs.contains(output)) { | ||
if (!output.contains("tc:")) { | ||
cleaned.add(recipe); | ||
outputs.add(output); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static List<TierRecipe> assemblyListCleaner(List recipeList) { | ||
Set<String> outputs = new HashSet(); | ||
ArrayList<TierRecipe> cleanedList = new ArrayList(); | ||
Iterator var3 = recipeList.iterator(); | ||
|
||
while(var3.hasNext()) { | ||
Object r = var3.next(); | ||
if (r instanceof TierRecipe) { | ||
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); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return cleanedList; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package tcce.client.render; | ||
|
||
|
||
|
||
|
||
|
||
import fexcraft.tmt.slim.ModelBase; | ||
import tcce.common.library.TCCEInfo; | ||
import train.common.api.EntityRollingStock; | ||
import train.common.api.TrainRenderRecord; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
|
||
import java.util.ArrayList; | ||
|
||
public enum TCCERenderEnum implements TrainRenderRecord { | ||
|
||
|
||
; | ||
private Class<? extends EntityRollingStock> entityClass; | ||
private final ModelBase model; | ||
private String texture; | ||
private boolean multiTexture; | ||
private float[] trans; | ||
private float[] rotate; | ||
private float[] scale; | ||
private String smokeType; | ||
private ArrayList<double[]> smokeFX; | ||
private String explosionType; | ||
private ArrayList<double[]> explosionFX; | ||
private int smokeIterations; | ||
private int explosionFXIterations; | ||
private boolean hasSmokeOnSlopes; | ||
|
||
/** | ||
* Defines the render @param for a RollingStock | ||
* | ||
* @param model ModelBase | ||
* @param texture String | ||
* @param multiTexture boolean | ||
* @param trans float[] | ||
* @param rotate float[] | ||
* @param scale float[] | ||
* @param smokeType String | ||
* @param smokeFX ArrayList | ||
* @param explosionType String | ||
* @param explosionFX ArrayList | ||
*/ | ||
TCCERenderEnum(Class<? extends EntityRollingStock> entityClass, ModelBase model, String texture, boolean multiTexture, float[] trans, float[] rotate, float[] scale, String smokeType, int smokeIterations, ArrayList<double[]> smokeFX, String explosionType, ArrayList<double[]> explosionFX, int explosionFXIterations, boolean hasSmokeOnSlopes) { | ||
this.entityClass = entityClass; | ||
this.model = model; | ||
this.texture = texture; | ||
this.multiTexture = multiTexture; | ||
this.trans = trans; | ||
this.rotate = rotate; | ||
this.scale = scale; | ||
this.smokeType = smokeType; | ||
this.smokeFX = smokeFX; | ||
this.explosionType = explosionType; | ||
this.explosionFX = explosionFX; | ||
this.smokeIterations = smokeIterations; | ||
this.explosionFXIterations = explosionFXIterations; | ||
this.hasSmokeOnSlopes = hasSmokeOnSlopes; | ||
} | ||
|
||
@Override | ||
public Class<? extends EntityRollingStock> getEntityClass() { | ||
return entityClass; | ||
} | ||
|
||
@Override | ||
public ModelBase getModel() { | ||
return model; | ||
} | ||
|
||
public boolean getIsMultiTextured() { | ||
return multiTexture; | ||
} | ||
|
||
@Override | ||
public boolean hasSmoke() { | ||
return smokeType.length() > 0; | ||
} | ||
|
||
@Override | ||
public boolean hasSmokeOnSlopes() { | ||
return hasSmokeOnSlopes; | ||
} | ||
|
||
@Override | ||
public String getSmokeType() { | ||
return smokeType; | ||
} | ||
|
||
@Override | ||
public ArrayList<double[]> getSmokeFX() { | ||
return smokeFX; | ||
} | ||
|
||
@Override | ||
public String getExplosionType() { | ||
return explosionType; | ||
} | ||
|
||
@Override | ||
public boolean hasExplosion() { | ||
return explosionType.length() > 0; | ||
} | ||
|
||
@Override | ||
public ArrayList<double[]> getExplosionFX() { | ||
return explosionFX; | ||
} | ||
|
||
@Override | ||
public float[] getTrans() { | ||
return trans; | ||
} | ||
|
||
@Override | ||
public float[] getRotate() { | ||
return rotate; | ||
} | ||
|
||
@Override | ||
public float[] getScale() { | ||
return scale; | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureFile(String colorString) { | ||
if (multiTexture) { | ||
return new ResourceLocation(TCCEInfo.resourceLocation, TCCEInfo.trainsPrefix + texture + colorString + ".png"); | ||
} else { | ||
return new ResourceLocation(TCCEInfo.resourceLocation, TCCEInfo.trainsPrefix + texture + ".png"); | ||
} | ||
} | ||
|
||
@Override | ||
public int getSmokeIterations() { | ||
return smokeIterations; | ||
} | ||
|
||
@Override | ||
public int getExplosionFXIterations() { | ||
return explosionFXIterations; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package tcce.common; | ||
|
||
import cpw.mods.fml.common.Mod; | ||
import cpw.mods.fml.common.SidedProxy; | ||
import cpw.mods.fml.common.event.FMLInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPostInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPreInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLServerStoppedEvent; | ||
import cpw.mods.fml.common.network.NetworkRegistry; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import tcce.common.items.TCCEItems; | ||
import tcce.common.library.TCCEInfo; | ||
import tcce.common.library.TCCERegistry; | ||
import train.common.core.CommonProxy; | ||
import train.common.core.handlers.EntityHandler; | ||
|
||
@Mod(modid = TCCEInfo.modID, name = TCCEInfo.modName, version = TCCEInfo.modVersion) | ||
public class TCCE { | ||
|
||
/* TrainCraft instance */ | ||
@Mod.Instance(TCCEInfo.modID) | ||
public static TCCE instance; | ||
|
||
@SidedProxy(clientSide = "com.thedoctor1138.train.client.core.ClientProxy", serverSide = "com.thedoctor1138.train.common.core.CommonProxy") | ||
public static CommonProxy proxy; | ||
|
||
/* TrainCraft Logger */ | ||
public static Logger tcLog = LogManager.getLogger(TCCEInfo.modName); | ||
|
||
// public static File configDirectory; | ||
|
||
/* Creative tab for Traincraft */ | ||
public static CreativeTabs tcMLPTab; | ||
|
||
private TCCERegistry registry; | ||
|
||
@Mod.EventHandler | ||
public void preInit(FMLPreInitializationEvent event) { | ||
tcLog.info("Starting Traincraft MLP Addon " + TCCEInfo.modVersion + "!"); | ||
|
||
/* Config handler */ | ||
// configDirectory= event.getModConfigurationDirectory(); | ||
|
||
/* Register Items, Blocks, ... */ | ||
tcLog.info("Initialize Blocks, Items, ..."); | ||
|
||
tcMLPTab = new TCCECreativeTabTraincraftTrains(CreativeTabs.getNextID(), "TCMLP"); | ||
|
||
|
||
TCCEItems.init(); | ||
EntityHandler.init(); | ||
|
||
/* Other Proxy init */ | ||
tcLog.info("Initialize Renderer and Events"); | ||
|
||
registry = new TCCERegistry(); | ||
registry.init(); | ||
|
||
tcLog.info("Finished PreInitialization"); | ||
} | ||
|
||
|
||
|
||
@Mod.EventHandler | ||
public void init(FMLInitializationEvent event) { | ||
} | ||
|
||
@Mod.EventHandler | ||
public void load(FMLInitializationEvent event) { | ||
|
||
|
||
|
||
tcLog.info("Initialize Gui"); | ||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); | ||
|
||
|
||
tcLog.info("Initialize Recipes"); | ||
TCCERecipeHandler.initBlockRecipes(); | ||
TCCERecipeHandler.initItemRecipes(); | ||
TCCERecipeHandler.initSmeltingRecipes(); | ||
AssemblyTableRecipes.recipes(); | ||
|
||
proxy.registerBookHandler(); | ||
|
||
|
||
} | ||
|
||
@Mod.EventHandler | ||
public void postInit(FMLPostInitializationEvent evt) { | ||
} | ||
|
||
@Mod.EventHandler | ||
public void serverStop(FMLServerStoppedEvent event) { | ||
} | ||
} } |
Oops, something went wrong.