diff options
Diffstat (limited to 'src/main/java/gregtech/api')
12 files changed, 86 insertions, 54 deletions
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index 0c484d05e0..f30360ca58 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -174,7 +174,8 @@ public class GT_Values { MOD_ID_BC_CORE = "BuildCraft|Core", MOD_ID_GC_CORE = "GalacticraftCore", MOD_ID_GC_MARS = "GalacticraftMars", - MOD_ID_GC_PLANETS = "GalacticraftPlanets"; + MOD_ID_GC_PLANETS = "GalacticraftPlanets", + MOD_ID_DC = "dreamcraft"; /** * File Paths and Resource Paths */ diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 862985faca..0b47d4681a 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -780,6 +780,7 @@ public enum ItemList implements IItemContainer { Casing_Grate, Casing_Vent, Casing_RadiationProof, + Casing_AdvancedRadiationProof, Casing_Firebox_Bronze, Casing_Firebox_Steel, Casing_Firebox_TungstenSteel, diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 9075a0a013..5de8bb13cb 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.MOD_ID_DC; @SuppressWarnings("ALL") public class Materials implements IColorModulationContainer, ISubTagContainer { @@ -98,7 +99,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Platinum = new Materials( 85, TextureSet.SET_SHINY , 12.0F, 64, 4, 1|2 |8 |32|64|128 , 255, 255, 200, 0, "Platinum" , "Platinum" , 0, 0, 2041, 0, false, false, 6, 1, 1, Dyes.dyeOrange , Element.Pt , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))); public static Materials Plutonium = new Materials( 100, TextureSet.SET_METALLIC , 6.0F, 512, 3, 1|2 |8 |32|64 , 240, 50, 50, 0, "Plutonium" , "Plutonium 239" , 0, 0, 912, 0, false, false, 6, 1, 1, Dyes.dyeLime , Element.Pu , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 2))); public static Materials Plutonium241 = new Materials( 101, TextureSet.SET_SHINY , 6.0F, 512, 3, 1|2 |8 |32|64 , 250, 70, 70, 0, "Plutonium241" , "Plutonium 241" , 0, 0, 912, 0, false, false, 6, 1, 1, Dyes.dyeLime , Element.Pu_241 , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 3))); - public static Materials Potassium = new Materials( 25, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1|2 |32 , 250, 250, 250, 0, "Potassium" , "Potassium" , 0, 0, 336, 0, false, false, 2, 1, 1, Dyes.dyeWhite , Element.K , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); + public static Materials Potassium = new Materials( 25, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1|2 |32 , 154, 172, 223, 0, "Potassium" , "Potassium" , 0, 0, 336, 0, false, false, 2, 1, 1, Dyes.dyeWhite , Element.K , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); public static Materials Praseodymium = new Materials( 66, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Praseodymium" , "Praseodymium" , 0, 0, 1208, 1208, true, false, 4, 1, 1, Dyes._NULL , Element.Pr , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); public static Materials Promethium = new Materials( 68, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Promethium" , "Promethium" , 0, 0, 1315, 1315, true, false, 4, 1, 1, Dyes._NULL , Element.Pm , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); public static Materials Radon = new Materials( 93, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 0, 255, 240, "Radon" , "Radon" , 0, 0, 202, 0, false, true, 5, 1, 1, Dyes.dyePurple , Element.Rn , Arrays.asList(new TC_AspectStack(TC_Aspects.AER, 1), new TC_AspectStack(TC_Aspects.RADIO, 1))); @@ -281,7 +282,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Migmatite = new Materials( 872, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Migmatite" , "Migmatite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); public static Materials Mimichite = new Materials( -1, TextureSet.SET_GEM_VERTICAL , 1.0F, 0, 1, 1 |4|8 , 255, 255, 255, 0, "Mimichite" , "Mimichite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); public static Materials Moonstone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Moonstone" , "Moonstone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.ALIENIS, 1))); - public static Materials Naquadah = new Materials( 324, TextureSet.SET_METALLIC , 6.0F, 1280, 4, 1|2 |8 |64 , 50, 50, 50, 0, "Naquadah" , "Naquadah" , 0, 0, 5400, 5400, true, false, 10, 1, 1, Dyes.dyeBlack , Element.Nq, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Naquadah = new Materials( 324, TextureSet.SET_METALLIC , 6.0F, 1280, 4, 1|2 |8 |64|128 , 50, 50, 50, 0, "Naquadah" , "Naquadah" , 0, 0, 5400, 5400, true, false, 10, 1, 1, Dyes.dyeBlack , Element.Nq, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); public static Materials NaquadahAlloy = new Materials( 325, TextureSet.SET_METALLIC , 8.0F, 5120, 5, 1|2 |64|128 , 40, 40, 40, 0, "NaquadahAlloy" , "Naquadah Alloy" , 0, 0, 7200, 7200, true, false, 10, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); public static Materials NaquadahEnriched = new Materials( 326, TextureSet.SET_METALLIC , 6.0F, 1280, 4, 1|2 |8 |64 , 50, 50, 50, 0, "NaquadahEnriched" , "Enriched Naquadah" , 0, 0, 4500, 4500, true, false, 15, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.RADIO, 2), new TC_AspectStack(TC_Aspects.NEBRISUM, 2))).disableAutoGeneratedBlastFurnaceRecipes(); public static Materials Naquadria = new Materials( 327, TextureSet.SET_SHINY , 1.0F, 512, 4, 1|2 |8 |64 , 30, 30, 30, 0, "Naquadria" , "Naquadria" , 0, 0, 9000, 9000, true, false, 20, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.RADIO, 3), new TC_AspectStack(TC_Aspects.NEBRISUM, 3))).disableAutoGeneratedBlastFurnaceRecipes(); @@ -615,7 +616,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Ultimet = new Materials( 344, TextureSet.SET_SHINY , 9.0F, 2048, 4, 1|2 |64|128 , 180, 180, 230, 0, "Ultimet" , "Ultimet" , 0, 0, 2700, 2700, true, false, 1, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Cobalt, 5), new MaterialStack(Chrome, 2), new MaterialStack(Nickel, 1), new MaterialStack(Molybdenum, 1))); // 54% Cobalt, 26% Chromium, 9% Nickel, 5% Molybdenum, 3% Iron, 2% Tungsten, 0.8% Manganese, 0.3% Silicon, 0.08% Nitrogen and 0.06% Carbon public static Materials Uraninite = new Materials( 922, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 35, 35, 35, 0, "Uraninite" , "Uraninite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime , 2, Arrays.asList(new MaterialStack(Uranium, 1), new MaterialStack(Oxygen, 2))); public static Materials Uvarovite = new Materials( 842, TextureSet.SET_DIAMOND , 1.0F, 0, 2, 1 |8 , 180, 255, 180, 0, "Uvarovite" , "Uvarovite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Chrome, 2), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials VanadiumGallium = new Materials( 357, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 , 128, 128, 140, 0, "VanadiumGallium" , "Vanadium-Gallium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGray , 2, Arrays.asList(new MaterialStack(Vanadium, 3), new MaterialStack(Gallium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials VanadiumGallium = new Materials( 357, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |128 , 128, 128, 140, 0, "VanadiumGallium" , "Vanadium-Gallium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGray , 2, Arrays.asList(new MaterialStack(Vanadium, 3), new MaterialStack(Gallium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); public static Materials Wood = new Materials( 809, TextureSet.SET_WOOD , 2.0F, 16, 0, 1|2 |64|128 , 100, 50, 0, 0, "Wood" , "Wood" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 0, Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1), new MaterialStack(Hydrogen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.ARBOR, 2))); public static Materials WroughtIron = new Materials( 304, TextureSet.SET_METALLIC , 6.0F, 384, 2, 1|2 |64|128 , 200, 180, 180, 0, "WroughtIron" , "Wrought Iron" , 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , 2, Arrays.asList(new MaterialStack(Iron, 1))); public static Materials Wulfenite = new Materials( 882, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 255, 128, 0, 0, "Wulfenite" , "Wulfenite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Molybdenum, 1), new MaterialStack(Oxygen, 4))); @@ -686,7 +687,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials BasalticMineralSand = new Materials( 935, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 40, 50, 40, 0, "BasalticMineralSand" , "Basaltic Mineral Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(Basalt, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); public static Materials GraniticMineralSand = new Materials( 936, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 40, 60, 60, 0, "GraniticMineralSand" , "Granitic Mineral Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(GraniteBlack, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); public static Materials GarnetSand = new Materials( 938, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "GarnetSand" , "Garnet Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(GarnetRed, 1), new MaterialStack(GarnetYellow, 1))); - public static Materials QuartzSand = new Materials( 939, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 200, 200, 200, 0, "QuartzSand" , "Quartz Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(CertusQuartz, 1), new MaterialStack(Quartzite, 1))); + public static Materials QuartzSand = new Materials( 939, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 194, 178, 128, 0, "QuartzSand" , "Quartz Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(CertusQuartz, 1), new MaterialStack(Quartzite, 1))); public static Materials Bastnasite = new Materials( 905, TextureSet.SET_FINE , 1.0F, 0, 2, 1 |8 , 200, 110, 45, 0, "Bastnasite" , "Bastnasite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Cerium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Fluorine, 1), new MaterialStack(Oxygen, 3))); // (Ce, La, Y)CO3F public static Materials Pentlandite = new Materials( 909, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 165, 150, 5, 0, "Pentlandite" , "Pentlandite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Nickel, 9), new MaterialStack(Sulfur, 8))); // (Fe,Ni)9S8 public static Materials Spodumene = new Materials( 920, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 190, 170, 170, 0, "Spodumene" , "Spodumene" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Lithium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Silicon, 2), new MaterialStack(Oxygen, 6))); // LiAl(SiO3)2 @@ -2094,7 +2095,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { initMaterialProperties(); //No more material addition or manipulation should be done past this point! MATERIALS_ARRAY = MATERIALS_MAP.values().toArray(new Materials[0]); //Generate standard object array. This is a lot faster to loop over. VALUES = Arrays.asList(MATERIALS_ARRAY); - if (!Loader.isModLoaded("dreamcraft") && !GT_Mod.gregtechproxy.mEnableAllComponents) + if (!Loader.isModLoaded(MOD_ID_DC) && !GT_Mod.gregtechproxy.mEnableAllComponents) OrePrefixes.initMaterialComponents(); else { OrePrefixes.ingotHot.mDisabledItems.addAll( @@ -2800,6 +2801,13 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { return new FluidStack(steamCrackedFluids[2], amount); } + /** Check that the material is a proper soldering fluid + ** @return true if Materials is a proper soldering fluid + */ + public boolean isProperSolderingFluid() { + return mStandardMoltenFluid != null && contains(SubTag.SOLDERING_MATERIAL) && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !contains(SubTag.SOLDERING_MATERIAL_GOOD)); + } + public ItemStack getCells(int amount) { return GT_OreDictUnificator.get(OrePrefixes.cell, this, amount); } @@ -2835,4 +2843,5 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public ItemStack getPlates(int amount) { return GT_OreDictUnificator.get(OrePrefixes.plate, this, amount); } + } diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 606d12c832..e8640431b5 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -760,7 +760,7 @@ public enum OrePrefixes { gearGt.mDisabledItems.add(aMaterial); //Small Gears if (!enableUnusedSmallGears && !(aMaterial == Materials.Aluminium || aMaterial == Materials.Titanium || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) + aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.Naquadah)) gearGtSmall.mDisabledItems.add(aMaterial); //Bolts if (!enableUnusedBolts && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index b0f7f7a337..c4c18b8725 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -298,6 +298,7 @@ public class Textures { MACHINE_CASING_VENT, MACHINE_CASING_RADIATIONPROOF, + MACHINE_CASING_ADVANCEDRADIATIONPROOF, MACHINE_CASING_FIREBOX_BRONZE, MACHINE_CASING_FIREBOX_STEEL, MACHINE_CASING_FIREBOX_TUNGSTENSTEEL, diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java index 96f1cdfd68..df6f2671e4 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -54,8 +54,9 @@ public class PowerNodePath extends NodePath { for (MetaPipeEntity tCable : mPipes) { if (((GT_MetaPipeEntity_Cable)tCable).mAmperage*40 < this.mAmps) { BaseMetaPipeEntity tBaseCable = (BaseMetaPipeEntity) tCable.getBaseMetaTileEntity(); - if (tBaseCable != null) + if (tBaseCable != null) { tBaseCable.setToFire(); + } } } } @@ -95,6 +96,9 @@ public class PowerNodePath extends NodePath { } private void reset(int aTimePassed) { + if (aTimePassed < 0 || aTimePassed > 100) { + mAmps = 0; + } mAmps = Math.max(0, mAmps - (mMaxAmps * aTimePassed)); } diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java index 477e52d103..12878b6a04 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -42,7 +42,7 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { * While a logical client don't really need to process fluid cells upon click (it could have just wait * for server side to send the result), doing so would result in every fluid interaction having a * noticeable delay between clicking and changes happening even on single player. - * I'd imagine this delay to get only more severe when playing MP over ethernet, which would have much more latency + * I'd imagine this lag to become only more severe when playing MP over ethernet, which would have much more latency * than a memory connection */ GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); @@ -55,18 +55,6 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - /** - * Expected to be called on client side only. Load fluid stacks from fluid display items as they were not sent - * over the network. - * Override this if you have more than one fluid display stack. This implementation will set drainable stack according to items - * in slot indexed 2. - * - */ - protected void syncFluidFromFluidDisplayItems() { - GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); - tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2))); - } - protected static ItemStack handleFluidSlotClick(IFluidAccess aFluidAccess, EntityPlayer aPlayer, boolean aProcessFullStack, boolean aCanDrain, boolean aCanFill) { ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); @@ -95,37 +83,35 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { // cannot take AND cannot fill, why make this call then? return null; // the slot does not allow filling, so try take some - return drainFluid(aFluidAccess.get(), aPlayer, aProcessFullStack); + return drainFluid(aFluidAccess, aPlayer, aProcessFullStack); } else { // cannot fill and there is something to take if (!aCanDrain) // but the slot does not allow taking, so bail out return null; - ItemStack tResultStack = drainFluid(tInputFluid, aPlayer, aProcessFullStack); - if (tInputFluid.amount == 0) - aFluidAccess.set(null); - return tResultStack; + return drainFluid(aFluidAccess, aPlayer, aProcessFullStack); } } - protected static ItemStack drainFluid(FluidStack aTankStack, EntityPlayer aPlayer, boolean aProcessFullStack) { - if (aTankStack == null) return null; + protected static ItemStack drainFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, boolean aProcessFullStack) { + FluidStack tTankStack = aFluidAccess.get(); + if (tTankStack == null) return null; ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null; - int tOriginalFluidAmount = aTankStack.amount; - ItemStack tFilled = GT_Utility.fillFluidContainer(aTankStack, tStackSizedOne, true, false); - if (tFilled == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) { + int tOriginalFluidAmount = tTankStack.amount; + ItemStack tFilledContainer = GT_Utility.fillFluidContainer(tTankStack, tStackSizedOne, true, false); + if (tFilledContainer == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) { IFluidContainerItem tContainerItem = (IFluidContainerItem) tStackSizedOne.getItem(); - int tFilledAmount = tContainerItem.fill(tStackSizedOne, aTankStack, true); + int tFilledAmount = tContainerItem.fill(tStackSizedOne, tTankStack, true); if (tFilledAmount > 0) { - tFilled = tStackSizedOne; - aTankStack.amount -= tFilledAmount; + tFilledContainer = tStackSizedOne; + tTankStack.amount -= tFilledAmount; } } - if (tFilled != null) { + if (tFilledContainer != null) { if (aProcessFullStack) { - int tFilledAmount = tOriginalFluidAmount - aTankStack.amount; + int tFilledAmount = tOriginalFluidAmount - tTankStack.amount; /* work out how many more items we can fill one cell is already used, so account for that @@ -133,13 +119,15 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { the user then get to decide what to do with it it will not be too fancy if it spills out partially filled cells */ - int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, aTankStack.amount / tFilledAmount); - aTankStack.amount -= tFilledAmount * tAdditionalParallel; - tFilled.stackSize += tAdditionalParallel; + int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, tTankStack.amount / tFilledAmount); + tTankStack.amount -= tFilledAmount * tAdditionalParallel; + tFilledContainer.stackSize += tAdditionalParallel; } - replaceCursorItemStack(aPlayer, tFilled); + replaceCursorItemStack(aPlayer, tFilledContainer); } - return tFilled; + if (tTankStack.amount <= 0) + aFluidAccess.set(null); + return tFilledContainer; } protected static ItemStack fillFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index e09c192bfa..f500e8027e 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -29,7 +29,6 @@ public interface IGT_RecipeAdder { * Adds a Centrifuge Recipe * * @param aInput1 must be != null - * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing * @param aOutput1 must be != null * @param aOutput2 can be null * @param aOutput3 can be null @@ -66,7 +65,6 @@ public interface IGT_RecipeAdder { * Adds a Electrolyzer Recipe * * @param aInput1 must be != null - * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing * @param aOutput1 must be != null * @param aOutput2 can be null * @param aOutput3 can be null @@ -80,7 +78,6 @@ public interface IGT_RecipeAdder { * Adds a Electrolyzer Recipe * * @param aInput1 must be != null - * @param aCellInput this is for the needed Cells, > 0 for Tincellcount, < 0 for negative Fuelcancount, == 0 for nothing * @param aOutput1 must be != null * @param aOutput2 can be null * @param aOutput3 can be null @@ -118,7 +115,7 @@ public interface IGT_RecipeAdder { * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput1 must be != null + * @param aOutput must be != null * @param aOutput2 must be != null * @param aDuration must be > 0 */ @@ -130,7 +127,7 @@ public interface IGT_RecipeAdder { * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput1 must be != null + * @param aOutput must be != null * @param aOutput2 must be != null * @param aDuration must be > 0 */ @@ -150,7 +147,7 @@ public interface IGT_RecipeAdder { * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput1 must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUtick must be > 0 */ @@ -163,7 +160,7 @@ public interface IGT_RecipeAdder { * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput1 must be != null + * @param aOutput must be != null * @param aOutput2 must be != null * @param aDuration must be > 0 * @param aEUtick must be > 0 @@ -244,7 +241,6 @@ public interface IGT_RecipeAdder { * @param aInput1 must be != null * @param aInput2 can be null * @param aOutput1 must be != null - * @param aOutput2 can be null * @param aDuration must be > 0 * @param aEUt should be > 0 */ @@ -377,6 +373,8 @@ public interface IGT_RecipeAdder { */ boolean addBenderRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addBenderRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput, int aDuration, int aEUt); + /** * Adds a Extruder Machine Recipe * diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java index cc2513f5c2..8f54112885 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java @@ -50,7 +50,8 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta @Override public void setExtendedFacing(ExtendedFacing newExtendedFacing) { if (mExtendedFacing != newExtendedFacing) { - stopMachine(); + if(mMachine) + stopMachine(); mExtendedFacing = newExtendedFacing; IGregTechTileEntity base = getBaseMetaTileEntity(); mMachine = false; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 0a1b2e8b02..7a2f1bedac 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -858,10 +858,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index cc224b977d..4b4c01345a 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -65,7 +65,7 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { } public static void initExecutorService() { - EXECUTOR_SERVICE = Executors.newFixedThreadPool((Runtime.getRuntime().availableProcessors() * 2 / 3), THREAD_FACTORY); + EXECUTOR_SERVICE = Executors.newFixedThreadPool(Math.max(1, (Runtime.getRuntime().availableProcessors() * 2 / 3)), THREAD_FACTORY); } public static void shutdownExecutorService() { diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 4059c6cd92..f941a86f5c 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -613,7 +613,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map(new HashSet<>(1170), "gt.recipe.chemicalreactor", "Chemical Reactor", null, RES_PATH_GUI + "basicmachines/ChemicalReactor", 2, 2, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor(); public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower(); - public static final GT_Recipe_Map sCrakingRecipes = new GT_Recipe_Map(new HashSet<>(70), "gt.recipe.craker", "Oil Cracker", null, RES_PATH_GUI + "basicmachines/OilCracker", 1, 1, 1, 2, 1, E, 1, E, true, true); + public static final GT_Recipe_Map_OilCracker sCrackingRecipes = new GT_Recipe_Map_OilCracker(); + /** + * Use sCrackingRecipes instead + */ + @Deprecated + public static final GT_Recipe_Map sCrakingRecipes = sCrackingRecipes; public static final GT_Recipe_Map sPyrolyseRecipes = new GT_Recipe_Map(new HashSet<>(150), "gt.recipe.pyro", "Pyrolyse Oven", null, RES_PATH_GUI + "basicmachines/Default", 2, 1, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sWiremillRecipes = new GT_Recipe_Map(new HashSet<>(450), "gt.recipe.wiremill", "Wiremill", null, RES_PATH_GUI + "basicmachines/Wiremill", 1, 1, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sBenderRecipes = new GT_Recipe_Map(new HashSet<>(5000), "gt.recipe.metalbender", "Bending Machine", null, RES_PATH_GUI + "basicmachines/Bender", 2, 1, 2, 0, 1, E, 1, E, true, true); @@ -1840,6 +1845,26 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } + public static class GT_Recipe_Map_OilCracker extends GT_Recipe_Map { + private final Set<String> mValidCatalystFluidNames = new HashSet<>(); + public GT_Recipe_Map_OilCracker() { + super(new HashSet<>(70), "gt.recipe.craker", "Oil Cracker", null, RES_PATH_GUI + "basicmachines/OilCracker", 1, 1, 1, 2, 1, E, 1, E, true, true); + } + + @Override + public GT_Recipe add(GT_Recipe aRecipe) { + GT_Recipe ret = super.add(aRecipe); + if (ret != null && ret.mFluidInputs != null && ret.mFluidInputs.length>1 && ret.mFluidInputs[1] != null) { + mValidCatalystFluidNames.add(ret.mFluidInputs[1].getFluid().getName()); + } + return ret; + } + + public boolean isValidCatalystFluid(FluidStack aFluidStack) { + return mValidCatalystFluidNames.contains(aFluidStack.getFluid().getName()); + } + } + public static class GT_Recipe_WithAlt extends GT_Recipe { ItemStack[][] mOreDictAlt; |