Skip to content

Commit

Permalink
2.2 Update
Browse files Browse the repository at this point in the history
- Migrated recipes from addOldShaped to addShaped (fixed a startup
recipes crash that I thought it was fixed in 2.1.1), closes #10
- Refactored RecipeHelper class
- Uncommented Ender IO and Mekanism integration for when those mods are
ready
- Improved modules checking (I think)
  • Loading branch information
Jacky1356400 committed Jul 16, 2017
1 parent 7c11610 commit 895a2aa
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 94 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
org.gradle.jvmargs=-Xmx4G
mc_version=1.12
forge_version=14.21.1.2406
mod_version=2.1.2
mod_version=2.2
mappings_version=snapshot_20170710
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.jacky1356400.exchangers.util;
package me.jacky1356400.exchangers.helper;

import me.jacky1356400.exchangers.util.Data;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand Down
165 changes: 85 additions & 80 deletions src/main/java/me/jacky1356400/exchangers/init/ModRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
import me.jacky1356400.exchangers.item.ItemPoweredExchanger;
import me.jacky1356400.exchangers.item.special.ItemTuberousExchanger;
import me.jacky1356400.exchangers.util.Data;
import me.jacky1356400.exchangers.util.RecipeHelper;
import me.jacky1356400.exchangers.helper.RecipeHelper;
import me.jacky1356400.exchangers.util.Tier;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import static me.jacky1356400.exchangers.integration.ThermalExpansionIntegration.*;

