diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-10-05 16:33:51 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-10-05 16:33:51 +1000 |
commit | 830a2df78d4b28d2bb27b83d4117aaf8651dd87b (patch) | |
tree | 94b6f8183bfd050a08f2d3c217a5d39431c05683 | |
parent | bc2b9e0a078859085ab8cf81855ca812800ea305 (diff) | |
download | GT5-Unofficial-830a2df78d4b28d2bb27b83d4117aaf8651dd87b.tar.gz GT5-Unofficial-830a2df78d4b28d2bb27b83d4117aaf8651dd87b.tar.bz2 GT5-Unofficial-830a2df78d4b28d2bb27b83d4117aaf8651dd87b.zip |
+ Added some wires from custom materials.
+ Added a new Super Conductor Material for LuV power (HG-1223).
+ Added recipes for all custom material wires and cables.
$ Fixed an issue where materials with a bad RGB array would crash the game.
6 files changed, 400 insertions, 65 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index cfd8fae7b0..99998d588b 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -444,6 +444,10 @@ public final class ModItems { //Leagrisium MaterialGenerator.generate(ALLOY.LEAGRISIUM); + + //Super Conductor + MaterialGenerator.generate(ALLOY.HG1223, false); + //Must be the final Alloy to Generate MaterialGenerator.generate(ALLOY.QUANTUM); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 4ea723a164..7488a3e0ae 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -546,7 +546,22 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().CARBON, 1) }); - + public static final Material HG1223 = new Material( + "HG-1223", //Material Name + MaterialState.LIQUID, //State + new short[]{39,85,159, 0}, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, + -1, + false, //Uses Blast furnace? + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().MERCURY, 1), + new MaterialStack(ELEMENT.getInstance().BARIUM, 2), + new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), + new MaterialStack(ELEMENT.getInstance().COPPER, 3), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 8) + }); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 00388c4a5c..02045368c8 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -95,8 +95,10 @@ public class MaterialGenerator { } } else { Item temp; + if (generateEverything == true){ Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + } temp = new BaseItemIngot(matInfo); temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 1ce9a29877..3b2bafe9fb 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -572,6 +572,44 @@ public class Utils { return output; } + + public static int calculateVoltageTier(int Voltage){ + int V; + if (Voltage == 8){ + V = 0; + } + else if (Voltage == 32){ + V = 1; + } + else if (Voltage == 128){ + V = 2; + } + else if (Voltage == 512){ + V = 3; + } + else if (Voltage == 2048){ + V = 4; + } + else if (Voltage == 8196){ + V = 5; + } + else if (Voltage == 32768){ + V = 6; + } + else if (Voltage == 131072){ + V = 7; + } + else if (Voltage == 524288){ + V = 8; + } + else if (Voltage == Integer.MAX_VALUE){ + V = 9; + } + else { + V = -1; + } + return V; + } public static String[] parseVersion(final String version){ return parseVersion(version, "//."); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java index 05f4d153db..e57be69c1a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java @@ -29,10 +29,25 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); this.vRGB = aRGB; } + + public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { + super(aID, aName, aNameRegional, aThickNess, null, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); + this.vRGB = aRGB; + } + + public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { + super(aName, aThickNess, null, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); + this.vRGB = aRGB; + } @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntity_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock, this.vRGB); + if (this.mMaterial == null){ + return new GregtechMetaPipeEntity_Cable(this.mName, this.mThickNess, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock, this.vRGB); + } + else { + return new GregtechMetaPipeEntity_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock, this.vRGB); + } } @Override @@ -48,12 +63,23 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (this.vRGB == null){ + if (this.vRGB == null || this.vRGB.length < 3 || this.vRGB.length > 4){ this.vRGB = new short[]{200, 0, 200, 0}; } + if (this.vRGB.length != 4){ + short[] tempRGB = this.vRGB; + this.vRGB = new short[]{tempRGB[0], tempRGB[1], tempRGB[2], 0}; + } + + Materials wireMaterial = this.mMaterial; + + if (wireMaterial == null){ + wireMaterial = Materials.Iron; + } + if (!(this.mInsulated)) - return new ITexture[] { new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], Dyes.getModulation(aColorIndex, this.vRGB)) }; if (aConnected) { float tThickNess = getThickNess(); @@ -62,30 +88,30 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.374F) return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.499F) return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.624F) return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.749F) return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - return new ITexture[] { new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[69], this.vRGB), + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index d297725ac9..6a93a46dbf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -7,11 +7,14 @@ import java.util.ArrayList; import gregtech.api.enums.*; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.*; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; @@ -29,6 +32,7 @@ public class GregtechConduits { */ + private static int BaseWireID = 30600; private static int BasePipeID = 30700; @@ -48,14 +52,19 @@ public class GregtechConduits { private static void run1(){ if (LoadedMods.Big_Reactors){ - wireFactory("Blutonium", 8196, 30600, 8, 32, 2, new short[]{28, 28, 218, 0}); - wireFactory("Cyanite", 512, 30615, 2, 16, 4, new short[]{27, 130, 178, 0}); - wireFactory("Yellorium", 2048, 30630, 4, 16, 2, new short[]{150, 195, 54, 0}); + wireFactory("Blutonium", 8196, BaseWireID, 8, 32, 2, new short[]{28, 28, 218, 0}); + wireFactory("Cyanite", 512, BaseWireID+15, 2, 16, 4, new short[]{27, 130, 178, 0}); + wireFactory("Yellorium", 2048, BaseWireID+30, 4, 16, 2, new short[]{150, 195, 54, 0}); } if (LoadedMods.EnderIO){ - wireFactory("RedstoneAlloy", 32, 30645, 0, 2, 1, new short[]{178,34,34, 0}); + wireFactory("RedstoneAlloy", 32, BaseWireID+45, 0, 2, 1, new short[]{178,34,34, 0}); } + customWireFactory(ALLOY.LEAGRISIUM, 512, BaseWireID+45+11, 1, 2, 2); + customWireFactory(ELEMENT.getInstance().ZIRCONIUM, 128, BaseWireID+67, 1, 2, 2); + customWireFactory(ALLOY.HG1223, 32768, BaseWireID+78, 2, 8, 4); + + //superConductorFactory(GT_Materials.Superconductor, 524288, 30660, 0, 0, 8); if (LoadedMods.Thaumcraft){ //superConductorFactory(GT_Materials.Void, 512, 30661, 0, 0, 8); @@ -89,45 +98,13 @@ public class GregtechConduits { private static void wireFactory(final String Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps, final short[] rgb){ final Materials T = Materials.valueOf(Material); - int V = 0; - if (Voltage == 8){ - V = 0; - } - else if (Voltage == 32){ - V = 1; - } - else if (Voltage == 128){ - V = 2; - } - else if (Voltage == 512){ - V = 3; - } - else if (Voltage == 2048){ - V = 4; - } - else if (Voltage == 8196){ - V = 5; - } - else if (Voltage == 32768){ - V = 6; - } - else if (Voltage == 131072){ - V = 7; - } - else if (Voltage == 524288){ - V = 8; - } - else if (Voltage == Integer.MAX_VALUE){ - V = 9; - } - else { + int V = Utils.calculateVoltageTier(Voltage); + if (V == -1){ Utils.LOG_ERROR("Failed to set voltage on "+Material+". Invalid voltage of "+Voltage+"V set."); Utils.LOG_ERROR(Material+" has defaulted to 8v."); - V = 0; + V=0; } - //makeWires(T, ID, 2L, 4L, 2L, GT_Values.V[V], true, false); makeWires(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false, rgb); - //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); } @SuppressWarnings("deprecation") @@ -137,7 +114,7 @@ public class GregtechConduits { GT_OreDictUnificator.registerOre(OrePrefixes.wireGt01, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 0, "wire." + aMaterial.name().toLowerCase() + ".01", "1x " + aMaterial.mDefaultLocalName + " Wire", 0.125F, aMaterial, aLoss, 1L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.wireGt02, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 1, "wire." + aMaterial.name().toLowerCase() + ".02", "2x " + aMaterial.mDefaultLocalName + " Wire", 0.25F, aMaterial, aLoss, 2L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.wireGt04, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 2, "wire." + aMaterial.name().toLowerCase() + ".04", "4x " + aMaterial.mDefaultLocalName + " Wire", 0.375F, aMaterial, aLoss, 4L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre(OrePrefixes.wireGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 3, "wire." + aMaterial.name().toLowerCase() + ".08", "8x " + aMaterial.mDefaultLocalName + " Wire", 0.5F, aMaterial, aLoss, 8L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.wireGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 3, "wire." + aMaterial.name().toLowerCase() + ".08", "8x " + aMaterial.mDefaultLocalName + " Wire", 0.50F, aMaterial, aLoss, 8L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.wireGt12, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 4, "wire." + aMaterial.name().toLowerCase() + ".12", "12x " + aMaterial.mDefaultLocalName + " Wire", 0.75F, aMaterial, aLoss, 12L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.wireGt16, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 5, "wire." + aMaterial.name().toLowerCase() + ".16", "16x " + aMaterial.mDefaultLocalName + " Wire", 1.0F, aMaterial, aLoss, 16L * aAmperage, aVoltage, false, !aAutoInsulated, aRGB).getStackForm(1L)); if (aInsulatable) @@ -145,11 +122,43 @@ public class GregtechConduits { GT_OreDictUnificator.registerOre(OrePrefixes.cableGt01, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 6, "cable." + aMaterial.name().toLowerCase() + ".01", "1x " + aMaterial.mDefaultLocalName + " Cable", 0.25F, aMaterial, aLossInsulated, 1L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.cableGt02, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 7, "cable." + aMaterial.name().toLowerCase() + ".02", "2x " + aMaterial.mDefaultLocalName + " Cable", 0.375F, aMaterial, aLossInsulated, 2L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.cableGt04, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 8, "cable." + aMaterial.name().toLowerCase() + ".04", "4x " + aMaterial.mDefaultLocalName + " Cable", 0.5F, aMaterial, aLossInsulated, 4L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre(OrePrefixes.cableGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 9, "cable." + aMaterial.name().toLowerCase() + ".08", "8x " + aMaterial.mDefaultLocalName + " Cable", 0.75F, aMaterial, aLossInsulated, 8L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); - GT_OreDictUnificator.registerOre(OrePrefixes.cableGt12, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 10, "cable." + aMaterial.name().toLowerCase() + ".12", "12x " + aMaterial.mDefaultLocalName + " Cable", 1.0F, aMaterial, aLossInsulated, 12L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.cableGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 9, "cable." + aMaterial.name().toLowerCase() + ".08", "8x " + aMaterial.mDefaultLocalName + " Cable", 0.625F, aMaterial, aLossInsulated, 8L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.cableGt12, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 10, "cable." + aMaterial.name().toLowerCase() + ".12", "12x " + aMaterial.mDefaultLocalName + " Cable", 0.875F, aMaterial, aLossInsulated, 12L * aAmperage, aVoltage, true, false, aRGB).getStackForm(1L)); } } + private static void customWireFactory(final Material Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps){ + int V = Utils.calculateVoltageTier(Voltage); + if (V == -1){ + Utils.LOG_ERROR("Failed to set voltage on "+Material+". Invalid voltage of "+Voltage+"V set."); + Utils.LOG_ERROR(Material+" has defaulted to 8v."); + V=0; + } + makeCustomWires(Material, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); + } + + private static void makeCustomWires(final Material aMaterial, final int aStartID, final long aLossInsulated, final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, final boolean aAutoInsulated) + { + Utils.LOG_WARNING("Gregtech5u Content | Registered "+aMaterial.getLocalizedName() +" as a new material for Wire & Cable."); + registerOre(OrePrefixes.wireGt01, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 0, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".01", "1x " + aMaterial.getLocalizedName() + " Wire", 0.125F, aLoss, 1L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.wireGt02, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 1, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".02", "2x " + aMaterial.getLocalizedName() + " Wire", 0.25F, aLoss, 2L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.wireGt04, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 2, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".04", "4x " + aMaterial.getLocalizedName() + " Wire", 0.375F, aLoss, 4L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.wireGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 3, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".08", "8x " + aMaterial.getLocalizedName() + " Wire", 0.50F, aLoss, 8L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.wireGt12, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 4, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".12", "12x " + aMaterial.getLocalizedName() + " Wire", 0.75F, aLoss, 12L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.wireGt16, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 5, "wire." + aMaterial.getLocalizedName().toLowerCase() + ".16", "16x " + aMaterial.getLocalizedName() + " Wire", 1.0F, aLoss, 16L * aAmperage, aVoltage, false, !aAutoInsulated, aMaterial.getRGBA()).getStackForm(1L)); + if (aInsulatable) + { + registerOre(OrePrefixes.cableGt01, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 6, "cable." + aMaterial.getLocalizedName().toLowerCase() + ".01", "1x " + aMaterial.getLocalizedName() + " Cable", 0.25F, aLossInsulated, 1L * aAmperage, aVoltage, true, false, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.cableGt02, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 7, "cable." + aMaterial.getLocalizedName().toLowerCase() + ".02", "2x " + aMaterial.getLocalizedName() + " Cable", 0.375F, aLossInsulated, 2L * aAmperage, aVoltage, true, false, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.cableGt04, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 8, "cable." + aMaterial.getLocalizedName().toLowerCase() + ".04", "4x " + aMaterial.getLocalizedName() + " Cable", 0.5F, aLossInsulated, 4L * aAmperage, aVoltage, true, false, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.cableGt08, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 9, "cable." + aMaterial.getLocalizedName().toLowerCase() + ".08", "8x " + aMaterial.getLocalizedName() + " Cable", 0.625F, aLossInsulated, 8L * aAmperage, aVoltage, true, false, aMaterial.getRGBA()).getStackForm(1L)); + registerOre(OrePrefixes.cableGt12, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 10, "cable." + aMaterial.getLocalizedName().toLowerCase() + ".12", "12x " + aMaterial.getLocalizedName() + " Cable", 0.875F, aLossInsulated, 12L * aAmperage, aVoltage, true, false, aMaterial.getRGBA()).getStackForm(1L)); + } + + generateWireRecipes(aMaterial); + + } + private static void superConductorFactory(final GT_Materials Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps){ final GT_Materials T = Material; int V = 0; @@ -193,17 +202,6 @@ public class GregtechConduits { //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); } - /*private static void makeSuperConductors(final GT_Materials aMaterial, final int aStartID, final long aLossInsulated, final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, final boolean aAutoInsulated) - { - Utils.LOG_WARNING("Gregtech5u Content | Registered "+aMaterial.name() +" as a new Super Conductor."); - registerOre(GregtechOrePrefixes.type2, aMaterial, new GregtechMetaPipeEntity_SuperConductor(aStartID + 5, "wire." + aMaterial.name().toLowerCase() + ".16", "16x " + aMaterial.mDefaultLocalName + " Wire", 1.0F, aMaterial, aLoss, 16L * aAmperage, aVoltage, false, !aAutoInsulated).getStackForm(1L)); - - }*/ - - private static boolean registerOre(final GregtechOrePrefixes aPrefix, final Object aMaterial, final ItemStack aStack) { - return GT_OreDictUnificator.registerOre(aPrefix.get(aMaterial), aStack); - } - private static void generateGTFluidPipes(final Materials material, final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof){ final int transferRatePerTick = transferRatePerSec/20; @@ -232,7 +230,7 @@ public class GregtechConduits { mass = ELEMENT.getInstance().IRON.getMass(); voltage = 8; } - + int tVoltageMultiplier = (material.mBlastFurnaceTemp >= 2800) ? 64 : 16; GT_OreDictUnificator.registerOre(OrePrefixes.pipeTiny.get(material), new GregtechMetaPipeEntityFluid(startID, "GT_Pipe_"+material.mDefaultLocalName+"_Tiny", "Tiny "+material.mDefaultLocalName+" Fluid Pipe", 0.25F, material, transferRatePerTick*2, heatResistance, isGasProof).getStackForm(1L)); @@ -263,7 +261,7 @@ public class GregtechConduits { pipeIngot = pipePlate; } } - + //Check all pipes are not null Utils.LOG_WARNING("Generated pipeTiny from "+ materialName +"? "+ ((ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Tiny"+output, 1) != null) ? true : false)); Utils.LOG_WARNING("Generated pipeSmall from "+ materialName +"? "+ ((ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 1) != null) ? true : false)); @@ -352,4 +350,256 @@ public class GregtechConduits { } return ItemUtils.getSimpleStack(ModItems.AAA_Broken, amount); } + + public static boolean registerOre(OrePrefixes aPrefix, Material aMaterial, ItemStack aStack) { + return registerOre(aPrefix.get(Utils.sanitizeString(aMaterial.getLocalizedName())), aStack); + } + + public static boolean registerOre(Object aName, ItemStack aStack) { + if ((aName == null) || (GT_Utility.isStackInvalid(aStack))) + return false; + String tName = aName.toString(); + if (GT_Utility.isStringInvalid(tName)) + return false; + ArrayList tList = GT_OreDictUnificator.getOres(tName); + for (int i = 0; i < tList.size(); ++i) + if (GT_Utility.areStacksEqual((ItemStack) tList.get(i), aStack, true)) + return false; + OreDictionary.registerOre(tName, GT_Utility.copyAmount(1L, new Object[] { aStack })); + return true; + } + + public static boolean generateWireRecipes(Material aMaterial){ + + //Adds manual crafting recipe + RecipeUtils.recipeBuilder( + Utils.sanitizeString("plate"+aMaterial.getLocalizedName()), CI.craftingToolWireCutter, null, + null, null, null, + null, null, null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1)); + + //Wire mill + GT_Values.RA.addWiremillRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("ingot"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + 5*20, + 4); + + //Extruder + GT_Values.RA.addExtruderRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("ingot"+aMaterial.getLocalizedName()), 1), + ItemList.Shape_Extruder_Wire.get(0), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + 196, + 96); + + GT_Values.RA.addUnboxingRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + null, + 100, + 8); + + //Shapeless Down-Crafting + //2x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1)}, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2) + ); + //4x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1)}, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 4) + ); + //8x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1)}, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 8) + ); + //12x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt12"+aMaterial.getLocalizedName()), 1)}, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 12) + ); + //16x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt16"+aMaterial.getLocalizedName()), 1)}, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 16) + ); + + + //1x -> 2x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1) + ); + + //2x -> 4x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1) + ); + + //4x -> 8x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1) + ); + + //8x -> 12x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt12"+aMaterial.getLocalizedName()), 1) + ); + + //12x -> 16x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt12"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt16"+aMaterial.getLocalizedName()), 1) + ); + + //8x -> 16x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt16"+aMaterial.getLocalizedName()), 1) + ); + + //1x -> 4x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1) + ); + + //1x -> 8x + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1) + }, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1) + ); + + + //Wire to Cable + //1x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 1), + CI.getNumberedCircuit(24), + FluidUtils.getFluidStack("molten.rubber", 144), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt01"+aMaterial.getLocalizedName()), 1), + 100, + 8); + //2x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1), + CI.getNumberedCircuit(24), + FluidUtils.getFluidStack("molten.rubber", 144), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt02"+aMaterial.getLocalizedName()), 1), + 100, + 8); + //4x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1), + CI.getNumberedCircuit(24), + FluidUtils.getFluidStack("molten.rubber", 288), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt04"+aMaterial.getLocalizedName()), 1), + 100, + 8); + //8x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1), + CI.getNumberedCircuit(24), + FluidUtils.getFluidStack("molten.rubber", 432), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt08"+aMaterial.getLocalizedName()), 1), + 100, + 8); + //12x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt12"+aMaterial.getLocalizedName()), 1), + CI.getNumberedCircuit(24), + FluidUtils.getFluidStack("molten.rubber", 576), + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("cableGt12"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + //Assemble small wires into bigger wires + + //2x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + CI.getNumberedCircuit(2), + null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt02"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + //4x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + CI.getNumberedCircuit(4), + null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt04"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + //8x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + CI.getNumberedCircuit(8), + null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt08"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + //12x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + CI.getNumberedCircuit(12), + null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt12"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + //16x + GT_Values.RA.addAssemblerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt01"+aMaterial.getLocalizedName()), 2), + CI.getNumberedCircuit(16), + null, + ItemUtils.getItemStackOfAmountFromOreDict(Utils.sanitizeString("wireGt16"+aMaterial.getLocalizedName()), 1), + 100, + 8); + + + + return true; + } }
\ No newline at end of file |