Compare commits

..
8 changed files with 84 additions and 14 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
api('com.github.GTNewHorizons:CodeChickenCore:1.4.7:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.39:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.7.0:dev')
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
@@ -180,8 +180,9 @@ public class ClientHandler {
new InputStreamReader(res.getInputStream(), StandardCharsets.UTF_8))) {
NEIClientConfig.logger.info("Loading '{}' from jar {}", resource, location);
callback.accept(
IOUtils.readLines(reader).stream().map(String::trim)
.filter(line -> !line.isEmpty() && !line.startsWith("#")));
IOUtils.readLines(reader).stream()
.map(line -> line.contains("#") ? line.substring(0, line.indexOf('#')) : line)
.map(String::trim).filter(line -> !line.isEmpty()));
return true;
}
@@ -209,8 +210,9 @@ public class ClientHandler {
try (FileReader reader = new FileReader(file)) {
NEIClientConfig.logger.info("Loading '{}' file {}", resource, file);
callback.accept(
IOUtils.readLines(reader).stream().map(String::trim)
.filter(line -> !line.isEmpty() && !line.startsWith("#")));
IOUtils.readLines(reader).stream()
.map(line -> line.contains("#") ? line.substring(0, line.indexOf('#')) : line)
.map(String::trim).filter(line -> !line.isEmpty()));
return true;
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to load '{}' file {}", resource, file, e);
@@ -20,6 +20,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.IFluidContainerItem;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
@@ -31,6 +32,7 @@ import codechicken.nei.api.ItemInfo;
import codechicken.nei.recipe.InformationHandler;
import codechicken.nei.search.TooltipFilter;
import codechicken.nei.util.ItemUntranslator;
import cpw.mods.fml.common.FMLLog;
public class ItemList {
@@ -297,6 +299,57 @@ public class ItemList {
.collect(Collectors.toList());
}
private void runChecked(ItemStack stack, Runnable action, String reason) {
int hashOld = 0;
if (stack.hasTagCompound()) {
hashOld = stack.stackTagCompound.hashCode();
}
action.run();
if (stack.hasTagCompound() && hashOld != stack.stackTagCompound.hashCode()) {
FMLLog.warning("NEI: Forced tag update with reason (" + reason + ") for " + stack);
}
}
private void forceTagCompoundInitialization(ItemStack stack) {
Item item = stack.getItem();
if (item == null) {
return;
}
if (item instanceof IFluidContainerItem) {
IFluidContainerItem fluidItem = (IFluidContainerItem) item;
runChecked(stack, () -> fluidItem.getFluid(stack), "getFluid");
}
runChecked(stack, () -> item.isDamaged(stack), "isDamaged");
runChecked(stack, () -> item.getDamage(stack), "getDamage");
runChecked(stack, () -> item.showDurabilityBar(stack), "showDurabilityBar");
runChecked(stack, () -> item.getAttributeModifiers(stack), "getAttributeModifiers");
runChecked(stack, () -> item.getDurabilityForDisplay(stack), "getDurabilityForDisplay");
runChecked(stack, () -> item.getItemStackLimit(stack), "getItemStackLimit");
runChecked(stack, () -> item.getToolClasses(stack), "getToolClasses");
runChecked(stack, () -> item.getUnlocalizedNameInefficiently(stack), "getUnlocalizedNameInefficiently");
runChecked(stack, () -> item.hasEffect(stack), "hasEffect");
/*
* unused... for now runChecked(stack, () -> GameRegistry.getFuelValue(stack), "getFuelValue");
* runChecked(stack, () -> item.getUnlocalizedName(stack), "getUnlocalizedName"); runChecked(stack, () ->
* item.doesContainerItemLeaveCraftingGrid(stack), "doesContainerItemLeaveCraftingGrid"); runChecked(stack,
* () -> item.getItemUseAction(stack), "getItemUseAction"); runChecked(stack, () ->
* item.getMaxItemUseDuration(stack), "getMaxItemUseDuration"); runChecked(stack, () ->
* item.getPotionEffect(stack), "getPotionEffect"); runChecked(stack, () -> item.isPotionIngredient(stack),
* "isPotionIngredient"); runChecked(stack, () -> item.getRarity(stack), "getRarity"); runChecked(stack, ()
* -> item.hasCustomEntity(stack), "hasCustomEntity"); runChecked(stack, () ->
* item.getSmeltingExperience(stack), "getSmeltingExperience"); runChecked(stack, () ->
* item.getMaxDamage(stack), "getMaxDamage"); runChecked(stack, () -> item.getDamage(stack), "getDamage");
* runChecked(stack, stack::isItemDamaged, "isItemDamaged"); runChecked(stack, () -> item.hasEffect(stack,
* 0), "hasEffect"); runChecked(stack, () -> item.getItemEnchantability(stack), "getItemEnchantability");
* runChecked(stack, () -> item.isBeaconPayment(stack), "isBeaconPayment"); runChecked(stack, () ->
* item.getDamage(stack), "getDamage"); runChecked(stack, () -> item.getDamage(stack), "getDamage");
* runChecked(stack, () -> item.getDamage(stack), "getDamage");
*/
}
// Generate itemlist, permutations, orders, collapsibleitems, and informationhandler stacks
@Override
@SuppressWarnings("unchecked")
@@ -336,6 +389,8 @@ public class ItemList {
items.add(stack);
}
forceTagCompoundInitialization(stack);
CollapsibleItems.putItem(stack);
TooltipFilter.getSearchTooltip(stack);
InformationHandler.populateStacks(stack);
@@ -147,6 +147,8 @@ public class NEIClientConfig {
tag.getTag("inventory.widgetsenabled").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.widgetsenabled"));
tag.getTag("findFuelsParallel").getBooleanValue(true);
tag.getTag("inventory.autocrafting").getBooleanValue(true);
tag.getTag("inventory.dynamicFontSize").getBooleanValue(true);
tag.getTag("inventory.hidden").getBooleanValue(false);
@@ -138,7 +138,7 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
return true;
}
if (button == 1 && slot instanceof SlotCrafting) // right click
if (button == 1 && modifier != 2 && slot instanceof SlotCrafting) // right click
{
for (int i1 = 0; i1 < 64; i1++) // click this slot 64 times
manager.handleSlotClick(slot.slotNumber, button, 0);
@@ -62,7 +62,13 @@ public class RecipeHandlerQuery<T extends IRecipeHandler> {
private ArrayList<T> getRecipeHandlersParallel() throws InterruptedException, ExecutionException {
// Pre-find the fuels so we're not fighting over it
FuelRecipeHandler.findFuelsOnceParallel();
if (NEIClientConfig.getBooleanSetting("findFuelsParallel")) {
FuelRecipeHandler.findFuelsOnceParallel();
} else {
FuelRecipeHandler.findFuelsOnce();
}
ArrayList<T> handlers = getSerialHandlersWithRecipes();
handlers.addAll(getHandlersWithRecipes());
handlers.sort(NEIClientConfig.HANDLER_COMPARATOR);
@@ -45,6 +45,7 @@ import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler;
import codechicken.nei.guihook.IContainerTooltipHandler;
import cpw.mods.fml.common.FMLLog;
/**
* A Template Recipe Handler! How about that. Because it was sooo hard, and more seriously required lots of copied code
@@ -108,10 +109,15 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
}
private static FurnaceRecipeHandler.FuelPair identifyFuel(final ItemStack itemStack) {
if (efuels.contains(itemStack.getItem())) return null;
final int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
if (burnTime <= 0) return null;
return new FurnaceRecipeHandler.FuelPair(itemStack.copy(), burnTime);
try {
if (efuels.contains(itemStack.getItem())) return null;
final int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
if (burnTime <= 0) return null;
return new FurnaceRecipeHandler.FuelPair(itemStack.copy(), burnTime);
} catch (Exception e) {
FMLLog.getLogger().error("NEI: Error identifying fuel for item " + itemStack.getItem());
throw e;
}
}
/**
@@ -822,6 +822,7 @@ gt.recipe.largeboilerfakefuels,gregtech:gt.blockmachines:1023,,gregtech,TRUE,gre
gt.recipe.vacuumfreezer,gregtech:gt.blockmachines:1002,,gregtech,TRUE,gregapi_post,,,,,
smelting,gregtech:gt.blockmachines:1003,,gregtech,TRUE,gregapi_post,,,,,
smelting,gregtech:gt.blockmachines:15412,,gregtech,TRUE,gregapi_post,,,,,
smelting,gregtech:gt.blockmachines:31087,,gregtech,TRUE,gregapi_post,,,,,
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1110,,gregtech,TRUE,gregapi_post,,,,,
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1111,,gregtech,TRUE,gregapi_post,,,,,
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1112,,gregtech,TRUE,gregapi_post,,,,,
@@ -1254,8 +1255,6 @@ bw.recipe.biolab,gregtech:gt.blockmachines:12705,,bartworks,TRUE,,,,,,
bw.recipe.biolab,gregtech:gt.blockmachines:12706,,bartworks,TRUE,,,,,,
bw.recipe.biolab,gregtech:gt.blockmachines:12707,,bartworks,TRUE,,,,,,
bw.recipe.biolab,gregtech:gt.blockmachines:12708,,bartworks,TRUE,,,,,,
bw.recipe.biolab,gregtech:gt.blockmachines:12709,,bartworks,TRUE,,,,,,
bw.recipe.biolab,gregtech:gt.blockmachines:12710,,bartworks,TRUE,,,,,,
bw.recipe.BacteriaVat,gregtech:gt.blockmachines:12712,,bartworks,TRUE,,,,,,
gt.recipe.electricimplosioncompressor,gregtech:gt.blockmachines:12734,,bartworks,TRUE,,,,,,
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1113,,GoodGenerator,TRUE,,,,,,
@@ -1484,4 +1483,4 @@ straywolfe.cookingwithtfc.client.nei.ClayOvenRecipeHandler,cookingwithtfc:item.c
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,,,,,,,,,,,
mekanism.client.nei.ElectrolyticSeparatorRecipeHandler,Mekanism:MachineBlock2:4,,Mekanism,TRUE,,,,,,,,,,,
1 handler itemName nbtInfo modId modRequired excludedModId priority minVersion maxVersion forceClassName itemNotes
822 gt.recipe.vacuumfreezer gregtech:gt.blockmachines:1002 gregtech TRUE gregapi_post
823 smelting gregtech:gt.blockmachines:1003 gregtech TRUE gregapi_post
824 smelting gregtech:gt.blockmachines:15412 gregtech TRUE gregapi_post
825 smelting gregtech:gt.blockmachines:31087 gregtech TRUE gregapi_post
826 gt.recipe.dieselgeneratorfuel gregtech:gt.blockmachines:1110 gregtech TRUE gregapi_post
827 gt.recipe.dieselgeneratorfuel gregtech:gt.blockmachines:1111 gregtech TRUE gregapi_post
828 gt.recipe.dieselgeneratorfuel gregtech:gt.blockmachines:1112 gregtech TRUE gregapi_post
1255 bw.recipe.biolab gregtech:gt.blockmachines:12706 bartworks TRUE
1256 bw.recipe.biolab gregtech:gt.blockmachines:12707 bartworks TRUE
1257 bw.recipe.biolab gregtech:gt.blockmachines:12708 bartworks TRUE
bw.recipe.biolab gregtech:gt.blockmachines:12709 bartworks TRUE
bw.recipe.biolab gregtech:gt.blockmachines:12710 bartworks TRUE
1258 bw.recipe.BacteriaVat gregtech:gt.blockmachines:12712 bartworks TRUE
1259 gt.recipe.electricimplosioncompressor gregtech:gt.blockmachines:12734 bartworks TRUE
1260 gt.recipe.dieselgeneratorfuel gregtech:gt.blockmachines:1113 GoodGenerator TRUE
1483 factorization.nei.RecipeGrinder factorization:diamond_cutting_head factorization TRUE
1484 factorization.nei.RecipeMixer factorization:FzBlock:18 factorization TRUE
1485 ua.pp.shurgent.tfctech.nei.WireDrawBenchRecipeHandler tfctech:item.Wire Draw Bench tfctech TRUE
1486 mekanism.client.nei.ElectrolyticSeparatorRecipeHandler Mekanism:MachineBlock2:4 Mekanism TRUE