diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
8 files changed, 431 insertions, 117 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 53bb8d8410..9e62d05df2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -453,7 +453,11 @@ public enum GregtechItemList implements GregtechItemContainer { //Elemental Duplicator Data Orb Bus Hatch_Input_Elemental_Duplicator, - + + //RTG Hatch + Hatch_RTG_LV, + Hatch_RTG_MV, + Hatch_RTG_HV, //Battery hatches for PSS Hatch_Input_Battery_MV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index bf36b56015..229bc234e9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -293,6 +293,9 @@ public interface IGregtech_RecipeAdder { public boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU); public boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU); - + public boolean addpackagerRecipe(ItemStack aRecipeType, ItemStack aInput1, ItemStack aInput2, ItemStack aOutputStack1); + + public boolean addFuelForRTG(ItemStack aFuelPellet, int aFuelDays, int aVoltage); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java new file mode 100644 index 0000000000..7b52b9449f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java @@ -0,0 +1,282 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import static gregtech.api.enums.GT_Values.V; + +import java.lang.reflect.Constructor; +import java.util.HashMap; + +import gregtech.api.gui.GT_Container_3by3; +import gregtech.api.gui.GT_GUIContainer_3by3; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_Energy { + + public GT_MetaTileEntity_Hatch_Energy_RTG(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_Energy_RTG(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_Hatch_Energy_RTG(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + return super.getDescription(); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, TexturesGtBlock.getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_On, new short[] {220, 220, 220, 0})}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, TexturesGtBlock.getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_Off, new short[] {220, 220, 220, 0})}; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isEnetInput() { + return false; + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @Override + public long getMinimumStoredEU() { + return 0; + } + + @Override + public long maxEUInput() { + return V[mTier]; + } + + @Override + public long maxEUStore() { + return Long.MAX_VALUE / (Short.MAX_VALUE * Byte.MAX_VALUE) ; + } + + @Override + public long maxAmperesIn() { + return 0; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + Constructor aCon = ReflectionUtils.getConstructor(this.getClass(), new Class[] {String.class, int.class, int.class, String[].class, ITexture[][][].class}); + Object aInst = ReflectionUtils.createNewInstanceFromConstructor(aCon, new Object[] {mName, mTier, 9, mDescriptionArray, mTextures}); + if (GT_MetaTileEntity_Hatch_Energy_RTG.class.isInstance(aInst)) { + return (MetaTileEntity) aInst; + } + Logger.INFO("Created bad sized RTG hatch."); + return new GT_MetaTileEntity_Hatch_Energy_RTG(mName, mTier, mDescriptionArray, mTextures); + } + + @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 true; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, "RTG Power Unit"); + } + + private static class Dat { + + protected final String mUniqueDataTag; + private final ItemStack mStack; + private final NBTTagCompound mNBT; + + public Dat(ItemStack aStack) { + mStack = aStack; + mNBT = (aStack.getTagCompound() != null ? aStack.getTagCompound() : new NBTTagCompound()); + mUniqueDataTag = ""+Item.getIdFromItem(aStack.getItem())+""+aStack.getItemDamage()+""+1+""+mNBT.getId(); + } + + public int getKey() { + return Item.getIdFromItem(mStack.getItem())+mStack.getItemDamage(); + } + + } + + private static final HashMap<String, ItemStack> mFuelInstanceMap = new HashMap<String, ItemStack>(); + private static final HashMap<String, Long> mFuelValueMap = new HashMap<String, Long>(); + private static final HashMap<String, Integer> mFuelTypeMap = new HashMap<String, Integer>(); + private static final HashMap<Integer, String> mFuelTypeMapReverse = new HashMap<Integer, String>(); + + public static boolean registerPelletForHatch(ItemStack aStack, long aFuelValue) { + if (!ItemUtils.checkForInvalidItems(aStack)) { + return false; + } + ItemStack aTemp = aStack.copy(); + aTemp.stackSize = 1; + Dat aDat = new Dat(aTemp); + String aKey = aDat.mUniqueDataTag; + mFuelInstanceMap.put(aKey, aTemp); + mFuelValueMap.put(aKey, aFuelValue); + mFuelTypeMap.put(aKey, aDat.getKey()); + mFuelTypeMapReverse.put(aDat.getKey(), aKey); + Logger.INFO("RTG Hatch: Registered Fuel Pellet: "+ItemUtils.getItemName(aTemp)+", Fuel Value: "+aFuelValue+", Key: "+aKey+", Key2: "+aDat.getKey()); + return true; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { + InventoryUtils.sortInventoryItems(this); + } + if (aTimer % 100 == 0 && aBaseMetaTileEntity.isServerSide()) { + if (hasPellet(this)) { + Logger.INFO("Has Pellet"); + tryConsumePellet(this); + } + } + } + + private static void tryConsumePellet(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { + ItemStack aPellet = getPelletToConsume(aTile); + if (aPellet != null) { + Logger.INFO("Found Pellet"); + long aFuel = getFuelValueOfPellet(aPellet); + if (aFuel > 0) { + Logger.INFO("Has Fuel Value: "+aFuel); + if (hasSpaceForEnergy(aTile, aFuel)) { + Logger.INFO("Can buffer"); + aPellet.stackSize = 0; + Logger.INFO("Stack set to 0"); + aPellet = null; + Logger.INFO("null stack"); + addEnergyToInternalStorage(aTile, aFuel); + Logger.INFO("Consumed"); + } + } + } + aTile.updateSlots(); + Logger.INFO("updating slots"); + } + + private static void addEnergyToInternalStorage(GT_MetaTileEntity_Hatch_Energy_RTG aTile, long aFuel) { + aTile.getBaseMetaTileEntity().increaseStoredEnergyUnits(aFuel, true); + } + + public static boolean hasSpaceForEnergy(GT_MetaTileEntity_Hatch_Energy_RTG aTile, long aAmount) { + long aMax = aTile.maxEUStore(); + long aCurrent = aTile.getEUVar(); + if ((aMax - aCurrent) >= aAmount) { + return true; + } + return false; + } + + public void updateSlots() { + for (int i = 0; i < mInventory.length; i++) { + if (mInventory[i] != null && mInventory[i].stackSize <= 0) { + mInventory[i] = null; + } + } + InventoryUtils.sortInventoryItems(this); + } + + public static boolean hasPellet(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { + for (ItemStack o : aTile.mInventory) { + if (o != null ) { + for (ItemStack i : mFuelInstanceMap.values()) { + if (ItemUtils.areItemsEqual(o, i)) { + return true; + } + } + } + } + return false; + } + + public static String getPelletType(ItemStack o) { + if (o == null) { + return "error"; + } + Dat aDat = new Dat(o); + return mFuelTypeMapReverse.get(aDat.getKey()); + } + + public static long getFuelValueOfPellet(ItemStack aPellet) { + String aType = getPelletType(aPellet); + if (mFuelValueMap.containsKey(aType)) { + return mFuelValueMap.get(aType); + } + return 0; + } + + public static ItemStack getPelletToConsume(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { + for (ItemStack o : aTile.mInventory) { + if (o != null ) { + for (ItemStack i : mFuelInstanceMap.values()) { + if (ItemUtils.areItemsEqual(o, i)) { + return o; + } + } + } + } + return null; + } + + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 07fd2fe82b..8b181a05f4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -99,6 +99,10 @@ public class TexturesGtBlock { } } + public static GT_RenderedTexture getTextureFromIcon(CustomIcon aIcon, short[] aRGB) { + return new GT_RenderedTexture(aIcon, aRGB); + } + /* * Add Some Custom Textures below. * I am not sure whether or not I need to declare them as such, but better to be safe than sorry. @@ -397,7 +401,11 @@ public class TexturesGtBlock { // Catalyst Bus private static final CustomIcon Internal_Overlay_Bus_Catalyst = new CustomIcon("iconsets/OVERLAY_CATALYSTS"); public static final CustomIcon Overlay_Bus_Catalyst = Internal_Overlay_Bus_Catalyst; - + // RTG Hatch + private static final CustomIcon Internal_Overlay_Hatch_RTG_Off = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_OFF"); + public static final CustomIcon Overlay_Hatch_RTG_Off = Internal_Overlay_Hatch_RTG_Off; + private static final CustomIcon Internal_Overlay_Hatch_RTG_On = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_ON"); + public static final CustomIcon Overlay_Hatch_RTG_On = Internal_Overlay_Hatch_RTG_On; //Dimensional private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index de16a247b0..ce8b6eaf62 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -201,46 +201,13 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.Pellet_RTG_SR90.set(this.addItem(42, StringUtils.superscript("90")+"Sr Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); GregtechItemList.Pellet_RTG_PO210.set(this.addItem(43, StringUtils.superscript("210")+"Po Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); GregtechItemList.Pellet_RTG_AM241.set(this.addItem(44, StringUtils.superscript("241")+"Am Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); - GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.addRecipe( - true, - new ItemStack[]{GregtechItemList.Pellet_RTG_PU238.get(1)}, - new ItemStack[]{}, - null, - null, - null, - 0, - 64, - MathUtils.roundToClosestInt(87.7f)); - GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.addRecipe( - true, - new ItemStack[]{GregtechItemList.Pellet_RTG_SR90.get(1)}, - new ItemStack[]{}, - null, - null, - null, - 0, - 32, - MathUtils.roundToClosestInt(28.8f)); - GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.addRecipe( - true, - new ItemStack[]{GregtechItemList.Pellet_RTG_PO210.get(1)}, - new ItemStack[]{}, - null, - null, - null, - 0, - 512, - MathUtils.roundToClosestInt(1f)); - GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.addRecipe( - true, - new ItemStack[]{GregtechItemList.Pellet_RTG_AM241.get(1)}, - new ItemStack[]{}, - null, - null, - null, - 0, - 16, - MathUtils.roundToClosestInt(432/2)); + + CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PU238.get(1), MathUtils.roundToClosestInt(87.7f), 64); + CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_SR90.get(1), MathUtils.roundToClosestInt(28.8f), 32); + CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_PO210.get(1), 1, 512); + CORE.RA.addFuelForRTG(GregtechItemList.Pellet_RTG_AM241.get(1), MathUtils.roundToClosestInt(432/2), 16); + CORE.RA.addFuelForRTG(GT_ModHandler.getIC2Item("RTGPellets", 1), MathUtils.roundToClosestInt(2.6f), 8); + //Computer Cube GregtechItemList.Gregtech_Computer_Cube.set(this.addItem(tLastID = 55, "Gregtech Computer Cube", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)})); this.setElectricStats(32000 + tLastID, GT_Values.V[6]* 10 * 60 * 20, GT_Values.V[5], 5L, -3L, true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index eca02d290e..10286411a7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -2,9 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc; import java.util.ArrayList; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,13 +12,13 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemStackData; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index f372baff30..1f41bf84e3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -26,8 +26,10 @@ import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy_RTG; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler; +import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntity_RTG; import gtPlusPlus.xmod.gregtech.recipes.machines.RECIPEHANDLER_MatterFabricator; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -96,7 +98,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { e.getStackTrace(); } try { - + GTPP_Recipe aSpecialRecipe = new GTPP_Recipe( true, new ItemStack[] { aInput1, aInput2 }, @@ -113,8 +115,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { int aSize2 = aSize; GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes.add(aSpecialRecipe); aSize = GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes.mRecipeList.size(); - - + + // RECIPEHANDLER_CokeOven.debug4(aInput1, aInput2, aFluidInput, // aFluidOutput, aOutput, aDuration, aEUt); /*if (aFluidInput == null && aInput2 != null) { @@ -398,7 +400,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { if (aFluidOutput != null) { Logger.WARNING("Recipe will output: " + aFluidOutput.getFluid().getName()); } - + GTPP_Recipe aSpecialRecipe = new GTPP_Recipe( true, aInput, @@ -421,7 +423,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { GTPP_Recipe.GTPP_Recipe_Map.sChemicalDehydratorRecipes.addRecipe(true, aInput, aOutputItems, null, aChances, new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, aDuration, aEUt, 0); - + } else { Logger.WARNING("Dehydrator recipe has two input items."); @@ -513,7 +515,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { /*GTPP_Recipe.GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.addRecipe(true, aInput, aOutputStack, null, aChance, new FluidStack[] { aInputFluid }, new FluidStack[] { aOutput }, aDuration, aEUt, aSpecialValue);*/ - + return aSize > aSize2; } @@ -569,7 +571,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { int aSize2 = aSize; GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing.add(aSpecialRecipe); aSize = GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing.mRecipeList.size(); - + if (aSize > aSize2) { Logger.INFO("Added Nuclear Fuel Recipe."); return true; @@ -607,7 +609,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { int aSize2 = aSize; GTPP_Recipe.GTPP_Recipe_Map.sCyclotronRecipes.add(aSpecialRecipe); aSize = GTPP_Recipe.GTPP_Recipe_Map.sCyclotronRecipes.mRecipeList.size(); - + if (aSize > aSize2) { Logger.INFO("Added Cyclotron Recipe."); return true; @@ -648,12 +650,12 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { int aSize2 = aSize; GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.add(aSpecialRecipe); aSize = GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.mRecipeList.size(); - + /*GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.addRecipe(true, new ItemStack[] { aInput1, aInput2, aInput3, aInput4 }, new ItemStack[] { aOutput1, aOutput2, aOutput3, aOutput4 }, null, null, new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, aDuration, aEUt, 0);*/ - + return aSize > aSize2; } @@ -715,7 +717,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { aEUtick, aSpecial); GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.addRecipe(aRecipe); - + //GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes.addRecipe(true, aInputs, aOutputs, null, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUtick, aSpecial); return true; } @@ -1660,6 +1662,46 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return aSize > aSize2; } + @Override + public boolean addpackagerRecipe(ItemStack aRecipeType, ItemStack aSmallDust, ItemStack aTinyDust, ItemStack aOutputStack1) { + AutoMap<Boolean> aResults = new AutoMap<Boolean>(); + //Dust 1 + aResults.put(GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(4L, new Object[]{aSmallDust}), aRecipeType, aOutputStack1, 100, 4)); + //Dust 2 + aResults.put(GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(9L, new Object[]{aTinyDust}), aRecipeType, aOutputStack1, 100, 4)); + for (boolean b : aResults) { + if (!b) { + return false; + } + } + return true; + } + + @Override + public boolean addFuelForRTG(ItemStack aFuelPellet, int aFuelDays, int aVoltage) { + int aSize1 = GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.mRecipeList.size(); + GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.addRecipe( + true, + new ItemStack[]{aFuelPellet}, + new ItemStack[]{}, + null, + null, + null, + 0, + aVoltage, + aFuelDays); + int aSize2 = GTPP_Recipe.GTPP_Recipe_Map.sRTGFuels.mRecipeList.size(); + + if (aSize2 > aSize1) { + long eu = GregtechMetaTileEntity_RTG.getTotalEUGenerated(GregtechMetaTileEntity_RTG.convertDaysToTicks(aFuelDays), aVoltage); + GT_MetaTileEntity_Hatch_Energy_RTG.registerPelletForHatch(aFuelPellet, eu); + return true; + } + else { + return false; + } + } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 677a47639c..c748da5d3c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -7,14 +7,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_TurbineProvider; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.*; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; public class GregtechCustomHatches { @@ -27,6 +22,7 @@ public class GregtechCustomHatches { run2(); } run3(); + run4(); } } @@ -70,10 +66,10 @@ public class GregtechCustomHatches { // Multiblock Control Core Bus GregtechItemList.Hatch_Control_Core.set((new GT_MetaTileEntity_Hatch_ControlCore(30020, "hatch.control.adv", "Control Core Module", 1)).getStackForm(1L)); - + // Multiblock Air Intake Hatch GregtechItemList.Hatch_Air_Intake.set(new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5).getStackForm(1L)); - + // Steam Hatch GregtechItemList.Hatch_Input_Steam .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getSteam(1).getFluid(), // Fluid @@ -86,10 +82,10 @@ public class GregtechCustomHatches { "hatch.steam.input.tier.00", // unlocal name "Steam Hatch" // Local name ).getStackForm(1L)); - - - - + + + + } @@ -125,86 +121,86 @@ public class GregtechCustomHatches { private static void run3() { - - + + /* * Super Input Busses */ - + int aStartID = 30021; Class aGT_MetaTileEntity_SuperBus_Input = GT_MetaTileEntity_SuperBus_Input.class; Class aGT_MetaTileEntity_SuperBus_Output = GT_MetaTileEntity_SuperBus_Output.class; - + GregtechItemList.Hatch_SuperBus_Input_ULV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.00", "Super Bus (I) (ULV)", 0)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.00", "Super Bus (I) (ULV)", 0)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_LV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.01", "Super Bus (I) (LV)", 1)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.01", "Super Bus (I) (LV)", 1)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_MV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.02", "Super Bus (I) (MV)", 2)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.02", "Super Bus (I) (MV)", 2)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_HV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.03", "Super Bus (I) (HV)", 3)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.03", "Super Bus (I) (HV)", 3)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_EV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.04", "Super Bus (I) (EV)", 4)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.04", "Super Bus (I) (EV)", 4)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_IV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.05", "Super Bus (I) (IV)", 5)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.05", "Super Bus (I) (IV)", 5)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_LuV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.06", "Super Bus (I) (LuV)", 6)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.06", "Super Bus (I) (LuV)", 6)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_ZPM - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.07", "Super Bus (I) (ZPM)", 7)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.07", "Super Bus (I) (ZPM)", 7)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_UV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.08", "Super Bus (I) (UV)", 8)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.08", "Super Bus (I) (UV)", 8)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Input_MAX - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.09", "Super Bus (I) (MAX)", 9)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Input, aStartID++, "hatch.superbus.input.tier.09", "Super Bus (I) (MAX)", 9)) + .getStackForm(1L)); /* * Super Output Busses */ GregtechItemList.Hatch_SuperBus_Output_ULV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.00", "Super Bus (O) (ULV)", 0)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.00", "Super Bus (O) (ULV)", 0)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_LV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.01", "Super Bus (O) (LV)", 1)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.01", "Super Bus (O) (LV)", 1)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_MV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.02", "Super Bus (O) (MV)", 2)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.02", "Super Bus (O) (MV)", 2)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_HV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.03", "Super Bus (O) (HV)", 3)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.03", "Super Bus (O) (HV)", 3)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_EV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.04", "Super Bus (O) (EV)", 4)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.04", "Super Bus (O) (EV)", 4)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_IV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.05", "Super Bus (O) (IV)", 5)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.05", "Super Bus (O) (IV)", 5)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_LuV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.06", "Super Bus (O) (LuV)", 6)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.06", "Super Bus (O) (LuV)", 6)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_ZPM - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.07", "Super Bus (O) (ZPM)", 7)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.07", "Super Bus (O) (ZPM)", 7)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_UV - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.08", "Super Bus (O) (UV)", 8)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.08", "Super Bus (O) (UV)", 8)) + .getStackForm(1L)); GregtechItemList.Hatch_SuperBus_Output_MAX - .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.09", "Super Bus (O) (MAX)", 9)) - .getStackForm(1L)); + .set(((IMetaTileEntity) generateBus(aGT_MetaTileEntity_SuperBus_Output, aStartID++, "hatch.superbus.output.tier.09", "Super Bus (O) (MAX)", 9)) + .getStackForm(1L)); } - + private static Object generateBus(Class aClass, int aID, String aUnlocalName, String aLocalName, int aTier) { Class<?> aBusEntity = aClass; Constructor<?> constructor; @@ -238,4 +234,19 @@ public class GregtechCustomHatches { return null; } + + private static void run4() { + int aID = 31060; + //41, "hatch.energy.tier.01", "LV Energy Hatch", 1 + Constructor aRTG = ReflectionUtils.getConstructor(GT_MetaTileEntity_Hatch_Energy_RTG.class, new Class[] {int.class, String.class, String.class, int.class, int.class}); + Object aHatch1 = ReflectionUtils.createNewInstanceFromConstructor(aRTG, new Object[] {aID++, "hatch.energy.rtg.tier.01", "RTG Power Unit [LV]", 1, 9}); + Object aHatch2 = ReflectionUtils.createNewInstanceFromConstructor(aRTG, new Object[] {aID++, "hatch.energy.rtg.tier.02", "RTG Power Unit [MV]", 2, 9}); + Object aHatch3 = ReflectionUtils.createNewInstanceFromConstructor(aRTG, new Object[] {aID++, "hatch.energy.rtg.tier.03", "RTG Power Unit [HV]", 3, 9}); + + GregtechItemList.Hatch_RTG_LV.set(((IMetaTileEntity) aHatch1).getStackForm(1L)); + GregtechItemList.Hatch_RTG_MV.set(((IMetaTileEntity) aHatch2).getStackForm(1L)); + GregtechItemList.Hatch_RTG_HV.set(((IMetaTileEntity) aHatch3).getStackForm(1L)); + + } + } |