public class ModRegistry {

public static final Item WOODEN = new ItemExchanger("exwooden", Tier.ONE, Config.woodMaxDmg);
Expand All @@ -45,86 +44,90 @@ public class ModRegistry {
@SuppressWarnings("deprecation")
private static void initRecipes() {
if (Config.vanillaModule = true) {
String L = "logWood";
String W = "logWood";
String R = "dyeRed";
String S = "stone";
String G = "ingotGold";
String I = "ingotIron";
String D = "gemDiamond";
String Db = "blockDiamond";
String E = "gemEmerald";
String L = "gemLapis";
String O = "obsidian";
String Pe = "enderpearl";
Item EYE = Items.ENDER_EYE;

RecipeHelper.addShaped(WOODEN, 3, 3, L, Items.ENDER_EYE, L, L, CORE_1, L, L, Items.ENDER_EYE, L);

if (Config.specialModule = true)
RecipeHelper.addOldShaped(POTATO, "PGP", "PEP", "PGP", 'P', Items.POTATO, 'G', "nuggetGold", 'E',
"enderpearl");
RecipeHelper.addShaped(WOODEN, 3, 3, W, EYE, W, W, CORE_1, W, W, EYE, W);

if (Config.vanillaProgressiveRecipes = true) {
RecipeHelper.addOldShaped(STONE, "SES", "CXC", "SES", 'S', "stone", 'E', Items.ENDER_EYE, 'C', CORE_1,
'X', WOODEN);
RecipeHelper.addOldShaped(GOLD, "GEG", "CXC", "GEG", 'G', "ingotGold", 'E', Items.ENDER_EYE, 'C',
CORE_2, 'X', STONE);
RecipeHelper.addOldShaped(IRON, "IEI", "CXC", "IEI", 'I', "ingotIron", 'E', Items.ENDER_EYE, 'C',
CORE_2, 'X', GOLD);
RecipeHelper.addOldShaped(DIAMOND, "DED", "CXC", "DED", 'D', "gemDiamond", 'E', Items.ENDER_EYE, 'C',
CORE_3, 'X', IRON);
RecipeHelper.addOldShaped(EMERALD, "MEM", "CXC", "MEM", 'M', "gemEmerald", 'E', Items.ENDER_EYE, 'C',
CORE_3, 'X', DIAMOND);
RecipeHelper.addOldShaped(OBSIDIAN, "OEO", "CXC", "OEO", 'O', "obsidian", 'E', Items.ENDER_EYE, 'C',
CORE_3, 'X', EMERALD);
RecipeHelper.addShaped(STONE, 3, 3, S, EYE, S, CORE_1, WOODEN, CORE_1, S, EYE, S);
RecipeHelper.addShaped(GOLD, 3, 3, G, EYE, G, CORE_2, STONE, CORE_2, G, EYE, G);
RecipeHelper.addShaped(IRON, 3, 3, I, EYE, I, CORE_2, GOLD, CORE_2, I, EYE, I);
RecipeHelper.addShaped(DIAMOND, 3, 3, D, EYE, D, CORE_3, IRON, CORE_3, D, EYE, D);
RecipeHelper.addShaped(EMERALD, 3, 3, E, EYE, E, CORE_3, DIAMOND, CORE_3, E, EYE, E);
RecipeHelper.addShaped(OBSIDIAN, 3, 3, O, EYE, O, CORE_3, EMERALD, CORE_3, O, EYE, O);
} else {
RecipeHelper.addOldShaped(STONE, "SES", "SCS", "SES", 'S', "stone", 'E', Items.ENDER_EYE, 'C', CORE_1);
RecipeHelper.addOldShaped(GOLD, "GEG", "GCG", "GEG", 'G', "ingotGold", 'E', Items.ENDER_EYE, 'C',
CORE_2);
RecipeHelper.addOldShaped(IRON, "IEI", "ICI", "IEI", 'I', "ingotIron", 'E', Items.ENDER_EYE, 'C',
CORE_2);
RecipeHelper.addOldShaped(DIAMOND, "DED", "DCD", "DED", 'D', "gemDiamond", 'E', Items.ENDER_EYE, 'C',
CORE_3);
RecipeHelper.addOldShaped(EMERALD, "MEM", "MCM", "MEM", 'M', "gemEmerald", 'E', Items.ENDER_EYE, 'C',
CORE_3);
RecipeHelper.addOldShaped(OBSIDIAN, "OEO", "OCO", "OEO", 'O', "obsidian", 'E', Items.ENDER_EYE, 'C',
CORE_3);
RecipeHelper.addShaped(STONE, 3, 3, S, EYE, S, S, CORE_1, S, S, EYE, S);
RecipeHelper.addShaped(GOLD, 3, 3, G, EYE, G, G, CORE_2, G, G, EYE, G);
RecipeHelper.addShaped(IRON, 3, 3, I, EYE, I, I, CORE_2, I, I, EYE, I);
RecipeHelper.addShaped(DIAMOND, 3, 3, D, EYE, D, D, CORE_3, D, D, EYE, D);
RecipeHelper.addShaped(EMERALD, 3, 3, E, EYE, E, E, CORE_3, E, E, EYE, E);
RecipeHelper.addShaped(OBSIDIAN, 3, 3, O, EYE, O, O, CORE_3, O, O, EYE, O);
}

RecipeHelper.addShaped(CORE_1, 3, 3, L, R, L, R, "enderpearl", R, L, R, L);
RecipeHelper.addShaped(CORE_2, 3, 3, I, "gemLapis", I, CORE_1, Items.ENDER_EYE, CORE_1, I, "gemLapis", I);
RecipeHelper.addShaped(CORE_3, 3, 3, D, CORE_2, E, CORE_2, "blockDiamond", CORE_2, E, CORE_2, D);
RecipeHelper.addShaped(CORE_1, 3, 3, W, R, W, R, Pe, R, W, R, W);
RecipeHelper.addShaped(CORE_2, 3, 3, I, L, I, CORE_1, EYE, CORE_1, I, L, I);
RecipeHelper.addShaped(CORE_3, 3, 3, D, CORE_2, E, CORE_2, Db, CORE_2, E, CORE_2, D);
}
if ((Config.thermalExpansionModule = true) && (Loader.isModLoaded(Data.THERMAL))) {
RecipeHelper.addOldShaped(LEADSTONE, "LSL", "LCL", "LFL", 'L', "ingotLead", 'S', ThermalExpansionIntegration.redstoneServo, 'F', ThermalExpansionIntegration.fluxCapacitorBasic, 'C', TECORE_1);
if (Config.specialModule = true) {
String Pe = "enderpearl";
String nG = "nuggetGold";
Item Po = Items.POTATO;

if (Config.thermalExpansionProgressiveRecipes = true) {
RecipeHelper.addOldShaped(HARDENED, "IRI", "CXC", "IFI", 'I', "ingotInvar", 'R',
ThermalExpansionIntegration.redstoneReceptionCoil, 'F', ThermalExpansionIntegration.fluxCapacitorHardened,
'C', TECORE_1, 'X', LEADSTONE);
RecipeHelper.addOldShaped(REINFORCED, "ERE", "CXC", "EFE", 'E', "ingotElectrum", 'R',
ThermalExpansionIntegration.redstoneTransmissionCoil, 'F', ThermalExpansionIntegration.fluxCapacitorReinforced,
'C', TECORE_2, 'X', HARDENED);
RecipeHelper.addOldShaped(SIGNALUM, "SRS", "CXC", "SFS", 'S', "ingotSignalum", 'R',
ThermalExpansionIntegration.redstoneConductanceCoil, 'F', ThermalExpansionIntegration.fluxCapacitorSignalum,
'C', TECORE_3, 'X', REINFORCED);
RecipeHelper.addOldShaped(RESONANT, "IRI", "CXC", "IFI", 'I', "ingotEnderium", 'R',
ThermalExpansionIntegration.redstoneConductanceCoil, 'F', ThermalExpansionIntegration.fluxCapacitorResonant,
'C', TECORE_3, 'X', SIGNALUM);
} else {
RecipeHelper.addOldShaped(HARDENED, "IRI", "ICI", "IFI", 'I', "ingotInvar",
'R', ThermalExpansionIntegration.redstoneReceptionCoil, 'F', ThermalExpansionIntegration.fluxCapacitorHardened,
'C', TECORE_1);
RecipeHelper.addOldShaped(REINFORCED, "ERE", "ECE", "EFE", 'E', "ingotElectrum",
'R', ThermalExpansionIntegration.redstoneTransmissionCoil, 'F', ThermalExpansionIntegration.fluxCapacitorReinforced,
'C', TECORE_2);
RecipeHelper.addOldShaped(SIGNALUM, "SRS", "SCS", "SFS", 'S', "ingotSignalum",
'R', ThermalExpansionIntegration.redstoneConductanceCoil, 'F', ThermalExpansionIntegration.fluxCapacitorSignalum,
'C', TECORE_3);
RecipeHelper.addOldShaped(RESONANT, "IRI", "ICI", "IFI", 'I', "ingotEnderium",
'R', ThermalExpansionIntegration.redstoneConductanceCoil, 'F', ThermalExpansionIntegration.fluxCapacitorResonant,
'C', TECORE_3);
}
RecipeHelper.addShaped(POTATO, 3, 3, Po, nG, Po, Po, Pe, Po, Po, nG, Po);
}
if (Config.thermalExpansionModule = true) {
if (Loader.isModLoaded(Data.THERMAL)) {
String iLe = "ingotLead";
String iI = "ingotInvar";
String iEle = "ingotElectrum";
String iS = "ingotSignalum";
String iEn = "ingotEnderium";
String gC = "gearCopper";
String gB = "gearBronze";
String gI = "gearInvar";
String gLu = "gearLumium";
ItemStack S = ThermalExpansionIntegration.redstoneServo;
ItemStack C1 = ThermalExpansionIntegration.redstoneReceptionCoil;
ItemStack C2 = ThermalExpansionIntegration.redstoneTransmissionCoil;
ItemStack C3 = ThermalExpansionIntegration.redstoneConductanceCoil;
ItemStack F1 = ThermalExpansionIntegration.fluxCapacitorBasic;
ItemStack F2 = ThermalExpansionIntegration.fluxCapacitorHardened;
ItemStack F3 = ThermalExpansionIntegration.fluxCapacitorReinforced;
ItemStack F4 = ThermalExpansionIntegration.fluxCapacitorSignalum;
ItemStack F5 = ThermalExpansionIntegration.fluxCapacitorResonant;
ItemStack B1 = ThermalExpansionIntegration.bucketResonantEnder;
ItemStack B2 = ThermalExpansionIntegration.bucketEnergizedGlowstone;
ItemStack B3 = ThermalExpansionIntegration.bucketGelidCryotheum;

RecipeHelper.addShaped(LEADSTONE, 3, 3, iLe, S, iLe, iLe, TECORE_1, iLe, iLe, F1, iLe);

RecipeHelper.addOldShaped(TECORE_1, "CLC", "LRL", "CLC", 'C', "gearCopper", 'L', "ingotLead",
'R', bucketResonantEnder);
RecipeHelper.addOldShaped(TECORE_2, "BIB", "CGC", "BIB", 'B', "gearBronze", 'I', "gearInvar",'C',
TECORE_1, 'G', bucketEnergizedGlowstone);
RecipeHelper.addOldShaped(TECORE_3, "LCL", "CGC", "LCL", 'C', TECORE_2,
'L', "gearLumium", 'G', bucketGelidCryotheum);
if (Config.thermalExpansionProgressiveRecipes = true) {
RecipeHelper.addShaped(HARDENED, 3, 3, iI, C1, iI, TECORE_1, LEADSTONE, TECORE_1, iI, F2, iI);
RecipeHelper.addShaped(REINFORCED, 3, 3, iEle, C2, iEle, TECORE_2, HARDENED, TECORE_2, iEle, F3, iEle);
RecipeHelper.addShaped(SIGNALUM, 3, 3, iS, C3, iS, TECORE_3, REINFORCED, TECORE_3, iS, F4, iS);
RecipeHelper.addShaped(RESONANT, 3, 3, iEn, C3, iEn, TECORE_3, SIGNALUM, TECORE_3, iEn, F5, iEn);
} else {
RecipeHelper.addShaped(HARDENED, 3, 3, iI, C1, iI, iI, TECORE_1, iI, iI, F2, iI);
RecipeHelper.addShaped(REINFORCED, 3, 3, iEle, C2, iEle, iEle, TECORE_2, iEle, iEle, F3, iEle);
RecipeHelper.addShaped(SIGNALUM, 3, 3, iS, C3, iS, iS, TECORE_3, iS, iS, F4, iS);
RecipeHelper.addShaped(RESONANT, 3, 3, iEn, C3, iEn, iEn, TECORE_3, iEn, iEn, F5, iEn);
}

RecipeHelper.addShaped(TECORE_1, 3, 3, gC, iLe, gC, iLe, B1, iLe, gC, iLe, gC);
RecipeHelper.addShaped(TECORE_2, 3, 3, gB, gI, gB, TECORE_1, B2, TECORE_1, gB, gI, gB);
RecipeHelper.addShaped(TECORE_3, 3, 3, gLu, TECORE_2, gLu, TECORE_2, B3, TECORE_2, gLu, TECORE_2, gLu);
}
}
}

Expand All @@ -140,19 +143,21 @@ public void onItemRegistry(RegistryEvent.Register<Item> e) {

@SubscribeEvent
public void onRecipeRegistry(RegistryEvent.Register<IRecipe> e) {
/*
if ((Config.enderIOModule = true) && (Loader.isModLoaded(Data.EIO))) {
EnderIOIntegration.init();
if (Config.enderIOModule = true) {
if (Loader.isModLoaded(Data.EIO)) {
//EnderIOIntegration.init();
}
}
*/
if ((Config.thermalExpansionModule = true) && (Loader.isModLoaded(Data.THERMAL))) {
ThermalExpansionIntegration.init();
if (Config.thermalExpansionModule = true) {
if (Loader.isModLoaded(Data.THERMAL)){
ThermalExpansionIntegration.init();
}
}
/*
if ((Config.mekanismModule = true) && (Loader.isModLoaded(Data.MEK))) {
MekanismIntegration.init();
if (Config.mekanismModule = true) {
if (Loader.isModLoaded(Data.MEK)) {
//MekanismIntegration.init();
}
}
*/
initRecipes();
e.getRegistry().registerAll(Data.RECIPES.toArray(new IRecipe[0]));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
package me.jacky1356400.exchangers.integration;

import me.jacky1356400.exchangers.Exchangers;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;

public class EnderIOIntegration {
/*

public static ItemStack capacitorBankBasic;
public static ItemStack capacitorBank;
public static ItemStack capacitorBankVibrant;
Expand Down Expand Up @@ -38,14 +48,11 @@ public static void init() {
}

Fluid nutrientDistillation = FluidRegistry.getFluid("nutrient_distillation");
bucketNutrientDistillation = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket,
nutrientDistillation);
bucketNutrientDistillation = FluidUtil.getFilledBucket(new FluidStack(nutrientDistillation, 1000));
Fluid dewOfTheVoid = FluidRegistry.getFluid("ender_distillation");
bucketDewOfTheVoid = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket,
dewOfTheVoid);
bucketDewOfTheVoid = FluidUtil.getFilledBucket(new FluidStack(dewOfTheVoid, 1000));
Fluid vaporOfLevity = FluidRegistry.getFluid("vapor_of_levity");
bucketVaporOfLevity = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket,
vaporOfLevity);
bucketVaporOfLevity = FluidUtil.getFilledBucket(new FluidStack(vaporOfLevity, 1000));
}
*/

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package me.jacky1356400.exchangers.integration;

import me.jacky1356400.exchangers.Exchangers;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class MekanismIntegration {
/*

public static ItemStack circuitBasic;
public static ItemStack circuitAdvanced;
public static ItemStack circuitElite;
Expand Down Expand Up @@ -36,5 +41,5 @@ public static void init() {
portableTeleporter = new ItemStack(portableTeleporterItem, 1, 0);
}
}
*/

}
2 changes: 1 addition & 1 deletion src/main/java/me/jacky1356400/exchangers/util/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Data {
public static final String EIO = "enderio";
public static final String MEK = "mekanism";
public static final String THERMAL = "thermalexpansion";
public static final String VERSION = "1.12-2.1.2";
public static final String VERSION = "1.12-2.2";
public static final String MODID = "exchangers";
public static final String MODNAME = "Exchangers";
public static final CreativeTabs TAB = new CreativeTabs(MODID) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "exchangers",
"name": "Exchangers",
"description": "Block Exchangers.",
"version": "1.12-2.1.2",
"version": "1.12-2.2",
"mcversion": "1.12",
"url": "https://github.com/Jacky1356400/Exchangers",
"updateUrl": "",
Expand Down

0 comments on commit 895a2aa

Please sign in to comment.