diff options
| author | Alkalus <draknyte1@hotmail.com> | 2017-11-22 13:47:37 +1000 | 
|---|---|---|
| committer | Alkalus <draknyte1@hotmail.com> | 2017-11-22 13:47:37 +1000 | 
| commit | 7bd2240747945f0c4b4287ef106049b7e1505fb6 (patch) | |
| tree | 27863b80e232517a618ee37e5cba4be541944ec7 /src/Java | |
| parent | 9d52b3d41d6dfdfb2e61cd59510b3a1d61925a16 (diff) | |
| download | GT5-Unofficial-7bd2240747945f0c4b4287ef106049b7e1505fb6.tar.gz GT5-Unofficial-7bd2240747945f0c4b4287ef106049b7e1505fb6.tar.bz2 GT5-Unofficial-7bd2240747945f0c4b4287ef106049b7e1505fb6.zip | |
+ Added the basic framework for Ore Regen commands.
+ Added more missing Blast Smelter recipes.
$ Fixed Alloy Blast Smelter not using fluids as expected.
Diffstat (limited to 'src/Java')
6 files changed, 574 insertions, 118 deletions
| diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 623e5651e5..39d09935d2 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1,8 +1,16 @@  package gtPlusPlus.core.recipe;  import gregtech.api.GregTech_API; -import gregtech.api.enums.*; -import gregtech.api.util.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.HotFuel; +import gregtech.api.util.ThermalFuel;  import gtPlusPlus.core.block.ModBlocks;  import gtPlusPlus.core.item.ModItems;  import gtPlusPlus.core.lib.CORE; @@ -55,7 +63,7 @@ public class RECIPES_GREGTECH {  		sifterRecipes();  		electroMagneticSeperatorRecipes();  		addFuels(); -	}	 +	}  	private static void blastSmelterRecipes() { @@ -65,9 +73,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getGregtechCircuit(13),  						ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 3),						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 3),  				}, -				FluidUtils.getFluidStack("molten.blackbronze", 5*144),  +				FluidUtils.getFluidStack("molten.blackbronze", 5*144),  				0,  				MathUtils.findPercentageOfInt(200*20, 80),  				120); @@ -80,9 +88,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 15),  						ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 3)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 3)  				}, -				FluidUtils.getFluidStack("molten.blacksteel", 25*144),  +				FluidUtils.getFluidStack("molten.blacksteel", 25*144),  				0,  				MathUtils.findPercentageOfInt(60*20, 80),  				120); @@ -96,9 +104,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustZinc", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustBismuth", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 10), -						ItemUtils.getItemStackOfAmountFromOreDict("dustBlackSteel", 20)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustBlackSteel", 20)  				}, -				FluidUtils.getFluidStack("molten.redsteel", 40*144),  +				FluidUtils.getFluidStack("molten.redsteel", 40*144),  				0,  				MathUtils.findPercentageOfInt(65*20, 80),  				120); @@ -111,10 +119,10 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 18),  						ItemUtils.getItemStackOfAmountFromOreDict("dustZinc", 5),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 30), -						ItemUtils.getItemStackOfAmountFromOreDict("dustBlackSteel", 60)	 +						ItemUtils.getItemStackOfAmountFromOreDict("dustBlackSteel", 60)  				}, -				FluidUtils.getFluidStack("molten.bluesteel", 125*144),  +				FluidUtils.getFluidStack("molten.bluesteel", 125*144),  				0,  				MathUtils.findPercentageOfInt(70*20, 80),  				120); @@ -124,9 +132,9 @@ public class RECIPES_GREGTECH {  				new ItemStack[]{  						ItemUtils.getGregtechCircuit(2),  						ItemUtils.getItemStackOfAmountFromOreDict("ingotTungsten", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("ingotSteel", 1)						 +						ItemUtils.getItemStackOfAmountFromOreDict("ingotSteel", 1)  				}, -				FluidUtils.getFluidStack("molten.tungstensteel", 2*144),  +				FluidUtils.getFluidStack("molten.tungstensteel", 2*144),  				0,  				MathUtils.findPercentageOfInt(300*20, 80),  				120); @@ -138,9 +146,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 6),  						ItemUtils.getItemStackOfAmountFromOreDict("dustNickel", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustManganese", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 1)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 1)  				}, -				FluidUtils.getFluidStack("molten.stainlesssteel", 9*144),  +				FluidUtils.getFluidStack("molten.stainlesssteel", 9*144),  				0,  				MathUtils.findPercentageOfInt(85*20, 80),  				120); @@ -155,9 +163,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 3),  						ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 3), -						ItemUtils.getItemStackOfAmountFromOreDict("dustSilicon", 12)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustSilicon", 12)  				}, -				FluidUtils.getFluidStack("molten.eglinsteel", 48*144),  +				FluidUtils.getFluidStack("molten.eglinsteel", 48*144),  				0,  				MathUtils.findPercentageOfInt(30*20, 80),  				120); @@ -169,9 +177,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustTungstenSteel", 5),  						ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustMolybdenum", 2), -						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 1)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 1)  				}, -				FluidUtils.getFluidStack("molten.hssg", 9*144),  +				FluidUtils.getFluidStack("molten.hssg", 9*144),  				0,  				MathUtils.findPercentageOfInt(450*20, 80),  				120); @@ -184,9 +192,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustSteel", 5),  						ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 2),  						ItemUtils.getItemStackOfAmountFromOreDict("dustMolybdenum", 4), -						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 2)						 +						ItemUtils.getItemStackOfAmountFromOreDict("dustChrome", 2)  				}, -				FluidUtils.getFluidStack("molten.hssg", 18*144),  +				FluidUtils.getFluidStack("molten.hssg", 18*144),  				0,  				MathUtils.findPercentageOfInt(900*20, 80),  				120); @@ -198,9 +206,9 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustHSSG", 6),  						ItemUtils.getItemStackOfAmountFromOreDict("dustCobalt", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustSilicon", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("dustManganese", 1)					 +						ItemUtils.getItemStackOfAmountFromOreDict("dustManganese", 1)  				}, -				FluidUtils.getFluidStack("molten.hsse", 9*144),  +				FluidUtils.getFluidStack("molten.hsse", 9*144),  				0,  				MathUtils.findPercentageOfInt(540*20, 80),  				120); @@ -211,20 +219,128 @@ public class RECIPES_GREGTECH {  						ItemUtils.getGregtechCircuit(3),  						ItemUtils.getItemStackOfAmountFromOreDict("dustHSSG", 6),  						ItemUtils.getItemStackOfAmountFromOreDict("dustOsmium", 1), -						ItemUtils.getItemStackOfAmountFromOreDict("dustIridium", 2)					 +						ItemUtils.getItemStackOfAmountFromOreDict("dustIridium", 2)  				}, -				FluidUtils.getFluidStack("molten.hsss", 9*144),  +				FluidUtils.getFluidStack("molten.hsss", 9*144),  				0,  				MathUtils.findPercentageOfInt(810*20, 80),  				120); +		//Osmiridium +		CORE.RA.addBlastSmelterRecipe( +				new ItemStack[]{ +						ItemUtils.getGregtechCircuit(2), +						ItemUtils.getItemStackOfAmountFromOreDict("dustIridium", 3), +						ItemUtils.getItemStackOfAmountFromOreDict("dustOsmium", 1) +				}, +				FluidUtils.getFluidStack("molten.osmiridium", 4*144), +				0, +				MathUtils.findPercentageOfInt(1920*20, 80), +				500); + +		//Naq Alloy +		CORE.RA.addBlastSmelterRecipe( +				new ItemStack[]{ +						ItemUtils.getGregtechCircuit(2), +						ItemUtils.getItemStackOfAmountFromOreDict("dustNaquadah", 1), +						ItemUtils.getItemStackOfAmountFromOreDict("dustOsmiridium", 1) +				}, +				FluidUtils.getFluidStack("molten.naquadahalloy", 2*144), +				0, +				MathUtils.findPercentageOfInt(30720*20, 80), +				500); + +		//Nickel-Zinc-Ferrite +		if (Materials.get("NickelZincFerrite") != null){ +			CORE.RA.addBlastSmelterRecipe( +					new ItemStack[]{ +							ItemUtils.getGregtechCircuit(2), +							ItemUtils.getItemStackOfAmountFromOreDict("dustFerriteMixture", 6) +					}, +					Materials.Oxygen.getGas(2000), +					FluidUtils.getFluidStack("molten.nickelzincferrite", 2*144), +					0, +					MathUtils.findPercentageOfInt(600*20, 80), +					120); +		} + +		//Gallium-Arsenide +		if (Materials.get("GalliumArsenide") != null){ +			CORE.RA.addBlastSmelterRecipe( +					new ItemStack[]{ +							ItemUtils.getGregtechCircuit(2), +							ItemUtils.getItemStackOfAmountFromOreDict("dustGallium", 1), +							ItemUtils.getItemStackOfAmountFromOreDict("dustArsenic", 1) +					}, +					FluidUtils.getFluidStack("molten.galliumarsenide", 2*144), +					0, +					MathUtils.findPercentageOfInt(600*20, 80), +					120); +		} + + + + + + + + + + + + + +		//TungstenCarbide +		if (Materials.get("TungstenCarbide") != null){ +			CORE.RA.addBlastSmelterRecipe( +					new ItemStack[]{ +							ItemUtils.getGregtechCircuit(12), +							ItemUtils.getItemStackOfAmountFromOreDict("dustTungsten", 1), +							ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 1) +					}, +					FluidUtils.getFluidStack("molten.tungstencarbide", 2*144), +					0, +					MathUtils.findPercentageOfInt((int) Math.max(Materials.TungstenCarbide.getMass() / 40L, 1L) * Materials.TungstenCarbide.mBlastFurnaceTemp*20, 80), +					480); +		} + + +		//Vanadium-Gallium +		if (Materials.get("VanadiumGallium") != null){ +			CORE.RA.addBlastSmelterRecipe( +					new ItemStack[]{ +							ItemUtils.getGregtechCircuit(2), +							ItemUtils.getItemStackOfAmountFromOreDict("dustGallium", 1), +							ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 3) +					}, +					FluidUtils.getFluidStack("molten.vanadiumgallium", 4*144), +					0, +					MathUtils.findPercentageOfInt((int) Math.max(Materials.VanadiumGallium.getMass() / 40L, 1L) * Materials.VanadiumGallium.mBlastFurnaceTemp*20, 80), +					480); +		} + +		//EIO +		//Dark Steel +		if (ItemUtils.getItemStackOfAmountFromOreDict("dustElectricalSteel", 1) != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ +			CORE.RA.addBlastSmelterRecipe( +					new ItemStack[]{ +							ItemUtils.getGregtechCircuit(2), +							ItemUtils.getItemStackOfAmountFromOreDict("dustElectricalSteel", 1), +							ItemUtils.getItemStackOfAmountFromOreDict("dustObsidian", 1) +					}, +					FluidUtils.getFluidStack("molten.darksteel", 2*144), +					0, +					MathUtils.findPercentageOfInt(500*20, 80), +					120); +		} +  	}  	private static void fluidcannerRecipes() {  		//Sulfuric Acid  		GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), FluidUtils.getFluidStack("sulfuricacid", 250), null); -		GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("sulfuricacid", 250));		 -		 +		GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("sulfuricacid", 250)); +  		//Hydrofluoric Acid  		GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), FluidUtils.getFluidStack("hydrofluoricacid", 250), null);  		GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid", 250)); @@ -239,7 +355,7 @@ public class RECIPES_GREGTECH {  				20,  				GT_ModHandler.getSteam(1000),  				GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), -				FluidUtils.getFluidStack("fluid.coalgas", 1440),  +				FluidUtils.getFluidStack("fluid.coalgas", 1440),  				60,  				30); @@ -249,7 +365,7 @@ public class RECIPES_GREGTECH {  				22,  				GT_ModHandler.getSteam(1000),  				ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 10), -				FluidUtils.getFluidStack("fluid.coalgas", 2880),  +				FluidUtils.getFluidStack("fluid.coalgas", 2880),  				30,  				120); @@ -610,12 +726,12 @@ public class RECIPES_GREGTECH {  		addAR(ItemUtils.getItemStackOfAmountFromOreDict("plateIncoloy020", 16), ItemUtils.getItemStackOfAmountFromOreDict("frameGtIncoloyMA956", 4), null, GregtechItemList.Casing_Power_SubStation.get(4), 80, 128);  	} -	private static boolean addAR(ItemStack inputA, ItemStack inputB, ItemStack outputA, int seconds, int voltage){ +	private static boolean addAR(final ItemStack inputA, final ItemStack inputB, final ItemStack outputA, final int seconds, final int voltage){  		//return GT_Values.RA.addAssemblerRecipe(inputA, inputB, outputA, seconds*20, voltage);  		return addAR(inputA, inputB, null, outputA, seconds*20, voltage);  	} -	private static boolean addAR(ItemStack inputA, ItemStack inputB, FluidStack inputFluidA, ItemStack outputA, int seconds, int voltage){ +	private static boolean addAR(final ItemStack inputA, final ItemStack inputB, final FluidStack inputFluidA, final ItemStack outputA, final int seconds, final int voltage){  		//return GT_Values.RA.addAssemblerRecipe(inputA, inputB, outputA, seconds*20, voltage);  		return GT_Values.RA.addAssemblerRecipe(inputA, inputB, inputFluidA, outputA, seconds*20, voltage);  	} @@ -953,12 +1069,12 @@ public class RECIPES_GREGTECH {  				FluidUtils.getFluidStack("molten.bismuth", 1),  				new ItemStack[]{GregtechItemList.Pellet_RTG_PO210.get(1)},  				null, -				new int[]{100},  -				20*300,  -				2040,  -				500*20);		 +				new int[]{100}, +				20*300, +				2040, +				500*20);  	} -	 +  	private static void sifterRecipes() {  		//Zirconium  		GT_Values.RA.addSifterRecipe( @@ -970,10 +1086,10 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1) -						}, +				},  				new int[]{10000, 5000, 1500, 1000, 500, 500},  				20*30, -				60);	 +				60);  		//Zirconium  		GT_Values.RA.addSifterRecipe( @@ -985,12 +1101,12 @@ public class RECIPES_GREGTECH {  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1),  						ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1) -						}, +				},  				new int[]{10000, 5000, 1500, 1000, 500, 500},  				20*30,  				60);  	} -	 +  	private static void electroMagneticSeperatorRecipes(){  		GT_Values.RA.addElectromagneticSeparatorRecipe(  				ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedBauxite", 1), @@ -1001,7 +1117,7 @@ public class RECIPES_GREGTECH {  				20*20,  				24);  	} -	 +  	private static void advancedMixerRecipes(){  		//HgBa2Ca2Cu3O8  		CORE.RA.addMixerRecipe( diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index e9831d96e0..bf7dc58db3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -6,8 +6,12 @@ import java.util.Iterator;  import gregtech.api.interfaces.metatileentity.IMetaTileEntity;  import gregtech.api.interfaces.tileentity.IGregTechTileEntity;  import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.util.*; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.GT_Recipe;  import gtPlusPlus.core.util.Utils;  import gtPlusPlus.core.util.math.MathUtils;  import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; @@ -19,8 +23,8 @@ import net.minecraft.inventory.IInventory;  import net.minecraft.item.ItemStack;  public abstract class GregtechMeta_MultiBlockBase -		extends -			GT_MetaTileEntity_MultiBlockBase { +extends +GT_MetaTileEntity_MultiBlockBase {  	public static boolean disableMaintenance;  	public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_InputBattery>(); @@ -77,16 +81,17 @@ public abstract class GregtechMeta_MultiBlockBase  	}  	@Override -	public boolean isCorrectMachinePart(ItemStack paramItemStack) { +	public boolean isCorrectMachinePart(final ItemStack paramItemStack) {  		return true;  	}  	@Override -	public int getDamageToComponent(ItemStack paramItemStack) { +	public int getDamageToComponent(final ItemStack paramItemStack) {  		return 0;  	} -	public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { +	@Override +	public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {  	}  	public void startProcess() { @@ -102,20 +107,23 @@ public abstract class GregtechMeta_MultiBlockBase  		int tValidOutputHatches = 0;  		for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { -			if (!isValidMetaTileEntity(tHatch)) +			if (!isValidMetaTileEntity(tHatch)) {  				continue; +			}  			int tEmptySlots = 0;  			boolean foundRoom = false;  			final IInventory tHatchInv = tHatch.getBaseMetaTileEntity(); -			for (int i = 0; i < tHatchInv.getSizeInventory() +			for (int i = 0; (i < tHatchInv.getSizeInventory())  					&& !foundRoom; ++i) { -				if (tHatchInv.getStackInSlot(i) != null) +				if (tHatchInv.getStackInSlot(i) != null) {  					continue; +				}  				tEmptySlots++; -				if (tEmptySlots < outputItemCount) +				if (tEmptySlots < outputItemCount) {  					continue; +				}  				tValidOutputHatches++;  				foundRoom = true; @@ -125,25 +133,25 @@ public abstract class GregtechMeta_MultiBlockBase  		return tValidOutputHatches;  	} -	public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe, -			float percentage) { +	public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe, +			final float percentage) {  		int cloneTime = 0;  		GT_Recipe baseRecipe;  		GT_Recipe cloneRecipe = null;  		baseRecipe = tRecipe.copy(); -		if (cloneRecipe != baseRecipe || cloneRecipe == null) { +		if ((cloneRecipe != baseRecipe) || (cloneRecipe == null)) {  			cloneRecipe = baseRecipe.copy();  			Utils.LOG_WARNING("Setting Recipe");  		} -		if (cloneTime != baseRecipe.mDuration || cloneTime == 0) { +		if ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0)) {  			cloneTime = baseRecipe.mDuration;  			Utils.LOG_WARNING("Setting Time");  		}  		if (cloneRecipe.mDuration > 0) { -			int originalTime = cloneRecipe.mDuration; -			int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, +			final int originalTime = cloneRecipe.mDuration; +			final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration,  					(100 - percentage));  			cloneRecipe.mDuration = tempTime;  			if (cloneRecipe.mDuration < originalTime) { @@ -162,8 +170,8 @@ public abstract class GregtechMeta_MultiBlockBase  	}  	@Override -	public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, -			long aTick) { +	public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, +			final long aTick) {  		super.onPostTick(aBaseMetaTileEntity, aTick);  		//this.mChargeHatches.clear();  		//this.mDischargeHatches.clear(); @@ -172,58 +180,71 @@ public abstract class GregtechMeta_MultiBlockBase  	@Override  	public void explodeMultiblock() {  		MetaTileEntity tTileEntity; -		for (Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches +		for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches  				.iterator(); localIterator.hasNext(); tTileEntity -						.getBaseMetaTileEntity() -						.doExplosion(gregtech.api.enums.GT_Values.V[8])) -			tTileEntity = (MetaTileEntity) localIterator.next(); +				.getBaseMetaTileEntity() +				.doExplosion(gregtech.api.enums.GT_Values.V[8])) { +			tTileEntity = localIterator.next(); +		}  		tTileEntity = null; -		for (Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches +		for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches  				.iterator(); localIterator.hasNext(); tTileEntity -						.getBaseMetaTileEntity() -						.doExplosion(gregtech.api.enums.GT_Values.V[8])) -			tTileEntity = (MetaTileEntity) localIterator.next(); +				.getBaseMetaTileEntity() +				.doExplosion(gregtech.api.enums.GT_Values.V[8])) { +			tTileEntity = localIterator.next(); +		}  		super.explodeMultiblock();  	} +	@Override  	public void updateSlots() { -		for (GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) -			if (isValidMetaTileEntity(tHatch)) +		for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) { +			if (isValidMetaTileEntity(tHatch)) {  				tHatch.updateSlots(); -		for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) -			if (isValidMetaTileEntity(tHatch)) +			} +		} +		for (final GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) { +			if (isValidMetaTileEntity(tHatch)) {  				tHatch.updateSlots(); +			} +		}  		super.updateSlots();  	} -	public boolean addToMachineList(IGregTechTileEntity aTileEntity, -			int aBaseCasingIndex) { -		if (aTileEntity == null) +	@Override +	public boolean addToMachineList(final IGregTechTileEntity aTileEntity, +			final int aBaseCasingIndex) { +		if (aTileEntity == null) {  			return false; -		IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); -		if (aMetaTileEntity == null) +		} +		final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +		if (aMetaTileEntity == null) {  			return false; -		 -		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) +		} + +		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {  			return this.mChargeHatches.add(  					(GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity); -		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) +		} +		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {  			return this.mDischargeHatches.add(  					(GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity); +		}  		return super.addToMachineList(aTileEntity, aBaseCasingIndex);  	} -	public boolean addChargeableToMachineList(IGregTechTileEntity aTileEntity, -			int aBaseCasingIndex) { +	public boolean addChargeableToMachineList(final IGregTechTileEntity aTileEntity, +			final int aBaseCasingIndex) {  		if (aTileEntity == null) {  			return false;  		} -		IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); -		if (aMetaTileEntity == null) +		final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +		if (aMetaTileEntity == null) {  			return false; +		}  		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {  			((GT_MetaTileEntity_Hatch) aMetaTileEntity) -					.updateTexture(aBaseCasingIndex); +			.updateTexture(aBaseCasingIndex);  			return this.mChargeHatches.add(  					(GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);  		} @@ -231,20 +252,53 @@ public abstract class GregtechMeta_MultiBlockBase  	}  	public boolean addDischargeableInputToMachineList( -			IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { +			final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {  		if (aTileEntity == null) {  			return false;  		} -		IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); -		if (aMetaTileEntity == null) +		final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +		if (aMetaTileEntity == null) {  			return false; +		}  		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {  			((GT_MetaTileEntity_Hatch) aMetaTileEntity) -					.updateTexture(aBaseCasingIndex); +			.updateTexture(aBaseCasingIndex);  			return this.mDischargeHatches.add(  					(GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);  		}  		return false;  	} + +	public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { +		if (aTileEntity == null) { +			return false; +		} +		final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +		if (aMetaTileEntity == null) { +			return false; +		} +		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { +			((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); +			((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); +			return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); +		} +		return false; +	} + +	public boolean addFluidOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { +		if (aTileEntity == null) { +			return false; +		} +		final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); +		if (aMetaTileEntity == null) { +			return false; +		} +		if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { +			((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); +			return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); +		} +		return false; +	} +  } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java new file mode 100644 index 0000000000..ebe26c8645 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/GTPP_WorldRegenerator.java @@ -0,0 +1,135 @@ +package gtPlusPlus.xmod.gregtech.common.command.regen; + +import java.util.HashSet; +import java.util.Random; + +import cpw.mods.fml.common.IWorldGenerator; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_Log; +import gregtech.api.world.GT_Worldgen; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; + +public class GTPP_WorldRegenerator implements IWorldGenerator { +	private static int mEndAsteroidProbability = 300; +	private static int mGCAsteroidProbability = 50; +	private static int mSize = 100; +	private static int endMinSize = 50; +	private static int endMaxSize = 200; +	private static int gcMinSize = 100; +	private static int gcMaxSize = 400; +	private static boolean endAsteroids = true; +	private static boolean gcAsteroids = true; + + +	public GTPP_WorldRegenerator() { +		GameRegistry.registerWorldGenerator(this, 1073741823); +	} + +	@Override +	public synchronized void generate(final Random aRandom, final int aX, final int aZ, final World aWorld, final IChunkProvider aChunkGenerator, final IChunkProvider aChunkProvider) { +		int tempDimensionId = aWorld.provider.dimensionId; +		if ((tempDimensionId != -1) && (tempDimensionId != 1) && !aChunkGenerator.getClass().getName().contains("galacticraft")) { +			tempDimensionId = 0; +		} +		new WorldGenContainer(aX * 16, aZ * 16, tempDimensionId, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords((aX * 16) + 8, (aZ * 16) + 8).biomeName).run(); +	} + +	public static class WorldGenContainer implements Runnable { +		public int mX; +		public int mZ; +		public final int mDimensionType; +		public final World mWorld; +		public final IChunkProvider mChunkGenerator; +		public final IChunkProvider mChunkProvider; +		public final String mBiome; +		public static HashSet<ChunkCoordIntPair> mGenerated = new HashSet<>(2000); + +		public WorldGenContainer(final int aX, final int aZ, final int aDimensionType, final World aWorld, final IChunkProvider aChunkGenerator, final IChunkProvider aChunkProvider, final String aBiome) { +			this.mX = aX; +			this.mZ = aZ; +			this.mDimensionType = aDimensionType; +			this.mWorld = aWorld; +			this.mChunkGenerator = aChunkGenerator; +			this.mChunkProvider = aChunkProvider; +			this.mBiome = aBiome; +		} + +		//returns a coordinate of a center chunk of 3x3 square; the argument belongs to this square +		public int getVeinCenterCoordinate(int c) { +			c += c < 0 ? 1 : 3; +			return c - (c % 3) - 2; +		} + +		public boolean surroundingChunksLoaded(final int xCenter, final int zCenter) { +			return this.mWorld.checkChunksExist(xCenter - 16, 0, zCenter - 16, xCenter + 16, 0, zCenter + 16); +		} + +		public Random getRandom(final int xChunk, final int zChunk) { +			final long worldSeed = this.mWorld.getSeed(); +			final Random fmlRandom = new Random(worldSeed); +			final long xSeed = fmlRandom.nextLong() >> (2 + 1L); +			final long zSeed = fmlRandom.nextLong() >> (2 + 1L); +			final long chunkSeed = ((xSeed * xChunk) + (zSeed * zChunk)) ^ worldSeed; +			fmlRandom.setSeed(chunkSeed); +			return new XSTR(fmlRandom.nextInt()); +		} + +		@Override +		public void run() { +			int xCenter = this.getVeinCenterCoordinate(this.mX >> 4); +			int zCenter = this.getVeinCenterCoordinate(this.mZ >> 4); +			final Random random = this.getRandom(xCenter, zCenter); +			xCenter <<= 4; +			zCenter <<= 4; +			final ChunkCoordIntPair centerChunk = new ChunkCoordIntPair(xCenter, zCenter); +			if (!mGenerated.contains(centerChunk) && this.surroundingChunksLoaded(xCenter, zCenter)) { +				mGenerated.add(centerChunk); +				if ((GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) { +					boolean temp = true; +					int tRandomWeight; +					for (int i = 0; (i < 256) && (temp); i++) { +						tRandomWeight = random.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight); +						for (final GT_Worldgen tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) { +							tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer) tWorldGen).mWeight; +							if (tRandomWeight <= 0) { +								try { +									if (tWorldGen.executeWorldgen(this.mWorld, random, this.mBiome, this.mDimensionType, xCenter, zCenter, this.mChunkGenerator, this.mChunkProvider)) { +										temp = false; +									} +									break; +								} catch (final Throwable e) { +									e.printStackTrace(GT_Log.err); +								} +							} +						} +					} +				} +				int i = 0; +				for (int tX = xCenter - 16; i < 3; tX += 16) { +					int j = 0; +					for (int tZ = zCenter - 16; j < 3; tZ += 16) { +						try { +							for (final GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { +								tWorldGen.executeWorldgen(this.mWorld, random, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider); +							} +						} catch (final Throwable e) { +							e.printStackTrace(GT_Log.err); +						} +						j++; +					} +					i++; +				} +			} +			final Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ); +			if (tChunk != null) { +				tChunk.isModified = true; +			} +		} +	} +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java new file mode 100644 index 0000000000..6e3d4fda93 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/command/regen/HANDLER_GT_Commands.java @@ -0,0 +1,129 @@ +package gtPlusPlus.xmod.gregtech.common.command.regen; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import bloodasp.galacticgreg.GT_Worldgenerator_Space; +import cpw.mods.fml.common.Loader; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.Materials; +import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; +import gregtech.common.GT_Worldgen_Stone; +import gregtech.common.GT_Worldgenerator; + +public class HANDLER_GT_Commands { + +	public static void preInit(){ + +	} + +	public static void init(){ + +	} + +	public static void postInit(){ +		final boolean tPFAA = (GregTech_API.sWorldgenFile.get(ConfigCategories.general, "AutoDetectPFAA", true)) && (Loader.isModLoaded("PFAAGeologica")); +		new GT_Worldgenerator(); +		if (Loader.isModLoaded("GalacticraftCore") && Loader.isModLoaded("GalacticraftMars")) { +			new GT_Worldgenerator_Space(); +		} + +		new GT_Worldgen_Stone("overworld.stone.blackgranite.tiny", true, GregTech_API.sBlockGranites, 0, 0, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.blackgranite.small", true, GregTech_API.sBlockGranites, 0, 0, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.blackgranite.medium", true, GregTech_API.sBlockGranites, 0, 0, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.blackgranite.large", true, GregTech_API.sBlockGranites, 0, 0, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.blackgranite.huge", true, GregTech_API.sBlockGranites, 0, 0, 1, 400, 240, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.redgranite.tiny", true, GregTech_API.sBlockGranites, 8, 0, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.redgranite.small", true, GregTech_API.sBlockGranites, 8, 0, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.redgranite.medium", true, GregTech_API.sBlockGranites, 8, 0, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.redgranite.large", true, GregTech_API.sBlockGranites, 8, 0, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.redgranite.huge", true, GregTech_API.sBlockGranites, 8, 0, 1, 400, 240, 0, 120, null, false); + +		new GT_Worldgen_Stone("nether.stone.blackgranite.tiny", false, GregTech_API.sBlockGranites, 0, -1, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.blackgranite.small", false, GregTech_API.sBlockGranites, 0, -1, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.blackgranite.medium", false, GregTech_API.sBlockGranites, 0, -1, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.blackgranite.large", false, GregTech_API.sBlockGranites, 0, -1, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.blackgranite.huge", false, GregTech_API.sBlockGranites, 0, -1, 1, 400, 240, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.redgranite.tiny", false, GregTech_API.sBlockGranites, 8, -1, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.redgranite.small", false, GregTech_API.sBlockGranites, 8, -1, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.redgranite.medium", false, GregTech_API.sBlockGranites, 8, -1, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.redgranite.large", false, GregTech_API.sBlockGranites, 8, -1, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.redgranite.huge", false, GregTech_API.sBlockGranites, 8, -1, 1, 400, 240, 0, 120, null, false); + +		new GT_Worldgen_Stone("overworld.stone.marble.tiny", true, GregTech_API.sBlockStones, 0, 0, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.marble.small", true, GregTech_API.sBlockStones, 0, 0, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.marble.medium", true, GregTech_API.sBlockStones, 0, 0, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.marble.large", true, GregTech_API.sBlockStones, 0, 0, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.marble.huge", true, GregTech_API.sBlockStones, 0, 0, 1, 400, 240, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.basalt.tiny", true, GregTech_API.sBlockStones, 8, 0, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.basalt.small", true, GregTech_API.sBlockStones, 8, 0, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.basalt.medium", true, GregTech_API.sBlockStones, 8, 0, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.basalt.large", true, GregTech_API.sBlockStones, 8, 0, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("overworld.stone.basalt.huge", true, GregTech_API.sBlockStones, 8, 0, 1, 400, 240, 0, 120, null, false); + +		new GT_Worldgen_Stone("nether.stone.marble.tiny", false, GregTech_API.sBlockStones, 0, -1, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.marble.small", false, GregTech_API.sBlockStones, 0, -1, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.marble.medium", false, GregTech_API.sBlockStones, 0, -1, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.marble.large", false, GregTech_API.sBlockStones, 0, -1, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.marble.huge", false, GregTech_API.sBlockStones, 0, -1, 1, 400, 240, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.basalt.tiny", false, GregTech_API.sBlockStones, 8, -1, 1, 50, 48, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.basalt.small", false, GregTech_API.sBlockStones, 8, -1, 1, 100, 96, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.basalt.medium", false, GregTech_API.sBlockStones, 8, -1, 1, 200, 144, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.basalt.large", false, GregTech_API.sBlockStones, 8, -1, 1, 300, 192, 0, 120, null, false); +		new GT_Worldgen_Stone("nether.stone.basalt.huge", false, GregTech_API.sBlockStones, 8, -1, 1, 400, 240, 0, 120, null, false); + +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.copper", true, 60, 120, 32, !tPFAA, true, true, true, true, false, Materials.Copper); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tin", true, 60, 120, 32, !tPFAA, true, true, true, true, true, Materials.Tin); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bismuth", true, 80, 120, 8, !tPFAA, true, false, true, true, false, Materials.Bismuth); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.coal", true, 60, 100, 24, !tPFAA, false, false, false, false, false, Materials.Coal); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iron", true, 40, 80, 16, !tPFAA, true, true, true, true, false, Materials.Iron); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.lead", true, 40, 80, 16, !tPFAA, true, true, true, true, true, Materials.Lead); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.zinc", true, 30, 60, 12, !tPFAA, true, true, true, true, false, Materials.Zinc); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.gold", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Gold); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.silver", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Silver); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.nickel", true, 20, 40, 8, !tPFAA, true, true, true, true, true, Materials.Nickel); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.lapis", true, 20, 40, 4, !tPFAA, false, false, true, false, true, Materials.Lapis); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.diamond", true, 5, 10, 2, !tPFAA, true, false, true, true, true, Materials.Diamond); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.emerald", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Emerald); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.ruby", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Ruby); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sapphire", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Sapphire); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.greensapphire", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GreenSapphire); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.olivine", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Olivine); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.topaz", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Topaz); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tanzanite", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Tanzanite); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amethyst", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Amethyst); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.opal", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Opal); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.jasper", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Jasper); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bluetopaz", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.BlueTopaz); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amber", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.Amber); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.foolsruby", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.FoolsRuby); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetred", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GarnetRed); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetyellow", true, 5, 250, 1, !tPFAA, true, false, false, true, true, Materials.GarnetYellow); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.redstone", true, 5, 20, 8, !tPFAA, true, false, true, true, true, Materials.Redstone); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.platinum", true, 20, 40, 8, false, false, true, false, true, true, Materials.Platinum); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iridium", true, 20, 40, 8, false, false, true, false, true, true, Materials.Iridium); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.netherquartz", true, 30, 120, 64, false, true, false, false, false, false, Materials.NetherQuartz); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.saltpeter", true, 10, 60, 8, false, true, false, false, false, false, Materials.Saltpeter); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sulfur_n", true, 10, 60, 32, false, true, false, false, false, false, Materials.Sulfur); +		new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sulfur_o", true, 5, 15, 8, !tPFAA, false, false, false, false, false, Materials.Sulfur); + +		int i = 0; +		for (final int j = GregTech_API.sWorldgenFile.get("worldgen", "AmountOfCustomSmallOreSlots", 16); i < j; i++) { +			new GT_Worldgen_GT_Ore_SmallPieces("ore.small.custom." + (i < 10 ? "0" : "") + i, false, 0, 0, 0, false, false, false, false, false, false, Materials._NULL); +		} +		if (GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes) { +			Class<?> rC; +			try { +				rC = Class.forName("blusunrize.immersiveengineering.api.tool.ExcavatorHandler"); +				final Method method = rC.getMethod("recalculateChances", new Class[]{boolean.class}); +				method.invoke(null, true); +			} +			catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { +			} +		} +	} + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 647b4c8a2a..bdb514ba84 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -10,7 +10,6 @@ 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.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;  import gregtech.api.objects.GT_RenderedTexture;  import gregtech.api.util.GT_Recipe;  import gregtech.api.util.GT_Utility; @@ -18,13 +17,14 @@ import gregtech.api.util.Recipe_GT;  import gtPlusPlus.core.block.ModBlocks;  import gtPlusPlus.core.lib.CORE;  import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;  import net.minecraft.entity.player.InventoryPlayer;  import net.minecraft.item.ItemStack;  import net.minecraftforge.common.util.ForgeDirection;  import net.minecraftforge.fluids.FluidStack;  public class GregtechMetaTileEntity_AlloyBlastSmelter -extends GT_MetaTileEntity_MultiBlockBase { +extends GregtechMeta_MultiBlockBase {  	private int mHeatingCapacity = 0;  	public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { @@ -55,6 +55,7 @@ extends GT_MetaTileEntity_MultiBlockBase {  				"1x Energy Hatch (one of bottom)",  				"1x Maintenance Hatch (one of bottom)",  				"1x Muffler Hatch (top middle)", +				"1x Fluid Input Hatch (optional, top layer)",  				"Blast Smelter Casings for the rest",  				CORE.GT_Tooltip};  	} @@ -81,17 +82,19 @@ extends GT_MetaTileEntity_MultiBlockBase {  	public boolean isCorrectMachinePart(final ItemStack aStack) {  		return true;  	} -	 -	public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { -        super.startSoundLoop(aIndex, aX, aY, aZ); -        if (aIndex == 1) { -            GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ); -        } -    } -    public void startProcess() { -        sendLoopStart((byte) 1); -    } +	@Override +	public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { +		super.startSoundLoop(aIndex, aX, aY, aZ); +		if (aIndex == 1) { +			GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ); +		} +	} + +	@Override +	public void startProcess() { +		this.sendLoopStart((byte) 1); +	}  	@Override  	public boolean isFacingValid(final byte aFacing) { @@ -192,11 +195,13 @@ extends GT_MetaTileEntity_MultiBlockBase {  					if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) {  						return false;  					} -					if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { -						return false; -					} -					if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { -						return false; +					if (!this.addFluidInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 11)) { +						if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { +							return false; +						} +						if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { +							return false; +						}  					}  				}  			} @@ -218,11 +223,11 @@ extends GT_MetaTileEntity_MultiBlockBase {  		}  		this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2); -		if (	this.mMaintenanceHatches.size() != 1 ||  -				this.mMufflerHatches.size() != 1 ||  -				this.mInputBusses.size() < 1 ||  -				this.mOutputHatches.size() < 1 ||  -				this.mEnergyHatches.size() != 1 )  { +		if (	(this.mMaintenanceHatches.size() != 1) || +				(this.mMufflerHatches.size() != 1) || +				(this.mInputBusses.size() < 1) || +				(this.mOutputHatches.size() < 1) || +				(this.mEnergyHatches.size() != 1) )  {  			return false;  		} @@ -244,6 +249,7 @@ extends GT_MetaTileEntity_MultiBlockBase {  		return 0;  	} +	@Override  	public int getAmountOfOutputs() {  		return 2;  	} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index d66649850a..6d1da0881e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -4,13 +4,19 @@ import java.util.ArrayList;  import gregtech.api.enums.GT_Values;  import gregtech.api.enums.ItemList; +import gtPlusPlus.core.item.ModItems;  import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.*; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack;  import gtPlusPlus.core.material.nuclear.FLUORIDES;  import gtPlusPlus.core.material.nuclear.NUCLIDE; +import gtPlusPlus.core.material.state.MaterialState;  import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils;  import gtPlusPlus.core.util.item.ItemUtils;  import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack;  public class RecipeGen_BlastSmelter  implements Runnable{ @@ -87,10 +93,10 @@ public class RecipeGen_BlastSmelter  implements Runnable{  			}  			if (duration <= 0){ -				int second = 20; +				final int second = 20;  				duration = 14*second*mMaterialListSize;  			} -			 +  			Utils.LOG_WARNING("[BAS] Size: "+mMaterialListSize); @@ -125,7 +131,7 @@ public class RecipeGen_BlastSmelter  implements Runnable{  						}  						if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){  							Utils.LOG_WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); -						}						 +						}  					}  				}  				else { @@ -189,11 +195,21 @@ public class RecipeGen_BlastSmelter  implements Runnable{  						//Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier  						components = new ItemStack[9];  						inputStackCount=0; +						FluidStack componentsFluid = null;  						for (int irc=0;irc<M.getComposites().size();irc++){  							if (M.getComposites().get(irc) != null){  								final int r = (int) M.vSmallestRatio[irc];  								inputStackCount = inputStackCount+r; -								components[irc] = M.getComposites().get(irc).getDustStack(r); +								if ((M.getComposites().get(irc).getStackMaterial().getState() != MaterialState.SOLID) && ((M.getComposites().get(irc).getDustStack(r) == null) || (M.getComposites().get(irc).getDustStack(r) == ItemUtils.getSimpleStack(ModItems.AAA_Broken)))){ +									final int xr = M.getComposites().get(irc).getPartsPerOneHundred(); +									if ((xr > 0) && (xr <= 100)){ +										final int mathmatics = (xr <= 10 ? 1000 : ((xr/10)*1000)); +										componentsFluid = FluidUtils.getFluidStack(M.getComposites().get(irc).getStackMaterial().getFluid(mathmatics), mathmatics); +									} +								} +								else { +									components[irc] = M.getComposites().get(irc).getDustStack(r); +								}  							}  						} @@ -230,7 +246,7 @@ public class RecipeGen_BlastSmelter  implements Runnable{  						//Adds Recipe  						if (M.requiresBlastFurnace()) { -							if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){ +							if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 500)){  								Utils.LOG_WARNING("[BAS] Success.");  							}  							else { @@ -238,7 +254,7 @@ public class RecipeGen_BlastSmelter  implements Runnable{  							}  						}  						else { -							if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){ +							if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 240)){  								Utils.LOG_WARNING("[BAS] Success.");  							}  							else { | 
