diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-05-23 08:03:30 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-05-23 08:03:30 +1000 |
commit | b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4 (patch) | |
tree | 47315845db808283079231d3d86be32800de3fc1 /src/Java/miscutil | |
parent | dce34f9ba22f173b7bf5d7c9669cf29120f14e3a (diff) | |
download | GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.tar.gz GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.tar.bz2 GT5-Unofficial-b1c08c2131c5c58e81ba9a6ae10e3738ae7025b4.zip |
Forgot to Commit before the weekend.. Not sure what I change, but making this as a rollback point/changelog.
Diffstat (limited to 'src/Java/miscutil')
13 files changed, 375 insertions, 109 deletions
diff --git a/src/Java/miscutil/MiscUtils.java b/src/Java/miscutil/MiscUtils.java index 18ddf45884..7681e6a581 100644 --- a/src/Java/miscutil/MiscUtils.java +++ b/src/Java/miscutil/MiscUtils.java @@ -85,8 +85,10 @@ implements ActionListener @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { Utils.LOG_INFO("Cleaning up, doing postInit."); + COMPAT_HANDLER.ServerStartedEvent(); PlayerCache.initCache(); proxy.postInit(event); + } @EventHandler @@ -94,7 +96,6 @@ implements ActionListener { event.registerServerCommand(new CommandMath()); Uptime.serverStarting(); //Integration of Uptime. - COMPAT_HANDLER.ServerStartedEvent(); } diff --git a/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java index 63360e1260..b1b6312956 100644 --- a/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java +++ b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java @@ -15,11 +15,18 @@ public class RECIPES_GREGTECH { } private static void execute(){ + cokeOvenRecipes(); + assemblerRecipes(); + + } + + private static void cokeOvenRecipes(){ Utils.LOG_INFO("Loading Recipes for Industrial Coking Oven."); try { //GT Logs to Charcoal Recipe + //With Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 1 GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 2 @@ -29,11 +36,9 @@ public class RECIPES_GREGTECH { 800, //Time in ticks 30); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - try { - - //Coal -> Coke Recipe + //Coal -> Coke Recipe + //With Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 1 GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 2 @@ -41,8 +46,39 @@ public class RECIPES_GREGTECH { Materials.Creosote.getFluid(250L), //Fluid Output UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output 600, //Time in ticks + 120); //EU + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + + try { + //GT Logs to Charcoal Recipe + //Without Sulfuric Acid + CORE.RA.addCokeOvenRecipe( + GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 1 + GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 2L), //Input 2 + null, //Fluid Input + Materials.Creosote.getFluid(145L), //Fluid Output + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output + 1200, //Time in ticks + 30); //EU + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + + try { + //Coal -> Coke Recipe + //Without Sulfuric Acid + CORE.RA.addCokeOvenRecipe( + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 1 + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 2L), //Input 2 + null, //Fluid Input + Materials.Creosote.getFluid(200L), //Fluid Output + UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output + 900, //Time in ticks 120); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } + + private static void assemblerRecipes(){ + //GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine2.get(1L, new Object[0]), 50, 16); + //GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine3.get(1L, new Object[0]), 50, 16); + + } }
\ No newline at end of file diff --git a/src/Java/miscutil/core/handler/registration/RECIPES_Machines.java b/src/Java/miscutil/core/handler/registration/RECIPES_Machines.java index 173892ce68..995a77f6c8 100644 --- a/src/Java/miscutil/core/handler/registration/RECIPES_Machines.java +++ b/src/Java/miscutil/core/handler/registration/RECIPES_Machines.java @@ -1,8 +1,8 @@ package miscutil.core.handler.registration; import gregtech.api.enums.ItemList; -import miscutil.core.util.UtilsItems; import miscutil.core.util.Utils; +import miscutil.core.util.UtilsItems; import miscutil.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; @@ -25,7 +25,7 @@ public class RECIPES_Machines { static ItemStack RECIPE_Buffer_MAX = GregtechItemList.Energy_Buffer_1by1_MAX.get(1); static ItemStack RECIPE_IndustrialCentrifuge = GregtechItemList.Industrial_Centrifuge.get(1); static ItemStack RECIPE_IndustrialCentrifugeCasing = GregtechItemList.Casing_Centrifuge1.get(1); - static ItemStack RECIPE_IndustrialCentrifugeCasingVibration = GregtechItemList.Casing_Centrifuge2.get(1); + static ItemStack RECIPE_IndustrialCokeOvenFrame = GregtechItemList.Casing_CokeOven.get(1); //Buffer Cores diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index c79a69b791..4e303c8e39 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -130,7 +130,7 @@ public class Utils { return FluidRegistry.getFluidStack("ic2steam", (int)aAmount); } - + /*public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ GameRegistry.addRecipe(new ItemStack(resultBlock), @@ -155,26 +155,42 @@ public class Utils { return correctTool; } - + /** - * - * @param colorStr e.g. "#FFFFFF" - * @return String - formatted "rgb(0,0,0)" - */ + * + * @param colorStr e.g. "#FFFFFF" + * @return String - formatted "rgb(0,0,0)" + */ public static String hex2Rgb(String hexString) { - Color c = new Color( - Integer.valueOf(hexString.substring(1, 3), 16), - Integer.valueOf(hexString.substring(3, 5), 16), - Integer.valueOf(hexString.substring(5, 7), 16)); - - StringBuffer sb = new StringBuffer(); - sb.append("rgb("); - sb.append(c.getRed()); - sb.append(","); - sb.append(c.getGreen()); - sb.append(","); - sb.append(c.getBlue()); - sb.append(")"); - return sb.toString(); + Color c = new Color( + Integer.valueOf(hexString.substring(1, 3), 16), + Integer.valueOf(hexString.substring(3, 5), 16), + Integer.valueOf(hexString.substring(5, 7), 16)); + + StringBuffer sb = new StringBuffer(); + sb.append("rgb("); + sb.append(c.getRed()); + sb.append(","); + sb.append(c.getGreen()); + sb.append(","); + sb.append(c.getBlue()); + sb.append(")"); + return sb.toString(); + } + + //Smooth Rounding Function + public static double decimalRounding(double d) { + return Math.round(d * 2) / 2.0; + } + + //Smooth Rounding Function (Nearest 5) + public static double decimalRoundingToWholes(double d) { + return 5*(Math.round(d/5)); + } + + //Converts temps for GT machines, then rounds for ease of use. + public static float celsiusToKelvin(int i){ + double f = i + 273.15F; + return (int)decimalRoundingToWholes(f); } } diff --git a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java index 1a95d49441..79ebcd3576 100644 --- a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java @@ -46,10 +46,13 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Iron_BlastFurnace, Casing_IronPlatedBricks, //Machine Casings - Casing_Shielding, Casing_Centrifuge1, Casing_Centrifuge2, + Casing_Shielding, //Large Centrifuge - Industrial_Centrifuge; + Industrial_Centrifuge, Casing_Centrifuge1, + + //Coke Oven + Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/miscutil/gregtech/api/init/InitGregtech.java b/src/Java/miscutil/gregtech/api/init/InitGregtech.java index 45435821c5..a1f1f1eb41 100644 --- a/src/Java/miscutil/gregtech/api/init/InitGregtech.java +++ b/src/Java/miscutil/gregtech/api/init/InitGregtech.java @@ -4,6 +4,7 @@ import static miscutil.core.lib.LoadedMods.Gregtech; import miscutil.gregtech.api.init.machines.GregtechConduits; import miscutil.gregtech.api.init.machines.GregtechEnergyBuffer; import miscutil.gregtech.api.init.machines.GregtechIndustrialCentrifuge; +import miscutil.gregtech.api.init.machines.GregtechIndustrialCokeOven; import miscutil.gregtech.api.init.machines.GregtechSafeBlock; import miscutil.gregtech.api.init.machines.GregtechSteamCondenser; @@ -16,6 +17,7 @@ public class InitGregtech { GregtechSteamCondenser.run(); GregtechSafeBlock.run(); GregtechIndustrialCentrifuge.run(); + GregtechIndustrialCokeOven.run(); } } diff --git a/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCokeOven.java b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCokeOven.java new file mode 100644 index 0000000000..6ddfbf7bc4 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/init/machines/GregtechIndustrialCokeOven.java @@ -0,0 +1,27 @@ +package miscutil.gregtech.api.init.machines; + +import miscutil.core.util.Utils; +import miscutil.gregtech.api.enums.GregtechItemList; +import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCokeOven; + +public class GregtechIndustrialCokeOven +{ + + + + public static void run() + { + if (miscutil.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Industrial Coke Oven Multiblock."); + run1(); + } + + } + + private static void run1() + { + //Industrial Centrifuge Multiblock + GregtechItemList.Industrial_CokeOven.set(new GregtechMetaTileEntityIndustrialCokeOven(791, "industrialcokeoven.controller.tier.single", "Industrial Coke Oven").getStackForm(1L)); + + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java index 8a4e7a1833..ab6d0ad900 100644 --- a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java +++ b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java @@ -9,62 +9,89 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechRecipeAdder implements IGregtech_RecipeAdder { - /*@Override - public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - if (bInput1 == null || aOutput1 == null || bOutput1 == null || aDuration < 1 || aEUt < 1) { - return false; - } - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(aOptimize, aInputs, aOutputs, aSpecial, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); - return true; - }*/ - - @Override - public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); + @SuppressWarnings("static-method") + private void debug1(){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Walking Through CokeOven Recipe Creation."); Utils.LOG_INFO("My name is Ralph and I will be your humble host."); - if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) && (aFluidOutput == null))) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug2(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); - if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug3(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); - if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug4(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); - Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+", "+aInput2.getDisplayName()+", "+aFluidInput.getFluid().getName()); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); + + } + @SuppressWarnings("static-method") + private void debug5(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+" & "+aInput2.getDisplayName()+" & liquid "+aFluidInput.getFluid().getName()+". This took "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); - return true; + } + + @Override + public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { + try { + + debug1(); + if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) && (aFluidOutput == null))) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + + debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + + debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + debug4(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if (aFluidInput == null){ + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + else { + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + debug5(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + + return true; + } catch (NullPointerException e){ + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Failed."); + return false; + } } } diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java index e2246504f1..8af461f1e0 100644 --- a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -23,9 +23,9 @@ extends GregtechMetaCasingBlocksAbstract { Textures.BlockIcons.CASING_BLOCKS[i] = new GT_CopiedBlockTexture(this, 6, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Centrifuge Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Centrifuge Top Blocks"); - //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "MV Machine Casing"); - //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "HV Machine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "EV Machine Casing"); //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "IV Machine Casing"); //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "LuV Machine Casing"); @@ -39,10 +39,10 @@ extends GregtechMetaCasingBlocksAbstract { //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Nichrome Coil Block"); //GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Superconducting Coil Block"); GregtechItemList.Casing_Centrifuge1.set(new ItemStack(this, 1, 0)); - GregtechItemList.Casing_Centrifuge2.set(new ItemStack(this, 1, 1)); - /*ItemList.Casing_MV.set(new ItemStack(this, 1, 2)); - ItemList.Casing_HV.set(new ItemStack(this, 1, 3)); - ItemList.Casing_EV.set(new ItemStack(this, 1, 4)); + GregtechItemList.Casing_CokeOven.set(new ItemStack(this, 1, 1)); + GregtechItemList.Casing_CokeOven_Coil1.set(new ItemStack(this, 1, 2)); + GregtechItemList.Casing_CokeOven_Coil2.set(new ItemStack(this, 1, 3)); + /*ItemList.Casing_EV.set(new ItemStack(this, 1, 4)); ItemList.Casing_IV.set(new ItemStack(this, 1, 5)); ItemList.Casing_LuV.set(new ItemStack(this, 1, 6)); ItemList.Casing_ZPM.set(new ItemStack(this, 1, 7)); @@ -60,10 +60,14 @@ extends GregtechMetaCasingBlocksAbstract { public IIcon getIcon(int aSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { - case 0: + case 0: //Centrifuge return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon(); - case 1: - return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + case 1: //Coke Oven Frame + return Textures.BlockIcons.MACHINE_CASING_GEARBOX_STEEL.getIcon(); + case 2: //Coke Oven Casing Tier 1 + return Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon(); + case 3: //Coke Oven Casing Tier 2 + return Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon(); case 10: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); case 12: diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java index d4ac2a03c3..4080db753a 100644 --- a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java @@ -1,8 +1,8 @@ package miscutil.gregtech.common.blocks; import gregtech.api.GregTech_API; +import gregtech.api.items.GT_Generic_Block; import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Block_Casings_Abstract; import java.util.Random; @@ -22,7 +22,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public abstract class GregtechMetaCasingBlocksAbstract - extends GT_Block_Casings_Abstract { + extends GT_Generic_Block { public GregtechMetaCasingBlocksAbstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) { super(aItemClass, aName, aMaterial); setStepSound(soundTypeMetal); diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasings1.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasings1.java new file mode 100644 index 0000000000..41c5552de2 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasings1.java @@ -0,0 +1,33 @@ +package miscutil.gregtech.common.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class GregtechMetaItemCasings1 +extends GregtechMetaItemCasingsAbstract { + public GregtechMetaItemCasings1(Block par1) { + super(par1); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + super.addInformation(aStack, aPlayer, aList, aF3_H); + switch (getDamage(aStack)) { + case 0: + aList.add(this.mCasing_Centrifuge); + break; + case 1: + aList.add(this.mCasing_CokeOven); + break; + case 2: + aList.add(this.mCasing_CokeCoil1); + break; + case 3: + aList.add(this.mCasing_CokeCoil2); + break; + } + } +} diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java new file mode 100644 index 0000000000..b43fa35190 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java @@ -0,0 +1,45 @@ +package miscutil.gregtech.common.blocks; + +import gregtech.api.util.GT_LanguageManager; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public abstract class GregtechMetaItemCasingsAbstract + extends ItemBlock { + + protected final String mCasing_Centrifuge = GT_LanguageManager.addStringLocalization("mu.centrifugecasing", "Warning! Standing in the Centrifuge not recommended"); + protected final String mCasing_CokeOven = GT_LanguageManager.addStringLocalization("mu.cokeoven", "Sturdy and Strong"); + protected final String mCasing_CokeCoil1 = GT_LanguageManager.addStringLocalization("mu.coil01tooltip", "Base Heating Capacity = 1350 Kelvin"); + protected final String mCasing_CokeCoil2 = GT_LanguageManager.addStringLocalization("mu.coil02tooltip", "Base Heating Capacity = 2275 Kelvin"); + protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); + protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); + + public GregtechMetaItemCasingsAbstract(Block par1) { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + //setCreativeTab(AddToCreativeTab.tabMachines); + } + + @Override + public int getMetadata(int aMeta) { + return aMeta; + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + super.addInformation(aStack, aPlayer, aList, aF3_H); + aList.add(this.mNoMobsToolTip); + aList.add(this.mNoTileEntityToolTip); + } +} diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java index 80c10f7e6e..6a00a34069 100644 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java +++ b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java @@ -1,6 +1,5 @@ package miscutil.gregtech.common.machines.multi; -import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -8,16 +7,18 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import java.util.ArrayList; +import java.util.Arrays; +import miscutil.core.block.ModBlocks; import miscutil.gregtech.api.util.GregtechRecipe; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntityIndustrialCokeOven extends GT_MetaTileEntity_MultiBlockBase { @@ -31,11 +32,13 @@ public class GregtechMetaTileEntityIndustrialCokeOven super(aName); } - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityIndustrialCokeOven(this.mName); } - public String[] getDescription() { + @Override + public String[] getDescription() { return new String[]{"Smelts up to 6-18 Items at once", "Controller Block for the Multi Smelter", "Size: 3x3x3 (Hollow)", @@ -49,36 +52,102 @@ public class GregtechMetaTileEntityIndustrialCokeOven "Heat Proof Machine Casings for the rest"}; } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[47], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[11]}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[47]}; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes; + } - public boolean isCorrectMachinePart(ItemStack aStack) { + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { return true; } - public boolean isFacingValid(byte aFacing) { + @Override + public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList<FluidStack> tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 0) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + updateSlots(); + return true; + } + } + return false; + } + /*public boolean checkRecipe(ItemStack aStack) { + ArrayList<ItemStack> tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); int j = 0; - this.mOutputItems = new ItemStack[6 * this.mLevel]; + this.mOutputItems = new ItemStack[12 * this.mLevel]; for (int i = 0; (i < 100) && (j < this.mOutputItems.length); i++) { if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) { j++; @@ -95,45 +164,43 @@ public class GregtechMetaTileEntityIndustrialCokeOven return true; } return false; - } + }*/ - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - + //this.mOutputItems = new ItemStack[12 * this.mLevel]; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { return false; } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 11); + addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 1); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { - case 12: + case 2: this.mLevel = 1; break; - case 13: + case 3: this.mLevel = 2; break; - case 14: - this.mLevel = 3; - break; default: return false; } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings1) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { return false; } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { return false; } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 11) { + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { return false; } } @@ -143,11 +210,11 @@ public class GregtechMetaTileEntityIndustrialCokeOven for (int j = -1; j < 2; j++) { if ((xDir + i != 0) || (zDir + j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) { + if ((!addMaintenanceToMachineList(tTileEntity, 1)) && (!addInputToMachineList(tTileEntity, 1)) && (!addOutputToMachineList(tTileEntity, 1)) && (!addEnergyInputToMachineList(tTileEntity, 1))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { return false; } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) { + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { return false; } } @@ -157,23 +224,28 @@ public class GregtechMetaTileEntityIndustrialCokeOven return true; } - public int getMaxEfficiency(ItemStack aStack) { + @Override + public int getMaxEfficiency(ItemStack aStack) { return 10000; } - public int getPollutionPerTick(ItemStack aStack) { - return 20; + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; } - public int getDamageToComponent(ItemStack aStack) { + @Override + public int getDamageToComponent(ItemStack aStack) { return 0; } - public int getAmountOfOutputs() { - return 18; + @Override + public int getAmountOfOutputs() { + return 24; } - public boolean explodesOnComponentBreak(ItemStack aStack) { + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } } |