aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Java/miscutil/core/handler/COMPAT_HANDLER.java2
-rw-r--r--src/Java/miscutil/core/handler/registration/gregtech/GregtechConduits.java135
-rw-r--r--src/Java/miscutil/xmod/gregtech/HANDLER_GT.java5
-rw-r--r--src/Java/miscutil/xmod/gregtech/api/enums/GregtechOrePrefixes.java6
-rw-r--r--src/Java/miscutil/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java385
-rw-r--r--src/resources/assets/miscutils/textures/items/itemBackpack.pngbin4326 -> 4929 bytes
6 files changed, 527 insertions, 6 deletions
diff --git a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java
index 4875ad5a08..fc43b9a09d 100644
--- a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java
@@ -18,7 +18,6 @@ import miscutil.core.common.compat.COMPAT_SimplyJetpacks;
import miscutil.core.common.compat.COMPAT_Thaumcraft;
import miscutil.core.handler.registration.LateRegistrationHandler;
import miscutil.core.handler.registration.RegistrationHandler;
-import miscutil.core.handler.registration.gregtech.GregtechConduits;
import miscutil.core.handler.registration.gregtech.GregtechEnergyBuffer;
import miscutil.core.handler.registration.gregtech.GregtechIndustrialCentrifuge;
import miscutil.core.handler.registration.gregtech.GregtechIndustrialCokeOven;
@@ -79,7 +78,6 @@ public class COMPAT_HANDLER {
if (Gregtech) {
new RECIPES_LaserEngraver();
GregtechEnergyBuffer.run();
- GregtechConduits.run();
GregtechSteamCondenser.run();
GregtechSafeBlock.run();
GregtechSuperConductionPoint.run();
diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechConduits.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechConduits.java
index e10780a11d..0fd5bbbe5e 100644
--- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechConduits.java
+++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechConduits.java
@@ -2,16 +2,28 @@ package miscutil.core.handler.registration.gregtech;
import static miscutil.core.lib.LoadedMods.Gregtech;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid;
import gregtech.api.util.GT_OreDictUnificator;
+
+import java.util.ArrayList;
+
+import miscutil.core.item.ModItems;
import miscutil.core.lib.LoadedMods;
import miscutil.core.util.Utils;
+import miscutil.core.util.item.UtilsItems;
+import miscutil.core.util.math.MathUtils;
+import miscutil.core.util.recipe.UtilsRecipe;
import miscutil.xmod.gregtech.api.enums.GregtechOrePrefixes;
import miscutil.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+import miscutil.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntityFluid;
import miscutil.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_Cable;
import miscutil.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_SuperConductor;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
public class GregtechConduits {
/**
@@ -25,7 +37,7 @@ public class GregtechConduits {
public static void run()
{
if (Gregtech){
- Utils.LOG_INFO("Gregtech5u Content | Registering Custom Cables/Wire.");
+ Utils.LOG_INFO("Gregtech5u Content | Registering Custom Cables/Wires/Pipes.");
run1();
}
@@ -44,6 +56,12 @@ public class GregtechConduits {
superConductorFactory("Superconductor", 524288, 30660, 0, 0, 8);
superConductorFactory("VoidMetal", 512, 30661, 0, 0, 8);
+ generateNonGTFluidPipes(GT_Materials.Staballoy, 30700, 150, 7500, true);
+ generateNonGTFluidPipes(GT_Materials.Tantalloy60, 30705, 120, 4250, true);
+ generateNonGTFluidPipes(GT_Materials.Tantalloy61, 30710, 135, 5800, true);
+ generateNonGTFluidPipes(GT_Materials.VoidMetal, 30715, 50, 25000, true);
+ generateGTFluidPipes(Materials.Europium, 30720, 175, 7500, true);
+
}
private static void wireFactory(String Material, int Voltage, int ID, long insulatedLoss, long uninsulatedLoss, long Amps){
@@ -161,4 +179,119 @@ public class GregtechConduits {
private static boolean registerOre(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aStack) {
return GT_OreDictUnificator.registerOre(aPrefix.get(aMaterial), aStack);
}
+
+
+ private static void generateGTFluidPipes(Materials material, int startID, int transferRatePerTick, int heatResistance, boolean isGasProof){
+ long magicNumber = material.mDensity;
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeTiny.get(material), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_"+material.name()+"_Tiny", "Tiny "+material.name()+" Fluid Pipe", 0.25F, material, transferRatePerTick*2, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeSmall.get(material), new GT_MetaPipeEntity_Fluid(startID+1, "GT_Pipe_"+material.name()+"_Small", "Small "+material.name()+" Fluid Pipe", 0.375F, material, transferRatePerTick*4, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeMedium.get(material), new GT_MetaPipeEntity_Fluid(startID+2, "GT_Pipe_"+material.name()+"", ""+material.name()+" Fluid Pipe", 0.5F, material, transferRatePerTick*6, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(material), new GT_MetaPipeEntity_Fluid(startID+3, "GT_Pipe_"+material.name()+"_Large", "Large "+material.name()+" Fluid Pipe", 0.75F, material, transferRatePerTick*8, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(material), new GT_MetaPipeEntity_Fluid(startID+4, "GT_Pipe_"+material.name()+"_Huge", "Huge "+material.name()+" Fluid Pipe", 1.0F, material, transferRatePerTick*10, heatResistance, isGasProof).getStackForm(1L));
+ generatePipeRecipes(material.name(), magicNumber, startID);
+ }
+
+ private static void generateNonGTFluidPipes(GT_Materials material, int startID, int transferRatePerTick, int heatResistance, boolean isGasProof){
+ long magicNumber = material.mDensity;
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeTiny.get(material), new GregtechMetaPipeEntityFluid(startID, "GT_Pipe_"+material.name()+"_Tiny", "Tiny "+material.name()+" Fluid Pipe", 0.25F, material, transferRatePerTick*2, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeSmall.get(material), new GregtechMetaPipeEntityFluid(startID+1, "GT_Pipe_"+material.name()+"_Small", "Small "+material.name()+" Fluid Pipe", 0.375F, material, transferRatePerTick*4, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeMedium.get(material), new GregtechMetaPipeEntityFluid(startID+2, "GT_Pipe_"+material.name()+"", ""+material.name()+" Fluid Pipe", 0.5F, material, transferRatePerTick*6, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(material), new GregtechMetaPipeEntityFluid(startID+3, "GT_Pipe_"+material.name()+"_Large", "Large "+material.name()+" Fluid Pipe", 0.75F, material, transferRatePerTick*8, heatResistance, isGasProof).getStackForm(1L));
+ GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(material), new GregtechMetaPipeEntityFluid(startID+4, "GT_Pipe_"+material.name()+"_Huge", "Huge "+material.name()+" Fluid Pipe", 1.0F, material, transferRatePerTick*10, heatResistance, isGasProof).getStackForm(1L));
+ generatePipeRecipes(material.name(), magicNumber, startID);
+
+ }
+
+ private static void generatePipeRecipes(String materialName, long multiplier, int ID){
+ Utils.LOG_INFO("Logging Generation of Pipe Recipes.");
+ int multi = (int) MathUtils.decimalRoundingToWholes(multiplier)/100000;
+ Utils.LOG_INFO("Magic Multiplier is "+multi);
+
+ if (multi <= 0){
+ multi = MathUtils.randInt(2, 8);
+ }
+
+ String output = materialName.substring(0, 1).toUpperCase() + materialName.substring(1);
+ Utils.LOG_INFO("materialName: "+materialName+" outputName: "+output);
+ Item pipeIngot = UtilsItems.getItemStackOfAmountFromOreDict("ingot"+output, 1).getItem();
+ Utils.LOG_INFO("Found "+pipeIngot.getUnlocalizedName()+" to use in extruder recipes.");
+ ItemStack pipePlate = UtilsItems.getItemStackOfAmountFromOreDict("plate"+output, 1);
+ Utils.LOG_INFO("Plates for recipes: "+" Expected:"+"plate"+output+" Got:"+pipePlate.getUnlocalizedName());
+
+ //Get the five Pipes
+ //Item pipeTiny = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.blockmachines", "Pipe Tiny", ID, 1).getItem();
+ //Item pipeSmall = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.blockmachines", "Pipe Small", ID+1, 1).getItem();
+ //Item pipeNormal = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.blockmachines", "Pipe Normal", ID+2, 1).getItem();
+ //Item pipeLarge = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.blockmachines", "Pipe Large", ID+3, 1).getItem();
+ //Item pipeHuge = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.blockmachines", "Pipe Huge", ID+4, 1).getItem();
+
+ /*Item pipeTiny = UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Tiny"+output, 1).getItem();
+ Item pipeSmall = UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 1).getItem();
+ Item pipeNormal = UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Medium"+output, 1).getItem();
+ Item pipeLarge = UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Large"+output, 1).getItem();
+ Item pipeHuge = UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Huge"+output, 1).getItem();*/
+
+ //Check all pipes are not null
+ Utils.LOG_INFO("Does pipeTiny == null? " + ((UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Tiny"+output, 1) == null) ? true : false));
+ Utils.LOG_INFO("Does pipeSmall == null? " + ((UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 1) == null) ? true : false));
+ Utils.LOG_INFO("Does pipeNormal == null? " + ((UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Medium"+output, 1) == null) ? true : false));
+ Utils.LOG_INFO("Does pipeLarge == null? " + ((UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Large"+output, 1) == null) ? true : false));
+ Utils.LOG_INFO("Does pipeHuge == null? " + ((UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Huge"+output, 1) == null) ? true : false));
+
+ //Add the Three Shaped Recipes First
+ UtilsRecipe.recipeBuilder(
+ pipePlate, "craftingToolWrench", pipePlate,
+ pipePlate, null, pipePlate,
+ pipePlate, "craftingToolHardHammer", pipePlate,
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 6));
+
+ UtilsRecipe.recipeBuilder(
+ pipePlate, pipePlate, pipePlate,
+ "craftingToolWrench", null, "craftingToolHardHammer",
+ pipePlate, pipePlate, pipePlate,
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Medium"+output, 2));
+
+ UtilsRecipe.recipeBuilder(
+ pipePlate, "craftingToolHardHammer", pipePlate,
+ pipePlate, null, pipePlate,
+ pipePlate, "craftingToolWrench", pipePlate,
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Large"+output, 1));
+
+ GT_Values.RA.addExtruderRecipe(
+ UtilsItems.getSimpleStack(pipeIngot, 1),
+ ItemList.Shape_Extruder_Pipe_Tiny.get(0),
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Tiny"+output, 2),
+ 32*multi, 8*multi);
+ GT_Values.RA.addExtruderRecipe(
+ UtilsItems.getSimpleStack(pipeIngot, 1),
+ ItemList.Shape_Extruder_Pipe_Small.get(0),
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 1),
+ 32*multi, 16*multi);
+ GT_Values.RA.addExtruderRecipe(
+ UtilsItems.getSimpleStack(pipeIngot, 3),
+ ItemList.Shape_Extruder_Pipe_Medium.get(0),
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Medium"+output, 1),
+ 32*multi, 32*multi);
+ GT_Values.RA.addExtruderRecipe(
+ UtilsItems.getSimpleStack(pipeIngot, 6),
+ ItemList.Shape_Extruder_Pipe_Large.get(0),
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Large"+output, 1),
+ 32*multi, 64*multi);
+ GT_Values.RA.addExtruderRecipe(
+ UtilsItems.getSimpleStack(pipeIngot, 12),
+ ItemList.Shape_Extruder_Pipe_Huge.get(0),
+ UtilsItems.getItemStackOfAmountFromOreDict("pipe"+"Huge"+output, 1),
+ 32*multi, 128*multi);
+
+ }
+
+ private static ItemStack getOredictStack(String oredictName, int amount){
+ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()){
+ ItemStack returnValue = oreDictList.get(0).copy();
+ returnValue.stackSize = amount;
+ return returnValue;
+ }
+ return UtilsItems.getSimpleStack(ModItems.AAA_Broken, amount);
+ }
}
diff --git a/src/Java/miscutil/xmod/gregtech/HANDLER_GT.java b/src/Java/miscutil/xmod/gregtech/HANDLER_GT.java
index 5f5de99ad7..c2bb4a5a8f 100644
--- a/src/Java/miscutil/xmod/gregtech/HANDLER_GT.java
+++ b/src/Java/miscutil/xmod/gregtech/HANDLER_GT.java
@@ -1,6 +1,7 @@
package miscutil.xmod.gregtech;
import gregtech.api.util.GT_Config;
+import miscutil.core.handler.registration.gregtech.GregtechConduits;
import miscutil.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import miscutil.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler;
import miscutil.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
@@ -23,6 +24,10 @@ public class HANDLER_GT {
}
public static void init(){
+
+ //Add Custom Pipes, Wires and Cables.
+ GregtechConduits.run();
+
/*if (Meta_GT_Proxy.mSortToTheEnd) {
new GT_ItemIterator().run();
Meta_GT_Proxy.registerUnificationEntries();
diff --git a/src/Java/miscutil/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/Java/miscutil/xmod/gregtech/api/enums/GregtechOrePrefixes.java
index 5e5a7e9b1a..20b4d3d500 100644
--- a/src/Java/miscutil/xmod/gregtech/api/enums/GregtechOrePrefixes.java
+++ b/src/Java/miscutil/xmod/gregtech/api/enums/GregtechOrePrefixes.java
@@ -313,7 +313,7 @@ public enum GregtechOrePrefixes {
Superconductor(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 190, 240, 190, 0, "Superconductor", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8))),
- Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 248, 255, 46, 0, "Staballoy", 0, 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Titanium, 1), new MaterialStack(Materials.Uranium, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))),
+ Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 66, 0, "Staballoy", 0, 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Titanium, 1), new MaterialStack(Materials.Uranium, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))),
Bedrockium(31, TextureSet.SET_FINE, 8.0F, 8196, 3, 1 | 2 | 16 | 32 | 64 | 128, 39, 39, 39, 0, "Bedrockium", 0, 0, -1, 0, false, false, 1, 5, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Materials.Carbon, 63), new MaterialStack(Materials.Carbon, 56)), Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS, 8), getTcAspectStack(TC_Aspects.TUTAMEN, 3))),
BloodSteel(32, TextureSet.SET_METALLIC, 11.0F, 768, 4, 1 | 2 | 16 | 32 | 64 | 128, 142, 28, 0, 0, "Blood Steel", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Steel, 3)), Arrays.asList(getTcAspectStack(TC_Aspects.VICTUS, 8), getTcAspectStack(TC_Aspects.IGNIS, 3))),
VoidMetal(33, TextureSet.SET_METALLIC, 6.0F, 1280, 3, 1 | 2 | 16 | 32 | 64 | 128, 82, 17, 82, 0, "Void Metal", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack, Arrays.asList(getTcAspectStack(TC_Aspects.PRAECANTATIO, 5), getTcAspectStack(TC_Aspects.VACUOS, 7))),
@@ -325,8 +325,8 @@ public enum GregtechOrePrefixes {
/* TODO*/ RedstoneAlloy(39, TextureSet.SET_METALLIC, 1.0F, 256, 2, 1|2|16|32|64, 178,34,34, 0, "Redstone Alloy", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.Redstone, 4))),
//Needs more Use, I think.
- Tantalloy60(40, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 213, 231, 237, 0, "Tantalloy 60", 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))),
- Tantalloy61(41, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 193, 211, 217, 0, "Tantalloy 61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3)));
+ Tantalloy60(40, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 166, 0, "Tantalloy-60", 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))),
+ Tantalloy61(41, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 122, 135, 196, 0, "Tantalloy-61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3)));
diff --git a/src/Java/miscutil/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/miscutil/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
new file mode 100644
index 0000000000..dd9a7ebd74
--- /dev/null
+++ b/src/Java/miscutil/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
@@ -0,0 +1,385 @@
+package miscutil.xmod.gregtech.api.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.D1;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.SubTag;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaPipeEntity;
+import gregtech.api.metatileentity.MetaPipeEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map.Entry;
+
+import miscutil.core.lib.CORE;
+import miscutil.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GregtechMetaPipeEntityFluid extends MetaPipeEntity {
+ public final float mThickNess;
+ public final GT_Materials mMaterial;
+ public final int mCapacity, mHeatResistance;
+ public final boolean mGasProof;
+ public FluidStack mFluid;
+ public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0;
+
+ public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) {
+ super(aID, aName, aNameRegional, 0);
+ mThickNess = aThickNess;
+ mMaterial = aMaterial;
+ mCapacity = aCapacity;
+ mGasProof = aGasProof;
+ mHeatResistance = aHeatResistance;
+ }
+
+ public GregtechMetaPipeEntityFluid(String aName, float aThickNess, GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) {
+ super(aName, 0);
+ mThickNess = aThickNess;
+ mMaterial = aMaterial;
+ mCapacity = aCapacity;
+ mGasProof = aGasProof;
+ mHeatResistance = aHeatResistance;
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return mMaterial == null ? 4 : (byte) ((mMaterial.contains(SubTag.WOOD) ? 12 : 4) + Math.max(0, Math.min(3, mMaterial.mToolQuality)));
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaPipeEntityFluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) {
+
+ short[] colours = Dyes.getModulation(aColorIndex, mMaterial.mRGBa);
+ if (aConnected) {
+ float tThickNess = getThickNess();
+ if (tThickNess < 0.37F){
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], colours)};
+ }
+ if (tThickNess < 0.49F){
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], colours)};
+ }
+ if (tThickNess < 0.74F){
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], colours)};
+ }
+ if (tThickNess < 0.99F){
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], colours)};
+ }
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], colours)};
+ }
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], colours)};
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return false;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return false;
+ }
+
+ @Override
+ public final boolean renderInside(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return getFluidAmount();
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return getCapacity();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom");
+ }
+
+ @Override
+ public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
+ if (mFluid != null && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) {
+ int tTemperature = mFluid.getFluid().getTemperature(mFluid);
+ if (tTemperature > 320) {
+ GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F);
+ } else if (tTemperature < 260) {
+ GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F);
+ }
+ }
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
+ return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide() && aTick % 5 == 0) {
+ mLastReceivedFrom &= 63;
+ if (mLastReceivedFrom == 63) {
+ mLastReceivedFrom = 0;
+ }
+
+ if (mFluid != null && mFluid.amount > 0) {
+ int tTemperature = mFluid.getFluid().getTemperature(mFluid);
+ if (tTemperature > mHeatResistance) {
+ if (aBaseMetaTileEntity.getRandomNumber(100) == 0) {
+ aBaseMetaTileEntity.setToFire();
+ return;
+ }
+ aBaseMetaTileEntity.setOnFire();
+ }
+ if (!mGasProof && mFluid.getFluid().isGaseous(mFluid)) {
+ mFluid.amount -= 5;
+ sendSound((byte) 9);
+ if (tTemperature > 320) {
+ try {
+ for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
+ GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ } else if (tTemperature < 260) {
+ try {
+ for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) {
+ GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ }
+ if (mFluid.amount <= 0) mFluid = null;
+ }
+ }
+
+ if (mLastReceivedFrom == oLastReceivedFrom) {
+ HashMap<IFluidHandler, ForgeDirection> tTanks = new HashMap<IFluidHandler, ForgeDirection>();
+
+ mConnections = 0;
+
+ for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) {
+ tSide = (byte) ((j + i) % 6);
+
+ IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(tSide);
+ if (tTileEntity != null) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ if (aBaseMetaTileEntity.getColorization() >= 0) {
+ byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization();
+ if (tColor >= 0 && (tColor & 15) != (aBaseMetaTileEntity.getColorization() & 15)) {
+ continue;
+ }
+ }
+ }
+ FluidTankInfo[] tInfo = tTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide).getOpposite());
+ if (tInfo != null && tInfo.length > 0) {
+ if (tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(tSide)).alwaysLookConnected(GT_Utility.getOppositeSide(tSide), ((ICoverable) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity))) {
+ mConnections |= (1 << tSide);
+ }
+ if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidIn(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) {
+ mConnections |= (1 << tSide);
+ }
+ if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidOut(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) {
+ mConnections |= (1 << tSide);
+ if (((1 << tSide) & mLastReceivedFrom) == 0)
+ tTanks.put(tTileEntity, ForgeDirection.getOrientation(tSide).getOpposite());
+ }
+ if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity)) {
+ mConnections |= (1 << tSide);
+ }
+ }
+ }
+ }
+
+ if (mFluid != null && mFluid.amount > 0) {
+ int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluid.amount / 2)), tSuccessfulTankAmount = 0;
+
+ for (Entry<IFluidHandler, ForgeDirection> tEntry : tTanks.entrySet())
+ if (tEntry.getKey().fill(tEntry.getValue(), drain(tAmount, false), false) > 0)
+ tSuccessfulTankAmount++;
+
+ if (tSuccessfulTankAmount > 0) {
+ if (tAmount >= tSuccessfulTankAmount) {
+ tAmount /= tSuccessfulTankAmount;
+ for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
+ if (mFluid == null || mFluid.amount <= 0) break;
+ int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tAmount, false), false);
+ if (tFilledAmount > 0)
+ tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true);
+ }
+ } else {
+ for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) {
+ if (mFluid == null || mFluid.amount <= 0) break;
+ int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(mFluid.amount, false), false);
+ if (tFilledAmount > 0)
+ tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true);
+ }
+ }
+ }
+ }
+
+ mLastReceivedFrom = 0;
+ }
+
+ oLastReceivedFrom = mLastReceivedFrom;
+ }
+ }
+
+ @Override
+ public void doSound(byte aIndex, double aX, double aY, double aZ) {
+ super.doSound(aIndex, aX, aY, aZ);
+ if (aIndex == 9) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
+ for (byte i = 0; i < 6; i++)
+ for (int l = 0; l < 2; ++l)
+ getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
+ }
+ }
+
+ @Override
+ public final int getCapacity() {
+ return mCapacity * 20;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public final FluidStack getFluid() {
+ return mFluid;
+ }
+
+ @Override
+ public final int getFluidAmount() {
+ return mFluid != null ? mFluid.amount : 0;
+ }
+
+ @Override
+ public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0;
+
+ if (mFluid == null || mFluid.getFluid().getID() <= 0) {
+ if (aFluid.amount <= getCapacity()) {
+ if (doFill) {
+ mFluid = aFluid.copy();
+ mLastReceivedFrom |= (1 << aSide.ordinal());
+ }
+ return aFluid.amount;
+ }
+ if (doFill) {
+ mFluid = aFluid.copy();
+ mLastReceivedFrom |= (1 << aSide.ordinal());
+ mFluid.amount = getCapacity();
+ }
+ return getCapacity();
+ }
+
+ if (!mFluid.isFluidEqual(aFluid)) return 0;
+
+ int space = getCapacity() - mFluid.amount;
+ if (aFluid.amount <= space) {
+ if (doFill) {
+ mFluid.amount += aFluid.amount;
+ mLastReceivedFrom |= (1 << aSide.ordinal());
+ }
+ return aFluid.amount;
+ }
+ if (doFill) {
+ mFluid.amount = getCapacity();
+ mLastReceivedFrom |= (1 << aSide.ordinal());
+ }
+ return space;
+ }
+
+ @Override
+ public final FluidStack drain(int maxDrain, boolean doDrain) {
+ if (mFluid == null) return null;
+ if (mFluid.amount <= 0) {
+ mFluid = null;
+ return null;
+ }
+
+ int used = maxDrain;
+ if (mFluid.amount < used)
+ used = mFluid.amount;
+
+ if (doDrain) {
+ mFluid.amount -= used;
+ }
+
+ FluidStack drained = mFluid.copy();
+ drained.amount = used;
+
+ if (mFluid.amount <= 0) {
+ mFluid = null;
+ }
+
+ return drained;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return (mFluid == null ? 0 : mFluid.amount) - (getCapacity() / 2);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ EnumChatFormatting.BLUE + "Fluid Capacity: " + (mCapacity * 20) + "L/sec" + EnumChatFormatting.GRAY,
+ EnumChatFormatting.RED + "Heat Limit: " + mHeatResistance + " K" + EnumChatFormatting.GRAY,
+ EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (mGasProof) + EnumChatFormatting.GRAY,
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public float getThickNess() {
+ return mThickNess;
+ }
+} \ No newline at end of file
diff --git a/src/resources/assets/miscutils/textures/items/itemBackpack.png b/src/resources/assets/miscutils/textures/items/itemBackpack.png
index 40f4c87bc7..00be30bea1 100644
--- a/src/resources/assets/miscutils/textures/items/itemBackpack.png
+++ b/src/resources/assets/miscutils/textures/items/itemBackpack.png
Binary files differ