From e0dd6847cbf9559913ca386c9bd2a6c8c7ce49e8 Mon Sep 17 00:00:00 2001 From: lailani-f <41488821+lailani-f@users.noreply.github.com> Date: Sat, 4 Jan 2025 15:03:53 +0100 Subject: [PATCH 1/3] Item List Sort: Ensure access to shared private field is atomic (#584) Co-authored-by: lailani-f <> --- src/main/java/codechicken/nei/ItemList.java | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/codechicken/nei/ItemList.java b/src/main/java/codechicken/nei/ItemList.java index 4044ba65..271dffe0 100644 --- a/src/main/java/codechicken/nei/ItemList.java +++ b/src/main/java/codechicken/nei/ItemList.java @@ -2,6 +2,7 @@ package codechicken.nei; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -44,7 +45,7 @@ public class ItemList { private static final HashSet erroredItems = new HashSet<>(); private static final HashSet stackTraces = new HashSet<>(); - private static final HashMap ordering = new HashMap<>(); + private static HashMap ordering = new HashMap<>(); /** * Unlike {@link LayoutManager#itemsLoaded}, this indicates whether item loading is actually finished or not. */ @@ -234,10 +235,10 @@ public class ItemList { } private void updateOrdering(List items) { - ItemList.ordering.clear(); - ItemSorter.sort(items); + HashMap newOrdering = new HashMap<>(); + if (!CollapsibleItems.isEmpty()) { HashMap groups = new HashMap<>(); int orderIndex = 0; @@ -246,23 +247,25 @@ public class ItemList { final int groupIndex = CollapsibleItems.getGroupIndex(stack); if (groupIndex == -1) { - ItemList.ordering.put(stack, orderIndex++); + newOrdering.put(stack, orderIndex++); } else { if (!groups.containsKey(groupIndex)) { groups.put(groupIndex, orderIndex++); } - ItemList.ordering.put(stack, groups.get(groupIndex)); + newOrdering.put(stack, groups.get(groupIndex)); } } } else { int orderIndex = 0; for (ItemStack stack : items) { - ItemList.ordering.put(stack, orderIndex++); + newOrdering.put(stack, orderIndex++); } } + + ItemList.ordering = newOrdering; } @Override @@ -346,12 +349,9 @@ public class ItemList { public static final RestartableTask updateFilter = new RestartableTask("NEI Item Filtering") { - private int compare(ItemStack o1, ItemStack o2) { - return Integer.compare(ItemList.ordering.get(o1), ItemList.ordering.get(o2)); - } - @Override public void execute() { + if (!loadFinished) return; ItemFilter filter = getItemListFilter(); ArrayList filtered; @@ -368,8 +368,12 @@ public class ItemList { } if (interrupted()) return; - filtered.sort(this::compare); + + Comparator comparator = Comparator.comparingInt(ItemList.ordering::get); + filtered.sort(comparator::compare); + if (interrupted()) return; + ItemPanel.updateItemList(filtered); } }; From 3ec4f8dd684a95396cb335d52298a94d30a1b269 Mon Sep 17 00:00:00 2001 From: Chris Stone Date: Wed, 8 Jan 2025 11:30:34 -0700 Subject: [PATCH 2/3] Add mod handlers for mods in Per Fabrica Ad Astra modpack (#587) --- .../resources/assets/nei/csv/catalysts.csv | 76 +++++++++++++++++++ .../resources/assets/nei/csv/handlers.csv | 75 ++++++++++++++++++ 2 files changed, 151 insertions(+) diff --git a/src/main/resources/assets/nei/csv/catalysts.csv b/src/main/resources/assets/nei/csv/catalysts.csv index fd1d46f4..3152d465 100644 --- a/src/main/resources/assets/nei/csv/catalysts.csv +++ b/src/main/resources/assets/nei/csv/catalysts.csv @@ -1421,3 +1421,79 @@ techguns.nei.TechgunsChemLabNEIRecipeHandler,Techguns:basicMachine:4,,Techguns,T techguns.nei.TechgunsAmmoPressNEIRecipeHandler,Techguns:basicMachine:0,,Techguns,TRUE,,,,,, techguns.nei.TechgunsMetalPressNEIRecipeHandler,Techguns:basicMachine:1,,Techguns,TRUE,,,,,, techguns.nei.TechgunsChargingStationNEIRecipeHandler,Techguns:basicMachine:9,,Techguns,TRUE,,,,,, +ihl.nei_integration.EvaporatorRecipeHandler,ihl:evaporatorBlock,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ElectricEvaporatorRecipeHandler,ihl:electricEvaporatorBlock,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.AchesonFurnaceRecipeHandler,ihl:achesonFurnance,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.MuffleFurnaceRecipeHandler,ihl:muffleFurnance,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.DetonationSprayingMachineRecipeHandler,ihl:cannonBronze,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ExtruderRecipeHandler,ihl:extruder,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ImpregnatingMachineRecipeHandler,ihl:tubBronze,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LeadOvenRecipeHandler,ihl:leadOven,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LoomRecipeHandler,ihl:loom,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.GasWeldingStationGasRecipeHandler,ihl:gasWeldingStation,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.WoodenRollingMachineRecipeHandler,ihl:woodenRollingMachinePart1,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.CryogenicDistillerRecipeHandler,ihl:cryogenicDistiller,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ChemicalReactorRecipeHandler,ihl:chemicalReactor,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.FluidizedBedReactorRecipeHandler,ihl:fluidizedBedReactor,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LabElectrolyzerRecipeHandler,ihl:labElectrolyzer,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.RollingMachineRecipeHandler,ihl:rollingMachinePart1,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.PaperMachineRecipeHandler,ihl:paperMachine,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ElectrolysisBathRecipeHandler,ihl:electrolysisBath,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.WireMillRecipeHandler,ihl:wireMill,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.InjectionMoldRecipeHandler,ihl:injectionMold,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.VulcanizationExtrudingMoldRecipeHandler,ihl:vulcanizationExtrudingMold,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.CrucibleRecipeHandler,ihl:crucible,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.FractionationColumnRecipeHandler,ihl:fractionatorCover,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.IronWorkbenchRecipeHandler,ihl:ironWorkbench,,ihl,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingCrusher,Magneticraft:crusher_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingGrinder,Magneticraft:grinder_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingPolymerizer,Magneticraft:polimerizer_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingBiomassBurner,Magneticraft:biomassburner,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingSifter,Magneticraft:sifter_control,,Magneticraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIRefineryManager,PneumaticCraft:refinery,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIPlasticMixerManager,PneumaticCraft:plasticMixer,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIAmadronTradeManager,PneumaticCraft:amadronTablet,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIUVLightBoxManager,PneumaticCraft:uvLightBox,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIEtchingAcidManager,PneumaticCraft:etchingAcid,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIThermopneumaticProcessingPlantManager,PneumaticCraft:thermopneumaticProcessingPlant,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIAssemblyControllerRecipeManager,PneumaticCraft:assemblyController,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIPressureChamberRecipeManager,PneumaticCraft:pressureChamberInterface,,PneumaticCraft,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.InductionCrucibleFurnaceRecipeHandler,foundry:foundryMachine:0,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.AlloyMixerRecipeHandler,foundry:foundryMachine:2,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.MetalCasterRecipeHandler,foundry:foundryMachine:1,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.InfuserRecipeHandler,foundry:foundryMachine:3,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.InfuserSubstanceRecipeHandler,foundry:foundryMachine:3,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.AlloyFurnaceRecipeHandler,foundry:alloyFurnace,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.MetalAtomizerRecipeHandler,foundry:foundryMachine:5,,foundry,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.AnvilRecipeHandler,terrafirmacraft:Anvil,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.QuernRecipeHandler,terrafirmacraft:item.Quern,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.KilnRecipeHandler,,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.LoomRecipeHandler,terrafirmacraft:Loom,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.KnappingRecipeHandler,terrafirmacraft:item.LooseRock,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.BarrelRecipeHandler,terrafirmacraft:Barrel,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.AlloyRecipeHandler,terrafirmacraft:Crucible,,terrafirmacraft,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.HeatRecipeHandler,terrafirmacraft:Firepit,,terrafirmacraft,TRUE,,,,,,,,,,, +techreborn.compat.nei.FustionReacorRecipeHandler,techreborn:fusioncontrolcomputer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.VacuumFreezerRecipeHandler,techreborn:vacuumfreezer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.ImplosionCompressorRecipeHandler,techreborn:implosioncompressor,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.AlloySmelterRecipeHandler,techreborn:alloySmelter,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IronAlloySmelterRecipeHandler,techreborn:alloyfurnace,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IndustrialSawmillRecipeHandler,techreborn:industrialSawmill,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.ChemicalReactorRecipeHandler,techreborn:chemicalreactor,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.CentrifugeRecipeHandler,techreborn:techreborn.centrifuge,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.GrinderRecipeHandler,techreborn:grinder,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IndustrialElectrolyzerRecipeHandler,techreborn:industrialelectrolyzer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.BlastFurnaceRecipeHandler,techreborn:blastFurnace,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.ShapedRollingMachineHandler,techreborn:rollingmachine,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.ShapelessRollingMachineHandler,techreborn:rollingmachine,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.AssemblingMachineRecipeHandler,techreborn:assemblymachine,,techreborn,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.LightsaberForgeRecipeHandler,lightsabers:lightsaber_forge_light,,lightsabers,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.DoubleLightsaberRecipeHandler,lightsabers:lightsaber_forge_dark,,lightsabers,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.DisassemblyRecipeHandler,lightsabers:disassembly_station,,lightsabers,TRUE,,,,,,,,,,, +matteroverdrive.compat.modules.nei.CraftingHandlerInscriber,mo:inscriber,,mo,TRUE,,,,,,,,,,, +straywolfe.cookingwithtfc.client.nei.CookingPotRecipeHandler,cookingwithtfc:item.clayCookingPot:1,,cookingwithtfc,TRUE,,,,,,,,,,, +straywolfe.cookingwithtfc.client.nei.ClayOvenRecipeHandler,cookingwithtfc:item.clayOvenWall,,cookingwithtfc,TRUE,,,,,,,,,,, +factorization.nei.RecipeGrinder,factorization:diamond_cutting_head,,factorization,TRUE,,,,,,,,,,, +factorization.nei.RecipeMixer,factorization:FzBlock:18,,factorization,TRUE,,,,,,,,,,, +ua.pp.shurgent.tfctech.nei.WireDrawBenchRecipeHandler,tfctech:item.Wire Draw Bench,,tfctech,TRUE,,,,,,,,,,, +mekanism.client.nei.ElectrolyticSeparatorRecipeHandler,Mekanism:MachineBlock2:4,,Mekanism,TRUE,,,,,,,,,,, \ No newline at end of file diff --git a/src/main/resources/assets/nei/csv/handlers.csv b/src/main/resources/assets/nei/csv/handlers.csv index 4bd56780..059d5db1 100644 --- a/src/main/resources/assets/nei/csv/handlers.csv +++ b/src/main/resources/assets/nei/csv/handlers.csv @@ -579,3 +579,78 @@ techguns.nei.TechgunsChemLabNEIRecipeHandler,Techguns,Techguns:basicMachine:4,,T techguns.nei.TechgunsAmmoPressNEIRecipeHandler,Techguns,Techguns:basicMachine:0,,Techguns,TRUE,,,75,,3,,,,,, techguns.nei.TechgunsMetalPressNEIRecipeHandler,Techguns,Techguns:basicMachine:1,,Techguns,TRUE,,,75,,3,,,,,, techguns.nei.TechgunsChargingStationNEIRecipeHandler,Techguns,Techguns:basicMachine:9,,Techguns,TRUE,,,65,,3,,,,,, +ihl.nei_integration.FluidizedBedReactorRecipeHandler,IHL Tools & Machines for IC2V2,ihl:fluidizedBedReactor,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.EvaporatorRecipeHandler,IHL Tools & Machines for IC2V2,ihl:evaporatorBlock,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ElectricEvaporatorRecipeHandler,IHL Tools & Machines for IC2V2,ihl:electricEvaporatorBlock,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.AchesonFurnaceRecipeHandler,IHL Tools & Machines for IC2V2,ihl:achesonFurnance,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.MuffleFurnaceRecipeHandler,IHL Tools & Machines for IC2V2,ihl:muffleFurnance,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.DetonationSprayingMachineRecipeHandler,IHL Tools & Machines for IC2V2,ihl:cannonBronze,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ExtruderRecipeHandler,IHL Tools & Machines for IC2V2,ihl:extruder,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ImpregnatingMachineRecipeHandler,IHL Tools & Machines for IC2V2,ihl:tubBronze,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LeadOvenRecipeHandler,IHL Tools & Machines for IC2V2,ihl:leadOven,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LoomRecipeHandler,IHL Tools & Machines for IC2V2,ihl:loom,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.GasWeldingStationGasRecipeHandler,IHL Tools & Machines for IC2V2,ihl:gasWeldingStation,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.WoodenRollingMachineRecipeHandler,IHL Tools & Machines for IC2V2,ihl:woodenRollingMachinePart1,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.CryogenicDistillerRecipeHandler,IHL Tools & Machines for IC2V2,ihl:cryogenicDistiller,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ChemicalReactorRecipeHandler,IHL Tools & Machines for IC2V2,ihl:chemicalReactor,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.LabElectrolyzerRecipeHandler,IHL Tools & Machines for IC2V2,ihl:labElectrolyzer,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.RollingMachineRecipeHandler,IHL Tools & Machines for IC2V2,ihl:rollingMachinePart1,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.PaperMachineRecipeHandler,IHL Tools & Machines for IC2V2,ihl:paperMachine,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.ElectrolysisBathRecipeHandler,IHL Tools & Machines for IC2V2,ihl:electrolysisBath,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.WireMillRecipeHandler,IHL Tools & Machines for IC2V2,ihl:wireMill,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.InjectionMoldRecipeHandler,IHL Tools & Machines for IC2V2,ihl:injectionMold,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.VulcanizationExtrudingMoldRecipeHandler,IHL Tools & Machines for IC2V2,ihl:vulcanizationExtrudingMold,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.CrucibleRecipeHandler,IHL Tools & Machines for IC2V2,ihl:crucible,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.FractionationColumnRecipeHandler,IHL Tools & Machines for IC2V2,ihl:fractionatorCover,,ihl,TRUE,,,,,,,,,,, +ihl.nei_integration.IronWorkbenchRecipeHandler,IHL Tools & Machines for IC2V2,ihl:ironWorkbench,,ihl,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingCrusher,Magneticraft,Magneticraft:crusher_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingGrinder,Magneticraft,Magneticraft:grinder_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingPolymerizer,Magneticraft,Magneticraft:polimerizer_control,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingBiomassBurner,Magneticraft,Magneticraft:biomassburner,,Magneticraft,TRUE,,,,,,,,,,, +com.cout970.magneticraft.compat.nei.CraftingSifter,Magneticraft,Magneticraft:sifter_control,,Magneticraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIRefineryManager,PneumaticCraft,PneumaticCraft:refinery,,PneumaticCraft,TRUE,,"",80,,4,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIPlasticMixerManager,PneumaticCraft,PneumaticCraft:plasticMixer,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIAmadronTradeManager,PneumaticCraft,PneumaticCraft:amadronTablet,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIUVLightBoxManager,PneumaticCraft,PneumaticCraft:uvLightBox,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIEtchingAcidManager,PneumaticCraft,PneumaticCraft:etchingAcid,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIThermopneumaticProcessingPlantManager,PneumaticCraft,PneumaticCraft:thermopneumaticProcessingPlant,,PneumaticCraft,TRUE,,,,,,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIAssemblyControllerRecipeManager,PneumaticCraft,PneumaticCraft:assemblyController,,PneumaticCraft,TRUE,,,115,,2,,,,,, +pneumaticCraft.common.thirdparty.nei.NEIPressureChamberRecipeManager,PneumaticCraft,PneumaticCraft:pressureChamberInterface,,PneumaticCraft,TRUE,,,130,,2,,,,,, +exter.foundry.integration.nei.InductionCrucibleFurnaceRecipeHandler,Foundry,foundry:foundryMachine:0,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.AlloyMixerRecipeHandler,Foundry,foundry:foundryMachine:2,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.MetalCasterRecipeHandler,Foundry,foundry:foundryMachine:1,"",foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.InfuserRecipeHandler,Foundry,foundry:foundryMachine:3,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.InfuserSubstanceRecipeHandler,Foundry,foundry:foundryMachine:3,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.AlloyFurnaceRecipeHandler,Foundry,foundry:alloyFurnace,,foundry,TRUE,,,,,,,,,,, +exter.foundry.integration.nei.MetalAtomizerRecipeHandler,Foundry,foundry:foundryMachine:5,,foundry,TRUE,,,,,,,,,,, +net.dries007.tfcnei.recipeHandlers.AnvilRecipeHandler,TerraFirmaCraft,terrafirmacraft:Anvil,,terrafirmacraft,TRUE,,10,138,208,2,,,,,, +net.dries007.tfcnei.recipeHandlers.QuernRecipeHandler,TerraFirmaCraft,terrafirmacraft:item.Quern,,terrafirmacraft,TRUE,,,65,166,5,,,,,, +net.dries007.tfcnei.recipeHandlers.KilnRecipeHandler,TerraFirmaCraft,,,terrafirmacraft,TRUE,,,65,166,5,terrafirmacraftneiplugin:textures/gui/pitkiln.png,47,38,14,14, +net.dries007.tfcnei.recipeHandlers.LoomRecipeHandler,TerraFirmaCraft,terrafirmacraft:Loom,,terrafirmacraft,TRUE,,,65,166,5,,,,,, +net.dries007.tfcnei.recipeHandlers.KnappingRecipeHandler,TerraFirmaCraft,terrafirmacraft:item.LooseRock,,terrafirmacraft,TRUE,,,96,166,3,,,,,, +net.dries007.tfcnei.recipeHandlers.BarrelRecipeHandler,TerraFirmaCraft,terrafirmacraft:Barrel,,terrafirmacraft,TRUE,,,65,166,5,,,,,, +net.dries007.tfcnei.recipeHandlers.AlloyRecipeHandler,TerraFirmaCraft,terrafirmacraft:Crucible,,terrafirmacraft,TRUE,,,65,166,5,,,,,, +net.dries007.tfcnei.recipeHandlers.HeatRecipeHandler,TerraFirmaCraft,terrafirmacraft:Firepit,,terrafirmacraft,TRUE,,,65,166,5,"",,,,, +techreborn.compat.nei.FustionReacorRecipeHandler,TechReborn,techreborn:fusioncontrolcomputer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.VacuumFreezerRecipeHandler,TechReborn,techreborn:vacuumfreezer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.ImplosionCompressorRecipeHandler,TechReborn,techreborn:implosioncompressor,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.AlloySmelterRecipeHandler,TechReborn,techreborn:alloySmelter,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IronAlloySmelterRecipeHandler,TechReborn,techreborn:alloyfurnace,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IndustrialSawmillRecipeHandler,TechReborn,techreborn:industrialSawmill,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.ChemicalReactorRecipeHandler,TechReborn,techreborn:chemicalreactor,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.CentrifugeRecipeHandler,TechReborn,techreborn:techreborn.centrifuge,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.GrinderRecipeHandler,TechReborn,techreborn:grinder,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.IndustrialElectrolyzerRecipeHandler,TechReborn,techreborn:industrialelectrolyzer,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.BlastFurnaceRecipeHandler,TechReborn,techreborn:blastFurnace,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.ShapedRollingMachineHandler,TechReborn,techreborn:rollingmachine,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.ShapelessRollingMachineHandler,TechReborn,techreborn:rollingmachine,,techreborn,TRUE,,,,,,,,,,, +techreborn.compat.nei.recipes.AssemblingMachineRecipeHandler,TechReborn,techreborn:assemblymachine,,techreborn,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.LightsaberForgeRecipeHandler,Advanced Lightsabers Mod,lightsabers:lightsaber_forge_light,,lightsabers,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.DoubleLightsaberRecipeHandler,Advanced Lightsabers Mod,lightsabers:lightsaber_forge_dark,,lightsabers,TRUE,,,,,,,,,,, +com.fiskmods.lightsabers.nei.DisassemblyRecipeHandler,Advanced Lightsabers Mod,lightsabers:disassembly_station,,lightsabers,TRUE,,,,,,,,,,, +matteroverdrive.compat.modules.nei.CraftingHandlerInscriber,Matter Overdrive,mo:inscriber,,mo,TRUE,,,,,,,,,,, +straywolfe.cookingwithtfc.client.nei.CookingPotRecipeHandler,Cooking with TFC,cookingwithtfc:item.clayCookingPot:1,,cookingwithtfc,TRUE,,,,,,,,,,, +straywolfe.cookingwithtfc.client.nei.ClayOvenRecipeHandler,Cooking with TFC,cookingwithtfc:item.clayOvenWall,,cookingwithtfc,TRUE,,,,,,,,,,, +factorization.nei.RecipeMixer,Factorization,factorization:FzBlock:18,,factorization,TRUE,,,,,,,,,,, +ua.pp.shurgent.tfctech.nei.WireDrawBenchRecipeHandler,Shurgent's TFCTech Addon,tfctech:item.Wire Draw Bench,,tfctech,TRUE,,,,,,,,,,, +mekanism.client.nei.ElectrolyticSeparatorRecipeHandler,Mekanism,Mekanism:MachineBlock2:4,,Mekanism,TRUE,,,,,,,,,,, \ No newline at end of file From 0c0cf37eb0332aad6577c36ac2d8c76ed90ee40a Mon Sep 17 00:00:00 2001 From: slprime <31038811+slprime@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:53:27 +0200 Subject: [PATCH 3/3] Add 'Hide Item List Until Searching' option (#572) Co-authored-by: slprime Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- src/main/java/codechicken/nei/BookmarkPanel.java | 2 +- .../java/codechicken/nei/ItemHistoryPanel.java | 13 ++++++++----- src/main/java/codechicken/nei/ItemPanel.java | 4 ++-- src/main/java/codechicken/nei/ItemsGrid.java | 4 ++++ .../java/codechicken/nei/NEIClientConfig.java | 16 ++++++++++++++++ src/main/java/codechicken/nei/PanelWidget.java | 2 +- src/main/java/codechicken/nei/SearchField.java | 8 +++++++- src/main/resources/assets/nei/lang/en_US.lang | 3 +++ 8 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/main/java/codechicken/nei/BookmarkPanel.java b/src/main/java/codechicken/nei/BookmarkPanel.java index a951b2e8..dc211831 100644 --- a/src/main/java/codechicken/nei/BookmarkPanel.java +++ b/src/main/java/codechicken/nei/BookmarkPanel.java @@ -2059,7 +2059,7 @@ public class BookmarkPanel extends PanelWidget { public void setVisible() { super.setVisible(); - if (grid.getPerPage() > 0) { + if (grid.getPerPage() > 0 && getNamespaceSize() > 1) { LayoutManager.addWidget(namespacePrev); LayoutManager.addWidget(namespaceNext); LayoutManager.addWidget(namespaceLabel); diff --git a/src/main/java/codechicken/nei/ItemHistoryPanel.java b/src/main/java/codechicken/nei/ItemHistoryPanel.java index 4c46cf5d..81f2ce96 100644 --- a/src/main/java/codechicken/nei/ItemHistoryPanel.java +++ b/src/main/java/codechicken/nei/ItemHistoryPanel.java @@ -1,12 +1,11 @@ package codechicken.nei; -import static codechicken.lib.gui.GuiDraw.drawRect; - import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; +import codechicken.lib.gui.GuiDraw; import codechicken.nei.ItemPanel.ItemPanelSlot; import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; @@ -22,10 +21,14 @@ public class ItemHistoryPanel extends Widget { grid = new ItemsGrid(); } + public boolean isEmpty() { + return grid.isEmpty(); + } + public void draw(int mousex, int mousey) { if (NEIClientConfig.getIntSetting("inventory.history.splittingMode") == 0) { - drawRect(x, y, w, h, NEIClientConfig.getSetting("inventory.history.historyColor").getHexValue()); + GuiDraw.drawRect(x, y, w, h, NEIClientConfig.getSetting("inventory.history.historyColor").getHexValue()); } else { drawSplittingArea(x, y, w, h, NEIClientConfig.getSetting("inventory.history.historyColor").getHexValue()); } @@ -44,8 +47,8 @@ public class ItemHistoryPanel extends Widget { grid.realItems.removeIf(historyStack -> StackInfo.equalItemAndNBT(historyStack, stack, true)); grid.realItems.add(0, is); - if (grid.realItems.size() > (grid.rows * grid.columns)) { - grid.realItems.remove(grid.rows * grid.columns); + if (grid.realItems.size() > Math.max(50, grid.rows * grid.columns)) { + grid.realItems.remove(grid.realItems.size() - 1); } grid.onItemsChanged(); diff --git a/src/main/java/codechicken/nei/ItemPanel.java b/src/main/java/codechicken/nei/ItemPanel.java index aa0a065a..4aea6c22 100644 --- a/src/main/java/codechicken/nei/ItemPanel.java +++ b/src/main/java/codechicken/nei/ItemPanel.java @@ -482,11 +482,11 @@ public class ItemPanel extends PanelWidget { LayoutManager.addWidget(quantity); } - if (!CollapsibleItems.isEmpty()) { + if (!CollapsibleItems.isEmpty() && !grid.isEmpty()) { LayoutManager.addWidget(toggleGroups); } - if (NEIClientConfig.showHistoryPanelWidget()) { + if (NEIClientConfig.showHistoryPanelWidget() && (!grid.isEmpty() || !historyPanel.isEmpty())) { LayoutManager.addWidget(historyPanel); } } diff --git a/src/main/java/codechicken/nei/ItemsGrid.java b/src/main/java/codechicken/nei/ItemsGrid.java index e518ef39..138818bf 100644 --- a/src/main/java/codechicken/nei/ItemsGrid.java +++ b/src/main/java/codechicken/nei/ItemsGrid.java @@ -66,6 +66,10 @@ public class ItemsGrid { return realItems.size(); } + public boolean isEmpty() { + return realItems.isEmpty(); + } + public int indexOf(ItemStack stackA, boolean useNBT) { for (int idx = 0; idx < realItems.size(); idx++) { diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 6b9dd5c2..51d1c38d 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -433,6 +433,18 @@ public class NEIClientConfig { tag.getTag("inventory.search.widgetPosition").setComment("Widget Position").getBooleanValue(true); API.addOption(new OptionToggleButton("inventory.search.widgetPosition", true)); + tag.getTag("inventory.search.hideUntilSearching").setComment("Hide Items Until Searching") + .getBooleanValue(false); + API.addOption(new OptionToggleButton("inventory.search.hideUntilSearching", true) { + + @Override + public boolean onClick(int button) { + super.onClick(button); + ItemList.updateFilter.restart(); + return true; + } + }); + tag.getTag("inventory.search.widgetAutofocus") .setComment( "Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first") @@ -875,6 +887,10 @@ public class NEIClientConfig { return getBooleanSetting("inventory.showItemQuantityWidget"); } + public static boolean hideItemsUntilSearching() { + return getBooleanSetting("inventory.search.hideUntilSearching"); + } + public static boolean isSearchWidgetCentered() { return getBooleanSetting("inventory.search.widgetPosition"); } diff --git a/src/main/java/codechicken/nei/PanelWidget.java b/src/main/java/codechicken/nei/PanelWidget.java index 9c577468..0674ae87 100644 --- a/src/main/java/codechicken/nei/PanelWidget.java +++ b/src/main/java/codechicken/nei/PanelWidget.java @@ -171,7 +171,7 @@ public abstract class PanelWidget extends Widget implements IContainerTooltipHan protected abstract int resizeFooter(GuiContainer gui); public void setVisible() { - if (grid.getPerPage() > 0) { + if (grid.getPerPage() > 0 && !grid.isEmpty()) { LayoutManager.addWidget(pagePrev); LayoutManager.addWidget(pageNext); LayoutManager.addWidget(pageLabel); diff --git a/src/main/java/codechicken/nei/SearchField.java b/src/main/java/codechicken/nei/SearchField.java index 71733cdf..d5a4cf90 100644 --- a/src/main/java/codechicken/nei/SearchField.java +++ b/src/main/java/codechicken/nei/SearchField.java @@ -144,7 +144,8 @@ public class SearchField extends TextField implements ItemFilterProvider { @Override public int getTextColour() { - if (ItemPanels.itemPanel.getItems().isEmpty()) { + if (ItemPanels.itemPanel.getItems().isEmpty() + && (!this.field.getText().isEmpty() || !NEIClientConfig.hideItemsUntilSearching())) { return focused() ? 0xFFcc3300 : 0xFF993300; } else { return focused() ? 0xFFE0E0E0 : 0xFF909090; @@ -315,6 +316,11 @@ public class SearchField extends TextField implements ItemFilterProvider { @Override public ItemFilter getFilter() { + + if (field.getText().isEmpty() && NEIClientConfig.hideItemsUntilSearching()) { + return new NothingItemFilter(); + } + return ((GuiSearchField) field).getFilter(); } diff --git a/src/main/resources/assets/nei/lang/en_US.lang b/src/main/resources/assets/nei/lang/en_US.lang index d2b9c297..ecf1f4a7 100644 --- a/src/main/resources/assets/nei/lang/en_US.lang +++ b/src/main/resources/assets/nei/lang/en_US.lang @@ -216,6 +216,9 @@ nei.options.inventory.search=Search Widget nei.options.inventory.search.widgetPosition=Widget Position nei.options.inventory.search.widgetPosition.true=Center nei.options.inventory.search.widgetPosition.false=Right +nei.options.inventory.search.hideUntilSearching=Hide Until Searching +nei.options.inventory.search.hideUntilSearching.true=Yes +nei.options.inventory.search.hideUntilSearching.false=No nei.options.inventory.search.widgetAutofocus=Autofocus nei.options.inventory.search.widgetAutofocus.0=No nei.options.inventory.search.widgetAutofocus.1=Yes