diff options
author | DreamMasterXXL <dream-master@gmx.net> | 2021-10-23 13:20:32 +0200 |
---|---|---|
committer | DreamMasterXXL <dream-master@gmx.net> | 2021-10-23 13:20:32 +0200 |
commit | c224095cb6f73941d12adfb0b2e1cd2f144dfd82 (patch) | |
tree | 5e8f2289e874519d990df8d2703e508cbba702df /src/main/java/gregtech/api | |
parent | 68e952339c491609d65f64eec7503237cf375ed2 (diff) | |
parent | 128ddd5029bd7500dd5a9c760a50d3bea1ab88d3 (diff) | |
download | GT5-Unofficial-c224095cb6f73941d12adfb0b2e1cd2f144dfd82.tar.gz GT5-Unofficial-c224095cb6f73941d12adfb0b2e1cd2f144dfd82.tar.bz2 GT5-Unofficial-c224095cb6f73941d12adfb0b2e1cd2f144dfd82.zip |
Merge branch 'experimental' of github.com:GTNewHorizons/GT5-Unofficial into experimental
Diffstat (limited to 'src/main/java/gregtech/api')
8 files changed, 48 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index a77a0de902..8dcf5fe129 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -843,6 +843,7 @@ public enum ItemList implements IItemContainer { Casing_MiningBlackPlutonium, Casing_Advanced_Rhodium_Palladium, Casing_Advanced_Iridium, + Casing_Magical, Hull_ULV, Hull_LV, diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 49aac808d6..e4aa589955 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -246,6 +246,7 @@ public class Textures { MACHINE_CASING_MINING_BLACKPLUTONIUM, MACHINE_CASING_RHODIUM_PALLADIUM, MACHINE_CASING_IRIDIUM, + MACHINE_CASING_MAGICAL, MACHINE_CASING_FIREBOX_TITANIUM, MACHINE_CASING_FUSION_COIL, @@ -533,6 +534,10 @@ public class Textures { OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW, OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE, OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW, + OVERLAY_FRONT_RESEARCH_COMPLETER, + OVERLAY_FRONT_RESEARCH_COMPLETER_GLOW, + OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE, + OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE_GLOW, OVERLAY_TOP_POTIONBREWER, OVERLAY_TOP_POTIONBREWER_GLOW, diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java index 5d2a9321c4..fbae0b6752 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -204,7 +204,10 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { } GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); IFluidAccess tFillableAccess = IFluidAccess.from(tTank, true); - return handleFluidSlotClick(tFillableAccess, aPlayer, aMouseclick == 0, true, true); + ItemStack tToken = handleFluidSlotClick(tFillableAccess, aPlayer, aMouseclick == 0, true, true); + if (mTileEntity.isServerSide() && tToken != null) + mTileEntity.markInventoryBeenModified(); + return tToken; } else { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java index 437d896800..74ad58c407 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java @@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack; public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords { + default void markInventoryBeenModified() {} + /** * if the Inventory of this TileEntity got modified this tick */ diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 397d03e0df..41203c3ad2 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1749,6 +1749,11 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } @Override + public void markInventoryBeenModified() { + mInventoryChanged = true; + } + + @Override public void setGenericRedstoneOutput(boolean aOnOff) { mRedstone = aOnOff; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java index a0fc7abcc7..2ff1e87348 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java @@ -9,6 +9,7 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; @@ -66,6 +67,19 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { } @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + if (mRecipeMap != null) + aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mRecipeMap = GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("recipeMap"), null); + } + + @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; aBaseMetaTileEntity.openGUI(aPlayer); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index 96667ddb8c..37a98162b8 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -169,6 +169,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { aNBT.setBoolean("disableSort", disableSort); aNBT.setBoolean("disableFilter", disableFilter); aNBT.setBoolean("disableLimited", disableLimited); + if (mRecipeMap != null) + aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); } @Override @@ -178,6 +180,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { disableFilter = aNBT.getBoolean("disableFilter"); if(aNBT.hasKey("disableLimited")) disableLimited = aNBT.getBoolean("disableLimited"); + mRecipeMap = GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("recipeMap"), null); } @Override diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 6130adfaef..96018571e9 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -572,6 +572,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Contains all Recipe Maps */ public static final Collection<GT_Recipe_Map> sMappings = new ArrayList<>(); + /** + * All recipe maps indexed by their {@link #mUniqueIdentifier}. + */ + public static final Map<String, GT_Recipe_Map> sIndexedMappings = new HashMap<>(); public static final GT_Recipe_Map sOreWasherRecipes = new GT_Recipe_Map(new HashSet<>(500), "gt.recipe.orewasher", "Ore Washing Plant", null, RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map(new HashSet<>(1000), "gt.recipe.thermalcentrifuge", "Thermal Centrifuge", null, RES_PATH_GUI + "basicmachines/ThermalCentrifuge", 1, 3, 1, 0, 2, E, 1, E, true, true); @@ -653,7 +657,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map_Fuel sHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.fluidnaquadahreactor", "Naquadah Reactor MkIII", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Fuel sExtremeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.hugenaquadahreactor", "Naquadah Reactor MkIV", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Fuel sUltraHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.extrahugenaquadahreactor", "Naquadah Reactor MkV", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.fluidnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); + public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.fluidfuelnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = new GT_Recipe_Map_LargeBoilerFakeFuels(); /** @@ -686,6 +690,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public final boolean mNEIAllowed, mShowVoltageAmperageInNEI; /** + * Unique identifier for this recipe map. Generated from aUnlocalizedName and a few other parameters. + * See constructor for details. + */ + public final String mUniqueIdentifier; + + /** * Initialises a new type of Recipe Handler. * * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a pre-initialised Size. @@ -717,6 +727,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { GregTech_API.sFluidMappings.add(mRecipeFluidMap); GregTech_API.sItemStackMappings.add(mRecipeItemMap); GT_LanguageManager.addStringLocalization(mUnlocalizedName = aUnlocalizedName, aLocalName); + mUniqueIdentifier = String.format("%s_%d_%d_%d_%d_%d", aUnlocalizedName, aAmperage, aUsualInputCount, aUsualOutputCount, aMinimalInputFluids, aMinimalInputItems); + if (sIndexedMappings.put(mUniqueIdentifier, this) != null) + throw new IllegalArgumentException("Duplicate recipe map registered: " + mUniqueIdentifier); } public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { |