mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-28 20:06:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3cfb6835f | ||
|
|
bcfec26e0c |
No files matched your search
+5
-1
@@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev')
|
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.17:dev')
|
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.21:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.17:dev')
|
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.17:dev')
|
||||||
compileOnly('com.github.GTNewHorizons:Draconic-Evolution:1.3.10-GTNH:dev')
|
compileOnly('com.github.GTNewHorizons:Draconic-Evolution:1.3.10-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
|
api('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
|
||||||
|
|
||||||
|
// For testing in dev environment.
|
||||||
|
//runtimeOnlyNonPublishable('com.github.GTNewHorizons:StorageDrawers:2.0.2-GTNH')
|
||||||
|
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:waila:1.8.1")
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ public class FindItConfig {
|
|||||||
public static int ITEM_HIGHLIGHTING_DURATION = 10;
|
public static int ITEM_HIGHLIGHTING_DURATION = 10;
|
||||||
public static int BLOCK_HIGHLIGHTING_DURATION = 8;
|
public static int BLOCK_HIGHLIGHTING_DURATION = 8;
|
||||||
public static int ITEM_HIGHLIGHTING_COLOR = 0xFFFF8726;
|
public static int ITEM_HIGHLIGHTING_COLOR = 0xFFFF8726;
|
||||||
|
public static boolean ITEM_HIGHLIGHTING_EMPTY_ITEMSTACKS = true;
|
||||||
|
|
||||||
public static void setup(final File file) {
|
public static void setup(final File file) {
|
||||||
final Configuration config = new Configuration(file);
|
final Configuration config = new Configuration(file);
|
||||||
@@ -82,6 +83,14 @@ public class FindItConfig {
|
|||||||
"FFFF8726",
|
"FFFF8726",
|
||||||
"Item highlighting color as a hexadecimal color code. For example 0xFFFF8726").getString(),
|
"Item highlighting color as a hexadecimal color code. For example 0xFFFF8726").getString(),
|
||||||
16);
|
16);
|
||||||
|
|
||||||
|
ITEM_HIGHLIGHTING_EMPTY_ITEMSTACKS = config.get(
|
||||||
|
Configuration.CATEGORY_GENERAL,
|
||||||
|
"ItemHighlightingEmptyItemStacks",
|
||||||
|
"true",
|
||||||
|
"If true, the item stack size is ignored. If false, items are only highlighted if their stack size is greater than zero.\n"
|
||||||
|
+ "This is useful when working with barrels or storage drawers.")
|
||||||
|
.getBoolean();
|
||||||
} catch (Exception ignore) {} finally {
|
} catch (Exception ignore) {} finally {
|
||||||
if (config.hasChanged()) config.save();
|
if (config.hasChanged()) config.save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import com.gtnh.findit.FindIt;
|
import com.gtnh.findit.FindIt;
|
||||||
|
import com.gtnh.findit.FindItConfig;
|
||||||
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
|
||||||
import com.gtnh.findit.util.ProtoUtils;
|
import com.gtnh.findit.util.ProtoUtils;
|
||||||
import com.gtnh.findit.util.mods.ForestryUtils;
|
import com.gtnh.findit.util.mods.ForestryUtils;
|
||||||
@@ -82,7 +83,24 @@ public class FindItemRequest implements IMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return StackInfo.equalItemAndNBT(targetStack, stack, true);
|
return StackInfo.equalItemAndNBT(targetStack, stack, true) && shouldHighlightItemStack(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether an {@code ItemStack} should be highlighted inside inventories. The method explicitly checks for
|
||||||
|
* empty item stacks and consults the mod's configuration to determine whether empty item stacks should be
|
||||||
|
* highlighted or not.
|
||||||
|
*
|
||||||
|
* @param itemStack The {@code ItemStack} to check.
|
||||||
|
* @return {@code true} if the {@code ItemStack} should be highlighted, {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
private boolean shouldHighlightItemStack(ItemStack itemStack) {
|
||||||
|
// If the user requested to highlight empty item stacks, we early return to make sure that we do so.
|
||||||
|
if (FindItConfig.ITEM_HIGHLIGHTING_EMPTY_ITEMSTACKS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemStack.stackSize > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler implements IMessageHandler<FindItemRequest, BlockFoundResponse> {
|
public static class Handler implements IMessageHandler<FindItemRequest, BlockFoundResponse> {
|
||||||
|
|||||||
Reference in new issue
Block a user