diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2021-12-11 18:07:47 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2021-12-11 18:07:47 +0000 |
commit | a88fed98878a081350cde7a0ee6d3fdd1a3de420 (patch) | |
tree | ed04766a10ba0e1c61cde2a9318df1adb81c9d2b /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 17f817dd419952fc089c5fc9564a9a2eb93de1f7 (diff) | |
download | GT5-Unofficial-a88fed98878a081350cde7a0ee6d3fdd1a3de420.tar.gz GT5-Unofficial-a88fed98878a081350cde7a0ee6d3fdd1a3de420.tar.bz2 GT5-Unofficial-a88fed98878a081350cde7a0ee6d3fdd1a3de420.zip |
Fixed issue of Multiblock hatches/buses not being assigned recipe maps.
Removed 7 from Charge Pack tooltips.
Initial work on Elemental Duplicator.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
4 files changed, 128 insertions, 54 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index bd0f11f0ad..8c814489f2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -404,7 +404,7 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Sparge_Tower_Interior, // Elemental Duplicator - /*Controller_ElementalDuplicator,*/ + Controller_ElementalDuplicator, Casing_ElementalDuplicator, // Big Steam Macerator @@ -458,7 +458,7 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_Output_Bus_Steam, //Elemental Duplicator Data Orb Bus - /*Hatch_Input_Elemental_Duplicator,*/ + Hatch_Input_Elemental_Duplicator, //RTG Hatch Hatch_RTG_LV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java index 71040d057c..a892346463 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import java.util.ArrayList; + import gregtech.api.gui.GT_Container_4by4; import gregtech.api.gui.GT_GUIContainer_4by4; import gregtech.api.interfaces.ITexture; @@ -18,14 +20,12 @@ import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; - public boolean disableSort; public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 16, new String[]{ "Holds Data Orbs for the Elemental Duplicator", CORE.GT_Tooltip - }); - disableSort = true; + }); } public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -85,7 +85,7 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Steam Input Bus"); + return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository"); } @Override @@ -102,28 +102,26 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE } protected void fillStacksIntoFirstSlots() { - if (disableSort) { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) - mInventory[i] = null; - } + for (int i = 0; i < mInventory.length; i++) { + if (mInventory[i] != null && mInventory[i].stackSize <= 0) { + mInventory[i] = null; + } + } } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("disableSort", disableSort); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - disableSort = aNBT.getBoolean("disableSort"); } @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - + } public String trans(String aKey, String aEnglish) { @@ -139,5 +137,13 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); } + + public ArrayList<ItemStack> getInventory(){ + ArrayList<ItemStack> aContents = new ArrayList<ItemStack>(); + for (int i=0;i<this.getSizeInventory();i++) { + aContents.add(this.getStackInSlot(i)); + } + return aContents; + } } 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 9aff009ec5..fd021f1487 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 @@ -7,7 +7,6 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.IToolStats; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; @@ -67,6 +66,10 @@ import java.util.function.Function; import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; +// Glee8e - 11/12/21 - 2:15pm +// Yeah, now I see what's wrong. Someone inherited from GregtechMeta_MultiBlockBase instead of GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialDehydrator> as it should have been +// so any method in GregtechMetaTileEntity_IndustrialDehydrator would see generic field declared in GregtechMeta_MultiBlockBase without generic parameter + public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { public static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true; @@ -95,14 +98,15 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En protected long mTotalRunTime = 0; protected boolean mVoidExcess = false; - //Control Core Hatch public ArrayList<GT_MetaTileEntity_Hatch_ControlCore> mControlCoreBus = new ArrayList<GT_MetaTileEntity_Hatch_ControlCore>(); public ArrayList<GT_MetaTileEntity_Hatch_AirIntake> mAirIntakes = new ArrayList<GT_MetaTileEntity_Hatch_AirIntake>(); public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_InputBattery>(); public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>(); + public ArrayList<GT_MetaTileEntity_Hatch> mAllEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); + public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); // Custom Behaviour Map - private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>();; + private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>(); public GregtechMeta_MultiBlockBase(final int aID, final String aName, @@ -1468,6 +1472,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En this.mAirIntakes.clear(); this.mTecTechEnergyHatches.clear(); this.mTecTechDynamoHatches.clear(); + this.mAllEnergyHatches.clear(); + this.mAllDynamoHatches.clear(); } } @@ -1658,8 +1664,18 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return mMaintenanceHatches.size() <= 1 && !mMufflerHatches.isEmpty(); } - public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, - final int aBaseCasingIndex) { + public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + return addToMachineListInternal(aList, aMetaTileEntity, aBaseCasingIndex); + } + + public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) { if (aTileEntity == null) { return false; } @@ -1669,7 +1685,15 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En * Class <?> aHatchType = ReflectionUtils.getTypeOfGenericObject(aList); if * (!aHatchType.isInstance(aTileEntity)) { return false; } */ + + // Try setRecipeMap + if (aTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch_Input) aTileEntity).mRecipeMap = getRecipeMap(); + } + if (aTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch_InputBus) aTileEntity).mRecipeMap = getRecipeMap(); + } if (aList.isEmpty()) { if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { @@ -1780,7 +1804,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En //Use this to determine the correct value, then update the hatch texture after. boolean aDidAdd = false; - //Handle Custom Hustoms + //Handle Custom Hatches if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ControlCore) { log("Found GT_MetaTileEntity_Hatch_ControlCore"); aDidAdd = addControlCoreToMachineList(aTileEntity, aBaseCasingIndex); @@ -1793,17 +1817,20 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En log("Found GT_MetaTileEntity_Hatch_OutputBattery"); aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex); } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) { + aDidAdd = addToMachineListInternal(mAirIntakes, aMetaTileEntity, aBaseCasingIndex); + } //Handle TT Multi-A Energy Hatches else if (LoadedMods.TecTech && isThisHatchMultiEnergy(aMetaTileEntity)) { log("Found isThisHatchMultiEnergy"); - aDidAdd = addToMachineListInternal(mTecTechEnergyHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); } //Handle TT Multi-A Dynamos else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) { log("Found isThisHatchMultiDynamo"); - aDidAdd = addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addDynamoToMachineList(aTileEntity, aBaseCasingIndex); } //Handle Fluid Hatches using seperate logic @@ -1818,9 +1845,9 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) aDidAdd = addToMachineListInternal(mOutputBusses, aMetaTileEntity, aBaseCasingIndex); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - aDidAdd = addToMachineListInternal(mEnergyHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - aDidAdd = addToMachineListInternal(mDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + aDidAdd = addDynamoToMachineList(aTileEntity, aBaseCasingIndex); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) aDidAdd = addToMachineListInternal(mMaintenanceHatches, aMetaTileEntity, aBaseCasingIndex); else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) @@ -1853,16 +1880,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } public boolean addAirIntakeToMachineList(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_AirIntake) { - this.mAirIntakes.add((GT_MetaTileEntity_Hatch_AirIntake)aMetaTileEntity); - } return addToMachineList(aTileEntity, aBaseCasingIndex); } @@ -2084,13 +2101,23 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return false; } if (isThisHatchMultiDynamo(aTileEntity)) { - updateTexture(aTileEntity, aBaseCasingIndex); - return this.mTecTechDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + return addToMachineListInternal(mTecTechDynamoHatches, aMetaTileEntity, aBaseCasingIndex); } return false; } - public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ + public boolean isThisHatchMultiDynamo(IGregTechTileEntity aTileEntity){ + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + return isThisHatchMultiDynamo(aMetaTileEntity); + } + + public boolean isThisHatchMultiDynamo(IMetaTileEntity aMetaTileEntity){ Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); if (mDynamoClass != null){ @@ -2105,11 +2132,27 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (LoadedMods.TecTech){ if (isThisHatchMultiDynamo(aTileEntity)) { - return addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); + return addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex) && updateMasterDynamoHatchList(aTileEntity); } } - return addToMachineList(aTileEntity, aBaseCasingIndex); + return addToMachineListInternal(this.mDynamoHatches, aTileEntity, aBaseCasingIndex) && updateMasterDynamoHatchList(aTileEntity); + } + + private boolean updateMasterDynamoHatchList(IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + GT_MetaTileEntity_Hatch aHatch = (GT_MetaTileEntity_Hatch) aMetaTileEntity; + return mAllDynamoHatches.add(aHatch); + } + return false; } @@ -2129,14 +2172,24 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En if (aMetaTileEntity == null) { return false; } - if (isThisHatchMultiEnergy(aTileEntity)) { - updateTexture(aTileEntity, aBaseCasingIndex); - return this.mTecTechEnergyHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + if (isThisHatchMultiEnergy(aMetaTileEntity)) { + return addToMachineListInternal(mTecTechEnergyHatches, aMetaTileEntity, aBaseCasingIndex); } return false; + } + + public boolean isThisHatchMultiEnergy(IGregTechTileEntity aTileEntity){ + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + return isThisHatchMultiEnergy(aMetaTileEntity); } - public boolean isThisHatchMultiEnergy(Object aMetaTileEntity){ + public boolean isThisHatchMultiEnergy(IMetaTileEntity aMetaTileEntity){ Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); if (mDynamoClass != null){ @@ -2151,11 +2204,26 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (LoadedMods.TecTech){ if (isThisHatchMultiEnergy(aTileEntity)) { - return addMultiAmpEnergyToMachineList(aTileEntity, aBaseCasingIndex); + return addMultiAmpEnergyToMachineList(aTileEntity, aBaseCasingIndex) && updateMasterEnergyHatchList(aTileEntity); } } - return super.addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); + return addToMachineListInternal(this.mEnergyHatches, aTileEntity, aBaseCasingIndex) && updateMasterEnergyHatchList(aTileEntity); + } + + private boolean updateMasterEnergyHatchList(IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + GT_MetaTileEntity_Hatch aHatch = (GT_MetaTileEntity_Hatch) aMetaTileEntity; + return mAllEnergyHatches.add(aHatch); + } + return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java index 36e68f6438..21b0efff99 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java @@ -290,18 +290,18 @@ public abstract class GregtechMeta_SteamMultiBase extends GregtechMeta_MultiBloc } //Use this to determine the correct value, then update the hatch texture after. - boolean aDidAdd = false; + boolean aDidAdd = false; - //Handle Custom Hustoms - - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase) + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase) { aDidAdd = addToMachineListInternal(mSteamInputFluids, aMetaTileEntity, aBaseCasingIndex); - - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) - aDidAdd = addToMachineListInternal(mSteamInputs, aMetaTileEntity, aBaseCasingIndex); - - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput) + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) { + ((GT_MetaTileEntity_Hatch_InputBus) aTileEntity).mRecipeMap = getRecipeMap(); + aDidAdd = addToMachineListInternal(mSteamInputs, aMetaTileEntity, aBaseCasingIndex); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput) { aDidAdd = addToMachineListInternal(mSteamOutputs, aMetaTileEntity, aBaseCasingIndex); + } return aDidAdd; } |