diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-11 14:28:49 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-11 14:28:49 +1000 |
commit | 9c1f8b82bfbe52c43002a45db897588721dcbb8d (patch) | |
tree | db542c0fcd02b85b998aeef7572740a7d81cb423 /src | |
parent | 65e7be449116dc3364e9df4d5ec3cba83c5d1884 (diff) | |
download | GT5-Unofficial-9c1f8b82bfbe52c43002a45db897588721dcbb8d.tar.gz GT5-Unofficial-9c1f8b82bfbe52c43002a45db897588721dcbb8d.tar.bz2 GT5-Unofficial-9c1f8b82bfbe52c43002a45db897588721dcbb8d.zip |
[1.4.6.5.2-release]
+ Added the Multitank, 3x3x20, at biggest, minimum 3x3x4 (Height wise)
$ Fixed TF stuff loading when it shouldn't, again.
Diffstat (limited to 'src')
8 files changed, 365 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 22a69e2468..aef0686424 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -87,6 +87,7 @@ public class COMPAT_HANDLER { GregtechPowerSubStation.run(); GregtechDehydrator.run(); GregtechTieredFluidTanks.run(); + //GregtechIndustrialMultiTank.run(); } } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index f88bcfa45c..00a7bdf522 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -21,7 +21,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.4.6.5-release"; + public static final String VERSION = "1.4.6.5.2-release"; public static final String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static boolean isModUpToDate = Utils.isModUpToDate(); public static boolean DEBUG = false; diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java new file mode 100644 index 0000000000..9e7e033bed --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.util.networking; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; + +public class NetworkUtils { + + public static String getContentFromURL(String args) { + + URL url; + + try { + // get URL content + url = new URL(args); + URLConnection conn = url.openConnection(); + + // open the stream and put it into BufferedReader + BufferedReader br = new BufferedReader( + new InputStreamReader(conn.getInputStream())); + + String inputLine; + String tempLine = null; + + + + + while ((inputLine = br.readLine()) != null) { + tempLine = inputLine; + } + + br.close(); + return tempLine; + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 8463318552..528ca324e1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -96,17 +96,22 @@ public enum GregtechItemList implements GregtechItemContainer { + //Cooked Raisin Toast for ImQ009 Food_Baked_Raisin_Bread, - + //For sintering TODO Industrial_SinterFurnace, + //Block that enables uplink to a superconductor network SuperConductorInputNode, + //The two tiers of reactor casings Casing_Reactor_I, Casing_Reactor_II, + //Power sub-station for mass storage. 3 hatches for input and output, whatever voltages you desire. PowerSubStation, + //Chemical Dehydrators for nuclear fuels GT_Dehydrator_EV, GT_Dehydrator_IV, GT_Dehydrator_LuV, GT_Dehydrator_ZPM, //Fluid Storage Tanks @@ -114,7 +119,10 @@ public enum GregtechItemList implements GregtechItemContainer { GT_FluidTank_IV, GT_FluidTank_LuV, GT_FluidTank_ZPM, GT_FluidTank_UV, GT_FluidTank_MAX, //Fluid Cells to regulate flows. - Fluid_Cell_1L, Fluid_Cell_16L, Fluid_Cell_36L, Fluid_Cell_144L; + Fluid_Cell_1L, Fluid_Cell_16L, Fluid_Cell_36L, Fluid_Cell_144L, + + //Multitank + Industrial_MultiTank; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMultiTank.java new file mode 100644 index 0000000000..265b8b2a90 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMultiTank.java @@ -0,0 +1,278 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; + +import java.util.ArrayList; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntityMultiTank + extends GregtechMeta_MultiBlockBase { + public GregtechMetaTileEntityMultiTank(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + private long fluidStored; + private short multiblockCasingCount; + private short storageMultiplier = getStorageMultiplier(); + private long maximumFluidStorage = getMaximumTankStorage(); + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mEUt", mEUt); + aNBT.setInteger("mProgresstime", mProgresstime); + aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); + aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease); + aNBT.setInteger("mEfficiency", mEfficiency); + aNBT.setInteger("mPollution", mPollution); + aNBT.setInteger("mRuntime", mRuntime); + aNBT.setLong("mFluidStored", fluidStored); + aNBT.setShort("mStorageMultiplier", storageMultiplier); + aNBT.setLong("mMaxFluidStored", maximumFluidStorage); + aNBT.setShort("mCasingCount", multiblockCasingCount); + + if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputItems[i].writeToNBT(tNBT); + aNBT.setTag("mOutputItem" + i, tNBT); + } + if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) + if (mOutputFluids[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } + + aNBT.setBoolean("mWrench", mWrench); + aNBT.setBoolean("mScrewdriver", mScrewdriver); + aNBT.setBoolean("mSoftHammer", mSoftHammer); + aNBT.setBoolean("mHardHammer", mHardHammer); + aNBT.setBoolean("mSolderingTool", mSolderingTool); + aNBT.setBoolean("mCrowbar", mCrowbar); + } + + private short getStorageMultiplier(){ + int tempstorageMultiplier = (1*multiblockCasingCount); + if (tempstorageMultiplier <= 0){ + return 1; + } + return (short) tempstorageMultiplier; + } + + private long getMaximumTankStorage(){ + long tempTankStorageMax = (64000*getStorageMultiplier()); + if (tempTankStorageMax <= 0){ + return 64000; + } + return tempTankStorageMax; + } + + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mEUt = aNBT.getInteger("mEUt"); + mProgresstime = aNBT.getInteger("mProgresstime"); + mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + if (mMaxProgresstime > 0) mRunningOnLoad = true; + mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); + mEfficiency = aNBT.getInteger("mEfficiency"); + mPollution = aNBT.getInteger("mPollution"); + mRuntime = aNBT.getInteger("mRuntime"); + fluidStored = aNBT.getLong("mFluidStored"); + storageMultiplier = aNBT.getShort("mStorageMultiplier"); + maximumFluidStorage = aNBT.getLong("mMaxFluidStored"); + multiblockCasingCount = aNBT.getShort("mCasingCount"); + mOutputItems = new ItemStack[getAmountOfOutputs()]; + for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + mOutputFluids = new FluidStack[getAmountOfOutputs()]; + for (int i = 0; i < mOutputFluids.length; i++) + mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + mWrench = aNBT.getBoolean("mWrench"); + mScrewdriver = aNBT.getBoolean("mScrewdriver"); + mSoftHammer = aNBT.getBoolean("mSoftHammer"); + mHardHammer = aNBT.getBoolean("mHardHammer"); + mSolderingTool = aNBT.getBoolean("mSolderingTool"); + mCrowbar = aNBT.getBoolean("mCrowbar"); + } + + public GregtechMetaTileEntityMultiTank(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityMultiTank(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Vacuum Freezer", + "Size: 3x4x3 (Hollow) LxHxW", + "Controller (front centered)", + "1x Input hatch (anywhere)", + "1x Output hatch (anywhere)", + "1x Energy Hatch (anywhere)", + "1x Maintenance Hatch (anywhere)", + "Frost Proof Casings for the rest (16 at least!)", + "Stored Fluid: "+fluidStored}; + } + + @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[17], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sVacuumRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<ItemStack> tInputList = getStoredInputs(); + for (ItemStack tInput : tInputList) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + 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)}; + updateSlots(); + return true; + } + } + } + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + Utils.LOG_INFO("Must be hollow."); + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 19; h++) { + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { + if (h < 3){ + Utils.LOG_INFO("Casing Expected."); + return false; + } + else if (h >= 3){ + Utils.LOG_INFO("Your Multitank can be 20 blocks tall."); + } + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + if (h < 3){ + Utils.LOG_INFO("Wrong Meta."); + return false; + } + else if (h >= 3){ + Utils.LOG_INFO("Your Multitank can be 20 blocks tall."); + } + } + if (h < 3){ + tAmount++; + } + else if (h >= 3){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){ + Utils.LOG_INFO("Found air"); + } + else { + Utils.LOG_INFO("Layer "+(h+2)+" is complete. Adding "+(64000*9)+"L storage to the tank."); + tAmount++; + } + } + } + } + } + } + } + multiblockCasingCount = (short) tAmount; + Utils.LOG_INFO("Casings Count: "+tAmount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+maximumFluidStorage+"L"); + return tAmount >= 16; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java new file mode 100644 index 0000000000..dcd3e0450a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityMultiTank; + +public class GregtechIndustrialMultiTank +{ + + + + public static void run() + { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Multitank Multiblock."); + run1(); + } + + } + + private static void run1() + { + GregtechItemList.Industrial_MultiTank.set(new GregtechMetaTileEntityMultiTank(827, "multitank.controller.tier.single", "Gregtech Multitank").getStackForm(1L)); + + } +} diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java index e28ad4a145..6804737ebf 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java @@ -9,7 +9,7 @@ import gtPlusPlus.xmod.thermalfoundation.recipe.TF_Gregtech_Recipes; public class HANDLER_TF{ public static void preInit(){ - if (LoadedMods.CoFHCore){ + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ TF_Fluids.preInit(); TF_Items.preInit(); TF_Blocks.preInit(); @@ -17,7 +17,7 @@ public class HANDLER_TF{ } public static void init(){ - if (LoadedMods.CoFHCore){ + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ TF_Fluids.init(); TF_Blocks.init(); TF_Items.init(); @@ -25,7 +25,7 @@ public class HANDLER_TF{ } public static void postInit(){ - if (LoadedMods.CoFHCore){ + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ TF_Fluids.postInit(); TF_Items.postInit(); TF_Blocks.postInit(); diff --git a/src/resources/mcmod.info b/src/resources/mcmod.info index f645e5cf48..fcb18a1def 100644 --- a/src/resources/mcmod.info +++ b/src/resources/mcmod.info @@ -5,7 +5,7 @@ "description": "Adds a few various Multiblocks, Machines, etc to Gregtech and a plethora of other mods (Nearly 30!)", "credits": "", "logoFile": "", - "version": "1.4.6.5-release", + "version": "1.4.6.5.2-release", "mcversion": "1.7.10", "url": "https://github.com/draknyte1/MiscUtilities/wiki", "updateUrl": "https://github.com/draknyte1/MiscUtilities/tree/master/build/libs", |